mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
CDemoEditor: slice begin/end markers added
This commit is contained in:
parent
65b2426349
commit
f1ee4aa48c
|
@ -2755,7 +2755,7 @@ void CClient::Con_RemoveFavorite(IConsole::IResult *pResult, void *pUserData)
|
|||
void CClient::DemoSliceBegin()
|
||||
{
|
||||
const CDemoPlayer::CPlaybackInfo *pInfo = m_DemoPlayer.Info();
|
||||
g_Config.m_ClDemoSliceStart = pInfo->m_Info.m_CurrentTick;
|
||||
g_Config.m_ClDemoSliceBegin = pInfo->m_Info.m_CurrentTick;
|
||||
}
|
||||
|
||||
void CClient::DemoSliceEnd()
|
||||
|
@ -2793,7 +2793,7 @@ void CClient::DemoSlice()
|
|||
char aDstName[256];
|
||||
str_format(aDstName, sizeof(aDstName), "%s_sliced.demo", aPathNoExt);
|
||||
|
||||
m_DemoEditor.Slice(pDemoFileName, aDstName, g_Config.m_ClDemoSliceStart, g_Config.m_ClDemoSliceEnd);
|
||||
m_DemoEditor.Slice(pDemoFileName, aDstName, g_Config.m_ClDemoSliceBegin, g_Config.m_ClDemoSliceEnd);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -313,7 +313,7 @@ MACRO_CONFIG_INT(ClConfirmDisconnect, cl_confirm_disconnect, 0, 0, 1, CFGFLAG_SA
|
|||
MACRO_CONFIG_STR(ClTimeoutCode, cl_timeout_code, 64, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Timeout code to use")
|
||||
|
||||
// demo editor
|
||||
MACRO_CONFIG_INT(ClDemoSliceStart, cl_demo_slice_start, -1, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
|
||||
MACRO_CONFIG_INT(ClDemoSliceBegin, cl_demo_slice_begin, -1, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
|
||||
MACRO_CONFIG_INT(ClDemoSliceEnd, cl_demo_slice_end, -1, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <engine/console.h>
|
||||
#include <engine/storage.h>
|
||||
|
||||
#include <engine/shared/config.h>
|
||||
|
||||
#include "compression.h"
|
||||
#include "demo.h"
|
||||
#include "memheap.h"
|
||||
|
@ -692,6 +694,10 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const
|
|||
// scan the file for interessting points
|
||||
ScanFile();
|
||||
|
||||
// reset slice markers
|
||||
g_Config.m_ClDemoSliceBegin = -1;
|
||||
g_Config.m_ClDemoSliceEnd = -1;
|
||||
|
||||
// ready for playback
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -104,6 +104,31 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
Graphics()->QuadsEnd();
|
||||
}
|
||||
|
||||
// draw slice markers
|
||||
// begin
|
||||
if (g_Config.m_ClDemoSliceBegin != -1)
|
||||
{
|
||||
float Ratio = (g_Config.m_ClDemoSliceBegin-pInfo->m_FirstTick) / (float)TotalTicks;
|
||||
Graphics()->TextureSet(-1);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
IGraphics::CQuadItem QuadItem(10.0f + SeekBar.x + (SeekBar.w-10.0f)*Ratio, SeekBar.y, UI()->PixelSize(), SeekBar.h);
|
||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
}
|
||||
|
||||
// end
|
||||
if (g_Config.m_ClDemoSliceEnd != -1)
|
||||
{
|
||||
float Ratio = (g_Config.m_ClDemoSliceEnd-pInfo->m_FirstTick) / (float)TotalTicks;
|
||||
Graphics()->TextureSet(-1);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
IGraphics::CQuadItem QuadItem(10.0f + SeekBar.x + (SeekBar.w-10.0f)*Ratio, SeekBar.y, UI()->PixelSize(), SeekBar.h);
|
||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
}
|
||||
|
||||
// draw time
|
||||
str_format(aBuffer, sizeof(aBuffer), "%d:%02d / %d:%02d",
|
||||
CurrentTick/SERVER_TICK_SPEED/60, (CurrentTick/SERVER_TICK_SPEED)%60,
|
||||
|
|
Loading…
Reference in a new issue