From 9d6563fcf79fe7b46b86acdaea722de3700a76cc Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 28 Oct 2018 14:43:58 -0400 Subject: [PATCH 01/31] Fix kartspeed/kartweight writes --- src/d_clisrv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3d5b90a2..f27fc3af 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -576,8 +576,8 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) // Just in case Lua does something like // modify these at runtime // SRB2kart - rsp->kartspeed = (UINT8)LONG(players[i].kartspeed); - rsp->kartweight = (UINT8)LONG(players[i].kartweight); + rsp->kartspeed = (UINT8)players[i].kartspeed; + rsp->kartweight = (UINT8)players[i].kartweight; // rsp->normalspeed = (fixed_t)LONG(players[i].normalspeed); rsp->runspeed = (fixed_t)LONG(players[i].runspeed); @@ -708,8 +708,8 @@ static void resynch_read_player(resynch_pak *rsp) players[i].skin = LONG(rsp->skin); // Just in case Lua does something like // modify these at runtime - players[i].kartspeed = (UINT8)LONG(rsp->kartspeed); - players[i].kartweight = (UINT8)LONG(rsp->kartweight); + players[i].kartspeed = (UINT8)rsp->kartspeed; + players[i].kartweight = (UINT8)rsp->kartweight; players[i].normalspeed = (fixed_t)LONG(rsp->normalspeed); players[i].runspeed = (fixed_t)LONG(rsp->runspeed); From b83286b532cde6e38a1f4c858b8674c92943550a Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 28 Oct 2018 14:45:01 -0400 Subject: [PATCH 02/31] Use k_itemtype as the additional check instead of pw_shield --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index f27fc3af..f811334a 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4344,7 +4344,7 @@ static INT16 Consistancy(void) { ret += players[i].mo->x; ret -= players[i].mo->y; - ret += players[i].powers[pw_shield]; + ret += players[i].kartstuff[k_itemtype]; // powers[pw_shield] ret *= i+1; } } From 9630e0161655ee044e34e17d215a0e1114c4b7c7 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 28 Oct 2018 17:31:59 -0400 Subject: [PATCH 03/31] Camera crash fixes UNRELATED, but they made this branch a pain in the ass to test so I needed to fix this here :V --- src/g_game.c | 2 ++ src/p_mobj.c | 5 +++++ src/p_user.c | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index baf89d06..c795c1d6 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4033,6 +4033,7 @@ static void M_ForceLoadGameResponse(INT32 ch) displayplayer = consoleplayer; multiplayer = false; splitscreen = 0; + SplitScreen_OnChange(); // not needed? if (setsizeneeded) R_ExecuteSetViewSize(); @@ -4122,6 +4123,7 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride) displayplayer = consoleplayer; multiplayer = false; splitscreen = 0; + SplitScreen_OnChange(); // not needed? // G_DeferedInitNew(sk_medium, G_BuildMapName(1), 0, 0, 1); if (setsizeneeded) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5de7e246..959aa741 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3654,6 +3654,11 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled { boolean itsatwodlevel = false; postimg_t postimg = postimg_none; + + // This can happen when joining + if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL) + return true; + if (twodlevel || (thiscam == &camera && players[displayplayer].mo && (players[displayplayer].mo->flags2 & MF2_TWOD)) || (thiscam == &camera2 && players[secondarydisplayplayer].mo && (players[secondarydisplayplayer].mo->flags2 & MF2_TWOD)) diff --git a/src/p_user.c b/src/p_user.c index 0f89f826..0a933c94 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8083,6 +8083,10 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (!player || !player->mo) return true; + // This can happen when joining + if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL) + return true; + mo = player->mo; #ifndef NOCLIPCAM From 48a400c34774876141075d6a1b58c7fa3924fe18 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 30 Oct 2018 01:23:21 -0400 Subject: [PATCH 04/31] Clean up resync pak --- src/d_clisrv.c | 108 ++++--------------------------------------------- src/d_clisrv.h | 52 ++---------------------- 2 files changed, 11 insertions(+), 149 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index f811334a..e294145c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -555,21 +555,17 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->panim = (UINT8)players[i].panim; //panim_t rsp->aiming = (angle_t)LONG(players[i].aiming); - rsp->currentweapon = LONG(players[i].currentweapon); - rsp->ringweapons = LONG(players[i].ringweapons); for (j = 0; j < NUMPOWERS; ++j) rsp->powers[j] = (UINT16)SHORT(players[i].powers[j]); for (j = 0; j < NUMKARTSTUFF; ++j) rsp->kartstuff[j] = LONG(players[i].kartstuff[j]); // SRB2kart + rsp->frameangle = (angle_t)LONG(players[i].frameangle); // SRB2kart + // Score is resynched in the rspfirm resync packet rsp->health = 0; // resynched with mo health rsp->lives = players[i].lives; - rsp->continues = players[i].continues; - rsp->scoreadd = players[i].scoreadd; - rsp->xtralife = players[i].xtralife; - rsp->pity = players[i].pity; rsp->skincolor = players[i].skincolor; rsp->skin = LONG(players[i].skin); @@ -578,41 +574,16 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) // SRB2kart rsp->kartspeed = (UINT8)players[i].kartspeed; rsp->kartweight = (UINT8)players[i].kartweight; - // - rsp->normalspeed = (fixed_t)LONG(players[i].normalspeed); - rsp->runspeed = (fixed_t)LONG(players[i].runspeed); - rsp->thrustfactor = players[i].thrustfactor; - rsp->accelstart = players[i].accelstart; - rsp->acceleration = players[i].acceleration; - rsp->charability = players[i].charability; - rsp->charability2 = players[i].charability2; - rsp->charflags = (UINT32)LONG(players[i].charflags); - rsp->thokitem = (UINT32)LONG(players[i].thokitem); //mobjtype_t - rsp->spinitem = (UINT32)LONG(players[i].spinitem); //mobjtype_t - rsp->revitem = (UINT32)LONG(players[i].revitem); //mobjtype_t - rsp->actionspd = (fixed_t)LONG(players[i].actionspd); - rsp->mindash = (fixed_t)LONG(players[i].mindash); - rsp->maxdash = (fixed_t)LONG(players[i].maxdash); - rsp->jumpfactor = (fixed_t)LONG(players[i].jumpfactor); rsp->speed = (fixed_t)LONG(players[i].speed); - rsp->jumping = players[i].jumping; - rsp->secondjump = players[i].secondjump; - rsp->fly1 = players[i].fly1; - rsp->glidetime = (tic_t)LONG(players[i].glidetime); - rsp->climbing = players[i].climbing; rsp->deadtimer = players[i].deadtimer; rsp->exiting = (tic_t)LONG(players[i].exiting); - rsp->homing = players[i].homing; rsp->skidtime = (tic_t)LONG(players[i].skidtime); rsp->cmomx = (fixed_t)LONG(players[i].cmomx); rsp->cmomy = (fixed_t)LONG(players[i].cmomy); rsp->rmomx = (fixed_t)LONG(players[i].rmomx); rsp->rmomy = (fixed_t)LONG(players[i].rmomy); - rsp->weapondelay = LONG(players[i].weapondelay); - rsp->tossdelay = LONG(players[i].tossdelay); - rsp->starpostx = SHORT(players[i].starpostx); rsp->starposty = SHORT(players[i].starposty); rsp->starpostz = SHORT(players[i].starpostz); @@ -621,29 +592,12 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->starposttime = (tic_t)LONG(players[i].starposttime); rsp->starpostangle = (angle_t)LONG(players[i].starpostangle); - rsp->maxlink = LONG(players[i].maxlink); - rsp->dashspeed = (fixed_t)LONG(players[i].dashspeed); - rsp->dashtime = LONG(players[i].dashtime); - rsp->angle_pos = (angle_t)LONG(players[i].angle_pos); - rsp->old_angle_pos = (angle_t)LONG(players[i].old_angle_pos); - rsp->bumpertime = (tic_t)LONG(players[i].bumpertime); - rsp->flyangle = LONG(players[i].flyangle); - rsp->drilltimer = (tic_t)LONG(players[i].drilltimer); - rsp->linkcount = LONG(players[i].linkcount); - rsp->linktimer = (tic_t)LONG(players[i].linktimer); - rsp->anotherflyangle = LONG(players[i].anotherflyangle); - rsp->nightstime = (tic_t)LONG(players[i].nightstime); - rsp->drillmeter = LONG(players[i].drillmeter); - rsp->drilldelay = players[i].drilldelay; - rsp->bonustime = players[i].bonustime; - rsp->mare = players[i].mare; - rsp->lastsidehit = SHORT(players[i].lastsidehit); - rsp->lastlinehit = SHORT(players[i].lastlinehit); - rsp->losstime = (tic_t)LONG(players[i].losstime); rsp->timeshit = players[i].timeshit; rsp->onconveyor = LONG(players[i].onconveyor); + rsp->jointime = (tic_t)LONG(players[i].jointime); + rsp->hasmo = false; //Transfer important mo information if the player has a body. //This lets us resync players even if they are dead. @@ -688,21 +642,17 @@ static void resynch_read_player(resynch_pak *rsp) players[i].panim = (UINT8)rsp->panim; //panim_t players[i].aiming = (angle_t)LONG(rsp->aiming); - players[i].currentweapon = LONG(rsp->currentweapon); - players[i].ringweapons = LONG(rsp->ringweapons); for (j = 0; j < NUMPOWERS; ++j) players[i].powers[j] = (UINT16)SHORT(rsp->powers[j]); for (j = 0; j < NUMKARTSTUFF; ++j) players[i].kartstuff[j] = LONG(rsp->kartstuff[j]); // SRB2kart + players[i].frameangle = (angle_t)LONG(rsp->frameangle); // SRB2kart + // Score is resynched in the rspfirm resync packet players[i].health = rsp->health; players[i].lives = rsp->lives; - players[i].continues = rsp->continues; - players[i].scoreadd = rsp->scoreadd; - players[i].xtralife = rsp->xtralife; - players[i].pity = rsp->pity; players[i].skincolor = rsp->skincolor; players[i].skin = LONG(rsp->skin); @@ -711,40 +661,15 @@ static void resynch_read_player(resynch_pak *rsp) players[i].kartspeed = (UINT8)rsp->kartspeed; players[i].kartweight = (UINT8)rsp->kartweight; - players[i].normalspeed = (fixed_t)LONG(rsp->normalspeed); - players[i].runspeed = (fixed_t)LONG(rsp->runspeed); - players[i].thrustfactor = rsp->thrustfactor; - players[i].accelstart = rsp->accelstart; - players[i].acceleration = rsp->acceleration; - players[i].charability = rsp->charability; - players[i].charability2 = rsp->charability2; - players[i].charflags = (UINT32)LONG(rsp->charflags); - players[i].thokitem = (UINT32)LONG(rsp->thokitem); //mobjtype_t - players[i].spinitem = (UINT32)LONG(rsp->spinitem); //mobjtype_t - players[i].revitem = (UINT32)LONG(rsp->revitem); //mobjtype_t - players[i].actionspd = (fixed_t)LONG(rsp->actionspd); - players[i].mindash = (fixed_t)LONG(rsp->mindash); - players[i].maxdash = (fixed_t)LONG(rsp->maxdash); - players[i].jumpfactor = (fixed_t)LONG(rsp->jumpfactor); - players[i].speed = (fixed_t)LONG(rsp->speed); - players[i].jumping = rsp->jumping; - players[i].secondjump = rsp->secondjump; - players[i].fly1 = rsp->fly1; - players[i].glidetime = (tic_t)LONG(rsp->glidetime); - players[i].climbing = rsp->climbing; players[i].deadtimer = rsp->deadtimer; players[i].exiting = (tic_t)LONG(rsp->exiting); - players[i].homing = rsp->homing; players[i].skidtime = (tic_t)LONG(rsp->skidtime); players[i].cmomx = (fixed_t)LONG(rsp->cmomx); players[i].cmomy = (fixed_t)LONG(rsp->cmomy); players[i].rmomx = (fixed_t)LONG(rsp->rmomx); players[i].rmomy = (fixed_t)LONG(rsp->rmomy); - players[i].weapondelay = LONG(rsp->weapondelay); - players[i].tossdelay = LONG(rsp->tossdelay); - players[i].starpostx = SHORT(rsp->starpostx); players[i].starposty = SHORT(rsp->starposty); players[i].starpostz = SHORT(rsp->starpostz); @@ -753,29 +678,12 @@ static void resynch_read_player(resynch_pak *rsp) players[i].starposttime = (tic_t)LONG(rsp->starposttime); players[i].starpostangle = (angle_t)LONG(rsp->starpostangle); - players[i].maxlink = LONG(rsp->maxlink); - players[i].dashspeed = (fixed_t)LONG(rsp->dashspeed); - players[i].dashtime = LONG(rsp->dashtime); - players[i].angle_pos = (angle_t)LONG(rsp->angle_pos); - players[i].old_angle_pos = (angle_t)LONG(rsp->old_angle_pos); - players[i].bumpertime = (tic_t)LONG(rsp->bumpertime); - players[i].flyangle = LONG(rsp->flyangle); - players[i].drilltimer = (tic_t)LONG(rsp->drilltimer); - players[i].linkcount = LONG(rsp->linkcount); - players[i].linktimer = (tic_t)LONG(rsp->linktimer); - players[i].anotherflyangle = LONG(rsp->anotherflyangle); - players[i].nightstime = (tic_t)LONG(rsp->nightstime); - players[i].drillmeter = LONG(rsp->drillmeter); - players[i].drilldelay = rsp->drilldelay; - players[i].bonustime = rsp->bonustime; - players[i].mare = rsp->mare; - players[i].lastsidehit = SHORT(rsp->lastsidehit); - players[i].lastlinehit = SHORT(rsp->lastlinehit); - players[i].losstime = (tic_t)LONG(rsp->losstime); players[i].timeshit = rsp->timeshit; players[i].onconveyor = LONG(rsp->onconveyor); + players[i].jointime = (tic_t)LONG(rsp->jointime); + //We get a packet for each player in game. if (!playeringame[i]) return; diff --git a/src/d_clisrv.h b/src/d_clisrv.h index e2a6ed7c..d1bdbec9 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -184,8 +184,7 @@ typedef struct UINT8 panim; // panim_t angle_t aiming; - INT32 currentweapon; - INT32 ringweapons; + UINT16 powers[NUMPOWERS]; INT32 kartstuff[NUMKARTSTUFF]; // SRB2kart @@ -194,10 +193,6 @@ typedef struct // Score is resynched in the confirm resync packet INT32 health; SINT8 lives; - SINT8 continues; - UINT8 scoreadd; - SINT8 xtralife; - SINT8 pity; UINT8 skincolor; INT32 skin; @@ -206,41 +201,16 @@ typedef struct // SRB2kart UINT8 kartspeed; UINT8 kartweight; - // - fixed_t normalspeed; - fixed_t runspeed; - UINT8 thrustfactor; - UINT8 accelstart; - UINT8 acceleration; - UINT8 charability; - UINT8 charability2; - UINT32 charflags; - UINT32 thokitem; // mobjtype_t - UINT32 spinitem; // mobjtype_t - UINT32 revitem; // mobjtype_t - fixed_t actionspd; - fixed_t mindash; - fixed_t maxdash; - fixed_t jumpfactor; fixed_t speed; - UINT8 jumping; - UINT8 secondjump; - UINT8 fly1; - tic_t glidetime; - UINT8 climbing; INT32 deadtimer; tic_t exiting; - UINT8 homing; tic_t skidtime; fixed_t cmomx; fixed_t cmomy; fixed_t rmomx; fixed_t rmomy; - INT32 weapondelay; - INT32 tossdelay; - INT16 starpostx; INT16 starposty; INT16 starpostz; @@ -249,28 +219,12 @@ typedef struct tic_t starposttime; angle_t starpostangle; - INT32 maxlink; - fixed_t dashspeed; - INT32 dashtime; - angle_t angle_pos; - angle_t old_angle_pos; - tic_t bumpertime; - INT32 flyangle; - tic_t drilltimer; - INT32 linkcount; - tic_t linktimer; - INT32 anotherflyangle; - tic_t nightstime; - INT32 drillmeter; - UINT8 drilldelay; - UINT8 bonustime; - UINT8 mare; - INT16 lastsidehit, lastlinehit; - tic_t losstime; UINT8 timeshit; INT32 onconveyor; + tic_t jointime; + //player->mo stuff UINT8 hasmo; // Boolean From 7fbfed535bdf4f8a3ada339dde646b118f4963ff Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 30 Oct 2018 16:24:27 -0400 Subject: [PATCH 05/31] Add hnext/hprev to consistancy, add marescore to resynchend --- src/d_clisrv.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------ src/d_clisrv.h | 3 +-- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index e294145c..edc0bf3d 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -847,8 +847,7 @@ static inline void resynch_write_others(resynchend_pak *rst) { rst->ctfteam[i] = 0; rst->score[i] = 0; - rst->numboxes[i] = 0; - rst->totalring[i] = 0; + rst->marescore[i] = 0; rst->realtime[i] = 0; rst->laps[i] = 0; continue; @@ -858,8 +857,7 @@ static inline void resynch_write_others(resynchend_pak *rst) rst->ingame |= (1<ctfteam[i] = (INT32)LONG(players[i].ctfteam); rst->score[i] = (UINT32)LONG(players[i].score); - rst->numboxes[i] = SHORT(players[i].numboxes); - rst->totalring[i] = SHORT(players[i].totalring); + rst->marescore[i] = (UINT32)LONG(players[i].marescore); rst->realtime[i] = (tic_t)LONG(players[i].realtime); rst->laps[i] = players[i].laps; } @@ -879,8 +877,7 @@ static inline void resynch_read_others(resynchend_pak *p) players[i].spectator = !(loc_ingame & (1<ctfteam[i]); // no, 0 does not mean spectator, at least not in Match players[i].score = (UINT32)LONG(p->score[i]); - players[i].numboxes = SHORT(p->numboxes[i]); - players[i].totalring = SHORT(p->totalring[i]); + players[i].marescore = (UINT32)LONG(p->marescore[i]); players[i].realtime = (tic_t)LONG(p->realtime[i]); players[i].laps = p->laps[i]; } @@ -4327,6 +4324,47 @@ static INT16 Consistancy(void) ret -= mo->tracer->sprite; ret += mo->tracer->frame; } + else + ret ^= 0xAAAA; + // SRB2Kart: We use hnext & hprev very extensively + if (mo->hnext) + { + ret += mo->hnext->type; + ret -= mo->hnext->x; + ret += mo->hnext->y; + ret -= mo->hnext->z; + ret += mo->hnext->momx; + ret -= mo->hnext->momy; + ret += mo->hnext->momz; + ret -= mo->hnext->angle; + ret += mo->hnext->flags; + ret -= mo->hnext->flags2; + ret += mo->hnext->eflags; + ret -= mo->hnext->state - states; + ret += mo->hnext->tics; + ret -= mo->hnext->sprite; + ret += mo->hnext->frame; + } + else + ret ^= 0x3333; + if (mo->hprev) + { + ret += mo->hprev->type; + ret -= mo->hprev->x; + ret += mo->hprev->y; + ret -= mo->hprev->z; + ret += mo->hprev->momx; + ret -= mo->hprev->momy; + ret += mo->hprev->momz; + ret -= mo->hprev->angle; + ret += mo->hprev->flags; + ret -= mo->hprev->flags2; + ret += mo->hprev->eflags; + ret -= mo->hprev->state - states; + ret += mo->hprev->tics; + ret -= mo->hprev->sprite; + ret += mo->hprev->frame; + } else ret ^= 0xAAAA; ret -= mo->state - states; diff --git a/src/d_clisrv.h b/src/d_clisrv.h index d1bdbec9..3e0bcb72 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -166,8 +166,7 @@ typedef struct // Resynch game scores and the like all at once UINT32 score[MAXPLAYERS]; // Everyone's score - INT16 numboxes[MAXPLAYERS]; - INT16 totalring[MAXPLAYERS]; + UINT32 marescore[MAXPLAYERS]; // SRB2kart: Battle score tic_t realtime[MAXPLAYERS]; UINT8 laps[MAXPLAYERS]; } ATTRPACK resynchend_pak; From f9d559b03c83c2426ef8178185f9dad7309b48df Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 30 Oct 2018 17:03:11 -0400 Subject: [PATCH 06/31] Fuck it, add back in the old vars If we want a smaller resync packet, let's actually remove these FOR REAL --- src/d_clisrv.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++ src/d_clisrv.h | 49 ++++++++++++++++++++++++ 2 files changed, 149 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index edc0bf3d..bba1e7b2 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -555,6 +555,8 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->panim = (UINT8)players[i].panim; //panim_t rsp->aiming = (angle_t)LONG(players[i].aiming); + rsp->currentweapon = LONG(players[i].currentweapon); + rsp->ringweapons = LONG(players[i].ringweapons); for (j = 0; j < NUMPOWERS; ++j) rsp->powers[j] = (UINT16)SHORT(players[i].powers[j]); @@ -566,6 +568,10 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) // Score is resynched in the rspfirm resync packet rsp->health = 0; // resynched with mo health rsp->lives = players[i].lives; + rsp->continues = players[i].continues; + rsp->scoreadd = players[i].scoreadd; + rsp->xtralife = players[i].xtralife; + rsp->pity = players[i].pity; rsp->skincolor = players[i].skincolor; rsp->skin = LONG(players[i].skin); @@ -574,16 +580,41 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) // SRB2kart rsp->kartspeed = (UINT8)players[i].kartspeed; rsp->kartweight = (UINT8)players[i].kartweight; + // + rsp->normalspeed = (fixed_t)LONG(players[i].normalspeed); + rsp->runspeed = (fixed_t)LONG(players[i].runspeed); + rsp->thrustfactor = players[i].thrustfactor; + rsp->accelstart = players[i].accelstart; + rsp->acceleration = players[i].acceleration; + rsp->charability = players[i].charability; + rsp->charability2 = players[i].charability2; + rsp->charflags = (UINT32)LONG(players[i].charflags); + rsp->thokitem = (UINT32)LONG(players[i].thokitem); //mobjtype_t + rsp->spinitem = (UINT32)LONG(players[i].spinitem); //mobjtype_t + rsp->revitem = (UINT32)LONG(players[i].revitem); //mobjtype_t + rsp->actionspd = (fixed_t)LONG(players[i].actionspd); + rsp->mindash = (fixed_t)LONG(players[i].mindash); + rsp->maxdash = (fixed_t)LONG(players[i].maxdash); + rsp->jumpfactor = (fixed_t)LONG(players[i].jumpfactor); rsp->speed = (fixed_t)LONG(players[i].speed); + rsp->jumping = players[i].jumping; + rsp->secondjump = players[i].secondjump; + rsp->fly1 = players[i].fly1; + rsp->glidetime = (tic_t)LONG(players[i].glidetime); + rsp->climbing = players[i].climbing; rsp->deadtimer = players[i].deadtimer; rsp->exiting = (tic_t)LONG(players[i].exiting); + rsp->homing = players[i].homing; rsp->skidtime = (tic_t)LONG(players[i].skidtime); rsp->cmomx = (fixed_t)LONG(players[i].cmomx); rsp->cmomy = (fixed_t)LONG(players[i].cmomy); rsp->rmomx = (fixed_t)LONG(players[i].rmomx); rsp->rmomy = (fixed_t)LONG(players[i].rmomy); + rsp->weapondelay = LONG(players[i].weapondelay); + rsp->tossdelay = LONG(players[i].tossdelay); + rsp->starpostx = SHORT(players[i].starpostx); rsp->starposty = SHORT(players[i].starposty); rsp->starpostz = SHORT(players[i].starpostz); @@ -592,6 +623,25 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->starposttime = (tic_t)LONG(players[i].starposttime); rsp->starpostangle = (angle_t)LONG(players[i].starpostangle); + rsp->maxlink = LONG(players[i].maxlink); + rsp->dashspeed = (fixed_t)LONG(players[i].dashspeed); + rsp->dashtime = LONG(players[i].dashtime); + rsp->angle_pos = (angle_t)LONG(players[i].angle_pos); + rsp->old_angle_pos = (angle_t)LONG(players[i].old_angle_pos); + rsp->bumpertime = (tic_t)LONG(players[i].bumpertime); + rsp->flyangle = LONG(players[i].flyangle); + rsp->drilltimer = (tic_t)LONG(players[i].drilltimer); + rsp->linkcount = LONG(players[i].linkcount); + rsp->linktimer = (tic_t)LONG(players[i].linktimer); + rsp->anotherflyangle = LONG(players[i].anotherflyangle); + rsp->nightstime = (tic_t)LONG(players[i].nightstime); + rsp->drillmeter = LONG(players[i].drillmeter); + rsp->drilldelay = players[i].drilldelay; + rsp->bonustime = players[i].bonustime; + rsp->mare = players[i].mare; + rsp->lastsidehit = SHORT(players[i].lastsidehit); + rsp->lastlinehit = SHORT(players[i].lastlinehit); + rsp->losstime = (tic_t)LONG(players[i].losstime); rsp->timeshit = players[i].timeshit; rsp->onconveyor = LONG(players[i].onconveyor); @@ -642,6 +692,8 @@ static void resynch_read_player(resynch_pak *rsp) players[i].panim = (UINT8)rsp->panim; //panim_t players[i].aiming = (angle_t)LONG(rsp->aiming); + players[i].currentweapon = LONG(rsp->currentweapon); + players[i].ringweapons = LONG(rsp->ringweapons); for (j = 0; j < NUMPOWERS; ++j) players[i].powers[j] = (UINT16)SHORT(rsp->powers[j]); @@ -653,6 +705,10 @@ static void resynch_read_player(resynch_pak *rsp) // Score is resynched in the rspfirm resync packet players[i].health = rsp->health; players[i].lives = rsp->lives; + players[i].continues = rsp->continues; + players[i].scoreadd = rsp->scoreadd; + players[i].xtralife = rsp->xtralife; + players[i].pity = rsp->pity; players[i].skincolor = rsp->skincolor; players[i].skin = LONG(rsp->skin); @@ -661,15 +717,40 @@ static void resynch_read_player(resynch_pak *rsp) players[i].kartspeed = (UINT8)rsp->kartspeed; players[i].kartweight = (UINT8)rsp->kartweight; + players[i].normalspeed = (fixed_t)LONG(rsp->normalspeed); + players[i].runspeed = (fixed_t)LONG(rsp->runspeed); + players[i].thrustfactor = rsp->thrustfactor; + players[i].accelstart = rsp->accelstart; + players[i].acceleration = rsp->acceleration; + players[i].charability = rsp->charability; + players[i].charability2 = rsp->charability2; + players[i].charflags = (UINT32)LONG(rsp->charflags); + players[i].thokitem = (UINT32)LONG(rsp->thokitem); //mobjtype_t + players[i].spinitem = (UINT32)LONG(rsp->spinitem); //mobjtype_t + players[i].revitem = (UINT32)LONG(rsp->revitem); //mobjtype_t + players[i].actionspd = (fixed_t)LONG(rsp->actionspd); + players[i].mindash = (fixed_t)LONG(rsp->mindash); + players[i].maxdash = (fixed_t)LONG(rsp->maxdash); + players[i].jumpfactor = (fixed_t)LONG(rsp->jumpfactor); + players[i].speed = (fixed_t)LONG(rsp->speed); + players[i].jumping = rsp->jumping; + players[i].secondjump = rsp->secondjump; + players[i].fly1 = rsp->fly1; + players[i].glidetime = (tic_t)LONG(rsp->glidetime); + players[i].climbing = rsp->climbing; players[i].deadtimer = rsp->deadtimer; players[i].exiting = (tic_t)LONG(rsp->exiting); + players[i].homing = rsp->homing; players[i].skidtime = (tic_t)LONG(rsp->skidtime); players[i].cmomx = (fixed_t)LONG(rsp->cmomx); players[i].cmomy = (fixed_t)LONG(rsp->cmomy); players[i].rmomx = (fixed_t)LONG(rsp->rmomx); players[i].rmomy = (fixed_t)LONG(rsp->rmomy); + players[i].weapondelay = LONG(rsp->weapondelay); + players[i].tossdelay = LONG(rsp->tossdelay); + players[i].starpostx = SHORT(rsp->starpostx); players[i].starposty = SHORT(rsp->starposty); players[i].starpostz = SHORT(rsp->starpostz); @@ -678,6 +759,25 @@ static void resynch_read_player(resynch_pak *rsp) players[i].starposttime = (tic_t)LONG(rsp->starposttime); players[i].starpostangle = (angle_t)LONG(rsp->starpostangle); + players[i].maxlink = LONG(rsp->maxlink); + players[i].dashspeed = (fixed_t)LONG(rsp->dashspeed); + players[i].dashtime = LONG(rsp->dashtime); + players[i].angle_pos = (angle_t)LONG(rsp->angle_pos); + players[i].old_angle_pos = (angle_t)LONG(rsp->old_angle_pos); + players[i].bumpertime = (tic_t)LONG(rsp->bumpertime); + players[i].flyangle = LONG(rsp->flyangle); + players[i].drilltimer = (tic_t)LONG(rsp->drilltimer); + players[i].linkcount = LONG(rsp->linkcount); + players[i].linktimer = (tic_t)LONG(rsp->linktimer); + players[i].anotherflyangle = LONG(rsp->anotherflyangle); + players[i].nightstime = (tic_t)LONG(rsp->nightstime); + players[i].drillmeter = LONG(rsp->drillmeter); + players[i].drilldelay = rsp->drilldelay; + players[i].bonustime = rsp->bonustime; + players[i].mare = rsp->mare; + players[i].lastsidehit = SHORT(rsp->lastsidehit); + players[i].lastlinehit = SHORT(rsp->lastlinehit); + players[i].losstime = (tic_t)LONG(rsp->losstime); players[i].timeshit = rsp->timeshit; players[i].onconveyor = LONG(rsp->onconveyor); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 3e0bcb72..4d738632 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -183,6 +183,8 @@ typedef struct UINT8 panim; // panim_t angle_t aiming; + INT32 currentweapon; + INT32 ringweapons; UINT16 powers[NUMPOWERS]; @@ -192,6 +194,10 @@ typedef struct // Score is resynched in the confirm resync packet INT32 health; SINT8 lives; + SINT8 continues; + UINT8 scoreadd; + SINT8 xtralife; + SINT8 pity; UINT8 skincolor; INT32 skin; @@ -200,16 +206,41 @@ typedef struct // SRB2kart UINT8 kartspeed; UINT8 kartweight; + // + fixed_t normalspeed; + fixed_t runspeed; + UINT8 thrustfactor; + UINT8 accelstart; + UINT8 acceleration; + UINT8 charability; + UINT8 charability2; + UINT32 charflags; + UINT32 thokitem; // mobjtype_t + UINT32 spinitem; // mobjtype_t + UINT32 revitem; // mobjtype_t + fixed_t actionspd; + fixed_t mindash; + fixed_t maxdash; + fixed_t jumpfactor; fixed_t speed; + UINT8 jumping; + UINT8 secondjump; + UINT8 fly1; + tic_t glidetime; + UINT8 climbing; INT32 deadtimer; tic_t exiting; + UINT8 homing; tic_t skidtime; fixed_t cmomx; fixed_t cmomy; fixed_t rmomx; fixed_t rmomy; + INT32 weapondelay; + INT32 tossdelay; + INT16 starpostx; INT16 starposty; INT16 starpostz; @@ -218,6 +249,24 @@ typedef struct tic_t starposttime; angle_t starpostangle; + INT32 maxlink; + fixed_t dashspeed; + INT32 dashtime; + angle_t angle_pos; + angle_t old_angle_pos; + tic_t bumpertime; + INT32 flyangle; + tic_t drilltimer; + INT32 linkcount; + tic_t linktimer; + INT32 anotherflyangle; + tic_t nightstime; + INT32 drillmeter; + UINT8 drilldelay; + UINT8 bonustime; + UINT8 mare; + INT16 lastsidehit, lastlinehit; + tic_t losstime; UINT8 timeshit; INT32 onconveyor; From f1ea725319369fcd3fcd2847011685ba2843520f Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 30 Oct 2018 18:20:56 -0400 Subject: [PATCH 07/31] Clean up for player->mo resyncing Make most of the order match the struct, make sure proper type conversions are used when needed --- src/d_clisrv.c | 69 ++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index bba1e7b2..b6f424cc 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -658,26 +658,26 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->health = LONG(players[i].mo->health); rsp->angle = (angle_t)LONG(players[i].mo->angle); - rsp->x = LONG(players[i].mo->x); - rsp->y = LONG(players[i].mo->y); - rsp->z = LONG(players[i].mo->z); - rsp->momx = LONG(players[i].mo->momx); - rsp->momy = LONG(players[i].mo->momy); - rsp->momz = LONG(players[i].mo->momz); - rsp->friction = LONG(players[i].mo->friction); - rsp->movefactor = LONG(players[i].mo->movefactor); + rsp->x = (fixed_t)LONG(players[i].mo->x); + rsp->y = (fixed_t)LONG(players[i].mo->y); + rsp->z = (fixed_t)LONG(players[i].mo->z); + rsp->momx = (fixed_t)LONG(players[i].mo->momx); + rsp->momy = (fixed_t)LONG(players[i].mo->momy); + rsp->momz = (fixed_t)LONG(players[i].mo->momz); + rsp->friction = (fixed_t)LONG(players[i].mo->friction); + rsp->movefactor = (fixed_t)LONG(players[i].mo->movefactor); rsp->tics = LONG(players[i].mo->tics); rsp->statenum = (statenum_t)LONG(players[i].mo->state-states); // :( + rsp->flags = (UINT32)LONG(players[i].mo->flags); + rsp->flags2 = (UINT32)LONG(players[i].mo->flags2); rsp->eflags = (UINT16)SHORT(players[i].mo->eflags); - rsp->flags = LONG(players[i].mo->flags); - rsp->flags2 = LONG(players[i].mo->flags2); - rsp->radius = LONG(players[i].mo->radius); - rsp->height = LONG(players[i].mo->height); - rsp->scale = LONG(players[i].mo->scale); - rsp->destscale = LONG(players[i].mo->destscale); - rsp->scalespeed = LONG(players[i].mo->scalespeed); + rsp->radius = (fixed_t)LONG(players[i].mo->radius); + rsp->height = (fixed_t)LONG(players[i].mo->height); + rsp->scale = (fixed_t)LONG(players[i].mo->scale); + rsp->destscale = (fixed_t)LONG(players[i].mo->destscale); + rsp->scalespeed = (fixed_t)LONG(players[i].mo->scalespeed); } static void resynch_read_player(resynch_pak *rsp) @@ -802,27 +802,30 @@ static void resynch_read_player(resynch_pak *rsp) //At this point, the player should have a body, whether they were respawned or not. P_UnsetThingPosition(players[i].mo); - players[i].mo->angle = (angle_t)LONG(rsp->angle); - players[i].mo->eflags = (UINT16)SHORT(rsp->eflags); - players[i].mo->flags = LONG(rsp->flags); - players[i].mo->flags2 = LONG(rsp->flags2); - players[i].mo->friction = LONG(rsp->friction); players[i].mo->health = LONG(rsp->health); - players[i].mo->momx = LONG(rsp->momx); - players[i].mo->momy = LONG(rsp->momy); - players[i].mo->momz = LONG(rsp->momz); - players[i].mo->movefactor = LONG(rsp->movefactor); + + players[i].mo->angle = (angle_t)LONG(rsp->angle); + players[i].mo->x = (fixed_t)LONG(rsp->x); + players[i].mo->y = (fixed_t)LONG(rsp->y); + players[i].mo->z = (fixed_t)LONG(rsp->z); + players[i].mo->momx = (fixed_t)LONG(rsp->momx); + players[i].mo->momy = (fixed_t)LONG(rsp->momy); + players[i].mo->momz = (fixed_t)LONG(rsp->momz); + players[i].mo->friction = (fixed_t)LONG(rsp->friction); + players[i].mo->movefactor = (fixed_t)LONG(rsp->movefactor); + players[i].mo->tics = LONG(rsp->tics); - P_SetMobjStateNF(players[i].mo, LONG(rsp->statenum)); - players[i].mo->x = LONG(rsp->x); - players[i].mo->y = LONG(rsp->y); - players[i].mo->z = LONG(rsp->z); - players[i].mo->radius = LONG(rsp->radius); - players[i].mo->height = LONG(rsp->height); + P_SetMobjStateNF(players[i].mo, (statenum_t)LONG(rsp->statenum)); + players[i].mo->flags = (UINT32)LONG(rsp->flags); + players[i].mo->flags2 = (UINT32)LONG(rsp->flags2); + players[i].mo->eflags = (UINT16)SHORT(rsp->eflags); + + players[i].mo->radius = (fixed_t)LONG(rsp->radius); + players[i].mo->height = (fixed_t)LONG(rsp->height); // P_SetScale is redundant for this, as all related variables are already restored properly. - players[i].mo->scale = LONG(rsp->scale); - players[i].mo->destscale = LONG(rsp->destscale); - players[i].mo->scalespeed = LONG(rsp->scalespeed); + players[i].mo->scale = (fixed_t)LONG(rsp->scale); + players[i].mo->destscale = (fixed_t)LONG(rsp->destscale); + players[i].mo->scalespeed = (fixed_t)LONG(rsp->scalespeed); // And finally, SET THE MOBJ SKIN damn it. players[i].mo->skin = &skins[players[i].skin]; From 69354856b70208f9b72219c5ddfe43b191e2eb06 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 02:46:16 -0400 Subject: [PATCH 08/31] "Joined with" kicks display in the chat instead of console --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3d5b90a2..97b352da 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2922,7 +2922,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) if (otherp >= 0) \ { \ if (otherp != pnum) \ - CONS_Printf("\x82%s\x80 left the game (Joined with \x82%s\x80)\n", player_names[otherp], player_names[pnum]); \ + HU_AddChatText(va("\x82*%s left the game (Joined with %s)", player_names[otherp], player_names[pnum]), false); \ buf[0] = (UINT8)otherp; \ SendNetXCmd(XD_REMOVEPLAYER, &buf, 1); \ otherp = -1; \ From db731209e521daa39c1308fb8a8ec76a95a7ead3 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 03:06:36 -0400 Subject: [PATCH 09/31] Fix ENTER GAME option not working --- src/d_netcmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a2dd550f..df9fb54a 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3234,6 +3234,8 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) players[playernum].playerstate = PST_REBORN; } + players[playernum].pflags &= ~PF_WANTSTOJOIN; + //Now that we've done our error checking and killed the player //if necessary, put the player on the correct team/status. if (G_TagGametype()) @@ -3315,8 +3317,6 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) else CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x84', M_GetText("Blue Team"), '\x80'); } - else if (players[playernum].pflags & PF_WANTSTOJOIN) - players[playernum].pflags &= ~PF_WANTSTOJOIN; else HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); From 20d86f01c7ab2a45455dcb0641b05f6fbc372bfe Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 03:07:33 -0400 Subject: [PATCH 10/31] Cancel pogo spring when bumping a wall Prevents instances where you can use it to stick in one spot in Battle --- src/p_map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_map.c b/src/p_map.c index 1d8a2daa..0078a969 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3784,6 +3784,7 @@ void P_BouncePlayerMove(mobj_t *mo) S_StartSound(mo, sfx_s3k49); } + mo->player->kartstuff[k_pogospring] = 0; // Cancel pogo spring effect so you aren't shoved forward back into the wall you just bounced off P_PlayerHitBounceLine(bestslideline); mo->eflags |= MFE_JUSTBOUNCEDWALL; From cc5d248c9095d30a3aa6fdd0dc41483a95391c2e Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 03:13:56 -0400 Subject: [PATCH 11/31] Time over cam & signposts support mobjscale --- src/p_mobj.c | 4 ++-- src/p_spec.c | 6 +++--- src/p_user.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index f4fd40c9..9802c88e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8509,8 +8509,8 @@ void P_MobjThinker(mobj_t *mobj) case MT_FZEROBOOM: // F-Zero explosion if (!mobj->extravalue1) { - fixed_t mx = P_ReturnThrustX(NULL, mobj->angle, 32<angle, 32<angle, 32*mobj->scale); + fixed_t my = P_ReturnThrustY(NULL, mobj->angle, 32*mobj->scale); mobj_t *explosion = P_SpawnMobj(mobj->x + (2*mx), mobj->y + (2*my), mobj->z+(mobj->height/2), MT_THOK); P_SetMobjState(explosion, S_FZEROBOOM1); diff --git a/src/p_spec.c b/src/p_spec.c index 76ed73aa..b7006c87 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3219,7 +3219,7 @@ void P_SetupSignExit(player_t *player) // SRB2Kart: Set sign spinning variables thing->movefactor = thing->z; - thing->z += (768<z += (768*thing->scale) * P_MobjFlip(thing); thing->movecount = 1; ++numfound; @@ -3247,7 +3247,7 @@ void P_SetupSignExit(player_t *player) // SRB2Kart: Set sign spinning variables thing->movefactor = thing->z; - thing->z += (768<z += (768*thing->scale) * P_MobjFlip(thing); thing->movecount = 1; ++numfound; @@ -3259,7 +3259,7 @@ void P_SetupSignExit(player_t *player) // SRB2Kart: FINALLY, add in an alternative if no place is found if (player->mo) { - mobj_t *sign = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (768<mo->x, player->mo->y, player->mo->z + (768*mapheaderinfo[gamemap-1]->mobj_scale), MT_SIGN); P_SetTarget(&sign->target, player->mo); P_SetMobjState(sign, S_SIGN1); diff --git a/src/p_user.c b/src/p_user.c index 8cd31f72..b5d9397d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8606,8 +8606,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (timeover == 1) { - thiscam->momx = P_ReturnThrustX(NULL, mo->angle, 32<momy = P_ReturnThrustY(NULL, mo->angle, 32<momx = P_ReturnThrustX(NULL, mo->angle, 32*mo->scale); // Push forward + thiscam->momy = P_ReturnThrustY(NULL, mo->angle, 32*mo->scale); thiscam->momz = 0; } else if (player->exiting || timeover == 2) From 66a7adfc34e1b82d45ec62f66eed194ff5805570 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 04:46:24 -0400 Subject: [PATCH 12/31] Push fakes away from other items Prevents stupid item stacking in Battle (you can still do it with bananas, but THOSE are removable, and don't have a similar sprite) --- src/p_map.c | 25 +++++++++++++++++++++++++ src/p_mobj.c | 1 + 2 files changed, 26 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index 0078a969..2bcfd73a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -665,8 +665,33 @@ static boolean PIT_CheckThing(mobj_t *thing) // SRB2kart 011617 - Colission code for kart items //{ + // Push fakes out of other items + if (tmthing->type == MT_FAKEITEM && (thing->type == MT_RANDOMITEM || thing->type == MT_FAKEITEM)) + { + // see if it went over / under + if (tmthing->z > thing->z + thing->height) + return true; // overhead + if (tmthing->z + tmthing->height < thing->z) + return true; // underneath + + P_InstaThrust(tmthing, R_PointToAngle2(thing->x, thing->y, tmthing->x, tmthing->y), thing->radius/4); + return true; + } + else if (thing->type == MT_FAKEITEM && (tmthing->type == MT_RANDOMITEM || tmthing->type == MT_FAKEITEM)) + { + // see if it went over / under + if (tmthing->z > thing->z + thing->height) + return true; // overhead + if (tmthing->z + tmthing->height < thing->z) + return true; // underneath + + P_InstaThrust(thing, R_PointToAngle2(tmthing->x, tmthing->y, thing->x, thing->y), tmthing->radius/4); + return true; + } + if (tmthing->type == MT_RANDOMITEM) return true; + if (tmthing->type == MT_ORBINAUT || tmthing->type == MT_JAWZ || tmthing->type == MT_JAWZ_DUD || tmthing->type == MT_ORBINAUT_SHIELD || tmthing->type == MT_JAWZ_SHIELD) { diff --git a/src/p_mobj.c b/src/p_mobj.c index 9802c88e..407ddc39 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8151,6 +8151,7 @@ void P_MobjThinker(mobj_t *mobj) } case MT_BANANA: case MT_FAKEITEM: + mobj->friction = ORIG_FRICTION/4; if (mobj->momx || mobj->momy) P_SpawnGhostMobj(mobj); if (mobj->z <= mobj->floorz && mobj->health > 1) From 6da700629fd5ae63a191a724157343c715f5e6a3 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 04:55:00 -0400 Subject: [PATCH 13/31] Fix incorrect scale of player arrows in non-splitscreen whoops --- src/p_mobj.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 407ddc39..611562a9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6829,10 +6829,10 @@ void P_MobjThinker(mobj_t *mobj) if (!splitscreen) { - scale += FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x, + scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x, players[displayplayer].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); - if (scale > 16*FRACUNIT) - scale = 16*FRACUNIT; + if (scale > 16*mobj->target->scale) + scale = 16*mobj->target->scale; } mobj->destscale = scale; @@ -7025,10 +7025,10 @@ void P_MobjThinker(mobj_t *mobj) if (!splitscreen) { - scale += FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x, + scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x, players[displayplayer].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); - if (scale > 16*FRACUNIT) - scale = 16*FRACUNIT; + if (scale > 16*mobj->target->scale) + scale = 16*mobj->target->scale; } mobj->destscale = scale; } From 54f71d3dbf0ab2443bd8e01b51148c9f74e250f8 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 05:28:39 -0400 Subject: [PATCH 14/31] Use frameangle for rocket sneakers so they rotate around you when you spinout --- src/k_kart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index ee59566f..be902e97 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3630,7 +3630,7 @@ static void K_MoveHeldObjects(player_t *player) #if 1 { - angle_t input = player->mo->angle - cur->angle; + angle_t input = player->frameangle - cur->angle; boolean invert = (input > ANGLE_180); if (invert) input = InvAngle(input); @@ -3642,7 +3642,7 @@ static void K_MoveHeldObjects(player_t *player) cur->angle = cur->angle + input; } #else - cur->angle = player->mo->angle; + cur->angle = player->frameangle; #endif angoffset = ANGLE_90 + (ANGLE_180 * num); From e76da7d5caa6da4b6991ef8896406674ce88d9f2 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 05:32:59 -0400 Subject: [PATCH 15/31] No item usage while squished or respawning --- src/k_kart.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index be902e97..fc90de2b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4662,7 +4662,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else if (cmd->buttons & BT_ATTACK) player->pflags |= PF_ATTACKDOWN; - if (player && player->mo && player->mo->health > 0 && !player->spectator && !(player->exiting || mapreset) && player->kartstuff[k_spinouttimer] == 0) + if (player && player->mo && player->mo->health > 0 && !player->spectator && !(player->exiting || mapreset) + && player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_squishedtimer] == 0 && player->kartstuff[k_respawn] == 0) { // First, the really specific, finicky items that function without the item being directly in your item slot. // Karma item dropping From 80b8aefdb2bc0d055314276c995ab5b992ed1537 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 05:35:06 -0400 Subject: [PATCH 16/31] Nerfed squishing After fixing flashing tics not being set properly, 2 seconds of being fully stopped and then another 1.5 seconds minimum of being unable to be hit just feels like an eternity :V --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index fc90de2b..4e576ea3 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1940,7 +1940,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source) K_CheckBumpers(); } - player->kartstuff[k_squishedtimer] = 2*TICRATE; + player->kartstuff[k_squishedtimer] = TICRATE; player->powers[pw_flashing] = K_GetKartFlashing(player); From 2999c45d05550c3f184420496acad5ae9d2309a7 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 15:14:53 -0400 Subject: [PATCH 17/31] Item distribution experiments based on my experience in netgames Needs tested tonight. - Grow & Rocket Sneakers are slightly more in the back - Sneaker x3 gets handed out more in the back-middle - Removed 5% from Ballhog towards the front - Removed 5% from Shrink in the forward-most column it was in --- src/k_kart.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 4e576ea3..23b84ff1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -487,22 +487,22 @@ static INT32 K_KartItemOddsRace[NUMKARTRESULTS][9] = { //P-Odds 0 1 2 3 4 5 6 7 8 /*Sneaker*/ {20, 0, 0, 4, 6, 6, 0, 0, 0 }, // Sneaker - /*Rocket Sneaker*/ { 0, 0, 0, 0, 0, 2, 5, 5, 0 }, // Rocket Sneaker - /*Invincibility*/ { 0, 0, 0, 0, 0, 1, 4, 6,16 }, // Invincibility + /*Rocket Sneaker*/ { 0, 0, 0, 0, 0, 1, 3, 5, 3 }, // Rocket Sneaker + /*Invincibility*/ { 0, 0, 0, 0, 0, 1, 4, 6,14 }, // Invincibility /*Banana*/ { 0, 9, 4, 2, 1, 0, 0, 0, 0 }, // Banana /*Eggman Monitor*/ { 0, 4, 3, 2, 0, 0, 0, 0, 0 }, // Eggman Monitor /*Orbinaut*/ { 0, 6, 5, 3, 2, 0, 0, 0, 0 }, // Orbinaut /*Jawz*/ { 0, 0, 3, 2, 1, 1, 0, 0, 0 }, // Jawz - /*Mine*/ { 0, 0, 1, 2, 1, 0, 0, 0, 0 }, // Mine - /*Ballhog*/ { 0, 0, 1, 2, 1, 0, 0, 0, 0 }, // Ballhog + /*Mine*/ { 0, 0, 2, 2, 1, 0, 0, 0, 0 }, // Mine + /*Ballhog*/ { 0, 0, 0, 2, 1, 0, 0, 0, 0 }, // Ballhog /*Self-Propelled Bomb*/ { 0, 0, 1, 2, 3, 4, 2, 2, 0 }, // Self-Propelled Bomb - /*Grow*/ { 0, 0, 0, 0, 0, 1, 3, 5, 4 }, // Grow - /*Shrink*/ { 0, 0, 0, 0, 0, 0, 1, 2, 0 }, // Shrink + /*Grow*/ { 0, 0, 0, 0, 0, 1, 3, 5, 3 }, // Grow + /*Shrink*/ { 0, 0, 0, 0, 0, 0, 0, 2, 0 }, // Shrink /*Thunder Shield*/ { 0, 1, 2, 0, 0, 0, 0, 0, 0 }, // Thunder Shield /*Hyudoro*/ { 0, 0, 0, 0, 1, 2, 1, 0, 0 }, // Hyudoro /*Pogo Spring*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Pogo Spring /*Kitchen Sink*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Kitchen Sink - /*Sneaker x3*/ { 0, 0, 0, 0, 3, 6, 6, 2, 0 }, // Sneaker x3 + /*Sneaker x3*/ { 0, 0, 0, 0, 3, 7, 9, 2, 0 }, // Sneaker x3 /*Banana x3*/ { 0, 0, 1, 1, 0, 0, 0, 0, 0 }, // Banana x3 /*Banana x10*/ { 0, 0, 0, 0, 1, 0, 0, 0, 0 }, // Banana x10 /*Orbinaut x3*/ { 0, 0, 0, 1, 0, 0, 0, 0, 0 }, // Orbinaut x3 From ea4ca2eb1f3c9f3383974f6f7034628cc5276e47 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 21:35:17 -0400 Subject: [PATCH 18/31] Brake drfit effect --- src/d_player.h | 1 + src/dehacked.c | 5 +++++ src/info.c | 43 ++++++++++++++++++++++++++++++++++++------- src/info.h | 5 +++++ src/k_kart.c | 33 ++++++++++++++++++++++++++++++++- src/p_enemy.c | 1 + src/p_mobj.c | 42 ++++++++++++++++++++++++++++++++++++++---- 7 files changed, 118 insertions(+), 12 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 866589df..91d09df6 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -308,6 +308,7 @@ typedef enum k_destboostcam, // Ditto k_timeovercam, // Camera timer for leaving behind or not k_aizdriftstrat, // Let go of your drift while boosting? Helper for the SICK STRATZ you have just unlocked + k_brakedrift, // Helper for brake-drift spark spawning k_itemroulette, // Used for the roulette when deciding what item to give you (was "pw_kartitem") k_roulettetype, // Used for the roulette, for deciding type (currently only used for Battle, to give you better items from Karma items) diff --git a/src/dehacked.c b/src/dehacked.c index 77663ccd..3dcc9212 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6247,6 +6247,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_DRIFTSPARK_C1", "S_DRIFTSPARK_C2", + // Brake drift sparks + "S_BRAKEDRIFT", + // Drift Smoke "S_DRIFTDUST1", "S_DRIFTDUST2", @@ -7393,6 +7396,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_INVULNFLASH", "MT_WIPEOUTTRAIL", "MT_DRIFTSPARK", + "MT_BRAKEDRIFT", "MT_DRIFTDUST", "MT_ROCKETSNEAKER", // Rocket sneakers @@ -7895,6 +7899,7 @@ static const char *const KARTSTUFF_LIST[] = { "DESTBOOSTCAM", "TIMEOVERCAM", "AIZDRIFTSTRAT", + "BRAKEDRIFT", "ITEMROULETTE", "ROULETTETYPE", diff --git a/src/info.c b/src/info.c index cde74cee..18b818c9 100644 --- a/src/info.c +++ b/src/info.c @@ -56,13 +56,13 @@ char sprnames[NUMSPRITES + 1][5] = "SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO", //SRB2kart Sprites "SPRG","BSPR","RNDM","RPOP","SGNS","FAST","DSHR","BOST","BOSM","KFRE", - "KINV","KINF","WIPD","DRIF","DUST","RSHE","FITM","BANA","ORBN","JAWZ", - "SSMN","KRBM","BHOG","BHBM","SPBM","THNS","SINK","SITR","KBLN","DEZL", - "POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB","CHOM","SACO", - "CRAB","SHAD","BRNG","BUMP","FLEN","CLAS","PSHW","ISTA","ISTB","ARRO", - "ITEM","ITMO","ITMI","ITMN","WANT","PBOM","RETI","AIDU","KSPK","LZI1", - "LZI2","KLIT","FZSM","FZBM","FPRT","SPTL","ENM1","GARU","MARR","REAP", - "JITB","CDMO","CDBU","VIEW" + "KINV","KINF","WIPD","DRIF","BDRF","DUST","RSHE","FITM","BANA","ORBN", + "JAWZ","SSMN","KRBM","BHOG","BHBM","SPBM","THNS","SINK","SITR","KBLN", + "DEZL","POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB","CHOM", + "SACO","CRAB","SHAD","BRNG","BUMP","FLEN","CLAS","PSHW","ISTA","ISTB", + "ARRO","ITEM","ITMO","ITMI","ITMN","WANT","PBOM","RETI","AIDU","KSPK", + "LZI1","LZI2","KLIT","FZSM","FZBM","FPRT","SPTL","ENM1","GARU","MARR", + "REAP","JITB","CDMO","CDBU","VIEW" }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) @@ -2561,6 +2561,8 @@ state_t states[NUMSTATES] = {SPR_DRIF, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_DRIFTSPARK_C2}, // S_DRIFTSPARK_C1 {SPR_DRIF, FF_FULLBRIGHT|FF_TRANS20, 1, {NULL}, 0, 0, S_DRIFTSPARK_A3}, // S_DRIFTSPARK_C2 (Loop back to A3) + {SPR_BDRF, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, -1, {NULL}, 5, 2, S_BRAKEDRIFT}, // S_BRAKEDRIFT + {SPR_DUST, 0, 3, {NULL}, 0, 0, S_DRIFTDUST2}, // S_DRIFTDUST1 {SPR_DUST, 1, 3, {NULL}, 0, 0, S_DRIFTDUST3}, // S_DRIFTDUST2 {SPR_DUST, FF_TRANS20|2, 3, {NULL}, 0, 0, S_DRIFTDUST4}, // S_DRIFTDUST3 @@ -14873,6 +14875,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_BRAKEDRIFT + -1, // doomednum + S_BRAKEDRIFT, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 8*FRACUNIT, // height + 1, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + { // MT_DRIFTDUST -1, // doomednum S_DRIFTDUST1, // spawnstate diff --git a/src/info.h b/src/info.h index 78f0edae..61e0e1db 100644 --- a/src/info.h +++ b/src/info.h @@ -601,6 +601,7 @@ typedef enum sprite SPR_KINF, // Invincibility flash SPR_WIPD, // Wipeout dust trail SPR_DRIF, // Drift Sparks + SPR_BDRF, // Brake drift sparks SPR_DUST, // Drift Dust // Kart Items @@ -3109,6 +3110,9 @@ typedef enum state S_DRIFTSPARK_C1, S_DRIFTSPARK_C2, + // Brake drift sparks + S_BRAKEDRIFT, + // Drift Smoke S_DRIFTDUST1, S_DRIFTDUST2, @@ -4272,6 +4276,7 @@ typedef enum mobj_type MT_INVULNFLASH, MT_WIPEOUTTRAIL, MT_DRIFTSPARK, + MT_BRAKEDRIFT, MT_DRIFTDUST, MT_ROCKETSNEAKER, diff --git a/src/k_kart.c b/src/k_kart.c index ee59566f..126ba184 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1330,6 +1330,23 @@ static void K_SpawnDashDustRelease(player_t *player) } } +static void K_SpawnBrakeDriftSparks(player_t *player) // Be sure to update the mobj thinker case too! +{ + mobj_t *sparks; + + I_Assert(player != NULL); + I_Assert(player->mo != NULL); + I_Assert(!P_MobjWasRemoved(player->mo)); + + // Position & etc are handled in its thinker, and its spawned invisible. + // This avoids needing to dupe code if we don't need it. + sparks = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BRAKEDRIFT); + P_SetTarget(&sparks->target, player->mo); + P_SetScale(sparks, (sparks->destscale = player->mo->scale)); + K_MatchGenericExtraFlags(sparks, player->mo); + sparks->flags2 |= MF2_DONTDRAW; +} + /** \brief Calculates the respawn timer and drop-boosting \param player player object passed from K_KartPlayerThink @@ -3879,6 +3896,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) fast->momx = 3*player->mo->momx/4; fast->momy = 3*player->mo->momy/4; fast->momz = 3*player->mo->momz/4; + K_MatchGenericExtraFlags(fast, player->mo); } if (player->playerstate == PST_DEAD || player->kartstuff[k_respawn] > 1) // Ensure these are set correctly here @@ -4454,7 +4472,8 @@ static void K_KartDrift(player_t *player, boolean onground) if (player->kartstuff[k_spinouttimer] > 0 // banana peel || player->speed < FixedMul(10<<16, player->mo->scale)) // you're too slow! { - player->kartstuff[k_drift] = player->kartstuff[k_driftcharge] = player->kartstuff[k_aizdriftstrat] = 0; + player->kartstuff[k_drift] = player->kartstuff[k_driftcharge] = 0; + player->kartstuff[k_aizdriftstrat] = player->kartstuff[k_brakedrift] = 0; } if ((!player->kartstuff[k_sneakertimer]) @@ -4468,6 +4487,18 @@ static void K_KartDrift(player_t *player, boolean onground) } else if (player->kartstuff[k_aizdriftstrat] && !player->kartstuff[k_drift]) K_SpawnAIZDust(player); + + if (player->kartstuff[k_drift] + && ((player->cmd.buttons & BT_BRAKE) + || !(player->cmd.buttons & BT_ACCELERATE)) + && P_IsObjectOnGround(player->mo)) + { + if (!player->kartstuff[k_brakedrift]) + K_SpawnBrakeDriftSparks(player); + player->kartstuff[k_brakedrift] = 1; + } + else + player->kartstuff[k_brakedrift] = 0; } // // K_KartUpdatePosition diff --git a/src/p_enemy.c b/src/p_enemy.c index f0671839..b44bb874 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8435,6 +8435,7 @@ void A_SPBChase(mobj_t *actor) //fast->momz = 3*actor->momz/4; fast->color = SKINCOLOR_RED; fast->colorized = true; + K_MatchGenericExtraFlags(fast, actor); } return; diff --git a/src/p_mobj.c b/src/p_mobj.c index f4fd40c9..089f6faf 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8301,6 +8301,43 @@ void P_MobjThinker(mobj_t *mobj) } P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z); break; + case MT_BRAKEDRIFT: + if ((!mobj->target || !mobj->target->health || !mobj->target->player || !P_IsObjectOnGround(mobj->target)) + || !mobj->target->player->kartstuff[k_drift] || !mobj->target->player->kartstuff[k_brakedrift] + || !((mobj->target->player->cmd.buttons & BT_BRAKE) + || !(mobj->target->player->cmd.buttons & BT_ACCELERATE))) // Letting go of accel functions about the same as brake-drifting + { + P_RemoveMobj(mobj); + return; + } + else + { + fixed_t newx, newy; + angle_t travelangle; + + travelangle = mobj->target->angle - ((ANGLE_45/5)*mobj->target->player->kartstuff[k_drift]); + + newx = mobj->target->x + P_ReturnThrustX(mobj->target, travelangle+ANGLE_180, 24*mobj->target->scale); + newy = mobj->target->y + P_ReturnThrustY(mobj->target, travelangle+ANGLE_180, 24*mobj->target->scale); + P_TeleportMove(mobj, newx, newy, mobj->target->z); + + mobj->angle = travelangle - ((ANGLE_90/5)*mobj->target->player->kartstuff[k_drift]); + P_SetScale(mobj, (mobj->destscale = mobj->target->scale)); + + if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player)*4) + mobj->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))); + else if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player)*2) + mobj->color = SKINCOLOR_KETCHUP; + else if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player)) + mobj->color = SKINCOLOR_SAPPHIRE; + else + mobj->color = SKINCOLOR_YELLOW; + + K_MatchGenericExtraFlags(mobj, mobj->target); + if (leveltime & 1) + mobj->flags2 |= MF2_DONTDRAW; + } + break; case MT_PLAYERRETICULE: if (!mobj->target || !mobj->target->health) { @@ -8310,10 +8347,7 @@ void P_MobjThinker(mobj_t *mobj) P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z); break; case MT_INSTASHIELDB: - if (leveltime & 1) - mobj->flags2 |= MF2_DONTDRAW; - else - mobj->flags2 &= ~MF2_DONTDRAW; + mobj->flags2 ^= MF2_DONTDRAW; /* FALLTHRU */ case MT_INSTASHIELDA: if (!mobj->target || !mobj->target->health || (mobj->target->player && !mobj->target->player->kartstuff[k_instashield])) From 4369917912463f3d6191afa2360bae951515fdb5 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 22:38:43 -0400 Subject: [PATCH 19/31] Fix offsets, add colormapping --- src/k_kart.c | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index ee59566f..453b0be8 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7376,41 +7376,48 @@ static void K_drawLapStartAnim(void) { // This is an EVEN MORE insanely complicated animation. const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation]; + UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, 0); - V_DrawScaledPatch(BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)), - 56 - (32*max(0, progress-76)), - 0, kp_lapanim_emblem); + V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, + (48 - (32*max(0, progress-76)))*FRACUNIT, + FRACUNIT, V_HUDTRANS, + kp_lapanim_emblem, colormap); if (stplyr->laps == (UINT8)(cv_numlaps.value - 1)) { - V_DrawScaledPatch(27 - (32*max(0, progress-76)), - 32, - 0, kp_lapanim_final[min(progress/2, 10)]); + V_DrawFixedPatch((62 - (32*max(0, progress-76)))*FRACUNIT, // 27 + (-6)*FRACUNIT, // 24 + FRACUNIT, V_HUDTRANS, + kp_lapanim_final[min(progress/2, 10)], NULL); if (progress/2-12 >= 0) { - V_DrawScaledPatch(194 + (32*max(0, progress-76)), - 32, - 0, kp_lapanim_lap[min(progress/2-12, 6)]); + V_DrawFixedPatch((188 + (32*max(0, progress-76)))*FRACUNIT, // 194 + (-6)*FRACUNIT, // 24 + FRACUNIT, V_HUDTRANS, + kp_lapanim_lap[min(progress/2-12, 6)], NULL); } } else { - V_DrawScaledPatch(61 - (32*max(0, progress-76)), - 32, - 0, kp_lapanim_lap[min(progress/2, 6)]); + V_DrawFixedPatch((82 - (32*max(0, progress-76)))*FRACUNIT, // 61 + (-6)*FRACUNIT, // 24 + FRACUNIT, V_HUDTRANS, + kp_lapanim_lap[min(progress/2, 6)], NULL); if (progress/2-8 >= 0) { - V_DrawScaledPatch(194 + (32*max(0, progress-76)), - 32, - 0, kp_lapanim_number[(((UINT32)stplyr->laps+1) / 10)][min(progress/2-8, 2)]); + V_DrawFixedPatch((188 + (32*max(0, progress-76)))*FRACUNIT, // 194 + (-6)*FRACUNIT, // 24 + FRACUNIT, V_HUDTRANS, + kp_lapanim_number[(((UINT32)stplyr->laps+1) / 10)][min(progress/2-8, 2)], NULL); if (progress/2-10 >= 0) { - V_DrawScaledPatch(221 + (32*max(0, progress-76)), - 32, - 0, kp_lapanim_number[(((UINT32)stplyr->laps+1) % 10)][min(progress/2-10, 2)]); + V_DrawFixedPatch((208 + (32*max(0, progress-76)))*FRACUNIT, // 221 + (-6)*FRACUNIT, // 24 + FRACUNIT, V_HUDTRANS, + kp_lapanim_number[(((UINT32)stplyr->laps+1) % 10)][min(progress/2-10, 2)], NULL); } } } From 6c557407d51493dea993354689ef4857d3877a99 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 23:10:38 -0400 Subject: [PATCH 20/31] Added judging hands (if'd out) --- src/k_kart.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index 453b0be8..78b92a9f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5577,6 +5577,9 @@ static patch_t *kp_lapanim_lap[7]; static patch_t *kp_lapanim_final[11]; static patch_t *kp_lapanim_number[10][3]; static patch_t *kp_lapanim_emblem; +#if 0 +static patch_t *kp_lapanim_hand[3]; +#endif void K_LoadKartHUDGraphics(void) { @@ -5796,6 +5799,15 @@ void K_LoadKartHUDGraphics(void) } kp_lapanim_emblem = (patch_t *) W_CachePatchName("K_LAPE00", PU_HUDGFX); + +#if 0 + sprintf(buffer, "K_LAPH0x"); + for (i = 0; i < 3; i++) + { + buffer[7] = '0'+(i+1); + kp_lapanim_hand[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + } +#endif } // For the item toggle menu @@ -7377,12 +7389,28 @@ static void K_drawLapStartAnim(void) // This is an EVEN MORE insanely complicated animation. const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation]; UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, 0); +#if 0 + UINT8 h = 1; + + if (stplyr->kartstuff[k_position] == 1) + h = 0; + else if (K_IsPlayerLosing(stplyr)) + h = 2; +#endif V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, (48 - (32*max(0, progress-76)))*FRACUNIT, FRACUNIT, V_HUDTRANS, kp_lapanim_emblem, colormap); +#if 0 + V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, + (48 - (32*max(0, progress-76)) + + 4 - abs((leveltime % 8) - 4))*FRACUNIT, + FRACUNIT, V_HUDTRANS, + kp_lapanim_hand[h], NULL); +#endif + if (stplyr->laps == (UINT8)(cv_numlaps.value - 1)) { V_DrawFixedPatch((62 - (32*max(0, progress-76)))*FRACUNIT, // 27 From a193a4adf23304b0c064a7ba3404a8ddf6f089ce Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 23:34:13 -0400 Subject: [PATCH 21/31] YOU GOT EM Flashes on screen whenever you get more than 1 karma point at a time, getting you back into the game. --- src/d_player.h | 1 + src/dehacked.c | 1 + src/k_kart.c | 10 ++++++++++ src/p_inter.c | 21 +++++++++++++++++---- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 866589df..18099967 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -344,6 +344,7 @@ typedef enum 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 bumper k_comebackmode, // 0 = bomb, 1 = item k_wanted, // Timer for determining WANTED status, lowers when hitting people, prevents the game turning into Camp Lazlo + k_yougotem, // "You Got Em" gfx when hitting someone as a karma player via a method that gets you back in the game instantly NUMKARTSTUFF } kartstufftype_t; diff --git a/src/dehacked.c b/src/dehacked.c index 77663ccd..7222b6ff 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7927,6 +7927,7 @@ static const char *const KARTSTUFF_LIST[] = { "COMEBACKPOINTS", "COMEBACKMODE", "WANTED", + "YOUGOTEM", }; static const char *const HUDITEMS_LIST[] = { diff --git a/src/k_kart.c b/src/k_kart.c index ee59566f..14978c67 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4067,6 +4067,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_lapanimation]) player->kartstuff[k_lapanimation]--; + if (player->kartstuff[k_yougotem]) + player->kartstuff[k_yougotem]--; + if (G_BattleGametype() && (player->exiting || player->kartstuff[k_comebacktimer])) { if (player->exiting) @@ -5578,6 +5581,8 @@ static patch_t *kp_lapanim_final[11]; static patch_t *kp_lapanim_number[10][3]; static patch_t *kp_lapanim_emblem; +static patch_t *kp_yougotem; + void K_LoadKartHUDGraphics(void) { INT32 i, j; @@ -5796,6 +5801,8 @@ void K_LoadKartHUDGraphics(void) } kp_lapanim_emblem = (patch_t *) W_CachePatchName("K_LAPE00", PU_HUDGFX); + + kp_yougotem = (patch_t *) W_CachePatchName("YOUGOTEM", PU_HUDGFX); } // For the item toggle menu @@ -7652,6 +7659,9 @@ void K_drawKartHUD(void) K_drawLapStartAnim(); } + if (G_BattleGametype() && !splitscreen && (stplyr->kartstuff[k_yougotem] % 2)) // * YOU GOT EM * + V_DrawScaledPatch(BASEVIDWIDTH/2 - SHORT(kp_yougotem->width), 32, V_HUDTRANS, kp_yougotem); + // Draw FREE PLAY. if (isfreeplay && !stplyr->spectator && timeinmap > 113) K_drawKartFreePlay(leveltime); diff --git a/src/p_inter.c b/src/p_inter.c index af5dc5b1..8b49494b 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -494,6 +494,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) else { mobj_t *boom = P_SpawnMobj(special->target->x, special->target->y, special->target->z, MT_BOOMEXPLODE); + UINT8 ptadd = (K_IsPlayerWanted(player) ? 2 : 1); + boom->scale = special->target->scale; boom->destscale = special->target->scale; boom->momz = 5*FRACUNIT; @@ -516,12 +518,17 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } if (numingame <= 2) // If so, then an extra karma point so they are 100% certain to switch places; it's annoying to end matches with a bomb kill - special->target->player->kartstuff[k_comebackpoints]++; + ptadd++; } - special->target->player->kartstuff[k_comebackpoints] += (K_IsPlayerWanted(player) ? 2 : 1); + special->target->player->kartstuff[k_comebackpoints] += ptadd; + + if (ptadd > 1) + special->target->player->kartstuff[k_yougotem] = TICRATE; + if (special->target->player->kartstuff[k_comebackpoints] >= 2) K_StealBumper(special->target->player, player, true); + special->target->player->kartstuff[k_comebacktimer] = comebacktime; K_ExplodePlayer(player, special->target, special); @@ -545,6 +552,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) else if (special->target->player->kartstuff[k_comebackmode] == 2 && P_CanPickupItem(player, 2)) { mobj_t *poof = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE); + UINT8 ptadd = 1; // No WANTED bonus for tricking + S_StartSound(poof, special->info->seesound); if (player->kartstuff[k_bumper] == 1) // If you have only one bumper left, and see if it's a 1v1 @@ -560,14 +569,18 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } if (numingame <= 2) // If so, then an extra karma point so they are 100% certain to switch places; it's annoying to end matches with a fake kill - special->target->player->kartstuff[k_comebackpoints]++; + ptadd++; } special->target->player->kartstuff[k_comebackmode] = 0; - special->target->player->kartstuff[k_comebackpoints]++; + special->target->player->kartstuff[k_comebackpoints] += ptadd; + + if (ptadd > 1) + special->target->player->kartstuff[k_yougotem] = TICRATE; if (special->target->player->kartstuff[k_comebackpoints] >= 2) K_StealBumper(special->target->player, player, true); + special->target->player->kartstuff[k_comebacktimer] = comebacktime; K_DropItems(player); //K_StripItems(player); From 7891a11fba4d830f2889e805d1d41ad9db5f3411 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Nov 2018 00:57:38 -0400 Subject: [PATCH 22/31] Battle points are visible --- src/dehacked.c | 32 ++++++++++++++++++++++++ src/info.c | 63 ++++++++++++++++++++++++++++++++++++++++++++--- src/info.h | 39 ++++++++++++++++++++++++++++- src/k_kart.c | 29 ++++++++++++++++++++++ src/k_kart.h | 1 + src/lua_baselib.c | 15 +++++++++++ src/p_mobj.c | 22 +++++++++++++++++ 7 files changed, 197 insertions(+), 4 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 7222b6ff..8877cee6 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6758,6 +6758,36 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_KARMAWHEEL", // Karma player wheels + "S_BATTLEPOINT1A", // Battle point indicators + "S_BATTLEPOINT1B", + "S_BATTLEPOINT1C", + "S_BATTLEPOINT1D", + "S_BATTLEPOINT1E", + "S_BATTLEPOINT1F", + "S_BATTLEPOINT1G", + "S_BATTLEPOINT1H", + "S_BATTLEPOINT1I", + + "S_BATTLEPOINT2A", + "S_BATTLEPOINT2B", + "S_BATTLEPOINT2C", + "S_BATTLEPOINT2D", + "S_BATTLEPOINT2E", + "S_BATTLEPOINT2F", + "S_BATTLEPOINT2G", + "S_BATTLEPOINT2H", + "S_BATTLEPOINT2I", + + "S_BATTLEPOINT3A", + "S_BATTLEPOINT3B", + "S_BATTLEPOINT3C", + "S_BATTLEPOINT3D", + "S_BATTLEPOINT3E", + "S_BATTLEPOINT3F", + "S_BATTLEPOINT3G", + "S_BATTLEPOINT3H", + "S_BATTLEPOINT3I", + // Thunder shield use stuff; "S_KSPARK1", // Sparkling Radius "S_KSPARK2", @@ -7515,6 +7545,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_KARMAHITBOX", "MT_KARMAWHEEL", + "MT_BATTLEPOINT", + "MT_FZEROBOOM", // Midnight Channel stuff: diff --git a/src/info.c b/src/info.c index cde74cee..928e2cb1 100644 --- a/src/info.c +++ b/src/info.c @@ -60,9 +60,9 @@ char sprnames[NUMSPRITES + 1][5] = "SSMN","KRBM","BHOG","BHBM","SPBM","THNS","SINK","SITR","KBLN","DEZL", "POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB","CHOM","SACO", "CRAB","SHAD","BRNG","BUMP","FLEN","CLAS","PSHW","ISTA","ISTB","ARRO", - "ITEM","ITMO","ITMI","ITMN","WANT","PBOM","RETI","AIDU","KSPK","LZI1", - "LZI2","KLIT","FZSM","FZBM","FPRT","SPTL","ENM1","GARU","MARR","REAP", - "JITB","CDMO","CDBU","VIEW" + "ITEM","ITMO","ITMI","ITMN","WANT","PBOM","HIT1","HIT2","HIT3","RETI", + "AIDU","KSPK","LZI1","LZI2","KLIT","FZSM","FZBM","FPRT","SPTL","ENM1", + "GARU","MARR","REAP","JITB","CDMO","CDBU","VIEW" }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) @@ -3046,6 +3046,36 @@ state_t states[NUMSTATES] = {SPR_PBOM, 0, -1, {NULL}, 0, 0, S_NULL}, // S_KARMAWHEEL + {SPR_HIT1, 0, 1, {NULL}, 0, 0, S_BATTLEPOINT1B}, // S_BATTLEPOINT1A + {SPR_HIT1, 2, 1, {NULL}, 0, 0, S_BATTLEPOINT1C}, // S_BATTLEPOINT1B + {SPR_HIT1, 4, 1, {NULL}, 0, 0, S_BATTLEPOINT1D}, // S_BATTLEPOINT1C + {SPR_HIT1, 3, 1, {NULL}, 0, 0, S_BATTLEPOINT1E}, // S_BATTLEPOINT1D + {SPR_HIT1, 2, 1, {NULL}, 0, 0, S_BATTLEPOINT1F}, // S_BATTLEPOINT1E + {SPR_HIT1, 1, 1, {NULL}, 0, 0, S_BATTLEPOINT1G}, // S_BATTLEPOINT1F + {SPR_HIT1, 2, TICRATE, {NULL}, 0, 0, S_BATTLEPOINT1H}, // S_BATTLEPOINT1G + {SPR_HIT1, 5, 1, {NULL}, 0, 0, S_BATTLEPOINT1I}, // S_BATTLEPOINT1H + {SPR_HIT1, 6, 1, {NULL}, 0, 0, S_NULL}, // S_BATTLEPOINT1I + + {SPR_HIT2, 0, 1, {NULL}, 0, 0, S_BATTLEPOINT2B}, // S_BATTLEPOINT2A + {SPR_HIT2, 2, 1, {NULL}, 0, 0, S_BATTLEPOINT2C}, // S_BATTLEPOINT2B + {SPR_HIT2, 4, 1, {NULL}, 0, 0, S_BATTLEPOINT2D}, // S_BATTLEPOINT2C + {SPR_HIT2, 3, 1, {NULL}, 0, 0, S_BATTLEPOINT2E}, // S_BATTLEPOINT2D + {SPR_HIT2, 2, 1, {NULL}, 0, 0, S_BATTLEPOINT2F}, // S_BATTLEPOINT2E + {SPR_HIT2, 1, 1, {NULL}, 0, 0, S_BATTLEPOINT2G}, // S_BATTLEPOINT2F + {SPR_HIT2, 2, TICRATE, {NULL}, 0, 0, S_BATTLEPOINT2H}, // S_BATTLEPOINT2G + {SPR_HIT2, 5, 1, {NULL}, 0, 0, S_BATTLEPOINT2I}, // S_BATTLEPOINT2H + {SPR_HIT2, 6, 1, {NULL}, 0, 0, S_NULL}, // S_BATTLEPOINT2I + + {SPR_HIT3, 0, 1, {NULL}, 0, 0, S_BATTLEPOINT3B}, // S_BATTLEPOINT3A + {SPR_HIT3, 2, 1, {NULL}, 0, 0, S_BATTLEPOINT3C}, // S_BATTLEPOINT3B + {SPR_HIT3, 4, 1, {NULL}, 0, 0, S_BATTLEPOINT3D}, // S_BATTLEPOINT3C + {SPR_HIT3, 3, 1, {NULL}, 0, 0, S_BATTLEPOINT3E}, // S_BATTLEPOINT3D + {SPR_HIT3, 2, 1, {NULL}, 0, 0, S_BATTLEPOINT3F}, // S_BATTLEPOINT3E + {SPR_HIT3, 1, 1, {NULL}, 0, 0, S_BATTLEPOINT3G}, // S_BATTLEPOINT3F + {SPR_HIT3, 2, TICRATE, {NULL}, 0, 0, S_BATTLEPOINT3H}, // S_BATTLEPOINT3G + {SPR_HIT3, 5, 1, {NULL}, 0, 0, S_BATTLEPOINT3I}, // S_BATTLEPOINT3H + {SPR_HIT3, 6, 1, {NULL}, 0, 0, S_NULL}, // S_BATTLEPOINT3I + // Oh no it's annoying lightning states....... // Lightning Sparks (it's the ones we'll use for the radius) {SPR_KSPK, FF_FULLBRIGHT, 2, {A_LightningFollowPlayer}, 0, 0, S_KSPARK2}, // S_KSPARK1 @@ -17276,6 +17306,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_BATTLEPOINT + -1, // doomednum + S_INVISIBLE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 8*FRACUNIT, // height + -1, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + { // MT_FZEROBOOM -1, // doomednum S_INVISIBLE, // spawnstate diff --git a/src/info.h b/src/info.h index 78f0edae..d125aa96 100644 --- a/src/info.h +++ b/src/info.h @@ -651,6 +651,11 @@ typedef enum sprite SPR_WANT, SPR_PBOM, // player bomb + + SPR_HIT1, // battle points + SPR_HIT2, // battle points + SPR_HIT3, // battle points + SPR_RETI, // player reticule SPR_AIDU, @@ -3619,7 +3624,37 @@ typedef enum state S_PLAYERFAKE, S_KARMAWHEEL, - + + S_BATTLEPOINT1A, // Battle point indicators + S_BATTLEPOINT1B, + S_BATTLEPOINT1C, + S_BATTLEPOINT1D, + S_BATTLEPOINT1E, + S_BATTLEPOINT1F, + S_BATTLEPOINT1G, + S_BATTLEPOINT1H, + S_BATTLEPOINT1I, + + S_BATTLEPOINT2A, + S_BATTLEPOINT2B, + S_BATTLEPOINT2C, + S_BATTLEPOINT2D, + S_BATTLEPOINT2E, + S_BATTLEPOINT2F, + S_BATTLEPOINT2G, + S_BATTLEPOINT2H, + S_BATTLEPOINT2I, + + S_BATTLEPOINT3A, + S_BATTLEPOINT3B, + S_BATTLEPOINT3C, + S_BATTLEPOINT3D, + S_BATTLEPOINT3E, + S_BATTLEPOINT3F, + S_BATTLEPOINT3G, + S_BATTLEPOINT3H, + S_BATTLEPOINT3I, + // Thunder shield use stuff; S_KSPARK1, // Sparkling Radius S_KSPARK2, @@ -4394,6 +4429,8 @@ typedef enum mobj_type MT_KARMAHITBOX, MT_KARMAWHEEL, + MT_BATTLEPOINT, + MT_FZEROBOOM, // Midnight Channel stuff: diff --git a/src/k_kart.c b/src/k_kart.c index 14978c67..68478db2 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1784,6 +1784,32 @@ void K_DoInstashield(player_t *player) P_SetTarget(&layerb->target, player->mo); } +void K_SpawnBattlePoints(player_t *source, player_t *victim, UINT8 amount) +{ + statenum_t st; + mobj_t *pt; + + if (!source || !source->mo) + return; + + if (amount == 1) + st = S_BATTLEPOINT1A; + else if (amount == 2) + st = S_BATTLEPOINT2A; + else if (amount == 3) + st = S_BATTLEPOINT3A; + else + return; // NO STATE! + + pt = P_SpawnMobj(source->mo->x, source->mo->y, source->mo->z, MT_BATTLEPOINT); + P_SetTarget(&pt->target, source->mo); + P_SetMobjState(pt, st); + if (victim && victim->skincolor) + pt->color = victim->skincolor; + else + pt->color = source->skincolor; +} + void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem) { UINT8 scoremultiply = 1; @@ -1817,6 +1843,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem if (source && source->player && player != source->player) { P_AddPlayerScore(source->player, scoremultiply); + K_SpawnBattlePoints(source->player, player, scoremultiply); if (!trapitem) { source->player->kartstuff[k_wanted] -= wantedreduce; @@ -1907,6 +1934,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source) if (source && source->player && player != source->player) { P_AddPlayerScore(source->player, scoremultiply); + K_SpawnBattlePoints(source->player, player, scoremultiply); source->player->kartstuff[k_wanted] -= wantedreduce; player->kartstuff[k_wanted] -= (wantedreduce/2); } @@ -1996,6 +2024,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b if (source && source->player && player != source->player) { P_AddPlayerScore(source->player, scoremultiply); + K_SpawnBattlePoints(source->player, player, scoremultiply); source->player->kartstuff[k_wanted] -= wantedreduce; player->kartstuff[k_wanted] -= (wantedreduce/2); } diff --git a/src/k_kart.h b/src/k_kart.h index 671efb89..1a96d6bb 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -27,6 +27,7 @@ void K_KartMoveAnimation(player_t *player); void K_KartPlayerThink(player_t *player, ticcmd_t *cmd); void K_KartPlayerAfterThink(player_t *player); void K_DoInstashield(player_t *player); +void K_SpawnBattlePoints(player_t *source, player_t *victim, UINT8 amount); void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem); void K_SquishPlayer(player_t *player, mobj_t *source); void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor); diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 8b9a0131..05facf18 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2109,6 +2109,20 @@ static int lib_kDoInstashield(lua_State *L) return 0; } +static int lib_kSpawnBattlePoints(lua_State *L) +{ + player_t *source = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + player_t *victim = *((player_t **)luaL_checkudata(L, 2, META_PLAYER)); + UINT8 amount = (UINT8)luaL_checkinteger(L, 3); + NOHUD + if (!source) + return LUA_ErrInvalid(L, "player_t"); + if (!victim) + return LUA_ErrInvalid(L, "player_t"); + K_SpawnBattlePoints(source, victim, amount); + return 0; +} + static int lib_kSpinPlayer(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); @@ -2500,6 +2514,7 @@ static luaL_Reg lib[] = { {"K_KartBouncing",lib_kKartBouncing}, {"K_MatchGenericExtraFlags",lib_kMatchGenericExtraFlags}, {"K_DoInstashield",lib_kDoInstashield}, + {"K_SpawnBattlePoints",lib_kSpawnBattlePoints}, {"K_SpinPlayer",lib_kSpinPlayer}, {"K_SquishPlayer",lib_kSquishPlayer}, {"K_ExplodePlayer",lib_kExplodePlayer}, diff --git a/src/p_mobj.c b/src/p_mobj.c index f4fd40c9..78c7fe5c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8323,6 +8323,28 @@ void P_MobjThinker(mobj_t *mobj) } P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z); break; + case MT_BATTLEPOINT: + if (!mobj->target || P_MobjWasRemoved(mobj->target)) + { + P_RemoveMobj(mobj); + return; + } + + if (mobj->movefactor < 48*mobj->target->scale) + { + mobj->movefactor += (48*mobj->target->scale)/6; + if (mobj->movefactor > mobj->target->height) + mobj->movefactor = mobj->target->height; + } + else if (mobj->movefactor > 48*mobj->target->scale) + { + mobj->movefactor -= (48*mobj->target->scale)/6; + if (mobj->movefactor < mobj->target->height) + mobj->movefactor = mobj->target->height; + } + + P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z + (mobj->target->height/2) + mobj->movefactor); + break; case MT_THUNDERSHIELD: { fixed_t destx, desty; From 4cf94765107f0d4037210e2854336809f3a069fe Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Nov 2018 13:44:09 -0400 Subject: [PATCH 23/31] First frame lasts longer --- src/info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/info.c b/src/info.c index 928e2cb1..5aa5dcc2 100644 --- a/src/info.c +++ b/src/info.c @@ -3046,7 +3046,7 @@ state_t states[NUMSTATES] = {SPR_PBOM, 0, -1, {NULL}, 0, 0, S_NULL}, // S_KARMAWHEEL - {SPR_HIT1, 0, 1, {NULL}, 0, 0, S_BATTLEPOINT1B}, // S_BATTLEPOINT1A + {SPR_HIT1, 0, 7, {NULL}, 0, 0, S_BATTLEPOINT1B}, // S_BATTLEPOINT1A {SPR_HIT1, 2, 1, {NULL}, 0, 0, S_BATTLEPOINT1C}, // S_BATTLEPOINT1B {SPR_HIT1, 4, 1, {NULL}, 0, 0, S_BATTLEPOINT1D}, // S_BATTLEPOINT1C {SPR_HIT1, 3, 1, {NULL}, 0, 0, S_BATTLEPOINT1E}, // S_BATTLEPOINT1D @@ -3056,7 +3056,7 @@ state_t states[NUMSTATES] = {SPR_HIT1, 5, 1, {NULL}, 0, 0, S_BATTLEPOINT1I}, // S_BATTLEPOINT1H {SPR_HIT1, 6, 1, {NULL}, 0, 0, S_NULL}, // S_BATTLEPOINT1I - {SPR_HIT2, 0, 1, {NULL}, 0, 0, S_BATTLEPOINT2B}, // S_BATTLEPOINT2A + {SPR_HIT2, 0, 7, {NULL}, 0, 0, S_BATTLEPOINT2B}, // S_BATTLEPOINT2A {SPR_HIT2, 2, 1, {NULL}, 0, 0, S_BATTLEPOINT2C}, // S_BATTLEPOINT2B {SPR_HIT2, 4, 1, {NULL}, 0, 0, S_BATTLEPOINT2D}, // S_BATTLEPOINT2C {SPR_HIT2, 3, 1, {NULL}, 0, 0, S_BATTLEPOINT2E}, // S_BATTLEPOINT2D @@ -3066,7 +3066,7 @@ state_t states[NUMSTATES] = {SPR_HIT2, 5, 1, {NULL}, 0, 0, S_BATTLEPOINT2I}, // S_BATTLEPOINT2H {SPR_HIT2, 6, 1, {NULL}, 0, 0, S_NULL}, // S_BATTLEPOINT2I - {SPR_HIT3, 0, 1, {NULL}, 0, 0, S_BATTLEPOINT3B}, // S_BATTLEPOINT3A + {SPR_HIT3, 0, 7, {NULL}, 0, 0, S_BATTLEPOINT3B}, // S_BATTLEPOINT3A {SPR_HIT3, 2, 1, {NULL}, 0, 0, S_BATTLEPOINT3C}, // S_BATTLEPOINT3B {SPR_HIT3, 4, 1, {NULL}, 0, 0, S_BATTLEPOINT3D}, // S_BATTLEPOINT3C {SPR_HIT3, 3, 1, {NULL}, 0, 0, S_BATTLEPOINT3E}, // S_BATTLEPOINT3D From 7e9300c4201cd7aeaf37790e40e964bf2d2908a3 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Nov 2018 16:15:25 -0400 Subject: [PATCH 24/31] Lap hands touch-up --- src/d_player.h | 1 + src/dehacked.c | 1 + src/k_kart.c | 27 ++++++++------------------- src/p_spec.c | 37 ++++++++++++++++++++++++++++--------- 4 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 866589df..f06a7313 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -280,6 +280,7 @@ typedef enum k_throwdir, // Held dir of controls; 1 = forward, 0 = none, -1 = backward (was "player->heldDir") k_lapanimation, // Used to show the lap start wing logo animation + k_laphand, // Lap hand gfx to use; 0 = none, 1 = :ok_hand:, 2 = :thumbs_up:, 3 = :thumps_down: k_cardanimation, // Used to determine the position of some full-screen Battle Mode graphics k_voices, // Used to stop the player saying more voices than it should k_tauntvoices, // Used to specifically stop taunt voice spam diff --git a/src/dehacked.c b/src/dehacked.c index 77663ccd..3545e055 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7867,6 +7867,7 @@ static const char *const KARTSTUFF_LIST[] = { "THROWDIR", "LAPANIMATION", + "LAPHAND", "CARDANIMATION", "VOICES", "TAUNTVOICES", diff --git a/src/k_kart.c b/src/k_kart.c index 78b92a9f..9af07ec8 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5577,9 +5577,7 @@ static patch_t *kp_lapanim_lap[7]; static patch_t *kp_lapanim_final[11]; static patch_t *kp_lapanim_number[10][3]; static patch_t *kp_lapanim_emblem; -#if 0 static patch_t *kp_lapanim_hand[3]; -#endif void K_LoadKartHUDGraphics(void) { @@ -5800,14 +5798,12 @@ void K_LoadKartHUDGraphics(void) kp_lapanim_emblem = (patch_t *) W_CachePatchName("K_LAPE00", PU_HUDGFX); -#if 0 sprintf(buffer, "K_LAPH0x"); for (i = 0; i < 3; i++) { buffer[7] = '0'+(i+1); kp_lapanim_hand[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); } -#endif } // For the item toggle menu @@ -7389,27 +7385,20 @@ static void K_drawLapStartAnim(void) // This is an EVEN MORE insanely complicated animation. const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation]; UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, 0); -#if 0 - UINT8 h = 1; - - if (stplyr->kartstuff[k_position] == 1) - h = 0; - else if (K_IsPlayerLosing(stplyr)) - h = 2; -#endif V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, (48 - (32*max(0, progress-76)))*FRACUNIT, FRACUNIT, V_HUDTRANS, kp_lapanim_emblem, colormap); -#if 0 - V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, - (48 - (32*max(0, progress-76)) - + 4 - abs((leveltime % 8) - 4))*FRACUNIT, - FRACUNIT, V_HUDTRANS, - kp_lapanim_hand[h], NULL); -#endif + if (stplyr->kartstuff[k_laphand] >= 1 && stplyr->kartstuff[k_laphand] <= 3) + { + V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, + (48 - (32*max(0, progress-76)) + + 4 - abs((leveltime % 8) - 4))*FRACUNIT, + FRACUNIT, V_HUDTRANS, + kp_lapanim_hand[stplyr->kartstuff[k_laphand]-1], NULL); + } if (stplyr->laps == (UINT8)(cv_numlaps.value - 1)) { diff --git a/src/p_spec.c b/src/p_spec.c index 76ed73aa..9f18fdc7 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4196,7 +4196,34 @@ DoneSection2: { if (player->starpostcount >= numstarposts/2) // srb2kart: must have touched *enough* starposts (was originally "(player->starpostnum == numstarposts)") { + UINT8 i; + UINT8 nump = 0; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i] || players[i].spectator) + continue; + nump++; + } + player->laps++; + + // Set up lap animation vars + if (nump > 1) + { + if (K_IsPlayerLosing(player)) + player->kartstuff[k_laphand] = 3; + else + { + if (nump > 2 && player->kartstuff[k_position] == 1) // 1st place in 1v1 uses thumbs up + player->kartstuff[k_laphand] = 1; + else + player->kartstuff[k_laphand] = 2; + } + } + else + player->kartstuff[k_laphand] = 0; // No hands in FREE PLAY + player->kartstuff[k_lapanimation] = 80; if (player->pflags & PF_NIGHTSMODE) @@ -4237,15 +4264,7 @@ DoneSection2: // Figure out how many are playing on the last lap, to prevent spectate griefing if (!nospectategrief && player->laps >= (UINT8)(cv_numlaps.value - 1)) - { - UINT8 i; - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i] || players[i].spectator) - continue; - nospectategrief++; - } - } + nospectategrief = nump; } else if (player->starpostnum) { From 43d72d72f9b009788e04dc3ceaa96a8466188002 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Nov 2018 17:06:10 -0400 Subject: [PATCH 25/31] Properly center this --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 68478db2..cef28029 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7689,7 +7689,7 @@ void K_drawKartHUD(void) } if (G_BattleGametype() && !splitscreen && (stplyr->kartstuff[k_yougotem] % 2)) // * YOU GOT EM * - V_DrawScaledPatch(BASEVIDWIDTH/2 - SHORT(kp_yougotem->width), 32, V_HUDTRANS, kp_yougotem); + V_DrawScaledPatch(BASEVIDWIDTH/2 - (SHORT(kp_yougotem->width)/2), 32, V_HUDTRANS, kp_yougotem); // Draw FREE PLAY. if (isfreeplay && !stplyr->spectator && timeinmap > 113) From a2da81243ed5182a521418ca614219ec369ef007 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Nov 2018 17:08:30 -0400 Subject: [PATCH 26/31] Double length of msg --- src/p_inter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 8b49494b..73eb9f98 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -524,7 +524,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) special->target->player->kartstuff[k_comebackpoints] += ptadd; if (ptadd > 1) - special->target->player->kartstuff[k_yougotem] = TICRATE; + special->target->player->kartstuff[k_yougotem] = 2*TICRATE; if (special->target->player->kartstuff[k_comebackpoints] >= 2) K_StealBumper(special->target->player, player, true); @@ -576,7 +576,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) special->target->player->kartstuff[k_comebackpoints] += ptadd; if (ptadd > 1) - special->target->player->kartstuff[k_yougotem] = TICRATE; + special->target->player->kartstuff[k_yougotem] = 2*TICRATE; if (special->target->player->kartstuff[k_comebackpoints] >= 2) K_StealBumper(special->target->player, player, true); From 7e103be39303467f6518b30f4cdcc8d74d44ccc9 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Nov 2018 17:37:59 -0400 Subject: [PATCH 27/31] Change default brake color from Yellow to White --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index f6548e94..12e61dff 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8331,7 +8331,7 @@ void P_MobjThinker(mobj_t *mobj) else if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player)) mobj->color = SKINCOLOR_SAPPHIRE; else - mobj->color = SKINCOLOR_YELLOW; + mobj->color = SKINCOLOR_WHITE; K_MatchGenericExtraFlags(mobj, mobj->target); if (leveltime & 1) From 5c7de7559292fb462303ba96edcc830dda9f2d38 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Nov 2018 19:50:31 -0400 Subject: [PATCH 28/31] Fix random crash on squishing Why does this cause a crash? I dunno, beats me, but this seemed to fix it. --- src/p_map.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 2bcfd73a..5784b3ff 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1411,19 +1411,17 @@ static boolean PIT_CheckThing(mobj_t *thing) // Make sure they aren't able to damage you ANYWHERE along the Z axis, you have to be TOUCHING the person. && !(thing->z + thing->height < tmthing->z || thing->z > tmthing->z + tmthing->height)) { - // SRB2kart - Squish! - if (tmthing->scale > thing->scale + (FRACUNIT/8)) + + if (tmthing->scale > thing->scale + (FRACUNIT/8)) // SRB2kart - Handle squishes first! K_SquishPlayer(thing->player, tmthing); else if (thing->scale > tmthing->scale + (FRACUNIT/8)) K_SquishPlayer(tmthing->player, thing); - - // SRB2kart - Invincibility! - if (tmthing->player->kartstuff[k_invincibilitytimer] && !thing->player->kartstuff[k_invincibilitytimer]) + else if (tmthing->player->kartstuff[k_invincibilitytimer] && !thing->player->kartstuff[k_invincibilitytimer]) // SRB2kart - Then invincibility! P_DamageMobj(thing, tmthing, tmthing, 1); else if (thing->player->kartstuff[k_invincibilitytimer] && !tmthing->player->kartstuff[k_invincibilitytimer]) P_DamageMobj(tmthing, thing, thing, 1); - if (G_BattleGametype() && (!G_GametypeHasTeams() || tmthing->player->ctfteam != thing->player->ctfteam)) + /*if (G_BattleGametype() && (!G_GametypeHasTeams() || tmthing->player->ctfteam != thing->player->ctfteam)) { if ((tmthing->player->powers[pw_invulnerability] || tmthing->player->powers[pw_super]) && !thing->player->powers[pw_super]) @@ -1441,7 +1439,7 @@ static boolean PIT_CheckThing(mobj_t *thing) P_DamageMobj(thing, tmthing, tmthing, 1); else if ((thing->player->pflags & PF_TAGIT) && !(tmthing->player->pflags & PF_TAGIT)) P_DamageMobj(tmthing, thing, tmthing, 1); - } + }*/ } // Force solid players in hide and seek to avoid corner stacking. From 67dd962fb97d6ffefae53c313f30bd1a431dc5ac Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Nov 2018 20:46:20 -0400 Subject: [PATCH 29/31] Change out the hex used for hnext/hprev consistancy --- src/d_clisrv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index e07b9021..3b66d760 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4449,7 +4449,7 @@ static INT16 Consistancy(void) ret += mo->hnext->frame; } else - ret ^= 0x3333; + ret ^= 0x5555; if (mo->hprev) { ret += mo->hprev->type; @@ -4469,7 +4469,7 @@ static INT16 Consistancy(void) ret += mo->hprev->frame; } else - ret ^= 0xAAAA; + ret ^= 0xCCCC; ret -= mo->state - states; ret += mo->tics; ret -= mo->sprite; From 78299c5feef1f82289e7a6238c653671e780d422 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Nov 2018 20:50:19 -0400 Subject: [PATCH 30/31] 0xFFFF to 0xFFFFFFFF I'll implement proper bit-setting later, just gotta see if it works first --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3b66d760..2fb2c826 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1001,7 +1001,7 @@ static void SV_RequireResynch(INT32 node) resynch_delay[node] = 10; // Delay before you can fail sync again resynch_score[node] += 200; // Add score for initial desynch - resynch_status[node] = 0xFFFFFFFF; // No players assumed synched + resynch_status[node] = 0xFFFF; // No players assumed synched resynch_inprogress[node] = true; // so we know to send a PT_RESYNCHEND after sync // Initial setup From 950bca1217470018256e848a04f86b313b184c3c Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Nov 2018 21:05:52 -0400 Subject: [PATCH 31/31] Actually lets just do this now, like how its done below --- src/d_clisrv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 2fb2c826..5ceb47cd 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1001,7 +1001,8 @@ static void SV_RequireResynch(INT32 node) resynch_delay[node] = 10; // Delay before you can fail sync again resynch_score[node] += 200; // Add score for initial desynch - resynch_status[node] = 0xFFFF; // No players assumed synched + for (i = 0; i < MAXPLAYERS; ++i) + resynch_status[node] |= (1<