From 888515331f06e4d3ee2cdb6b00c844cbd52530d0 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 20 Nov 2017 02:00:19 -0500 Subject: [PATCH] More lenient checkpoints Doesn't really belong in this branch but shut up! I'm lazy :p --- src/d_clisrv.c | 2 ++ src/d_clisrv.h | 1 + src/d_player.h | 1 + src/g_game.c | 6 ++++++ src/lua_playerlib.c | 4 ++++ src/p_inter.c | 5 +++-- src/p_spec.c | 5 +++-- 7 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index fafc92f3..7e1cfc38 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -575,6 +575,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->starposty = SHORT(players[i].starposty); rsp->starpostz = SHORT(players[i].starpostz); rsp->starpostnum = LONG(players[i].starpostnum); + rsp->starpostcount = LONG(players[i].starpostcount); rsp->starposttime = (tic_t)LONG(players[i].starposttime); rsp->starpostangle = (angle_t)LONG(players[i].starpostangle); @@ -706,6 +707,7 @@ static void resynch_read_player(resynch_pak *rsp) players[i].starposty = SHORT(rsp->starposty); players[i].starpostz = SHORT(rsp->starpostz); players[i].starpostnum = LONG(rsp->starpostnum); + players[i].starpostcount = LONG(rsp->starpostcount); players[i].starposttime = (tic_t)LONG(rsp->starposttime); players[i].starpostangle = (angle_t)LONG(rsp->starpostangle); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index f25203fb..06fa15fc 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -219,6 +219,7 @@ typedef struct INT16 starposty; INT16 starpostz; INT32 starpostnum; + INT32 starpostcount; tic_t starposttime; angle_t starpostangle; diff --git a/src/d_player.h b/src/d_player.h index db880ba5..4f043cf8 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -477,6 +477,7 @@ typedef struct player_s INT16 starposty; INT16 starpostz; INT32 starpostnum; // The number of the last starpost you hit + INT32 starpostcount; // SRB2kart: how many did you hit? tic_t starposttime; // Your time when you hit the starpost angle_t starpostangle; // Angle that the starpost is facing - you respawn facing this way diff --git a/src/g_game.c b/src/g_game.c index 49822076..b3c4ff69 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2142,6 +2142,7 @@ static inline void G_PlayerFinishLevel(INT32 player) p->starposty = 0; p->starpostz = 0; p->starpostnum = 0; + p->starpostcount = 0; if (rendermode == render_soft) V_SetPaletteLump(GetPalette()); // Reset the palette @@ -2182,6 +2183,7 @@ void G_PlayerReborn(INT32 player) INT16 starposty; INT16 starpostz; INT32 starpostnum; + INT32 starpostcount; INT32 starpostangle; fixed_t jumpfactor; INT32 exiting; @@ -2239,6 +2241,7 @@ void G_PlayerReborn(INT32 player) starposty = players[player].starposty; starpostz = players[player].starpostz; starpostnum = players[player].starpostnum; + starpostcount = players[player].starpostcount; starpostangle = players[player].starpostangle; jumpfactor = players[player].jumpfactor; thokitem = players[player].thokitem; @@ -2296,6 +2299,7 @@ void G_PlayerReborn(INT32 player) p->starposty = starposty; p->starpostz = starpostz; p->starpostnum = starpostnum; + p->starpostcount = starpostcount; p->starpostangle = starpostangle; p->jumpfactor = jumpfactor; p->exiting = exiting; @@ -2665,6 +2669,7 @@ void G_DoReborn(INT32 playernum) player->starposty = 0; player->starpostz = 0; player->starpostnum = 0; + player->starpostcount = 0; } if (!countdowntimeup && (mapheaderinfo[gamemap-1]->levelflags & LF_NORELOAD)) { @@ -3714,6 +3719,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean players[i].playerstate = PST_REBORN; players[i].starpostangle = players[i].starpostnum = players[i].starposttime = 0; players[i].starpostx = players[i].starposty = players[i].starpostz = 0; + players[i].starpostcount = 0; // srb2kart if (netgame || multiplayer) { diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 66a41219..a58892d3 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -246,6 +246,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->starpostz); else if (fastcmp(field,"starpostnum")) lua_pushinteger(L, plr->starpostnum); + else if (fastcmp(field,"starpostcount")) + lua_pushinteger(L, plr->starpostcount); else if (fastcmp(field,"starposttime")) lua_pushinteger(L, plr->starposttime); else if (fastcmp(field,"starpostangle")) @@ -513,6 +515,8 @@ static int player_set(lua_State *L) plr->starpostz = (INT16)luaL_checkinteger(L, 3); else if (fastcmp(field,"starpostnum")) plr->starpostnum = (INT32)luaL_checkinteger(L, 3); + else if (fastcmp(field,"starpostcount")) + plr->starpostcount = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"starposttime")) plr->starposttime = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"starpostangle")) diff --git a/src/p_inter.c b/src/p_inter.c index 346c0be1..bff3a030 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1213,9 +1213,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; } // - // In circuit, player must have touched all previous starposts + // SRB2kart: make sure the player will have enough checkpoints to touch if (circuitmap - && special->health - player->starpostnum > 1) + && special->health >= (numstarposts/2 + player->starpostnum)) { // blatant reuse of a variable that's normally unused in circuit if (!player->tossdelay) @@ -1242,6 +1242,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) player->starpostz = special->z>>FRACBITS; player->starpostangle = special->angle; player->starpostnum = special->health; + player->starpostcount++; P_ClearStarPost(special->health); // Find all starposts in the level with this value. diff --git a/src/p_spec.c b/src/p_spec.c index 716cf576..6ebeb466 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4110,12 +4110,12 @@ DoneSection2: case 10: // Finish Line // SRB2kart - 150117 - if (gametype == GT_RACE && (player->starpostnum == numstarposts || player->exiting)) + if (gametype == GT_RACE && (player->starpostcount >= numstarposts/2 || player->exiting)) player->kartstuff[k_starpostwp] = player->kartstuff[k_waypoint] = 0; // if (gametype == GT_RACE && !player->exiting) { - if (player->starpostnum == numstarposts) // Must have touched all the starposts + if (player->starpostcount >= numstarposts/2) // srb2kart: must have touched *enough* starposts (was originally "(player->starpostnum == numstarposts)") { player->laps++; player->kartstuff[k_lapanimation] = 80; @@ -4134,6 +4134,7 @@ DoneSection2: // SRB2kart 200117 player->starpostangle = player->starpostnum = 0; player->starpostx = player->starposty = player->starpostz = 0; + player->starpostcount = 0; //except the time! player->starposttime = player->realtime;