From 2360516e660765f66731a2f3239021fc8a8f9383 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 12 Nov 2017 22:48:32 -0500 Subject: [PATCH] Yet more comeback stuff! - You can now choose to carry an item to someone instead of bombing - You need to bomb someone or give an item a combined total of three times in order to come back. - Bombing somone gives 2 points while giving items doesn't award you any points. - Position number still flashes after you've won, and it flashes rainbow for people who have won and are in 1st place! - Flashing players can no longer eat items - Fixed kartstarsfx playing the alarm in conjunction with music - Fixed some items no longer causing wipeout --- src/d_player.h | 8 ++++-- src/k_kart.c | 59 ++++++++++++++++++++++++++++++++++++----- src/p_enemy.c | 2 ++ src/p_inter.c | 38 ++++++++++++++++++++++++++- src/p_map.c | 71 +++++++++++++++++++++++++++++++++++++++++--------- src/p_user.c | 3 --- 6 files changed, 157 insertions(+), 24 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 287a8fee9..0e4a8090b 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -307,8 +307,12 @@ typedef enum k_lightning, // 0x1 = Lightning in inventory k_feather, // 0x1 = Feather in inventory, 0x2 = Player is feather jumping k_kitchensink, // 0x1 = Sink in inventory - k_balloon, // Battle mode, number of balloons left - k_comebackhits, // Battle mode, number of times hit in comeback mode + + // Battle Mode vars + k_balloon, // Number of balloons left + k_comebackhits, // Number of times hit in comeback mode + k_comebackpoints, // Number of times you've bombed or gave an item to someone; once it's 3 it gets set back to 0 and you're given a balloon + k_comebackmode, // 0 = bomb, 1 = item NUMKARTSTUFF } kartstufftype_t; diff --git a/src/k_kart.c b/src/k_kart.c index 251a776bf..352ca3939 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1449,6 +1449,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_comebackhits] > 5) player->kartstuff[k_comebackhits] = 5; + else if (player->kartstuff[k_comebackhits] < 0) + player->kartstuff[k_comebackhits] = 0; // ??? /* @@ -1461,6 +1463,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) } */ + if (player->kartstuff[k_comebacktimer]) + player->kartstuff[k_comebackmode] = 0; + if (P_IsObjectOnGround(player->mo) && !(player->mo->momz) && player->kartstuff[k_feather] & 2) player->kartstuff[k_feather] &= ~2; @@ -1493,10 +1498,11 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) S_StopSoundByID(player->mo, sfx_mega); // Stop it } + // AAAAAAND handle the SMK star alarm if (player->mo->health > 0 && (player->mo->player->kartstuff[k_startimer] > 0 || player->mo->player->kartstuff[k_growshrinktimer] > 0)) { - if (leveltime % 13 == 0 && !P_IsLocalPlayer(player)) + if (leveltime % 13 == 0 && cv_kartstarsfx.value && !P_IsLocalPlayer(player)) S_StartSound(player->mo, sfx_smkinv); } else if (S_SoundPlaying(player->mo, sfx_smkinv)) @@ -1880,7 +1886,7 @@ void K_StealBalloon(player_t *player, player_t *victim) || victim->kartstuff[k_startimer] > 0 || victim->kartstuff[k_growshrinktimer] > 0 || victim->kartstuff[k_bootimer] > 0)) return; - CONS_Printf(M_GetText("%s stole a balloon from %s!\n"), player_names[player-players], player_names[victim-players]); + //CONS_Printf(M_GetText("%s stole a balloon from %s!\n"), player_names[player-players], player_names[victim-players]); newballoon = player->kartstuff[k_balloon]; if (newballoon <= 1) @@ -1907,6 +1913,7 @@ void K_StealBalloon(player_t *player, player_t *victim) P_SetMobjState(newmo, S_BATTLEBALLOON1); player->kartstuff[k_balloon]++; + player->powers[pw_flashing] = flashingtics; return; } @@ -3361,7 +3368,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { player->mo->flags2 &= ~MF2_DONTDRAW; } - + if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) // dead in match? you da bomb { K_StripItems(player); @@ -3383,6 +3390,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->powers[pw_flashing] = player->kartstuff[k_comebacktimer]; } + else if (player->kartstuff[k_comebackmode] != 0) + player->mo->tracer->flags2 |= MF2_DONTDRAW; else player->mo->tracer->flags2 &= ~MF2_DONTDRAW; } @@ -3468,7 +3477,7 @@ void K_CheckBalloons(void) UINT8 numingame = 0; INT8 winnernum = -1; -// Quick thing for testing comeback in splitscreen +// Set to 1 if you need to test comeback in splitscreen #if 0 return; #endif @@ -3527,6 +3536,7 @@ static patch_t *kp_lapstickernarrow; static patch_t *kp_lakitustart[NUMLAKIFRAMES]; static patch_t *kp_lakitulaps[17]; static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES]; +static patch_t *kp_winnernum[NUMPOSFRAMES]; static patch_t *kp_facenull; static patch_t *kp_facefirst; static patch_t *kp_facesecond; @@ -3663,6 +3673,13 @@ void K_LoadKartHUDGraphics(void) kp_positionnum[i][j] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); } } + + for (i = 0; i < NUMPOSFRAMES; i++) + { + sprintf(buffer, "K_POSNW%d", i); + kp_winnernum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + } + kp_facenull = W_CachePatchName("K_PFACE0", PU_HUDGFX); kp_facefirst = W_CachePatchName("K_PFACE1", PU_HUDGFX); kp_facesecond = W_CachePatchName("K_PFACE2", PU_HUDGFX); @@ -4222,8 +4239,38 @@ static void K_DrawKartPositionNum(INT32 num) { X -= W; - // Check for the final lap - if (stplyr->laps+1 == cv_numlaps.value) + if (stplyr->exiting && num == 1) // 1st place winner? You get rainbows!! + { + // Alternate frame every three frames + switch (leveltime % 21) + { + case 1: case 2: case 3: + localpatch = kp_winnernum[0]; + break; + case 4: case 5: case 6: + localpatch = kp_winnernum[1]; + break; + case 7: case 8: case 9: + localpatch = kp_winnernum[2]; + break; + case 10: case 11: case 12: + localpatch = kp_winnernum[3]; + break; + case 13: case 14: case 15: + localpatch = kp_winnernum[4]; + break; + case 16: case 17: case 18: + localpatch = kp_winnernum[5]; + break; + case 19: case 20: case 21: + localpatch = kp_winnernum[6]; + break; + default: + localpatch = kp_positionnum[1][0]; + break; + } + } + else if (stplyr->laps+1 == cv_numlaps.value || stplyr->exiting) // Check for the final lap, or won { // Alternate frame every three frames switch (leveltime % 9) diff --git a/src/p_enemy.c b/src/p_enemy.c index a9704f66f..deeb7b82e 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3633,6 +3633,8 @@ void A_AttractChase(mobj_t *actor) || !P_CheckSight(actor, actor->tracer)) // You have to be able to SEE it...sorta { // Lost attracted rings don't through walls anymore. + if (actor->tracer && actor->tracer->player) + actor->tracer->player->kartstuff[k_comebackmode] = 0; actor->flags &= ~MF_NOCLIP; P_SetTarget(&actor->tracer, NULL); return; diff --git a/src/p_inter.c b/src/p_inter.c index 684c09137..a3d911201 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -410,8 +410,39 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { case MT_RANDOMITEM: // SRB2kart case MT_FLINGRANDOMITEM: + if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) + { + if (player->kartstuff[k_comebackmode] == 0 && !player->kartstuff[k_comebacktimer]) + { + P_SetTarget(&special->tracer, toucher); + player->kartstuff[k_comebackmode] = 1; + } + return; + } + if (!P_CanPickupItem(player, false) && special->tracer != toucher) return; + + if (gametype != GT_RACE && special->tracer && special->tracer->player) + { + special->tracer->player->kartstuff[k_comebackmode] = 0; + + special->tracer->player->kartstuff[k_comebackpoints]++; + CONS_Printf(M_GetText("%s gave an item to %s.\n"), player_names[special->tracer->player-players], player_names[player-players]); + + if (special->tracer->player->kartstuff[k_comebackpoints] >= 3) + { + K_StealBalloon(special->tracer->player, player); + special->tracer->player->kartstuff[k_comebackpoints] = 0; + CONS_Printf(M_GetText("%s is back in the game!\n"), player_names[special->tracer->player-players]); + } + + special->tracer->player->kartstuff[k_comebackhits]--; + if (special->tracer->player->kartstuff[k_comebackhits] < 0) + special->tracer->player->kartstuff[k_comebackhits] = 0; + special->tracer->player->kartstuff[k_comebacktimer] = comebacktime * (special->tracer->player->kartstuff[k_comebackhits]+1); + } + special->momx = special->momy = special->momz = 0; P_SetTarget(&special->target, toucher); P_SetMobjState(special, special->info->deathstate); @@ -3167,7 +3198,12 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da return false; else { - if (inflictor && (inflictor->type == MT_GREENITEM || inflictor->type == MT_REDITEM || inflictor->type == MT_REDITEMDUD || inflictor->player)) + if (inflictor && (inflictor->type == MT_GREENITEM || inflictor->type == MT_GREENSHIELD + || inflictor->type == MT_REDITEM || inflictor->type == MT_REDSHIELD || inflictor->type == MT_REDITEMDUD + || inflictor->type == MT_FAKEITEM || inflictor->type == MT_FAKESHIELD + || inflictor->type == MT_TRIPLEGREENSHIELD1 || inflictor->type == MT_TRIPLEGREENSHIELD2 || inflictor->type == MT_TRIPLEGREENSHIELD3 + || inflictor->type == MT_TRIPLEREDSHIELD1 || inflictor->type == MT_TRIPLEREDSHIELD2 || inflictor->type == MT_TRIPLEREDSHIELD3 + || inflictor->player)) { player->kartstuff[k_spinouttype] = 1; K_SpinPlayer(player, source); diff --git a/src/p_map.c b/src/p_map.c index 924ddf462..ca40ba7d2 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -675,6 +675,9 @@ static boolean PIT_CheckThing(mobj_t *thing) && (tmthing->target == thing->target)) // Don't hit each other if you have the same target return true; + if (thing->player && thing->player->powers[pw_flashing]) + return true; + if (thing->type == MT_PLAYER) { // Player Damage @@ -810,6 +813,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (((tmthing->target == thing) || (tmthing->target == thing->target)) && (tmthing->threshold > 0 || (thing->type != MT_PLAYER && thing->threshold > 0))) return true; + if (thing->player && thing->player->powers[pw_flashing]) + return true; + if (thing->type == MT_PLAYER) { S_StartSound(NULL, sfx_cgot); //let all players hear it. @@ -834,6 +840,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (!(thing->type == MT_PLAYER)) return true; + if (thing->player && thing->player->powers[pw_flashing]) + return true; + if (thing->type == MT_PLAYER) { K_SpinPlayer(thing->player, tmthing->target); @@ -865,6 +874,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->type == MT_FIREBALL && thing->type == MT_FIREBALL) return true; // Fireballs don't collide with eachother + if (thing->player && thing->player->powers[pw_flashing]) + return true; + if (thing->type == MT_PLAYER) { // Player Damage @@ -962,6 +974,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->health <= 0 || thing->health <= 0) return true; + if (thing->player && thing->player->powers[pw_flashing]) + return true; + if (thing->type == MT_GREENITEM // When these items collide with the fake item, just the fake item is destroyed || thing->type == MT_REDITEM || thing->type == MT_REDITEMDUD || thing->type == MT_BOMBITEM @@ -1045,6 +1060,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->health <= 0 || thing->health <= 0) return true; + if (thing->player && thing->player->powers[pw_flashing]) + return true; + if (thing->type == MT_PLAYER) { P_KillMobj(tmthing, thing, thing); @@ -1089,6 +1107,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->z + tmthing->height < thing->z) return true; // underneath + if (tmthing->player && tmthing->player->powers[pw_flashing]) + return true; + if (thing->type == MT_GREENSHIELD || thing->type == MT_TRIPLEGREENSHIELD1 || thing->type == MT_TRIPLEGREENSHIELD2 || thing->type == MT_TRIPLEGREENSHIELD3 || thing->type == MT_REDSHIELD || thing->type == MT_TRIPLEREDSHIELD1 || thing->type == MT_TRIPLEREDSHIELD2 || thing->type == MT_TRIPLEREDSHIELD3 || thing->type == MT_GREENITEM || thing->type == MT_REDITEM || thing->type == MT_REDITEMDUD @@ -1606,49 +1627,71 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player->kartstuff[k_growshrinktimer] || thing->player->kartstuff[k_squishedtimer] || thing->player->kartstuff[k_bootimer] || thing->player->kartstuff[k_spinouttimer] || thing->player->kartstuff[k_startimer] || thing->player->kartstuff[k_justbumped] - || (gametype != GT_RACE && (thing->player->kartstuff[k_balloon] <= 0 && thing->player->kartstuff[k_comebacktimer])) + || (gametype != GT_RACE && (thing->player->kartstuff[k_balloon] <= 0 + && (thing->player->kartstuff[k_comebacktimer] || thing->player->kartstuff[k_comebackmode] == 1))) || tmthing->player->kartstuff[k_growshrinktimer] || tmthing->player->kartstuff[k_squishedtimer] || tmthing->player->kartstuff[k_bootimer] || tmthing->player->kartstuff[k_spinouttimer] || tmthing->player->kartstuff[k_startimer] || tmthing->player->kartstuff[k_justbumped] - || (gametype != GT_RACE && (tmthing->player->kartstuff[k_balloon] <= 0 && tmthing->player->kartstuff[k_comebacktimer]))) + || (gametype != GT_RACE && (tmthing->player->kartstuff[k_balloon] <= 0 + && (tmthing->player->kartstuff[k_comebacktimer] || tmthing->player->kartstuff[k_comebackmode] == 1)))) { return true; } if (gametype != GT_RACE) { - if (thing->player->kartstuff[k_balloon] <= 0 || tmthing->player->kartstuff[k_balloon] <= 0) + if ((thing->player->kartstuff[k_balloon] <= 0 || tmthing->player->kartstuff[k_balloon] <= 0) + && (thing->player->kartstuff[k_comebackmode] == 0 && tmthing->player->kartstuff[k_comebackmode] == 0)) { - thing->player->kartstuff[k_justbumped] = 6; - tmthing->player->kartstuff[k_justbumped] = 6; - if (tmthing->player->kartstuff[k_balloon] > 0) { - if (tmthing->player->kartstuff[k_balloon] == 1) + thing->player->kartstuff[k_comebackpoints]++; + CONS_Printf(M_GetText("%s bombed %s!\n"), player_names[thing->player-players], player_names[tmthing->player-players]); + + if (thing->player->kartstuff[k_comebackpoints] >= 3) + { K_StealBalloon(thing->player, tmthing->player); + thing->player->kartstuff[k_comebackpoints] = 0; + CONS_Printf(M_GetText("%s is back in the game!\n"), player_names[thing->player-players]); + } K_ExplodePlayer(tmthing->player, thing); - P_AddPlayerScore(thing->player, 1); // 2 points instead of 1 for getting someone in comeback mode + P_AddPlayerScore(thing->player, 1); // 2 points instead of 1 for getting someone in comeback mode, since it's REALLY tough :V + + thing->player->kartstuff[k_comebackhits]--; + if (thing->player->kartstuff[k_comebackhits] < 0) + thing->player->kartstuff[k_comebackhits] = 0; - thing->player->kartstuff[k_comebackhits]++; thing->player->kartstuff[k_comebacktimer] = comebacktime * (thing->player->kartstuff[k_comebackhits]+1); return true; } else if (thing->player->kartstuff[k_balloon] > 0) { - if (thing->player->kartstuff[k_balloon] == 1) + tmthing->player->kartstuff[k_comebackpoints]++; + CONS_Printf(M_GetText("%s bombed %s!\n"), player_names[tmthing->player-players], player_names[thing->player-players]); + + if (tmthing->player->kartstuff[k_comebackpoints] >= 3) + { K_StealBalloon(tmthing->player, thing->player); + thing->player->kartstuff[k_comebackpoints] = 0; + CONS_Printf(M_GetText("%s is back in the game!\n"), player_names[tmthing->player-players]); + } K_ExplodePlayer(thing->player, tmthing); - P_AddPlayerScore(thing->player, 1); // 2 points instead of 1 for getting someone in comeback mode + P_AddPlayerScore(tmthing->player, 1); // 2 points instead of 1 for getting someone in comeback mode, since it's REALLY tough :V + + tmthing->player->kartstuff[k_comebackhits]--; + if (tmthing->player->kartstuff[k_comebackhits] < 0) + tmthing->player->kartstuff[k_comebackhits] = 0; - tmthing->player->kartstuff[k_comebackhits]++; tmthing->player->kartstuff[k_comebacktimer] = comebacktime * (tmthing->player->kartstuff[k_comebackhits]+1); return true; } else if (thing->player->kartstuff[k_balloon] <= 0 && tmthing->player->kartstuff[k_balloon] <= 0) { K_KartBouncing(tmthing, thing, false); + thing->player->kartstuff[k_justbumped] = 6; + tmthing->player->kartstuff[k_justbumped] = 6; K_SpinPlayer(thing->player, tmthing); K_SpinPlayer(tmthing->player, thing); @@ -1669,6 +1712,7 @@ static boolean PIT_CheckThing(mobj_t *thing) { K_StealBalloon(tmthing->player, thing->player); K_SpinPlayer(thing->player, tmthing); + CONS_Printf(M_GetText("%s stole a balloon from %s!\n"), player_names[tmthing->player-players], player_names[thing->player-players]); } } else if (P_IsObjectOnGround(tmthing) && thing->momz < 0) @@ -1678,6 +1722,7 @@ static boolean PIT_CheckThing(mobj_t *thing) { K_StealBalloon(thing->player, tmthing->player); K_SpinPlayer(tmthing->player, thing); + CONS_Printf(M_GetText("%s stole a balloon from %s!\n"), player_names[thing->player-players], player_names[tmthing->player-players]); } } else @@ -1689,11 +1734,13 @@ static boolean PIT_CheckThing(mobj_t *thing) { K_StealBalloon(thing->player, tmthing->player); K_SpinPlayer(tmthing->player, thing); + CONS_Printf(M_GetText("%s stole a balloon from %s!\n"), player_names[thing->player-players], player_names[tmthing->player-players]); } else if (tmthing->player->kartstuff[k_mushroomtimer] && !(thing->player->kartstuff[k_mushroomtimer])) { K_StealBalloon(tmthing->player, thing->player); K_SpinPlayer(thing->player, tmthing); + CONS_Printf(M_GetText("%s stole a balloon from %s!\n"), player_names[tmthing->player-players], player_names[thing->player-players]); } } diff --git a/src/p_user.c b/src/p_user.c index 4dfced7d6..b5f645376 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1010,9 +1010,6 @@ void P_AddPlayerScore(player_t *player, UINT32 amount) if (player->bot) player = &players[consoleplayer]; - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) - return; - // NiGHTS does it different! if (gamestate == GS_LEVEL && mapheaderinfo[gamemap-1]->typeoflevel & TOL_NIGHTS) {