Move intermission emerald bounce to ticker

This commit is contained in:
Eidolon 2022-04-25 18:33:17 -05:00
parent f34a61156c
commit 8597f3876c

View file

@ -83,6 +83,10 @@ typedef union
INT32 passedx3;
INT32 passedx4;
INT32 emeraldbounces;
INT32 emeraldmomy;
INT32 emeraldy;
y_bonus_t bonuses[2];
patch_t *bonuspatches[2];
@ -646,7 +650,6 @@ void Y_IntermissionDrawer(void)
}
// draw the emeralds
//if (intertic & 1)
if (LUA_HudEnabled(hud_intermissionemeralds))
{
boolean drawthistic = !(ALL7EMERALDS(emeralds) && (intertic & 1));
@ -663,10 +666,6 @@ void Y_IntermissionDrawer(void)
}
else if (em < 7)
{
static UINT8 emeraldbounces = 0;
static INT32 emeraldmomy = 20;
static INT32 emeraldy = -40;
if (drawthistic)
for (i = 0; i < 7; ++i)
{
@ -677,45 +676,15 @@ void Y_IntermissionDrawer(void)
emeraldx = 152 + (em-3)*28;
if (intertic <= 1)
if (intertic > 1)
{
emeraldbounces = 0;
emeraldmomy = 20;
emeraldy = -40;
}
else
{
if (!stagefailed)
if (stagefailed && data.spec.emeraldy < (vid.height/vid.dupy)+16)
{
if (emeraldbounces < 3)
{
emeraldy += (++emeraldmomy);
if (emeraldy > 74)
{
S_StartSound(NULL, sfx_tink); // tink
emeraldbounces++;
emeraldmomy = -(emeraldmomy/2);
emeraldy = 74;
}
}
}
else
{
if (emeraldy < (vid.height/vid.dupy)+16)
{
emeraldy += (++emeraldmomy);
emeraldx += intertic - 6;
}
if (emeraldbounces < 1 && emeraldy > 74)
{
S_StartSound(NULL, sfx_shldls); // nope
emeraldbounces++;
emeraldmomy = -(emeraldmomy/2);
emeraldy = 74;
}
emeraldx += intertic - 6;
}
if (drawthistic)
V_DrawScaledPatch(emeraldx, emeraldy, 0, emeraldpics[0][em]);
V_DrawScaledPatch(emeraldx, data.spec.emeraldy, 0, emeraldpics[0][em]);
}
}
}
@ -1153,6 +1122,45 @@ void Y_Ticker(void)
S_ChangeMusicInternal("_clear", false); // don't loop it
tallydonetic = -1;
}
// emerald bounce
if (intertic <= 1)
{
data.spec.emeraldbounces = 0;
data.spec.emeraldmomy = 20;
data.spec.emeraldy = -40;
}
else
{
if (!stagefailed)
{
if (data.spec.emeraldbounces < 3)
{
data.spec.emeraldy += (++data.spec.emeraldmomy);
if (data.spec.emeraldy > 74)
{
S_StartSound(NULL, sfx_tink); // tink
data.spec.emeraldbounces++;
data.spec.emeraldmomy = -(data.spec.emeraldmomy/2);
data.spec.emeraldy = 74;
}
}
}
else
{
if (data.spec.emeraldy < (vid.height/vid.dupy)+16)
{
data.spec.emeraldy += (++data.spec.emeraldmomy);
}
if (data.spec.emeraldbounces < 1 && data.spec.emeraldy > 74)
{
S_StartSound(NULL, sfx_shldls); // nope
data.spec.emeraldbounces++;
data.spec.emeraldmomy = -(data.spec.emeraldmomy/2);
data.spec.emeraldy = 74;
}
}
}
if (intertic < 2*TICRATE) // TWO second pause before tally begins, thank you mazmazz
return;