From c5a9be9d288acaac92898c72b13d1b8d25f3c96e Mon Sep 17 00:00:00 2001 From: Antonio Martinez Date: Sun, 29 Sep 2024 21:13:27 -0700 Subject: [PATCH] TA2, attempt 2 --- src/d_player.h | 1 + src/f_finale.c | 21 ++++++++++++++++++--- src/k_kart.c | 39 +++++++++++++++++++++++++++++---------- src/lua_playerlib.c | 4 ++++ src/p_saveg.c | 2 ++ 5 files changed, 54 insertions(+), 13 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index f6397d682..f9dab30a4 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -1050,6 +1050,7 @@ struct player_t UINT8 ringboxdelay; // Delay until Ring Box auto-activates UINT8 ringboxaward; // Where did we stop? + UINT32 lastringboost; // What was our accumulated boost when locking the award? UINT8 amps; UINT8 amppickup; diff --git a/src/f_finale.c b/src/f_finale.c index 55fec2aa7..1584009d8 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -923,6 +923,14 @@ void F_IntroTicker(void) S_StartSound(NULL, sfx_supflk); } + if (skiptype == 5) // Quick Race Menu + { + ResetSkipSequences(); + M_StartControlPanel(); + currentMenu = &PLAY_RaceGamemodesDef; + return; + } + if (doskip && disclaimerskippable) { if (dc_state == DISCLAIMER_FINAL) { @@ -1013,16 +1021,21 @@ static void AdvanceSkipSequences(UINT8 input) UINT8 s2cheat[] = {1, 1, 1}; UINT8 s3cheat[] = {2, 2, 2}; UINT8 s3kcheat[] = {3, 3, 3}; + UINT8 spincheat[] = {4, 4, 4}; #else UINT8 s2cheat[] = {1, 1, 1, 3, 3, 3, 1}; UINT8 s3cheat[] = {1, 1, 3, 3, 1, 1, 1, 1}; UINT8 s3kcheat[] = {4, 4, 4, 2, 2, 2, 1, 1, 1}; + UINT8 spincheat[] = {1, 2, 3, 4, 3, 2, 1}; #endif UINT8 nicetry[] = {1, 1, 3, 3, 4, 2, 4, 2}; - UINT8 *cheats[4] = {s2cheat, s3cheat, s3kcheat, nicetry}; - UINT8 cheatlengths[4] = {sizeof(s2cheat), sizeof(s3cheat), sizeof(s3kcheat), sizeof(nicetry)}; - for (UINT8 i = 0; i < 4; i++) // for each cheat... + #define NUMCHEATS 5 + + UINT8 *cheats[NUMCHEATS] = {s2cheat, s3cheat, s3kcheat, nicetry, spincheat}; + UINT8 cheatlengths[NUMCHEATS] = {sizeof(s2cheat), sizeof(s3cheat), sizeof(s3kcheat), sizeof(nicetry), sizeof(spincheat)}; + + for (UINT8 i = 0; i < NUMCHEATS; i++) // for each cheat... { UINT8 cheatsize = cheatlengths[i]; boolean matched = true; @@ -1040,6 +1053,8 @@ static void AdvanceSkipSequences(UINT8 input) skiptype = i+1; } + #undef NUMCHEATS + skipinputindex++; } diff --git a/src/k_kart.c b/src/k_kart.c index 17346da8f..9baa7a933 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -292,7 +292,7 @@ void K_TimerInit(void) if (G_TimeAttackStart()) { - starttime = 15*TICRATE; // Longest permitted start. No half-laps in reverse. + starttime = 6*TICRATE; // Longest permitted start. No half-laps in reverse. // (Changed on finish line cross later, don't worry.) } @@ -9304,13 +9304,20 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) // extreme ringboost duration. Less aggressive for accel types, so they // retain more speed for small payouts. + // 2.4: Even if it IS paying out, if the duration gets extreme, + // start applying decay anyway! + UINT8 roller = TICRATE*2; roller += 4*(8-player->kartspeed); + // UINT16 oldringboost = player->ringboost; + if (player->superring == 0) player->ringboost -= max((player->ringboost / roller), 1); else - player->ringboost--; + player->ringboost -= min(K_GetFullKartRingPower(player, false) - 1, max(player->ringboost / 2 / roller, 1)); + + // CONS_Printf("%d - %d\n", player->ringboost, oldringboost - player->ringboost); } if (player->sneakertimer) @@ -9583,7 +9590,13 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->superring) { player->nextringaward++; - UINT8 ringrate = 3 - min(2, player->superring / 20); // Used to consume fat stacks of cash faster. + + UINT8 fastringscaler = (K_GetKartGameSpeedScalar(gamespeed) > FRACUNIT) ? 20 : 20; // If G3 / TA gets out of control, can speed up all ring box payout + + UINT32 existing = (player->lastringboost / K_GetFullKartRingPower(player, true)); // How many rings (effectively) do we have boost credit for right now? + + UINT8 ringrate = 3 - min(2, (player->superring + existing) / fastringscaler); // Used to consume fat stacks of cash faster. + if (player->nextringaward >= ringrate) { mobj_t *ring = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_RING); @@ -13029,6 +13042,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->ringboxdelay--; if (player->ringboxdelay == 0) { + player->lastringboost = player->ringboost; UINT32 award = 5*player->ringboxaward + 10; if (!K_ThunderDome()) award = 3 * award / 2; @@ -13057,22 +13071,23 @@ void K_MoveKartPlayer(player_t *player, boolean onground) // Relative stat power for bonus TA Ring Box awards. // AP 1, WP 2 = weight is worth twice what accel is. - UINT8 accelPower = 1; - UINT8 weightPower = 2; + // 0 = stat not considered at all! + UINT8 accelPower = 0; + UINT8 weightPower = 4; UINT8 total = accelPower*accel + weightPower*weight; UINT8 maxtotal = accelPower*9 + weightPower*9; // Scale from base payout at 9/1 to max payout at 1/9. - award = Easing_OutSine(FRACUNIT*total/maxtotal, award, 18*award/10); + award = Easing_InCubic(FRACUNIT*total/maxtotal, 13*award/10, 18*award/10); // And, because we don't have to give a damn about sandbagging, up the stakes the longer we progress! if (gametyperules & GTR_CIRCUIT) { - // This should be based on completion percentage, but I looked at - // the circuitlength stuff and immediately gave up - fixed_t marginTime = FixedDiv(leveltime, TICRATE*60*2); - award = Easing_Linear(min(marginTime, FRACUNIT), award, 3*award/2); + UINT8 maxgrade = 10; + UINT8 margin = min(player->gradingpointnum, maxgrade); + + award = Easing_Linear(FRACUNIT * margin / maxgrade, award, 2*award); } } else @@ -13084,6 +13099,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground) award = award * (behindMulti + 10) / 10; } + // Felt kinda arbitrary, replaced with G3+ fast payout. Sealed away for later...? + + /* // Stacked Ring Box is good. REALLY good. "Uncapped speed that feeds into itself" good. // Keep highly unusual values under control, using the following core rule: // If we already have more boost than we're about to be awarded, STOP!!! @@ -13092,6 +13110,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) fixed_t reductionfactor = FixedDiv(FRACUNIT*reduction, FRACUNIT*award); // ...get a ratio to compare our potential award against it. 0 = no existing boost, 1+ = existing boost comparable to our award. reductionfactor = min(reductionfactor, FRACUNIT); // Cap for easing function, and... award = Easing_Linear(reductionfactor, award, award/4); // ...ease between unmodified and minimum award. + */ K_AwardPlayerRings(player, award, true); player->ringboxaward = 0; diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 2b6c7b07e..99edf5a86 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -288,6 +288,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->ringboxdelay); else if (fastcmp(field,"ringboxaward")) lua_pushinteger(L, plr->ringboxaward); + else if (fastcmp(field,"lastringboost")) + lua_pushinteger(L, plr->lastringboost); else if (fastcmp(field,"amps")) lua_pushinteger(L, plr->amps); else if (fastcmp(field,"amppickup")) @@ -892,6 +894,8 @@ static int player_set(lua_State *L) plr->ringboxdelay = luaL_checkinteger(L, 3); else if (fastcmp(field,"ringboxaward")) plr->ringboxaward = luaL_checkinteger(L, 3); + else if (fastcmp(field,"lastringboost")) + plr->lastringboost = luaL_checkinteger(L, 3); else if (fastcmp(field,"amps")) plr->amps = luaL_checkinteger(L, 3); else if (fastcmp(field,"amppickup")) diff --git a/src/p_saveg.c b/src/p_saveg.c index f7e4b53ae..cea456f8a 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -655,6 +655,7 @@ static void P_NetArchivePlayers(savebuffer_t *save) WRITEUINT8(save->p, players[i].ringboxdelay); WRITEUINT8(save->p, players[i].ringboxaward); + WRITEUINT32(save->p, players[i].lastringboost); WRITEUINT8(save->p, players[i].amps); WRITEUINT8(save->p, players[i].amppickup); @@ -1289,6 +1290,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save) players[i].ringboxdelay = READUINT8(save->p); players[i].ringboxaward = READUINT8(save->p); + players[i].lastringboost = READUINT32(save->p); players[i].amps =READUINT8(save->p); players[i].amppickup =READUINT8(save->p);