UC_TOTALTUMBLETIME

`Condition1 = TotalTumbleTime 30*TICRATE
"tumble through the air for 30:00"

Also makes all the time-based non-playing Conditions use get_number so TICRATE can be provided
This commit is contained in:
toaster 2023-10-19 20:22:17 +01:00
parent 42233cfb9e
commit d8e6e1d1a4
4 changed files with 28 additions and 6 deletions

View file

@ -2577,8 +2577,8 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
else if (fastcmp(params[0], "PLAYTIME"))
{
PARAMCHECK(1);
ty = UC_PLAYTIME + offset;
re = atoi(params[1]);
ty = UC_PLAYTIME;
re = get_number(params[1]);
}
else if (fastcmp(params[0], "ROUNDSPLAYED"))
{
@ -2624,6 +2624,12 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
return;
}
}
else if (fastcmp(params[0], "TOTALTUMBLETIME"))
{
PARAMCHECK(1);
ty = UC_TOTALTUMBLETIME;
re = get_number(params[1]);
}
else if (fastcmp(params[0], "GAMECLEAR"))
{
ty = UC_GAMECLEAR;
@ -2633,7 +2639,7 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
{
PARAMCHECK(1);
ty = UC_OVERALLTIME;
re = atoi(params[1]);
re = get_number(params[1]);
}
else if ((offset=0) || fastcmp(params[0], "MAPVISITED")
|| (++offset && fastcmp(params[0], "MAPBEATEN"))
@ -2655,7 +2661,7 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
{
PARAMCHECK(2);
ty = UC_MAPTIME;
re = atoi(params[2]);
re = get_number(params[2]);
x1 = G_MapNumber(params[1]);
if (x1 >= nummapheaders)

View file

@ -7658,6 +7658,14 @@ void K_KartPlayerHUDUpdate(player_t *player)
}
else
player->karthud[khud_finish] = 0;
if (demo.playback == false && P_IsLocalPlayer(player) == true)
{
if (player->tumbleBounces != 0 && gamedata->totaltumbletime != UINT32_MAX)
{
gamedata->totaltumbletime++;
}
}
}
#undef RINGANIM_DELAYMAX

View file

@ -649,6 +649,7 @@ void M_ClearStats(void)
UINT8 i;
gamedata->totalplaytime = 0;
gamedata->totalrings = 0;
gamedata->totaltumbletime = 0;
for (i = 0; i < GDGT_MAX; ++i)
gamedata->roundsplayed[i] = 0;
gamedata->timesBeaten = 0;
@ -1286,6 +1287,8 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
}
case UC_TOTALRINGS: // Requires grabbing >= x rings
return (gamedata->totalrings >= (unsigned)cn->requirement);
case UC_TOTALTUMBLETIME: // Requires total tumbling time >= x
return (gamedata->totaltumbletime >= (unsigned)cn->requirement);
case UC_GAMECLEAR: // Requires game beaten >= x times
return (gamedata->timesBeaten >= (unsigned)cn->requirement);
case UC_OVERALLTIME: // Requires overall time <= x
@ -1918,14 +1921,12 @@ static const char *M_GetConditionString(condition_t *cn)
switch (cn->type)
{
case UC_PLAYTIME: // Requires total playing time >= x
return va("play for %i:%02i:%02i",
G_TicsToHours(cn->requirement),
G_TicsToMinutes(cn->requirement, false),
G_TicsToSeconds(cn->requirement));
case UC_ROUNDSPLAYED: // Requires any level completed >= x times
if (cn->extrainfo1 == GDGT_MAX)
work = "";
else if (cn->extrainfo1 != GDGT_RACE && cn->extrainfo1 != GDGT_BATTLE // Base gametypes
@ -1963,6 +1964,11 @@ static const char *M_GetConditionString(condition_t *cn)
return va("collect %u,%03u Rings", (cn->requirement/1000), (cn->requirement%1000));
return va("collect %u Rings", cn->requirement);
case UC_TOTALTUMBLETIME:
return va("tumble through the air for %i:%02i",
G_TicsToMinutes(cn->requirement, true),
G_TicsToSeconds(cn->requirement));
case UC_GAMECLEAR: // Requires game beaten >= x times
if (cn->requirement > 1)
return va("beat game %d times", cn->requirement);

View file

@ -33,6 +33,7 @@ typedef enum
UC_PLAYTIME, // PLAYTIME [tics]
UC_ROUNDSPLAYED, // ROUNDSPLAYED [x played]
UC_TOTALRINGS, // TOTALRINGS [x collected]
UC_TOTALTUMBLETIME, // TOTALTUMBLETIME [tics]
UC_GAMECLEAR, // GAMECLEAR <x times>
UC_OVERALLTIME, // OVERALLTIME [time to beat, tics]
@ -344,6 +345,7 @@ struct gamedata_t
UINT32 totalplaytime;
UINT32 roundsplayed[GDGT_MAX];
UINT32 totalrings;
UINT32 totaltumbletime;
// Chao Key condition bypass
UINT32 pendingkeyrounds;