- applied a few fixes:

* removed the timer callback stuff that came back through the backdoor.
* do not use gameclock in the UI code - use the underlying timer directly.
* UpdateSounds must still use totalclock, until this can be refactored in its entirety.
This commit is contained in:
Christoph Oelckers 2020-08-25 20:20:35 +02:00
parent c888bc802d
commit 8256b54005
5 changed files with 12 additions and 26 deletions

View file

@ -113,20 +113,6 @@ void InputState::ClearAllInput()
}
//==========================================================================
//
//
//
//==========================================================================
TArray<void(*)(void)> callbacks;
void(*timerSetCallback(void(*callback)(void)))(void)
{
callbacks.Push(callback);
return nullptr;
}
//==========================================================================
//
//
@ -159,8 +145,6 @@ int32_t handleevents(void)
setsizeneeded = false;
}
for (auto cb : callbacks) cb();
I_StartFrame();
I_StartTic();
return 0;

View file

@ -60,7 +60,5 @@ public:
extern InputState inputState;
void (*timerSetCallback(void (*callback)(void)))(void);
void CONTROL_GetInput(ControlInfo* info);
int32_t handleevents(void);

View file

@ -65,11 +65,12 @@ static void Menu_DrawBackground(const DVector2 &origin)
static void Menu_DrawCursor(double x, double y, double scale, bool right)
{
int mclock = I_GetBuildTime();
const int frames = isRR() ? 16 : 7;
int picnum;
if (!right) picnum = TILE_SPINNINGNUKEICON + ((gameclock >> 3) % frames);
else picnum = TILE_SPINNINGNUKEICON + frames - 1 - ((frames - 1 + (gameclock >> 3)) % frames);
int light = int(224 + 31 * sin(gameclock / 20.));
if (!right) picnum = TILE_SPINNINGNUKEICON + ((mclock >> 3) % frames);
else picnum = TILE_SPINNINGNUKEICON + frames - 1 - ((frames - 1 + (mclock >> 3)) % frames);
int light = int(224 + 31 * sin(mclock / 20.));
PalEntry pe(255, light, light, light);
DrawTexture(twod, tileGetTexture(picnum), x, y, DTA_FullscreenScale, FSMode_Fit320x200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_Color, pe, DTA_CenterOffsetRel, true, TAG_DONE);
}
@ -153,7 +154,8 @@ class DukeMainMenu : public DukeListMenu
DrawTexture(twod, tileGetTexture(TILE_INGAMEDUKETHREEDEE), x, origin.Y + 29, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffsetRel, true, TAG_DONE);
if (PLUTOPAK)
{
int light = 224 + 31 * sin(gameclock / 40.);
int mclock = I_GetBuildTime();
int light = 224 + 31 * sin(mclock / 40.);
PalEntry pe(255, light, light, light);
DrawTexture(twod, tileGetTexture(TILE_PLUTOPAKSPRITE + 2), x + 100, origin.Y + 36, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_Color, pe, DTA_CenterOffsetRel, true, TAG_DONE);
}
@ -186,7 +188,8 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double oxpos, dou
else if (state == NIT_SelectedState)
{
trans = 0;
int light = 224 + 31 * sin(gameclock / 20.);
int mclock = I_GetBuildTime();
int light = 224 + 31 * sin(mclock / 20.);
pe = PalEntry(255, light, light, light);
}
else
@ -346,8 +349,9 @@ static int GetPlayerColor(int color)
void GameInterface::DrawPlayerSprite(const DVector2& origin, bool onteam)
{
int mclock = I_GetBuildTime();
int color = TRANSLATION(Translation_Remap, playercolor2lookup(playercolor));
int tile = isRR() ? 3845 + 36 - ((((8 - (gameclock >> 4))) & 7) * 5) : 1441 - ((((4 - (gameclock >> 4))) & 3) * 5);
int tile = isRR() ? 3845 + 36 - ((((8 - (mclock >> 4))) & 7) * 5) : 1441 - ((((4 - (mclock >> 4))) & 3) * 5);
auto tex = tileGetTexture(tile);
if (!tex) return;
double x = origin.X + 260, y = origin.Y + tex->GetDisplayHeight() * (isRR()? 0.25 : 0.5);

View file

@ -353,7 +353,7 @@ void S_Update(void)
}
listener.ListenerObject = ud.camerasprite == -1 ? nullptr : &sprite[ud.camerasprite];
soundEngine->SetListener(listener);
soundEngine->UpdateSounds(gameclock);
soundEngine->UpdateSounds(totalclock);
}

View file

@ -604,7 +604,7 @@ void DoUpdateSounds(void)
soundEngine->SetListener(listener);
UpdateAmbients();
soundEngine->UpdateSounds(gameclock);
soundEngine->UpdateSounds(totalclock);
}
//==========================================================================