diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 9ece2c36..fc6ccf81 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -563,6 +563,8 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) 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; @@ -576,8 +578,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); @@ -644,6 +646,8 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) 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. @@ -654,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) @@ -696,6 +700,8 @@ static void resynch_read_player(resynch_pak *rsp) 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; @@ -708,8 +714,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); @@ -776,6 +782,8 @@ static void resynch_read_player(resynch_pak *rsp) 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; @@ -794,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]; @@ -939,8 +950,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; @@ -950,8 +960,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; } @@ -971,8 +980,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]; } @@ -993,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] = 0xFFFFFFFF; // No players assumed synched + for (i = 0; i < MAXPLAYERS; ++i) + resynch_status[node] |= (1<= 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; \ @@ -4344,7 +4353,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; } } @@ -4421,6 +4430,47 @@ static INT16 Consistancy(void) } 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 ^= 0x5555; + 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 ^= 0xCCCC; ret -= mo->state - states; ret += mo->tics; ret -= mo->sprite; diff --git a/src/d_clisrv.h b/src/d_clisrv.h index e2a6ed7c..4d738632 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; @@ -186,6 +185,7 @@ typedef struct angle_t aiming; INT32 currentweapon; INT32 ringweapons; + UINT16 powers[NUMPOWERS]; INT32 kartstuff[NUMKARTSTUFF]; // SRB2kart @@ -271,6 +271,8 @@ typedef struct UINT8 timeshit; INT32 onconveyor; + tic_t jointime; + //player->mo stuff UINT8 hasmo; // Boolean 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); diff --git a/src/d_player.h b/src/d_player.h index 866589df..a5907646 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 @@ -308,6 +309,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) @@ -344,6 +346,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 b370d8ea..1e03c865 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6252,6 +6252,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", @@ -6763,6 +6766,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", @@ -7593,6 +7626,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 @@ -7715,6 +7749,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_KARMAHITBOX", "MT_KARMAWHEEL", + "MT_BATTLEPOINT", + "MT_FZEROBOOM", // Various plants @@ -8186,6 +8222,7 @@ static const char *const KARTSTUFF_LIST[] = { "THROWDIR", "LAPANIMATION", + "LAPHAND", "CARDANIMATION", "VOICES", "TAUNTVOICES", @@ -8214,6 +8251,7 @@ static const char *const KARTSTUFF_LIST[] = { "DESTBOOSTCAM", "TIMEOVERCAM", "AIZDRIFTSTRAT", + "BRAKEDRIFT", "ITEMROULETTE", "ROULETTETYPE", @@ -8246,6 +8284,7 @@ static const char *const KARTSTUFF_LIST[] = { "COMEBACKPOINTS", "COMEBACKMODE", "WANTED", + "YOUGOTEM", }; static const char *const HUDITEMS_LIST[] = { diff --git a/src/g_game.c b/src/g_game.c index bbf6ebac..fecef69a 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4034,6 +4034,7 @@ static void M_ForceLoadGameResponse(INT32 ch) displayplayer = consoleplayer; multiplayer = false; splitscreen = 0; + SplitScreen_OnChange(); // not needed? if (setsizeneeded) R_ExecuteSetViewSize(); @@ -4123,6 +4124,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/info.c b/src/info.c index da3ba55a..8253f769 100644 --- a/src/info.c +++ b/src/info.c @@ -56,20 +56,20 @@ 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","SBUS","SHRB","TWEE","MARB","FUFO", - "RUST","BLON","VAPE","HTZA","HTZB","SGVA","SGVB","SGVC","PGTR","PGF1", - "PGF2","PGF3","PGBH","DPLR","SPTL","ENM1","GARU","MARR","REAP","JITB", - "CDMO","CDBU","PINE","PPLR","DPPT","AATR","COCO","BDST","FROG","CBRA", - "HOLE","BBRA","EGFG","SMKP","MTYM","THWP","SNOB","ICEB","CNDL","DOCH", - "DUCK","GTRE","CHES","CHIM","DRGN","LZMN","PGSS","ZTCH","MKMA","MKMP", - "RTCH","BOWL","BOWH","BRRL","BRRR","HRSE","TOAH","BFRT","OFRT","RFRT", - "PFRT","ASPK","HBST","HBSO","HBSF","WBLZ","WBLN","MSMF", - "XMS4","XMS5","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","HIT1","HIT2","HIT3", + "RETI","AIDU","KSPK","LZI1","LZI2","KLIT","FZSM","FZBM","FPRT","SBUS", + "SHRB","TWEE","MARB","FUFO","RUST","BLON","VAPE","HTZA","HTZB","SGVA", + "SGVB","SGVC","PGTR","PGF1","PGF2","PGF3","PGBH","DPLR","SPTL","ENM1", + "GARU","MARR","REAP","JITB","CDMO","CDBU","PINE","PPLR","DPPT","AATR", + "COCO","BDST","FROG","CBRA","HOLE","BBRA","EGFG","SMKP","MTYM","THWP", + "SNOB","ICEB","CNDL","DOCH","DUCK","GTRE","CHES","CHIM","DRGN","LZMN", + "PGSS","ZTCH","MKMA","MKMP","RTCH","BOWL","BOWH","BRRL","BRRR","HRSE", + "TOAH","BFRT","OFRT","RFRT","PFRT","ASPK","HBST","HBSO","HBSF","WBLZ", + "WBLN","MSMF","XMS4","XMS5","VIEW" }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) @@ -2572,6 +2572,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 @@ -3057,6 +3059,36 @@ state_t states[NUMSTATES] = {SPR_PBOM, 0, -1, {NULL}, 0, 0, S_NULL}, // S_KARMAWHEEL + {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 + {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, 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 + {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, 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 + {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 @@ -15203,6 +15235,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 @@ -17606,6 +17665,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 2ed349cb..2176219d 100644 --- a/src/info.h +++ b/src/info.h @@ -602,6 +602,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 @@ -652,6 +653,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, @@ -3210,6 +3216,9 @@ typedef enum state S_DRIFTSPARK_C1, S_DRIFTSPARK_C2, + // Brake drift sparks + S_BRAKEDRIFT, + // Drift Smoke S_DRIFTDUST1, S_DRIFTDUST2, @@ -3720,7 +3729,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, @@ -4584,6 +4623,7 @@ typedef enum mobj_type MT_INVULNFLASH, MT_WIPEOUTTRAIL, MT_DRIFTSPARK, + MT_BRAKEDRIFT, MT_DRIFTDUST, MT_ROCKETSNEAKER, @@ -4706,6 +4746,8 @@ typedef enum mobj_type MT_KARMAHITBOX, MT_KARMAWHEEL, + MT_BATTLEPOINT, + MT_FZEROBOOM, // Various plants diff --git a/src/k_kart.c b/src/k_kart.c index eeb96c5a..25abf4a2 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 @@ -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 @@ -1784,6 +1801,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 +1860,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 +1951,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); } @@ -1940,7 +1985,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); @@ -1996,6 +2041,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); } @@ -3630,7 +3676,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 +3688,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); @@ -3879,6 +3925,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 @@ -4067,6 +4114,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) @@ -4454,7 +4504,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 +4519,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 @@ -4662,7 +4725,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 @@ -5577,6 +5641,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; +static patch_t *kp_lapanim_hand[3]; + +static patch_t *kp_yougotem; void K_LoadKartHUDGraphics(void) { @@ -5796,6 +5863,15 @@ void K_LoadKartHUDGraphics(void) } kp_lapanim_emblem = (patch_t *) W_CachePatchName("K_LAPE00", PU_HUDGFX); + + 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); + } + + kp_yougotem = (patch_t *) W_CachePatchName("YOUGOTEM", PU_HUDGFX); } // For the item toggle menu @@ -7376,41 +7452,57 @@ 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->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)) { - 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); } } } @@ -7652,6 +7744,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)/2), 32, V_HUDTRANS, kp_yougotem); + // Draw FREE PLAY. if (isfreeplay && !stplyr->spectator && timeinmap > 113) K_drawKartFreePlay(leveltime); 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_enemy.c b/src/p_enemy.c index 4d1c5de4..c4d1fe41 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8436,6 +8436,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_inter.c b/src/p_inter.c index eea55382..0529c0d5 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -456,6 +456,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; @@ -478,12 +480,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] = 2*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); @@ -507,6 +514,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 @@ -522,14 +531,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] = 2*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); diff --git a/src/p_map.c b/src/p_map.c index eba6ad8d..0129701a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -696,8 +696,33 @@ static boolean PIT_CheckThing(mobj_t *thing) return false; } + // 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) { @@ -1417,19 +1442,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]) @@ -1447,7 +1470,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. @@ -3915,6 +3938,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; diff --git a/src/p_mobj.c b/src/p_mobj.c index dc626b07..5404d27c 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)) @@ -6810,10 +6815,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; @@ -7007,10 +7012,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; } @@ -8136,6 +8141,7 @@ void P_MobjThinker(mobj_t *mobj) } case MT_BANANA: case MT_EGGMANITEM: + mobj->friction = ORIG_FRICTION/4; if (mobj->momx || mobj->momy) P_SpawnGhostMobj(mobj); if (mobj->z <= mobj->floorz && mobj->health > 1) @@ -8286,6 +8292,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_WHITE; + + K_MatchGenericExtraFlags(mobj, mobj->target); + if (leveltime & 1) + mobj->flags2 |= MF2_DONTDRAW; + } + break; case MT_PLAYERRETICULE: if (!mobj->target || !mobj->target->health) { @@ -8295,10 +8338,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])) @@ -8308,6 +8348,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; @@ -8518,8 +8580,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 995f52ae..651f3b20 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); @@ -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; thwompsactive = true; // Lap 2 effects } diff --git a/src/p_user.c b/src/p_user.c index 95e5c9fb..a2d07843 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8136,6 +8136,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 @@ -8607,8 +8611,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)