From ecaf14a76b86ffcd6fb3ee96cdda917296ff36ef Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 10 May 2019 17:04:30 -0400 Subject: [PATCH 001/117] Grow no longer has a speed boost, but no longer holds the item box hostage It can now be moved over to "mid-tier" instead of the end. Flame Shield will be taking its place as the "situational but powerful speed-up/offense combo item" --- src/d_player.h | 1 - src/dehacked.c | 3 +- src/k_kart.c | 76 ++++++++++---------------------------------------- src/p_inter.c | 2 +- src/p_mobj.c | 11 -------- src/p_user.c | 12 ++++---- 6 files changed, 22 insertions(+), 83 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 4b08d111a..48faca92c 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -335,7 +335,6 @@ typedef enum k_getsparks, // Disable drift sparks at low speed, JUST enough to give acceleration the actual headstart above speed k_jawztargetdelay, // Delay for Jawz target switching, to make it less twitchy k_spectatewait, // How long have you been waiting as a spectator - k_growcancel, // Hold the item button down to cancel Grow NUMKARTSTUFF } kartstufftype_t; diff --git a/src/dehacked.c b/src/dehacked.c index 3db8962d2..7e4b94117 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8471,8 +8471,7 @@ static const char *const KARTSTUFF_LIST[] = { "ITEMBLINKMODE", "GETSPARKS", "JAWZTARGETDELAY", - "SPECTATEWAIT", - "GROWCANCEL" + "SPECTATEWAIT" }; #endif diff --git a/src/k_kart.c b/src/k_kart.c index 501ba6139..adce3c111 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1259,7 +1259,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) { - fixed_t weight = 5<scale; switch (mobj->type) { @@ -1270,7 +1270,7 @@ static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) weight = 0; // Do not bump else { - weight = (mobj->player->kartweight)<player->kartweight) * mobj->scale; if (mobj->player->speed > K_GetKartSpeed(mobj->player, false)) weight += (mobj->player->speed - K_GetKartSpeed(mobj->player, false))/8; } @@ -1282,21 +1282,21 @@ static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) || against->player->kartstuff[k_growshrinktimer] > 0) weight = 0; else - weight = (against->player->kartweight)<player->kartweight) * against->scale; } break; case MT_ORBINAUT: case MT_ORBINAUT_SHIELD: if (against->player) - weight = (against->player->kartweight)<player->kartweight) * against->scale; break; case MT_JAWZ: case MT_JAWZ_DUD: case MT_JAWZ_SHIELD: if (against->player) - weight = (against->player->kartweight+3)<player->kartweight+3) * against->scale; else - weight = 8<scale; break; default: break; @@ -2229,14 +2229,6 @@ static void K_GetKartBoostPower(player_t *player) if (player->kartstuff[k_ringboost]) // Ring Boost ADDBOOST(FRACUNIT/5, 4*FRACUNIT); // + 20% top speed, + 400% acceleration - if (player->kartstuff[k_growshrinktimer] > 0) // Grow - { - // Grow's design is weird with booster stacking. - // We'll see how to replace its design BEFORE v2 gets released. - speedboost += (FRACUNIT/5); // + 20% - //numboosts++; // Don't add any boost afterimages to Grow - } - if (player->kartstuff[k_draftpower] > 0) // Drafting { speedboost += (player->kartstuff[k_draftpower]) / 3; // + 0 to 33.3% top speed @@ -2545,7 +2537,6 @@ static void K_RemoveGrowShrink(player_t *player) } player->kartstuff[k_growshrinktimer] = 0; - player->kartstuff[k_growcancel] = -1; P_RestoreMusic(player); } @@ -4820,17 +4811,17 @@ static void K_UpdateInvincibilitySounds(player_t *player) { if (cv_kartinvinsfx.value) { - if (player->kartstuff[k_growshrinktimer] > 0) // Prioritize Grow - sfxnum = sfx_alarmg; - else if (player->kartstuff[k_invincibilitytimer] > 0) + if (player->kartstuff[k_invincibilitytimer] > 0) // Prioritize invincibility sfxnum = sfx_alarmi; + else if (player->kartstuff[k_growshrinktimer] > 0) + sfxnum = sfx_alarmg; } else { - if (player->kartstuff[k_growshrinktimer] > 0) - sfxnum = sfx_kgrow; - else if (player->kartstuff[k_invincibilitytimer] > 0) + if (player->kartstuff[k_invincibilitytimer] > 0) sfxnum = sfx_kinvnc; + else if (player->kartstuff[k_growshrinktimer] > 0) + sfxnum = sfx_kgrow; } } @@ -5855,7 +5846,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) && NO_HYUDORO && !(HOLDING_ITEM || player->kartstuff[k_itemamount] || player->kartstuff[k_itemroulette] - || player->kartstuff[k_growshrinktimer] // Being disabled during Shrink was unintended but people seemed to be okay with it sooo... + || player->kartstuff[k_growshrinktimer] < 0 // Being disabled during Shrink was unintended but people seemed to be okay with it sooo... || player->kartstuff[k_rocketsneakertimer] || player->kartstuff[k_eggmanexplode])) player->kartstuff[k_userings] = 1; @@ -5952,28 +5943,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->kartstuff[k_rocketsneakertimer] = 1; } } - // Grow Canceling - else if (player->kartstuff[k_growshrinktimer] > 0) - { - if (player->kartstuff[k_growcancel] >= 0) - { - if (cmd->buttons & BT_ATTACK) - { - player->kartstuff[k_growcancel]++; - if (player->kartstuff[k_growcancel] > 26) - K_RemoveGrowShrink(player); - } - else - player->kartstuff[k_growcancel] = 0; - } - else - { - if ((cmd->buttons & BT_ATTACK) || (player->pflags & PF_ATTACKDOWN)) - player->kartstuff[k_growcancel] = -1; - else - player->kartstuff[k_growcancel] = 0; - } - } else if (player->kartstuff[k_itemamount] <= 0) { player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0; @@ -6225,8 +6194,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } break; case KITEM_GROW: - if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO - && player->kartstuff[k_growshrinktimer] <= 0) // Grow holds the item box hostage + if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) { if (player->kartstuff[k_growshrinktimer] < 0) // If you're shrunk, then "grow" will just make you normal again. K_RemoveGrowShrink(player); @@ -6353,9 +6321,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else player->kartstuff[k_curshield] = 0; - if (player->kartstuff[k_growshrinktimer] <= 0) - player->kartstuff[k_growcancel] = -1; - if (player->kartstuff[k_itemtype] == KITEM_SPB || player->kartstuff[k_itemtype] == KITEM_SHRINK || player->kartstuff[k_growshrinktimer] < 0) @@ -7581,19 +7546,6 @@ static void K_drawKartItem(void) else localpatch = kp_nodraw; } - else if (stplyr->kartstuff[k_growshrinktimer] > 0) - { - if (stplyr->kartstuff[k_growcancel] > 0) - { - itembar = stplyr->kartstuff[k_growcancel]; - maxl = 26; - } - - if (leveltime & 1) - localpatch = kp_grow[offset]; - else - localpatch = kp_nodraw; - } else if (stplyr->kartstuff[k_sadtimer] > 0) { if (leveltime & 2) diff --git a/src/p_inter.c b/src/p_inter.c index 9e6d64030..8d898f83d 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -132,7 +132,7 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon) { // Item-specific timer going off if (player->kartstuff[k_stealingtimer] || player->kartstuff[k_stolentimer] - || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_rocketsneakertimer] + || player->kartstuff[k_rocketsneakertimer] || player->kartstuff[k_eggmanexplode]) return false; diff --git a/src/p_mobj.c b/src/p_mobj.c index e5f8bc65f..be4bf0c1a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6805,17 +6805,6 @@ void P_MobjThinker(mobj_t *mobj) else mobj->tracer->flags2 |= MF2_DONTDRAW; } - else if (mobj->target->player->kartstuff[k_growshrinktimer] > 0) - { - P_SetMobjState(mobj, S_PLAYERARROW_BOX); - mobj->tracer->sprite = SPR_ITEM; - mobj->tracer->frame = FF_FULLBRIGHT|KITEM_GROW; - - if (leveltime & 1) - mobj->tracer->flags2 &= ~MF2_DONTDRAW; - else - mobj->tracer->flags2 |= MF2_DONTDRAW; - } else if (mobj->target->player->kartstuff[k_itemtype] && mobj->target->player->kartstuff[k_itemamount] > 0) { P_SetMobjState(mobj, S_PLAYERARROW_BOX); diff --git a/src/p_user.c b/src/p_user.c index ab14d1d49..bd2e8ee28 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1218,10 +1218,10 @@ void P_RestoreMusic(player_t *player) #define setbests(p) \ if (players[p].playerstate == PST_LIVE) \ { \ - if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \ - { wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \ - else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \ + if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \ { wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \ + else if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \ + { wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \ } setbests(displayplayers[0]); setbests(displayplayers[1]); @@ -1235,10 +1235,10 @@ void P_RestoreMusic(player_t *player) { if (player->playerstate == PST_LIVE) { - if (player->kartstuff[k_growshrinktimer] > 1) - wantedmus = 2; - else if (player->kartstuff[k_invincibilitytimer] > 1) + if (player->kartstuff[k_invincibilitytimer] > 1) wantedmus = 1; + else if (player->kartstuff[k_growshrinktimer] > 1) + wantedmus = 2; } } From c2a07b486b89a03ef626b20b235d23c0db905a36 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 11 May 2019 15:20:06 -0400 Subject: [PATCH 002/117] Add Flame Shield --- src/d_player.h | 16 +++ src/dehacked.c | 36 ++++++- src/info.c | 101 ++++++++++++++++--- src/info.h | 27 ++++- src/k_kart.c | 262 ++++++++++++++++++++++++++++++++++++++++--------- src/k_kart.h | 1 + src/p_enemy.c | 2 +- src/p_inter.c | 14 +-- src/p_map.c | 4 + src/p_mobj.c | 71 +++++++++++++- src/p_user.c | 2 +- 11 files changed, 464 insertions(+), 72 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 48faca92c..024c2e04f 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -214,6 +214,8 @@ typedef enum KITEM_GROW, KITEM_SHRINK, KITEM_THUNDERSHIELD, + KITEM_BUBBLESHIELD, + KITEM_FLAMESHIELD, KITEM_HYUDORO, KITEM_POGOSPRING, KITEM_SUPERRING, @@ -232,6 +234,15 @@ typedef enum NUMKARTRESULTS } kartitems_t; +typedef enum +{ + KSHIELD_NONE = 0, + KSHIELD_THUNDER = 1, + KSHIELD_BUBBLE = 2, + KSHIELD_FLAME = 3, + NUMKARTSHIELDS +} kartshields_t; + //{ SRB2kart - kartstuff typedef enum { @@ -311,6 +322,8 @@ typedef enum k_squishedtimer, // Squished frame timer k_rocketsneakertimer, // Rocket Sneaker duration timer k_invincibilitytimer, // Invincibility timer + k_flameready, // Flame Shield dash ready to activate + k_flamedash, // Flame Shield dash power k_eggmanheld, // Eggman monitor held, separate from k_itemheld so it doesn't stop you from getting items k_eggmanexplode, // Fake item recieved, explode in a few seconds k_eggmanblame, // Fake item recieved, who set this fake @@ -342,6 +355,9 @@ typedef enum // QUICKLY GET EITHER SNEAKER OR LEVEL BOOSTER SINCE THEY ARE FUNCTIONALLY IDENTICAL #define EITHERSNEAKER(p) (p->kartstuff[k_sneakertimer] || p->kartstuff[k_levelbooster]) +// QUICKLY GET RING TOTAL, INCLUDING RINGS CURRENTLY IN THE PICKUP ANIMATION +#define RINGTOTAL(p) (p->kartstuff[k_rings] + p->kartstuff[k_pickuprings]) + //} #define WEP_AUTO 1 diff --git a/src/dehacked.c b/src/dehacked.c index 7e4b94117..7ae32e384 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6623,6 +6623,27 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_THUNDERSHIELD23", "S_THUNDERSHIELD24", + // Flame Shield + "S_FLAMESHIELD1", + "S_FLAMESHIELD2", + "S_FLAMESHIELD3", + "S_FLAMESHIELD4", + "S_FLAMESHIELD5", + "S_FLAMESHIELD6", + "S_FLAMESHIELD7", + "S_FLAMESHIELD8", + "S_FLAMESHIELD9", + "S_FLAMESHIELD10", + "S_FLAMESHIELD11", + "S_FLAMESHIELD12", + "S_FLAMESHIELD13", + "S_FLAMESHIELD14", + "S_FLAMESHIELD15", + "S_FLAMESHIELD16", + "S_FLAMESHIELD17", + "S_FLAMESHIELD18", + "S_FLAMESHIELDDASH", + // The legend "S_SINK", "S_SINK_SHIELD", @@ -7757,7 +7778,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_SPB", // Self-Propelled Bomb "MT_SPBEXPLOSION", - "MT_THUNDERSHIELD", // Thunder Shield stuff + "MT_THUNDERSHIELD", // Shields + "MT_BUBBLESHIELD", + "MT_FLAMESHIELD", "MT_SINK", // Kitchen Sink Stuff "MT_SINK_SHIELD", @@ -8450,6 +8473,8 @@ static const char *const KARTSTUFF_LIST[] = { "SQUISHEDTIMER", "ROCKETSNEAKERTIMER", "INVINCIBILITYTIMER", + "FLAMEREADY", + "FLAMEDASH", "EGGMANHELD", "EGGMANEXPLODE", "EGGMANBLAME", @@ -8993,6 +9018,8 @@ struct { {"KITEM_GROW",KITEM_GROW}, {"KITEM_SHRINK",KITEM_SHRINK}, {"KITEM_THUNDERSHIELD",KITEM_THUNDERSHIELD}, + {"KITEM_BUBBLESHIELD",KITEM_BUBBLESHIELD}, + {"KITEM_FLAMESHIELD",KITEM_FLAMESHIELD}, {"KITEM_HYUDORO",KITEM_HYUDORO}, {"KITEM_POGOSPRING",KITEM_POGOSPRING}, {"KITEM_SUPERRING",KITEM_SUPERRING}, @@ -9006,6 +9033,13 @@ struct { {"KRITEM_DUALJAWZ",KRITEM_DUALJAWZ}, {"NUMKARTRESULTS",NUMKARTRESULTS}, + // kartshields_t + {"KSHIELD_NONE",KSHIELD_NONE}, + {"KSHIELD_THUNDER",KSHIELD_THUNDER}, + {"KSHIELD_BUBBLE",KSHIELD_BUBBLE}, + {"KSHIELD_FLAME",KSHIELD_FLAME}, + {"NUMKARTSHIELDS",NUMKARTSHIELDS}, + // translation colormaps {"TC_DEFAULT",TC_DEFAULT}, {"TC_BOSS",TC_BOSS}, diff --git a/src/info.c b/src/info.c index 31f2f8348..c87ac4866 100644 --- a/src/info.c +++ b/src/info.c @@ -57,19 +57,19 @@ char sprnames[NUMSPRITES + 1][5] = //SRB2kart Sprites "SPRG","BSPR","RNDM","RPOP","SGNS","FAST","DSHR","BOST","BOSM","KFRE", "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", - "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","FWRK", - "MXCL","RGSP","DRAF","XMS4","XMS5","VIEW" + "JAWZ","SSMN","KRBM","BHOG","BHBM","SPBM","THNS","BUBS","FLMS","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","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","FWRK","MXCL","RGSP","DRAF","XMS4","XMS5","VIEW" }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) @@ -2850,6 +2850,26 @@ state_t states[NUMSTATES] = {SPR_THNS, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_THUNDERSHIELD24}, // S_THUNDERSHIELD23 {SPR_THNS, FF_FULLBRIGHT|0, 2, {NULL}, 0, 0, S_THUNDERSHIELD1}, // S_THUNDERSHIELD24 + {SPR_FLMS, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_FLAMESHIELD2}, // S_FLAMESHIELD1 + {SPR_FLMS, FF_FULLBRIGHT|9, 2, {NULL}, 0, 0, S_FLAMESHIELD3}, // S_FLAMESHIELD2 + {SPR_FLMS, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_FLAMESHIELD4}, // S_FLAMESHIELD3 + {SPR_FLMS, FF_FULLBRIGHT|10, 2, {NULL}, 0, 0, S_FLAMESHIELD5}, // S_FLAMESHIELD4 + {SPR_FLMS, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_FLAMESHIELD6}, // S_FLAMESHIELD5 + {SPR_FLMS, FF_FULLBRIGHT|11, 2, {NULL}, 0, 0, S_FLAMESHIELD7}, // S_FLAMESHIELD6 + {SPR_FLMS, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_FLAMESHIELD8}, // S_FLAMESHIELD7 + {SPR_FLMS, FF_FULLBRIGHT|12, 2, {NULL}, 0, 0, S_FLAMESHIELD9}, // S_FLAMESHIELD8 + {SPR_FLMS, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_FLAMESHIELD10}, // S_FLAMESHIELD9 + {SPR_FLMS, FF_FULLBRIGHT|13, 2, {NULL}, 0, 0, S_FLAMESHIELD11}, // S_FLAMESHIELD10 + {SPR_FLMS, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_FLAMESHIELD12}, // S_FLAMESHIELD11 + {SPR_FLMS, FF_FULLBRIGHT|14, 2, {NULL}, 0, 0, S_FLAMESHIELD13}, // S_FLAMESHIELD12 + {SPR_FLMS, FF_FULLBRIGHT|6, 2, {NULL}, 0, 0, S_FLAMESHIELD14}, // S_FLAMESHIELD13 + {SPR_FLMS, FF_FULLBRIGHT|15, 2, {NULL}, 0, 0, S_FLAMESHIELD15}, // S_FLAMESHIELD14 + {SPR_FLMS, FF_FULLBRIGHT|7, 2, {NULL}, 0, 0, S_FLAMESHIELD16}, // S_FLAMESHIELD15 + {SPR_FLMS, FF_FULLBRIGHT|16, 2, {NULL}, 0, 0, S_FLAMESHIELD17}, // S_FLAMESHIELD16 + {SPR_FLMS, FF_FULLBRIGHT|8, 2, {NULL}, 0, 0, S_FLAMESHIELD18}, // S_FLAMESHIELD17 + {SPR_FLMS, FF_FULLBRIGHT|17, 2, {NULL}, 0, 0, S_FLAMESHIELD1}, // S_FLAMESHIELD18 + {SPR_FLMS, FF_FULLBRIGHT|18, -1, {NULL}, 0, 0, S_FLAMESHIELDDASH}, // S_FLAMESHIELDDASH + {SPR_SINK, 0, 1, {A_SmokeTrailer}, MT_SINKTRAIL, 0, S_SINK}, // S_SINK {SPR_SINK, 0|FF_TRANS80|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_SINK_SHIELD}, // S_SINK_SHIELD {SPR_SITR, 0, 1, {NULL}, 0, 0, S_SINKTRAIL2}, // S_SINKTRAIL1 @@ -15935,6 +15955,61 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_BUBBLESHIELD + -1, // doomednum + S_THUNDERSHIELD1, // 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 + 20*FRACUNIT, // radius + 56*FRACUNIT, // height + 1, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + + { // MT_FLAMESHIELD + -1, // doomednum + S_FLAMESHIELD1, // 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 + 20*FRACUNIT, // radius + 56*FRACUNIT, // height + 1, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + + { // MT_SINK -1, // doomednum S_SINK, // spawnstate diff --git a/src/info.h b/src/info.h index e2a60e131..a302aa679 100644 --- a/src/info.h +++ b/src/info.h @@ -617,6 +617,8 @@ typedef enum sprite SPR_BHBM, // Ballhog BOOM SPR_SPBM, // Self-Propelled Bomb SPR_THNS, // Thunder Shield + SPR_BUBS, // Bubble Shield (not Bubs) + SPR_FLMS, // Flame Shield SPR_SINK, // Kitchen Sink SPR_SITR, // Kitchen Sink Trail SPR_KBLN, // Battle Mode Bumper @@ -3516,6 +3518,27 @@ typedef enum state S_THUNDERSHIELD23, S_THUNDERSHIELD24, + // Flame Shield + S_FLAMESHIELD1, + S_FLAMESHIELD2, + S_FLAMESHIELD3, + S_FLAMESHIELD4, + S_FLAMESHIELD5, + S_FLAMESHIELD6, + S_FLAMESHIELD7, + S_FLAMESHIELD8, + S_FLAMESHIELD9, + S_FLAMESHIELD10, + S_FLAMESHIELD11, + S_FLAMESHIELD12, + S_FLAMESHIELD13, + S_FLAMESHIELD14, + S_FLAMESHIELD15, + S_FLAMESHIELD16, + S_FLAMESHIELD17, + S_FLAMESHIELD18, + S_FLAMESHIELDDASH, + // The legend S_SINK, S_SINK_SHIELD, @@ -4682,7 +4705,9 @@ typedef enum mobj_type MT_SPB, // SPB stuff MT_SPBEXPLOSION, - MT_THUNDERSHIELD, // Thunder Shield stuff + MT_THUNDERSHIELD, // Shields + MT_BUBBLESHIELD, + MT_FLAMESHIELD, MT_SINK, // Kitchen Sink Stuff MT_SINK_SHIELD, diff --git a/src/k_kart.c b/src/k_kart.c index adce3c111..d0f777daf 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -652,24 +652,26 @@ fixed_t K_GetKartGameSpeedScalar(SINT8 value) static INT32 K_KartItemOddsRace[NUMKARTRESULTS][8] = { //P-Odds 0 1 2 3 4 5 6 7 - /*Sneaker*/ { 0, 0, 4, 6, 7, 0, 0, 0 }, // Sneaker - /*Rocket Sneaker*/ { 0, 0, 0, 0, 1, 4, 5, 3 }, // Rocket Sneaker - /*Invincibility*/ { 0, 0, 0, 0, 1, 4, 6,10 }, // Invincibility - /*Banana*/ { 9, 4, 2, 1, 0, 0, 0, 0 }, // Banana + /*Sneaker*/ { 0, 0, 3, 5, 6, 0, 0, 0 }, // Sneaker + /*Rocket Sneaker*/ { 0, 0, 0, 0, 0, 2, 4, 6 }, // Rocket Sneaker + /*Invincibility*/ { 0, 0, 0, 0, 1, 4, 8,12 }, // Invincibility + /*Banana*/ { 7, 4, 2, 1, 0, 0, 0, 0 }, // Banana /*Eggman Monitor*/ { 3, 2, 1, 0, 0, 0, 0, 0 }, // Eggman Monitor - /*Orbinaut*/ { 7, 6, 4, 2, 0, 0, 0, 0 }, // Orbinaut + /*Orbinaut*/ { 7, 5, 4, 2, 0, 0, 0, 0 }, // Orbinaut /*Jawz*/ { 0, 3, 2, 1, 1, 0, 0, 0 }, // Jawz /*Mine*/ { 0, 2, 2, 1, 0, 0, 0, 0 }, // Mine /*Ballhog*/ { 0, 0, 2, 1, 0, 0, 0, 0 }, // Ballhog /*Self-Propelled Bomb*/ { 0, 1, 2, 3, 4, 2, 2, 0 }, // Self-Propelled Bomb - /*Grow*/ { 0, 0, 0, 0, 0, 2, 5, 7 }, // Grow + /*Grow*/ { 0, 0, 0, 1, 1, 2, 0, 0 }, // Grow /*Shrink*/ { 0, 0, 0, 0, 0, 0, 2, 0 }, // Shrink /*Thunder Shield*/ { 1, 2, 0, 0, 0, 0, 0, 0 }, // Thunder Shield + /*Bubble Shield*/ { 0, 0, 0, 0, 0, 0, 0, 0 }, // Bubble Shield + /*Flame Shield*/ { 0, 0, 0, 0, 0, 0, 1, 2 }, // Flame Shield /*Hyudoro*/ { 0, 0, 0, 1, 2, 1, 0, 0 }, // Hyudoro /*Pogo Spring*/ { 0, 0, 0, 0, 0, 0, 0, 0 }, // Pogo Spring /*Super Ring*/ { 2, 1, 1, 0, 0, 0, 0, 0 }, // Super Ring /*Kitchen Sink*/ { 0, 0, 0, 0, 0, 0, 0, 0 }, // Kitchen Sink - /*Sneaker x3*/ { 0, 0, 0, 3, 7, 9, 2, 0 }, // Sneaker x3 + /*Sneaker x3*/ { 0, 0, 0, 2, 6,10, 5, 0 }, // Sneaker x3 /*Banana x3*/ { 0, 1, 1, 0, 0, 0, 0, 0 }, // Banana x3 /*Banana x10*/ { 0, 0, 0, 1, 0, 0, 0, 0 }, // Banana x10 /*Orbinaut x3*/ { 0, 0, 1, 0, 0, 0, 0, 0 }, // Orbinaut x3 @@ -693,6 +695,8 @@ static INT32 K_KartItemOddsBattle[NUMKARTRESULTS][6] = /*Grow*/ { 0, 0, 1, 2, 4, 2 }, // Grow /*Shrink*/ { 0, 0, 0, 0, 0, 0 }, // Shrink /*Thunder Shield*/ { 0, 0, 0, 0, 0, 0 }, // Thunder Shield + /*Bubble Shield*/ { 0, 0, 0, 0, 0, 0 }, // Bubble Shield + /*Flame Shield*/ { 0, 0, 0, 0, 0, 0 }, // Flame Shield /*Hyudoro*/ { 1, 1, 0, 0, 0, 0 }, // Hyudoro /*Pogo Spring*/ { 1, 1, 0, 0, 0, 0 }, // Pogo Spring /*Super Ring*/ { 0, 0, 0, 0, 0, 0 }, // Super Ring @@ -707,6 +711,17 @@ static INT32 K_KartItemOddsBattle[NUMKARTRESULTS][6] = #define DISTVAR (64*14) +INT32 K_GetShieldFromItem(INT32 item) +{ + switch (item) + { + case KITEM_THUNDERSHIELD: return KSHIELD_THUNDER; + case KITEM_BUBBLESHIELD: return KSHIELD_BUBBLE; + case KITEM_FLAMESHIELD: return KSHIELD_FLAME; + default: return KSHIELD_NONE; + } +} + /** \brief Item Roulette for Kart \param player player @@ -774,9 +789,10 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp INT32 newodds; INT32 i; UINT8 pingame = 0, pexiting = 0; - boolean thunderisout = false; + boolean shieldout[NUMKARTSHIELDS-1]; SINT8 first = -1, second = -1; INT32 secondist = 0; + INT32 shieldtype = KSHIELD_NONE; boolean itemenabled[NUMKARTRESULTS-1] = { cv_sneaker.value, cv_rocketsneaker.value, @@ -816,6 +832,8 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp // Base multiplication to ALL item odds to simulate fractional precision newodds *= 4; + memset(shieldout, false, sizeof(shieldout)); + for (i = 0; i < MAXPLAYERS; i++) { if (!playeringame[i] || players[i].spectator) @@ -827,18 +845,16 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp if (players[i].exiting) pexiting++; - if (players[i].mo) - { - if (players[i].kartstuff[k_itemtype] == KITEM_THUNDERSHIELD) - thunderisout = true; + shieldtype = K_GetShieldFromItem(players[i].kartstuff[k_itemtype]); + if (shieldtype != KSHIELD_NONE) + shieldout[shieldtype-1] = true; - if (!G_BattleGametype()) - { - if (players[i].kartstuff[k_position] == 1 && first == -1) - first = i; - if (players[i].kartstuff[k_position] == 2 && second == -1) - second = i; - } + if (players[i].mo && G_RaceGametype()) + { + if (players[i].kartstuff[k_position] == 1 && first == -1) + first = i; + if (players[i].kartstuff[k_position] == 2 && second == -1) + second = i; } } @@ -852,6 +868,11 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp secondist = ((28 + (8-pingame)) * secondist) / 28; } + // Don't allow more than one of each shield type at a time + shieldtype = K_GetShieldFromItem(item); + if (shieldout[shieldtype-1]) + return 0; + // POWERITEMODDS handles all of the "frantic item" related functionality, for all of our powerful items. // First, it multiplies it by 2 if franticitems is true; easy-peasy. // Next, it multiplies it again if it's in SPB mode and 2nd needs to apply pressure to 1st. @@ -889,6 +910,8 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp case KITEM_INVINCIBILITY: case KITEM_MINE: case KITEM_GROW: + case KITEM_BUBBLESHIELD: + case KITEM_FLAMESHIELD: if (COOLDOWNONSTART) newodds = 0; else @@ -907,10 +930,11 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp POWERITEMODDS(newodds); break; case KITEM_THUNDERSHIELD: - if (thunderisout || spbplace != -1) + if (spbplace != -1 || COOLDOWNONSTART) newodds = 0; else POWERITEMODDS(newodds); + break; case KITEM_HYUDORO: if ((hyubgone > 0) || COOLDOWNONSTART) newodds = 0; @@ -1600,11 +1624,16 @@ static void K_DrawDraftCombiring(player_t *player, player_t *victim, fixed_t cur SKINCOLOR_CHERRY }; fixed_t minimumdist = FixedMul(RING_DIST>>1, player->mo->scale); - UINT8 c = FixedMul(CHAOTIXBANDCOLORS<> FRACBITS; UINT8 n = CHAOTIXBANDLEN; UINT8 offset = ((leveltime / 3) % 3); fixed_t stepx, stepy, stepz; fixed_t curx, cury, curz; + UINT8 c; + + if (maxdist == 0) + c = 0; + else + c = FixedMul(CHAOTIXBANDCOLORS<> FRACBITS; stepx = (victim->mo->x - player->mo->x) / CHAOTIXBANDLEN; stepy = (victim->mo->y - player->mo->y) / CHAOTIXBANDLEN; @@ -1656,13 +1685,21 @@ static void K_UpdateDraft(player_t *player) UINT8 leniency; UINT8 i; - // Distance you have to be to draft. If you're still accelerating, then this distance is lessened. - // This distance biases toward low weight! (min weight gets 4096 units, max weight gets 3072 units) - // This distance is also scaled based on game speed. - draftdistance = (3072 + (128 * (9 - player->kartweight))) * player->mo->scale; - if (player->speed < topspd) - draftdistance = FixedMul(draftdistance, FixedDiv(player->speed, topspd)); - draftdistance = FixedMul(draftdistance, K_GetKartGameSpeedScalar(gamespeed)); + if (player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) + { + // Flame Shield gets infinite draft distance as its passive effect. + draftdistance = 0; + } + else + { + // Distance you have to be to draft. If you're still accelerating, then this distance is lessened. + // This distance biases toward low weight! (min weight gets 4096 units, max weight gets 3072 units) + // This distance is also scaled based on game speed. + draftdistance = (3072 + (128 * (9 - player->kartweight))) * player->mo->scale; + if (player->speed < topspd) + draftdistance = FixedMul(draftdistance, FixedDiv(player->speed, topspd)); + draftdistance = FixedMul(draftdistance, K_GetKartGameSpeedScalar(gamespeed)); + } // On the contrary, the leniency period biases toward high weight. // (See also: the leniency variable in K_SpawnDraftDust) @@ -1722,7 +1759,7 @@ static void K_UpdateDraft(player_t *player) continue; // Not close enough to draft. - if (dist > draftdistance) + if (dist > draftdistance && draftdistance > 0) continue; #endif @@ -2220,6 +2257,12 @@ static void K_GetKartBoostPower(player_t *player) if (player->kartstuff[k_invincibilitytimer]) // Invincibility ADDBOOST((3*FRACUNIT)/8, 3*FRACUNIT); // + 37.5% top speed, + 300% acceleration + if (player->kartstuff[k_flamedash]) // Flame Shield dash + { + fixed_t dashval = ((player->kartstuff[k_flamedash]<kartstuff[k_startboost]) // Startup Boost ADDBOOST(FRACUNIT/4, 6*FRACUNIT); // + 25% top speed, + 600% acceleration @@ -3842,6 +3885,29 @@ static void K_DoThunderShield(player_t *player) #undef THUNDERRADIUS +static void K_FlameShieldPop(mobj_t *src) +{ + mobj_t *smoke; + UINT8 i; + + //S_StartSound(src, sfx_zio3); + + // spawn vertical bolt + for (i = 0; i < 8; i++) + { + smoke = P_SpawnMobj(src->x, src->y, src->z, MT_SMOKE); + P_SetMobjState(smoke, S_OPAQUESMOKE1); + P_SetScale(smoke, 2*smoke->scale); + smoke->destscale = 8*smoke->scale; + smoke->angle = FixedAngle((i*45)<fuse = P_RandomRange(20, 50); + smoke->momx = src->momx; + smoke->momy = src->momy; + smoke->momz = src->momz + (P_RandomRange(1,4) * smoke->scale); + P_Thrust(smoke, smoke->angle, (P_RandomRange(1,2) * smoke->scale)); + } +} + static void K_DoHyudoroSteal(player_t *player) { INT32 i, numplayers = 0; @@ -3849,6 +3915,10 @@ static void K_DoHyudoroSteal(player_t *player) INT32 stealplayer = -1; // The player that's getting stolen from INT32 prandom = 0; boolean sink = P_RandomChance(FRACUNIT/64); + INT32 hyu = hyudorotime; + + if (G_RaceGametype()) + hyu = (hyu<<1); // double in race for (i = 0; i < MAXPLAYERS; i++) { @@ -4132,11 +4202,18 @@ void K_DropHnextList(player_t *player) flip = P_MobjFlip(player->mo); ponground = P_IsObjectOnGround(player->mo); - if (player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD && player->kartstuff[k_itemamount]) + if (player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD) { K_DoThunderShield(player); - player->kartstuff[k_itemamount] = 0; player->kartstuff[k_itemtype] = KITEM_NONE; + player->kartstuff[k_itemamount] = 0; + player->kartstuff[k_curshield] = 0; + } + else if (player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) + { + //K_PopFlameShield(player); + player->kartstuff[k_itemtype] = KITEM_NONE; + player->kartstuff[k_itemamount] = 0; player->kartstuff[k_curshield] = 0; } @@ -4258,9 +4335,12 @@ void K_DropHnextList(player_t *player) // For getting EXTRA hit! void K_DropItems(player_t *player) { - boolean thunderhack = (player->kartstuff[k_curshield] && player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD); + INT32 shieldhack = 0; - if (thunderhack) + if (player->kartstuff[k_curshield]) + shieldhack = K_GetShieldFromItem(player->kartstuff[k_itemtype]); + + if (shieldhack) player->kartstuff[k_itemtype] = KITEM_NONE; K_DropHnextList(player); @@ -4279,7 +4359,13 @@ void K_DropItems(player_t *player) if (drop->eflags & MFE_UNDERWATER) drop->momz = (117 * drop->momz) / 200; - drop->threshold = (thunderhack ? KITEM_THUNDERSHIELD : player->kartstuff[k_itemtype]); + switch (shieldhack) + { + case KSHIELD_THUNDER: drop->threshold = KITEM_THUNDERSHIELD; break; + case KSHIELD_BUBBLE: drop->threshold = KITEM_BUBBLESHIELD; break; + case KSHIELD_FLAME: drop->threshold = KITEM_FLAMESHIELD; break; + default: drop->threshold = player->kartstuff[k_itemtype]; break; + } drop->movecount = player->kartstuff[k_itemamount]; drop->flags |= MF_NOCLIPTHING; @@ -5384,6 +5470,14 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue) if (player->spectator) return turnvalue; + if (player->kartstuff[k_flamedash]) // Reduce turning + { + fixed_t dashval = ((player->kartstuff[k_flamedash]< FRACUNIT) + return 0; // NO MORE TURNING! + turnvalue = FixedMul(turnvalue, FRACUNIT-dashval); + } + if (player->kartstuff[k_drift] != 0 && P_IsObjectOnGround(player->mo)) { // If we're drifting we have a completely different turning value @@ -5402,7 +5496,7 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue) turnvalue = FixedMul(turnvalue, adjustangle); // Weight has a small effect on turning if (EITHERSNEAKER(player) || player->kartstuff[k_invincibilitytimer] || player->kartstuff[k_growshrinktimer] > 0) - turnvalue = FixedMul(turnvalue, FixedDiv(5*FRACUNIT, 4*FRACUNIT)); + turnvalue = FixedMul(turnvalue, (5*FRACUNIT)/4); return turnvalue; } @@ -6223,14 +6317,15 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } break; case KITEM_THUNDERSHIELD: - if (player->kartstuff[k_curshield] != 1) + if (player->kartstuff[k_curshield] != KSHIELD_THUNDER) { mobj_t *shield = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_THUNDERSHIELD); P_SetScale(shield, (shield->destscale = (5*shield->destscale)>>2)); P_SetTarget(&shield->target, player->mo); - S_StartSound(shield, sfx_s3k41); - player->kartstuff[k_curshield] = 1; + S_StartSound(player->mo, sfx_s3k41); + player->kartstuff[k_curshield] = KSHIELD_THUNDER; } + if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) { K_DoThunderShield(player); @@ -6238,6 +6333,53 @@ void K_MoveKartPlayer(player_t *player, boolean onground) K_PlayAttackTaunt(player->mo); } break; + case KITEM_BUBBLESHIELD: + if (player->kartstuff[k_curshield] != KSHIELD_BUBBLE) + { + //mobj_t *shield = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BUBBLESHIELD); + //P_SetScale(shield, (shield->destscale = (5*shield->destscale)>>2)); + //P_SetTarget(&shield->target, player->mo); + S_StartSound(player->mo, sfx_s3k3f); + player->kartstuff[k_curshield] = KSHIELD_BUBBLE; + } + case KITEM_FLAMESHIELD: + if (player->kartstuff[k_curshield] != KSHIELD_FLAME) + { + mobj_t *shield = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_FLAMESHIELD); + P_SetScale(shield, (shield->destscale = (5*shield->destscale)>>2)); + P_SetTarget(&shield->target, player->mo); + S_StartSound(player->mo, sfx_s3k3e); + player->kartstuff[k_curshield] = KSHIELD_FLAME; + } + + if (!HOLDING_ITEM && NO_HYUDORO) + { + if (cmd->buttons & BT_ATTACK) + { + if (player->kartstuff[k_flameready]) + { + if (player->kartstuff[k_flamedash] == 0) + K_PlayBoostTaunt(player->mo); + player->kartstuff[k_flamedash]++; + } + } + else + { + if (player->kartstuff[k_flamedash] > TICRATE) + { + K_FlameShieldPop(player->mo); + player->kartstuff[k_flamedash] = 0; + player->kartstuff[k_flameready] = 0; + player->kartstuff[k_itemamount]--; + } + else + { + player->kartstuff[k_flamedash] = 0; + player->kartstuff[k_flameready] = 1; + } + } + } + break; case KITEM_HYUDORO: if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) { @@ -6315,11 +6457,21 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD) { - if ((player->kartstuff[k_rings]+player->kartstuff[k_pickuprings]) < 20 && !player->kartstuff[k_ringlock]) + if (RINGTOTAL(player) < 20 && !player->kartstuff[k_ringlock]) K_LookForRings(player->mo); } - else - player->kartstuff[k_curshield] = 0; + + if (player->kartstuff[k_itemtype] != KITEM_FLAMESHIELD + || player->exiting || player->kartstuff[k_spinouttimer] || player->kartstuff[k_squishedtimer]) + { + if (player->kartstuff[k_flamedash]) + K_FlameShieldPop(player->mo); + player->kartstuff[k_flamedash] = 0; + player->kartstuff[k_flameready] = 0; + } + + if (K_GetShieldFromItem(player->kartstuff[k_itemtype]) == KSHIELD_NONE) + player->kartstuff[k_curshield] = KSHIELD_NONE; // RESET shield type if (player->kartstuff[k_itemtype] == KITEM_SPB || player->kartstuff[k_itemtype] == KITEM_SHRINK @@ -6335,7 +6487,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else player->mo->flags2 &= ~MF2_DONTDRAW; - if (player->kartstuff[k_hyudorotimer] >= (1*TICRATE/2) && player->kartstuff[k_hyudorotimer] <= hyudorotime-(1*TICRATE/2)) + if (player->kartstuff[k_hyudorotimer] >= (TICRATE/2) && player->kartstuff[k_hyudorotimer] <= hyudorotime-(TICRATE/2)) { if (player == &players[displayplayers[1]]) player->mo->eflags |= MFE_DRAWONLYFORP2; @@ -6354,7 +6506,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else { if (P_IsDisplayPlayer(player) - || (!P_IsDisplayPlayer(player) && (player->kartstuff[k_hyudorotimer] < (1*TICRATE/2) || player->kartstuff[k_hyudorotimer] > hyudorotime-(1*TICRATE/2)))) + || (!P_IsDisplayPlayer(player) && (player->kartstuff[k_hyudorotimer] < (TICRATE/2) || player->kartstuff[k_hyudorotimer] > hyudorotime-(TICRATE/2)))) { if (leveltime & 1) player->mo->flags2 |= MF2_DONTDRAW; @@ -6877,6 +7029,8 @@ static patch_t *kp_selfpropelledbomb[2]; static patch_t *kp_grow[2]; static patch_t *kp_shrink[2]; static patch_t *kp_thundershield[2]; +static patch_t *kp_bubbleshield[2]; +static patch_t *kp_flameshield[2]; static patch_t *kp_hyudoro[2]; static patch_t *kp_pogospring[2]; static patch_t *kp_kitchensink[2]; @@ -7063,6 +7217,8 @@ void K_LoadKartHUDGraphics(void) kp_grow[0] = W_CachePatchName("K_ITGROW", PU_HUDGFX); kp_shrink[0] = W_CachePatchName("K_ITSHRK", PU_HUDGFX); kp_thundershield[0] = W_CachePatchName("K_ITTHNS", PU_HUDGFX); + kp_bubbleshield[0] = W_CachePatchName("K_ITBUBS", PU_HUDGFX); + kp_flameshield[0] = W_CachePatchName("K_ITFLMS", PU_HUDGFX); kp_hyudoro[0] = W_CachePatchName("K_ITHYUD", PU_HUDGFX); kp_pogospring[0] = W_CachePatchName("K_ITPOGO", PU_HUDGFX); kp_kitchensink[0] = W_CachePatchName("K_ITSINK", PU_HUDGFX); @@ -7093,6 +7249,8 @@ void K_LoadKartHUDGraphics(void) kp_grow[1] = W_CachePatchName("K_ISGROW", PU_HUDGFX); kp_shrink[1] = W_CachePatchName("K_ISSHRK", PU_HUDGFX); kp_thundershield[1] = W_CachePatchName("K_ISTHNS", PU_HUDGFX); + kp_bubbleshield[1] = W_CachePatchName("K_ISBUBS", PU_HUDGFX); + kp_flameshield[1] = W_CachePatchName("K_ISFLMS", PU_HUDGFX); kp_hyudoro[1] = W_CachePatchName("K_ISHYUD", PU_HUDGFX); kp_pogospring[1] = W_CachePatchName("K_ISPOGO", PU_HUDGFX); kp_kitchensink[1] = W_CachePatchName("K_ISSINK", PU_HUDGFX); @@ -7215,6 +7373,10 @@ const char *K_GetItemPatch(UINT8 item, boolean tiny) return (tiny ? "K_ISSHRK" : "K_ITSHRK"); case KITEM_THUNDERSHIELD: return (tiny ? "K_ISTHNS" : "K_ITTHNS"); + case KITEM_BUBBLESHIELD: + return (tiny ? "K_ISBUBS" : "K_ITBUBS"); + case KITEM_FLAMESHIELD: + return (tiny ? "K_ISFLMS" : "K_ITFLMS"); case KITEM_HYUDORO: return (tiny ? "K_ISHYUD" : "K_ITHYUD"); case KITEM_POGOSPRING: @@ -7602,6 +7764,14 @@ static void K_drawKartItem(void) localpatch = kp_thundershield[offset]; localbg = kp_itembg[offset+1]; break; + case KITEM_BUBBLESHIELD: + localpatch = kp_bubbleshield[offset]; + localbg = kp_itembg[offset+1]; + break; + case KITEM_FLAMESHIELD: + localpatch = kp_flameshield[offset]; + localbg = kp_itembg[offset+1]; + break; case KITEM_HYUDORO: localpatch = kp_hyudoro[offset]; break; @@ -8885,8 +9055,8 @@ static void K_drawKartMinimap(void) if (players[i].kartstuff[k_hyudorotimer] > 0) { - if (!((players[i].kartstuff[k_hyudorotimer] < 1*TICRATE/2 - || players[i].kartstuff[k_hyudorotimer] > hyudorotime-(1*TICRATE/2)) + if (!((players[i].kartstuff[k_hyudorotimer] < TICRATE/2 + || players[i].kartstuff[k_hyudorotimer] > hyudorotime-(TICRATE/2)) && !(leveltime & 1))) continue; } @@ -9439,6 +9609,8 @@ static void K_drawDistributionDebugger(void) kp_grow[1], kp_shrink[1], kp_thundershield[1], + kp_bubbleshield[1], + kp_flameshield[1], kp_hyudoro[1], kp_pogospring[1], kp_superring[1], diff --git a/src/k_kart.h b/src/k_kart.h index b91e8c8a1..ccbb7b55a 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -23,6 +23,7 @@ void K_RegisterKartStuff(void); boolean K_IsPlayerLosing(player_t *player); boolean K_IsPlayerWanted(player_t *player); fixed_t K_GetKartGameSpeedScalar(SINT8 value); +INT32 K_GetShieldFromItem(INT32 item); void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid); void K_KartPainEnergyFling(player_t *player); void K_FlipFromObject(mobj_t *mo, mobj_t *master); diff --git a/src/p_enemy.c b/src/p_enemy.c index 91268b504..4ee97a59f 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3676,7 +3676,7 @@ void A_AttractChase(mobj_t *actor) if (actor->tracer && actor->tracer->player && actor->tracer->health //&& P_CheckSight(actor, actor->tracer) && actor->tracer->player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD - && (actor->tracer->player->kartstuff[k_rings]+actor->tracer->player->kartstuff[k_pickuprings]) < 20 + && RINGTOTAL(actor->tracer->player) < 20 && !actor->tracer->player->kartstuff[k_ringlock]) { fixed_t dist; diff --git a/src/p_inter.c b/src/p_inter.c index 8d898f83d..e51fbb39f 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -142,8 +142,8 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon) || player->kartstuff[k_itemheld]) return false; - if (weapon == 3 && player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD) - return false; // No stacking thunder shields! + if (weapon == 3 && K_GetShieldFromItem(player->kartstuff[k_itemtype]) != KSHIELD_NONE) + return false; // No stacking shields! } } @@ -629,7 +629,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; // kill - if (player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0) + if (player->kartstuff[k_invincibilitytimer] > 0 + || player->kartstuff[k_growshrinktimer] > 0 + || player->kartstuff[k_flamedash] > 0) { P_KillMobj(special, toucher, toucher); return; @@ -704,7 +706,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; // Reached the cap, don't waste 'em! - if ((player->kartstuff[k_rings] + player->kartstuff[k_pickuprings]) >= 20) + if (RINGTOTAL(player) >= 20) return; special->momx = special->momy = special->momz = 0; @@ -3297,8 +3299,8 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) if (!player) return; - // Has a shield? Don't lose your rings! - if (player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD) + // Have a shield? You get hit, but don't lose your rings! + if (K_GetShieldFromItem(player->kartstuff[k_itemtype]) != KSHIELD_NONE) return; // 20 is the ring cap in kart diff --git a/src/p_map.c b/src/p_map.c index 3dd026ee4..025d84b02 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1452,6 +1452,10 @@ static boolean PIT_CheckThing(mobj_t *thing) P_DamageMobj(thing, tmthing, tmthing, 1); else if (thing->player->kartstuff[k_invincibilitytimer] && !tmthing->player->kartstuff[k_invincibilitytimer]) P_DamageMobj(tmthing, thing, thing, 1); + else if (tmthing->player->kartstuff[k_flamedash] && !thing->player->kartstuff[k_flamedash]) // SRB2kart - Then flame shield! + P_DamageMobj(thing, tmthing, tmthing, 1); + else if (thing->player->kartstuff[k_flamedash] && !tmthing->player->kartstuff[k_flamedash]) + P_DamageMobj(tmthing, thing, thing, 1); /*if (G_BattleGametype() && (!G_GametypeHasTeams() || tmthing->player->ctfteam != thing->player->ctfteam)) { diff --git a/src/p_mobj.c b/src/p_mobj.c index be4bf0c1a..96c442d64 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6232,7 +6232,9 @@ void P_RunShadows(void) dest = mobj->target; - if (dest->type == MT_THUNDERSHIELD) + if (dest->type == MT_THUNDERSHIELD + || dest->type == MT_BUBBLESHIELD + || dest->type == MT_FLAMESHIELD) dest = dest->target; P_TeleportMove(mobj, dest->x, dest->y, mobj->target->z); @@ -8362,7 +8364,8 @@ void P_MobjThinker(mobj_t *mobj) case MT_THUNDERSHIELD: { fixed_t destx, desty; - if (!mobj->target || !mobj->target->health || (mobj->target->player && mobj->target->player->kartstuff[k_curshield] != 1)) + if (!mobj->target || !mobj->target->health || !mobj->target->player + || mobj->target->player->kartstuff[k_curshield] != KSHIELD_THUNDER) { P_RemoveMobj(mobj); return; @@ -8381,8 +8384,9 @@ void P_MobjThinker(mobj_t *mobj) else viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, camera[0].x, camera[0].y); - if (curstate > S_THUNDERSHIELD15) + if (curstate > S_THUNDERSHIELD15 && curstate <= S_THUNDERSHIELD24) viewingangle += ANGLE_180; + destx = mobj->target->x + P_ReturnThrustX(mobj->target, viewingangle, mobj->scale>>4); desty = mobj->target->y + P_ReturnThrustY(mobj->target, viewingangle, mobj->scale>>4); } @@ -8395,6 +8399,64 @@ void P_MobjThinker(mobj_t *mobj) P_TeleportMove(mobj, destx, desty, mobj->target->z); break; } + case MT_FLAMESHIELD: + { + fixed_t destx, desty; + statenum_t curstate; + + if (!mobj->target || !mobj->target->health || !mobj->target->player + || mobj->target->player->kartstuff[k_curshield] != KSHIELD_FLAME) + { + P_RemoveMobj(mobj); + return; + } + P_SetScale(mobj, (mobj->destscale = (5*mobj->target->destscale)>>2)); + + curstate = ((mobj->tics == 1) ? (mobj->state->nextstate) : ((statenum_t)(mobj->state-states))); + + if (mobj->target->player->kartstuff[k_flamedash]) + { + if (curstate != S_FLAMESHIELDDASH) + P_SetMobjState(mobj, S_FLAMESHIELDDASH); + mobj->flags2 ^= MF2_DONTDRAW; + } + else + { + if (curstate == S_FLAMESHIELDDASH) + P_SetMobjState(mobj, S_FLAMESHIELD1); + mobj->flags2 &= ~MF2_DONTDRAW; + } + + if (!splitscreen /*&& rendermode != render_soft*/) + { + angle_t viewingangle; + + if (players[displayplayers[0]].awayviewtics) + viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, players[displayplayers[0]].awayviewmobj->x, players[displayplayers[0]].awayviewmobj->y); + else if (!camera[0].chase && players[displayplayers[0]].mo) + viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y); + else + viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, camera[0].x, camera[0].y); + + if (curstate >= S_FLAMESHIELD1 && curstate < S_FLAMESHIELDDASH && ((curstate-S_FLAMESHIELD1) & 1)) + viewingangle += ANGLE_180; + + destx = mobj->target->x + P_ReturnThrustX(mobj->target, viewingangle, mobj->scale>>4); + desty = mobj->target->y + P_ReturnThrustY(mobj->target, viewingangle, mobj->scale>>4); + } + else + { + destx = mobj->target->x; + desty = mobj->target->y; + } + + P_TeleportMove(mobj, destx, desty, mobj->target->z); + if (mobj->target->momx || mobj->target->momy) + mobj->angle = R_PointToAngle2(0, 0, mobj->target->momx, mobj->target->momy); + else + mobj->angle = mobj->target->angle; + break; + } case MT_ROCKETSNEAKER: if (!mobj->target || !mobj->target->health) { @@ -10116,7 +10178,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) case MT_JAWZ: case MT_JAWZ_DUD: case MT_JAWZ_SHIELD: case MT_SSMINE: case MT_SSMINE_SHIELD: case MT_BALLHOG: case MT_SINK: - case MT_THUNDERSHIELD: case MT_ROCKETSNEAKER: + case MT_THUNDERSHIELD: case MT_BUBBLESHIELD: case MT_FLAMESHIELD: + case MT_ROCKETSNEAKER: case MT_SPB: P_SpawnShadowMobj(mobj); default: diff --git a/src/p_user.c b/src/p_user.c index bd2e8ee28..7e2b13023 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1083,7 +1083,7 @@ void P_PlayLivesJingle(player_t *player) void P_PlayRinglossSound(mobj_t *source) { - if (source->player && source->player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD) + if (source->player && K_GetShieldFromItem(source->player->kartstuff[k_itemtype]) != KSHIELD_NONE) S_StartSound(source, sfx_s1a3); // Shield hit (no ring loss) else if (source->player && source->player->kartstuff[k_rings] <= 0) S_StartSound(source, sfx_s1a6); // Ring debt (lessened ring loss) From 480d56838f9e853c625597e31918682ed0a7d955 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 20 May 2019 00:50:44 -0400 Subject: [PATCH 003/117] Add cvars to prevent issues --- src/d_netcmd.c | 2 ++ src/d_netcmd.h | 3 ++- src/k_kart.c | 4 ++++ src/m_menu.c | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index c4d99e840..9d7708dd8 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -342,6 +342,8 @@ consvar_t cv_selfpropelledbomb = {"selfpropelledbomb", "On", CV_NETVAR|CV_CHEAT consvar_t cv_grow = {"grow", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_shrink = {"shrink", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_thundershield = {"thundershield", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_bubbleshield = {"bubbleshield", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_flameshield = {"flameshield", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_hyudoro = {"hyudoro", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_pogospring = {"pogospring", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_kitchensink = {"kitchensink", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 73930c172..1d360a254 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -104,7 +104,8 @@ extern consvar_t cv_recycler;*/ extern consvar_t cv_superring, cv_sneaker, cv_rocketsneaker, cv_invincibility, cv_banana; extern consvar_t cv_eggmanmonitor, cv_orbinaut, cv_jawz, cv_mine; extern consvar_t cv_ballhog, cv_selfpropelledbomb, cv_grow, cv_shrink; -extern consvar_t cv_thundershield, cv_hyudoro, cv_pogospring, cv_kitchensink; +extern consvar_t cv_thundershield, cv_bubbleshield, cv_flameshield; +extern consvar_t cv_hyudoro, cv_pogospring, cv_kitchensink; extern consvar_t cv_triplesneaker, cv_triplebanana, cv_decabanana; extern consvar_t cv_tripleorbinaut, cv_quadorbinaut, cv_dualjawz; diff --git a/src/k_kart.c b/src/k_kart.c index da3ad8c7b..c23d45d11 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -556,6 +556,8 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_grow); CV_RegisterVar(&cv_shrink); CV_RegisterVar(&cv_thundershield); + CV_RegisterVar(&cv_bubbleshield); + CV_RegisterVar(&cv_flameshield); CV_RegisterVar(&cv_hyudoro); CV_RegisterVar(&cv_pogospring); CV_RegisterVar(&cv_superring); @@ -808,6 +810,8 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp cv_grow.value, cv_shrink.value, cv_thundershield.value, + cv_bubbleshield.value, + cv_flameshield.value, cv_hyudoro.value, cv_pogospring.value, cv_superring.value, diff --git a/src/m_menu.c b/src/m_menu.c index b367fc9a4..258c149eb 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -10622,6 +10622,8 @@ static consvar_t *kartitemcvs[NUMKARTRESULTS-1] = { &cv_grow, &cv_shrink, &cv_thundershield, + &cv_bubbleshield, + &cv_flameshield, &cv_hyudoro, &cv_pogospring, &cv_superring, From 1e7b79144d3c457d5dc94cb3f1a105225cd0f2a1 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 20 May 2019 14:17:16 -0400 Subject: [PATCH 004/117] Nice things - Fix off-by-one error in shieldout code - Added KartItemCVars array for anything to use - More I_Asserts in item logic --- src/k_kart.c | 71 +++++++++++++++++++++++++++++----------------------- src/k_kart.h | 3 +++ src/m_menu.c | 37 ++++----------------------- 3 files changed, 48 insertions(+), 63 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index c23d45d11..78e3a7057 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -649,10 +649,39 @@ fixed_t K_GetKartGameSpeedScalar(SINT8 value) //{ SRB2kart Roulette Code - Position Based +consvar_t *KartItemCVars[NUMKARTRESULTS-1] = +{ + &cv_sneaker, + &cv_rocketsneaker, + &cv_invincibility, + &cv_banana, + &cv_eggmanmonitor, + &cv_orbinaut, + &cv_jawz, + &cv_mine, + &cv_ballhog, + &cv_selfpropelledbomb, + &cv_grow, + &cv_shrink, + &cv_thundershield, + &cv_bubbleshield, + &cv_flameshield, + &cv_hyudoro, + &cv_pogospring, + &cv_superring, + &cv_kitchensink, + &cv_triplesneaker, + &cv_triplebanana, + &cv_decabanana, + &cv_tripleorbinaut, + &cv_quadorbinaut, + &cv_dualjawz +}; + #define NUMKARTODDS 80 // Less ugly 2D arrays -static INT32 K_KartItemOddsRace[NUMKARTRESULTS][8] = +static INT32 K_KartItemOddsRace[NUMKARTRESULTS-1][8] = { //P-Odds 0 1 2 3 4 5 6 7 /*Sneaker*/ { 0, 0, 3, 5, 6, 0, 0, 0 }, // Sneaker @@ -682,7 +711,7 @@ static INT32 K_KartItemOddsRace[NUMKARTRESULTS][8] = /*Jawz x2*/ { 0, 0, 1, 2, 0, 0, 0, 0 } // Jawz x2 }; -static INT32 K_KartItemOddsBattle[NUMKARTRESULTS][6] = +static INT32 K_KartItemOddsBattle[NUMKARTRESULTS-1][6] = { //P-Odds 0 1 2 3 4 5 /*Sneaker*/ { 3, 2, 2, 2, 0, 2 }, // Sneaker @@ -796,43 +825,23 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp SINT8 first = -1, second = -1; INT32 secondist = 0; INT32 shieldtype = KSHIELD_NONE; - boolean itemenabled[NUMKARTRESULTS-1] = { - cv_sneaker.value, - cv_rocketsneaker.value, - cv_invincibility.value, - cv_banana.value, - cv_eggmanmonitor.value, - cv_orbinaut.value, - cv_jawz.value, - cv_mine.value, - cv_ballhog.value, - cv_selfpropelledbomb.value, - cv_grow.value, - cv_shrink.value, - cv_thundershield.value, - cv_bubbleshield.value, - cv_flameshield.value, - cv_hyudoro.value, - cv_pogospring.value, - cv_superring.value, - cv_kitchensink.value, - cv_triplesneaker.value, - cv_triplebanana.value, - cv_decabanana.value, - cv_tripleorbinaut.value, - cv_quadorbinaut.value, - cv_dualjawz.value - }; I_Assert(item > KITEM_NONE); // too many off by one scenarioes. + I_Assert(KartItemCVars[NUMKARTRESULTS-2] != NULL); // Make sure this exists - if (!itemenabled[item-1] && !modeattacking) + if (!KartItemCVars[item-1]->value && !modeattacking) return 0; if (G_BattleGametype()) + { + I_Assert(pos < 6); // DO NOT allow positions past the bounds of the table newodds = K_KartItemOddsBattle[item-1][pos]; + } else + { + I_Assert(pos < 8); // Ditto newodds = K_KartItemOddsRace[item-1][pos]; + } // Base multiplication to ALL item odds to simulate fractional precision newodds *= 4; @@ -875,7 +884,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp // Don't allow more than one of each shield type at a time shieldtype = K_GetShieldFromItem(item); - if (shieldout[shieldtype-1]) + if (shieldtype != KSHIELD_NONE && shieldout[shieldtype-1]) return 0; // POWERITEMODDS handles all of the "frantic item" related functionality, for all of our powerful items. diff --git a/src/k_kart.h b/src/k_kart.h index ccbb7b55a..b72928165 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -23,6 +23,9 @@ void K_RegisterKartStuff(void); boolean K_IsPlayerLosing(player_t *player); boolean K_IsPlayerWanted(player_t *player); fixed_t K_GetKartGameSpeedScalar(SINT8 value); + +consvar_t *KartItemCVars[NUMKARTRESULTS-1]; + INT32 K_GetShieldFromItem(INT32 item); void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid); void K_KartPainEnergyFling(player_t *player); diff --git a/src/m_menu.c b/src/m_menu.c index 258c149eb..94502d8bf 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -10608,33 +10608,6 @@ static void M_HandleVideoMode(INT32 ch) // =============== // Monitor Toggles // =============== -static consvar_t *kartitemcvs[NUMKARTRESULTS-1] = { - &cv_sneaker, - &cv_rocketsneaker, - &cv_invincibility, - &cv_banana, - &cv_eggmanmonitor, - &cv_orbinaut, - &cv_jawz, - &cv_mine, - &cv_ballhog, - &cv_selfpropelledbomb, - &cv_grow, - &cv_shrink, - &cv_thundershield, - &cv_bubbleshield, - &cv_flameshield, - &cv_hyudoro, - &cv_pogospring, - &cv_superring, - &cv_kitchensink, - &cv_triplesneaker, - &cv_triplebanana, - &cv_decabanana, - &cv_tripleorbinaut, - &cv_quadorbinaut, - &cv_dualjawz -}; static tic_t shitsfree = 0; @@ -10703,7 +10676,7 @@ static void M_DrawMonitorToggles(void) continue; } - cv = kartitemcvs[currentMenu->menuitems[thisitem].alphaKey-1]; + cv = KartItemCVars[currentMenu->menuitems[thisitem].alphaKey-1]; translucent = (cv->value ? 0 : V_TRANSLUCENT); switch (currentMenu->menuitems[thisitem].alphaKey) @@ -10772,7 +10745,7 @@ static void M_DrawMonitorToggles(void) } else { - cv = kartitemcvs[currentMenu->menuitems[itemOn].alphaKey-1]; + cv = KartItemCVars[currentMenu->menuitems[itemOn].alphaKey-1]; translucent = (cv->value ? 0 : V_TRANSLUCENT); switch (currentMenu->menuitems[itemOn].alphaKey) @@ -10888,14 +10861,14 @@ static void M_HandleMonitorToggles(INT32 choice) S_StartSound(NULL, sfx_s1b4); for (i = 0; i < NUMKARTRESULTS-1; i++) { - if (kartitemcvs[i]->value == v) - CV_AddValue(kartitemcvs[i], 1); + if (KartItemCVars[i]->value == v) + CV_AddValue(KartItemCVars[i], 1); } } else { S_StartSound(NULL, sfx_s1ba); - CV_AddValue(kartitemcvs[currentMenu->menuitems[itemOn].alphaKey-1], 1); + CV_AddValue(KartItemCVars[currentMenu->menuitems[itemOn].alphaKey-1], 1); } break; From 52bd194c69cbded96175f2b23e286300180aa4ec Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 20 May 2019 15:39:33 -0400 Subject: [PATCH 005/117] Flame Shield updatin's --- src/k_kart.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 78e3a7057..904b562fa 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2274,7 +2274,7 @@ static void K_GetKartBoostPower(player_t *player) if (player->kartstuff[k_flamedash]) // Flame Shield dash { fixed_t dashval = ((player->kartstuff[k_flamedash]<kartstuff[k_startboost]) // Startup Boost @@ -5544,7 +5544,7 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue) if (player->kartstuff[k_flamedash]) // Reduce turning { - fixed_t dashval = ((player->kartstuff[k_flamedash]<kartstuff[k_flamedash]< FRACUNIT) return 0; // NO MORE TURNING! turnvalue = FixedMul(turnvalue, FRACUNIT-dashval); @@ -6414,6 +6414,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) S_StartSound(player->mo, sfx_s3k3f); player->kartstuff[k_curshield] = KSHIELD_BUBBLE; } + break; case KITEM_FLAMESHIELD: if (player->kartstuff[k_curshield] != KSHIELD_FLAME) { @@ -6433,11 +6434,18 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_flamedash] == 0) K_PlayBoostTaunt(player->mo); player->kartstuff[k_flamedash]++; + if (player->kartstuff[k_flamedash] > 10*TICRATE) + { + K_FlameShieldPop(player->mo); + player->kartstuff[k_flamedash] = 0; + player->kartstuff[k_flameready] = 0; + player->kartstuff[k_itemamount]--; + } } } else { - if (player->kartstuff[k_flamedash] > TICRATE) + if (player->kartstuff[k_flamedash] > (TICRATE*2)) { K_FlameShieldPop(player->mo); player->kartstuff[k_flamedash] = 0; @@ -7861,11 +7869,15 @@ static void K_drawKartItem(void) localbg = kp_itembg[offset+1]; break; case KITEM_BUBBLESHIELD: + localpatch = kp_bubbleshield[offset]; localbg = kp_itembg[offset+1]; break; case KITEM_FLAMESHIELD: - localpatch = kp_flameshield[offset]; + if (stplyr->kartstuff[k_flamedash] > (TICRATE*2) && (leveltime & 1)) + localpatch = kp_nodraw; + else + localpatch = kp_flameshield[offset]; localbg = kp_itembg[offset+1]; break; case KITEM_HYUDORO: From 99ed66ac4659e77ac5abb9e85d9785882dce008d Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 21 May 2019 01:01:29 -0400 Subject: [PATCH 006/117] Bubble Shield, Flame Shield changes --- src/d_player.h | 7 +- src/dehacked.c | 34 ++++++- src/doomstat.h | 1 + src/g_game.c | 1 + src/info.c | 58 +++++++++++- src/info.h | 30 +++++++ src/k_kart.c | 238 ++++++++++++++++++++++++++++++------------------- src/p_inter.c | 60 ++++++++++++- src/p_map.c | 112 +++++++++++++++++++++++ src/p_mobj.c | 159 ++++++++++++++++++++++++++++++++- 10 files changed, 597 insertions(+), 103 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index c51b12769..d4dc44ea4 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -300,21 +300,22 @@ typedef enum k_itemtype, // KITEM_ constant for item number k_itemamount, // Amount of said item k_itemheld, // Are you holding an item? + k_holdready, // Hold button-style item is ready to activate // Some items use timers for their duration or effects - //k_thunderanim, // Duration of Thunder Shield's use animation k_curshield, // 0 = no shield, 1 = thunder shield k_hyudorotimer, // Duration of the Hyudoro offroad effect itself k_stealingtimer, // You are stealing an item, this is your timer k_stolentimer, // You are being stolen from, this is your timer k_superring, // Spawn rings on top of you every tic! k_sneakertimer, // Duration of the Sneaker Boost itself - k_levelbooster, // Duration of a level booster's boost (same as sneaker, but separated for ) + k_levelbooster, // Duration of a level booster's boost (same as sneaker, but separated for boost stacking) k_growshrinktimer, // > 0 = Big, < 0 = small k_squishedtimer, // Squished frame timer k_rocketsneakertimer, // Rocket Sneaker duration timer k_invincibilitytimer, // Invincibility timer - k_flameready, // Flame Shield dash ready to activate + k_bubblecool, // Bubble Shield use cooldown + k_bubbleblowup, // Bubble Shield usage blowup k_flamedash, // Flame Shield dash power k_eggmanheld, // Eggman monitor held, separate from k_itemheld so it doesn't stop you from getting items k_eggmanexplode, // Fake item recieved, explode in a few seconds diff --git a/src/dehacked.c b/src/dehacked.c index d7d428bab..5de479c9e 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6634,6 +6634,35 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_THUNDERSHIELD23", "S_THUNDERSHIELD24", + // Bubble Shield + "S_BUBBLESHIELD1", + "S_BUBBLESHIELD2", + "S_BUBBLESHIELD3", + "S_BUBBLESHIELD4", + "S_BUBBLESHIELD5", + "S_BUBBLESHIELD6", + "S_BUBBLESHIELD7", + "S_BUBBLESHIELD8", + "S_BUBBLESHIELD9", + "S_BUBBLESHIELD10", + "S_BUBBLESHIELD11", + "S_BUBBLESHIELD12", + "S_BUBBLESHIELD13", + "S_BUBBLESHIELD14", + "S_BUBBLESHIELD15", + "S_BUBBLESHIELD16", + "S_BUBBLESHIELD17", + "S_BUBBLESHIELD18", + "S_BUBBLESHIELDBLOWUP", + "S_BUBBLESHIELDTRAP1", + "S_BUBBLESHIELDTRAP2", + "S_BUBBLESHIELDTRAP3", + "S_BUBBLESHIELDTRAP4", + "S_BUBBLESHIELDTRAP5", + "S_BUBBLESHIELDTRAP6", + "S_BUBBLESHIELDTRAP7", + "S_BUBBLESHIELDTRAP8", + // Flame Shield "S_FLAMESHIELD1", "S_FLAMESHIELD2", @@ -7792,6 +7821,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_THUNDERSHIELD", // Shields "MT_BUBBLESHIELD", "MT_FLAMESHIELD", + "MT_BUBBLESHIELDTRAP", "MT_SINK", // Kitchen Sink Stuff "MT_SINK_SHIELD", @@ -8463,6 +8493,7 @@ static const char *const KARTSTUFF_LIST[] = { "ITEMTYPE", "ITEMAMOUNT", "ITEMHELD", + "HOLDREADY", "CURSHIELD", "HYUDOROTIMER", @@ -8475,7 +8506,8 @@ static const char *const KARTSTUFF_LIST[] = { "SQUISHEDTIMER", "ROCKETSNEAKERTIMER", "INVINCIBILITYTIMER", - "FLAMEREADY", + "BUBBLECOOL", + "BUBBLEBLOWUP", "FLAMEDASH", "EGGMANHELD", "EGGMANEXPLODE", diff --git a/src/doomstat.h b/src/doomstat.h index 1f855da27..b12e535ee 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -433,6 +433,7 @@ extern INT32 hyudorotime; extern INT32 stealtime; extern INT32 sneakertime; extern INT32 itemtime; +extern INT32 bubbletime; extern INT32 comebacktime; extern INT32 bumptime; extern INT32 wipeoutslowtime; diff --git a/src/g_game.c b/src/g_game.c index 6f08eb7c6..3a5e3d6e9 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -214,6 +214,7 @@ INT32 hyudorotime = 7*TICRATE; INT32 stealtime = TICRATE/2; INT32 sneakertime = TICRATE + (TICRATE/3); INT32 itemtime = 8*TICRATE; +INT32 bubbletime = TICRATE/2; INT32 comebacktime = 10*TICRATE; INT32 bumptime = 6; INT32 wipeoutslowtime = 20; diff --git a/src/info.c b/src/info.c index c87ac4866..f7d60dff3 100644 --- a/src/info.c +++ b/src/info.c @@ -2850,6 +2850,34 @@ state_t states[NUMSTATES] = {SPR_THNS, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_THUNDERSHIELD24}, // S_THUNDERSHIELD23 {SPR_THNS, FF_FULLBRIGHT|0, 2, {NULL}, 0, 0, S_THUNDERSHIELD1}, // S_THUNDERSHIELD24 + {SPR_BUBS, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_BUBBLESHIELD2}, // S_BUBBLESHIELD1 + {SPR_BUBS, FF_FULLBRIGHT|13, 2, {NULL}, 0, 0, S_BUBBLESHIELD3}, // S_BUBBLESHIELD2 + {SPR_BUBS, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_BUBBLESHIELD4}, // S_BUBBLESHIELD3 + {SPR_BUBS, FF_FULLBRIGHT|13, 2, {NULL}, 0, 0, S_BUBBLESHIELD5}, // S_BUBBLESHIELD4 + {SPR_BUBS, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_BUBBLESHIELD6}, // S_BUBBLESHIELD5 + {SPR_BUBS, FF_FULLBRIGHT|13, 2, {NULL}, 0, 0, S_BUBBLESHIELD7}, // S_BUBBLESHIELD6 + {SPR_BUBS, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_BUBBLESHIELD8}, // S_BUBBLESHIELD7 + {SPR_BUBS, FF_FULLBRIGHT|13, 2, {NULL}, 0, 0, S_BUBBLESHIELD9}, // S_BUBBLESHIELD8 + {SPR_BUBS, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_BUBBLESHIELD10}, // S_BUBBLESHIELD9 + {SPR_BUBS, FF_FULLBRIGHT|13, 2, {NULL}, 0, 0, S_BUBBLESHIELD11}, // S_BUBBLESHIELD10 + {SPR_BUBS, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_BUBBLESHIELD12}, // S_BUBBLESHIELD11 + {SPR_BUBS, FF_FULLBRIGHT|13, 2, {NULL}, 0, 0, S_BUBBLESHIELD13}, // S_BUBBLESHIELD12 + {SPR_BUBS, FF_FULLBRIGHT|6, 2, {NULL}, 0, 0, S_BUBBLESHIELD14}, // S_BUBBLESHIELD13 + {SPR_BUBS, FF_FULLBRIGHT|13, 2, {NULL}, 0, 0, S_BUBBLESHIELD15}, // S_BUBBLESHIELD14 + {SPR_BUBS, FF_FULLBRIGHT|7, 2, {NULL}, 0, 0, S_BUBBLESHIELD16}, // S_BUBBLESHIELD15 + {SPR_BUBS, FF_FULLBRIGHT|13, 2, {NULL}, 0, 0, S_BUBBLESHIELD17}, // S_BUBBLESHIELD16 + {SPR_BUBS, FF_FULLBRIGHT|8, 2, {NULL}, 0, 0, S_BUBBLESHIELD18}, // S_BUBBLESHIELD17 + {SPR_BUBS, FF_FULLBRIGHT|13, 2, {NULL}, 0, 0, S_BUBBLESHIELD1}, // S_BUBBLESHIELD18 + {SPR_BUBS, FF_FULLBRIGHT|13, -1, {NULL}, 0, 0, S_BUBBLESHIELDBLOWUP}, // S_BUBBLESHIELDBLOWUP + {SPR_BUBS, FF_FULLBRIGHT|13, 2, {NULL}, 0, 0, S_BUBBLESHIELDTRAP2}, // S_BUBBLESHIELDTRAP1 + {SPR_BUBS, FF_FULLBRIGHT|14, 2, {NULL}, 0, 0, S_BUBBLESHIELDTRAP3}, // S_BUBBLESHIELDTRAP2 + {SPR_BUBS, FF_FULLBRIGHT|15, 2, {NULL}, 0, 0, S_BUBBLESHIELDTRAP4}, // S_BUBBLESHIELDTRAP3 + {SPR_BUBS, FF_FULLBRIGHT|14, 2, {NULL}, 0, 0, S_BUBBLESHIELDTRAP5}, // S_BUBBLESHIELDTRAP4 + {SPR_BUBS, FF_FULLBRIGHT|13, 2, {NULL}, 0, 0, S_BUBBLESHIELDTRAP6}, // S_BUBBLESHIELDTRAP5 + {SPR_BUBS, FF_FULLBRIGHT|12, 2, {NULL}, 0, 0, S_BUBBLESHIELDTRAP7}, // S_BUBBLESHIELDTRAP6 + {SPR_BUBS, FF_FULLBRIGHT|11, 2, {NULL}, 0, 0, S_BUBBLESHIELDTRAP8}, // S_BUBBLESHIELDTRAP7 + {SPR_BUBS, FF_FULLBRIGHT|12, 2, {NULL}, 0, 0, S_BUBBLESHIELDTRAP1}, // S_BUBBLESHIELDTRAP8 + {SPR_FLMS, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_FLAMESHIELD2}, // S_FLAMESHIELD1 {SPR_FLMS, FF_FULLBRIGHT|9, 2, {NULL}, 0, 0, S_FLAMESHIELD3}, // S_FLAMESHIELD2 {SPR_FLMS, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_FLAMESHIELD4}, // S_FLAMESHIELD3 @@ -15957,7 +15985,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_BUBBLESHIELD -1, // doomednum - S_THUNDERSHIELD1, // spawnstate + S_BUBBLESHIELD1, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -15978,7 +16006,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 16, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + MF_SPECIAL|MF_NOCLIP|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -16009,6 +16037,32 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_BUBBLESHIELDTRAP + -1, // doomednum + S_BUBBLESHIELDTRAP1, // 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 + 20*FRACUNIT, // radius + 56*FRACUNIT, // height + 1, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, { // MT_SINK -1, // doomednum diff --git a/src/info.h b/src/info.h index a302aa679..000d2fb93 100644 --- a/src/info.h +++ b/src/info.h @@ -3518,6 +3518,35 @@ typedef enum state S_THUNDERSHIELD23, S_THUNDERSHIELD24, + // Bubble Shield + S_BUBBLESHIELD1, + S_BUBBLESHIELD2, + S_BUBBLESHIELD3, + S_BUBBLESHIELD4, + S_BUBBLESHIELD5, + S_BUBBLESHIELD6, + S_BUBBLESHIELD7, + S_BUBBLESHIELD8, + S_BUBBLESHIELD9, + S_BUBBLESHIELD10, + S_BUBBLESHIELD11, + S_BUBBLESHIELD12, + S_BUBBLESHIELD13, + S_BUBBLESHIELD14, + S_BUBBLESHIELD15, + S_BUBBLESHIELD16, + S_BUBBLESHIELD17, + S_BUBBLESHIELD18, + S_BUBBLESHIELDBLOWUP, + S_BUBBLESHIELDTRAP1, + S_BUBBLESHIELDTRAP2, + S_BUBBLESHIELDTRAP3, + S_BUBBLESHIELDTRAP4, + S_BUBBLESHIELDTRAP5, + S_BUBBLESHIELDTRAP6, + S_BUBBLESHIELDTRAP7, + S_BUBBLESHIELDTRAP8, + // Flame Shield S_FLAMESHIELD1, S_FLAMESHIELD2, @@ -4708,6 +4737,7 @@ typedef enum mobj_type MT_THUNDERSHIELD, // Shields MT_BUBBLESHIELD, MT_FLAMESHIELD, + MT_BUBBLESHIELDTRAP, MT_SINK, // Kitchen Sink Stuff MT_SINK_SHIELD, diff --git a/src/k_kart.c b/src/k_kart.c index 904b562fa..72158e807 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -697,7 +697,7 @@ static INT32 K_KartItemOddsRace[NUMKARTRESULTS-1][8] = /*Grow*/ { 0, 0, 0, 1, 1, 2, 0, 0 }, // Grow /*Shrink*/ { 0, 0, 0, 0, 0, 0, 2, 0 }, // Shrink /*Thunder Shield*/ { 1, 2, 0, 0, 0, 0, 0, 0 }, // Thunder Shield - /*Bubble Shield*/ { 0, 0, 0, 0, 0, 0, 0, 0 }, // Bubble Shield + /*Bubble Shield*/ { 0, 0, 0, 1, 2, 0, 0, 0 }, // Bubble Shield /*Flame Shield*/ { 0, 0, 0, 0, 0, 0, 1, 2 }, // Flame Shield /*Hyudoro*/ { 0, 0, 0, 1, 2, 1, 0, 0 }, // Hyudoro /*Pogo Spring*/ { 0, 0, 0, 0, 0, 0, 0, 0 }, // Pogo Spring @@ -1304,8 +1304,11 @@ static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) case MT_PLAYER: if (!mobj->player) break; - if (against->player && !against->player->kartstuff[k_spinouttimer] && mobj->player->kartstuff[k_spinouttimer]) - weight = 0; // Do not bump + if (against->player + && ((!against->player->kartstuff[k_spinouttimer] && mobj->player->kartstuff[k_spinouttimer]) + || (against->player->kartstuff[k_itemtype] == KITEM_BUBBLESHIELD && mobj->player->kartstuff[k_itemtype] != KITEM_BUBBLESHIELD) + || (against->type == MT_BUBBLESHIELD))) + weight = 0; // This player does not cause any bump action else { weight = (mobj->player->kartweight) * mobj->scale; @@ -3856,7 +3859,6 @@ static void K_DoThunderShield(player_t *player) angle_t an; S_StartSound(player->mo, sfx_zio3); - //player->kartstuff[k_thunderanim] = 35; P_NukeEnemies(player->mo, player->mo, RING_DIST/4); // spawn vertical bolt @@ -4221,14 +4223,20 @@ void K_DropHnextList(player_t *player) K_DoThunderShield(player); player->kartstuff[k_itemtype] = KITEM_NONE; player->kartstuff[k_itemamount] = 0; - player->kartstuff[k_curshield] = 0; + player->kartstuff[k_curshield] = KSHIELD_NONE; + } + else if (player->kartstuff[k_itemtype] == KITEM_BUBBLESHIELD) + { + player->kartstuff[k_itemtype] = KITEM_NONE; + player->kartstuff[k_itemamount] = 0; + player->kartstuff[k_curshield] = KSHIELD_NONE; } else if (player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) { - //K_PopFlameShield(player); + K_FlameShieldPop(player->mo); player->kartstuff[k_itemtype] = KITEM_NONE; player->kartstuff[k_itemamount] = 0; - player->kartstuff[k_curshield] = 0; + player->kartstuff[k_curshield] = KSHIELD_NONE; } nextwork = work->hnext; @@ -5043,6 +5051,68 @@ void K_KartPlayerHUDUpdate(player_t *player) #undef RINGANIM_DELAYMAX +// SRB2Kart: blockmap iterate for attraction shield users +static mobj_t *attractmo; +static fixed_t attractdist; +static inline boolean PIT_AttractingRings(mobj_t *thing) +{ + if (!attractmo || P_MobjWasRemoved(attractmo)) + return false; + + if (!attractmo->player) + return false; // not a player + + if (thing->health <= 0 || !thing) + return true; // dead + + if (thing->type != MT_RING && thing->type != MT_FLINGRING) + return true; // not a ring + + if (thing->extravalue1) + return true; // in special ring animation + + if (thing->cusval) + return true; // already attracted + + // see if it went over / under + if (attractmo->z - (attractdist>>2) > thing->z + thing->height) + return true; // overhead + if (attractmo->z + attractmo->height + (attractdist>>2) < thing->z) + return true; // underneath + + if (P_AproxDistance(attractmo->x - thing->x, attractmo->y - thing->y) < attractdist) + return true; // Too far away + + // set target + P_SetTarget(&thing->tracer, attractmo); + // flag to show it's been attracted once before + thing->cusval = 1; + return true; // find other rings +} + +/** Looks for rings near a player in the blockmap. + * + * \param pmo Player object looking for rings to attract + * \sa A_AttractChase + */ +static void K_LookForRings(mobj_t *pmo) +{ + INT32 bx, by, xl, xh, yl, yh; + attractdist = FixedMul(RING_DIST, pmo->scale)>>2; + + // Use blockmap to check for nearby rings + yh = (unsigned)(pmo->y + attractdist - bmaporgy)>>MAPBLOCKSHIFT; + yl = (unsigned)(pmo->y - attractdist - bmaporgy)>>MAPBLOCKSHIFT; + xh = (unsigned)(pmo->x + attractdist - bmaporgx)>>MAPBLOCKSHIFT; + xl = (unsigned)(pmo->x - attractdist - bmaporgx)>>MAPBLOCKSHIFT; + + attractmo = pmo; + + for (by = yl; by <= yh; by++) + for (bx = xl; bx <= xh; bx++) + P_BlockThingsIterator(bx, by, PIT_AttractingRings); +} + /** \brief Decreases various kart timers and powers per frame. Called in P_PlayerThink in p_user.c \param player player object passed from P_PlayerThink @@ -5192,6 +5262,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->mo->colorized = false; } + if (player->kartstuff[k_itemtype] == KITEM_NONE) + player->kartstuff[k_holdready] = 0; + // DKR style camera for boosting if (player->karthud[khud_boostcam] != 0 || player->karthud[khud_destboostcam] != 0) { @@ -5382,6 +5455,31 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) } } + if (player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD) + { + if (RINGTOTAL(player) < 20 && !player->kartstuff[k_ringlock]) + K_LookForRings(player->mo); + } + + if (player->kartstuff[k_itemtype] == KITEM_BUBBLESHIELD) + { + if (player->kartstuff[k_bubblecool]) + player->kartstuff[k_bubblecool]--; + } + else + { + player->kartstuff[k_bubbleblowup] = 0; + player->kartstuff[k_bubblecool] = 0; + } + + if (player->kartstuff[k_itemtype] != KITEM_FLAMESHIELD + || player->exiting || player->kartstuff[k_spinouttimer] || player->kartstuff[k_squishedtimer]) + { + if (player->kartstuff[k_flamedash]) + K_FlameShieldPop(player->mo); + player->kartstuff[k_flamedash] = 0; + } + // ??? /* if (player->kartstuff[k_jmp] > 1 && onground) @@ -5890,8 +5988,7 @@ void K_StripItems(player_t *player) player->kartstuff[k_stealingtimer] = 0; player->kartstuff[k_stolentimer] = 0; - player->kartstuff[k_curshield] = 0; - //player->kartstuff[k_thunderanim] = 0; + player->kartstuff[k_curshield] = KSHIELD_NONE; player->kartstuff[k_bananadrag] = 0; player->kartstuff[k_sadtimer] = 0; @@ -5914,68 +6011,6 @@ void K_StripOther(player_t *player) } } -// SRB2Kart: blockmap iterate for attraction shield users -static mobj_t *attractmo; -static fixed_t attractdist; -static inline boolean PIT_AttractingRings(mobj_t *thing) -{ - if (!attractmo || P_MobjWasRemoved(attractmo)) - return false; - - if (!attractmo->player) - return false; // not a player - - if (thing->health <= 0 || !thing) - return true; // dead - - if (thing->type != MT_RING && thing->type != MT_FLINGRING) - return true; // not a ring - - if (thing->extravalue1) - return true; // in special ring animation - - if (thing->cusval) - return true; // already attracted - - // see if it went over / under - if (attractmo->z - (attractdist>>2) > thing->z + thing->height) - return true; // overhead - if (attractmo->z + attractmo->height + (attractdist>>2) < thing->z) - return true; // underneath - - if (P_AproxDistance(attractmo->x - thing->x, attractmo->y - thing->y) < attractdist) - return true; // Too far away - - // set target - P_SetTarget(&thing->tracer, attractmo); - // flag to show it's been attracted once before - thing->cusval = 1; - return true; // find other rings -} - -/** Looks for rings near a player in the blockmap. - * - * \param pmo Player object looking for rings to attract - * \sa A_AttractChase - */ -static void K_LookForRings(mobj_t *pmo) -{ - INT32 bx, by, xl, xh, yl, yh; - attractdist = FixedMul(RING_DIST, pmo->scale)>>2; - - // Use blockmap to check for nearby rings - yh = (unsigned)(pmo->y + attractdist - bmaporgy)>>MAPBLOCKSHIFT; - yl = (unsigned)(pmo->y - attractdist - bmaporgy)>>MAPBLOCKSHIFT; - xh = (unsigned)(pmo->x + attractdist - bmaporgx)>>MAPBLOCKSHIFT; - xl = (unsigned)(pmo->x - attractdist - bmaporgx)>>MAPBLOCKSHIFT; - - attractmo = pmo; - - for (by = yl; by <= yh; by++) - for (bx = xl; bx <= xh; bx++) - P_BlockThingsIterator(bx, by, PIT_AttractingRings); -} - // // K_MoveKartPlayer // @@ -6408,12 +6443,44 @@ void K_MoveKartPlayer(player_t *player, boolean onground) case KITEM_BUBBLESHIELD: if (player->kartstuff[k_curshield] != KSHIELD_BUBBLE) { - //mobj_t *shield = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BUBBLESHIELD); - //P_SetScale(shield, (shield->destscale = (5*shield->destscale)>>2)); - //P_SetTarget(&shield->target, player->mo); + mobj_t *shield = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BUBBLESHIELD); + P_SetScale(shield, (shield->destscale = (5*shield->destscale)>>2)); + P_SetTarget(&shield->target, player->mo); S_StartSound(player->mo, sfx_s3k3f); player->kartstuff[k_curshield] = KSHIELD_BUBBLE; } + + if (!HOLDING_ITEM && NO_HYUDORO) + { + if (cmd->buttons & BT_ATTACK) + { + if (player->kartstuff[k_holdready]) + { + if (player->kartstuff[k_bubbleblowup] == 0) + K_PlayAttackTaunt(player->mo); + player->kartstuff[k_bubbleblowup]++; + player->kartstuff[k_bubblecool] = TICRATE+bubbletime; + if (player->kartstuff[k_bubbleblowup] > bubbletime) + { + mobj_t *trap = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BUBBLESHIELDTRAP); + P_SetScale(trap, (5*trap->destscale)>>1); + trap->destscale = (5*trap->destscale)>>2; + P_SetTarget(&trap->target, player->mo); + trap->threshold = 10; + S_StartSound(player->mo, sfx_s3k44); + + player->kartstuff[k_bubbleblowup] = 0; + player->kartstuff[k_itemamount]--; + } + } + } + else + { + if (player->kartstuff[k_bubbleblowup]) + player->kartstuff[k_bubbleblowup]--; + player->kartstuff[k_holdready] = (player->kartstuff[k_bubblecool] ? 0 : 1); + } + } break; case KITEM_FLAMESHIELD: if (player->kartstuff[k_curshield] != KSHIELD_FLAME) @@ -6429,7 +6496,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { if (cmd->buttons & BT_ATTACK) { - if (player->kartstuff[k_flameready]) + if (player->kartstuff[k_holdready]) { if (player->kartstuff[k_flamedash] == 0) K_PlayBoostTaunt(player->mo); @@ -6438,7 +6505,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { K_FlameShieldPop(player->mo); player->kartstuff[k_flamedash] = 0; - player->kartstuff[k_flameready] = 0; + player->kartstuff[k_holdready] = 0; player->kartstuff[k_itemamount]--; } } @@ -6449,13 +6516,13 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { K_FlameShieldPop(player->mo); player->kartstuff[k_flamedash] = 0; - player->kartstuff[k_flameready] = 0; + player->kartstuff[k_holdready] = 0; player->kartstuff[k_itemamount]--; } else { player->kartstuff[k_flamedash] = 0; - player->kartstuff[k_flameready] = 1; + player->kartstuff[k_holdready] = 1; } } } @@ -6535,21 +6602,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (spbplace == -1 || player->kartstuff[k_position] != spbplace) player->kartstuff[k_ringlock] = 0; // reset ring lock - if (player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD) - { - if (RINGTOTAL(player) < 20 && !player->kartstuff[k_ringlock]) - K_LookForRings(player->mo); - } - - if (player->kartstuff[k_itemtype] != KITEM_FLAMESHIELD - || player->exiting || player->kartstuff[k_spinouttimer] || player->kartstuff[k_squishedtimer]) - { - if (player->kartstuff[k_flamedash]) - K_FlameShieldPop(player->mo); - player->kartstuff[k_flamedash] = 0; - player->kartstuff[k_flameready] = 0; - } - if (K_GetShieldFromItem(player->kartstuff[k_itemtype]) == KSHIELD_NONE) player->kartstuff[k_curshield] = KSHIELD_NONE; // RESET shield type diff --git a/src/p_inter.c b/src/p_inter.c index 406644a1b..760026944 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -595,11 +595,12 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { mobj_t *spbexplode; - if (player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0) + if (player->kartstuff[k_bubbleblowup] > 0) { - //player->powers[pw_flashing] = 0; K_DropHnextList(player); - K_StripItems(player); + special->extravalue1 = 2; // WAIT... + special->extravalue2 = 52; // Slightly over the respawn timer length + return; } S_StopSound(special); // Don't continue playing the gurgle or the siren @@ -675,6 +676,59 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_BALLOON: // SRB2kart P_SetObjectMomZ(toucher, 20<target == toucher) + return; + + if (special->health <= 0 || toucher->health <= 0) + return; + + if (player->spectator) + return; + + if (special->target->player && special->target->player->kartstuff[k_bubbleblowup] + && !player->kartstuff[k_spinouttimer]) + { + K_SpinPlayer(player, special->target, 0, special, false); + if (player->kartstuff[k_spinouttimer]) // Successfully spun out + K_KartBouncing(toucher, special, false, true); + } + return; + case MT_BUBBLESHIELDTRAP: + if ((special->target == toucher || special->target == toucher->target) && (special->threshold > 0)) + return; + + if (special->tracer && !P_MobjWasRemoved(special->tracer)) + return; + + if (special->health <= 0 || toucher->health <= 0) + return; + + if (!player->mo || player->spectator) + return; + + // kill + /*if (player->kartstuff[k_invincibilitytimer] > 0 + || player->kartstuff[k_growshrinktimer] > 0 + || player->kartstuff[k_flamedash] > 0) + { + P_KillMobj(special, toucher, toucher); + return; + }*/ + + // no interaction + if (player->powers[pw_flashing] > 0 || player->kartstuff[k_hyudorotimer] > 0 + || player->kartstuff[k_squishedtimer] > 0 || player->kartstuff[k_spinouttimer] > 0) + return; + + // attach to player! + P_SetTarget(&special->tracer, toucher); + toucher->flags |= MF_NOGRAVITY; + toucher->momx = (4*toucher->momx)/5; // Huge initial speed cut + toucher->momy = (4*toucher->momy)/5; + toucher->momz = (8*toucher->scale) * P_MobjFlip(toucher); + //S_StartSound(special, sfx_s1a2); + return; // ***************************************** // // Rings, coins, spheres, weapon panels, etc // diff --git a/src/p_map.c b/src/p_map.c index 025d84b02..4f0edfae0 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -750,6 +750,29 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player && thing->player->kartstuff[k_hyudorotimer]) return true; // no interaction + if ((thing->type == MT_BUBBLESHIELD && thing->target->player && thing->target->player->kartstuff[k_bubbleblowup]) + || (thing->player && thing->player->kartstuff[k_bubbleblowup])) + { + if (!tmthing->threshold) + { + if (!tmthing->momx && !tmthing->momy) + { + tmthing->momz = (32*tmthing->scale) * P_MobjFlip(tmthing); + } + else + { + tmthing->momx = -tmthing->momx; + tmthing->momy = -tmthing->momy; + tmthing->momz = -tmthing->momz; + } + if (tmthing->type == MT_JAWZ) + P_SetTarget(&tmthing->tracer, tmthing->target); // Back to the source! + tmthing->threshold = 10; + S_StartSound(tmthing, sfx_s3k44); + } + return true; + } + if (thing->type == MT_PLAYER) { // Player Damage @@ -851,6 +874,27 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player && thing->player->powers[pw_flashing]) return true; + if ((thing->type == MT_BUBBLESHIELD && thing->target->player && thing->target->player->kartstuff[k_bubbleblowup]) + || (thing->player && thing->player->kartstuff[k_bubbleblowup])) + { + if (!tmthing->threshold) + { + if (!tmthing->momx && !tmthing->momy) + { + tmthing->momz = (32*tmthing->scale) * P_MobjFlip(tmthing); + } + else + { + tmthing->momx = -tmthing->momx; + tmthing->momy = -tmthing->momy; + tmthing->momz = -tmthing->momz; + } + tmthing->threshold = 10; + S_StartSound(tmthing, sfx_s3k44); + } + return true; + } + if (thing->type == MT_PLAYER) { S_StartSound(NULL, sfx_bsnipe); //let all players hear it. @@ -913,6 +957,27 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player && thing->player->powers[pw_flashing]) return true; + if ((thing->type == MT_BUBBLESHIELD && thing->target->player && thing->target->player->kartstuff[k_bubbleblowup]) + || (thing->player && thing->player->kartstuff[k_bubbleblowup])) + { + if (!tmthing->threshold) + { + if (!tmthing->momx && !tmthing->momy) + { + tmthing->momz = (32*tmthing->scale) * P_MobjFlip(tmthing); + } + else + { + tmthing->momx = -tmthing->momx; + tmthing->momy = -tmthing->momy; + tmthing->momz = -tmthing->momz; + } + tmthing->threshold = 10; + S_StartSound(tmthing, sfx_s3k44); + } + return true; + } + if (thing->type == MT_PLAYER) { // Banana snipe! @@ -985,6 +1050,28 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player && thing->player->powers[pw_flashing]) return true; + // Bubble Shield reflect + if ((thing->type == MT_BUBBLESHIELD && thing->target->player && thing->target->player->kartstuff[k_bubbleblowup]) + || (thing->player && thing->player->kartstuff[k_bubbleblowup])) + { + if (!tmthing->threshold) + { + if (!tmthing->momx && !tmthing->momy) + { + tmthing->momz = (32*tmthing->scale) * P_MobjFlip(tmthing); + } + else + { + tmthing->momx = -tmthing->momx; + tmthing->momy = -tmthing->momy; + tmthing->momz = -tmthing->momz; + } + tmthing->threshold = 10; + S_StartSound(tmthing, sfx_s3k44); + } + return true; + } + if (thing->type == MT_PLAYER) { // Bomb punting @@ -1036,6 +1123,31 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->player && tmthing->player->kartstuff[k_hyudorotimer]) // I thought about doing this for just the objects below but figured it should apply to everything. return true; // no interaction + // Bubble Shield reflect + if (((tmthing->type == MT_BUBBLESHIELD && tmthing->target->player && tmthing->target->player->kartstuff[k_bubbleblowup]) + || (tmthing->player && tmthing->player->kartstuff[k_bubbleblowup])) + && (thing->type != MT_MINEEXPLOSION)) + { + if (!thing->threshold) + { + if (!thing->momx && !thing->momy) + { + thing->momz = (32*thing->scale) * P_MobjFlip(thing); + } + else + { + thing->momx = -thing->momx; + thing->momy = -thing->momy; + thing->momz = -thing->momz; + } + if (thing->type == MT_JAWZ) + P_SetTarget(&thing->tracer, thing->target); // Back to the source! + thing->threshold = 10; + S_StartSound(thing, sfx_s3k44); + } + return true; + } + if (thing->type == MT_ORBINAUT_SHIELD || thing->type == MT_JAWZ_SHIELD || thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD) { diff --git a/src/p_mobj.c b/src/p_mobj.c index 7892f3414..775af90e1 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8399,6 +8399,100 @@ void P_MobjThinker(mobj_t *mobj) P_TeleportMove(mobj, destx, desty, mobj->target->z); break; } + case MT_BUBBLESHIELD: + { + fixed_t destx, desty; + fixed_t scale; + statenum_t curstate; + + if (!mobj->target || !mobj->target->health || !mobj->target->player + || mobj->target->player->kartstuff[k_curshield] != KSHIELD_BUBBLE) + { + P_RemoveMobj(mobj); + return; + } + + scale = (5*mobj->target->destscale)>>2; + curstate = ((mobj->tics == 1) ? (mobj->state->nextstate) : ((statenum_t)(mobj->state-states))); + + if (mobj->target->player->kartstuff[k_bubbleblowup]) + { + INT32 blow = mobj->target->player->kartstuff[k_bubbleblowup]; + + if (curstate != S_BUBBLESHIELDBLOWUP) + P_SetMobjState(mobj, S_BUBBLESHIELDBLOWUP); + + mobj->flags2 &= ~MF2_SHADOW; + scale += (blow * (scale<<1)) / bubbletime; + + mobj->frame = (states[S_BUBBLESHIELDBLOWUP].frame + mobj->extravalue1); + + if (mobj->extravalue1 < 4 && mobj->extravalue2 < blow && !mobj->cvmem && (leveltime & 1)) // Growing + { + mobj->extravalue1++; + if (mobj->extravalue1 >= 4) + mobj->cvmem = 1; // shrink back down + } + else if ((mobj->extravalue1 > -4 && mobj->extravalue2 > blow) + || (mobj->cvmem && mobj->extravalue1 > 0)) // Shrinking + mobj->extravalue1--; + } + else + { + mobj->cvmem = 0; + + if (curstate == S_BUBBLESHIELDBLOWUP) + { + if (mobj->extravalue1 != 0) + { + mobj->frame = (states[S_BUBBLESHIELDBLOWUP].frame + mobj->extravalue1); + + if (mobj->extravalue1 < 0 && (leveltime & 1)) + mobj->extravalue1++; + else if (mobj->extravalue1 > 0) + mobj->extravalue1--; + } + else + { + P_SetMobjState(mobj, S_BUBBLESHIELD1); + mobj->extravalue1 = 0; + } + } + else + { + if (mobj->target->player->kartstuff[k_bubblecool] && ((curstate-S_BUBBLESHIELD1) & 1)) + mobj->flags2 |= MF2_SHADOW; + else + mobj->flags2 &= ~MF2_SHADOW; + } + } + + mobj->extravalue2 = mobj->target->player->kartstuff[k_bubbleblowup]; + P_SetScale(mobj, (mobj->destscale = scale)); + + if (!splitscreen /*&& rendermode != render_soft*/) + { + angle_t viewingangle; + + if (players[displayplayers[0]].awayviewtics) + viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, players[displayplayers[0]].awayviewmobj->x, players[displayplayers[0]].awayviewmobj->y); + else if (!camera[0].chase && players[displayplayers[0]].mo) + viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y); + else + viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, camera[0].x, camera[0].y); + + destx = mobj->target->x + P_ReturnThrustX(mobj->target, viewingangle, mobj->scale>>4); + desty = mobj->target->y + P_ReturnThrustY(mobj->target, viewingangle, mobj->scale>>4); + } + else + { + destx = mobj->target->x; + desty = mobj->target->y; + } + + P_TeleportMove(mobj, destx, desty, mobj->target->z); + break; + } case MT_FLAMESHIELD: { fixed_t destx, desty; @@ -9122,6 +9216,69 @@ void P_MobjThinker(mobj_t *mobj) } } break; + case MT_BUBBLESHIELDTRAP: + if (mobj->tracer && !P_MobjWasRemoved(mobj->tracer) && mobj->tracer->player) + { + player_t *player = mobj->tracer->player; + + mobj->extravalue1 = 1; + + P_TeleportMove(mobj, + mobj->tracer->x + P_ReturnThrustX(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->y + P_ReturnThrustY(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->z + (P_RandomRange(-abs(mobj->cvmem), abs(mobj->cvmem))<cvmem /= 2; + mobj->momz = 0; + mobj->destscale = (5*mobj->tracer->scale)>>2; + + mobj->tracer->momx = (31*mobj->tracer->momx)/32; + mobj->tracer->momy = (31*mobj->tracer->momy)/32; + mobj->tracer->momz = (8*mobj->tracer->scale) * P_MobjFlip(mobj->tracer); + + if (mobj->movecount > 8*TICRATE) + { + S_StartSound(mobj->tracer, sfx_s3k77); + mobj->tracer->flags &= ~MF_NOGRAVITY; + P_KillMobj(mobj, mobj->tracer, mobj->tracer); + break; + } + + if (abs(player->cmd.driftturn) > 100) + { + INT32 lastsign = 0; + if (mobj->lastlook > 0) + lastsign = 1; + else if (mobj->lastlook < 0) + lastsign = -1; + + if ((player->cmd.driftturn > 0 && lastsign < 0) + || (player->cmd.driftturn < 0 && lastsign > 0)) + { + mobj->movecount += (TICRATE/2); + mobj->cvmem = 8*lastsign; + S_StartSound(mobj, sfx_s3k7a); + } + + mobj->lastlook = player->cmd.driftturn; + } + + mobj->movecount++; + } + else if (mobj->extravalue1) // lost your player somehow, DIE + { + mobj->tracer->flags &= ~MF_NOGRAVITY; + P_KillMobj(mobj, NULL, NULL); + break; + } + else + { + mobj->momz = 0; + mobj->destscale = (5*mapobjectscale)>>2; + if (mobj->threshold > 0) + mobj->threshold--; + } + break; case MT_KARMAFIREWORK: if (mobj->momz == 0) { @@ -10179,7 +10336,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) case MT_SSMINE: case MT_SSMINE_SHIELD: case MT_BALLHOG: case MT_SINK: case MT_THUNDERSHIELD: case MT_BUBBLESHIELD: case MT_FLAMESHIELD: - case MT_ROCKETSNEAKER: + case MT_ROCKETSNEAKER: case MT_BUBBLESHIELDTRAP: case MT_SPB: P_SpawnShadowMobj(mobj); default: From 1fc9009bd353056d2917ff3ce435ce2db7216106 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 21 May 2019 01:10:54 -0400 Subject: [PATCH 007/117] Put these special cases behind RaceGametype --- src/k_kart.c | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 72158e807..85c3e4cab 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1222,16 +1222,35 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) return; } - // SPECIAL CASE No. 4: - // Being in ring debt occasionally forces Super Ring on you if you mashed - if (mashed && player->kartstuff[k_rings] < 0 && cv_superring.value) + if (G_RaceGametype()) { - INT32 debtamount = min(20, abs(player->kartstuff[k_rings])); - if (P_RandomChance((debtamount*FRACUNIT)/20)) + // SPECIAL CASE No. 4: + // Being in ring debt occasionally forces Super Ring on you if you mashed + if (mashed && player->kartstuff[k_rings] < 0 && cv_superring.value) { - K_KartGetItemResult(player, KITEM_SUPERRING); + INT32 debtamount = min(20, abs(player->kartstuff[k_rings])); + if (P_RandomChance((debtamount*FRACUNIT)/20)) + { + K_KartGetItemResult(player, KITEM_SUPERRING); + player->karthud[khud_itemblink] = TICRATE; + player->karthud[khud_itemblinkmode] = 1; + player->kartstuff[k_itemroulette] = 0; + player->kartstuff[k_roulettetype] = 0; + if (P_IsDisplayPlayer(player)) + S_StartSound(NULL, (mashed ? sfx_itrolm : sfx_itrolf)); + return; + } + } + + // SPECIAL CASE No. 5: + // Force SPB onto 2nd if they get too far behind + if (player->kartstuff[k_position] == 2 && pdis > (DISTVAR*6) + && spbplace == -1 && !indirectitemcooldown && !dontforcespb + && cv_selfpropelledbomb.value) + { + K_KartGetItemResult(player, KITEM_SPB); player->karthud[khud_itemblink] = TICRATE; - player->karthud[khud_itemblinkmode] = 1; + player->karthud[khud_itemblinkmode] = (mashed ? 1 : 0); player->kartstuff[k_itemroulette] = 0; player->kartstuff[k_roulettetype] = 0; if (P_IsDisplayPlayer(player)) @@ -1240,22 +1259,6 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) } } - // SPECIAL CASE No. 5: - // Force SPB onto 2nd if they get too far behind - if (player->kartstuff[k_position] == 2 && pdis > (DISTVAR*6) - && spbplace == -1 && !indirectitemcooldown && !dontforcespb - && cv_selfpropelledbomb.value) - { - K_KartGetItemResult(player, KITEM_SPB); - player->karthud[khud_itemblink] = TICRATE; - player->karthud[khud_itemblinkmode] = (mashed ? 1 : 0); - player->kartstuff[k_itemroulette] = 0; - player->kartstuff[k_roulettetype] = 0; - if (P_IsDisplayPlayer(player)) - S_StartSound(NULL, (mashed ? sfx_itrolm : sfx_itrolf)); - return; - } - // NOW that we're done with all of those specialized cases, we can move onto the REAL item roulette tables. // Initializes existing spawnchance values for (i = 0; i < NUMKARTRESULTS; i++) From 8abfee5dd04dc5518059158f243850763c8bd1fd Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 21 May 2019 01:18:08 -0400 Subject: [PATCH 008/117] Increase SPB force distance --- 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 85c3e4cab..4f96710d9 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1244,7 +1244,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) // SPECIAL CASE No. 5: // Force SPB onto 2nd if they get too far behind - if (player->kartstuff[k_position] == 2 && pdis > (DISTVAR*6) + if (player->kartstuff[k_position] == 2 && pdis > (DISTVAR*9) && spbplace == -1 && !indirectitemcooldown && !dontforcespb && cv_selfpropelledbomb.value) { From f26deae97c522f3f7a630317392407b8ce498498 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 21 May 2019 01:20:08 -0400 Subject: [PATCH 009/117] Update item table to make Shields more common --- src/k_kart.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 4f96710d9..c1c59986a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -684,21 +684,21 @@ consvar_t *KartItemCVars[NUMKARTRESULTS-1] = static INT32 K_KartItemOddsRace[NUMKARTRESULTS-1][8] = { //P-Odds 0 1 2 3 4 5 6 7 - /*Sneaker*/ { 0, 0, 3, 5, 6, 0, 0, 0 }, // Sneaker + /*Sneaker*/ { 0, 0, 2, 4, 6, 0, 0, 0 }, // Sneaker /*Rocket Sneaker*/ { 0, 0, 0, 0, 0, 2, 4, 6 }, // Rocket Sneaker - /*Invincibility*/ { 0, 0, 0, 0, 1, 4, 8,12 }, // Invincibility + /*Invincibility*/ { 0, 0, 0, 0, 1, 4, 8, 9 }, // Invincibility /*Banana*/ { 7, 4, 2, 1, 0, 0, 0, 0 }, // Banana /*Eggman Monitor*/ { 3, 2, 1, 0, 0, 0, 0, 0 }, // Eggman Monitor - /*Orbinaut*/ { 7, 5, 4, 2, 0, 0, 0, 0 }, // Orbinaut + /*Orbinaut*/ { 7, 5, 3, 2, 0, 0, 0, 0 }, // Orbinaut /*Jawz*/ { 0, 3, 2, 1, 1, 0, 0, 0 }, // Jawz /*Mine*/ { 0, 2, 2, 1, 0, 0, 0, 0 }, // Mine /*Ballhog*/ { 0, 0, 2, 1, 0, 0, 0, 0 }, // Ballhog /*Self-Propelled Bomb*/ { 0, 1, 2, 3, 4, 2, 2, 0 }, // Self-Propelled Bomb - /*Grow*/ { 0, 0, 0, 1, 1, 2, 0, 0 }, // Grow + /*Grow*/ { 0, 0, 0, 1, 1, 3, 0, 0 }, // Grow /*Shrink*/ { 0, 0, 0, 0, 0, 0, 2, 0 }, // Shrink /*Thunder Shield*/ { 1, 2, 0, 0, 0, 0, 0, 0 }, // Thunder Shield - /*Bubble Shield*/ { 0, 0, 0, 1, 2, 0, 0, 0 }, // Bubble Shield - /*Flame Shield*/ { 0, 0, 0, 0, 0, 0, 1, 2 }, // Flame Shield + /*Bubble Shield*/ { 0, 0, 2, 2, 2, 0, 0, 0 }, // Bubble Shield + /*Flame Shield*/ { 0, 0, 0, 0, 0, 0, 1, 5 }, // Flame Shield /*Hyudoro*/ { 0, 0, 0, 1, 2, 1, 0, 0 }, // Hyudoro /*Pogo Spring*/ { 0, 0, 0, 0, 0, 0, 0, 0 }, // Pogo Spring /*Super Ring*/ { 2, 1, 1, 0, 0, 0, 0, 0 }, // Super Ring From 02bd05ff2bb547f8a8dffc0a2b9a454481479f50 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 21 May 2019 15:46:42 -0400 Subject: [PATCH 010/117] Bubble Shield waves --- src/dehacked.c | 6 ++++++ src/info.c | 38 +++++++++++++++++++++---------------- src/info.h | 7 +++++++ src/k_kart.c | 2 +- src/p_inter.c | 7 +------ src/p_mobj.c | 51 +++++++++++++++++++++++++++++++++++++++++++++----- 6 files changed, 83 insertions(+), 28 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 5de479c9e..2ed7a45c7 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6662,6 +6662,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_BUBBLESHIELDTRAP6", "S_BUBBLESHIELDTRAP7", "S_BUBBLESHIELDTRAP8", + "S_BUBBLESHIELDWAVE1", + "S_BUBBLESHIELDWAVE2", + "S_BUBBLESHIELDWAVE3", + "S_BUBBLESHIELDWAVE4", + "S_BUBBLESHIELDWAVE5", + "S_BUBBLESHIELDWAVE6", // Flame Shield "S_FLAMESHIELD1", diff --git a/src/info.c b/src/info.c index f7d60dff3..deae2828a 100644 --- a/src/info.c +++ b/src/info.c @@ -57,19 +57,19 @@ char sprnames[NUMSPRITES + 1][5] = //SRB2kart Sprites "SPRG","BSPR","RNDM","RPOP","SGNS","FAST","DSHR","BOST","BOSM","KFRE", "KINV","KINF","WIPD","DRIF","BDRF","DUST","RSHE","FITM","BANA","ORBN", - "JAWZ","SSMN","KRBM","BHOG","BHBM","SPBM","THNS","BUBS","FLMS","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","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","FWRK","MXCL","RGSP","DRAF","XMS4","XMS5","VIEW" + "JAWZ","SSMN","KRBM","BHOG","BHBM","SPBM","THNS","BUBS","BWVE","FLMS", + "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","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","FWRK","MXCL","RGSP","DRAF","XMS4","XMS5","VIEW" }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) @@ -2877,6 +2877,12 @@ state_t states[NUMSTATES] = {SPR_BUBS, FF_FULLBRIGHT|12, 2, {NULL}, 0, 0, S_BUBBLESHIELDTRAP7}, // S_BUBBLESHIELDTRAP6 {SPR_BUBS, FF_FULLBRIGHT|11, 2, {NULL}, 0, 0, S_BUBBLESHIELDTRAP8}, // S_BUBBLESHIELDTRAP7 {SPR_BUBS, FF_FULLBRIGHT|12, 2, {NULL}, 0, 0, S_BUBBLESHIELDTRAP1}, // S_BUBBLESHIELDTRAP8 + {SPR_BWVE, FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_BUBBLESHIELDWAVE2}, // S_BUBBLESHIELDWAVE1 + {SPR_BWVE, FF_FULLBRIGHT|1, 1, {NULL}, 0, 0, S_BUBBLESHIELDWAVE3}, // S_BUBBLESHIELDWAVE2 + {SPR_BWVE, FF_FULLBRIGHT|2, 1, {NULL}, 0, 0, S_BUBBLESHIELDWAVE4}, // S_BUBBLESHIELDWAVE3 + {SPR_BWVE, FF_FULLBRIGHT|3, 1, {NULL}, 0, 0, S_BUBBLESHIELDWAVE5}, // S_BUBBLESHIELDWAVE4 + {SPR_BWVE, FF_FULLBRIGHT|4, 1, {NULL}, 0, 0, S_BUBBLESHIELDWAVE6}, // S_BUBBLESHIELDWAVE5 + {SPR_BWVE, FF_FULLBRIGHT|5, 1, {NULL}, 0, 0, S_NULL}, // S_BUBBLESHIELDWAVE6 {SPR_FLMS, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_FLAMESHIELD2}, // S_FLAMESHIELD1 {SPR_FLMS, FF_FULLBRIGHT|9, 2, {NULL}, 0, 0, S_FLAMESHIELD3}, // S_FLAMESHIELD2 @@ -15973,7 +15979,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 8, // speed - 20*FRACUNIT, // radius + 28*FRACUNIT, // radius 56*FRACUNIT, // height 1, // display offset 16, // mass @@ -16000,7 +16006,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 8, // speed - 20*FRACUNIT, // radius + 28*FRACUNIT, // radius 56*FRACUNIT, // height 1, // display offset 16, // mass @@ -16027,7 +16033,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 8, // speed - 20*FRACUNIT, // radius + 28*FRACUNIT, // radius 56*FRACUNIT, // height 1, // display offset 16, // mass diff --git a/src/info.h b/src/info.h index 000d2fb93..f6324c1d9 100644 --- a/src/info.h +++ b/src/info.h @@ -618,6 +618,7 @@ typedef enum sprite SPR_SPBM, // Self-Propelled Bomb SPR_THNS, // Thunder Shield SPR_BUBS, // Bubble Shield (not Bubs) + SPR_BWVE, // Bubble Shield waves SPR_FLMS, // Flame Shield SPR_SINK, // Kitchen Sink SPR_SITR, // Kitchen Sink Trail @@ -3546,6 +3547,12 @@ typedef enum state S_BUBBLESHIELDTRAP6, S_BUBBLESHIELDTRAP7, S_BUBBLESHIELDTRAP8, + S_BUBBLESHIELDWAVE1, + S_BUBBLESHIELDWAVE2, + S_BUBBLESHIELDWAVE3, + S_BUBBLESHIELDWAVE4, + S_BUBBLESHIELDWAVE5, + S_BUBBLESHIELDWAVE6, // Flame Shield S_FLAMESHIELD1, diff --git a/src/k_kart.c b/src/k_kart.c index c1c59986a..9e123e16c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6465,7 +6465,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->kartstuff[k_bubblecool] = TICRATE+bubbletime; if (player->kartstuff[k_bubbleblowup] > bubbletime) { - mobj_t *trap = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BUBBLESHIELDTRAP); + mobj_t *trap = P_SpawnMobj(player->mo->x + player->mo->momx, player->mo->y + player->mo->momy, player->mo->z + player->mo->momz, MT_BUBBLESHIELDTRAP); P_SetScale(trap, (5*trap->destscale)>>1); trap->destscale = (5*trap->destscale)>>2; P_SetTarget(&trap->target, player->mo); diff --git a/src/p_inter.c b/src/p_inter.c index 760026944..941899c16 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -686,13 +686,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->spectator) return; - if (special->target->player && special->target->player->kartstuff[k_bubbleblowup] - && !player->kartstuff[k_spinouttimer]) - { + if (special->target->player && special->target->player->kartstuff[k_bubbleblowup]) K_SpinPlayer(player, special->target, 0, special, false); - if (player->kartstuff[k_spinouttimer]) // Successfully spun out - K_KartBouncing(toucher, special, false, true); - } return; case MT_BUBBLESHIELDTRAP: if ((special->target == toucher || special->target == toucher->target) && (special->threshold > 0)) diff --git a/src/p_mobj.c b/src/p_mobj.c index 775af90e1..7b4bcc212 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6205,7 +6205,7 @@ void P_RunShadows(void) for (mobj = shadowcap; mobj; mobj = next) { - fixed_t floorz; + fixed_t floorz, rad; next = mobj->hnext; P_SetTarget(&mobj->hnext, NULL); @@ -6227,8 +6227,24 @@ void P_RunShadows(void) || (!(mobj->target->eflags & MFE_VERTICALFLIP) && mobj->target->z < floorz)) mobj->flags2 |= MF2_DONTDRAW; + rad = mobj->info->radius; + + switch (mobj->type) + { + case MT_FLOATINGITEM: + rad /= 3; + break; + case MT_THUNDERSHIELD: + case MT_BUBBLESHIELD: + case MT_FLAMESHIELD: + rad = 10<target->radius, mobj->info->radius)); + P_SetScale(mobj, FixedDiv(mobj->target->radius, rad)); dest = mobj->target; @@ -6263,9 +6279,6 @@ void P_RunShadows(void) break; } } - - if (mobj->target->type == MT_FLOATINGITEM) - P_SetScale(mobj, mobj->scale/3); } P_SetTarget(&shadowcap, NULL); } @@ -8422,6 +8435,7 @@ void P_MobjThinker(mobj_t *mobj) if (curstate != S_BUBBLESHIELDBLOWUP) P_SetMobjState(mobj, S_BUBBLESHIELDBLOWUP); + mobj->angle += ANGLE_22h; mobj->flags2 &= ~MF2_SHADOW; scale += (blow * (scale<<1)) / bubbletime; @@ -8436,10 +8450,37 @@ void P_MobjThinker(mobj_t *mobj) else if ((mobj->extravalue1 > -4 && mobj->extravalue2 > blow) || (mobj->cvmem && mobj->extravalue1 > 0)) // Shrinking mobj->extravalue1--; + + if (P_IsObjectOnGround(mobj->target)) + { + mobj_t *wave; + + wave = P_SpawnMobj( + mobj->target->x + P_ReturnThrustX(NULL, mobj->angle, mobj->radius), + mobj->target->y + P_ReturnThrustY(NULL, mobj->angle, mobj->radius), + mobj->target->z, MT_THOK); + wave->flags &= ~(MF_NOCLIPHEIGHT|MF_NOGRAVITY); + wave->momx = mobj->target->momx; + wave->momy = mobj->target->momy; + wave->momz = mobj->target->momz; + P_SetMobjState(wave, S_BUBBLESHIELDWAVE1); + + // same thing, but + ANGLE_180 + wave = P_SpawnMobj( + mobj->target->x + P_ReturnThrustX(NULL, mobj->angle + ANGLE_180, mobj->radius), + mobj->target->y + P_ReturnThrustY(NULL, mobj->angle + ANGLE_180, mobj->radius), + mobj->target->z, MT_THOK); + wave->flags &= ~(MF_NOCLIPHEIGHT|MF_NOGRAVITY); + wave->momx = mobj->target->momx; + wave->momy = mobj->target->momy; + wave->momz = mobj->target->momz; + P_SetMobjState(wave, S_BUBBLESHIELDWAVE1); + } } else { mobj->cvmem = 0; + mobj->angle = mobj->target->angle; if (curstate == S_BUBBLESHIELDBLOWUP) { From 26065e99830e09e51a59d598536b83af0041e820 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 21 May 2019 18:02:21 -0400 Subject: [PATCH 011/117] Bubble Shield updatin's - Bigger hitbox - Waves start smaller, grow up the old size near the end of the inflation - Waves follow the shield slightly better - Bubble Shield gives more base weight (this may not actually impact anything) - Reduced slowdown from bubble trap - Recoded bubble reflecting to ignore player held shield items - Added more sound effects - Increased Bubble max size --- src/info.c | 4 +- src/k_kart.c | 60 +++++++++----- src/p_inter.c | 19 +---- src/p_map.c | 216 ++++++++++++++++++++++++-------------------------- src/p_mobj.c | 70 ++++++++-------- src/sounds.c | 10 +-- 6 files changed, 191 insertions(+), 188 deletions(-) diff --git a/src/info.c b/src/info.c index deae2828a..3ddd217b6 100644 --- a/src/info.c +++ b/src/info.c @@ -16012,7 +16012,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 16, // mass 0, // damage sfx_None, // activesound - MF_SPECIAL|MF_NOCLIP|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + MF_SOLID|MF_NOCLIP|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -16060,7 +16060,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 8, // speed - 20*FRACUNIT, // radius + 28*FRACUNIT, // radius 56*FRACUNIT, // height 1, // display offset 16, // mass diff --git a/src/k_kart.c b/src/k_kart.c index 9e123e16c..85f06be67 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1298,6 +1298,31 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) //{ SRB2kart p_user.c Stuff +static fixed_t K_PlayerWeight(mobj_t *mobj, mobj_t *against) +{ + fixed_t weight = 5*mobj->scale; + + if (!mobj->player) + return weight; + + if (against && !P_MobjWasRemoved(against) && against->player + && ((!against->player->kartstuff[k_spinouttimer] && mobj->player->kartstuff[k_spinouttimer]) // You're in spinout + || (against->player->kartstuff[k_itemtype] == KITEM_BUBBLESHIELD && mobj->player->kartstuff[k_itemtype] != KITEM_BUBBLESHIELD))) // They have a Bubble Shield + { + weight = 0; // This player does not cause any bump action + } + else + { + weight = (mobj->player->kartweight) * mobj->scale; + if (mobj->player->speed > K_GetKartSpeed(mobj->player, false)) + weight += (mobj->player->speed - K_GetKartSpeed(mobj->player, false))/8; + if (mobj->player->kartstuff[k_itemtype] == KITEM_BUBBLESHIELD) + weight += 9*mobj->scale; + } + + return weight; +} + static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) { fixed_t weight = 5*mobj->scale; @@ -1307,40 +1332,32 @@ static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) case MT_PLAYER: if (!mobj->player) break; - if (against->player - && ((!against->player->kartstuff[k_spinouttimer] && mobj->player->kartstuff[k_spinouttimer]) - || (against->player->kartstuff[k_itemtype] == KITEM_BUBBLESHIELD && mobj->player->kartstuff[k_itemtype] != KITEM_BUBBLESHIELD) - || (against->type == MT_BUBBLESHIELD))) - weight = 0; // This player does not cause any bump action - else - { - weight = (mobj->player->kartweight) * mobj->scale; - if (mobj->player->speed > K_GetKartSpeed(mobj->player, false)) - weight += (mobj->player->speed - K_GetKartSpeed(mobj->player, false))/8; - } + weight = K_PlayerWeight(mobj, against); + break; + case MT_BUBBLESHIELD: + weight = K_PlayerWeight(mobj->target, against); break; case MT_FALLINGROCK: if (against->player) { - if (against->player->kartstuff[k_invincibilitytimer] - || against->player->kartstuff[k_growshrinktimer] > 0) + if (against->player->kartstuff[k_invincibilitytimer] || against->player->kartstuff[k_growshrinktimer] > 0) weight = 0; else - weight = (against->player->kartweight) * against->scale; + weight = K_PlayerWeight(against, NULL); } break; case MT_ORBINAUT: case MT_ORBINAUT_SHIELD: if (against->player) - weight = (against->player->kartweight) * against->scale; + weight = K_PlayerWeight(against, NULL); break; case MT_JAWZ: case MT_JAWZ_DUD: case MT_JAWZ_SHIELD: if (against->player) - weight = (against->player->kartweight+3) * against->scale; + weight = K_PlayerWeight(against, NULL) + (3*against->scale); else - weight = 8*mobj->scale; + weight += 3*mobj->scale; break; default: break; @@ -6460,18 +6477,19 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_holdready]) { if (player->kartstuff[k_bubbleblowup] == 0) - K_PlayAttackTaunt(player->mo); + S_StartSound(player->mo, sfx_s3k75); player->kartstuff[k_bubbleblowup]++; player->kartstuff[k_bubblecool] = TICRATE+bubbletime; if (player->kartstuff[k_bubbleblowup] > bubbletime) { mobj_t *trap = P_SpawnMobj(player->mo->x + player->mo->momx, player->mo->y + player->mo->momy, player->mo->z + player->mo->momz, MT_BUBBLESHIELDTRAP); - P_SetScale(trap, (5*trap->destscale)>>1); + P_SetScale(trap, ((5*trap->destscale)>>2)*4); trap->destscale = (5*trap->destscale)>>2; P_SetTarget(&trap->target, player->mo); - trap->threshold = 10; - S_StartSound(player->mo, sfx_s3k44); + trap->threshold = TICRATE; + S_StartSound(trap, sfx_s3kbfl); + K_PlayAttackTaunt(player->mo); player->kartstuff[k_bubbleblowup] = 0; player->kartstuff[k_itemamount]--; } diff --git a/src/p_inter.c b/src/p_inter.c index 941899c16..74688a810 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -676,19 +676,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_BALLOON: // SRB2kart P_SetObjectMomZ(toucher, 20<target == toucher) - return; - - if (special->health <= 0 || toucher->health <= 0) - return; - - if (player->spectator) - return; - - if (special->target->player && special->target->player->kartstuff[k_bubbleblowup]) - K_SpinPlayer(player, special->target, 0, special, false); - return; case MT_BUBBLESHIELDTRAP: if ((special->target == toucher || special->target == toucher->target) && (special->threshold > 0)) return; @@ -719,10 +706,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // attach to player! P_SetTarget(&special->tracer, toucher); toucher->flags |= MF_NOGRAVITY; - toucher->momx = (4*toucher->momx)/5; // Huge initial speed cut - toucher->momy = (4*toucher->momy)/5; + toucher->momx = (15*toucher->momx)/16; // Huge initial speed cut + toucher->momy = (15*toucher->momy)/16; toucher->momz = (8*toucher->scale) * P_MobjFlip(toucher); - //S_StartSound(special, sfx_s1a2); + S_StartSound(toucher, sfx_s1b2); return; // ***************************************** // diff --git a/src/p_map.c b/src/p_map.c index 4f0edfae0..053ec6e83 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -723,6 +723,110 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->type == MT_RANDOMITEM) return true; + // Bubble Shield reflect + if (((thing->type == MT_BUBBLESHIELD && thing->target->player && thing->target->player->kartstuff[k_bubbleblowup]) + || (thing->player && thing->player->kartstuff[k_bubbleblowup])) + && (tmthing->type == MT_ORBINAUT || tmthing->type == MT_JAWZ || tmthing->type == MT_JAWZ_DUD + || tmthing->type == MT_BANANA || tmthing->type == MT_EGGMANITEM || tmthing->type == MT_BALLHOG + || tmthing->type == MT_SSMINE || tmthing->type == MT_SINK + || (tmthing->type == MT_PLAYER && thing->target != tmthing))) + { + // 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 + + if (tmthing->type == MT_PLAYER) + { + if (tmthing->player->kartstuff[k_spinouttimer] || tmthing->player->kartstuff[k_squishedtimer] + || tmthing->player->powers[pw_flashing] || tmthing->player->kartstuff[k_hyudorotimer] + || tmthing->player->kartstuff[k_justbumped] || tmthing->scale > thing->scale + (mapobjectscale/8)) + return true; + + // Player Damage + P_DamageMobj(tmthing, thing, ((thing->type == MT_BUBBLESHIELD) ? thing->target : thing), 1); + K_KartBouncing(tmthing, thing, false, true); + S_StartSound(thing, sfx_s3k44); + } + else + { + if (!tmthing->threshold) + { + if (!tmthing->momx && !tmthing->momy) + { + tmthing->momz += (24*tmthing->scale) * P_MobjFlip(tmthing); + } + else + { + tmthing->momx = -tmthing->momx; + tmthing->momy = -tmthing->momy; + tmthing->momz = -tmthing->momz; + } + if (tmthing->type == MT_JAWZ) + P_SetTarget(&tmthing->tracer, tmthing->target); // Back to the source! + tmthing->threshold = 10; + S_StartSound(thing, sfx_s3k44); + } + } + + // no interaction + return true; + } + else if (((tmthing->type == MT_BUBBLESHIELD && tmthing->target->player && tmthing->target->player->kartstuff[k_bubbleblowup]) + || (tmthing->player && tmthing->player->kartstuff[k_bubbleblowup])) + && (thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD + || thing->type == MT_BANANA || thing->type == MT_EGGMANITEM || thing->type == MT_BALLHOG + || thing->type == MT_SSMINE || thing->type == MT_SINK + || (thing->type == MT_PLAYER && tmthing->target != thing))) + { + // 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 + + if (thing->type == MT_PLAYER) + { + if (thing->player->kartstuff[k_spinouttimer] || thing->player->kartstuff[k_squishedtimer] + || thing->player->powers[pw_flashing] || thing->player->kartstuff[k_hyudorotimer] + || thing->player->kartstuff[k_justbumped] || thing->scale > tmthing->scale + (mapobjectscale/8)) + return true; + + // Player Damage + P_DamageMobj(thing, tmthing, ((tmthing->type == MT_BUBBLESHIELD) ? tmthing->target : tmthing), 1); + K_KartBouncing(thing, tmthing, false, true); + S_StartSound(tmthing, sfx_s3k44); + } + else + { + if (!thing->threshold) + { + if (!thing->momx && !thing->momy) + { + thing->momz += (24*thing->scale) * P_MobjFlip(thing); + } + else + { + thing->momx = -thing->momx; + thing->momy = -thing->momy; + thing->momz = -thing->momz; + } + if (thing->type == MT_JAWZ) + P_SetTarget(&thing->tracer, thing->target); // Back to the source! + thing->threshold = 10; + S_StartSound(tmthing, sfx_s3k44); + } + } + + // no interaction + return true; + } + + // double make sure bubbles won't collide with anything else + if (thing->type == MT_BUBBLESHIELD || tmthing->type == MT_BUBBLESHIELD) + 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) { @@ -750,29 +854,6 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player && thing->player->kartstuff[k_hyudorotimer]) return true; // no interaction - if ((thing->type == MT_BUBBLESHIELD && thing->target->player && thing->target->player->kartstuff[k_bubbleblowup]) - || (thing->player && thing->player->kartstuff[k_bubbleblowup])) - { - if (!tmthing->threshold) - { - if (!tmthing->momx && !tmthing->momy) - { - tmthing->momz = (32*tmthing->scale) * P_MobjFlip(tmthing); - } - else - { - tmthing->momx = -tmthing->momx; - tmthing->momy = -tmthing->momy; - tmthing->momz = -tmthing->momz; - } - if (tmthing->type == MT_JAWZ) - P_SetTarget(&tmthing->tracer, tmthing->target); // Back to the source! - tmthing->threshold = 10; - S_StartSound(tmthing, sfx_s3k44); - } - return true; - } - if (thing->type == MT_PLAYER) { // Player Damage @@ -874,27 +955,6 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player && thing->player->powers[pw_flashing]) return true; - if ((thing->type == MT_BUBBLESHIELD && thing->target->player && thing->target->player->kartstuff[k_bubbleblowup]) - || (thing->player && thing->player->kartstuff[k_bubbleblowup])) - { - if (!tmthing->threshold) - { - if (!tmthing->momx && !tmthing->momy) - { - tmthing->momz = (32*tmthing->scale) * P_MobjFlip(tmthing); - } - else - { - tmthing->momx = -tmthing->momx; - tmthing->momy = -tmthing->momy; - tmthing->momz = -tmthing->momz; - } - tmthing->threshold = 10; - S_StartSound(tmthing, sfx_s3k44); - } - return true; - } - if (thing->type == MT_PLAYER) { S_StartSound(NULL, sfx_bsnipe); //let all players hear it. @@ -957,27 +1017,6 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player && thing->player->powers[pw_flashing]) return true; - if ((thing->type == MT_BUBBLESHIELD && thing->target->player && thing->target->player->kartstuff[k_bubbleblowup]) - || (thing->player && thing->player->kartstuff[k_bubbleblowup])) - { - if (!tmthing->threshold) - { - if (!tmthing->momx && !tmthing->momy) - { - tmthing->momz = (32*tmthing->scale) * P_MobjFlip(tmthing); - } - else - { - tmthing->momx = -tmthing->momx; - tmthing->momy = -tmthing->momy; - tmthing->momz = -tmthing->momz; - } - tmthing->threshold = 10; - S_StartSound(tmthing, sfx_s3k44); - } - return true; - } - if (thing->type == MT_PLAYER) { // Banana snipe! @@ -1050,28 +1089,6 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player && thing->player->powers[pw_flashing]) return true; - // Bubble Shield reflect - if ((thing->type == MT_BUBBLESHIELD && thing->target->player && thing->target->player->kartstuff[k_bubbleblowup]) - || (thing->player && thing->player->kartstuff[k_bubbleblowup])) - { - if (!tmthing->threshold) - { - if (!tmthing->momx && !tmthing->momy) - { - tmthing->momz = (32*tmthing->scale) * P_MobjFlip(tmthing); - } - else - { - tmthing->momx = -tmthing->momx; - tmthing->momy = -tmthing->momy; - tmthing->momz = -tmthing->momz; - } - tmthing->threshold = 10; - S_StartSound(tmthing, sfx_s3k44); - } - return true; - } - if (thing->type == MT_PLAYER) { // Bomb punting @@ -1123,31 +1140,6 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->player && tmthing->player->kartstuff[k_hyudorotimer]) // I thought about doing this for just the objects below but figured it should apply to everything. return true; // no interaction - // Bubble Shield reflect - if (((tmthing->type == MT_BUBBLESHIELD && tmthing->target->player && tmthing->target->player->kartstuff[k_bubbleblowup]) - || (tmthing->player && tmthing->player->kartstuff[k_bubbleblowup])) - && (thing->type != MT_MINEEXPLOSION)) - { - if (!thing->threshold) - { - if (!thing->momx && !thing->momy) - { - thing->momz = (32*thing->scale) * P_MobjFlip(thing); - } - else - { - thing->momx = -thing->momx; - thing->momy = -thing->momy; - thing->momz = -thing->momz; - } - if (thing->type == MT_JAWZ) - P_SetTarget(&thing->tracer, thing->target); // Back to the source! - thing->threshold = 10; - S_StartSound(thing, sfx_s3k44); - } - return true; - } - if (thing->type == MT_ORBINAUT_SHIELD || thing->type == MT_JAWZ_SHIELD || thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD) { diff --git a/src/p_mobj.c b/src/p_mobj.c index 7b4bcc212..20c7abb04 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6227,24 +6227,25 @@ void P_RunShadows(void) || (!(mobj->target->eflags & MFE_VERTICALFLIP) && mobj->target->z < floorz)) mobj->flags2 |= MF2_DONTDRAW; - rad = mobj->info->radius; + rad = mobj->target->radius; - switch (mobj->type) + switch (mobj->target->type) { case MT_FLOATINGITEM: rad /= 3; break; case MT_THUNDERSHIELD: case MT_BUBBLESHIELD: + case MT_BUBBLESHIELDTRAP: case MT_FLAMESHIELD: - rad = 10<target->scale; break; default: break; } // First scale to the same radius - P_SetScale(mobj, FixedDiv(mobj->target->radius, rad)); + P_SetScale(mobj, FixedDiv(rad, mobj->info->radius)); dest = mobj->target; @@ -8383,7 +8384,7 @@ void P_MobjThinker(mobj_t *mobj) P_RemoveMobj(mobj); return; } - P_SetScale(mobj, (mobj->destscale = (5*mobj->target->destscale)>>2)); + P_SetScale(mobj, (mobj->destscale = (5*mobj->target->scale)>>2)); if (!splitscreen /*&& rendermode != render_soft*/) { @@ -8425,7 +8426,7 @@ void P_MobjThinker(mobj_t *mobj) return; } - scale = (5*mobj->target->destscale)>>2; + scale = (5*mobj->target->scale)>>2; curstate = ((mobj->tics == 1) ? (mobj->state->nextstate) : ((statenum_t)(mobj->state-states))); if (mobj->target->player->kartstuff[k_bubbleblowup]) @@ -8437,7 +8438,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->angle += ANGLE_22h; mobj->flags2 &= ~MF2_SHADOW; - scale += (blow * (scale<<1)) / bubbletime; + scale += (blow * (3*scale)) / bubbletime; mobj->frame = (states[S_BUBBLESHIELDBLOWUP].frame + mobj->extravalue1); @@ -8453,28 +8454,30 @@ void P_MobjThinker(mobj_t *mobj) if (P_IsObjectOnGround(mobj->target)) { - mobj_t *wave; + UINT8 i; - wave = P_SpawnMobj( - mobj->target->x + P_ReturnThrustX(NULL, mobj->angle, mobj->radius), - mobj->target->y + P_ReturnThrustY(NULL, mobj->angle, mobj->radius), - mobj->target->z, MT_THOK); - wave->flags &= ~(MF_NOCLIPHEIGHT|MF_NOGRAVITY); - wave->momx = mobj->target->momx; - wave->momy = mobj->target->momy; - wave->momz = mobj->target->momz; - P_SetMobjState(wave, S_BUBBLESHIELDWAVE1); + for (i = 0; i < 2; i++) + { + angle_t a = mobj->angle + ((i & 1) ? ANGLE_180 : 0); + fixed_t ws = (mobj->target->scale>>1); + mobj_t *wave; - // same thing, but + ANGLE_180 - wave = P_SpawnMobj( - mobj->target->x + P_ReturnThrustX(NULL, mobj->angle + ANGLE_180, mobj->radius), - mobj->target->y + P_ReturnThrustY(NULL, mobj->angle + ANGLE_180, mobj->radius), - mobj->target->z, MT_THOK); - wave->flags &= ~(MF_NOCLIPHEIGHT|MF_NOGRAVITY); - wave->momx = mobj->target->momx; - wave->momy = mobj->target->momy; - wave->momz = mobj->target->momz; - P_SetMobjState(wave, S_BUBBLESHIELDWAVE1); + ws += (blow * ws) / bubbletime; + + wave = P_SpawnMobj( + (mobj->target->x - mobj->target->momx) + P_ReturnThrustX(NULL, a, mobj->radius - (21*ws)), + (mobj->target->y - mobj->target->momy) + P_ReturnThrustY(NULL, a, mobj->radius - (21*ws)), + (mobj->target->z - mobj->target->momz), MT_THOK); + + wave->flags &= ~(MF_NOCLIPHEIGHT|MF_NOGRAVITY); + P_SetScale(wave, (wave->destscale = ws)); + + wave->momx = mobj->target->momx; + wave->momy = mobj->target->momy; + wave->momz = mobj->target->momz; + + P_SetMobjState(wave, S_BUBBLESHIELDWAVE1); + } } } else @@ -8545,7 +8548,7 @@ void P_MobjThinker(mobj_t *mobj) P_RemoveMobj(mobj); return; } - P_SetScale(mobj, (mobj->destscale = (5*mobj->target->destscale)>>2)); + P_SetScale(mobj, (mobj->destscale = (5*mobj->target->scale)>>2)); curstate = ((mobj->tics == 1) ? (mobj->state->nextstate) : ((statenum_t)(mobj->state-states))); @@ -9258,6 +9261,9 @@ void P_MobjThinker(mobj_t *mobj) } break; case MT_BUBBLESHIELDTRAP: + if (leveltime % 180 == 0) + S_StartSound(mobj, sfx_s3kbfl); + if (mobj->tracer && !P_MobjWasRemoved(mobj->tracer) && mobj->tracer->player) { player_t *player = mobj->tracer->player; @@ -9267,14 +9273,14 @@ void P_MobjThinker(mobj_t *mobj) P_TeleportMove(mobj, mobj->tracer->x + P_ReturnThrustX(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->y + P_ReturnThrustY(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->z + (P_RandomRange(-abs(mobj->cvmem), abs(mobj->cvmem))<tracer->z - (4*mobj->tracer->scale) + (P_RandomRange(-abs(mobj->cvmem), abs(mobj->cvmem))<cvmem /= 2; mobj->momz = 0; - mobj->destscale = (5*mobj->tracer->scale)>>2; + mobj->destscale = ((5*mobj->tracer->scale)>>2) + (mobj->tracer->scale>>3); - mobj->tracer->momx = (31*mobj->tracer->momx)/32; - mobj->tracer->momy = (31*mobj->tracer->momy)/32; + mobj->tracer->momx = (127*mobj->tracer->momx)/128; + mobj->tracer->momy = (127*mobj->tracer->momy)/128; mobj->tracer->momz = (8*mobj->tracer->scale) * P_MobjFlip(mobj->tracer); if (mobj->movecount > 8*TICRATE) diff --git a/src/sounds.c b/src/sounds.c index 61fddb76f..85d6137ba 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -408,13 +408,13 @@ sfxinfo_t S_sfx[NUMSFX] = {"s3k3b", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"s3k3c", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"s3k3d", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"s3k3e", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"s3k3f", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, + {"s3k3e", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Kart Flame Shield spawned + {"s3k3f", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Kart Bubble Shield spawned {"s3k40", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"s3k41", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"s3k42", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Kart Thunder Shield spawned + {"s3k41", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Kart Thunder Shield spawned + {"s3k42", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"s3k43", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"s3k44", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, + {"s3k44", false, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Kart Bubble Shield reflect {"s3k45", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"s3k46", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"s3k47", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Kart AIZ dust From ea3d6227e4966155abdc4075e72d6ce60576bcfc Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 21 May 2019 18:13:39 -0400 Subject: [PATCH 012/117] Add small bit of gravity for Bubble trap --- 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 20c7abb04..5d40940b9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9320,7 +9320,7 @@ void P_MobjThinker(mobj_t *mobj) } else { - mobj->momz = 0; + mobj->momz = -(FRACUNIT * P_MobjFlip(mobj)); mobj->destscale = (5*mapobjectscale)>>2; if (mobj->threshold > 0) mobj->threshold--; From 75d7bf675e4eb3b81e99f054707ebecc1eb401a9 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 21 May 2019 18:13:46 -0400 Subject: [PATCH 013/117] Update item table --- src/k_kart.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 85f06be67..f4d915238 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -686,20 +686,20 @@ static INT32 K_KartItemOddsRace[NUMKARTRESULTS-1][8] = //P-Odds 0 1 2 3 4 5 6 7 /*Sneaker*/ { 0, 0, 2, 4, 6, 0, 0, 0 }, // Sneaker /*Rocket Sneaker*/ { 0, 0, 0, 0, 0, 2, 4, 6 }, // Rocket Sneaker - /*Invincibility*/ { 0, 0, 0, 0, 1, 4, 8, 9 }, // Invincibility - /*Banana*/ { 7, 4, 2, 1, 0, 0, 0, 0 }, // Banana - /*Eggman Monitor*/ { 3, 2, 1, 0, 0, 0, 0, 0 }, // Eggman Monitor - /*Orbinaut*/ { 7, 5, 3, 2, 0, 0, 0, 0 }, // Orbinaut + /*Invincibility*/ { 0, 0, 0, 0, 1, 4, 7, 9 }, // Invincibility + /*Banana*/ { 7, 3, 2, 0, 0, 0, 0, 0 }, // Banana + /*Eggman Monitor*/ { 3, 2, 0, 0, 0, 0, 0, 0 }, // Eggman Monitor + /*Orbinaut*/ { 7, 4, 3, 2, 0, 0, 0, 0 }, // Orbinaut /*Jawz*/ { 0, 3, 2, 1, 1, 0, 0, 0 }, // Jawz /*Mine*/ { 0, 2, 2, 1, 0, 0, 0, 0 }, // Mine /*Ballhog*/ { 0, 0, 2, 1, 0, 0, 0, 0 }, // Ballhog /*Self-Propelled Bomb*/ { 0, 1, 2, 3, 4, 2, 2, 0 }, // Self-Propelled Bomb - /*Grow*/ { 0, 0, 0, 1, 1, 3, 0, 0 }, // Grow + /*Grow*/ { 0, 0, 0, 1, 2, 3, 0, 0 }, // Grow /*Shrink*/ { 0, 0, 0, 0, 0, 0, 2, 0 }, // Shrink /*Thunder Shield*/ { 1, 2, 0, 0, 0, 0, 0, 0 }, // Thunder Shield - /*Bubble Shield*/ { 0, 0, 2, 2, 2, 0, 0, 0 }, // Bubble Shield - /*Flame Shield*/ { 0, 0, 0, 0, 0, 0, 1, 5 }, // Flame Shield - /*Hyudoro*/ { 0, 0, 0, 1, 2, 1, 0, 0 }, // Hyudoro + /*Bubble Shield*/ { 0, 2, 3, 3, 1, 0, 0, 0 }, // Bubble Shield + /*Flame Shield*/ { 0, 0, 0, 0, 0, 1, 3, 5 }, // Flame Shield + /*Hyudoro*/ { 0, 0, 0, 1, 2, 0, 0, 0 }, // Hyudoro /*Pogo Spring*/ { 0, 0, 0, 0, 0, 0, 0, 0 }, // Pogo Spring /*Super Ring*/ { 2, 1, 1, 0, 0, 0, 0, 0 }, // Super Ring /*Kitchen Sink*/ { 0, 0, 0, 0, 0, 0, 0, 0 }, // Kitchen Sink From a2f61c8f2b318ed19abffca9ac199df69e03e96a Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 21 May 2019 18:15:08 -0400 Subject: [PATCH 014/117] Reel force SPB distance back in a bit --- 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 f4d915238..7308f048b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1244,7 +1244,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) // SPECIAL CASE No. 5: // Force SPB onto 2nd if they get too far behind - if (player->kartstuff[k_position] == 2 && pdis > (DISTVAR*9) + if (player->kartstuff[k_position] == 2 && pdis > (DISTVAR*8) && spbplace == -1 && !indirectitemcooldown && !dontforcespb && cv_selfpropelledbomb.value) { From e96cf41fabdae32c8aa659a20f35d5fd2a3a11a2 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 21 May 2019 20:40:20 -0400 Subject: [PATCH 015/117] Bubble attacks no longer bump Causes desync --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 053ec6e83..52a483d3c 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -746,7 +746,7 @@ static boolean PIT_CheckThing(mobj_t *thing) // Player Damage P_DamageMobj(tmthing, thing, ((thing->type == MT_BUBBLESHIELD) ? thing->target : thing), 1); - K_KartBouncing(tmthing, thing, false, true); + //K_KartBouncing(tmthing, thing, false, true); // Causes desync S_StartSound(thing, sfx_s3k44); } else @@ -795,7 +795,7 @@ static boolean PIT_CheckThing(mobj_t *thing) // Player Damage P_DamageMobj(thing, tmthing, ((tmthing->type == MT_BUBBLESHIELD) ? tmthing->target : tmthing), 1); - K_KartBouncing(thing, tmthing, false, true); + //K_KartBouncing(thing, tmthing, false, true); S_StartSound(tmthing, sfx_s3k44); } else From 5ed356ea46d20e955868cf7ac29d13a8926e7e34 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 22 May 2019 13:40:35 -0400 Subject: [PATCH 016/117] Flip angle when reflecting --- src/p_map.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index 52a483d3c..c0286263b 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -762,6 +762,7 @@ static boolean PIT_CheckThing(mobj_t *thing) tmthing->momx = -tmthing->momx; tmthing->momy = -tmthing->momy; tmthing->momz = -tmthing->momz; + tmthing->angle += ANGLE_180; } if (tmthing->type == MT_JAWZ) P_SetTarget(&tmthing->tracer, tmthing->target); // Back to the source! @@ -811,6 +812,7 @@ static boolean PIT_CheckThing(mobj_t *thing) thing->momx = -thing->momx; thing->momy = -thing->momy; thing->momz = -thing->momz; + thing->angle += ANGLE_180; } if (thing->type == MT_JAWZ) P_SetTarget(&thing->tracer, thing->target); // Back to the source! From 414c2d4fb03410481272b0d4dea66bc325509b34 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 22 May 2019 13:50:31 -0400 Subject: [PATCH 017/117] Add thrust to Bubble Shield --- src/p_map.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index c0286263b..48a790aa2 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -739,6 +739,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->type == MT_PLAYER) { + // K_KartBouncing causes desync, so we'll have to use a janky thrust instead + P_Thrust(tmthing, R_PointToAngle2(thing->x, thing->y, tmthing->x, tmthing->y), 4*thing->scale); + if (tmthing->player->kartstuff[k_spinouttimer] || tmthing->player->kartstuff[k_squishedtimer] || tmthing->player->powers[pw_flashing] || tmthing->player->kartstuff[k_hyudorotimer] || tmthing->player->kartstuff[k_justbumped] || tmthing->scale > thing->scale + (mapobjectscale/8)) @@ -746,7 +749,7 @@ static boolean PIT_CheckThing(mobj_t *thing) // Player Damage P_DamageMobj(tmthing, thing, ((thing->type == MT_BUBBLESHIELD) ? thing->target : thing), 1); - //K_KartBouncing(tmthing, thing, false, true); // Causes desync + //K_KartBouncing(tmthing, thing, false, true); S_StartSound(thing, sfx_s3k44); } else @@ -789,6 +792,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->type == MT_PLAYER) { + // K_KartBouncing causes desync, so we'll have to use a janky thrust instead + P_Thrust(thing, R_PointToAngle2(tmthing->x, tmthing->y, thing->x, thing->y), 4*tmthing->scale); + if (thing->player->kartstuff[k_spinouttimer] || thing->player->kartstuff[k_squishedtimer] || thing->player->powers[pw_flashing] || thing->player->kartstuff[k_hyudorotimer] || thing->player->kartstuff[k_justbumped] || thing->scale > tmthing->scale + (mapobjectscale/8)) From f615ff3b6b7f503efaf39aaac31af9e40300095e Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 22 May 2019 13:54:32 -0400 Subject: [PATCH 018/117] Ignore bumping ring effects for shielded players --- src/k_kart.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 7308f048b..4d97353b0 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1550,7 +1550,8 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) mobj1->player->kartstuff[k_spinouttimer] = max(wipeoutslowtime+1, mobj1->player->kartstuff[k_spinouttimer]); //mobj1->player->kartstuff[k_spinouttype] = 1; // Enforce type } - else if (mobj2->player) // Player VS player bumping only + else if (mobj2->player // Player VS player bumping only + && (K_GetShieldFromItem(mobj1->player->kartstuff[k_itemtype]) == KITEM_NONE)) // Ignore for shields { if (mobj1->player->kartstuff[k_rings] <= 0) { @@ -1574,7 +1575,8 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) mobj2->player->kartstuff[k_spinouttimer] = max(wipeoutslowtime+1, mobj2->player->kartstuff[k_spinouttimer]); //mobj2->player->kartstuff[k_spinouttype] = 1; // Enforce type } - else if (mobj1->player) // Player VS player bumping only + else if (mobj1->player // Player VS player bumping only + && (K_GetShieldFromItem(mobj2->player->kartstuff[k_itemtype]) == KITEM_NONE)) // Ignore for shields { if (mobj2->player->kartstuff[k_rings] <= 0) { From bb794ffac988fa3383e17a9c0dedf7a161541440 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 22 May 2019 19:26:43 -0400 Subject: [PATCH 019/117] SHOOT bubbles forward --- src/info.c | 6 ++-- src/k_kart.c | 52 +++++++++++++++++++++++----------- src/p_inter.c | 14 --------- src/p_mobj.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++----- 4 files changed, 110 insertions(+), 40 deletions(-) diff --git a/src/info.c b/src/info.c index 3ddd217b6..81fa4484f 100644 --- a/src/info.c +++ b/src/info.c @@ -16059,14 +16059,14 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // deathstate S_NULL, // xdeathstate sfx_None, // deathsound - 8, // speed + 128*FRACUNIT, // speed 28*FRACUNIT, // radius 56*FRACUNIT, // height - 1, // display offset + 2, // display offset 16, // mass 0, // damage sfx_None, // activesound - MF_SPECIAL|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + MF_SPECIAL|MF_BOUNCE|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, diff --git a/src/k_kart.c b/src/k_kart.c index 4d97353b0..c5b7b1640 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1526,7 +1526,10 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) } // Do the bump fx when we've CONFIRMED we can bump. - S_StartSound(mobj1, sfx_s3k49); + if ((mobj1->player && mobj1->player->kartstuff[k_itemtype] == KITEM_BUBBLESHIELD) || (mobj2->player && mobj2->player->kartstuff[k_itemtype] == KITEM_BUBBLESHIELD)) + S_StartSound(mobj1, sfx_s3k44); + else + S_StartSound(mobj1, sfx_s3k49); fx = P_SpawnMobj(mobj1->x/2 + mobj2->x/2, mobj1->y/2 + mobj2->y/2, mobj1->z/2 + mobj2->z/2, MT_BUMP); if (mobj1->eflags & MFE_VERTICALFLIP) @@ -3201,16 +3204,25 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I case MT_SPB: th->movefactor = finalspeed; break; + case MT_BUBBLESHIELDTRAP: + P_SetScale(th, ((5*th->destscale)>>2)*4); + th->destscale = (5*th->destscale)>>2; + S_StartSound(th, sfx_s3kbfl); + S_StartSound(th, sfx_cdfm35); + break; default: break; } - x = x + P_ReturnThrustX(source, an, source->radius + th->radius); - y = y + P_ReturnThrustY(source, an, source->radius + th->radius); - throwmo = P_SpawnMobj(x, y, z, MT_FIREDITEM); - throwmo->movecount = 1; - throwmo->movedir = source->angle - an; - P_SetTarget(&throwmo->target, source); + if (type != MT_BUBBLESHIELDTRAP) + { + x = x + P_ReturnThrustX(source, an, source->radius + th->radius); + y = y + P_ReturnThrustY(source, an, source->radius + th->radius); + throwmo = P_SpawnMobj(x, y, z, MT_FIREDITEM); + throwmo->movecount = 1; + throwmo->movedir = source->angle - an; + P_SetTarget(&throwmo->target, source); + } return NULL; } @@ -3769,8 +3781,16 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map { mobj_t *lasttrail = K_FindLastTrailMobj(player); - if (lasttrail) + if (mapthing == MT_BUBBLESHIELDTRAP) // Drop directly on top of you. { + newangle = player->mo->angle; + newx = player->mo->x + player->mo->momx; + newy = player->mo->y + player->mo->momy; + newz = player->mo->z; + } + else if (lasttrail) + { + newangle = lasttrail->angle; newx = lasttrail->x; newy = lasttrail->y; newz = lasttrail->z; @@ -3822,6 +3842,12 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map if (mapthing == MT_SSMINE) mo->extravalue1 = 49; // Pads the start-up length from 21 frames to a full 2 seconds + else if (mapthing == MT_BUBBLESHIELDTRAP) + { + P_SetScale(mo, ((5*mo->destscale)>>2)*4); + mo->destscale = (5*mo->destscale)>>2; + S_StartSound(mo, sfx_s3kbfl); + } } } @@ -6481,16 +6507,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_bubbleblowup] == 0) S_StartSound(player->mo, sfx_s3k75); player->kartstuff[k_bubbleblowup]++; - player->kartstuff[k_bubblecool] = TICRATE+bubbletime; + player->kartstuff[k_bubblecool] = player->kartstuff[k_bubbleblowup]*3; if (player->kartstuff[k_bubbleblowup] > bubbletime) { - mobj_t *trap = P_SpawnMobj(player->mo->x + player->mo->momx, player->mo->y + player->mo->momy, player->mo->z + player->mo->momz, MT_BUBBLESHIELDTRAP); - P_SetScale(trap, ((5*trap->destscale)>>2)*4); - trap->destscale = (5*trap->destscale)>>2; - P_SetTarget(&trap->target, player->mo); - trap->threshold = TICRATE; - S_StartSound(trap, sfx_s3kbfl); - + K_ThrowKartItem(player, (player->kartstuff[k_throwdir] > 0), MT_BUBBLESHIELDTRAP, -1, 0); K_PlayAttackTaunt(player->mo); player->kartstuff[k_bubbleblowup] = 0; player->kartstuff[k_itemamount]--; diff --git a/src/p_inter.c b/src/p_inter.c index 74688a810..bee9fc9cf 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -689,20 +689,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (!player->mo || player->spectator) return; - // kill - /*if (player->kartstuff[k_invincibilitytimer] > 0 - || player->kartstuff[k_growshrinktimer] > 0 - || player->kartstuff[k_flamedash] > 0) - { - P_KillMobj(special, toucher, toucher); - return; - }*/ - - // no interaction - if (player->powers[pw_flashing] > 0 || player->kartstuff[k_hyudorotimer] > 0 - || player->kartstuff[k_squishedtimer] > 0 || player->kartstuff[k_spinouttimer] > 0) - return; - // attach to player! P_SetTarget(&special->tracer, toucher); toucher->flags |= MF_NOGRAVITY; diff --git a/src/p_mobj.c b/src/p_mobj.c index 5d40940b9..c0e5b76e2 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1729,6 +1729,10 @@ void P_XYMovement(mobj_t *mo) P_InstaThrust(mo, R_PointToAngle2(mo->x, mo->y, mo->x + xmove, mo->y + ymove)+ANGLE_90, 16*FRACUNIT); } } + + // Bubble bounce + if (mo->type == MT_BUBBLESHIELDTRAP) + S_StartSound(mo, sfx_s3k44); //} // Bounce ring algorithm @@ -1937,7 +1941,9 @@ void P_XYMovement(mobj_t *mo) #endif //{ SRB2kart stuff - if (mo->type == MT_ORBINAUT || mo->type == MT_JAWZ_DUD || mo->type == MT_JAWZ || mo->type == MT_BALLHOG || mo->type == MT_FLINGRING) //(mo->type == MT_JAWZ && !mo->tracer)) + if (mo->type == MT_FLINGRING + || mo->type == MT_ORBINAUT || mo->type == MT_JAWZ || mo->type == MT_JAWZ_DUD + || mo->type == MT_BALLHOG || mo->type == MT_BUBBLESHIELDTRAP) return; if (mo->player && (mo->player->kartstuff[k_spinouttimer] && !mo->player->kartstuff[k_wipeoutslow]) && mo->player->speed <= K_GetKartSpeed(mo->player, false)/2) @@ -2274,6 +2280,7 @@ static boolean P_ZMovement(mobj_t *mo) case MT_JAWZ_DUD: case MT_BALLHOG: case MT_SSMINE: + case MT_BUBBLESHIELDTRAP: // Remove stuff from death pits. if (P_CheckDeathPitCollide(mo)) { @@ -8472,11 +8479,11 @@ void P_MobjThinker(mobj_t *mobj) wave->flags &= ~(MF_NOCLIPHEIGHT|MF_NOGRAVITY); P_SetScale(wave, (wave->destscale = ws)); + P_SetMobjState(wave, S_BUBBLESHIELDWAVE1); + wave->momx = mobj->target->momx; wave->momy = mobj->target->momy; wave->momz = mobj->target->momz; - - P_SetMobjState(wave, S_BUBBLESHIELDWAVE1); } } } @@ -9279,8 +9286,8 @@ void P_MobjThinker(mobj_t *mobj) mobj->momz = 0; mobj->destscale = ((5*mobj->tracer->scale)>>2) + (mobj->tracer->scale>>3); - mobj->tracer->momx = (127*mobj->tracer->momx)/128; - mobj->tracer->momy = (127*mobj->tracer->momy)/128; + mobj->tracer->momx = (63*mobj->tracer->momx)/64; + mobj->tracer->momy = (63*mobj->tracer->momy)/64; mobj->tracer->momz = (8*mobj->tracer->scale) * P_MobjFlip(mobj->tracer); if (mobj->movecount > 8*TICRATE) @@ -9314,16 +9321,73 @@ void P_MobjThinker(mobj_t *mobj) } else if (mobj->extravalue1) // lost your player somehow, DIE { - mobj->tracer->flags &= ~MF_NOGRAVITY; P_KillMobj(mobj, NULL, NULL); break; } else { - mobj->momz = -(FRACUNIT * P_MobjFlip(mobj)); mobj->destscale = (5*mapobjectscale)>>2; + if (mobj->threshold > 0) mobj->threshold--; + + if (abs(mobj->momx) < 8*mobj->destscale && abs(mobj->momy) < 8*mobj->destscale) + { + // Stop, give light gravity + mobj->momx = mobj->momy = 0; + mobj->momz = -(mobj->scale * P_MobjFlip(mobj)); + } + else + { + UINT8 i; + mobj_t *ghost = P_SpawnGhostMobj(mobj); + + if (mobj->target && !P_MobjWasRemoved(mobj->target) && mobj->target->player) + { + ghost->color = mobj->target->player->skincolor; + ghost->colorized = true; + } + + mobj->momx = (23*mobj->momx)/24; + mobj->momy = (23*mobj->momy)/24; + + mobj->angle = R_PointToAngle2(0,0,mobj->momx,mobj->momy); + + if ((mobj->z - mobj->floorz) < (24*mobj->scale) && (leveltime % 3 != 0)) + { + // Cool wave effects! + for (i = 0; i < 2; i++) + { + angle_t aoff; + SINT8 sign = 1; + mobj_t *wave; + + if (i & 1) + sign = -1; + else + sign = 1; + + aoff = (mobj->angle + ANGLE_180) + (ANGLE_45 * sign); + + wave = P_SpawnMobj(mobj->x + FixedMul(mobj->radius, FINECOSINE(aoff>>ANGLETOFINESHIFT)), + mobj->y + FixedMul(mobj->radius, FINESINE(aoff>>ANGLETOFINESHIFT)), + mobj->z, MT_THOK); + + wave->flags &= ~(MF_NOCLIPHEIGHT|MF_NOGRAVITY); + P_SetScale(wave, (wave->destscale = mobj->scale/2)); + + P_SetMobjState(wave, S_BUBBLESHIELDWAVE1); + if (leveltime & 1) + wave->tics++; + + P_SetTarget(&wave->target, mobj); + wave->angle = mobj->angle - (ANGLE_90 * sign); // point completely perpendicular from the bubble + K_FlipFromObject(wave, mobj); + + P_Thrust(wave, wave->angle, 4*mobj->scale); + } + } + } } break; case MT_KARMAFIREWORK: From 5caacfd91d98ae826c89258a6a547869ff5af92b Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 22 May 2019 20:12:16 -0400 Subject: [PATCH 020/117] Enable patch again --- src/doomdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doomdef.h b/src/doomdef.h index 4d3934773..7730a4df0 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -163,7 +163,7 @@ extern FILE *logstream; // Does this version require an added patch file? // Comment or uncomment this as necessary. -//#define USE_PATCH_FILE +#define USE_PATCH_FILE // Use .kart extension addons #define USE_KART From ed316ff4bd76d42bfdea9a6404d9a62939ad7602 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 22 May 2019 20:12:36 -0400 Subject: [PATCH 021/117] Remove thrust again --- src/p_map.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 48a790aa2..7e0b842a1 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -739,17 +739,22 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->type == MT_PLAYER) { - // K_KartBouncing causes desync, so we'll have to use a janky thrust instead + // Counter desyncs + /*mobj_t *oldthing = thing; + mobj_t *oldtmthing = tmthing; + P_Thrust(tmthing, R_PointToAngle2(thing->x, thing->y, tmthing->x, tmthing->y), 4*thing->scale); + thing = oldthing; + P_SetTarget(&tmthing, oldtmthing);*/ + if (tmthing->player->kartstuff[k_spinouttimer] || tmthing->player->kartstuff[k_squishedtimer] || tmthing->player->powers[pw_flashing] || tmthing->player->kartstuff[k_hyudorotimer] || tmthing->player->kartstuff[k_justbumped] || tmthing->scale > thing->scale + (mapobjectscale/8)) return true; // Player Damage - P_DamageMobj(tmthing, thing, ((thing->type == MT_BUBBLESHIELD) ? thing->target : thing), 1); - //K_KartBouncing(tmthing, thing, false, true); + K_SpinPlayer(tmthing->player, thing, 0, ((thing->type == MT_BUBBLESHIELD) ? thing->target : thing), false); S_StartSound(thing, sfx_s3k44); } else @@ -792,17 +797,22 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->type == MT_PLAYER) { - // K_KartBouncing causes desync, so we'll have to use a janky thrust instead + // Counter desyncs + /*mobj_t *oldthing = thing; + mobj_t *oldtmthing = tmthing; + P_Thrust(thing, R_PointToAngle2(tmthing->x, tmthing->y, thing->x, thing->y), 4*tmthing->scale); + thing = oldthing; + P_SetTarget(&tmthing, oldtmthing);*/ + if (thing->player->kartstuff[k_spinouttimer] || thing->player->kartstuff[k_squishedtimer] || thing->player->powers[pw_flashing] || thing->player->kartstuff[k_hyudorotimer] || thing->player->kartstuff[k_justbumped] || thing->scale > tmthing->scale + (mapobjectscale/8)) return true; // Player Damage - P_DamageMobj(thing, tmthing, ((tmthing->type == MT_BUBBLESHIELD) ? tmthing->target : tmthing), 1); - //K_KartBouncing(thing, tmthing, false, true); + K_SpinPlayer(thing->player, tmthing, 0, ((tmthing->type == MT_BUBBLESHIELD) ? tmthing->target : tmthing), false); S_StartSound(tmthing, sfx_s3k44); } else From 068db363685646dbb0dbafdb003d33e2fc5974f1 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 26 May 2019 21:14:26 -0400 Subject: [PATCH 022/117] Bubble blowup has a brief mercy period before it shoots --- src/k_kart.c | 2 +- src/p_mobj.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index c5b7b1640..5a209ab1b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6508,7 +6508,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) S_StartSound(player->mo, sfx_s3k75); player->kartstuff[k_bubbleblowup]++; player->kartstuff[k_bubblecool] = player->kartstuff[k_bubbleblowup]*3; - if (player->kartstuff[k_bubbleblowup] > bubbletime) + if (player->kartstuff[k_bubbleblowup] > bubbletime+10) { K_ThrowKartItem(player, (player->kartstuff[k_throwdir] > 0), MT_BUBBLESHIELDTRAP, -1, 0); K_PlayAttackTaunt(player->mo); diff --git a/src/p_mobj.c b/src/p_mobj.c index c0e5b76e2..267e55365 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8439,6 +8439,8 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->target->player->kartstuff[k_bubbleblowup]) { INT32 blow = mobj->target->player->kartstuff[k_bubbleblowup]; + if (blow > bubbletime) + blow = bubbletime; if (curstate != S_BUBBLESHIELDBLOWUP) P_SetMobjState(mobj, S_BUBBLESHIELDBLOWUP); @@ -8448,6 +8450,8 @@ void P_MobjThinker(mobj_t *mobj) scale += (blow * (3*scale)) / bubbletime; mobj->frame = (states[S_BUBBLESHIELDBLOWUP].frame + mobj->extravalue1); + if ((mobj->target->player->kartstuff[k_bubbleblowup] > bubbletime) && (leveltime & 1)) + mobj->frame = (states[S_BUBBLESHIELDBLOWUP].frame + 5); if (mobj->extravalue1 < 4 && mobj->extravalue2 < blow && !mobj->cvmem && (leveltime & 1)) // Growing { From c90bdc1c37e750af9c0e78d36c90b6fd0b9faded Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 26 May 2019 21:54:35 -0400 Subject: [PATCH 023/117] Longer flash period, but quicker deflate --- src/k_kart.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 5a209ab1b..a9bfe62df 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6508,7 +6508,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) S_StartSound(player->mo, sfx_s3k75); player->kartstuff[k_bubbleblowup]++; player->kartstuff[k_bubblecool] = player->kartstuff[k_bubbleblowup]*3; - if (player->kartstuff[k_bubbleblowup] > bubbletime+10) + if (player->kartstuff[k_bubbleblowup] > bubbletime*2) { K_ThrowKartItem(player, (player->kartstuff[k_throwdir] > 0), MT_BUBBLESHIELDTRAP, -1, 0); K_PlayAttackTaunt(player->mo); @@ -6519,6 +6519,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } else { + if (player->kartstuff[k_bubbleblowup] > bubbletime) + player->kartstuff[k_bubbleblowup] = bubbletime; if (player->kartstuff[k_bubbleblowup]) player->kartstuff[k_bubbleblowup]--; player->kartstuff[k_holdready] = (player->kartstuff[k_bubblecool] ? 0 : 1); From 3151805f6b4ba5da045cf483f8d4637f8e95348f Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 24 Oct 2019 10:25:13 -0400 Subject: [PATCH 024/117] Eggman monitor gives you a very tiny speed boost --- src/k_kart.c | 17 +++++++++++++++-- src/k_kart.h | 3 ++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 991d510f9..ef392bd48 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2302,7 +2302,7 @@ static void K_GetKartBoostPower(player_t *player) if (player->kartstuff[k_flamedash]) // Flame Shield dash { fixed_t dashval = ((player->kartstuff[k_flamedash]<kartstuff[k_startboost]) // Startup Boost @@ -2314,6 +2314,9 @@ static void K_GetKartBoostPower(player_t *player) if (player->kartstuff[k_ringboost]) // Ring Boost ADDBOOST(FRACUNIT/5, 4*FRACUNIT); // + 20% top speed, + 400% acceleration + if (player->kartstuff[k_eggmanexplode]) // Ready-to-explode + ADDBOOST(FRACUNIT/5, 2*FRACUNIT); // + 20% top speed, + 200% acceleration + if (player->kartstuff[k_draftpower] > 0) // Drafting { fixed_t draftspeed = ((3*FRACUNIT)/10) + ((player->kartspeed-1) * (FRACUNIT/50)); // min is 30%, max is 46% @@ -5216,17 +5219,27 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) { // Speed lines if (EITHERSNEAKER(player) || player->kartstuff[k_ringboost] - || player->kartstuff[k_driftboost] || player->kartstuff[k_startboost]) + || player->kartstuff[k_driftboost] || player->kartstuff[k_startboost] + || player->kartstuff[k_eggmanexplode]) { mobj_t *fast = P_SpawnMobj(player->mo->x + (P_RandomRange(-36,36) * player->mo->scale), player->mo->y + (P_RandomRange(-36,36) * player->mo->scale), player->mo->z + (player->mo->height/2) + (P_RandomRange(-20,20) * player->mo->scale), MT_FASTLINE); + fast->angle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); 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); + + // Make it red when you have the eggman speed boost + if (player->kartstuff[k_eggmanexplode]) + { + fast->color = SKINCOLOR_RED; + fast->colorized = true; + } } if (player->kartstuff[k_numboosts] > 0) // Boosting after images diff --git a/src/k_kart.h b/src/k_kart.h index b72928165..731078479 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -8,6 +8,7 @@ #include "doomdef.h" #include "d_player.h" // Need for player_t +#include "command.h" // Need for player_t #define KART_FULLTURN 800 @@ -24,7 +25,7 @@ boolean K_IsPlayerLosing(player_t *player); boolean K_IsPlayerWanted(player_t *player); fixed_t K_GetKartGameSpeedScalar(SINT8 value); -consvar_t *KartItemCVars[NUMKARTRESULTS-1]; +extern consvar_t *KartItemCVars[NUMKARTRESULTS-1]; INT32 K_GetShieldFromItem(INT32 item); void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid); From 985b2ba8dd5f2a29c7a767b546fd1626311f7d69 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 24 Oct 2019 10:26:44 -0400 Subject: [PATCH 025/117] Wrong var here (although the result is the same) --- 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 ef392bd48..1a4e5ebe4 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1554,7 +1554,7 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) //mobj1->player->kartstuff[k_spinouttype] = 1; // Enforce type } else if (mobj2->player // Player VS player bumping only - && (K_GetShieldFromItem(mobj1->player->kartstuff[k_itemtype]) == KITEM_NONE)) // Ignore for shields + && (K_GetShieldFromItem(mobj1->player->kartstuff[k_itemtype]) == KSHIELD_NONE)) // Ignore for shields { if (mobj1->player->kartstuff[k_rings] <= 0) { @@ -1579,7 +1579,7 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) //mobj2->player->kartstuff[k_spinouttype] = 1; // Enforce type } else if (mobj1->player // Player VS player bumping only - && (K_GetShieldFromItem(mobj2->player->kartstuff[k_itemtype]) == KITEM_NONE)) // Ignore for shields + && (K_GetShieldFromItem(mobj2->player->kartstuff[k_itemtype]) == KSHIELD_NONE)) // Ignore for shields { if (mobj2->player->kartstuff[k_rings] <= 0) { From e8c327e5bb00143193e19652ae047fcca8d0f1cb Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 24 Oct 2019 10:33:06 -0400 Subject: [PATCH 026/117] Return earlier for multiple shields --- src/k_kart.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 1a4e5ebe4..8079b2c63 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -821,7 +821,6 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp INT32 newodds; INT32 i; UINT8 pingame = 0, pexiting = 0; - boolean shieldout[NUMKARTSHIELDS-1]; SINT8 first = -1, second = -1; INT32 secondist = 0; INT32 shieldtype = KSHIELD_NONE; @@ -846,7 +845,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp // Base multiplication to ALL item odds to simulate fractional precision newodds *= 4; - memset(shieldout, false, sizeof(shieldout)); + shieldtype = K_GetShieldFromItem(item); for (i = 0; i < MAXPLAYERS; i++) { @@ -859,9 +858,11 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp if (players[i].exiting) pexiting++; - shieldtype = K_GetShieldFromItem(players[i].kartstuff[k_itemtype]); - if (shieldtype != KSHIELD_NONE) - shieldout[shieldtype-1] = true; + if (shieldtype != KSHIELD_NONE && shieldtype == K_GetShieldFromItem(players[i].kartstuff[k_itemtype])) + { + // Don't allow more than one of each shield type at a time + return 0; + } if (players[i].mo && G_RaceGametype()) { @@ -882,11 +883,6 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp secondist = ((28 + (8-pingame)) * secondist) / 28; } - // Don't allow more than one of each shield type at a time - shieldtype = K_GetShieldFromItem(item); - if (shieldtype != KSHIELD_NONE && shieldout[shieldtype-1]) - return 0; - // POWERITEMODDS handles all of the "frantic item" related functionality, for all of our powerful items. // First, it multiplies it by 2 if franticitems is true; easy-peasy. // Next, it multiplies it again if it's in SPB mode and 2nd needs to apply pressure to 1st. From f164320c8817ae96c48ba149a2b01368c5cff49d Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 20 Feb 2020 21:46:55 -0800 Subject: [PATCH 027/117] Make the order of displayplayers irrelevant and split splitscreen into splitscreen and r_splitscreen --- src/d_clisrv.c | 8 ++- src/d_main.c | 7 +- src/d_netcmd.c | 140 +++++++++++++++++++-------------------- src/doomstat.h | 3 + src/g_game.c | 69 +++++++++---------- src/hu_stuff.c | 26 ++++---- src/k_kart.c | 154 +++++++++++++++++++++---------------------- src/lua_consolelib.c | 2 +- src/lua_hudlib.c | 16 ++--- src/m_menu.c | 32 ++++----- src/m_misc.c | 10 +-- src/p_enemy.c | 2 +- src/p_floor.c | 16 ++--- src/p_inter.c | 12 ++-- src/p_map.c | 4 +- src/p_mobj.c | 50 +++++++------- src/p_setup.c | 30 ++++----- src/p_spec.c | 2 +- src/p_telept.c | 12 ++-- src/p_tick.c | 6 +- src/p_user.c | 30 ++++----- src/r_bsp.c | 4 +- src/r_draw.c | 2 +- src/r_main.c | 38 ++++++----- src/r_plane.c | 8 +-- src/r_sky.c | 2 +- src/r_things.c | 12 ++-- src/s_sound.c | 50 +++++++------- src/st_stuff.c | 22 +++---- src/v_video.c | 6 +- src/y_inter.c | 16 ++--- 31 files changed, 404 insertions(+), 387 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 1dacabd9f..a53a61cf0 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2718,8 +2718,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason) RemoveAdminPlayer(playernum); // don't stay admin after you're gone } - if (playernum == displayplayers[0] && !demo.playback) - displayplayers[0] = consoleplayer; // don't look through someone's view who isn't there + if (playernum == displayplayers[localdisplayplayers[0]] && !demo.playback) + displayplayers[localdisplayplayers[0]] = consoleplayer; // don't look through someone's view who isn't there #ifdef HAVE_BLUA LUA_InvalidatePlayer(&players[playernum]); @@ -3503,7 +3503,10 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) { consoleplayer = newplayernum; for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) + { displayplayers[i] = newplayernum; + localdisplayplayers[i] = i; + } DEBFILE("spawning me\n"); } @@ -3705,6 +3708,7 @@ void SV_StopServer(void) D_Clearticcmd(i); consoleplayer = 0; + localdisplayplayers[0] = 0; cl_mode = CL_SEARCHING; maketic = gametic+1; neededtic = maketic; diff --git a/src/d_main.c b/src/d_main.c index dee752107..e0ba654ad 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -416,7 +416,7 @@ static void D_Display(void) // draw the view directly if (cv_renderview.value && !automapactive) { - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (players[displayplayers[i]].mo || players[displayplayers[i]].playerstate == PST_DEAD) { @@ -443,7 +443,7 @@ static void D_Display(void) switch (i) { case 1: - if (splitscreen > 1) + if (r_splitscreen > 1) { viewwindowx = viewwidth; viewwindowy = 0; @@ -482,7 +482,7 @@ static void D_Display(void) if (rendermode == render_soft) { - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (postimgtype[i]) V_DoPostProcessor(i, postimgtype[i], postimgparam[i]); @@ -780,6 +780,7 @@ void D_StartTitle(void) gameaction = ga_nothing; memset(displayplayers, 0, sizeof(displayplayers)); + memset(localdisplayplayers, 0, sizeof localdisplayplayers); consoleplayer = 0; //demosequence = -1; gametype = GT_RACE; // SRB2kart diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 70dff2fcf..334509389 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1180,11 +1180,11 @@ static void CleanupPlayerName(INT32 playernum, const char *newname) // spaces may have been removed if (playernum == consoleplayer) CV_StealthSet(&cv_playername, tmpname); - else if (playernum == displayplayers[1] || (!netgame && playernum == 1)) + else if (playernum == displayplayers[localdisplayplayers[1]] || (!netgame && playernum == 1)) CV_StealthSet(&cv_playername2, tmpname); - else if (playernum == displayplayers[2] || (!netgame && playernum == 2)) + else if (playernum == displayplayers[localdisplayplayers[2]] || (!netgame && playernum == 2)) CV_StealthSet(&cv_playername3, tmpname); - else if (playernum == displayplayers[3] || (!netgame && playernum == 3)) + else if (playernum == displayplayers[localdisplayplayers[3]] || (!netgame && playernum == 3)) CV_StealthSet(&cv_playername4, tmpname); else I_Assert(((void)"CleanupPlayerName used on non-local player", 0)); @@ -1292,11 +1292,11 @@ static void ForceAllSkins(INT32 forcedskin) { if (i == consoleplayer) CV_StealthSet(&cv_skin, skins[forcedskin].name); - else if (i == displayplayers[1]) + else if (i == displayplayers[localdisplayplayers[1]]) CV_StealthSet(&cv_skin2, skins[forcedskin].name); - else if (i == displayplayers[2]) + else if (i == displayplayers[localdisplayplayers[2]]) CV_StealthSet(&cv_skin3, skins[forcedskin].name); - else if (i == displayplayers[3]) + else if (i == displayplayers[localdisplayplayers[3]]) CV_StealthSet(&cv_skin4, skins[forcedskin].name); } } @@ -1431,8 +1431,8 @@ static void SendNameAndColor2(void) if (splitscreen < 1 && !botingame) return; // can happen if skin2/color2/name2 changed - if (displayplayers[1] != consoleplayer) - secondplaya = displayplayers[1]; + if (displayplayers[localdisplayplayers[1]] != consoleplayer) + secondplaya = displayplayers[localdisplayplayers[1]]; else if (!netgame) // HACK secondplaya = 1; @@ -1520,14 +1520,14 @@ static void SendNameAndColor2(void) snac2pending++; // Don't change name if muted - if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[1]))) - CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]); + if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[1]]))) + CV_StealthSet(&cv_playername2, player_names[displayplayers[localdisplayplayers[1]]]); else // Cleanup name if changing it - CleanupPlayerName(displayplayers[1], cv_playername2.zstring); + CleanupPlayerName(displayplayers[localdisplayplayers[1]], cv_playername2.zstring); // Don't change skin if the server doesn't want you to. - if (!CanChangeSkin(displayplayers[1])) - CV_StealthSet(&cv_skin2, skins[players[displayplayers[1]].skin].name); + if (!CanChangeSkin(displayplayers[localdisplayplayers[1]])) + CV_StealthSet(&cv_skin2, skins[players[displayplayers[localdisplayplayers[1]]].skin].name); // check if player has the skin loaded (cv_skin2 may have // the name of a skin that was available in the previous game) @@ -1554,8 +1554,8 @@ static void SendNameAndColor3(void) if (splitscreen < 2) return; // can happen if skin3/color3/name3 changed - if (displayplayers[2] != consoleplayer) - thirdplaya = displayplayers[2]; + if (displayplayers[localdisplayplayers[2]] != consoleplayer) + thirdplaya = displayplayers[localdisplayplayers[2]]; else if (!netgame) // HACK thirdplaya = 2; @@ -1635,14 +1635,14 @@ static void SendNameAndColor3(void) snac3pending++; // Don't change name if muted - if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[2]))) - CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]); + if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[2]]))) + CV_StealthSet(&cv_playername3, player_names[displayplayers[localdisplayplayers[2]]]); else // Cleanup name if changing it - CleanupPlayerName(displayplayers[2], cv_playername3.zstring); + CleanupPlayerName(displayplayers[localdisplayplayers[2]], cv_playername3.zstring); // Don't change skin if the server doesn't want you to. - if (!CanChangeSkin(displayplayers[2])) - CV_StealthSet(&cv_skin3, skins[players[displayplayers[2]].skin].name); + if (!CanChangeSkin(displayplayers[localdisplayplayers[2]])) + CV_StealthSet(&cv_skin3, skins[players[displayplayers[localdisplayplayers[2]]].skin].name); // check if player has the skin loaded (cv_skin3 may have // the name of a skin that was available in the previous game) @@ -1669,8 +1669,8 @@ static void SendNameAndColor4(void) if (splitscreen < 3) return; // can happen if skin4/color4/name4 changed - if (displayplayers[3] != consoleplayer) - fourthplaya = displayplayers[3]; + if (displayplayers[localdisplayplayers[3]] != consoleplayer) + fourthplaya = displayplayers[localdisplayplayers[3]]; else if (!netgame) // HACK fourthplaya = 3; @@ -1758,14 +1758,14 @@ static void SendNameAndColor4(void) snac4pending++; // Don't change name if muted - if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[3]))) - CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]); + if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[3]]))) + CV_StealthSet(&cv_playername4, player_names[displayplayers[localdisplayplayers[3]]]); else // Cleanup name if changing it - CleanupPlayerName(displayplayers[3], cv_playername4.zstring); + CleanupPlayerName(displayplayers[localdisplayplayers[3]], cv_playername4.zstring); // Don't change skin if the server doesn't want you to. - if (!CanChangeSkin(displayplayers[3])) - CV_StealthSet(&cv_skin4, skins[players[displayplayers[3]].skin].name); + if (!CanChangeSkin(displayplayers[localdisplayplayers[3]])) + CV_StealthSet(&cv_skin4, skins[players[displayplayers[localdisplayplayers[3]]].skin].name); // check if player has the skin loaded (cv_skin4 may have // the name of a skin that was available in the previous game) @@ -1796,11 +1796,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) if (playernum == consoleplayer) snacpending--; // TODO: make snacpending an array instead of 4 separate vars? - else if (playernum == displayplayers[1]) + else if (playernum == displayplayers[localdisplayplayers[1]]) snac2pending--; - else if (playernum == displayplayers[2]) + else if (playernum == displayplayers[localdisplayplayers[2]]) snac3pending--; - else if (playernum == displayplayers[3]) + else if (playernum == displayplayers[localdisplayplayers[3]]) snac4pending--; #ifdef PARANOIA @@ -1823,8 +1823,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) demo_extradata[playernum] |= DXD_COLOR; // normal player colors - if (server && (p != &players[consoleplayer] && p != &players[displayplayers[1]] - && p != &players[displayplayers[2]] && p != &players[displayplayers[3]])) + if (server && (p != &players[consoleplayer] && p != &players[displayplayers[localdisplayplayers[1]]] + && p != &players[displayplayers[localdisplayplayers[2]]] && p != &players[displayplayers[localdisplayplayers[3]]])) { boolean kick = false; @@ -1861,11 +1861,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) if (playernum == consoleplayer) CV_StealthSet(&cv_skin, skins[forcedskin].name); - else if (playernum == displayplayers[1]) + else if (playernum == displayplayers[localdisplayplayers[1]]) CV_StealthSet(&cv_skin2, skins[forcedskin].name); - else if (playernum == displayplayers[2]) + else if (playernum == displayplayers[localdisplayplayers[2]]) CV_StealthSet(&cv_skin3, skins[forcedskin].name); - else if (playernum == displayplayers[3]) + else if (playernum == displayplayers[localdisplayplayers[3]]) CV_StealthSet(&cv_skin4, skins[forcedskin].name); } else @@ -1988,7 +1988,7 @@ void D_SendPlayerConfig(void) // Only works for displayplayer, sorry! static void Command_ResetCamera_f(void) { - P_ResetCamera(&players[displayplayers[0]], &camera[0]); + P_ResetCamera(&players[displayplayers[localdisplayplayers[0]]], &camera[0]); } /* Consider replacing nametonum with this */ @@ -2144,7 +2144,7 @@ static void Command_View_f(void) } else/* print current view */ { - if (splitscreen < viewnum-1)/* We can't see those guys! */ + if (r_splitscreen < viewnum-1)/* We can't see those guys! */ return; PRINTVIEWPOINT ("Currently ",) } @@ -2169,7 +2169,7 @@ static void Command_SetViews_f(void) return; } - splits = splitscreen+1; + splits = r_splitscreen+1; newsplits = atoi(COM_Argv(1)); newsplits = min(max(newsplits, 1), 4); @@ -2177,7 +2177,7 @@ static void Command_SetViews_f(void) G_AdjustView(newsplits, 0, true); else { - splitscreen = newsplits-1; + r_splitscreen = newsplits-1; R_ExecuteSetViewSize(); } } @@ -2426,7 +2426,7 @@ void D_ModifyClientVote(SINT8 voted, UINT8 splitplayer) UINT8 player = consoleplayer; if (splitplayer > 0) - player = displayplayers[splitplayer]; + player = displayplayers[localdisplayplayers[splitplayer]]; WRITESINT8(p, voted); WRITEUINT8(p, player); @@ -3078,11 +3078,11 @@ static void Command_Teamchange2_f(void) return; } - if (players[displayplayers[1]].spectator) - error = !(NetPacket.packet.newteam || (players[displayplayers[1]].pflags & PF_WANTSTOJOIN)); + if (players[displayplayers[localdisplayplayers[1]]].spectator) + error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[1]]].pflags & PF_WANTSTOJOIN)); else if (G_GametypeHasTeams()) - error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[1]].ctfteam); - else if (G_GametypeHasSpectators() && !players[displayplayers[1]].spectator) + error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[1]]].ctfteam); + else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[1]]].spectator) error = (NetPacket.packet.newteam == 3); #ifdef PARANOIA else @@ -3169,11 +3169,11 @@ static void Command_Teamchange3_f(void) return; } - if (players[displayplayers[2]].spectator) - error = !(NetPacket.packet.newteam || (players[displayplayers[2]].pflags & PF_WANTSTOJOIN)); + if (players[displayplayers[localdisplayplayers[2]]].spectator) + error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[2]]].pflags & PF_WANTSTOJOIN)); else if (G_GametypeHasTeams()) - error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[2]].ctfteam); - else if (G_GametypeHasSpectators() && !players[displayplayers[2]].spectator) + error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[2]]].ctfteam); + else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[2]]].spectator) error = (NetPacket.packet.newteam == 3); #ifdef PARANOIA else @@ -3260,11 +3260,11 @@ static void Command_Teamchange4_f(void) return; } - if (players[displayplayers[3]].spectator) - error = !(NetPacket.packet.newteam || (players[displayplayers[3]].pflags & PF_WANTSTOJOIN)); + if (players[displayplayers[localdisplayplayers[3]]].spectator) + error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[3]]].pflags & PF_WANTSTOJOIN)); else if (G_GametypeHasTeams()) - error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[3]].ctfteam); - else if (G_GametypeHasSpectators() && !players[displayplayers[3]].spectator) + error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[3]]].ctfteam); + else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[3]]].spectator) error = (NetPacket.packet.newteam == 3); #ifdef PARANOIA else @@ -3661,8 +3661,8 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame //reset view if you are changed, or viewing someone who was changed. - if (playernum == consoleplayer || displayplayers[0] == playernum) - displayplayers[0] = consoleplayer; + if (playernum == consoleplayer || displayplayers[localdisplayplayers[0]] == playernum) + displayplayers[localdisplayplayers[0]] = consoleplayer; if (G_GametypeHasTeams()) { @@ -5299,7 +5299,7 @@ static void Got_PickVotecmd(UINT8 **cp, INT32 playernum) */ static void Command_Displayplayer_f(void) { - CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayers[0]); + CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayers[localdisplayplayers[0]]); } /** Quits a game and returns to the title screen. @@ -5494,7 +5494,7 @@ static void Name2_OnChange(void) if (cv_mute.value) //Secondary player can't be admin. { CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n")); - CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]); + CV_StealthSet(&cv_playername2, player_names[displayplayers[localdisplayplayers[1]]]); } else SendNameAndColor2(); @@ -5505,7 +5505,7 @@ static void Name3_OnChange(void) if (cv_mute.value) //Third player can't be admin. { CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n")); - CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]); + CV_StealthSet(&cv_playername3, player_names[displayplayers[localdisplayplayers[2]]]); } else SendNameAndColor3(); @@ -5516,7 +5516,7 @@ static void Name4_OnChange(void) if (cv_mute.value) //Secondary player can't be admin. { CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n")); - CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]); + CV_StealthSet(&cv_playername4, player_names[displayplayers[localdisplayplayers[3]]]); } else SendNameAndColor4(); @@ -5557,12 +5557,12 @@ static void Skin2_OnChange(void) if (!Playing() || !splitscreen) return; // do whatever you want - if (CanChangeSkin(displayplayers[1]) && !P_PlayerMoving(displayplayers[1])) + if (CanChangeSkin(displayplayers[localdisplayplayers[1]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[1]])) SendNameAndColor2(); else { CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n")); - CV_StealthSet(&cv_skin2, skins[players[displayplayers[1]].skin].name); + CV_StealthSet(&cv_skin2, skins[players[displayplayers[localdisplayplayers[1]]].skin].name); } } @@ -5571,12 +5571,12 @@ static void Skin3_OnChange(void) if (!Playing() || splitscreen < 2) return; // do whatever you want - if (CanChangeSkin(displayplayers[2]) && !P_PlayerMoving(displayplayers[2])) + if (CanChangeSkin(displayplayers[localdisplayplayers[2]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[2]])) SendNameAndColor3(); else { CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n")); - CV_StealthSet(&cv_skin3, skins[players[displayplayers[2]].skin].name); + CV_StealthSet(&cv_skin3, skins[players[displayplayers[localdisplayplayers[2]]].skin].name); } } @@ -5585,12 +5585,12 @@ static void Skin4_OnChange(void) if (!Playing() || splitscreen < 3) return; // do whatever you want - if (CanChangeSkin(displayplayers[3]) && !P_PlayerMoving(displayplayers[3])) + if (CanChangeSkin(displayplayers[localdisplayplayers[3]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[3]])) SendNameAndColor4(); else { CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n")); - CV_StealthSet(&cv_skin4, skins[players[displayplayers[3]].skin].name); + CV_StealthSet(&cv_skin4, skins[players[displayplayers[localdisplayplayers[3]]].skin].name); } } @@ -5631,7 +5631,7 @@ static void Color2_OnChange(void) if (!Playing() || !splitscreen) return; // do whatever you want - if (!P_PlayerMoving(displayplayers[1])) + if (!P_PlayerMoving(displayplayers[localdisplayplayers[1]])) { // Color change menu scrolling fix is no longer necessary SendNameAndColor2(); @@ -5639,7 +5639,7 @@ static void Color2_OnChange(void) else { CV_StealthSetValue(&cv_playercolor2, - players[displayplayers[1]].skincolor); + players[displayplayers[localdisplayplayers[1]]].skincolor); } } @@ -5648,7 +5648,7 @@ static void Color3_OnChange(void) if (!Playing() || splitscreen < 2) return; // do whatever you want - if (!P_PlayerMoving(displayplayers[2])) + if (!P_PlayerMoving(displayplayers[localdisplayplayers[2]])) { // Color change menu scrolling fix is no longer necessary SendNameAndColor3(); @@ -5656,7 +5656,7 @@ static void Color3_OnChange(void) else { CV_StealthSetValue(&cv_playercolor3, - players[displayplayers[2]].skincolor); + players[displayplayers[localdisplayplayers[2]]].skincolor); } } @@ -5665,7 +5665,7 @@ static void Color4_OnChange(void) if (!Playing() || splitscreen < 3) return; // do whatever you want - if (!P_PlayerMoving(displayplayers[3])) + if (!P_PlayerMoving(displayplayers[localdisplayplayers[3]])) { // Color change menu scrolling fix is no longer necessary SendNameAndColor4(); @@ -5673,7 +5673,7 @@ static void Color4_OnChange(void) else { CV_StealthSetValue(&cv_playercolor4, - players[displayplayers[3]].skincolor); + players[displayplayers[localdisplayplayers[3]]].skincolor); } } diff --git a/src/doomstat.h b/src/doomstat.h index 59e2bd5c4..1d43b4986 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -82,6 +82,7 @@ extern INT16 gametype; #define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer extern UINT8 splitscreen; +extern int r_splitscreen; extern boolean circuitmap; // Does this level have 'circuit mode'? extern boolean fromlevelselect; @@ -122,6 +123,8 @@ extern boolean gamedataloaded; // Player taking events, and displaying. extern INT32 consoleplayer; extern INT32 displayplayers[MAXSPLITSCREENPLAYERS]; +/* displayplayers[localdisplayplayers[0]] = consoleplayer */ +extern INT32 localdisplayplayers[MAXSPLITSCREENPLAYERS]; // Maps of special importance extern INT16 spstage_start; diff --git a/src/g_game.c b/src/g_game.c index d4d48f7c2..871eafaab 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -115,6 +115,7 @@ player_t players[MAXPLAYERS]; INT32 consoleplayer; // player taking events and displaying INT32 displayplayers[MAXSPLITSCREENPLAYERS]; // view being displayed +INT32 localdisplayplayers[MAXSPLITSCREENPLAYERS]; tic_t gametic; tic_t levelstarttic; // gametic at level start @@ -1256,7 +1257,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (ssplayer == 1) player = &players[consoleplayer]; else - player = &players[displayplayers[ssplayer-1]]; + player = &players[displayplayers[localdisplayplayers[ssplayer-1]]]; if (ssplayer == 2) thiscam = (player->bot == 2 ? &camera[0] : &camera[ssplayer-1]); @@ -1595,8 +1596,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) //Reset away view if a command is given. if ((cmd->forwardmove || cmd->sidemove || cmd->buttons) - && displayplayers[0] != consoleplayer && ssplayer == 1) - displayplayers[0] = consoleplayer; + && displayplayers[localdisplayplayers[0]] != consoleplayer && ssplayer == 1) + displayplayers[localdisplayplayers[0]] = consoleplayer; } @@ -1748,12 +1749,12 @@ void G_DoLoadLevel(boolean resetplayer) if (!resetplayer) P_FindEmerald(); - displayplayers[0] = consoleplayer; // view the guy you are playing + displayplayers[localdisplayplayers[0]] = consoleplayer; // view the guy you are playing for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { - if (i > 0 && !(i == 1 && botingame) && splitscreen < i) - displayplayers[i] = consoleplayer; + if (i > 0 && !(i == 1 && botingame) && r_splitscreen < i) + displayplayers[localdisplayplayers[i]] = consoleplayer; } gameaction = ga_nothing; @@ -1761,10 +1762,10 @@ void G_DoLoadLevel(boolean resetplayer) Z_CheckHeap(-2); #endif - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (camera[i].chase) - P_ResetCamera(&players[displayplayers[i]], &camera[i]); + P_ResetCamera(&players[displayplayers[localdisplayplayers[i]]], &camera[i]); } // clear cmd building stuff @@ -1874,8 +1875,8 @@ boolean G_Responder(event_t *ev) if (gamestate == GS_LEVEL && ev->type == ev_keydown && (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1])) { - if (!demo.playback && (splitscreen || !netgame)) - displayplayers[0] = consoleplayer; + if (!demo.playback && (r_splitscreen || !netgame)) + displayplayers[localdisplayplayers[0]] = consoleplayer; else { G_AdjustView(1, 1, true); @@ -2139,7 +2140,7 @@ boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive) if (!(onlyactive ? G_CouldView(playernum) : (playeringame[playernum] && !players[playernum].spectator))) return false; - splits = splitscreen+1; + splits = r_splitscreen+1; if (viewnum > splits) viewnum = splits; @@ -2210,7 +2211,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive) INT32 olddisplayplayer; INT32 playersviewable; - splits = splitscreen+1; + splits = r_splitscreen+1; /* Promote splits */ if (viewnum > splits) @@ -2221,7 +2222,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive) if (viewnum > playersviewable) viewnum = playersviewable; - splitscreen = viewnum-1; + r_splitscreen = viewnum-1; /* Prepare extra views for G_FindView to pass. */ for (viewd = splits+1; viewd < viewnum; ++viewd) @@ -2294,14 +2295,14 @@ void G_ResetViews(void) INT32 playersviewable; - splits = splitscreen+1; + splits = r_splitscreen+1; playersviewable = G_CountPlayersPotentiallyViewable(false); /* Demote splits */ if (playersviewable < splits) { splits = playersviewable; - splitscreen = max(splits-1, 0); + r_splitscreen = max(splits-1, 0); R_ExecuteSetViewSize(); } @@ -2884,18 +2885,18 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) if (nummapthings) { if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[1]) - || (splitscreen > 1 && playernum == displayplayers[2]) - || (splitscreen > 2 && playernum == displayplayers[3])) + || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) + || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) + || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the first mapthing!\n")); spawnpoint = &mapthings[0]; } else { if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[1]) - || (splitscreen > 1 && playernum == displayplayers[2]) - || (splitscreen > 2 && playernum == displayplayers[3])) + || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) + || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) + || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the origin!\n")); //P_MovePlayerToSpawn handles this fine if the spawnpoint is NULL. } @@ -2990,17 +2991,17 @@ mapthing_t *G_FindMatchStart(INT32 playernum) return deathmatchstarts[i]; } if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[1]) - || (splitscreen > 1 && playernum == displayplayers[2]) - || (splitscreen > 2 && playernum == displayplayers[3])) + || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) + || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) + || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Deathmatch starts!\n")); return NULL; } if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[1]) - || (splitscreen > 1 && playernum == displayplayers[2]) - || (splitscreen > 2 && playernum == displayplayers[3])) + || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) + || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) + || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) CONS_Alert(CONS_WARNING, M_GetText("No Deathmatch starts in this map!\n")); return NULL; } @@ -3088,17 +3089,17 @@ mapthing_t *G_FindRaceStart(INT32 playernum) //return playerstarts[0]; if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[1]) - || (splitscreen > 1 && playernum == displayplayers[2]) - || (splitscreen > 2 && playernum == displayplayers[3])) + || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) + || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) + || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Race starts!\n")); return NULL; } if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[1]) - || (splitscreen > 1 && playernum == displayplayers[2]) - || (splitscreen > 2 && playernum == displayplayers[3])) + || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) + || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) + || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) CONS_Alert(CONS_WARNING, M_GetText("No Race starts in this map!\n")); return NULL; } @@ -3712,7 +3713,7 @@ static void G_DoCompleted(void) } // play some generic music if there's no win/cool/lose music going on (for exitlevel commands) - if (G_RaceGametype() && ((multiplayer && demo.playback) || j == splitscreen+1) && (cv_inttime.value > 0)) + if (G_RaceGametype() && ((multiplayer && demo.playback) || j == r_splitscreen+1) && (cv_inttime.value > 0)) S_ChangeMusicInternal("racent", true); if (automapactive) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 1afa133b3..ad64552d8 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1477,7 +1477,7 @@ static void HU_drawMiniChat(void) if (!chat_nummsg_min) return; // needless to say it's useless to do anything if we don't have anything to draw. - if (splitscreen > 1) + if (r_splitscreen > 1) boxw = max(64, boxw/2); for (; i>0; i--) @@ -1529,10 +1529,10 @@ static void HU_drawMiniChat(void) y = chaty - charheight*(msglines+1); #ifdef NETSPLITSCREEN - if (splitscreen) + if (r_splitscreen) { y -= BASEVIDHEIGHT/2; - if (splitscreen > 1) + if (r_splitscreen > 1) y += 16; } else @@ -1620,10 +1620,10 @@ static void HU_drawChatLog(INT32 offset) chat_scroll = chat_maxscroll; #ifdef NETSPLITSCREEN - if (splitscreen) + if (r_splitscreen) { boxh = max(6, boxh/2); - if (splitscreen > 1) + if (r_splitscreen > 1) boxw = max(64, boxw/2); } #endif @@ -1631,10 +1631,10 @@ static void HU_drawChatLog(INT32 offset) y = chaty - offset*charheight - (chat_scroll*charheight) - boxh*charheight - 12; #ifdef NETSPLITSCREEN - if (splitscreen) + if (r_splitscreen) { y -= BASEVIDHEIGHT/2; - if (splitscreen > 1) + if (r_splitscreen > 1) y += 16; } else @@ -1739,10 +1739,10 @@ static void HU_DrawChat(void) const char *mute = "Chat has been muted."; #ifdef NETSPLITSCREEN - if (splitscreen) + if (r_splitscreen) { y -= BASEVIDHEIGHT/2; - if (splitscreen > 1) + if (r_splitscreen > 1) { y += 16; boxw = max(64, boxw/2); @@ -1836,10 +1836,10 @@ static void HU_DrawChat(void) INT32 count = 0; INT32 p_dispy = chaty - charheight -1; #ifdef NETSPLITSCREEN - if (splitscreen) + if (r_splitscreen) { p_dispy -= BASEVIDHEIGHT/2; - if (splitscreen > 1) + if (r_splitscreen > 1) p_dispy += 16; } else @@ -2250,7 +2250,7 @@ void HU_DrawSongCredits(void) { char *str; INT32 len, destx; - INT32 y = (splitscreen ? (BASEVIDHEIGHT/2)-4 : 32); + INT32 y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32); INT32 bgt; if (!cursongcredit.def) // No def @@ -3022,7 +3022,7 @@ static void HU_DrawRankings(void) // When you play, you quickly see your score because your name is displayed in white. // When playing back a demo, you quickly see who's the view. - if (!splitscreen) + if (!r_splitscreen) whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; scorelines = 0; diff --git a/src/k_kart.c b/src/k_kart.c index 230662d2a..ebce1458e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1058,7 +1058,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsDisplayPlayer(player)) { #define PLAYROULETTESND S_StartSound(NULL, sfx_itrol1 + ((player->kartstuff[k_itemroulette] / 3) % 8)) - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]] && players[displayplayers[i]].kartstuff[k_itemroulette]) PLAYROULETTESND; @@ -3925,7 +3925,7 @@ static void K_DoHyudoroSteal(player_t *player) players[stealplayer].kartstuff[k_itemamount] = 0; players[stealplayer].kartstuff[k_itemheld] = 0; - if (P_IsDisplayPlayer(&players[stealplayer]) && !splitscreen) + if (P_IsDisplayPlayer(&players[stealplayer]) && !r_splitscreen) S_StartSound(NULL, sfx_s3k92); } } @@ -6500,7 +6500,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_hyudorotimer] > 0) { - if (splitscreen) + if (r_splitscreen) { if (leveltime & 1) player->mo->flags2 |= MF2_DONTDRAW; @@ -6511,9 +6511,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { if (player == &players[displayplayers[1]]) player->mo->eflags |= MFE_DRAWONLYFORP2; - else if (player == &players[displayplayers[2]] && splitscreen > 1) + else if (player == &players[displayplayers[2]] && r_splitscreen > 1) player->mo->eflags |= MFE_DRAWONLYFORP3; - else if (player == &players[displayplayers[3]] && splitscreen > 2) + else if (player == &players[displayplayers[3]] && r_splitscreen > 2) player->mo->eflags |= MFE_DRAWONLYFORP4; else if (player == &players[displayplayers[0]]) player->mo->eflags |= MFE_DRAWONLYFORP1; @@ -6635,7 +6635,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } // Play the starting countdown sounds - if (player == &players[displayplayers[0]]) // Don't play louder in splitscreen + if (player == &players[displayplayers[localdisplayplayers[0]]]) // Don't play louder in splitscreen { if ((leveltime == starttime-(3*TICRATE)) || (leveltime == starttime-(2*TICRATE)) || (leveltime == starttime-TICRATE)) S_StartSound(NULL, sfx_s3ka7); @@ -7521,7 +7521,7 @@ static void K_initKartHUD(void) WANT_X = BASEVIDWIDTH - 55; // 270 WANT_Y = BASEVIDHEIGHT- 71; // 176 - if (splitscreen) // Splitscreen + if (r_splitscreen) // Splitscreen { ITEM_X = 5; ITEM_Y = 3; @@ -7534,7 +7534,7 @@ static void K_initKartHUD(void) MINI_Y = (BASEVIDHEIGHT/2); - if (splitscreen > 1) // 3P/4P Small Splitscreen + if (r_splitscreen > 1) // 3P/4P Small Splitscreen { // 1P (top left) ITEM_X = -9; @@ -7563,7 +7563,7 @@ static void K_initKartHUD(void) MINI_X = (3*BASEVIDWIDTH/4); MINI_Y = (3*BASEVIDHEIGHT/4); - if (splitscreen > 2) // 4P-only + if (r_splitscreen > 2) // 4P-only { MINI_X = (BASEVIDWIDTH/2); MINI_Y = (BASEVIDHEIGHT/2); @@ -7583,20 +7583,20 @@ INT32 K_calcSplitFlags(INT32 snapflags) { INT32 splitflags = 0; - if (splitscreen == 0) + if (r_splitscreen == 0) return snapflags; if (stplyr != &players[displayplayers[0]]) { - if (splitscreen == 1 && stplyr == &players[displayplayers[1]]) + if (r_splitscreen == 1 && stplyr == &players[displayplayers[1]]) { splitflags |= V_SPLITSCREEN; } - else if (splitscreen > 1) + else if (r_splitscreen > 1) { - if (stplyr == &players[displayplayers[2]] || (splitscreen == 3 && stplyr == &players[displayplayers[3]])) + if (stplyr == &players[displayplayers[2]] || (r_splitscreen == 3 && stplyr == &players[displayplayers[3]])) splitflags |= V_SPLITSCREEN; - if (stplyr == &players[displayplayers[1]] || (splitscreen == 3 && stplyr == &players[displayplayers[3]])) + if (stplyr == &players[displayplayers[1]] || (r_splitscreen == 3 && stplyr == &players[displayplayers[3]])) splitflags |= V_HORZSCREEN; } } @@ -7606,7 +7606,7 @@ INT32 K_calcSplitFlags(INT32 snapflags) else snapflags &= ~V_SNAPTOBOTTOM; - if (splitscreen > 1) + if (r_splitscreen > 1) { if (splitflags & V_HORZSCREEN) snapflags &= ~V_SNAPTOLEFT; @@ -7624,7 +7624,7 @@ static void K_drawKartItem(void) // Why write V_DrawScaledPatch calls over and over when they're all the same? // Set to 'no item' just in case. - const UINT8 offset = ((splitscreen > 1) ? 1 : 0); + const UINT8 offset = ((r_splitscreen > 1) ? 1 : 0); patch_t *localpatch = kp_nodraw; patch_t *localbg = ((offset) ? kp_itembg[2] : kp_itembg[0]); patch_t *localinv = ((offset) ? kp_invincibility[((leveltime % (6*3)) / 3) + 7] : kp_invincibility[(leveltime % (7*3)) / 3]); @@ -7633,7 +7633,7 @@ static void K_drawKartItem(void) const INT32 numberdisplaymin = ((!offset && stplyr->kartstuff[k_itemtype] == KITEM_ORBINAUT) ? 5 : 2); INT32 itembar = 0; INT32 maxl = 0; // itembar's normal highest value - const INT32 barlength = (splitscreen > 1 ? 12 : 26); + const INT32 barlength = (r_splitscreen > 1 ? 12 : 26); UINT8 localcolor = SKINCOLOR_NONE; SINT8 colormode = TC_RAINBOW; UINT8 *colmap = NULL; @@ -7865,7 +7865,7 @@ static void K_drawKartItem(void) } // pain and suffering defined below - if (splitscreen < 2) // don't change shit for THIS splitscreen. + if (r_splitscreen < 2) // don't change shit for THIS splitscreen. { fx = ITEM_X; fy = ITEM_Y; @@ -8110,19 +8110,19 @@ static void K_DrawKartPositionNum(INT32 num) scale *= 2; overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw. } - if (splitscreen) + if (r_splitscreen) scale /= 2; W = FixedMul(W<>FRACBITS; // pain and suffering defined below - if (!splitscreen) + if (!r_splitscreen) { fx = POSI_X; fy = BASEVIDHEIGHT - 8; fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT; } - else if (splitscreen == 1) // for this splitscreen, we'll use case by case because it's a bit different. + else if (r_splitscreen == 1) // for this splitscreen, we'll use case by case because it's a bit different. { fx = POSI_X; if (stplyr == &players[displayplayers[0]]) // for player 1: display this at the top right, above the minimap. @@ -8487,16 +8487,16 @@ static void K_drawKartLapsAndRings(void) { ringflip = V_FLIP; ringanim_realframe = RINGANIM_NUMFRAMES-stplyr->karthud[khud_ringframe]; - ringx += SHORT((splitscreen > 1) ? kp_smallring[ringanim_realframe]->width : kp_ring[ringanim_realframe]->width); + ringx += SHORT((r_splitscreen > 1) ? kp_smallring[ringanim_realframe]->width : kp_ring[ringanim_realframe]->width); } - if (splitscreen > 1) + if (r_splitscreen > 1) { INT32 fx = 0, fy = 0, fr = 0; INT32 flipflag = 0; // pain and suffering defined below - if (splitscreen < 2) // don't change shit for THIS splitscreen. + if (r_splitscreen < 2) // don't change shit for THIS splitscreen. { fx = LAPS_X; fy = LAPS_Y; @@ -8679,13 +8679,13 @@ static void K_drawKartBumpersOrKarma(void) UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, GTC_CACHE); INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); - if (splitscreen > 1) + if (r_splitscreen > 1) { INT32 fx = 0, fy = 0; INT32 flipflag = 0; // pain and suffering defined below - if (splitscreen < 2) // don't change shit for THIS splitscreen. + if (r_splitscreen < 2) // don't change shit for THIS splitscreen. { fx = LAPS_X; fy = LAPS_Y; @@ -8782,7 +8782,7 @@ static fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fix if (encoremode) x = 320-x; - if (splitscreen > 1) + if (r_splitscreen > 1) x /= 2; return x; @@ -8808,17 +8808,17 @@ static void K_drawKartWanted(void) return; // set X/Y coords depending on splitscreen. - if (splitscreen < 3) // 1P and 2P use the same code. + if (r_splitscreen < 3) // 1P and 2P use the same code. { basex = WANT_X; basey = WANT_Y; - if (splitscreen == 2) + if (r_splitscreen == 2) { basey += 16; // slight adjust for 3P basex -= 6; } } - else if (splitscreen == 3) // 4P splitscreen... + else if (r_splitscreen == 3) // 4P splitscreen... { basex = BASEVIDWIDTH/2 - (SHORT(kp_wantedsplit->width)/2); // center on screen basey = BASEVIDHEIGHT - 55; @@ -8827,13 +8827,13 @@ static void K_drawKartWanted(void) if (battlewanted[0] != -1) colormap = R_GetTranslationColormap(0, players[battlewanted[0]].skincolor, GTC_CACHE); - V_DrawFixedPatch(basex< 1 ? kp_wantedsplit : kp_wanted), colormap); + V_DrawFixedPatch(basex< 1 ? kp_wantedsplit : kp_wanted), colormap); /*if (basey2) V_DrawFixedPatch(basex< 1 ? 13 : 8), y = basey+(splitscreen > 1 ? 16 : 21); + INT32 x = basex+(r_splitscreen > 1 ? 13 : 8), y = basey+(r_splitscreen > 1 ? 16 : 21); fixed_t scale = FRACUNIT/2; player_t *p = &players[battlewanted[i]]; @@ -8853,7 +8853,7 @@ static void K_drawKartWanted(void) if (players[battlewanted[i]].skincolor) { colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE); - V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap); + V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap); /*if (basey2) // again with 4p stuff V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap);*/ } @@ -8990,7 +8990,7 @@ static void K_drawKartMinimap(void) patch_t *AutomapPic; INT32 i = 0; INT32 x, y; - INT32 minimaptrans, splitflags = (splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) + INT32 minimaptrans, splitflags = (r_splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) UINT8 skin = 0; UINT8 *colormap = NULL; SINT8 localplayers[4]; @@ -9035,7 +9035,7 @@ static void K_drawKartMinimap(void) else V_DrawScaledPatch(x, y, splitflags, AutomapPic); - if (!(splitscreen == 2)) + if (!(r_splitscreen == 2)) { splitflags &= ~minimaptrans; splitflags |= V_HUDTRANSHALF; @@ -9104,7 +9104,7 @@ static void K_drawKartMinimap(void) if (!players[i].mo || players[i].spectator) continue; - if (i != displayplayers[0] || splitscreen) + if (i != displayplayers[0] || r_splitscreen) { if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0) continue; @@ -9194,7 +9194,7 @@ static void K_drawKartStartCountdown(void) pnum++; if ((leveltime % (2*5)) / 5) // blink pnum += 4; - if (splitscreen) // splitscreen + if (r_splitscreen) // splitscreen pnum += 8; V_DrawScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/2), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/2), splitflags, kp_startcountdown[pnum]); @@ -9210,7 +9210,7 @@ static void K_drawKartFinish(void) if ((stplyr->karthud[khud_cardanimation] % (2*5)) / 5) // blink pnum = 1; - if (splitscreen > 1) // 3/4p, stationary FIN + if (r_splitscreen > 1) // 3/4p, stationary FIN { pnum += 2; V_DrawScaledPatch(STCD_X - (SHORT(kp_racefinish[pnum]->width)/2), STCD_Y - (SHORT(kp_racefinish[pnum]->height)/2), splitflags, kp_racefinish[pnum]); @@ -9221,14 +9221,14 @@ static void K_drawKartFinish(void) { INT32 x, xval; - if (splitscreen) // wide splitscreen + if (r_splitscreen) // wide splitscreen pnum += 4; x = ((vid.width<width)<karthud[khud_cardanimation])*(xval > x ? xval : x))/TICRATE; - if (splitscreen && stplyr == &players[displayplayers[1]]) + if (r_splitscreen && stplyr == &players[displayplayers[1]]) x = -x; V_DrawFixedPatch(x + (STCD_X<>1), @@ -9250,11 +9250,11 @@ static void K_drawBattleFullscreen(void) drawcomebacktimer = false; #endif - if (splitscreen) + if (r_splitscreen) { - if ((splitscreen == 1 && stplyr == &players[displayplayers[1]]) - || (splitscreen > 1 && (stplyr == &players[displayplayers[2]] - || (stplyr == &players[displayplayers[3]] && splitscreen > 2)))) + if ((r_splitscreen == 1 && stplyr == &players[displayplayers[1]]) + || (r_splitscreen > 1 && (stplyr == &players[displayplayers[2]] + || (stplyr == &players[displayplayers[3]] && r_splitscreen > 2)))) { y = 232-(stplyr->karthud[khud_cardanimation]/2); splitflags = V_SNAPTOBOTTOM; @@ -9262,12 +9262,12 @@ static void K_drawBattleFullscreen(void) else y = -32+(stplyr->karthud[khud_cardanimation]/2); - if (splitscreen > 1) + if (r_splitscreen > 1) { scale /= 2; if (stplyr == &players[displayplayers[1]] - || (stplyr == &players[displayplayers[3]] && splitscreen > 2)) + || (stplyr == &players[displayplayers[3]] && r_splitscreen > 2)) x = 3*BASEVIDWIDTH/4; else x = BASEVIDWIDTH/4; @@ -9303,7 +9303,7 @@ static void K_drawBattleFullscreen(void) else if (stplyr->kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback && !stplyr->spectator && drawcomebacktimer) { UINT16 t = stplyr->kartstuff[k_comebacktimer]/(10*TICRATE); - INT32 txoff, adjust = (splitscreen > 1) ? 4 : 6; // normal string is 8, kart string is 12, half of that for ease + INT32 txoff, adjust = (r_splitscreen > 1) ? 4 : 6; // normal string is 8, kart string is 12, half of that for ease INT32 ty = (BASEVIDHEIGHT/2)+66; txoff = adjust; @@ -9314,13 +9314,13 @@ static void K_drawBattleFullscreen(void) t /= 10; } - if (splitscreen) + if (r_splitscreen) { - if (splitscreen > 1) + if (r_splitscreen > 1) ty = (BASEVIDHEIGHT/4)+33; - if ((splitscreen == 1 && stplyr == &players[displayplayers[1]]) - || (stplyr == &players[displayplayers[2]] && splitscreen > 1) - || (stplyr == &players[displayplayers[3]] && splitscreen > 2)) + if ((r_splitscreen == 1 && stplyr == &players[displayplayers[1]]) + || (stplyr == &players[displayplayers[2]] && r_splitscreen > 1) + || (stplyr == &players[displayplayers[3]] && r_splitscreen > 2)) ty += (BASEVIDHEIGHT/2); } else @@ -9331,7 +9331,7 @@ static void K_drawBattleFullscreen(void) else V_DrawFixedPatch(x< 1) + if (r_splitscreen > 1) V_DrawString(x-txoff, ty, 0, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE)); else { @@ -9373,24 +9373,24 @@ static void K_drawKartFirstPerson(void) if (stplyr->spectator || !stplyr->mo || (stplyr->mo->flags2 & MF2_DONTDRAW)) return; - if (stplyr == &players[displayplayers[1]] && splitscreen) + if (stplyr == &players[displayplayers[1]] && r_splitscreen) { pn = pnum[1]; tn = turn[1]; dr = drift[1]; } - else if (stplyr == &players[displayplayers[2]] && splitscreen > 1) + else if (stplyr == &players[displayplayers[2]] && r_splitscreen > 1) { pn = pnum[2]; tn = turn[2]; dr = drift[2]; } - else if (stplyr == &players[displayplayers[3]] && splitscreen > 2) + else if (stplyr == &players[displayplayers[3]] && r_splitscreen > 2) { pn = pnum[3]; tn = turn[3]; dr = drift[3]; } else { pn = pnum[0]; tn = turn[0]; dr = drift[0]; } - if (splitscreen) + if (r_splitscreen) { y >>= 1; - if (splitscreen > 1) + if (r_splitscreen > 1) x >>= 1; } { - if (stplyr->speed < (20*stplyr->mo->scale) && (leveltime & 1) && !splitscreen) + if (stplyr->speed < (20*stplyr->mo->scale) && (leveltime & 1) && !r_splitscreen) y++; // the following isn't EXPLICITLY right, it just gets the result we want, but i'm too lazy to look up the right way to do it if (stplyr->mo->flags2 & MF2_SHADOW) @@ -9434,12 +9434,12 @@ static void K_drawKartFirstPerson(void) if (dr != stplyr->kartstuff[k_drift]*16) dr -= (dr - (stplyr->kartstuff[k_drift]*16))/8; - if (splitscreen == 1) + if (r_splitscreen == 1) { scale = (2*FRACUNIT)/3; y += FRACUNIT/(vid.dupx < vid.dupy ? vid.dupx : vid.dupy); // correct a one-pixel gap on the screen view (not the basevid view) } - else if (splitscreen) + else if (r_splitscreen) scale = FRACUNIT/2; else scale = FRACUNIT; @@ -9457,7 +9457,7 @@ static void K_drawKartFirstPerson(void) fixed_t xoffs = -P_ReturnThrustY(stplyr->mo, ang, (BASEVIDWIDTH<<(FRACBITS-2))/2); fixed_t yoffs = -(P_ReturnThrustX(stplyr->mo, ang, 4*FRACUNIT) - 4*FRACUNIT); - if (splitscreen) + if (r_splitscreen) xoffs = FixedMul(xoffs, scale); xoffs -= (tn)*scale; @@ -9470,7 +9470,7 @@ static void K_drawKartFirstPerson(void) if (mag < FRACUNIT) { xoffs = FixedMul(xoffs, mag); - if (!splitscreen) + if (!r_splitscreen) yoffs = FixedMul(yoffs, mag); } } @@ -9482,7 +9482,7 @@ static void K_drawKartFirstPerson(void) x -= xoffs; else x += xoffs; - if (!splitscreen) + if (!r_splitscreen) y += yoffs; } @@ -9502,11 +9502,11 @@ static void K_drawKartFirstPerson(void) V_DrawFixedPatch(x, y, scale, splitflags, kp_fpview[target], colmap); - if (stplyr == &players[displayplayers[1]] && splitscreen) + if (stplyr == &players[displayplayers[1]] && r_splitscreen) { pnum[1] = pn; turn[1] = tn; drift[1] = dr; } - else if (stplyr == &players[displayplayers[2]] && splitscreen > 1) + else if (stplyr == &players[displayplayers[2]] && r_splitscreen > 1) { pnum[2] = pn; turn[2] = tn; drift[2] = dr; } - else if (stplyr == &players[displayplayers[3]] && splitscreen > 2) + else if (stplyr == &players[displayplayers[3]] && r_splitscreen > 2) { pnum[3] = pn; turn[3] = tn; drift[3] = dr; } else { pnum[0] = pn; turn[0] = tn; drift[0] = dr; } @@ -9832,7 +9832,7 @@ void K_drawKartHUD(void) K_initKartHUD(); // Draw that fun first person HUD! Drawn ASAP so it looks more "real". - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (stplyr == &players[displayplayers[i]] && !camera[i].chase) K_drawKartFirstPerson(); @@ -9852,10 +9852,10 @@ void K_drawKartHUD(void) && comeback && stplyr->playerstate == PST_LIVE))); - if (!demo.title && (!battlefullscreen || splitscreen)) + if (!demo.title && (!battlefullscreen || r_splitscreen)) { // Draw the CHECK indicator before the other items, so it's overlapped by everything else - if (cv_kartcheck.value && !splitscreen && !players[displayplayers[0]].exiting) + if (cv_kartcheck.value && !r_splitscreen && !players[displayplayers[0]].exiting) K_drawKartPlayerCheck(); // Draw WANTED status @@ -9892,7 +9892,7 @@ void K_drawKartHUD(void) K_drawKartItem(); // If not splitscreen, draw... - if (!splitscreen && !demo.title) + if (!r_splitscreen && !demo.title) { // Draw the timestamp #ifdef HAVE_BLUA @@ -9913,7 +9913,7 @@ void K_drawKartHUD(void) if (!stplyr->spectator) // Bottom of the screen elements, don't need in spectate mode { // Draw the speedometer - if (cv_kartspeedometer.value && !splitscreen) + if (cv_kartspeedometer.value && !r_splitscreen) { #ifdef HAVE_BLUA if (LUA_HudEnabled(hud_speedometer)) @@ -9925,7 +9925,7 @@ void K_drawKartHUD(void) { INT32 x = BASEVIDWIDTH - 32, y = 128, offs; - if (splitscreen == 3) + if (r_splitscreen == 3) { x = BASEVIDWIDTH/2 + 10; y = BASEVIDHEIGHT/2 - 30; @@ -9984,11 +9984,11 @@ void K_drawKartHUD(void) if (leveltime >= starttime-(3*TICRATE) && leveltime < starttime+TICRATE) K_drawKartStartCountdown(); - else if (countdown && (!splitscreen || !stplyr->exiting)) + else if (countdown && (!r_splitscreen || !stplyr->exiting)) { char *countstr = va("%d", countdown/TICRATE); - if (splitscreen > 1) + if (r_splitscreen > 1) V_DrawCenteredString(BASEVIDWIDTH/4, LAPS_Y+1, K_calcSplitFlags(0), countstr); else { @@ -10002,14 +10002,14 @@ void K_drawKartHUD(void) { if (stplyr->exiting) K_drawKartFinish(); - else if (stplyr->karthud[khud_lapanimation] && !splitscreen) + else if (stplyr->karthud[khud_lapanimation] && !r_splitscreen) K_drawLapStartAnim(); } if (modeattacking) // everything after here is MP and debug only return; - if (G_BattleGametype() && !splitscreen && (stplyr->karthud[khud_yougotem] % 2)) // * YOU GOT EM * + if (G_BattleGametype() && !r_splitscreen && (stplyr->karthud[khud_yougotem] % 2)) // * YOU GOT EM * V_DrawScaledPatch(BASEVIDWIDTH/2 - (SHORT(kp_yougotem->width)/2), 32, V_HUDTRANS, kp_yougotem); // Draw FREE PLAY. diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 299870e00..2ce3e89ae 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -125,7 +125,7 @@ void COM_Lua_f(void) lua_pop(gL, 1); // pop command info table return; // can't execute splitscreen command without player 2! } - playernum = displayplayers[1]; + playernum = displayplayers[localdisplayplayers[1]]; } if (netgame) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index ec76552d1..d10a8dd0a 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -426,15 +426,15 @@ static int libd_drawOnMinimap(lua_State *L) // first, check what position the mmap is supposed to be in (pasted from k_kart.c): MM_X = BASEVIDWIDTH - 50; // 270 MM_Y = (BASEVIDHEIGHT/2)-16; // 84 - if (splitscreen) + if (r_splitscreen) { MM_Y = (BASEVIDHEIGHT/2); - if (splitscreen > 1) // 3P : bottom right + if (r_splitscreen > 1) // 3P : bottom right { MM_X = (3*BASEVIDWIDTH/4); MM_Y = (3*BASEVIDHEIGHT/4); - if (splitscreen > 2) // 4P: centered + if (r_splitscreen > 2) // 4P: centered { MM_X = (BASEVIDWIDTH/2); MM_Y = (BASEVIDHEIGHT/2); @@ -443,7 +443,7 @@ static int libd_drawOnMinimap(lua_State *L) } // splitscreen flags - splitflags = (splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) + splitflags = (r_splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) // translucency: if (timeinmap > 105) @@ -461,7 +461,7 @@ static int libd_drawOnMinimap(lua_State *L) minimaptrans = ((10-minimaptrans)< 2 && stplayr == &players[displayplayers[3]]) + if (r_splitscreen > 2 && stplayr == &players[displayplayers[3]]) { LUA_PushUserdata(gL, &camera[3], META_CAMERA); camnum = 4; } - else if (splitscreen > 1 && stplayr == &players[displayplayers[2]]) + else if (r_splitscreen > 1 && stplayr == &players[displayplayers[2]]) { LUA_PushUserdata(gL, &camera[2], META_CAMERA); camnum = 3; } - else if (splitscreen && stplayr == &players[displayplayers[1]]) + else if (r_splitscreen && stplayr == &players[displayplayers[1]]) { LUA_PushUserdata(gL, &camera[1], META_CAMERA); camnum = 2; diff --git a/src/m_menu.c b/src/m_menu.c index d5084dff2..3fe0198df 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5789,9 +5789,9 @@ static void M_DrawPlaybackMenu(void) { PlaybackMenu[playback_viewcount].status = IT_ARROWS|IT_STRING; - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) PlaybackMenu[playback_view1+i].status = IT_ARROWS|IT_STRING; - for (i = splitscreen+1; i < 4; i++) + for (i = r_splitscreen+1; i < 4; i++) PlaybackMenu[playback_view1+i].status = IT_DISABLED; //PlaybackMenu[playback_moreoptions].alphaKey = 156; @@ -5814,7 +5814,7 @@ static void M_DrawPlaybackMenu(void) { if (modeattacking) continue; - if (splitscreen >= i - playback_view1) + if (r_splitscreen >= i - playback_view1) { INT32 ply = displayplayers[i - playback_view1]; @@ -5850,18 +5850,18 @@ static void M_DrawPlaybackMenu(void) { char *str; - if (!(i == playback_viewcount && splitscreen == 3)) + if (!(i == playback_viewcount && r_splitscreen == 3)) V_DrawCharacter(BASEVIDWIDTH/2 - 4, currentMenu->y + 28 - (skullAnimCounter/5), '\x1A' | V_SNAPTOTOP|highlightflags, false); // up arrow - if (!(i == playback_viewcount && splitscreen == 0)) + if (!(i == playback_viewcount && r_splitscreen == 0)) V_DrawCharacter(BASEVIDWIDTH/2 - 4, currentMenu->y + 48 + (skullAnimCounter/5), '\x1B' | V_SNAPTOTOP|highlightflags, false); // down arrow switch (i) { case playback_viewcount: - str = va("%d", splitscreen+1); + str = va("%d", r_splitscreen+1); break; case playback_view1: @@ -5954,12 +5954,12 @@ static void M_PlaybackSetViews(INT32 choice) { if (choice > 0) { - if (splitscreen < 3) - G_AdjustView(splitscreen + 2, 0, true); + if (r_splitscreen < 3) + G_AdjustView(r_splitscreen + 2, 0, true); } - else if (splitscreen) + else if (r_splitscreen) { - splitscreen--; + r_splitscreen--; R_ExecuteSetViewSize(); } } @@ -9525,7 +9525,7 @@ static void M_SetupMultiPlayer2(INT32 choice) strcpy (setupm_name, cv_playername2.string); // set for splitscreen secondary player - setupm_player = &players[displayplayers[1]]; + setupm_player = &players[displayplayers[localdisplayplayers[1]]]; setupm_cvskin = &cv_skin2; setupm_cvcolor = &cv_playercolor2; setupm_cvname = &cv_playername2; @@ -9537,7 +9537,7 @@ static void M_SetupMultiPlayer2(INT32 choice) setupm_fakecolor = setupm_cvcolor->value; // disable skin changes if we can't actually change skins - if (splitscreen && !CanChangeSkin(displayplayers[1])) + if (splitscreen && !CanChangeSkin(displayplayers[localdisplayplayers[1]])) MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT); else MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); @@ -9556,7 +9556,7 @@ static void M_SetupMultiPlayer3(INT32 choice) strcpy(setupm_name, cv_playername3.string); // set for splitscreen third player - setupm_player = &players[displayplayers[2]]; + setupm_player = &players[displayplayers[localdisplayplayers[2]]]; setupm_cvskin = &cv_skin3; setupm_cvcolor = &cv_playercolor3; setupm_cvname = &cv_playername3; @@ -9568,7 +9568,7 @@ static void M_SetupMultiPlayer3(INT32 choice) setupm_fakecolor = setupm_cvcolor->value; // disable skin changes if we can't actually change skins - if (splitscreen > 1 && !CanChangeSkin(displayplayers[2])) + if (splitscreen > 1 && !CanChangeSkin(displayplayers[localdisplayplayers[2]])) MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT); else MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); @@ -9587,7 +9587,7 @@ static void M_SetupMultiPlayer4(INT32 choice) strcpy(setupm_name, cv_playername4.string); // set for splitscreen fourth player - setupm_player = &players[displayplayers[3]]; + setupm_player = &players[displayplayers[localdisplayplayers[3]]]; setupm_cvskin = &cv_skin4; setupm_cvcolor = &cv_playercolor4; setupm_cvname = &cv_playername4; @@ -9599,7 +9599,7 @@ static void M_SetupMultiPlayer4(INT32 choice) setupm_fakecolor = setupm_cvcolor->value; // disable skin changes if we can't actually change skins - if (splitscreen > 2 && !CanChangeSkin(displayplayers[3])) + if (splitscreen > 2 && !CanChangeSkin(displayplayers[localdisplayplayers[3]])) MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT); else MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); diff --git a/src/m_misc.c b/src/m_misc.c index f4a4ec291..b232bce9a 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -743,12 +743,12 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png else snprintf(lvlttltext, 48, "Unknown"); - if (gamestate == GS_LEVEL && &players[displayplayers[0]] && players[displayplayers[0]].mo) + if (gamestate == GS_LEVEL && &players[displayplayers[localdisplayplayers[0]]] && players[displayplayers[localdisplayplayers[0]]].mo) snprintf(locationtxt, 40, "X:%d Y:%d Z:%d A:%d", - players[displayplayers[0]].mo->x>>FRACBITS, - players[displayplayers[0]].mo->y>>FRACBITS, - players[displayplayers[0]].mo->z>>FRACBITS, - FixedInt(AngleFixed(players[displayplayers[0]].mo->angle))); + players[displayplayers[localdisplayplayers[0]]].mo->x>>FRACBITS, + players[displayplayers[localdisplayplayers[0]]].mo->y>>FRACBITS, + players[displayplayers[localdisplayplayers[0]]].mo->z>>FRACBITS, + FixedInt(AngleFixed(players[displayplayers[localdisplayplayers[0]]].mo->angle))); else snprintf(locationtxt, 40, "Unknown"); diff --git a/src/p_enemy.c b/src/p_enemy.c index 76f6b3159..a9b8d30b3 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -4229,7 +4229,7 @@ void A_OverlayThink(mobj_t *actor) if (!actor->target) return; - if (!splitscreen && rendermode != render_soft) + if (!r_splitscreen && rendermode != render_soft) { angle_t viewingangle; diff --git a/src/p_floor.c b/src/p_floor.c index ccbfd6eae..a6419b409 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2536,9 +2536,9 @@ void T_CameraScanner(elevator_t *elevator) lastleveltime = leveltime; } - if (players[displayplayers[0]].mo) + if (players[displayplayers[localdisplayplayers[0]]].mo) { - if (players[displayplayers[0]].mo->subsector->sector == elevator->actionsector) + if (players[displayplayers[localdisplayplayers[0]]].mo->subsector->sector == elevator->actionsector) { if (t_cam_dist == -42) t_cam_dist = cv_cam_dist.value; @@ -2564,9 +2564,9 @@ void T_CameraScanner(elevator_t *elevator) } } - if (splitscreen && players[displayplayers[1]].mo) + if (splitscreen && players[displayplayers[localdisplayplayers[1]]].mo) { - if (players[displayplayers[1]].mo->subsector->sector == elevator->actionsector) + if (players[displayplayers[localdisplayplayers[1]]].mo->subsector->sector == elevator->actionsector) { if (t_cam2_rotate == -42) t_cam2_dist = cv_cam2_dist.value; @@ -2592,9 +2592,9 @@ void T_CameraScanner(elevator_t *elevator) } } - if (splitscreen > 1 && players[displayplayers[2]].mo) + if (splitscreen > 1 && players[displayplayers[localdisplayplayers[2]]].mo) { - if (players[displayplayers[2]].mo->subsector->sector == elevator->actionsector) + if (players[displayplayers[localdisplayplayers[2]]].mo->subsector->sector == elevator->actionsector) { if (t_cam3_rotate == -42) t_cam3_dist = cv_cam3_dist.value; @@ -2620,9 +2620,9 @@ void T_CameraScanner(elevator_t *elevator) } } - if (splitscreen > 2 && players[displayplayers[3]].mo) + if (splitscreen > 2 && players[displayplayers[localdisplayplayers[3]]].mo) { - if (players[displayplayers[3]].mo->subsector->sector == elevator->actionsector) + if (players[displayplayers[localdisplayplayers[3]]].mo->subsector->sector == elevator->actionsector) { if (t_cam4_rotate == -42) t_cam4_dist = cv_cam4_dist.value; diff --git a/src/p_inter.c b/src/p_inter.c index 7a975951c..d53423a46 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -63,11 +63,11 @@ void P_ForceConstant(const BasicFF_t *FFInfo) ConstantQuake.Magnitude = FFInfo->Magnitude; if (FFInfo->player == &players[consoleplayer]) I_Tactile(ConstantForce, &ConstantQuake); - else if (splitscreen && FFInfo->player == &players[displayplayers[1]]) + else if (splitscreen && FFInfo->player == &players[displayplayers[localdisplayplayers[1]]]) I_Tactile2(ConstantForce, &ConstantQuake); - else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[2]]) + else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[localdisplayplayers[2]]]) I_Tactile3(ConstantForce, &ConstantQuake); - else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[3]]) + else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[localdisplayplayers[3]]]) I_Tactile4(ConstantForce, &ConstantQuake); } void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End) @@ -84,11 +84,11 @@ void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End) RampQuake.End = End; if (FFInfo->player == &players[consoleplayer]) I_Tactile(ConstantForce, &RampQuake); - else if (splitscreen && FFInfo->player == &players[displayplayers[1]]) + else if (splitscreen && FFInfo->player == &players[displayplayers[localdisplayplayers[1]]]) I_Tactile2(ConstantForce, &RampQuake); - else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[2]]) + else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[localdisplayplayers[2]]]) I_Tactile3(ConstantForce, &RampQuake); - else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[3]]) + else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[localdisplayplayers[3]]]) I_Tactile4(ConstantForce, &RampQuake); } diff --git a/src/p_map.c b/src/p_map.c index e9bc95712..253be0955 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2568,7 +2568,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) itsatwodlevel = true; else { - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (thiscam == &camera[i] && players[displayplayers[i]].mo && (players[displayplayers[i]].mo->flags2 & MF2_TWOD)) @@ -2584,7 +2584,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) fixed_t tryx = thiscam->x; fixed_t tryy = thiscam->y; - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { #ifndef NOCLIPCAM if ((thiscam == &camera[i] && (players[displayplayers[i]].pflags & PF_NOCLIP)) || (leveltime < introtime)) // Noclipping player camera noclips too!! diff --git a/src/p_mobj.c b/src/p_mobj.c index b220ff4e6..d648ff0f3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1171,7 +1171,7 @@ static void P_PlayerFlip(mobj_t *mo) mo->player->aiming = InvAngle(mo->player->aiming); - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (mo->player-players == displayplayers[i]) { @@ -3565,7 +3565,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled itsatwodlevel = true; else { - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (thiscam == &camera[i] && players[displayplayers[i]].mo && (players[displayplayers[i]].mo->flags2 & MF2_TWOD)) @@ -3606,7 +3606,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled if (postimg != postimg_none) { - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) postimgtype[i] = postimg; @@ -3656,11 +3656,11 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled fixed_t cam_height = cv_cam_height.value; thiscam->z = thiscam->floorz; - if (player == &players[displayplayers[1]]) + if (player == &players[displayplayers[localdisplayplayers[1]]]) cam_height = cv_cam2_height.value; - if (player == &players[displayplayers[2]]) + if (player == &players[displayplayers[localdisplayplayers[2]]]) cam_height = cv_cam3_height.value; - if (player == &players[displayplayers[3]]) + if (player == &players[displayplayers[localdisplayplayers[3]]]) cam_height = cv_cam4_height.value; if (thiscam->z > player->mo->z + player->mo->height + FixedMul(cam_height*FRACUNIT + 16*FRACUNIT, player->mo->scale)) { @@ -6112,7 +6112,7 @@ void P_RunOverlays(void) if (!mo->target) continue; - if (!splitscreen /*&& rendermode != render_soft*/) + if (!r_splitscreen /*&& rendermode != render_soft*/) { angle_t viewingangle; @@ -6635,7 +6635,7 @@ void P_RunBattleOvertime(void) { UINT8 transparency = tr_trans50; - if (!splitscreen && players[displayplayers[0]].mo) + if (!r_splitscreen && players[displayplayers[0]].mo) { INT32 dist = P_AproxDistance(battleovertime.x-players[displayplayers[0]].mo->x, battleovertime.y-players[displayplayers[0]].mo->y); transparency = max(0, NUMTRANSMAPS - ((256 + (dist>>FRACBITS)) / 256)); @@ -7094,7 +7094,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->angle = R_PointToAngle(mobj->x, mobj->y) + ANGLE_90; // literally only happened because i wanted to ^L^R the SPR_ITEM's - if (!splitscreen && players[displayplayers[0]].mo) + if (!r_splitscreen && players[displayplayers[0]].mo) { scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayers[0]].mo->x-mobj->target->x, players[displayplayers[0]].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); @@ -7282,7 +7282,7 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->target && mobj->target->health && mobj->tracer && mobj->target->player && !mobj->target->player->spectator && mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD - && players[displayplayers[0]].mo && !players[displayplayers[0]].spectator) + && players[displayplayers[localdisplayplayers[0]]].mo && !players[displayplayers[localdisplayplayers[0]]].spectator) { fixed_t scale = 3*mobj->target->scale; @@ -7302,7 +7302,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->x = mobj->target->x; mobj->y = mobj->target->y; - if (!splitscreen && players[displayplayers[0]].mo) + if (!r_splitscreen && players[displayplayers[0]].mo) { scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayers[0]].mo->x-mobj->target->x, players[displayplayers[0]].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); @@ -8807,7 +8807,7 @@ void P_MobjThinker(mobj_t *mobj) } P_SetScale(mobj, (mobj->destscale = (5*mobj->target->destscale)>>2)); - if (!splitscreen /*&& rendermode != render_soft*/) + if (!r_splitscreen /*&& rendermode != render_soft*/) { angle_t viewingangle; statenum_t curstate = ((mobj->tics == 1) ? (mobj->state->nextstate) : ((statenum_t)(mobj->state-states))); @@ -11136,13 +11136,13 @@ void P_PrecipitationEffects(void) // Local effects from here on out! // If we're not in game fully yet, we don't worry about them. - if (!playeringame[displayplayers[0]] || !players[displayplayers[0]].mo) + if (!playeringame[displayplayers[localdisplayplayers[0]]] || !players[displayplayers[localdisplayplayers[0]]].mo) return; if (sound_disabled) return; // Sound off? D'aw, no fun. - if (players[displayplayers[0]].mo->subsector->sector->ceilingpic == skyflatnum) + if (players[displayplayers[localdisplayplayers[0]]].mo->subsector->sector->ceilingpic == skyflatnum) volume = 255; // Sky above? We get it full blast. else { @@ -11150,17 +11150,17 @@ void P_PrecipitationEffects(void) fixed_t closedist, newdist; // Essentially check in a 1024 unit radius of the player for an outdoor area. - yl = players[displayplayers[0]].mo->y - 1024*FRACUNIT; - yh = players[displayplayers[0]].mo->y + 1024*FRACUNIT; - xl = players[displayplayers[0]].mo->x - 1024*FRACUNIT; - xh = players[displayplayers[0]].mo->x + 1024*FRACUNIT; + yl = players[displayplayers[localdisplayplayers[0]]].mo->y - 1024*FRACUNIT; + yh = players[displayplayers[localdisplayplayers[0]]].mo->y + 1024*FRACUNIT; + xl = players[displayplayers[localdisplayplayers[0]]].mo->x - 1024*FRACUNIT; + xh = players[displayplayers[localdisplayplayers[0]]].mo->x + 1024*FRACUNIT; closedist = 2048*FRACUNIT; for (y = yl; y <= yh; y += FRACUNIT*64) for (x = xl; x <= xh; x += FRACUNIT*64) { if (R_PointInSubsector(x, y)->sector->ceilingpic == skyflatnum) // Found the outdoors! { - newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, x, y, 0); + newdist = S_CalculateSoundDistance(players[displayplayers[localdisplayplayers[0]]].mo->x, players[displayplayers[localdisplayplayers[0]]].mo->y, 0, x, y, 0); if (newdist < closedist) closedist = newdist; } @@ -11175,7 +11175,7 @@ void P_PrecipitationEffects(void) volume = 255; if (sounds_rain && (!leveltime || leveltime % 80 == 1)) - S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_rainin, volume); + S_StartSoundAtVolume(players[displayplayers[localdisplayplayers[0]]].mo, sfx_rainin, volume); if (!sounds_thunder) return; @@ -11183,7 +11183,7 @@ void P_PrecipitationEffects(void) if (effects_lightning && lightningStrike && volume) { // Large, close thunder sounds to go with our lightning. - S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_litng1 + M_RandomKey(4), volume); + S_StartSoundAtVolume(players[displayplayers[localdisplayplayers[0]]].mo, sfx_litng1 + M_RandomKey(4), volume); } else if (thunderchance < 20) { @@ -11191,7 +11191,7 @@ void P_PrecipitationEffects(void) if (volume < 80) volume = 80; - S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_athun1 + M_RandomKey(2), volume); + S_StartSoundAtVolume(players[displayplayers[localdisplayplayers[0]]].mo, sfx_athun1 + M_RandomKey(2), volume); } } @@ -11525,9 +11525,9 @@ void P_AfterPlayerSpawn(INT32 playernum) if (playernum == consoleplayer) localangle[0] = mobj->angle; - else if (splitscreen) + else if (r_splitscreen) { - for (i = 1; i <= splitscreen; i++) + for (i = 1; i <= r_splitscreen; i++) { if (playernum == displayplayers[i]) { @@ -11557,7 +11557,7 @@ void P_AfterPlayerSpawn(INT32 playernum) SV_SpawnPlayer(playernum, mobj->x, mobj->y, mobj->angle); - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (camera[i].chase) { diff --git a/src/p_setup.c b/src/p_setup.c index 5acc72746..491127d5b 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2567,29 +2567,29 @@ static void P_ForceCharacter(const char *forcecharskin) { if (splitscreen) { - SetPlayerSkin(displayplayers[1], forcecharskin); - if ((unsigned)cv_playercolor2.value != skins[players[displayplayers[1]].skin].prefcolor && !modeattacking) + SetPlayerSkin(displayplayers[localdisplayplayers[1]], forcecharskin); + if ((unsigned)cv_playercolor2.value != skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor2, skins[players[displayplayers[1]].skin].prefcolor); - players[displayplayers[1]].skincolor = skins[players[displayplayers[1]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor2, skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor); + players[displayplayers[localdisplayplayers[1]]].skincolor = skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor; } if (splitscreen > 1) { - SetPlayerSkin(displayplayers[2], forcecharskin); - if ((unsigned)cv_playercolor3.value != skins[players[displayplayers[2]].skin].prefcolor && !modeattacking) + SetPlayerSkin(displayplayers[localdisplayplayers[2]], forcecharskin); + if ((unsigned)cv_playercolor3.value != skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor3, skins[players[displayplayers[2]].skin].prefcolor); - players[displayplayers[2]].skincolor = skins[players[displayplayers[2]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor3, skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor); + players[displayplayers[localdisplayplayers[2]]].skincolor = skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor; } if (splitscreen > 2) { - SetPlayerSkin(displayplayers[3], forcecharskin); - if ((unsigned)cv_playercolor4.value != skins[players[displayplayers[3]].skin].prefcolor && !modeattacking) + SetPlayerSkin(displayplayers[localdisplayplayers[3]], forcecharskin); + if ((unsigned)cv_playercolor4.value != skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor4, skins[players[displayplayers[3]].skin].prefcolor); - players[displayplayers[3]].skincolor = skins[players[displayplayers[3]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor4, skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor); + players[displayplayers[localdisplayplayers[3]]].skincolor = skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor; } } } @@ -2824,7 +2824,7 @@ boolean P_SetupLevel(boolean skipprecip) P_LevelInitStuff(); - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) postimgtype[i] = postimg_none; if (mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0') @@ -3228,7 +3228,7 @@ boolean P_SetupLevel(boolean skipprecip) if (!dedicated) { - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) P_SetupCamera(displayplayers[i], &camera[i]); // Salt: CV_ClearChangedFlags() messes with your settings :( @@ -3270,7 +3270,7 @@ boolean P_SetupLevel(boolean skipprecip) /*if (rendermode != render_none) CV_Set(&cv_fov, cv_fov.defaultvalue);*/ - displayplayers[0] = consoleplayer; // Start with your OWN view, please! + displayplayers[localdisplayplayers[0]] = consoleplayer; // Start with your OWN view, please! } /*if (cv_useranalog.value) diff --git a/src/p_spec.c b/src/p_spec.c index 93e88e2ce..e62f1410c 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2386,7 +2386,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (bot) // This might put poor Tails in a wall if he's too far behind! D: But okay, whatever! >:3 P_TeleportMove(bot, bot->x + x, bot->y + y, bot->z + z); - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (mo->player == &players[displayplayers[i]] && camera[i].chase) { diff --git a/src/p_telept.c b/src/p_telept.c index 74f9d462c..8c2f8ed70 100644 --- a/src/p_telept.c +++ b/src/p_telept.c @@ -66,9 +66,9 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, // absolute angle position if (thing == players[consoleplayer].mo) localangle[0] = angle; - else if (splitscreen) + else if (r_splitscreen) { - for (i = 1; i <= splitscreen; i++) + for (i = 1; i <= r_splitscreen; i++) { if (thing == players[displayplayers[i]].mo) { @@ -79,7 +79,7 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, } // move chasecam at new player location - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (thing->player == &players[displayplayers[i]] && camera[i].chase) P_ResetCamera(thing->player, &camera[i]); @@ -151,9 +151,9 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle // absolute angle position if (thing == players[consoleplayer].mo) localangle[0] = angle; - else if (splitscreen) + else if (r_splitscreen) { - for (i = 1; i <= splitscreen; i++) + for (i = 1; i <= r_splitscreen; i++) { if (thing == players[displayplayers[i]].mo) { @@ -164,7 +164,7 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle } // move chasecam at new player location - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (thing->player == &players[displayplayers[i]] && camera[i].chase) P_ResetCamera(thing->player, &camera[i]); diff --git a/src/p_tick.c b/src/p_tick.c index b285c35d0..a5214a5ab 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -601,7 +601,7 @@ void P_Ticker(boolean run) return; } - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) postimgtype[i] = postimg_none; P_MapStart(); @@ -751,7 +751,7 @@ void P_Ticker(boolean run) } // Always move the camera. - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (camera[i].chase) P_MoveChaseCamera(&players[displayplayers[i]], &camera[i], false); @@ -771,7 +771,7 @@ void P_PreTicker(INT32 frames) INT32 i,framecnt; ticcmd_t temptic; - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) postimgtype[i] = postimg_none; for (framecnt = 0; framecnt < frames; ++framecnt) diff --git a/src/p_user.c b/src/p_user.c index 8185667a0..bb9eae095 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1122,12 +1122,12 @@ boolean P_EndingMusic(player_t *player) // Event - Level Finish // Check for if this is valid or not - if (splitscreen) + if (r_splitscreen) { if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_TIMEOVER)) || (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_TIMEOVER)) - || ((splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER))) - || ((splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER))))) + || ((r_splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER))) + || ((r_splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER))))) return false; bestlocalplayer = &players[displayplayers[0]]; @@ -1139,9 +1139,9 @@ boolean P_EndingMusic(player_t *player) bestlocalpos = ((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]); \ } setbests(displayplayers[1]); - if (splitscreen > 1) + if (r_splitscreen > 1) setbests(displayplayers[2]); - if (splitscreen > 2) + if (r_splitscreen > 2) setbests(displayplayers[3]); #undef setbests } @@ -1211,7 +1211,7 @@ void P_RestoreMusic(player_t *player) { INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow - if (splitscreen) + if (r_splitscreen) { INT32 bestlocaltimer = 1; @@ -1225,9 +1225,9 @@ void P_RestoreMusic(player_t *player) } setbests(displayplayers[0]); setbests(displayplayers[1]); - if (splitscreen > 1) + if (r_splitscreen > 1) setbests(displayplayers[2]); - if (splitscreen > 2) + if (r_splitscreen > 2) setbests(displayplayers[3]); #undef setbests } @@ -1490,9 +1490,9 @@ boolean P_IsLocalPlayer(player_t *player) if (player == &players[consoleplayer]) return true; - else if (splitscreen) + else if (r_splitscreen) { - for (i = 1; i <= splitscreen; i++) // Skip P1 + for (i = 1; i <= r_splitscreen; i++) // Skip P1 { if (player == &players[displayplayers[i]]) return true; @@ -1512,7 +1512,7 @@ boolean P_IsDisplayPlayer(player_t *player) { UINT8 i; - for (i = 0; i <= splitscreen; i++) // DON'T skip P1 + for (i = 0; i <= r_splitscreen; i++) // DON'T skip P1 { if (player == &players[displayplayers[i]]) return true; @@ -7913,7 +7913,7 @@ static void P_CalcPostImg(player_t *player) pviewheight = player->awayviewmobj->z + 20*FRACUNIT; } - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { @@ -8078,7 +8078,7 @@ void P_PlayerThink(player_t *player) } #ifdef SEENAMES - if (netgame && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)) && !splitscreen) + if (netgame && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)) && !r_splitscreen) { seenplayer = NULL; @@ -8434,7 +8434,7 @@ void P_PlayerThink(player_t *player) // Hide the mobj from our sights if we're the displayplayer and chasecam is off. // Why not just not spawn the mobj? Well, I'd rather only flirt with // consistency so much... - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]] && !camera[i].chase) { @@ -8664,7 +8664,7 @@ void P_PlayerAfterThink(player_t *player) P_PlayerInSpecialSector(player); #endif - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { diff --git a/src/r_bsp.c b/src/r_bsp.c index 296cbbe87..d7641838e 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -254,7 +254,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, boolean underwater; UINT8 i; - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (viewplayer == &players[displayplayers[i]] && camera[i].chase) { @@ -263,7 +263,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, } } - if (i > splitscreen && viewmobj) + if (i > r_splitscreen && viewmobj) heightsec = R_PointInSubsector(viewmobj->x, viewmobj->y)->sector->heightsec; else return sec; diff --git a/src/r_draw.c b/src/r_draw.c index 1931ce6ee..70e487342 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -299,7 +299,7 @@ void R_InitViewBuffer(INT32 width, INT32 height) for (i = 0; i < height; i++) { ylookup[i] = ylookup1[i] = screens[0] + i*vid.width*bytesperpixel; - if (splitscreen == 1) + if (r_splitscreen == 1) ylookup2[i] = screens[0] + (i+viewheight)*vid.width*bytesperpixel; else ylookup2[i] = screens[0] + i*vid.width*bytesperpixel + (viewwidth*bytesperpixel); diff --git a/src/r_main.c b/src/r_main.c index 0d14bed73..cf16802cb 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -73,6 +73,8 @@ boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisibl sector_t *viewsector; player_t *viewplayer; +int r_splitscreen; + // PORTALS! // You can thank and/or curse JTE for these. UINT8 portalrender; @@ -192,6 +194,12 @@ void SplitScreen_OnChange(void) { UINT8 i; + /* + local splitscreen is updated before you're in a game, + so this is the first value for renderer splitscreen + */ + r_splitscreen = splitscreen; + // recompute screen size R_ExecuteSetViewSize(); @@ -659,12 +667,12 @@ void R_ExecuteSetViewSize(void) scaledviewwidth = vid.width; viewheight = vid.height; - if (splitscreen) + if (r_splitscreen) viewheight >>= 1; viewwidth = scaledviewwidth; - if (splitscreen > 1) + if (r_splitscreen > 1) { viewwidth >>= 1; scaledviewwidth >>= 1; @@ -677,7 +685,7 @@ void R_ExecuteSetViewSize(void) fov = FixedAngle(cv_fov.value/2) + ANGLE_90; fovtan = FINETANGENT(fov >> ANGLETOFINESHIFT); - if (splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view + if (r_splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view fovtan = 17*fovtan/10; projection = projectiony = FixedDiv(centerxfrac, fovtan); @@ -848,9 +856,9 @@ void R_SkyboxFrame(player_t *player) camera_t *thiscam = &camera[0]; UINT8 i; - if (splitscreen) + if (r_splitscreen) { - for (i = 1; i <= splitscreen; i++) + for (i = 1; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { @@ -891,9 +899,9 @@ void R_SkyboxFrame(player_t *player) viewangle = localangle[0]; // WARNING: camera uses this aimingangle = localaiming[0]; } - else if (splitscreen) + else if (r_splitscreen) { - for (i = 1; i <= splitscreen; i++) + for (i = 1; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { @@ -1080,17 +1088,17 @@ void R_SetupFrame(player_t *player, boolean skybox) camera_t *thiscam; boolean chasecam = false; - if (splitscreen > 2 && player == &players[displayplayers[3]]) + if (r_splitscreen > 2 && player == &players[displayplayers[3]]) { thiscam = &camera[3]; chasecam = (cv_chasecam4.value != 0); } - else if (splitscreen > 1 && player == &players[displayplayers[2]]) + else if (r_splitscreen > 1 && player == &players[displayplayers[2]]) { thiscam = &camera[2]; chasecam = (cv_chasecam3.value != 0); } - else if (splitscreen && player == &players[displayplayers[1]]) + else if (r_splitscreen && player == &players[displayplayers[1]]) { thiscam = &camera[1]; chasecam = (cv_chasecam2.value != 0); @@ -1150,10 +1158,10 @@ void R_SetupFrame(player_t *player, boolean skybox) viewangle = localangle[0]; // WARNING: camera uses this aimingangle = localaiming[0]; } - else if (splitscreen) + else if (r_splitscreen) { UINT8 i; - for (i = 1; i <= splitscreen; i++) + for (i = 1; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { @@ -1334,7 +1342,7 @@ void R_RenderPlayerView(player_t *player) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 32+(timeinmap&15)); } // Draw over the fourth screen so you don't have to stare at a HOM :V - else if (splitscreen == 2 && player == &players[displayplayers[2]]) + else if (r_splitscreen == 2 && player == &players[displayplayers[2]]) #if 1 { // V_DrawPatchFill, but for the fourth screen only @@ -1353,7 +1361,7 @@ void R_RenderPlayerView(player_t *player) #endif // load previous saved value of skyVisible for the player - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { @@ -1463,7 +1471,7 @@ void R_RenderPlayerView(player_t *player) // save value to skyVisiblePerPlayer // this is so that P1 can't affect whether P2 can see a skybox or not, or vice versa - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { diff --git a/src/r_plane.c b/src/r_plane.c index ec105bf75..08a449e6c 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -883,12 +883,12 @@ void R_DrawSinglePlane(visplane_t *pl) if (bottom > vid.height) bottom = vid.height; - if (splitscreen > 2 && viewplayer == &players[displayplayers[3]]) // Only copy the part of the screen we need + if (r_splitscreen > 2 && viewplayer == &players[displayplayers[3]]) // Only copy the part of the screen we need scr = (screens[0] + (top+(viewheight))*vid.width + viewwidth); - else if ((splitscreen == 1 && viewplayer == &players[displayplayers[1]]) - || (splitscreen > 1 && viewplayer == &players[displayplayers[2]])) + else if ((r_splitscreen == 1 && viewplayer == &players[displayplayers[1]]) + || (r_splitscreen > 1 && viewplayer == &players[displayplayers[2]])) scr = (screens[0] + (top+(viewheight))*vid.width); - else if (splitscreen > 1 && viewplayer == &players[displayplayers[1]]) + else if (r_splitscreen > 1 && viewplayer == &players[displayplayers[1]]) scr = (screens[0] + ((top)*vid.width) + viewwidth); else scr = (screens[0] + ((top)*vid.width)); diff --git a/src/r_sky.c b/src/r_sky.c index 1fe0fe0e6..3904eba3a 100644 --- a/src/r_sky.c +++ b/src/r_sky.c @@ -81,7 +81,7 @@ void R_SetSkyScale(void) { fixed_t difference = vid.fdupx-(vid.dupx< 1) + if (r_splitscreen > 1) scr *= 2; skyscale = FixedDiv(scr, vid.fdupx+difference); } diff --git a/src/r_things.c b/src/r_things.c index 1afbb125c..239c9def0 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1761,7 +1761,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) continue; - if (splitscreen) + if (r_splitscreen) { if (thing->eflags & MFE_DRAWONLYFORP1) if (viewssnum != 0) @@ -1771,11 +1771,11 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) if (viewssnum != 1) continue; - if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) + if (thing->eflags & MFE_DRAWONLYFORP3 && r_splitscreen > 1) if (viewssnum != 2) continue; - if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) + if (thing->eflags & MFE_DRAWONLYFORP4 && r_splitscreen > 2) if (viewssnum != 3) continue; } @@ -1796,7 +1796,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) continue; - if (splitscreen) + if (r_splitscreen) { if (thing->eflags & MFE_DRAWONLYFORP1) if (viewssnum != 0) @@ -1806,11 +1806,11 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) if (viewssnum != 1) continue; - if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) + if (thing->eflags & MFE_DRAWONLYFORP3 && r_splitscreen > 1) if (viewssnum != 2) continue; - if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) + if (thing->eflags & MFE_DRAWONLYFORP4 && r_splitscreen > 2) if (viewssnum != 3) continue; } diff --git a/src/s_sound.c b/src/s_sound.c index 21b668f28..82435d3dc 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -457,19 +457,19 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) if (players[displayplayers[0]].awayviewtics) listenmobj = players[displayplayers[0]].awayviewmobj; - if (splitscreen) + if (r_splitscreen) { listenmobj2 = players[displayplayers[1]].mo; if (players[displayplayers[1]].awayviewtics) listenmobj2 = players[displayplayers[1]].awayviewmobj; - if (splitscreen > 1) + if (r_splitscreen > 1) { listenmobj3 = players[displayplayers[2]].mo; if (players[displayplayers[2]].awayviewtics) listenmobj3 = players[displayplayers[2]].awayviewmobj; - if (splitscreen > 2) + if (r_splitscreen > 2) { listenmobj4 = players[displayplayers[3]].mo; if (players[displayplayers[3]].awayviewtics) @@ -574,10 +574,10 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) pitch = NORM_PITCH; priority = NORM_PRIORITY; - if (splitscreen && origin) - volume = FixedDiv(volume<>FRACBITS; + if (r_splitscreen && origin) + volume = FixedDiv(volume<>FRACBITS; - if (splitscreen && listenmobj2) // Copy the sound for the split player + if (r_splitscreen && listenmobj2) // Copy the sound for the split player { // Check to see if it is audible, and if not, modify the params if (origin && origin != listenmobj2) @@ -633,7 +633,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) dontplay: - if (splitscreen > 1 && listenmobj3) // Copy the sound for the third player + if (r_splitscreen > 1 && listenmobj3) // Copy the sound for the third player { // Check to see if it is audible, and if not, modify the params if (origin && origin != listenmobj3) @@ -689,7 +689,7 @@ dontplay: dontplay3: - if (splitscreen > 2 && listenmobj4) // Copy the sound for the split player + if (r_splitscreen > 2 && listenmobj4) // Copy the sound for the split player { // Check to see if it is audible, and if not, modify the params if (origin && origin != listenmobj4) @@ -942,19 +942,19 @@ void S_UpdateSounds(void) if (players[displayplayers[0]].awayviewtics) listenmobj = players[displayplayers[0]].awayviewmobj; - if (splitscreen) + if (r_splitscreen) { listenmobj2 = players[displayplayers[1]].mo; if (players[displayplayers[1]].awayviewtics) listenmobj2 = players[displayplayers[1]].awayviewmobj; - if (splitscreen > 1) + if (r_splitscreen > 1) { listenmobj3 = players[displayplayers[2]].mo; if (players[displayplayers[2]].awayviewtics) listenmobj3 = players[displayplayers[2]].awayviewmobj; - if (splitscreen > 2) + if (r_splitscreen > 2) { listenmobj4 = players[displayplayers[3]].mo; if (players[displayplayers[3]].awayviewtics) @@ -1058,24 +1058,24 @@ void S_UpdateSounds(void) pitch = NORM_PITCH; sep = NORM_SEP; - if (splitscreen && c->origin) - volume = FixedDiv(volume<>FRACBITS; + if (r_splitscreen && c->origin) + volume = FixedDiv(volume<>FRACBITS; // check non-local sounds for distance clipping // or modify their params - if (c->origin && ((c->origin != players[consoleplayer].mo) - || (splitscreen && c->origin != players[displayplayers[1]].mo) - || (splitscreen > 1 && c->origin != players[displayplayers[2]].mo) - || (splitscreen > 2 && c->origin != players[displayplayers[3]].mo))) + if (c->origin && ((c->origin != players[displayplayers[0]].mo) + || (r_splitscreen && c->origin != players[displayplayers[1]].mo) + || (r_splitscreen > 1 && c->origin != players[displayplayers[2]].mo) + || (r_splitscreen > 2 && c->origin != players[displayplayers[3]].mo))) { // Whomever is closer gets the sound, but only in splitscreen. - if (splitscreen) + if (r_splitscreen) { const mobj_t *soundmobj = c->origin; fixed_t recdist = -1; INT32 i, p = -1; - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { fixed_t thisdist = -1; @@ -1130,7 +1130,7 @@ void S_UpdateSounds(void) S_StopChannel(cnum); } } - else if (listenmobj && !splitscreen) + else if (listenmobj && !r_splitscreen) { // In the case of a single player, he or she always should get updated sound. audible = S_AdjustSoundParams(listenmobj, c->origin, &volume, &sep, &pitch, @@ -1258,21 +1258,21 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v listensource.z = camera[0].z; listensource.angle = camera[0].angle; } - else if (splitscreen && listener == players[displayplayers[1]].mo && camera[1].chase) + else if (r_splitscreen && listener == players[displayplayers[1]].mo && camera[1].chase) { listensource.x = camera[1].x; listensource.y = camera[1].y; listensource.z = camera[1].z; listensource.angle = camera[1].angle; } - else if (splitscreen > 1 && listener == players[displayplayers[2]].mo && camera[2].chase) + else if (r_splitscreen > 1 && listener == players[displayplayers[2]].mo && camera[2].chase) { listensource.x = camera[2].x; listensource.y = camera[2].y; listensource.z = camera[2].z; listensource.angle = camera[2].angle; } - else if (splitscreen > 2 && listener == players[displayplayers[3]].mo && camera[3].chase) + else if (r_splitscreen > 2 && listener == players[displayplayers[3]].mo && camera[3].chase) { listensource.x = camera[3].x; listensource.y = camera[3].y; @@ -1372,8 +1372,8 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v *vol = (15 * ((S_CLIPPING_DIST - approx_dist)>>FRACBITS)) / S_ATTENUATOR; } - if (splitscreen) - *vol = FixedDiv((*vol)<>FRACBITS; + if (r_splitscreen) + *vol = FixedDiv((*vol)<>FRACBITS; return (*vol > 0); } diff --git a/src/st_stuff.c b/src/st_stuff.c index caed81f3e..280984ca7 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -230,7 +230,7 @@ void ST_doPaletteStuff(void) if (rendermode != render_none) { //V_SetPaletteLump(GetPalette()); // Reset the palette -- is this needed? - if (!splitscreen) + if (!r_splitscreen) V_SetPalette(palette); } } @@ -515,9 +515,9 @@ static INT32 SCR(INT32 r) #define ST_DrawNumFromHud(h,n) V_DrawTallNum(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, n) #define ST_DrawPadNumFromHud(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, n, q) #define ST_DrawPatchFromHud(h,p) V_DrawScaledPatch(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, p) -#define ST_DrawNumFromHudWS(h,n) V_DrawTallNum(SCX(hudinfo[h+!!splitscreen].x), SCY(hudinfo[h+!!splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n) -#define ST_DrawPadNumFromHudWS(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h+!!splitscreen].x), SCY(hudinfo[h+!!splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n, q) -#define ST_DrawPatchFromHudWS(h,p) V_DrawScaledPatch(SCX(hudinfo[h+!!splitscreen].x), SCY(hudinfo[h+!!splitscreen].y), V_NOSCALESTART|V_HUDTRANS, p) +#define ST_DrawNumFromHudWS(h,n) V_DrawTallNum(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n) +#define ST_DrawPadNumFromHudWS(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n, q) +#define ST_DrawPatchFromHudWS(h,p) V_DrawScaledPatch(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_NOSCALESTART|V_HUDTRANS, p) /* // Draw a number, scaled, over the view, maybe with set translucency @@ -757,7 +757,7 @@ static void ST_drawLevelTitle(void) INT32 dupcalc = (vid.width/vid.dupx); UINT8 gtc = G_GetGametypeColor(gametype); INT32 sub = 0; - INT32 bary = (splitscreen) + INT32 bary = (r_splitscreen) ? BASEVIDHEIGHT/2 : 163; INT32 lvlw; @@ -1910,12 +1910,12 @@ static void ST_overlayDrawer(void) else if (!demo.title) { - if (!splitscreen) + if (!r_splitscreen) { V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Viewpoint:")); V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_HUDTRANSHALF|V_ALLOWLOWERCASE, player_names[stplyr-players]); } - else if (splitscreen == 1) + else if (r_splitscreen == 1) { char name[MAXPLAYERNAME+12]; @@ -1923,7 +1923,7 @@ static void ST_overlayDrawer(void) sprintf(name, "VIEWPOINT: %s", player_names[stplyr-players]); V_DrawRightAlignedThinString(BASEVIDWIDTH-40, y, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOBOTTOM|V_SNAPTORIGHT), name); } - else if (splitscreen) + else if (r_splitscreen) { V_DrawCenteredThinString((vid.width/vid.dupx)/4, BASEVIDHEIGHT/2 - 12, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT), player_names[stplyr-players]); } @@ -1998,7 +1998,7 @@ static void ST_overlayDrawer(void) } // SRB2kart: changed positions & text - if (splitscreen) + if (r_splitscreen) { INT32 splitflags = K_calcSplitFlags(0); V_DrawThinString(2, (BASEVIDHEIGHT/2)-20, V_YELLOWMAP|V_HUDTRANSHALF|splitflags, M_GetText("- SPECTATING -")); @@ -2089,7 +2089,7 @@ void ST_Drawer(void) UINT8 i; #ifdef SEENAMES - if (cv_seenames.value && cv_allowseenames.value && displayplayers[0] == consoleplayer && seenplayer && seenplayer->mo && !mapreset) + if (cv_seenames.value && cv_allowseenames.value && displayplayers[localdisplayplayers[0]] == consoleplayer && seenplayer && seenplayer->mo && !mapreset) { if (cv_seenames.value == 1) V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]); @@ -2123,7 +2123,7 @@ void ST_Drawer(void) if (st_overlay) { // No deadview! - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { stplyr = &players[displayplayers[i]]; ST_overlayDrawer(); diff --git a/src/v_video.c b/src/v_video.c index 297eae9c4..55e8e7b90 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2503,15 +2503,15 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param) return; #endif - if (view < 0 || view > 3 || view > splitscreen) + if (view < 0 || view > 3 || view > r_splitscreen) return; - if ((view == 1 && splitscreen == 1) || view >= 2) + if ((view == 1 && r_splitscreen == 1) || view >= 2) yoffset = viewheight; else yoffset = 0; - if ((view == 1 || view == 3) && splitscreen > 1) + if ((view == 1 || view == 3) && r_splitscreen > 1) xoffset = viewwidth; else xoffset = 0; diff --git a/src/y_inter.c b/src/y_inter.c index f5380d565..e27289b87 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -366,7 +366,7 @@ void Y_IntermissionDrawer(void) if (usebuffer) // Fade everything out V_DrawFadeScreen(0xFF00, 22); - if (!splitscreen) + if (!r_splitscreen) whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; if (cons_menuhighlight.value) @@ -1263,19 +1263,19 @@ void Y_VoteDrawer(void) { case 1: thiscurs = cursor2; - p = displayplayers[1]; + p = displayplayers[localdisplayplayers[1]]; break; case 2: thiscurs = cursor3; - p = displayplayers[2]; + p = displayplayers[localdisplayplayers[2]]; break; case 3: thiscurs = cursor4; - p = displayplayers[3]; + p = displayplayers[localdisplayplayers[3]]; break; default: thiscurs = cursor1; - p = displayplayers[0]; + p = displayplayers[localdisplayplayers[0]]; break; } @@ -1563,13 +1563,13 @@ void Y_VoteTicker(void) switch (i) { case 1: - p = displayplayers[1]; + p = displayplayers[localdisplayplayers[1]]; break; case 2: - p = displayplayers[2]; + p = displayplayers[localdisplayplayers[2]]; break; case 3: - p = displayplayers[3]; + p = displayplayers[localdisplayplayers[3]]; break; default: p = consoleplayer; From 46ac563eaf50c3e287d6e64a93da0c78052658b3 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 22 Feb 2020 03:15:44 -0800 Subject: [PATCH 028/117] Implement big bad parties (splitscreen with network players) Use the 'invite' command to invite another player to your party. If that player accepts, via the 'acceptinvite' command, they and any splitscreen players on their machine will be added after the players in your party. They may also use the 'rejectinvite' command. Use the 'leaveparty' command to leave a party. You and any splitscreen players on your machine will be removed from the party. Players after you will be shifted to take your place on the splitscreen. --- src/Makefile | 1 + src/d_clisrv.c | 58 +++++++++++- src/d_clisrv.h | 10 ++ src/d_netcmd.c | 217 +++++++++++++++++++++++++++++++++++++++++++- src/d_netcmd.h | 7 +- src/doomdef.h | 1 + src/doomstat.h | 13 ++- src/g_game.h | 3 + src/g_splitscreen.c | 209 ++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 513 insertions(+), 6 deletions(-) create mode 100644 src/g_splitscreen.c diff --git a/src/Makefile b/src/Makefile index fee849d6c..d0e66e269 100644 --- a/src/Makefile +++ b/src/Makefile @@ -487,6 +487,7 @@ OBJS:=$(i_main_o) \ $(OBJDIR)/f_wipe.o \ $(OBJDIR)/g_game.o \ $(OBJDIR)/g_input.o \ + $(OBJDIR)/g_splitscreen.o\ $(OBJDIR)/am_map.o \ $(OBJDIR)/command.o \ $(OBJDIR)/console.o \ diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a53a61cf0..b397c83ae 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -84,6 +84,8 @@ static boolean serverrunning = false; INT32 serverplayer = 0; char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support) +int playerconsole[MAXPLAYERS]; + // Server specific vars UINT8 playernode[MAXPLAYERS]; @@ -1505,6 +1507,8 @@ static boolean SV_SendServerConfig(INT32 node) UINT8 *p, *op; boolean waspacketsent; + memset(&netbuffer->u.servercfg, 0, sizeof netbuffer->u.servercfg); + netbuffer->packettype = PT_SERVERCFG; netbuffer->u.servercfg.version = VERSION; @@ -1524,7 +1528,6 @@ static boolean SV_SendServerConfig(INT32 node) memset(netbuffer->u.servercfg.playercolor, 0xFF, sizeof(netbuffer->u.servercfg.playercolor)); memset(netbuffer->u.servercfg.adminplayers, -1, sizeof(netbuffer->u.servercfg.adminplayers)); - memset(netbuffer->u.servercfg.powerlevels, 0, sizeof(netbuffer->u.servercfg.powerlevels)); for (i = 0; i < MAXPLAYERS; i++) { @@ -1535,6 +1538,19 @@ static boolean SV_SendServerConfig(INT32 node) if (!playeringame[i]) continue; + netbuffer->u.servercfg.consoleplayers[i] = playerconsole[i]; + netbuffer->u.servercfg.invitations[i] = splitscreen_invitations[i]; + netbuffer->u.servercfg.party_size[i] = splitscreen_party_size[i]; + netbuffer->u.servercfg.original_party_size[i] = + splitscreen_original_party_size[i]; + + for (j = 0; j < MAXSPLITSCREENPLAYERS; ++j) + { + netbuffer->u.servercfg.party[i][j] = splitscreen_party[i][j]; + netbuffer->u.servercfg.original_party[i][j] = + splitscreen_original_party[i][j]; + } + netbuffer->u.servercfg.playerskins[i] = (UINT8)players[i].skin; netbuffer->u.servercfg.playercolor[i] = (UINT8)players[i].skincolor; } @@ -2619,6 +2635,8 @@ static void ResetNode(INT32 node); // void CL_ClearPlayer(INT32 playernum) { + int i; + if (players[playernum].mo) { // Don't leave a NiGHTS ghost! @@ -2626,6 +2644,16 @@ void CL_ClearPlayer(INT32 playernum) P_RemoveMobj(players[playernum].mo->tracer); P_RemoveMobj(players[playernum].mo); } + + for (i = 0; i < MAXPLAYERS; ++i) + { + if (splitscreen_invitations[i] == playernum) + splitscreen_invitations[i] = -1; + } + + splitscreen_invitations[playernum] = -1; + splitscreen_partied[playernum] = false; + memset(&players[playernum], 0, sizeof (player_t)); } @@ -3351,6 +3379,7 @@ void SV_ResetServer(void) sprintf(player_names[i], "Player %d", i + 1); adminplayers[i] = -1; // Populate the entire adminplayers array with -1. K_ClearClientPowerLevels(); + splitscreen_invitations[i] = -1; } mynode = 0; @@ -3455,6 +3484,7 @@ static inline void SV_AddNode(INT32 node) static void Got_AddPlayer(UINT8 **p, INT32 playernum) { INT16 node, newplayernum; + int console; UINT8 splitscreenplayer = 0; UINT8 i; @@ -3475,6 +3505,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) node = (UINT8)READUINT8(*p); newplayernum = (UINT8)READUINT8(*p); + console = (UINT8)READUINT8(*p); splitscreenplayer = (UINT8)READUINT8(*p); CONS_Debug(DBG_NETPLAY, "addplayer: %d %d %d\n", node, newplayernum, splitscreenplayer); @@ -3507,6 +3538,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) displayplayers[i] = newplayernum; localdisplayplayers[i] = i; } + splitscreen_partied[newplayernum] = true; DEBFILE("spawning me\n"); } @@ -3516,6 +3548,12 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) players[newplayernum].splitscreenindex = splitscreenplayer; + playerconsole[newplayernum] = console; + splitscreen_original_party_size[console] = + ++splitscreen_party_size[console]; + splitscreen_original_party[console][splitscreenplayer] = + splitscreen_party[console][splitscreenplayer] = newplayernum; + if (netgame) { if (server && cv_showjoinaddress.value) @@ -3577,7 +3615,7 @@ static boolean SV_AddWaitingPlayers(void) // splitscreen can allow 2+ players in one node for (; nodewaiting[node] > 0; nodewaiting[node]--) { - UINT8 buf[3]; + UINT8 buf[4]; UINT8 *buf_p = buf; newplayer = true; @@ -3614,6 +3652,7 @@ static boolean SV_AddWaitingPlayers(void) else if (playerpernode[node] < 4) nodetoplayer4[node] = newplayernum; + WRITEUINT8(buf_p, nodetoplayer[node]); // consoleplayer WRITEUINT8(buf_p, playerpernode[node]); // splitscreen num playerpernode[node]++; @@ -4141,6 +4180,21 @@ static void HandlePacketFromAwayNode(SINT8 node) adminplayers[j] = netbuffer->u.servercfg.adminplayers[j]; for (k = 0; k < PWRLV_NUMTYPES; k++) clientpowerlevels[j][k] = netbuffer->u.servercfg.powerlevels[j][k]; + + /* all spitscreen related */ + playerconsole[j] = netbuffer->u.servercfg.consoleplayers[j]; + splitscreen_invitations[j] = netbuffer->u.servercfg.invitations[j]; + splitscreen_original_party_size[j] = + netbuffer->u.servercfg.original_party_size[j]; + splitscreen_party_size[j] = + netbuffer->u.servercfg.party_size[j]; + for (k = 0; k < MAXSPLITSCREENPLAYERS; ++k) + { + splitscreen_original_party[j][k] = + netbuffer->u.servercfg.original_party[j][k]; + splitscreen_party[j][k] = + netbuffer->u.servercfg.party[j][k]; + } } memcpy(server_context, netbuffer->u.servercfg.server_context, 8); } diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 0bd85b614..c13df4f5e 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -328,6 +328,14 @@ typedef struct SINT8 adminplayers[MAXPLAYERS]; // Needs to be signed UINT16 powerlevels[MAXPLAYERS][PWRLV_NUMTYPES]; // SRB2kart: player power levels + UINT8 consoleplayers[MAXPLAYERS]; + /* splitscreen */ + SINT8 invitations[MAXPLAYERS]; + UINT8 party_size[MAXPLAYERS]; + UINT8 party[MAXPLAYERS][MAXSPLITSCREENPLAYERS]; + UINT8 original_party_size[MAXPLAYERS]; + UINT8 original_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS]; + char server_context[8]; // Unique context id, generated at server startup. UINT8 varlengthinputs[0]; // Playernames and netvars @@ -599,6 +607,8 @@ SINT8 nametonum(const char *name); extern char motd[254], server_context[8]; extern UINT8 playernode[MAXPLAYERS]; +/* consoleplayer of this player (splitscreen) */ +extern int playerconsole[MAXPLAYERS]; INT32 D_NumPlayers(void); void D_ResetTiccmds(void); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 334509389..51a4b822d 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -63,6 +63,9 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum); static void Got_WeaponPref(UINT8 **cp, INT32 playernum); static void Got_PowerLevel(UINT8 **cp, INT32 playernum); +static void Got_PartyInvite(UINT8 **cp, INT32 playernum); +static void Got_AcceptPartyInvite(UINT8 **cp, INT32 playernum); +static void Got_LeaveParty(UINT8 **cp, INT32 playernum); static void Got_Mapcmd(UINT8 **cp, INT32 playernum); static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum); static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum); @@ -134,6 +137,11 @@ static void Command_ResetCamera_f(void); static void Command_View_f (void); static void Command_SetViews_f(void); +static void Command_Invite_f(void); +static void Command_AcceptInvite_f(void); +static void Command_RejectInvite_f(void); +static void Command_LeaveParty_f(void); + static void Command_Addfile(void); static void Command_ListWADS_f(void); #ifdef DELFILE @@ -544,6 +552,9 @@ void D_RegisterServerCommands(void) RegisterNetXCmd(XD_NAMEANDCOLOR, Got_NameAndColor); RegisterNetXCmd(XD_WEAPONPREF, Got_WeaponPref); RegisterNetXCmd(XD_POWERLEVEL, Got_PowerLevel); + RegisterNetXCmd(XD_PARTYINVITE, Got_PartyInvite); + RegisterNetXCmd(XD_ACCEPTPARTYINVITE, Got_AcceptPartyInvite); + RegisterNetXCmd(XD_LEAVEPARTY, Got_LeaveParty); RegisterNetXCmd(XD_MAP, Got_Mapcmd); RegisterNetXCmd(XD_EXITLEVEL, Got_ExitLevelcmd); RegisterNetXCmd(XD_ADDFILE, Got_Addfilecmd); @@ -753,6 +764,11 @@ void D_RegisterClientCommands(void) COM_AddCommand("changeteam3", Command_Teamchange3_f); COM_AddCommand("changeteam4", Command_Teamchange4_f); + COM_AddCommand("invite", Command_Invite_f); + COM_AddCommand("acceptinvite", Command_AcceptInvite_f); + COM_AddCommand("rejectinvite", Command_RejectInvite_f); + COM_AddCommand("leaveparty", Command_LeaveParty_f); + COM_AddCommand("playdemo", Command_Playdemo_f); COM_AddCommand("timedemo", Command_Timedemo_f); COM_AddCommand("stopdemo", Command_Stopdemo_f); @@ -1942,6 +1958,104 @@ static void Got_PowerLevel(UINT8 **cp,INT32 playernum) CONS_Debug(DBG_GAMELOGIC, "set player %d to power %d\n", playernum, race); } +static void Got_PartyInvite(UINT8 **cp,INT32 playernum) +{ + int invitee; + + boolean kick = false; + + invitee = READUINT8 (*cp); + + if ( + invitee >= 0 && + invitee < MAXPLAYERS && + playeringame[invitee] && + playerconsole[playernum] == playernum/* only consoleplayer may! */ + ){ + invitee = playerconsole[invitee]; + /* you cannot invite yourself or your computer */ + if (invitee == playernum) + kick = true; + } + else + kick = true; + + if (kick) + { + CONS_Alert(CONS_WARNING, M_GetText("Illegal splitscreen invitation received from %s\n"), player_names[playernum]); + if (server) + { + XBOXSTATIC UINT8 buf[2]; + + buf[0] = (UINT8)playernum; + buf[1] = KICK_MSG_CON_FAIL; + SendNetXCmd(XD_KICK, &buf, 2); + } + return; + } + + if (splitscreen_invitations[invitee] < 0) + { + splitscreen_invitations[invitee] = playernum; + + if (invitee == consoleplayer)/* hey that's me! */ + { + CONS_Printf( + "You have been invited to join %s", + player_names[playernum] + ); + if (splitscreen_party_size[playernum] > 1) + { + CONS_Printf( + " and %d others", + ( splitscreen_party_size[playernum] - 1 ) + ); + } + CONS_Printf(".\n"); + } + } +} + +static void Got_AcceptPartyInvite(UINT8 **cp,INT32 playernum) +{ + int invitation; + int old_party_size; + int views; + + if (playerconsole[playernum] != playernum) + { + CONS_Alert(CONS_WARNING, M_GetText("Illegal accept splitscreen invite received from %s\n"), player_names[playernum]); + if (server) + { + XBOXSTATIC UINT8 buf[2]; + + buf[0] = (UINT8)playernum; + buf[1] = KICK_MSG_CON_FAIL; + SendNetXCmd(XD_KICK, &buf, 2); + } + return; + } + + invitation = splitscreen_invitations[playernum]; + + if (invitation >= 0) + { + old_party_size = splitscreen_party_size[invitation]; + views = splitscreen_original_party_size[playernum]; + + if (( old_party_size + views ) <= MAXSPLITSCREENPLAYERS) + { + G_RemovePartyMember(playernum); + G_AddPartyMember(invitation, playernum); + } + } +} + +static void Got_LeaveParty(UINT8 **cp,INT32 playernum) +{ + splitscreen_invitations[playernum] = -1; +} + void D_SendPlayerConfig(void) { SendNameAndColor(); @@ -2182,6 +2296,85 @@ static void Command_SetViews_f(void) } } +static void +Command_Invite_f (void) +{ + UINT8 invitee; + + if (COM_Argc() != 2) + { + CONS_Printf("invite : Invite a player to your party.\n"); + return; + } + + if (r_splitscreen >= MAXSPLITSCREENPLAYERS) + { + CONS_Alert(CONS_WARNING, "Your party is full!\n"); + return; + } + + invitee = LookupPlayer(COM_Argv(1)); + + if (invitee == -1) + { + CONS_Alert(CONS_WARNING, "There is no player by that name!\n"); + return; + } + if (!playeringame[invitee]) + { + CONS_Alert(CONS_WARNING, "There is no player using that slot!\n"); + return; + } + + if (invitee == consoleplayer) + { + CONS_Alert(CONS_WARNING, "You cannot invite yourself! Bruh!\n"); + return; + } + + if (splitscreen_invitations[invitee] >= 0) + { + CONS_Alert(CONS_WARNING, + "That player has already been invited to join another party.\n"); + } + + SendNetXCmd(XD_PARTYINVITE, &invitee, 1); +} + +static boolean +CheckPartyInvite (void) +{ + if (splitscreen_invitations[consoleplayer] < 0) + { + CONS_Alert(CONS_WARNING, "There is no open party invitation.\n"); + return false; + } + return true; +} + +static void +Command_AcceptInvite_f (void) +{ + if (CheckPartyInvite()) + SendNetXCmd(XD_ACCEPTPARTYINVITE, NULL, 0); +} + +static void +Command_RejectInvite_f (void) +{ + if (CheckPartyInvite()) + SendNetXCmd(XD_LEAVEPARTY, NULL, 0); +} + +static void +Command_LeaveParty_f (void) +{ + if (r_splitscreen > splitscreen) + { + SendNetXCmd(XD_LEAVEPARTY, NULL, 0); + } +} + // ======================================================================== // play a demo, add .lmp for external demos @@ -5299,7 +5492,29 @@ static void Got_PickVotecmd(UINT8 **cp, INT32 playernum) */ static void Command_Displayplayer_f(void) { - CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayers[localdisplayplayers[0]]); + int playernum; + int i; + for (i = 0; i <= splitscreen; ++i) + { + playernum = displayplayers[localdisplayplayers[i]]; + CONS_Printf( + "local player %d: \x84(%d) \x83%s\x80\n", + i, + playernum, + player_names[playernum] + ); + } + CONS_Printf("\x83----------------------------------------\x80\n"); + for (i = 0; i <= r_splitscreen; ++i) + { + playernum = displayplayers[i]; + CONS_Printf( + "display player %d: \x84(%d) \x83%s\x80\n", + i, + playernum, + player_names[playernum] + ); + } } /** Quits a game and returns to the title screen. diff --git a/src/d_netcmd.h b/src/d_netcmd.h index d1f28665c..fe1f59ad2 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -179,9 +179,12 @@ typedef enum XD_PICKVOTE, // 24 XD_REMOVEPLAYER,// 25 XD_POWERLEVEL, // 26 + XD_PARTYINVITE, // 27 + XD_ACCEPTPARTYINVITE, // 28 + XD_LEAVEPARTY, // 29 #ifdef HAVE_BLUA - XD_LUACMD, // 27 - XD_LUAVAR, // 28 + XD_LUACMD, // 30 + XD_LUAVAR, // 31 #endif MAXNETXCMD } netxcmd_t; diff --git a/src/doomdef.h b/src/doomdef.h index e1e9ab13d..2aa505744 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -242,6 +242,7 @@ extern FILE *logstream; // NOTE: it needs more than this to increase the number of players... #define MAXPLAYERS 16 +#define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer #define MAXSKINS 128 #define PLAYERSMASK (MAXPLAYERS-1) #define MAXPLAYERNAME 21 diff --git a/src/doomstat.h b/src/doomstat.h index 1d43b4986..fbda4df2a 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -80,7 +80,6 @@ extern boolean multiplayer; extern INT16 gametype; -#define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer extern UINT8 splitscreen; extern int r_splitscreen; @@ -126,6 +125,18 @@ extern INT32 displayplayers[MAXSPLITSCREENPLAYERS]; /* displayplayers[localdisplayplayers[0]] = consoleplayer */ extern INT32 localdisplayplayers[MAXSPLITSCREENPLAYERS]; +/* spitscreen players sync */ +extern int splitscreen_original_party_size[MAXPLAYERS]; +extern int splitscreen_original_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS]; + +/* parties */ +extern int splitscreen_invitations[MAXPLAYERS]; +extern int splitscreen_party_size[MAXPLAYERS]; +extern int splitscreen_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS]; + +/* the only local one */ +extern boolean splitscreen_partied[MAXPLAYERS]; + // Maps of special importance extern INT16 spstage_start; extern INT16 sstage_start; diff --git a/src/g_game.h b/src/g_game.h index de482fe7f..e96c0d480 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -308,6 +308,9 @@ void G_ResetViews(void); void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive); void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive); +void G_AddPartyMember (int party_member, int new_party_member); +void G_RemovePartyMember (int party_member); + void G_AddPlayer(INT32 playernum); void G_SetExitGameFlag(void); diff --git a/src/g_splitscreen.c b/src/g_splitscreen.c new file mode 100644 index 000000000..271a83569 --- /dev/null +++ b/src/g_splitscreen.c @@ -0,0 +1,209 @@ +// SONIC ROBO BLAST 2 KART +//----------------------------------------------------------------------------- +// Copyright (C) 2020 by James R. +// +// This program is free software distributed under the +// terms of the GNU General Public License, version 2. +// See the 'LICENSE' file for more details. +//----------------------------------------------------------------------------- +/// \file g_splitscreen.c +/// \brief some splitscreen stuff + +#include "doomdef.h" +#include "g_game.h" +#include "r_local.h" + +int splitscreen_original_party_size[MAXPLAYERS]; +int splitscreen_original_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS]; + +int splitscreen_invitations[MAXPLAYERS]; +int splitscreen_party_size[MAXPLAYERS]; +int splitscreen_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS]; + +boolean splitscreen_partied[MAXPLAYERS]; + +static void +ResetParty (int playernum) +{ + INT32 old_displayplayers[MAXSPLITSCREENPLAYERS]; + + int i; + + splitscreen_party_size[playernum] = + splitscreen_original_party_size[playernum]; + + memcpy(splitscreen_party[playernum], splitscreen_original_party[playernum], + sizeof splitscreen_party[playernum]); + + if (playernum == consoleplayer) + { + memset(splitscreen_partied, 0, sizeof splitscreen_partied); + splitscreen_partied[consoleplayer] = true; + + memcpy(old_displayplayers, displayplayers, sizeof old_displayplayers); + + /* easier to just rebuild displayplayers with local players */ + for (i = 0; i <= splitscreen; ++i) + { + displayplayers[i] = old_displayplayers[localdisplayplayers[i]]; + localdisplayplayers[i] = i; + } + while (i < MAXSPLITSCREENPLAYERS) + { + displayplayers[i] = consoleplayer; + localdisplayplayers[i] = i; + + i++; + } + + r_splitscreen = splitscreen; + + R_ExecuteSetViewSize(); + } +} + +void +G_RemovePartyMember (int playernum) +{ + int old_party[MAXSPLITSCREENPLAYERS]; + int new_party[MAXSPLITSCREENPLAYERS]; + + int old_party_size; + int before; + int after; + int views; + + int i; + int n; + + old_party_size = splitscreen_party_size[playernum]; + + for (i = 0; i < old_party_size; ++i) + { + /* exploit that splitscreen players keep order */ + if (splitscreen_party[playernum][i] == playernum) + { + before = i; + + views = splitscreen_original_party_size[playernum]; + after = ( before + views ); + + memcpy(old_party, splitscreen_party[playernum], sizeof old_party); + memcpy(new_party, old_party, before * sizeof *old_party); + + while (i < after) + { + splitscreen_partied[old_party[i]] = false; + + i++; + } + + memcpy(&new_party[before], &old_party[after], + ( old_party_size - after ) * sizeof *new_party); + + views = ( old_party_size - views ); + + for (i = 0; i < old_party_size; ++i) + { + n = old_party[i]; + if (n != playernum && playerconsole[n] == n) + { + splitscreen_party_size[n] = views; + memcpy(splitscreen_party[n], new_party, + sizeof splitscreen_party[n]); + } + } + + ResetParty(playernum); + + if (playernum != consoleplayer && splitscreen_partied[playernum]) + { + splitscreen_partied[playernum] = false; + + for (i = 0; i < views; ++i) + { + displayplayers[i] = new_party[i]; + } + while (i < MAXSPLITSCREENPLAYERS) + { + displayplayers[i] = consoleplayer; + + i++; + } + + r_splitscreen = ( views - 1 ); + + R_ExecuteSetViewSize(); + } + + break; + } + } +} + +void +G_AddPartyMember (int invitation, int playernum) +{ + int * party; + int *add_party; + + int old_party_size; + int new_party_size; + + int views; + + int i; + int n; + + views = splitscreen_original_party_size[playernum]; + + old_party_size = splitscreen_party_size[invitation]; + new_party_size = ( old_party_size + views ); + + party = splitscreen_party[invitation]; + add_party = splitscreen_original_party[playernum]; + + for (i = 0; i < old_party_size; ++i) + { + n = party[i]; + if (playerconsole[n] == n) + { + splitscreen_party_size[n] = new_party_size; + memcpy(&splitscreen_party[n][old_party_size], add_party, + views * sizeof *splitscreen_party[n]); + } + } + + splitscreen_party_size[playernum] = new_party_size; + memcpy(splitscreen_party[playernum], party, + sizeof splitscreen_party[playernum]); + + /* in my party or adding me? */ + if (splitscreen_partied[invitation]) + { + for (i = old_party_size; i < new_party_size; ++i) + { + displayplayers[i] = party[i]; + } + + r_splitscreen += views; + + R_ExecuteSetViewSize(); + } + else if (playernum == consoleplayer) + { + for (i = 0; i <= splitscreen; ++i) + { + localdisplayplayers[i] = ( old_party_size + i ); + displayplayers[i] = party[i]; + } + while (++i < new_party_size) + { + displayplayers[i] = party[i]; + } + + r_splitscreen = ( new_party_size - 1 ); + + R_ExecuteSetViewSize(); + } +} From 02757eac82e90a3bca5afc8497ca21f6c05eba3b Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 22 Feb 2020 04:14:28 -0800 Subject: [PATCH 029/117] Fix and fully implement leaving parties --- src/d_clisrv.c | 5 ++++- src/d_netcmd.c | 20 ++++++++++++++++++++ src/g_game.h | 1 + src/g_splitscreen.c | 25 ++++++++++++++----------- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index b397c83ae..aad0f9b1a 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2652,7 +2652,6 @@ void CL_ClearPlayer(INT32 playernum) } splitscreen_invitations[playernum] = -1; - splitscreen_partied[playernum] = false; memset(&players[playernum], 0, sizeof (player_t)); } @@ -2746,6 +2745,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason) RemoveAdminPlayer(playernum); // don't stay admin after you're gone } + G_RemovePartyMember(playernum); + if (playernum == displayplayers[localdisplayplayers[0]] && !demo.playback) displayplayers[localdisplayplayers[0]] = consoleplayer; // don't look through someone's view who isn't there @@ -3382,6 +3383,8 @@ void SV_ResetServer(void) splitscreen_invitations[i] = -1; } + memset(splitscreen_partied, 0, sizeof splitscreen_partied); + mynode = 0; cl_packetmissed = false; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 51a4b822d..e1603bff0 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2053,7 +2053,27 @@ static void Got_AcceptPartyInvite(UINT8 **cp,INT32 playernum) static void Got_LeaveParty(UINT8 **cp,INT32 playernum) { + if (playerconsole[playernum] != playernum) + { + CONS_Alert(CONS_WARNING, M_GetText("Illegal accept splitscreen invite received from %s\n"), player_names[playernum]); + if (server) + { + XBOXSTATIC UINT8 buf[2]; + + buf[0] = (UINT8)playernum; + buf[1] = KICK_MSG_CON_FAIL; + SendNetXCmd(XD_KICK, &buf, 2); + } + return; + } + splitscreen_invitations[playernum] = -1; + if (splitscreen_party_size[playernum] > + splitscreen_original_party_size[playernum]) + { + G_RemovePartyMember(playernum); + G_ResetSplitscreen(playernum); + } } void D_SendPlayerConfig(void) diff --git a/src/g_game.h b/src/g_game.h index e96c0d480..de88d6bdc 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -310,6 +310,7 @@ void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive); void G_AddPartyMember (int party_member, int new_party_member); void G_RemovePartyMember (int party_member); +void G_ResetSplitscreen (int playernum); void G_AddPlayer(INT32 playernum); diff --git a/src/g_splitscreen.c b/src/g_splitscreen.c index 271a83569..3ff71e627 100644 --- a/src/g_splitscreen.c +++ b/src/g_splitscreen.c @@ -22,8 +22,8 @@ int splitscreen_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS]; boolean splitscreen_partied[MAXPLAYERS]; -static void -ResetParty (int playernum) +void +G_ResetSplitscreen (int playernum) { INT32 old_displayplayers[MAXSPLITSCREENPLAYERS]; @@ -91,16 +91,16 @@ G_RemovePartyMember (int playernum) memcpy(old_party, splitscreen_party[playernum], sizeof old_party); memcpy(new_party, old_party, before * sizeof *old_party); - while (i < after) - { - splitscreen_partied[old_party[i]] = false; - - i++; - } - memcpy(&new_party[before], &old_party[after], ( old_party_size - after ) * sizeof *new_party); + if (splitscreen_partied[playernum] && + localdisplayplayers[0] >= after) + { + for (i = 0; i < MAXSPLITSCREENPLAYERS; ++i) + localdisplayplayers[i] -= views; + } + views = ( old_party_size - views ); for (i = 0; i < old_party_size; ++i) @@ -114,8 +114,7 @@ G_RemovePartyMember (int playernum) } } - ResetParty(playernum); - + /* don't want to remove yourself from your own screen! */ if (playernum != consoleplayer && splitscreen_partied[playernum]) { splitscreen_partied[playernum] = false; @@ -181,6 +180,8 @@ G_AddPartyMember (int invitation, int playernum) /* in my party or adding me? */ if (splitscreen_partied[invitation]) { + splitscreen_partied[playernum] = true; + for (i = old_party_size; i < new_party_size; ++i) { displayplayers[i] = party[i]; @@ -192,6 +193,8 @@ G_AddPartyMember (int invitation, int playernum) } else if (playernum == consoleplayer) { + splitscreen_partied[invitation] = true; + for (i = 0; i <= splitscreen; ++i) { localdisplayplayers[i] = ( old_party_size + i ); From 110871c3b6a8c76339aaaca94881aad640609a1c Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 22 Feb 2020 04:16:08 -0800 Subject: [PATCH 030/117] Void the party invitation once its accepted --- src/d_netcmd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index e1603bff0..8c9be30d6 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2048,6 +2048,8 @@ static void Got_AcceptPartyInvite(UINT8 **cp,INT32 playernum) G_RemovePartyMember(playernum); G_AddPartyMember(invitation, playernum); } + + splitscreen_invitations[playernum] = -1; } } @@ -2068,6 +2070,7 @@ static void Got_LeaveParty(UINT8 **cp,INT32 playernum) } splitscreen_invitations[playernum] = -1; + if (splitscreen_party_size[playernum] > splitscreen_original_party_size[playernum]) { From e235267f1d625e88caf593874be51dc291f32a7b Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 22 Feb 2020 04:59:21 -0800 Subject: [PATCH 031/117] Improve feedback on party invitations --- src/d_netcmd.c | 103 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 91 insertions(+), 12 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 8c9be30d6..a2e566d63 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1318,6 +1318,38 @@ static void ForceAllSkins(INT32 forcedskin) } } +static const char * +VaguePartyDescription (int playernum, int *party_sizes, int default_color) +{ + static char description[1 + MAXPLAYERNAME + 1 + sizeof " and x others"]; + const char *name; + int size; + name = player_names[playernum]; + size = party_sizes[playernum]; + /* + less than check for the dumb compiler because I KNOW it'll + complain about "writing x bytes into an area of y bytes"!!! + */ + if (size > 1 && size <= MAXSPLITSCREENPLAYERS) + { + sprintf(description, + "\x83%s%c and %d others", + name, + ( size - 1 ), + default_color + ); + } + else + { + sprintf(description, + "\x83%s%c", + name, + default_color + ); + } + return description; +} + static INT32 snacpending = 0, snac2pending = 0, snac3pending = 0, snac4pending = 0, chmappending = 0; // name, color, or skin has changed @@ -2000,18 +2032,11 @@ static void Got_PartyInvite(UINT8 **cp,INT32 playernum) if (invitee == consoleplayer)/* hey that's me! */ { - CONS_Printf( - "You have been invited to join %s", - player_names[playernum] - ); - if (splitscreen_party_size[playernum] > 1) - { - CONS_Printf( - " and %d others", - ( splitscreen_party_size[playernum] - 1 ) - ); - } - CONS_Printf(".\n"); + HU_AddChatText(va( + "\x82*You have been invited to join %s.", + VaguePartyDescription( + playernum, splitscreen_party_size, '\x82') + ), true); } } } @@ -2040,6 +2065,23 @@ static void Got_AcceptPartyInvite(UINT8 **cp,INT32 playernum) if (invitation >= 0) { + if (splitscreen_partied[invitation]) + { + HU_AddChatText(va( + "\x82*%s has joined your party!", + VaguePartyDescription( + playernum, splitscreen_original_party_size, '\x82') + ), true); + } + else if (playernum == consoleplayer) + { + HU_AddChatText(va( + "\x82*You joined %s's party!", + VaguePartyDescription( + invitation, splitscreen_party_size, '\x82') + ), true); + } + old_party_size = splitscreen_party_size[invitation]; views = splitscreen_original_party_size[playernum]; @@ -2069,11 +2111,28 @@ static void Got_LeaveParty(UINT8 **cp,INT32 playernum) return; } + if (consoleplayer == splitscreen_invitations[playernum]) + { + HU_AddChatText(va( + "\x85*\x83%s\x85 rejected your invitation.", + player_names[playernum] + ), true); + } + splitscreen_invitations[playernum] = -1; if (splitscreen_party_size[playernum] > splitscreen_original_party_size[playernum]) { + if (splitscreen_partied[playernum] && playernum != consoleplayer) + { + HU_AddChatText(va( + "\x85*%s left your party.", + VaguePartyDescription( + playernum, splitscreen_original_party_size, '\x85') + ), true); + } + G_RemovePartyMember(playernum); G_ResetSplitscreen(playernum); } @@ -2361,6 +2420,20 @@ Command_Invite_f (void) "That player has already been invited to join another party.\n"); } + if (( splitscreen_party_size[consoleplayer] + + splitscreen_original_party_size[invitee] ) > MAXSPLITSCREENPLAYERS) + { + CONS_Alert(CONS_WARNING, + "That player joined with too many " + "splitscreen players for your party.\n"); + } + + CONS_Printf( + "Inviting %s...\n", + VaguePartyDescription( + invitee, splitscreen_original_party_size, '\x80') + ); + SendNetXCmd(XD_PARTYINVITE, &invitee, 1); } @@ -2386,7 +2459,11 @@ static void Command_RejectInvite_f (void) { if (CheckPartyInvite()) + { + CONS_Printf("\x85Rejecting invite...\n"); + SendNetXCmd(XD_LEAVEPARTY, NULL, 0); + } } static void @@ -2394,6 +2471,8 @@ Command_LeaveParty_f (void) { if (r_splitscreen > splitscreen) { + CONS_Printf("\x85Leaving party...\n"); + SendNetXCmd(XD_LEAVEPARTY, NULL, 0); } } From 06cee4a0b75e334fffb36e929c3fa5ba7fc4df44 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 22 Feb 2020 05:12:29 -0800 Subject: [PATCH 032/117] Fix camera angle of party players --- src/d_clisrv.c | 3 ++- src/g_splitscreen.c | 3 ++- src/p_user.c | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index aad0f9b1a..7c3f1aa30 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3529,6 +3529,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) if (splitscreenplayer) { displayplayers[splitscreenplayer] = newplayernum; + localdisplayplayers[splitscreenplayer] = splitscreenplayer; DEBFILE(va("spawning sister # %d\n", splitscreenplayer)); if (splitscreenplayer == 1 && botingame) players[newplayernum].bot = 1; @@ -3539,7 +3540,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { displayplayers[i] = newplayernum; - localdisplayplayers[i] = i; + localdisplayplayers[i] = 0; } splitscreen_partied[newplayernum] = true; DEBFILE("spawning me\n"); diff --git a/src/g_splitscreen.c b/src/g_splitscreen.c index 3ff71e627..039eb02bf 100644 --- a/src/g_splitscreen.c +++ b/src/g_splitscreen.c @@ -51,7 +51,7 @@ G_ResetSplitscreen (int playernum) while (i < MAXSPLITSCREENPLAYERS) { displayplayers[i] = consoleplayer; - localdisplayplayers[i] = i; + localdisplayplayers[i] = 0; i++; } @@ -203,6 +203,7 @@ G_AddPartyMember (int invitation, int playernum) while (++i < new_party_size) { displayplayers[i] = party[i]; + localdisplayplayers[i] = old_party_size; } r_splitscreen = ( new_party_size - 1 ); diff --git a/src/p_user.c b/src/p_user.c index bb9eae095..581085d75 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7339,17 +7339,17 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall focusangle = localangle[0]; focusaiming = localaiming[0]; } - else if (player == &players[displayplayers[1]]) + else if (player == &players[displayplayers[localdisplayplayers[1]]]) { focusangle = localangle[1]; focusaiming = localaiming[1]; } - else if (player == &players[displayplayers[2]]) + else if (player == &players[displayplayers[localdisplayplayers[2]]]) { focusangle = localangle[2]; focusaiming = localaiming[2]; } - else if (player == &players[displayplayers[3]]) + else if (player == &players[displayplayers[localdisplayplayers[3]]]) { focusangle = localangle[3]; focusaiming = localaiming[3]; From a55ccbe52c9eeb7707d5eac256b3bcea42c3f37b Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 16:04:40 -0800 Subject: [PATCH 033/117] Maybe fix incorrect displayplayers after adding/removing from party --- src/g_splitscreen.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/g_splitscreen.c b/src/g_splitscreen.c index 039eb02bf..6f5a69297 100644 --- a/src/g_splitscreen.c +++ b/src/g_splitscreen.c @@ -94,11 +94,13 @@ G_RemovePartyMember (int playernum) memcpy(&new_party[before], &old_party[after], ( old_party_size - after ) * sizeof *new_party); - if (splitscreen_partied[playernum] && - localdisplayplayers[0] >= after) + if (splitscreen_partied[playernum]) { - for (i = 0; i < MAXSPLITSCREENPLAYERS; ++i) + for (i = 0; i < MAXSPLITSCREENPLAYERS && + localdisplayplayers[i] >= after; ++i) + { localdisplayplayers[i] -= views; + } } views = ( old_party_size - views ); @@ -205,6 +207,13 @@ G_AddPartyMember (int invitation, int playernum) displayplayers[i] = party[i]; localdisplayplayers[i] = old_party_size; } + while (i < MAXSPLITSCREENPLAYERS) + { + displayplayers[i] = consoleplayer; + localdisplayplayers[i] = old_party_size; + + i++; + } r_splitscreen = ( new_party_size - 1 ); From c8524b47e7ba15dd323e803bbabca30d801b5bf2 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 16:05:22 -0800 Subject: [PATCH 034/117] Fix VIEWPOINT annotation showing up in parties --- src/p_user.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 581085d75..f7477ecfc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1488,11 +1488,19 @@ boolean P_IsLocalPlayer(player_t *player) { UINT8 i; - if (player == &players[consoleplayer]) - return true; - else if (r_splitscreen) + if (r_splitscreen > splitscreen) { - for (i = 1; i <= r_splitscreen; i++) // Skip P1 + for (i = 0; i <= r_splitscreen; ++i) + { + if (player == &players[displayplayers[i]]) + return true; + } + } + else if (player == &players[consoleplayer]) + return true; + else if (splitscreen) + { + for (i = 1; i <= splitscreen; i++) // Skip P1 { if (player == &players[displayplayers[i]]) return true; From 1e89d512a73b9bcf055d94d6f678c072732a8609 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 18:06:48 -0800 Subject: [PATCH 035/117] Fix spectator join black screen --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index f7477ecfc..6a660f20f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7893,8 +7893,8 @@ boolean P_SpectatorJoinGame(player_t *player) player->playerstate = PST_REBORN; //Reset away view - if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer) - displayplayers[0] = consoleplayer; + if (P_IsLocalPlayer(player) && displayplayers[localdisplayplayers[0]] != consoleplayer) + displayplayers[localdisplayplayers[0]] = consoleplayer; HU_AddChatText(va(M_GetText("\x82*%s entered the game."), player_names[player-players]), false); return true; // no more player->mo, cannot continue. From 4f40edaf01ce104265b4b942ba8182e1e113f6a2 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 18:20:55 -0800 Subject: [PATCH 036/117] Maybe localdisplayplayers is a bad idea --- src/d_clisrv.c | 9 ++- src/d_main.c | 2 +- src/d_netcmd.c | 134 +++++++++++++++++++++---------------------- src/doomstat.h | 4 +- src/g_game.c | 52 ++++++++--------- src/g_splitscreen.c | 22 +------ src/k_kart.c | 2 +- src/lua_consolelib.c | 2 +- src/m_menu.c | 12 ++-- src/m_misc.c | 10 ++-- src/p_floor.c | 16 +++--- src/p_inter.c | 12 ++-- src/p_mobj.c | 28 ++++----- src/p_setup.c | 26 ++++----- src/p_user.c | 10 ++-- src/st_stuff.c | 2 +- src/y_inter.c | 14 ++--- 17 files changed, 169 insertions(+), 188 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 7c3f1aa30..a6190a0dc 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2747,8 +2747,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason) G_RemovePartyMember(playernum); - if (playernum == displayplayers[localdisplayplayers[0]] && !demo.playback) - displayplayers[localdisplayplayers[0]] = consoleplayer; // don't look through someone's view who isn't there + if (playernum == g_localplayers[0] && !demo.playback) + g_localplayers[0] = consoleplayer; // don't look through someone's view who isn't there #ifdef HAVE_BLUA LUA_InvalidatePlayer(&players[playernum]); @@ -3529,7 +3529,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) if (splitscreenplayer) { displayplayers[splitscreenplayer] = newplayernum; - localdisplayplayers[splitscreenplayer] = splitscreenplayer; + g_localplayers[splitscreenplayer] = newplayernum; DEBFILE(va("spawning sister # %d\n", splitscreenplayer)); if (splitscreenplayer == 1 && botingame) players[newplayernum].bot = 1; @@ -3540,7 +3540,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { displayplayers[i] = newplayernum; - localdisplayplayers[i] = 0; + g_localplayers[i] = newplayernum; } splitscreen_partied[newplayernum] = true; DEBFILE("spawning me\n"); @@ -3751,7 +3751,6 @@ void SV_StopServer(void) D_Clearticcmd(i); consoleplayer = 0; - localdisplayplayers[0] = 0; cl_mode = CL_SEARCHING; maketic = gametic+1; neededtic = maketic; diff --git a/src/d_main.c b/src/d_main.c index e0ba654ad..8a01ec45e 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -780,7 +780,7 @@ void D_StartTitle(void) gameaction = ga_nothing; memset(displayplayers, 0, sizeof(displayplayers)); - memset(localdisplayplayers, 0, sizeof localdisplayplayers); + memset(g_localplayers, 0, sizeof g_localplayers); consoleplayer = 0; //demosequence = -1; gametype = GT_RACE; // SRB2kart diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a2e566d63..fa10c1640 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1196,11 +1196,11 @@ static void CleanupPlayerName(INT32 playernum, const char *newname) // spaces may have been removed if (playernum == consoleplayer) CV_StealthSet(&cv_playername, tmpname); - else if (playernum == displayplayers[localdisplayplayers[1]] || (!netgame && playernum == 1)) + else if (playernum == g_localplayers[1] || (!netgame && playernum == 1)) CV_StealthSet(&cv_playername2, tmpname); - else if (playernum == displayplayers[localdisplayplayers[2]] || (!netgame && playernum == 2)) + else if (playernum == g_localplayers[2] || (!netgame && playernum == 2)) CV_StealthSet(&cv_playername3, tmpname); - else if (playernum == displayplayers[localdisplayplayers[3]] || (!netgame && playernum == 3)) + else if (playernum == g_localplayers[3] || (!netgame && playernum == 3)) CV_StealthSet(&cv_playername4, tmpname); else I_Assert(((void)"CleanupPlayerName used on non-local player", 0)); @@ -1308,11 +1308,11 @@ static void ForceAllSkins(INT32 forcedskin) { if (i == consoleplayer) CV_StealthSet(&cv_skin, skins[forcedskin].name); - else if (i == displayplayers[localdisplayplayers[1]]) + else if (i == g_localplayers[1]) CV_StealthSet(&cv_skin2, skins[forcedskin].name); - else if (i == displayplayers[localdisplayplayers[2]]) + else if (i == g_localplayers[2]) CV_StealthSet(&cv_skin3, skins[forcedskin].name); - else if (i == displayplayers[localdisplayplayers[3]]) + else if (i == g_localplayers[3]) CV_StealthSet(&cv_skin4, skins[forcedskin].name); } } @@ -1479,8 +1479,8 @@ static void SendNameAndColor2(void) if (splitscreen < 1 && !botingame) return; // can happen if skin2/color2/name2 changed - if (displayplayers[localdisplayplayers[1]] != consoleplayer) - secondplaya = displayplayers[localdisplayplayers[1]]; + if (g_localplayers[1] != consoleplayer) + secondplaya = g_localplayers[1]; else if (!netgame) // HACK secondplaya = 1; @@ -1568,14 +1568,14 @@ static void SendNameAndColor2(void) snac2pending++; // Don't change name if muted - if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[1]]))) - CV_StealthSet(&cv_playername2, player_names[displayplayers[localdisplayplayers[1]]]); + if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[1]))) + CV_StealthSet(&cv_playername2, player_names[g_localplayers[1]]); else // Cleanup name if changing it - CleanupPlayerName(displayplayers[localdisplayplayers[1]], cv_playername2.zstring); + CleanupPlayerName(g_localplayers[1], cv_playername2.zstring); // Don't change skin if the server doesn't want you to. - if (!CanChangeSkin(displayplayers[localdisplayplayers[1]])) - CV_StealthSet(&cv_skin2, skins[players[displayplayers[localdisplayplayers[1]]].skin].name); + if (!CanChangeSkin(g_localplayers[1])) + CV_StealthSet(&cv_skin2, skins[players[g_localplayers[1]].skin].name); // check if player has the skin loaded (cv_skin2 may have // the name of a skin that was available in the previous game) @@ -1602,8 +1602,8 @@ static void SendNameAndColor3(void) if (splitscreen < 2) return; // can happen if skin3/color3/name3 changed - if (displayplayers[localdisplayplayers[2]] != consoleplayer) - thirdplaya = displayplayers[localdisplayplayers[2]]; + if (g_localplayers[2] != consoleplayer) + thirdplaya = g_localplayers[2]; else if (!netgame) // HACK thirdplaya = 2; @@ -1683,14 +1683,14 @@ static void SendNameAndColor3(void) snac3pending++; // Don't change name if muted - if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[2]]))) - CV_StealthSet(&cv_playername3, player_names[displayplayers[localdisplayplayers[2]]]); + if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[2]))) + CV_StealthSet(&cv_playername3, player_names[g_localplayers[2]]); else // Cleanup name if changing it - CleanupPlayerName(displayplayers[localdisplayplayers[2]], cv_playername3.zstring); + CleanupPlayerName(g_localplayers[2], cv_playername3.zstring); // Don't change skin if the server doesn't want you to. - if (!CanChangeSkin(displayplayers[localdisplayplayers[2]])) - CV_StealthSet(&cv_skin3, skins[players[displayplayers[localdisplayplayers[2]]].skin].name); + if (!CanChangeSkin(g_localplayers[2])) + CV_StealthSet(&cv_skin3, skins[players[g_localplayers[2]].skin].name); // check if player has the skin loaded (cv_skin3 may have // the name of a skin that was available in the previous game) @@ -1717,8 +1717,8 @@ static void SendNameAndColor4(void) if (splitscreen < 3) return; // can happen if skin4/color4/name4 changed - if (displayplayers[localdisplayplayers[3]] != consoleplayer) - fourthplaya = displayplayers[localdisplayplayers[3]]; + if (g_localplayers[3] != consoleplayer) + fourthplaya = g_localplayers[3]; else if (!netgame) // HACK fourthplaya = 3; @@ -1806,14 +1806,14 @@ static void SendNameAndColor4(void) snac4pending++; // Don't change name if muted - if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[3]]))) - CV_StealthSet(&cv_playername4, player_names[displayplayers[localdisplayplayers[3]]]); + if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[3]))) + CV_StealthSet(&cv_playername4, player_names[g_localplayers[3]]); else // Cleanup name if changing it - CleanupPlayerName(displayplayers[localdisplayplayers[3]], cv_playername4.zstring); + CleanupPlayerName(g_localplayers[3], cv_playername4.zstring); // Don't change skin if the server doesn't want you to. - if (!CanChangeSkin(displayplayers[localdisplayplayers[3]])) - CV_StealthSet(&cv_skin4, skins[players[displayplayers[localdisplayplayers[3]]].skin].name); + if (!CanChangeSkin(g_localplayers[3])) + CV_StealthSet(&cv_skin4, skins[players[g_localplayers[3]].skin].name); // check if player has the skin loaded (cv_skin4 may have // the name of a skin that was available in the previous game) @@ -1844,11 +1844,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) if (playernum == consoleplayer) snacpending--; // TODO: make snacpending an array instead of 4 separate vars? - else if (playernum == displayplayers[localdisplayplayers[1]]) + else if (playernum == g_localplayers[1]) snac2pending--; - else if (playernum == displayplayers[localdisplayplayers[2]]) + else if (playernum == g_localplayers[2]) snac3pending--; - else if (playernum == displayplayers[localdisplayplayers[3]]) + else if (playernum == g_localplayers[3]) snac4pending--; #ifdef PARANOIA @@ -1871,8 +1871,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) demo_extradata[playernum] |= DXD_COLOR; // normal player colors - if (server && (p != &players[consoleplayer] && p != &players[displayplayers[localdisplayplayers[1]]] - && p != &players[displayplayers[localdisplayplayers[2]]] && p != &players[displayplayers[localdisplayplayers[3]]])) + if (server && (p != &players[consoleplayer] && p != &players[g_localplayers[1]] + && p != &players[g_localplayers[2]] && p != &players[g_localplayers[3]])) { boolean kick = false; @@ -1909,11 +1909,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) if (playernum == consoleplayer) CV_StealthSet(&cv_skin, skins[forcedskin].name); - else if (playernum == displayplayers[localdisplayplayers[1]]) + else if (playernum == g_localplayers[1]) CV_StealthSet(&cv_skin2, skins[forcedskin].name); - else if (playernum == displayplayers[localdisplayplayers[2]]) + else if (playernum == g_localplayers[2]) CV_StealthSet(&cv_skin3, skins[forcedskin].name); - else if (playernum == displayplayers[localdisplayplayers[3]]) + else if (playernum == g_localplayers[3]) CV_StealthSet(&cv_skin4, skins[forcedskin].name); } else @@ -2184,7 +2184,7 @@ void D_SendPlayerConfig(void) // Only works for displayplayer, sorry! static void Command_ResetCamera_f(void) { - P_ResetCamera(&players[displayplayers[localdisplayplayers[0]]], &camera[0]); + P_ResetCamera(&players[g_localplayers[0]], &camera[0]); } /* Consider replacing nametonum with this */ @@ -2721,7 +2721,7 @@ void D_ModifyClientVote(SINT8 voted, UINT8 splitplayer) UINT8 player = consoleplayer; if (splitplayer > 0) - player = displayplayers[localdisplayplayers[splitplayer]]; + player = g_localplayers[splitplayer]; WRITESINT8(p, voted); WRITEUINT8(p, player); @@ -3373,11 +3373,11 @@ static void Command_Teamchange2_f(void) return; } - if (players[displayplayers[localdisplayplayers[1]]].spectator) - error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[1]]].pflags & PF_WANTSTOJOIN)); + if (players[g_localplayers[1]].spectator) + error = !(NetPacket.packet.newteam || (players[g_localplayers[1]].pflags & PF_WANTSTOJOIN)); else if (G_GametypeHasTeams()) - error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[1]]].ctfteam); - else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[1]]].spectator) + error = (NetPacket.packet.newteam == (unsigned)players[g_localplayers[1]].ctfteam); + else if (G_GametypeHasSpectators() && !players[g_localplayers[1]].spectator) error = (NetPacket.packet.newteam == 3); #ifdef PARANOIA else @@ -3464,11 +3464,11 @@ static void Command_Teamchange3_f(void) return; } - if (players[displayplayers[localdisplayplayers[2]]].spectator) - error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[2]]].pflags & PF_WANTSTOJOIN)); + if (players[g_localplayers[2]].spectator) + error = !(NetPacket.packet.newteam || (players[g_localplayers[2]].pflags & PF_WANTSTOJOIN)); else if (G_GametypeHasTeams()) - error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[2]]].ctfteam); - else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[2]]].spectator) + error = (NetPacket.packet.newteam == (unsigned)players[g_localplayers[2]].ctfteam); + else if (G_GametypeHasSpectators() && !players[g_localplayers[2]].spectator) error = (NetPacket.packet.newteam == 3); #ifdef PARANOIA else @@ -3555,11 +3555,11 @@ static void Command_Teamchange4_f(void) return; } - if (players[displayplayers[localdisplayplayers[3]]].spectator) - error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[3]]].pflags & PF_WANTSTOJOIN)); + if (players[g_localplayers[3]].spectator) + error = !(NetPacket.packet.newteam || (players[g_localplayers[3]].pflags & PF_WANTSTOJOIN)); else if (G_GametypeHasTeams()) - error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[3]]].ctfteam); - else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[3]]].spectator) + error = (NetPacket.packet.newteam == (unsigned)players[g_localplayers[3]].ctfteam); + else if (G_GametypeHasSpectators() && !players[g_localplayers[3]].spectator) error = (NetPacket.packet.newteam == 3); #ifdef PARANOIA else @@ -3956,8 +3956,8 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame //reset view if you are changed, or viewing someone who was changed. - if (playernum == consoleplayer || displayplayers[localdisplayplayers[0]] == playernum) - displayplayers[localdisplayplayers[0]] = consoleplayer; + if (playernum == consoleplayer || g_localplayers[0] == playernum) + g_localplayers[0] = consoleplayer; if (G_GametypeHasTeams()) { @@ -5598,7 +5598,7 @@ static void Command_Displayplayer_f(void) int i; for (i = 0; i <= splitscreen; ++i) { - playernum = displayplayers[localdisplayplayers[i]]; + playernum = g_localplayers[i]; CONS_Printf( "local player %d: \x84(%d) \x83%s\x80\n", i, @@ -5811,7 +5811,7 @@ static void Name2_OnChange(void) if (cv_mute.value) //Secondary player can't be admin. { CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n")); - CV_StealthSet(&cv_playername2, player_names[displayplayers[localdisplayplayers[1]]]); + CV_StealthSet(&cv_playername2, player_names[g_localplayers[1]]); } else SendNameAndColor2(); @@ -5822,7 +5822,7 @@ static void Name3_OnChange(void) if (cv_mute.value) //Third player can't be admin. { CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n")); - CV_StealthSet(&cv_playername3, player_names[displayplayers[localdisplayplayers[2]]]); + CV_StealthSet(&cv_playername3, player_names[g_localplayers[2]]); } else SendNameAndColor3(); @@ -5833,7 +5833,7 @@ static void Name4_OnChange(void) if (cv_mute.value) //Secondary player can't be admin. { CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n")); - CV_StealthSet(&cv_playername4, player_names[displayplayers[localdisplayplayers[3]]]); + CV_StealthSet(&cv_playername4, player_names[g_localplayers[3]]); } else SendNameAndColor4(); @@ -5874,12 +5874,12 @@ static void Skin2_OnChange(void) if (!Playing() || !splitscreen) return; // do whatever you want - if (CanChangeSkin(displayplayers[localdisplayplayers[1]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[1]])) + if (CanChangeSkin(g_localplayers[1]) && !P_PlayerMoving(g_localplayers[1])) SendNameAndColor2(); else { CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n")); - CV_StealthSet(&cv_skin2, skins[players[displayplayers[localdisplayplayers[1]]].skin].name); + CV_StealthSet(&cv_skin2, skins[players[g_localplayers[1]].skin].name); } } @@ -5888,12 +5888,12 @@ static void Skin3_OnChange(void) if (!Playing() || splitscreen < 2) return; // do whatever you want - if (CanChangeSkin(displayplayers[localdisplayplayers[2]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[2]])) + if (CanChangeSkin(g_localplayers[2]) && !P_PlayerMoving(g_localplayers[2])) SendNameAndColor3(); else { CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n")); - CV_StealthSet(&cv_skin3, skins[players[displayplayers[localdisplayplayers[2]]].skin].name); + CV_StealthSet(&cv_skin3, skins[players[g_localplayers[2]].skin].name); } } @@ -5902,12 +5902,12 @@ static void Skin4_OnChange(void) if (!Playing() || splitscreen < 3) return; // do whatever you want - if (CanChangeSkin(displayplayers[localdisplayplayers[3]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[3]])) + if (CanChangeSkin(g_localplayers[3]) && !P_PlayerMoving(g_localplayers[3])) SendNameAndColor4(); else { CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n")); - CV_StealthSet(&cv_skin4, skins[players[displayplayers[localdisplayplayers[3]]].skin].name); + CV_StealthSet(&cv_skin4, skins[players[g_localplayers[3]].skin].name); } } @@ -5948,7 +5948,7 @@ static void Color2_OnChange(void) if (!Playing() || !splitscreen) return; // do whatever you want - if (!P_PlayerMoving(displayplayers[localdisplayplayers[1]])) + if (!P_PlayerMoving(g_localplayers[1])) { // Color change menu scrolling fix is no longer necessary SendNameAndColor2(); @@ -5956,7 +5956,7 @@ static void Color2_OnChange(void) else { CV_StealthSetValue(&cv_playercolor2, - players[displayplayers[localdisplayplayers[1]]].skincolor); + players[g_localplayers[1]].skincolor); } } @@ -5965,7 +5965,7 @@ static void Color3_OnChange(void) if (!Playing() || splitscreen < 2) return; // do whatever you want - if (!P_PlayerMoving(displayplayers[localdisplayplayers[2]])) + if (!P_PlayerMoving(g_localplayers[2])) { // Color change menu scrolling fix is no longer necessary SendNameAndColor3(); @@ -5973,7 +5973,7 @@ static void Color3_OnChange(void) else { CV_StealthSetValue(&cv_playercolor3, - players[displayplayers[localdisplayplayers[2]]].skincolor); + players[g_localplayers[2]].skincolor); } } @@ -5982,7 +5982,7 @@ static void Color4_OnChange(void) if (!Playing() || splitscreen < 3) return; // do whatever you want - if (!P_PlayerMoving(displayplayers[localdisplayplayers[3]])) + if (!P_PlayerMoving(g_localplayers[3])) { // Color change menu scrolling fix is no longer necessary SendNameAndColor4(); @@ -5990,7 +5990,7 @@ static void Color4_OnChange(void) else { CV_StealthSetValue(&cv_playercolor4, - players[displayplayers[localdisplayplayers[3]]].skincolor); + players[g_localplayers[3]].skincolor); } } diff --git a/src/doomstat.h b/src/doomstat.h index fbda4df2a..675f79d38 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -122,8 +122,8 @@ extern boolean gamedataloaded; // Player taking events, and displaying. extern INT32 consoleplayer; extern INT32 displayplayers[MAXSPLITSCREENPLAYERS]; -/* displayplayers[localdisplayplayers[0]] = consoleplayer */ -extern INT32 localdisplayplayers[MAXSPLITSCREENPLAYERS]; +/* g_localplayers[0] = consoleplayer */ +extern INT32 g_localplayers[MAXSPLITSCREENPLAYERS]; /* spitscreen players sync */ extern int splitscreen_original_party_size[MAXPLAYERS]; diff --git a/src/g_game.c b/src/g_game.c index 871eafaab..ffb75f3fb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -115,7 +115,7 @@ player_t players[MAXPLAYERS]; INT32 consoleplayer; // player taking events and displaying INT32 displayplayers[MAXSPLITSCREENPLAYERS]; // view being displayed -INT32 localdisplayplayers[MAXSPLITSCREENPLAYERS]; +INT32 g_localplayers[MAXSPLITSCREENPLAYERS]; tic_t gametic; tic_t levelstarttic; // gametic at level start @@ -1257,7 +1257,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (ssplayer == 1) player = &players[consoleplayer]; else - player = &players[displayplayers[localdisplayplayers[ssplayer-1]]]; + player = &players[g_localplayers[ssplayer-1]]; if (ssplayer == 2) thiscam = (player->bot == 2 ? &camera[0] : &camera[ssplayer-1]); @@ -1596,8 +1596,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) //Reset away view if a command is given. if ((cmd->forwardmove || cmd->sidemove || cmd->buttons) - && displayplayers[localdisplayplayers[0]] != consoleplayer && ssplayer == 1) - displayplayers[localdisplayplayers[0]] = consoleplayer; + && g_localplayers[0] != consoleplayer && ssplayer == 1) + g_localplayers[0] = consoleplayer; } @@ -1749,12 +1749,12 @@ void G_DoLoadLevel(boolean resetplayer) if (!resetplayer) P_FindEmerald(); - displayplayers[localdisplayplayers[0]] = consoleplayer; // view the guy you are playing + g_localplayers[0] = consoleplayer; // view the guy you are playing for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { if (i > 0 && !(i == 1 && botingame) && r_splitscreen < i) - displayplayers[localdisplayplayers[i]] = consoleplayer; + g_localplayers[i] = consoleplayer; } gameaction = ga_nothing; @@ -1765,7 +1765,7 @@ void G_DoLoadLevel(boolean resetplayer) for (i = 0; i <= r_splitscreen; i++) { if (camera[i].chase) - P_ResetCamera(&players[displayplayers[localdisplayplayers[i]]], &camera[i]); + P_ResetCamera(&players[g_localplayers[i]], &camera[i]); } // clear cmd building stuff @@ -1876,7 +1876,7 @@ boolean G_Responder(event_t *ev) && (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1])) { if (!demo.playback && (r_splitscreen || !netgame)) - displayplayers[localdisplayplayers[0]] = consoleplayer; + g_localplayers[0] = consoleplayer; else { G_AdjustView(1, 1, true); @@ -2885,18 +2885,18 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) if (nummapthings) { if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) - || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) - || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) + || (splitscreen && playernum == g_localplayers[1]) + || (splitscreen > 1 && playernum == g_localplayers[2]) + || (splitscreen > 2 && playernum == g_localplayers[3])) CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the first mapthing!\n")); spawnpoint = &mapthings[0]; } else { if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) - || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) - || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) + || (splitscreen && playernum == g_localplayers[1]) + || (splitscreen > 1 && playernum == g_localplayers[2]) + || (splitscreen > 2 && playernum == g_localplayers[3])) CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the origin!\n")); //P_MovePlayerToSpawn handles this fine if the spawnpoint is NULL. } @@ -2991,17 +2991,17 @@ mapthing_t *G_FindMatchStart(INT32 playernum) return deathmatchstarts[i]; } if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) - || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) - || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) + || (splitscreen && playernum == g_localplayers[1]) + || (splitscreen > 1 && playernum == g_localplayers[2]) + || (splitscreen > 2 && playernum == g_localplayers[3])) CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Deathmatch starts!\n")); return NULL; } if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) - || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) - || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) + || (splitscreen && playernum == g_localplayers[1]) + || (splitscreen > 1 && playernum == g_localplayers[2]) + || (splitscreen > 2 && playernum == g_localplayers[3])) CONS_Alert(CONS_WARNING, M_GetText("No Deathmatch starts in this map!\n")); return NULL; } @@ -3089,17 +3089,17 @@ mapthing_t *G_FindRaceStart(INT32 playernum) //return playerstarts[0]; if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) - || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) - || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) + || (splitscreen && playernum == g_localplayers[1]) + || (splitscreen > 1 && playernum == g_localplayers[2]) + || (splitscreen > 2 && playernum == g_localplayers[3])) CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Race starts!\n")); return NULL; } if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) - || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) - || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) + || (splitscreen && playernum == g_localplayers[1]) + || (splitscreen > 1 && playernum == g_localplayers[2]) + || (splitscreen > 2 && playernum == g_localplayers[3])) CONS_Alert(CONS_WARNING, M_GetText("No Race starts in this map!\n")); return NULL; } diff --git a/src/g_splitscreen.c b/src/g_splitscreen.c index 6f5a69297..d99f85ea3 100644 --- a/src/g_splitscreen.c +++ b/src/g_splitscreen.c @@ -45,13 +45,11 @@ G_ResetSplitscreen (int playernum) /* easier to just rebuild displayplayers with local players */ for (i = 0; i <= splitscreen; ++i) { - displayplayers[i] = old_displayplayers[localdisplayplayers[i]]; - localdisplayplayers[i] = i; + displayplayers[i] = g_localplayers[i]; } while (i < MAXSPLITSCREENPLAYERS) { displayplayers[i] = consoleplayer; - localdisplayplayers[i] = 0; i++; } @@ -94,15 +92,6 @@ G_RemovePartyMember (int playernum) memcpy(&new_party[before], &old_party[after], ( old_party_size - after ) * sizeof *new_party); - if (splitscreen_partied[playernum]) - { - for (i = 0; i < MAXSPLITSCREENPLAYERS && - localdisplayplayers[i] >= after; ++i) - { - localdisplayplayers[i] -= views; - } - } - views = ( old_party_size - views ); for (i = 0; i < old_party_size; ++i) @@ -197,20 +186,13 @@ G_AddPartyMember (int invitation, int playernum) { splitscreen_partied[invitation] = true; - for (i = 0; i <= splitscreen; ++i) - { - localdisplayplayers[i] = ( old_party_size + i ); - displayplayers[i] = party[i]; - } - while (++i < new_party_size) + for (i = 0; i < new_party_size; ++i) { displayplayers[i] = party[i]; - localdisplayplayers[i] = old_party_size; } while (i < MAXSPLITSCREENPLAYERS) { displayplayers[i] = consoleplayer; - localdisplayplayers[i] = old_party_size; i++; } diff --git a/src/k_kart.c b/src/k_kart.c index ebce1458e..8fdc61529 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6635,7 +6635,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } // Play the starting countdown sounds - if (player == &players[displayplayers[localdisplayplayers[0]]]) // Don't play louder in splitscreen + if (player == &players[g_localplayers[0]]) // Don't play louder in splitscreen { if ((leveltime == starttime-(3*TICRATE)) || (leveltime == starttime-(2*TICRATE)) || (leveltime == starttime-TICRATE)) S_StartSound(NULL, sfx_s3ka7); diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 2ce3e89ae..4e75ca8f7 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -125,7 +125,7 @@ void COM_Lua_f(void) lua_pop(gL, 1); // pop command info table return; // can't execute splitscreen command without player 2! } - playernum = displayplayers[localdisplayplayers[1]]; + playernum = g_localplayers[1]; } if (netgame) diff --git a/src/m_menu.c b/src/m_menu.c index 3fe0198df..df4e2ed39 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -9525,7 +9525,7 @@ static void M_SetupMultiPlayer2(INT32 choice) strcpy (setupm_name, cv_playername2.string); // set for splitscreen secondary player - setupm_player = &players[displayplayers[localdisplayplayers[1]]]; + setupm_player = &players[g_localplayers[1]]; setupm_cvskin = &cv_skin2; setupm_cvcolor = &cv_playercolor2; setupm_cvname = &cv_playername2; @@ -9537,7 +9537,7 @@ static void M_SetupMultiPlayer2(INT32 choice) setupm_fakecolor = setupm_cvcolor->value; // disable skin changes if we can't actually change skins - if (splitscreen && !CanChangeSkin(displayplayers[localdisplayplayers[1]])) + if (splitscreen && !CanChangeSkin(g_localplayers[1])) MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT); else MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); @@ -9556,7 +9556,7 @@ static void M_SetupMultiPlayer3(INT32 choice) strcpy(setupm_name, cv_playername3.string); // set for splitscreen third player - setupm_player = &players[displayplayers[localdisplayplayers[2]]]; + setupm_player = &players[g_localplayers[2]]; setupm_cvskin = &cv_skin3; setupm_cvcolor = &cv_playercolor3; setupm_cvname = &cv_playername3; @@ -9568,7 +9568,7 @@ static void M_SetupMultiPlayer3(INT32 choice) setupm_fakecolor = setupm_cvcolor->value; // disable skin changes if we can't actually change skins - if (splitscreen > 1 && !CanChangeSkin(displayplayers[localdisplayplayers[2]])) + if (splitscreen > 1 && !CanChangeSkin(g_localplayers[2])) MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT); else MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); @@ -9587,7 +9587,7 @@ static void M_SetupMultiPlayer4(INT32 choice) strcpy(setupm_name, cv_playername4.string); // set for splitscreen fourth player - setupm_player = &players[displayplayers[localdisplayplayers[3]]]; + setupm_player = &players[g_localplayers[3]]; setupm_cvskin = &cv_skin4; setupm_cvcolor = &cv_playercolor4; setupm_cvname = &cv_playername4; @@ -9599,7 +9599,7 @@ static void M_SetupMultiPlayer4(INT32 choice) setupm_fakecolor = setupm_cvcolor->value; // disable skin changes if we can't actually change skins - if (splitscreen > 2 && !CanChangeSkin(displayplayers[localdisplayplayers[3]])) + if (splitscreen > 2 && !CanChangeSkin(g_localplayers[3])) MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT); else MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); diff --git a/src/m_misc.c b/src/m_misc.c index b232bce9a..c3b8776b0 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -743,12 +743,12 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png else snprintf(lvlttltext, 48, "Unknown"); - if (gamestate == GS_LEVEL && &players[displayplayers[localdisplayplayers[0]]] && players[displayplayers[localdisplayplayers[0]]].mo) + if (gamestate == GS_LEVEL && &players[g_localplayers[0]] && players[g_localplayers[0]].mo) snprintf(locationtxt, 40, "X:%d Y:%d Z:%d A:%d", - players[displayplayers[localdisplayplayers[0]]].mo->x>>FRACBITS, - players[displayplayers[localdisplayplayers[0]]].mo->y>>FRACBITS, - players[displayplayers[localdisplayplayers[0]]].mo->z>>FRACBITS, - FixedInt(AngleFixed(players[displayplayers[localdisplayplayers[0]]].mo->angle))); + players[g_localplayers[0]].mo->x>>FRACBITS, + players[g_localplayers[0]].mo->y>>FRACBITS, + players[g_localplayers[0]].mo->z>>FRACBITS, + FixedInt(AngleFixed(players[g_localplayers[0]].mo->angle))); else snprintf(locationtxt, 40, "Unknown"); diff --git a/src/p_floor.c b/src/p_floor.c index a6419b409..510832b90 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2536,9 +2536,9 @@ void T_CameraScanner(elevator_t *elevator) lastleveltime = leveltime; } - if (players[displayplayers[localdisplayplayers[0]]].mo) + if (players[g_localplayers[0]].mo) { - if (players[displayplayers[localdisplayplayers[0]]].mo->subsector->sector == elevator->actionsector) + if (players[g_localplayers[0]].mo->subsector->sector == elevator->actionsector) { if (t_cam_dist == -42) t_cam_dist = cv_cam_dist.value; @@ -2564,9 +2564,9 @@ void T_CameraScanner(elevator_t *elevator) } } - if (splitscreen && players[displayplayers[localdisplayplayers[1]]].mo) + if (splitscreen && players[g_localplayers[1]].mo) { - if (players[displayplayers[localdisplayplayers[1]]].mo->subsector->sector == elevator->actionsector) + if (players[g_localplayers[1]].mo->subsector->sector == elevator->actionsector) { if (t_cam2_rotate == -42) t_cam2_dist = cv_cam2_dist.value; @@ -2592,9 +2592,9 @@ void T_CameraScanner(elevator_t *elevator) } } - if (splitscreen > 1 && players[displayplayers[localdisplayplayers[2]]].mo) + if (splitscreen > 1 && players[g_localplayers[2]].mo) { - if (players[displayplayers[localdisplayplayers[2]]].mo->subsector->sector == elevator->actionsector) + if (players[g_localplayers[2]].mo->subsector->sector == elevator->actionsector) { if (t_cam3_rotate == -42) t_cam3_dist = cv_cam3_dist.value; @@ -2620,9 +2620,9 @@ void T_CameraScanner(elevator_t *elevator) } } - if (splitscreen > 2 && players[displayplayers[localdisplayplayers[3]]].mo) + if (splitscreen > 2 && players[g_localplayers[3]].mo) { - if (players[displayplayers[localdisplayplayers[3]]].mo->subsector->sector == elevator->actionsector) + if (players[g_localplayers[3]].mo->subsector->sector == elevator->actionsector) { if (t_cam4_rotate == -42) t_cam4_dist = cv_cam4_dist.value; diff --git a/src/p_inter.c b/src/p_inter.c index d53423a46..81240d72f 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -63,11 +63,11 @@ void P_ForceConstant(const BasicFF_t *FFInfo) ConstantQuake.Magnitude = FFInfo->Magnitude; if (FFInfo->player == &players[consoleplayer]) I_Tactile(ConstantForce, &ConstantQuake); - else if (splitscreen && FFInfo->player == &players[displayplayers[localdisplayplayers[1]]]) + else if (splitscreen && FFInfo->player == &players[g_localplayers[1]]) I_Tactile2(ConstantForce, &ConstantQuake); - else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[localdisplayplayers[2]]]) + else if (splitscreen > 1 && FFInfo->player == &players[g_localplayers[2]]) I_Tactile3(ConstantForce, &ConstantQuake); - else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[localdisplayplayers[3]]]) + else if (splitscreen > 2 && FFInfo->player == &players[g_localplayers[3]]) I_Tactile4(ConstantForce, &ConstantQuake); } void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End) @@ -84,11 +84,11 @@ void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End) RampQuake.End = End; if (FFInfo->player == &players[consoleplayer]) I_Tactile(ConstantForce, &RampQuake); - else if (splitscreen && FFInfo->player == &players[displayplayers[localdisplayplayers[1]]]) + else if (splitscreen && FFInfo->player == &players[g_localplayers[1]]) I_Tactile2(ConstantForce, &RampQuake); - else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[localdisplayplayers[2]]]) + else if (splitscreen > 1 && FFInfo->player == &players[g_localplayers[2]]) I_Tactile3(ConstantForce, &RampQuake); - else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[localdisplayplayers[3]]]) + else if (splitscreen > 2 && FFInfo->player == &players[g_localplayers[3]]) I_Tactile4(ConstantForce, &RampQuake); } diff --git a/src/p_mobj.c b/src/p_mobj.c index d648ff0f3..b0c8f43cb 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3656,11 +3656,11 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled fixed_t cam_height = cv_cam_height.value; thiscam->z = thiscam->floorz; - if (player == &players[displayplayers[localdisplayplayers[1]]]) + if (player == &players[g_localplayers[1]]) cam_height = cv_cam2_height.value; - if (player == &players[displayplayers[localdisplayplayers[2]]]) + if (player == &players[g_localplayers[2]]) cam_height = cv_cam3_height.value; - if (player == &players[displayplayers[localdisplayplayers[3]]]) + if (player == &players[g_localplayers[3]]) cam_height = cv_cam4_height.value; if (thiscam->z > player->mo->z + player->mo->height + FixedMul(cam_height*FRACUNIT + 16*FRACUNIT, player->mo->scale)) { @@ -7282,7 +7282,7 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->target && mobj->target->health && mobj->tracer && mobj->target->player && !mobj->target->player->spectator && mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD - && players[displayplayers[localdisplayplayers[0]]].mo && !players[displayplayers[localdisplayplayers[0]]].spectator) + && players[g_localplayers[0]].mo && !players[g_localplayers[0]].spectator) { fixed_t scale = 3*mobj->target->scale; @@ -11136,13 +11136,13 @@ void P_PrecipitationEffects(void) // Local effects from here on out! // If we're not in game fully yet, we don't worry about them. - if (!playeringame[displayplayers[localdisplayplayers[0]]] || !players[displayplayers[localdisplayplayers[0]]].mo) + if (!playeringame[g_localplayers[0]] || !players[g_localplayers[0]].mo) return; if (sound_disabled) return; // Sound off? D'aw, no fun. - if (players[displayplayers[localdisplayplayers[0]]].mo->subsector->sector->ceilingpic == skyflatnum) + if (players[g_localplayers[0]].mo->subsector->sector->ceilingpic == skyflatnum) volume = 255; // Sky above? We get it full blast. else { @@ -11150,17 +11150,17 @@ void P_PrecipitationEffects(void) fixed_t closedist, newdist; // Essentially check in a 1024 unit radius of the player for an outdoor area. - yl = players[displayplayers[localdisplayplayers[0]]].mo->y - 1024*FRACUNIT; - yh = players[displayplayers[localdisplayplayers[0]]].mo->y + 1024*FRACUNIT; - xl = players[displayplayers[localdisplayplayers[0]]].mo->x - 1024*FRACUNIT; - xh = players[displayplayers[localdisplayplayers[0]]].mo->x + 1024*FRACUNIT; + yl = players[g_localplayers[0]].mo->y - 1024*FRACUNIT; + yh = players[g_localplayers[0]].mo->y + 1024*FRACUNIT; + xl = players[g_localplayers[0]].mo->x - 1024*FRACUNIT; + xh = players[g_localplayers[0]].mo->x + 1024*FRACUNIT; closedist = 2048*FRACUNIT; for (y = yl; y <= yh; y += FRACUNIT*64) for (x = xl; x <= xh; x += FRACUNIT*64) { if (R_PointInSubsector(x, y)->sector->ceilingpic == skyflatnum) // Found the outdoors! { - newdist = S_CalculateSoundDistance(players[displayplayers[localdisplayplayers[0]]].mo->x, players[displayplayers[localdisplayplayers[0]]].mo->y, 0, x, y, 0); + newdist = S_CalculateSoundDistance(players[g_localplayers[0]].mo->x, players[g_localplayers[0]].mo->y, 0, x, y, 0); if (newdist < closedist) closedist = newdist; } @@ -11175,7 +11175,7 @@ void P_PrecipitationEffects(void) volume = 255; if (sounds_rain && (!leveltime || leveltime % 80 == 1)) - S_StartSoundAtVolume(players[displayplayers[localdisplayplayers[0]]].mo, sfx_rainin, volume); + S_StartSoundAtVolume(players[g_localplayers[0]].mo, sfx_rainin, volume); if (!sounds_thunder) return; @@ -11183,7 +11183,7 @@ void P_PrecipitationEffects(void) if (effects_lightning && lightningStrike && volume) { // Large, close thunder sounds to go with our lightning. - S_StartSoundAtVolume(players[displayplayers[localdisplayplayers[0]]].mo, sfx_litng1 + M_RandomKey(4), volume); + S_StartSoundAtVolume(players[g_localplayers[0]].mo, sfx_litng1 + M_RandomKey(4), volume); } else if (thunderchance < 20) { @@ -11191,7 +11191,7 @@ void P_PrecipitationEffects(void) if (volume < 80) volume = 80; - S_StartSoundAtVolume(players[displayplayers[localdisplayplayers[0]]].mo, sfx_athun1 + M_RandomKey(2), volume); + S_StartSoundAtVolume(players[g_localplayers[0]].mo, sfx_athun1 + M_RandomKey(2), volume); } } diff --git a/src/p_setup.c b/src/p_setup.c index 491127d5b..0b237c520 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2567,29 +2567,29 @@ static void P_ForceCharacter(const char *forcecharskin) { if (splitscreen) { - SetPlayerSkin(displayplayers[localdisplayplayers[1]], forcecharskin); - if ((unsigned)cv_playercolor2.value != skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor && !modeattacking) + SetPlayerSkin(g_localplayers[1], forcecharskin); + if ((unsigned)cv_playercolor2.value != skins[players[g_localplayers[1]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor2, skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor); - players[displayplayers[localdisplayplayers[1]]].skincolor = skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor2, skins[players[g_localplayers[1]].skin].prefcolor); + players[g_localplayers[1]].skincolor = skins[players[g_localplayers[1]].skin].prefcolor; } if (splitscreen > 1) { - SetPlayerSkin(displayplayers[localdisplayplayers[2]], forcecharskin); - if ((unsigned)cv_playercolor3.value != skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor && !modeattacking) + SetPlayerSkin(g_localplayers[2], forcecharskin); + if ((unsigned)cv_playercolor3.value != skins[players[g_localplayers[2]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor3, skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor); - players[displayplayers[localdisplayplayers[2]]].skincolor = skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor3, skins[players[g_localplayers[2]].skin].prefcolor); + players[g_localplayers[2]].skincolor = skins[players[g_localplayers[2]].skin].prefcolor; } if (splitscreen > 2) { - SetPlayerSkin(displayplayers[localdisplayplayers[3]], forcecharskin); - if ((unsigned)cv_playercolor4.value != skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor && !modeattacking) + SetPlayerSkin(g_localplayers[3], forcecharskin); + if ((unsigned)cv_playercolor4.value != skins[players[g_localplayers[3]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor4, skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor); - players[displayplayers[localdisplayplayers[3]]].skincolor = skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor4, skins[players[g_localplayers[3]].skin].prefcolor); + players[g_localplayers[3]].skincolor = skins[players[g_localplayers[3]].skin].prefcolor; } } } @@ -3270,7 +3270,7 @@ boolean P_SetupLevel(boolean skipprecip) /*if (rendermode != render_none) CV_Set(&cv_fov, cv_fov.defaultvalue);*/ - displayplayers[localdisplayplayers[0]] = consoleplayer; // Start with your OWN view, please! + g_localplayers[0] = consoleplayer; // Start with your OWN view, please! } /*if (cv_useranalog.value) diff --git a/src/p_user.c b/src/p_user.c index 6a660f20f..193d597b5 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7347,17 +7347,17 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall focusangle = localangle[0]; focusaiming = localaiming[0]; } - else if (player == &players[displayplayers[localdisplayplayers[1]]]) + else if (player == &players[g_localplayers[1]]) { focusangle = localangle[1]; focusaiming = localaiming[1]; } - else if (player == &players[displayplayers[localdisplayplayers[2]]]) + else if (player == &players[g_localplayers[2]]) { focusangle = localangle[2]; focusaiming = localaiming[2]; } - else if (player == &players[displayplayers[localdisplayplayers[3]]]) + else if (player == &players[g_localplayers[3]]) { focusangle = localangle[3]; focusaiming = localaiming[3]; @@ -7893,8 +7893,8 @@ boolean P_SpectatorJoinGame(player_t *player) player->playerstate = PST_REBORN; //Reset away view - if (P_IsLocalPlayer(player) && displayplayers[localdisplayplayers[0]] != consoleplayer) - displayplayers[localdisplayplayers[0]] = consoleplayer; + if (P_IsLocalPlayer(player) && g_localplayers[0] != consoleplayer) + g_localplayers[0] = consoleplayer; HU_AddChatText(va(M_GetText("\x82*%s entered the game."), player_names[player-players]), false); return true; // no more player->mo, cannot continue. diff --git a/src/st_stuff.c b/src/st_stuff.c index 280984ca7..02c4fe445 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2089,7 +2089,7 @@ void ST_Drawer(void) UINT8 i; #ifdef SEENAMES - if (cv_seenames.value && cv_allowseenames.value && displayplayers[localdisplayplayers[0]] == consoleplayer && seenplayer && seenplayer->mo && !mapreset) + if (cv_seenames.value && cv_allowseenames.value && g_localplayers[0] == consoleplayer && seenplayer && seenplayer->mo && !mapreset) { if (cv_seenames.value == 1) V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]); diff --git a/src/y_inter.c b/src/y_inter.c index e27289b87..85bfcad06 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1263,19 +1263,19 @@ void Y_VoteDrawer(void) { case 1: thiscurs = cursor2; - p = displayplayers[localdisplayplayers[1]]; + p = g_localplayers[1]; break; case 2: thiscurs = cursor3; - p = displayplayers[localdisplayplayers[2]]; + p = g_localplayers[2]; break; case 3: thiscurs = cursor4; - p = displayplayers[localdisplayplayers[3]]; + p = g_localplayers[3]; break; default: thiscurs = cursor1; - p = displayplayers[localdisplayplayers[0]]; + p = g_localplayers[0]; break; } @@ -1563,13 +1563,13 @@ void Y_VoteTicker(void) switch (i) { case 1: - p = displayplayers[localdisplayplayers[1]]; + p = g_localplayers[1]; break; case 2: - p = displayplayers[localdisplayplayers[2]]; + p = g_localplayers[2]; break; case 3: - p = displayplayers[localdisplayplayers[3]]; + p = g_localplayers[3]; break; default: p = consoleplayer; From fc1e4b5cc524f667f9a771f3ba3647256c570fb3 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 18:22:45 -0800 Subject: [PATCH 037/117] Just say "joined" so to not worry about plurals --- src/d_netcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index fa10c1640..e044b3be0 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2068,7 +2068,7 @@ static void Got_AcceptPartyInvite(UINT8 **cp,INT32 playernum) if (splitscreen_partied[invitation]) { HU_AddChatText(va( - "\x82*%s has joined your party!", + "\x82*%s joined your party!", VaguePartyDescription( playernum, splitscreen_original_party_size, '\x82') ), true); From dfe6d62d7658c4dd1b18db98d02176ec80925fd6 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 18:28:30 -0800 Subject: [PATCH 038/117] bruh --- 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 e044b3be0..2c2f67250 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1335,8 +1335,8 @@ VaguePartyDescription (int playernum, int *party_sizes, int default_color) sprintf(description, "\x83%s%c and %d others", name, - ( size - 1 ), - default_color + default_color, + ( size - 1 ) ); } else From 7fe61a99dfb178272c549b2b4e7d6b06c1e133fc Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 18:29:45 -0800 Subject: [PATCH 039/117] More plurals --- src/d_netcmd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 2c2f67250..53bc3e928 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1333,10 +1333,11 @@ VaguePartyDescription (int playernum, int *party_sizes, int default_color) if (size > 1 && size <= MAXSPLITSCREENPLAYERS) { sprintf(description, - "\x83%s%c and %d others", + "\x83%s%c and %d other%s", name, default_color, - ( size - 1 ) + ( size - 1 ), + ( (size > 2) ? "s" : "" ) ); } else From 70bb244dd63be4665c6eba00fbd132a333e18897 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 18:35:47 -0800 Subject: [PATCH 040/117] Reset camera when party changes --- src/g_splitscreen.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/g_splitscreen.c b/src/g_splitscreen.c index d99f85ea3..9127bd18a 100644 --- a/src/g_splitscreen.c +++ b/src/g_splitscreen.c @@ -11,6 +11,7 @@ #include "doomdef.h" #include "g_game.h" +#include "p_local.h" #include "r_local.h" int splitscreen_original_party_size[MAXPLAYERS]; @@ -46,6 +47,7 @@ G_ResetSplitscreen (int playernum) for (i = 0; i <= splitscreen; ++i) { displayplayers[i] = g_localplayers[i]; + P_ResetCamera(&players[displayplayers[i]], &camera[i]); } while (i < MAXSPLITSCREENPLAYERS) { @@ -113,6 +115,7 @@ G_RemovePartyMember (int playernum) for (i = 0; i < views; ++i) { displayplayers[i] = new_party[i]; + P_ResetCamera(&players[displayplayers[i]], &camera[i]); } while (i < MAXSPLITSCREENPLAYERS) { @@ -176,6 +179,7 @@ G_AddPartyMember (int invitation, int playernum) for (i = old_party_size; i < new_party_size; ++i) { displayplayers[i] = party[i]; + P_ResetCamera(&players[displayplayers[i]], &camera[i]); } r_splitscreen += views; @@ -189,6 +193,7 @@ G_AddPartyMember (int invitation, int playernum) for (i = 0; i < new_party_size; ++i) { displayplayers[i] = party[i]; + P_ResetCamera(&players[displayplayers[i]], &camera[i]); } while (i < MAXSPLITSCREENPLAYERS) { From e593b5297a4a745f8271ba5a0d7bc0bba6077819 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 19:17:56 -0800 Subject: [PATCH 041/117] Reset party size --- src/d_clisrv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a6190a0dc..b5b8c8143 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2652,6 +2652,8 @@ void CL_ClearPlayer(INT32 playernum) } splitscreen_invitations[playernum] = -1; + splitscreen_party_size[playernum] = 0; + splitscreen_original_party_size[playernum] = 0; memset(&players[playernum], 0, sizeof (player_t)); } @@ -2728,6 +2730,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason) (void)reason; #endif + G_RemovePartyMember(playernum); + // Reset player data CL_ClearPlayer(playernum); @@ -2745,8 +2749,6 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason) RemoveAdminPlayer(playernum); // don't stay admin after you're gone } - G_RemovePartyMember(playernum); - if (playernum == g_localplayers[0] && !demo.playback) g_localplayers[0] = consoleplayer; // don't look through someone's view who isn't there From 7961ac9d955474d44c3217ca353a7f7e7a3aa019 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 22:01:42 -0800 Subject: [PATCH 042/117] Fix moving while viewing another player not resetting the viewpoint --- src/g_game.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index ffb75f3fb..22ded1c93 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1596,8 +1596,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) //Reset away view if a command is given. if ((cmd->forwardmove || cmd->sidemove || cmd->buttons) - && g_localplayers[0] != consoleplayer && ssplayer == 1) - g_localplayers[0] = consoleplayer; + && ! r_splitscreen && displayplayers[0] != consoleplayer && ssplayer == 1) + displayplayers[0] = consoleplayer; } From 0c814ce42dd3fcbc609b1bab6cf2d7a92b19fc68 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 22:14:14 -0800 Subject: [PATCH 043/117] Sync look back Also fixes look back applying to the first player in parties instead of locally. --- src/d_ticcmd.h | 3 ++- src/g_game.c | 7 +++++-- src/g_game.h | 2 +- src/k_kart.c | 2 +- src/p_user.c | 5 +---- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/d_ticcmd.h b/src/d_ticcmd.h index dab758f8d..c73c161b5 100644 --- a/src/d_ticcmd.h +++ b/src/d_ticcmd.h @@ -32,8 +32,9 @@ typedef enum BT_ATTACK = 1<<4, // Use Item BT_FORWARD = 1<<5, // Aim Item Forward BT_BACKWARD = 1<<6, // Aim Item Backward + BT_LOOKBACK = 1<<7, // Look Backward - // free: 1<<7 to 1<<12 + // free: 1<<8 to 1<<12 // Lua garbage BT_CUSTOM1 = 1<<13, diff --git a/src/g_game.c b/src/g_game.c index 22ded1c93..551261de8 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1231,7 +1231,6 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 p) // INT32 localaiming[MAXSPLITSCREENPLAYERS]; angle_t localangle[MAXSPLITSCREENPLAYERS]; -boolean camspin[MAXSPLITSCREENPLAYERS]; static fixed_t forwardmove[2] = {25<>16, 50<>16}; static fixed_t sidemove[2] = {2<>16, 4<>16}; @@ -1456,6 +1455,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (InputDown(gc_drift, ssplayer) || (usejoystick && axis > 0)) cmd->buttons |= BT_DRIFT; + // rear view with any button/key + axis = JoyAxis(AXISLOOKBACK, ssplayer); + if (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0)) + cmd->buttons |= BT_LOOKBACK; + // Lua scriptable buttons if (InputDown(gc_custom1, ssplayer)) cmd->buttons |= BT_CUSTOM1; @@ -1576,7 +1580,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) keyboard_look[ssplayer-1] = kbl; turnheld[ssplayer-1] = th; resetdown[ssplayer-1] = rd; - camspin[ssplayer-1] = InputDown(gc_lookback, ssplayer); } /* Lua: Allow this hook to overwrite ticcmd. diff --git a/src/g_game.h b/src/g_game.h index de88d6bdc..9d4a3e4d9 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -129,6 +129,7 @@ typedef enum AXISDEAD, //Axises that don't want deadzones AXISFIRE, AXISDRIFT, + AXISLOOKBACK, } axis_input_e; // mouseaiming (looking up/down with the mouse or keyboard) @@ -154,7 +155,6 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 p); extern angle_t localangle[MAXSPLITSCREENPLAYERS]; extern INT32 localaiming[MAXSPLITSCREENPLAYERS]; // should be an angle_t but signed -extern boolean camspin[MAXSPLITSCREENPLAYERS]; // SRB2Kart // // GAME diff --git a/src/k_kart.c b/src/k_kart.c index 8fdc61529..9ffe143fd 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8874,7 +8874,7 @@ static void K_drawKartPlayerCheck(void) if (stplyr->awayviewtics) return; - if (camspin[0]) + if (( stplyr->cmd.buttons & BT_LOOKBACK )) return; for (i = 0; i < MAXPLAYERS; i++) diff --git a/src/p_user.c b/src/p_user.c index 193d597b5..035979c75 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7371,6 +7371,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (P_CameraThinker(player, thiscam, resetcalled)) return true; + lookback = ( player->cmd.buttons & BT_LOOKBACK ); if (thiscam == &camera[1]) // Camera 2 { @@ -7380,7 +7381,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camrotate = cv_cam2_rotate.value; camdist = FixedMul(cv_cam2_dist.value, mapobjectscale); camheight = FixedMul(cv_cam2_height.value, mapobjectscale); - lookback = camspin[1]; } else if (thiscam == &camera[2]) // Camera 3 { @@ -7390,7 +7390,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camrotate = cv_cam3_rotate.value; camdist = FixedMul(cv_cam3_dist.value, mapobjectscale); camheight = FixedMul(cv_cam3_height.value, mapobjectscale); - lookback = camspin[2]; } else if (thiscam == &camera[3]) // Camera 4 { @@ -7400,7 +7399,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camrotate = cv_cam4_rotate.value; camdist = FixedMul(cv_cam4_dist.value, mapobjectscale); camheight = FixedMul(cv_cam4_height.value, mapobjectscale); - lookback = camspin[3]; } else // Camera 1 { @@ -7410,7 +7408,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camrotate = cv_cam_rotate.value; camdist = FixedMul(cv_cam_dist.value, mapobjectscale); camheight = FixedMul(cv_cam_height.value, mapobjectscale); - lookback = camspin[0]; } if (timeover) From 8619ec4d0f01b914598f036769489329473eed45 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 22:19:11 -0800 Subject: [PATCH 044/117] Fix first person camera angle in parties --- src/r_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index cf16802cb..fb5ae220d 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -899,11 +899,11 @@ void R_SkyboxFrame(player_t *player) viewangle = localangle[0]; // WARNING: camera uses this aimingangle = localaiming[0]; } - else if (r_splitscreen) + else if (splitscreen) { - for (i = 1; i <= r_splitscreen; i++) + for (i = 1; i <= splitscreen; i++) { - if (player == &players[displayplayers[i]]) + if (player == &players[g_localplayers[i]]) { viewangle = localangle[i]; aimingangle = localaiming[i]; @@ -1158,12 +1158,12 @@ void R_SetupFrame(player_t *player, boolean skybox) viewangle = localangle[0]; // WARNING: camera uses this aimingangle = localaiming[0]; } - else if (r_splitscreen) + else if (splitscreen) { UINT8 i; - for (i = 1; i <= r_splitscreen; i++) + for (i = 1; i <= splitscreen; i++) { - if (player == &players[displayplayers[i]]) + if (player == &players[g_localplayers[i]]) { viewangle = localangle[i]; aimingangle = localaiming[i]; From ea8fd7348f448e4a0170d1d24a37901f967e0ab5 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 22 Feb 2020 19:12:35 -0800 Subject: [PATCH 045/117] Show lagless for all the host's splitscreen players --- src/k_kart.c | 2 +- src/y_inter.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 23bb15761..7deaa08a1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8406,7 +8406,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I y2 = y; - if (tab[i].num == 0 && server_lagless) + if (playerconsole[tab[i].num] == 0 && server_lagless) { y2 = ( y - 4 ); diff --git a/src/y_inter.c b/src/y_inter.c index 44ffdd70a..444e0bd7d 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -495,7 +495,7 @@ void Y_IntermissionDrawer(void) y2 = y; - if (data.match.num[i] == 0 && server_lagless) + if (playerconsole[data.match.num[i]] == 0 && server_lagless) { static int alagles_timer = 0; patch_t *alagles; From ac75b30400744a2d9a34e604f87f5c809d298f73 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 2 Mar 2020 21:09:12 -0800 Subject: [PATCH 046/117] r_splitscreen for opengl --- src/hardware/hw_main.c | 56 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 659af386d..9dd84cddd 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4144,11 +4144,11 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t angle_t shadowdir; // Set direction - if (splitscreen && stplyr == &players[displayplayers[1]]) + if (r_splitscreen && stplyr == &players[displayplayers[1]]) shadowdir = localangle[1] + FixedAngle(cv_cam2_rotate.value); - else if (splitscreen > 1 && stplyr == &players[displayplayers[2]]) + else if (r_splitscreen > 1 && stplyr == &players[displayplayers[2]]) shadowdir = localangle[2] + FixedAngle(cv_cam3_rotate.value); - else if (splitscreen > 2 && stplyr == &players[displayplayers[3]]) + else if (r_splitscreen > 2 && stplyr == &players[displayplayers[3]]) shadowdir = localangle[3] + FixedAngle(cv_cam4_rotate.value); else shadowdir = localangle[0] + FixedAngle(cv_cam_rotate.value); @@ -5485,7 +5485,7 @@ static void HWR_AddSprites(sector_t *sec) if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) continue; - if (splitscreen) + if (r_splitscreen) { if (thing->eflags & MFE_DRAWONLYFORP1) if (viewssnum != 0) @@ -5495,11 +5495,11 @@ static void HWR_AddSprites(sector_t *sec) if (viewssnum != 1) continue; - if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) + if (thing->eflags & MFE_DRAWONLYFORP3 && r_splitscreen > 1) if (viewssnum != 2) continue; - if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) + if (thing->eflags & MFE_DRAWONLYFORP4 && r_splitscreen > 2) if (viewssnum != 3) continue; } @@ -5520,7 +5520,7 @@ static void HWR_AddSprites(sector_t *sec) if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) continue; - if (splitscreen) + if (r_splitscreen) { if (thing->eflags & MFE_DRAWONLYFORP1) if (viewssnum != 0) @@ -5530,11 +5530,11 @@ static void HWR_AddSprites(sector_t *sec) if (viewssnum != 1) continue; - if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) + if (thing->eflags & MFE_DRAWONLYFORP3 && r_splitscreen > 1) if (viewssnum != 2) continue; - if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) + if (thing->eflags & MFE_DRAWONLYFORP4 && r_splitscreen > 2) if (viewssnum != 3) continue; } @@ -5971,7 +5971,7 @@ static void HWR_DrawSkyBackground(void) dimensionmultiply = ((float)tex->height/(128.0f*aspectratio)); - if (splitscreen == 1) + if (r_splitscreen == 1) { dimensionmultiply *= 2; angle *= 2; @@ -6043,10 +6043,10 @@ void HWR_SetViewSize(void) gr_viewwidth = (float)vid.width; gr_viewheight = (float)vid.height; - if (splitscreen) + if (r_splitscreen) gr_viewheight /= 2; - if (splitscreen > 1) + if (r_splitscreen > 1) gr_viewwidth /= 2; gr_basecenterx = gr_viewwidth / 2; @@ -6102,13 +6102,13 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) gr_viewwindowy = gr_baseviewwindowy; gr_windowcentery = gr_basewindowcentery; - if ((splitscreen == 1 && viewnumber == 1) || (splitscreen > 1 && viewnumber > 1)) + if ((r_splitscreen == 1 && viewnumber == 1) || (r_splitscreen > 1 && viewnumber > 1)) { gr_viewwindowy += gr_viewheight; gr_windowcentery += gr_viewheight; } - if (splitscreen > 1 && viewnumber & 1) + if (r_splitscreen > 1 && viewnumber & 1) { gr_viewwindowx += gr_viewwidth; gr_windowcenterx += gr_viewwidth; @@ -6150,7 +6150,7 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) atransform.scalez = 1; atransform.fovxangle = fpov; // Tails atransform.fovyangle = fpov; // Tails - atransform.splitscreen = splitscreen; + atransform.splitscreen = r_splitscreen; gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); @@ -6169,7 +6169,7 @@ if (0) HWR_DrawSkyBackground(); //Hurdler: it doesn't work in splitscreen mode - drawsky = splitscreen; + drawsky = r_splitscreen; HWR_ClearSprites(); @@ -6202,11 +6202,11 @@ if (0) // Make a viewangle int so we can render things based on mouselook if (player == &players[consoleplayer]) viewangle = localaiming[0]; - else if (splitscreen && player == &players[displayplayers[1]]) + else if (r_splitscreen && player == &players[displayplayers[1]]) viewangle = localaiming[1]; - else if (splitscreen > 1 && player == &players[displayplayers[2]]) + else if (r_splitscreen > 1 && player == &players[displayplayers[2]]) viewangle = localaiming[2]; - else if (splitscreen > 2 && player == &players[displayplayers[3]]) + else if (r_splitscreen > 2 && player == &players[displayplayers[3]]) viewangle = localaiming[3]; // Handle stuff when you are looking farther up or down. @@ -6336,13 +6336,13 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) gr_viewwindowy = gr_baseviewwindowy; gr_windowcentery = gr_basewindowcentery; - if ((splitscreen == 1 && viewnumber == 1) || (splitscreen > 1 && viewnumber > 1)) + if ((r_splitscreen == 1 && viewnumber == 1) || (r_splitscreen > 1 && viewnumber > 1)) { gr_viewwindowy += gr_viewheight; gr_windowcentery += gr_viewheight; } - if (splitscreen > 1 && viewnumber & 1) + if (r_splitscreen > 1 && viewnumber & 1) { gr_viewwindowx += gr_viewwidth; gr_windowcenterx += gr_viewwidth; @@ -6384,7 +6384,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) atransform.scalez = 1; atransform.fovxangle = fpov; // Tails atransform.fovyangle = fpov; // Tails - atransform.splitscreen = splitscreen; + atransform.splitscreen = r_splitscreen; gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); @@ -6403,7 +6403,7 @@ if (0) HWR_DrawSkyBackground(); //Hurdler: it doesn't work in splitscreen mode - drawsky = splitscreen; + drawsky = r_splitscreen; HWR_ClearSprites(); @@ -6436,11 +6436,11 @@ if (0) // Make a viewangle int so we can render things based on mouselook if (player == &players[consoleplayer]) viewangle = localaiming[0]; - else if (splitscreen && player == &players[displayplayers[1]]) + else if (r_splitscreen && player == &players[displayplayers[1]]) viewangle = localaiming[1]; - else if (splitscreen > 1 && player == &players[displayplayers[2]]) + else if (r_splitscreen > 1 && player == &players[displayplayers[2]]) viewangle = localaiming[2]; - else if (splitscreen > 2 && player == &players[displayplayers[3]]) + else if (r_splitscreen > 2 && player == &players[displayplayers[3]]) viewangle = localaiming[3]; // Handle stuff when you are looking farther up or down. @@ -6920,7 +6920,7 @@ void HWR_DoPostProcessor(player_t *player) postimg_t *type = &postimgtype[0]; UINT8 i; - for (i = splitscreen; i > 0; i--) + for (i = r_splitscreen; i > 0; i--) { if (player == &players[displayplayers[i]]) { @@ -6958,7 +6958,7 @@ void HWR_DoPostProcessor(player_t *player) if(gamestate != GS_INTERMISSION) HWD.pfnMakeScreenTexture(); - if (splitscreen) // Not supported in splitscreen - someone want to add support? + if (r_splitscreen) // Not supported in splitscreen - someone want to add support? return; // Drunken vision! WooOOooo~ From 9b239e82523640ae7da1f30915f13d101261a65a Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 3 Mar 2020 18:49:26 -0800 Subject: [PATCH 047/117] Set extra displayplayers to displayplayers[0] instead of splitscreen for parties This fixes P2's HUD drawing in P4's area in a 3P party, when the first local player was P2. --- src/g_splitscreen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_splitscreen.c b/src/g_splitscreen.c index 9127bd18a..939eacef0 100644 --- a/src/g_splitscreen.c +++ b/src/g_splitscreen.c @@ -119,7 +119,7 @@ G_RemovePartyMember (int playernum) } while (i < MAXSPLITSCREENPLAYERS) { - displayplayers[i] = consoleplayer; + displayplayers[i] = displayplayers[0]; i++; } @@ -197,7 +197,7 @@ G_AddPartyMember (int invitation, int playernum) } while (i < MAXSPLITSCREENPLAYERS) { - displayplayers[i] = consoleplayer; + displayplayers[i] = displayplayers[0]; i++; } From dd29a44ecc61906a7b2ba13a734ed0fc0228d29c Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 3 Mar 2020 19:17:27 -0800 Subject: [PATCH 048/117] cancelinvite command to rescind a party invitation --- src/d_netcmd.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/d_netcmd.h | 5 ++-- 2 files changed, 83 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 53bc3e928..ce3f9b290 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -65,6 +65,7 @@ static void Got_WeaponPref(UINT8 **cp, INT32 playernum); static void Got_PowerLevel(UINT8 **cp, INT32 playernum); static void Got_PartyInvite(UINT8 **cp, INT32 playernum); static void Got_AcceptPartyInvite(UINT8 **cp, INT32 playernum); +static void Got_CancelPartyInvite(UINT8 **cp, INT32 playernum); static void Got_LeaveParty(UINT8 **cp, INT32 playernum); static void Got_Mapcmd(UINT8 **cp, INT32 playernum); static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum); @@ -138,6 +139,7 @@ static void Command_View_f (void); static void Command_SetViews_f(void); static void Command_Invite_f(void); +static void Command_CancelInvite_f(void); static void Command_AcceptInvite_f(void); static void Command_RejectInvite_f(void); static void Command_LeaveParty_f(void); @@ -554,6 +556,7 @@ void D_RegisterServerCommands(void) RegisterNetXCmd(XD_POWERLEVEL, Got_PowerLevel); RegisterNetXCmd(XD_PARTYINVITE, Got_PartyInvite); RegisterNetXCmd(XD_ACCEPTPARTYINVITE, Got_AcceptPartyInvite); + RegisterNetXCmd(XD_CANCELPARTYINVITE, Got_CancelPartyInvite); RegisterNetXCmd(XD_LEAVEPARTY, Got_LeaveParty); RegisterNetXCmd(XD_MAP, Got_Mapcmd); RegisterNetXCmd(XD_EXITLEVEL, Got_ExitLevelcmd); @@ -765,6 +768,7 @@ void D_RegisterClientCommands(void) COM_AddCommand("changeteam4", Command_Teamchange4_f); COM_AddCommand("invite", Command_Invite_f); + COM_AddCommand("cancelinvite", Command_CancelInvite_f); COM_AddCommand("acceptinvite", Command_AcceptInvite_f); COM_AddCommand("rejectinvite", Command_RejectInvite_f); COM_AddCommand("leaveparty", Command_LeaveParty_f); @@ -2096,6 +2100,43 @@ static void Got_AcceptPartyInvite(UINT8 **cp,INT32 playernum) } } +static void Got_CancelPartyInvite(UINT8 **cp,INT32 playernum) +{ + UINT8 invitee; + + invitee = READUINT8 (*cp); + + if ( + invitee >= 0 && + invitee < MAXPLAYERS && + playeringame[invitee] + ){ + invitee = playerconsole[invitee]; + + if (splitscreen_invitations[invitee] == playerconsole[playernum]) + { + splitscreen_invitations[invitee] = -1; + + if (consoleplayer == invitee) + { + HU_AddChatText("\x85*Your invitation has been rescinded.", true); + } + } + } + else + { + CONS_Alert(CONS_WARNING, M_GetText("Illegal cancel splitscreen invite received from %s\n"), player_names[playernum]); + if (server) + { + XBOXSTATIC UINT8 buf[2]; + + buf[0] = (UINT8)playernum; + buf[1] = KICK_MSG_CON_FAIL; + SendNetXCmd(XD_KICK, &buf, 2); + } + } +} + static void Got_LeaveParty(UINT8 **cp,INT32 playernum) { if (playerconsole[playernum] != playernum) @@ -2438,6 +2479,45 @@ Command_Invite_f (void) SendNetXCmd(XD_PARTYINVITE, &invitee, 1); } +static void +Command_CancelInvite_f (void) +{ + UINT8 invitee; + + if (COM_Argc() != 2) + { + CONS_Printf("cancelinvite : Rescind a party invitation.\n"); + return; + } + + invitee = LookupPlayer(COM_Argv(1)); + + if (invitee == -1) + { + CONS_Alert(CONS_WARNING, "There is no player by that name!\n"); + return; + } + if (!playeringame[invitee]) + { + CONS_Alert(CONS_WARNING, "There is no player using that slot!\n"); + return; + } + + if (splitscreen_invitations[invitee] != consoleplayer) + { + CONS_Alert(CONS_WARNING, + "You have not invited this player!\n"); + } + + CONS_Printf( + "Rescinding invite to %s...\n", + VaguePartyDescription( + invitee, splitscreen_original_party_size, '\x80') + ); + + SendNetXCmd(XD_CANCELPARTYINVITE, &invitee, 1); +} + static boolean CheckPartyInvite (void) { diff --git a/src/d_netcmd.h b/src/d_netcmd.h index fe1f59ad2..b18dfa59c 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -182,9 +182,10 @@ typedef enum XD_PARTYINVITE, // 27 XD_ACCEPTPARTYINVITE, // 28 XD_LEAVEPARTY, // 29 + XD_CANCELPARTYINVITE, // 30 #ifdef HAVE_BLUA - XD_LUACMD, // 30 - XD_LUAVAR, // 31 + XD_LUACMD, // 31 + XD_LUAVAR, // 32 #endif MAXNETXCMD } netxcmd_t; From 74f47f83f2fb2f902c4e2d62f490e3157613d5d1 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 3 Mar 2020 19:22:32 -0800 Subject: [PATCH 049/117] Party yourself with ALL party members when being added to a party --- src/g_splitscreen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_splitscreen.c b/src/g_splitscreen.c index 939eacef0..7aec3f159 100644 --- a/src/g_splitscreen.c +++ b/src/g_splitscreen.c @@ -188,10 +188,10 @@ G_AddPartyMember (int invitation, int playernum) } else if (playernum == consoleplayer) { - splitscreen_partied[invitation] = true; - for (i = 0; i < new_party_size; ++i) { + splitscreen_partied[playerconsole[party[i]]] = true; + displayplayers[i] = party[i]; P_ResetCamera(&players[displayplayers[i]], &camera[i]); } From 32d1abeb2b4ae29155696c9688dabf66073b3c35 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Tue, 17 Mar 2020 19:22:13 -0400 Subject: [PATCH 050/117] Bubble cooldown is longer It was meant to be the same length as inflate & deflate AFTER you were done, but it was only half of that -- now you're vulnerable for the same amount of time as you held it down. --- src/k_kart.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 8079b2c63..d52afa2eb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6592,8 +6592,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { if (player->kartstuff[k_bubbleblowup] == 0) S_StartSound(player->mo, sfx_s3k75); + player->kartstuff[k_bubbleblowup]++; - player->kartstuff[k_bubblecool] = player->kartstuff[k_bubbleblowup]*3; + player->kartstuff[k_bubblecool] = player->kartstuff[k_bubbleblowup]*4; + if (player->kartstuff[k_bubbleblowup] > bubbletime*2) { K_ThrowKartItem(player, (player->kartstuff[k_throwdir] > 0), MT_BUBBLESHIELDTRAP, -1, 0); From eb2c36348ebd432e88d1b8b83bb7da45f7bb4783 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Tue, 17 Mar 2020 19:27:09 -0400 Subject: [PATCH 051/117] Bubble Shield trap overlay fixes - Add player momentum to it, so that it lines up better - Set noclip so it doesn't stop against walls --- src/p_mobj.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 0bcb1695d..58e25f334 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9709,12 +9709,13 @@ void P_MobjThinker(mobj_t *mobj) { player_t *player = mobj->tracer->player; + mobj->flags = MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOCLIPTHING|MF_NOGRAVITY|MF_DONTENCOREMAP; mobj->extravalue1 = 1; P_TeleportMove(mobj, - mobj->tracer->x + P_ReturnThrustX(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->y + P_ReturnThrustY(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->z - (4*mobj->tracer->scale) + (P_RandomRange(-abs(mobj->cvmem), abs(mobj->cvmem))<tracer->x + mobj->tracer->momx + P_ReturnThrustX(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->y + mobj->tracer->momy + P_ReturnThrustY(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->z + mobj->tracer->momz - (4*mobj->tracer->scale) + (P_RandomRange(-abs(mobj->cvmem), abs(mobj->cvmem))<cvmem /= 2; mobj->momz = 0; From 54e144485266c8aeeb6c606ccab762f3b60979aa Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Tue, 17 Mar 2020 19:41:53 -0400 Subject: [PATCH 052/117] Reset bubble cooldown & holdready when used --- src/k_kart.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index a1c4d534b..b8238f3f5 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6749,6 +6749,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground) K_ThrowKartItem(player, (player->kartstuff[k_throwdir] > 0), MT_BUBBLESHIELDTRAP, -1, 0); K_PlayAttackTaunt(player->mo); player->kartstuff[k_bubbleblowup] = 0; + player->kartstuff[k_bubblecool] = 0; + player->kartstuff[k_holdready] = 0; player->kartstuff[k_itemamount]--; } } @@ -6757,8 +6759,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { if (player->kartstuff[k_bubbleblowup] > bubbletime) player->kartstuff[k_bubbleblowup] = bubbletime; + if (player->kartstuff[k_bubbleblowup]) player->kartstuff[k_bubbleblowup]--; + player->kartstuff[k_holdready] = (player->kartstuff[k_bubblecool] ? 0 : 1); } } From 1886115e54a58eb1639e1b90db247add621eb3bb Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Tue, 17 Mar 2020 20:30:30 -0400 Subject: [PATCH 053/117] Allow Eggman items to be picked up by players using invulerability items --- src/p_inter.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 165cfae84..37b7ff36f 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -108,7 +108,7 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon) return false; /*if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) // No bumpers in Match - return false;*/ + return false;*/ if (weapon) { @@ -118,10 +118,7 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon) // Invulnerable if (player->powers[pw_flashing] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinouttype] != 2) - || player->kartstuff[k_squishedtimer] > 0 - || player->kartstuff[k_invincibilitytimer] > 0 - || player->kartstuff[k_growshrinktimer] > 0 - || player->kartstuff[k_hyudorotimer] > 0) + || player->kartstuff[k_squishedtimer] > 0) return false; // Already have fake From e5fb55df8369818673a5ee89d54300610985b89e Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Tue, 17 Mar 2020 20:36:23 -0400 Subject: [PATCH 054/117] Fix infinite bubble bug --- src/k_kart.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index b8238f3f5..980104301 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6734,25 +6734,22 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (!HOLDING_ITEM && NO_HYUDORO) { - if (cmd->buttons & BT_ATTACK) + if ((cmd->buttons & BT_ATTACK) && player->kartstuff[k_holdready]) { - if (player->kartstuff[k_holdready]) + if (player->kartstuff[k_bubbleblowup] == 0) + S_StartSound(player->mo, sfx_s3k75); + + player->kartstuff[k_bubbleblowup]++; + player->kartstuff[k_bubblecool] = player->kartstuff[k_bubbleblowup]*4; + + if (player->kartstuff[k_bubbleblowup] > bubbletime*2) { - if (player->kartstuff[k_bubbleblowup] == 0) - S_StartSound(player->mo, sfx_s3k75); - - player->kartstuff[k_bubbleblowup]++; - player->kartstuff[k_bubblecool] = player->kartstuff[k_bubbleblowup]*4; - - if (player->kartstuff[k_bubbleblowup] > bubbletime*2) - { - K_ThrowKartItem(player, (player->kartstuff[k_throwdir] > 0), MT_BUBBLESHIELDTRAP, -1, 0); - K_PlayAttackTaunt(player->mo); - player->kartstuff[k_bubbleblowup] = 0; - player->kartstuff[k_bubblecool] = 0; - player->kartstuff[k_holdready] = 0; - player->kartstuff[k_itemamount]--; - } + K_ThrowKartItem(player, (player->kartstuff[k_throwdir] > 0), MT_BUBBLESHIELDTRAP, -1, 0); + K_PlayAttackTaunt(player->mo); + player->kartstuff[k_bubbleblowup] = 0; + player->kartstuff[k_bubblecool] = 0; + player->kartstuff[k_holdready] = 0; + player->kartstuff[k_itemamount]--; } } else From dad1d7b610381e6ab7fa8798ac44121ee0b17eea Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Tue, 17 Mar 2020 20:37:36 -0400 Subject: [PATCH 055/117] Apply to flame shield as well (although it didn't need it) --- src/k_kart.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 980104301..0574a15ce 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6776,20 +6776,19 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (!HOLDING_ITEM && NO_HYUDORO) { - if (cmd->buttons & BT_ATTACK) + if ((cmd->buttons & BT_ATTACK) && player->kartstuff[k_holdready]) { - if (player->kartstuff[k_holdready]) + if (player->kartstuff[k_flamedash] == 0) + K_PlayBoostTaunt(player->mo); + + player->kartstuff[k_flamedash]++; + + if (player->kartstuff[k_flamedash] > 10*TICRATE) { - if (player->kartstuff[k_flamedash] == 0) - K_PlayBoostTaunt(player->mo); - player->kartstuff[k_flamedash]++; - if (player->kartstuff[k_flamedash] > 10*TICRATE) - { - K_FlameShieldPop(player->mo); - player->kartstuff[k_flamedash] = 0; - player->kartstuff[k_holdready] = 0; - player->kartstuff[k_itemamount]--; - } + K_FlameShieldPop(player->mo); + player->kartstuff[k_flamedash] = 0; + player->kartstuff[k_holdready] = 0; + player->kartstuff[k_itemamount]--; } } else From c313de326ed9cba3cbd1dc5d185c1bee563f0a23 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Tue, 17 Mar 2020 20:47:05 -0400 Subject: [PATCH 056/117] Teleport bubble trap overlay after slowing down rather than before --- src/p_mobj.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 70b97f851..d8baad638 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9467,11 +9467,6 @@ void P_MobjThinker(mobj_t *mobj) mobj->flags = MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOCLIPTHING|MF_NOGRAVITY|MF_DONTENCOREMAP; mobj->extravalue1 = 1; - P_TeleportMove(mobj, - mobj->tracer->x + mobj->tracer->momx + P_ReturnThrustX(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->y + mobj->tracer->momy + P_ReturnThrustY(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->z + mobj->tracer->momz - (4*mobj->tracer->scale) + (P_RandomRange(-abs(mobj->cvmem), abs(mobj->cvmem))<cvmem /= 2; mobj->momz = 0; mobj->destscale = ((5*mobj->tracer->scale)>>2) + (mobj->tracer->scale>>3); @@ -9480,6 +9475,11 @@ void P_MobjThinker(mobj_t *mobj) mobj->tracer->momy = (63*mobj->tracer->momy)/64; mobj->tracer->momz = (8*mobj->tracer->scale) * P_MobjFlip(mobj->tracer); + P_TeleportMove(mobj, + mobj->tracer->x + mobj->tracer->momx + P_ReturnThrustX(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->y + mobj->tracer->momy + P_ReturnThrustY(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->z + mobj->tracer->momz - (4*mobj->tracer->scale) + (P_RandomRange(-abs(mobj->cvmem), abs(mobj->cvmem))<movecount > 8*TICRATE) { S_StartSound(mobj->tracer, sfx_s3k77); From bb516042a8fd0dae97252bedbd2fc25f89a8cad0 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Tue, 17 Mar 2020 21:02:44 -0400 Subject: [PATCH 057/117] Correct shadow size --- 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 d8baad638..d9df21eaf 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10318,7 +10318,7 @@ static void P_DefaultMobjShadowScale(mobj_t *thing) case MT_BUBBLESHIELD: case MT_BUBBLESHIELDTRAP: case MT_FLAMESHIELD: - thing->shadowscale = 2*FRACUNIT; + thing->shadowscale = FRACUNIT; break; case MT_RING: case MT_FLOATINGITEM: From 10c625b42ebdf2736a27d54d89bbe05bae0f8f2a Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Wed, 18 Mar 2020 02:38:02 -0400 Subject: [PATCH 058/117] Start on flame shield rework --- src/d_player.h | 1 + src/dehacked.c | 1 + src/k_kart.c | 94 ++++++++++++++++++++++++++++++-------------------- 3 files changed, 58 insertions(+), 38 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 63e6dd397..8414cd81d 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -319,6 +319,7 @@ typedef enum k_bubblecool, // Bubble Shield use cooldown k_bubbleblowup, // Bubble Shield usage blowup k_flamedash, // Flame Shield dash power + k_flamemeter, // Flame Shield dash meter left k_eggmanheld, // Eggman monitor held, separate from k_itemheld so it doesn't stop you from getting items k_eggmanexplode, // Fake item recieved, explode in a few seconds k_eggmanblame, // Fake item recieved, who set this fake diff --git a/src/dehacked.c b/src/dehacked.c index fdf2ddd3a..39744f7a0 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8529,6 +8529,7 @@ static const char *const KARTSTUFF_LIST[] = { "BUBBLECOOL", "BUBBLEBLOWUP", "FLAMEDASH", + "FLAMEMETER", "EGGMANHELD", "EGGMANEXPLODE", "EGGMANBLAME", diff --git a/src/k_kart.c b/src/k_kart.c index 0574a15ce..adbdf6836 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2283,10 +2283,7 @@ static void K_GetKartBoostPower(player_t *player) ADDBOOST((3*FRACUNIT)/8, 3*FRACUNIT); // + 37.5% top speed, + 300% acceleration if (player->kartstuff[k_flamedash]) // Flame Shield dash - { - fixed_t dashval = ((player->kartstuff[k_flamedash]<kartstuff[k_startboost]) // Startup Boost ADDBOOST(FRACUNIT/4, 6*FRACUNIT); // + 25% top speed, + 600% acceleration @@ -2298,7 +2295,7 @@ static void K_GetKartBoostPower(player_t *player) ADDBOOST(FRACUNIT/5, 4*FRACUNIT); // + 20% top speed, + 400% acceleration if (player->kartstuff[k_eggmanexplode]) // Ready-to-explode - ADDBOOST(FRACUNIT/5, 2*FRACUNIT); // + 20% top speed, + 200% acceleration + ADDBOOST(FRACUNIT/5, FRACUNIT); // + 20% top speed, + 100% acceleration if (player->kartstuff[k_draftpower] > 0) // Drafting { @@ -5620,6 +5617,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_levelbooster]) player->kartstuff[k_levelbooster]--; + if (player->kartstuff[k_flamedash]) + player->kartstuff[k_flamedash]--; + if (EITHERSNEAKER(player) && player->kartstuff[k_wipeoutslow] > 0 && player->kartstuff[k_wipeoutslow] < wipeoutslowtime+1) player->kartstuff[k_wipeoutslow] = wipeoutslowtime+1; @@ -5764,12 +5764,10 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->kartstuff[k_bubblecool] = 0; } - if (player->kartstuff[k_itemtype] != KITEM_FLAMESHIELD - || player->exiting || player->kartstuff[k_spinouttimer] || player->kartstuff[k_squishedtimer]) + if (player->kartstuff[k_itemtype] != KITEM_FLAMESHIELD || player->exiting) { if (player->kartstuff[k_flamedash]) K_FlameShieldPop(player->mo); - player->kartstuff[k_flamedash] = 0; } if (player->kartstuff[k_comebacktimer]) @@ -5922,14 +5920,6 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue) if (player->spectator) return turnvalue; - if (player->kartstuff[k_flamedash]) // Reduce turning - { - fixed_t dashval = ((player->kartstuff[k_flamedash]< FRACUNIT) - return 0; // NO MORE TURNING! - turnvalue = FixedMul(turnvalue, FRACUNIT-dashval); - } - if (player->kartstuff[k_drift] != 0 && P_IsObjectOnGround(player->mo)) { // If we're drifting we have a completely different turning value @@ -6776,35 +6766,36 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (!HOLDING_ITEM && NO_HYUDORO) { + INT32 flamemax = 16 * (TICRATE/4); + if ((cmd->buttons & BT_ATTACK) && player->kartstuff[k_holdready]) { + if (player->kartstuff[k_flamemeter] > flamemax) + player->kartstuff[k_flamemeter] = flamemax; + if (player->kartstuff[k_flamedash] == 0) K_PlayBoostTaunt(player->mo); - player->kartstuff[k_flamedash]++; + player->kartstuff[k_flamedash] += 2; - if (player->kartstuff[k_flamedash] > 10*TICRATE) + if (player->kartstuff[k_flamemeter] <= 0) { K_FlameShieldPop(player->mo); - player->kartstuff[k_flamedash] = 0; - player->kartstuff[k_holdready] = 0; - player->kartstuff[k_itemamount]--; - } - } - else - { - if (player->kartstuff[k_flamedash] > (TICRATE*2)) - { - K_FlameShieldPop(player->mo); - player->kartstuff[k_flamedash] = 0; + player->kartstuff[k_flamemeter] = flamemax; player->kartstuff[k_holdready] = 0; player->kartstuff[k_itemamount]--; } else - { - player->kartstuff[k_flamedash] = 0; - player->kartstuff[k_holdready] = 1; - } + player->kartstuff[k_flamemeter] -= 2; + } + else + { + player->kartstuff[k_holdready] = 1; + + if (player->kartstuff[k_flamemeter] > flamemax || player->kartstuff[k_flamemeter] == 0) + player->kartstuff[k_flamemeter] = flamemax; + else if (player->kartstuff[k_flamemeter] < flamemax) + player->kartstuff[k_flamemeter]++; } } break; @@ -7466,6 +7457,9 @@ static patch_t *kp_check[6]; static patch_t *kp_eggnum[4]; +static patch_t *kp_flameshieldmeter[104]; +static patch_t *kp_flameshieldmeter_bg; + static patch_t *kp_fpview[3]; static patch_t *kp_inputwheel[5]; @@ -7674,6 +7668,17 @@ void K_LoadKartHUDGraphics(void) kp_kitchensink[0] = W_CachePatchName("K_ITSINK", PU_HUDGFX); kp_sadface[0] = W_CachePatchName("K_ITSAD", PU_HUDGFX); + kp_flameshieldmeter_bg = W_CachePatchName("FSMBG001", PU_HUDGFX); + + sprintf(buffer, "FSMFGxxx"); + for (i = 0; i < 104; i++) + { + buffer[5] = '0'+((i+1)/100); + buffer[6] = '0'+(((i+1)/10)%10); + buffer[7] = '0'+((i+1)%10); + kp_flameshieldmeter[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + } + // Splitscreen kp_itembg[2] = W_CachePatchName("K_ISBG", PU_HUDGFX); kp_itembg[3] = W_CachePatchName("K_ISBGD", PU_HUDGFX); @@ -8230,15 +8235,11 @@ static void K_drawKartItem(void) localbg = kp_itembg[offset+1]; break; case KITEM_BUBBLESHIELD: - localpatch = kp_bubbleshield[offset]; localbg = kp_itembg[offset+1]; break; case KITEM_FLAMESHIELD: - if (stplyr->kartstuff[k_flamedash] > (TICRATE*2) && (leveltime & 1)) - localpatch = kp_nodraw; - else - localpatch = kp_flameshield[offset]; + localpatch = kp_flameshield[offset]; localbg = kp_itembg[offset+1]; break; case KITEM_HYUDORO: @@ -8355,6 +8356,23 @@ static void K_drawKartItem(void) // Quick Eggman numbers if (stplyr->kartstuff[k_eggmanexplode] > 1 /*&& stplyr->kartstuff[k_eggmanexplode] <= 3*TICRATE*/) V_DrawScaledPatch(fx+17, fy+13-offset, V_HUDTRANS|fflags, kp_eggnum[min(3, G_TicsToSeconds(stplyr->kartstuff[k_eggmanexplode]))]); + + if (stplyr->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) + { + INT32 flamemax = 16 * (TICRATE/4); + INT32 numframes = 104; + INT32 f = (stplyr->kartstuff[k_flamemeter] * numframes) / flamemax; + + if (f < 1) + f = 1; + if (f > numframes) + f = numframes; + + V_DrawScaledPatch(fx-6, fy-4, V_HUDTRANS|fflags, kp_flameshieldmeter_bg); + + if (stplyr->kartstuff[k_flamemeter] < flamemax) + V_DrawScaledPatch(fx-6, fy-4, V_HUDTRANS|fflags, kp_flameshieldmeter[f-1]); + } } void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UINT8 mode) From 26794eef469e4e17687c73c5317b3a2e7b7abe04 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 18 Mar 2020 19:42:13 -0700 Subject: [PATCH 059/117] Draw mini ping counter in splitscreen --- src/hu_stuff.c | 42 +++++++++++++++++++++++++++++++++--------- src/hu_stuff.h | 1 + src/k_kart.c | 34 ++++++++++++++++++++++++++++++++++ src/screen.c | 2 +- 4 files changed, 69 insertions(+), 10 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index ad64552d8..c9fb7f45e 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -78,6 +78,7 @@ patch_t *cred_font[CRED_FONTSIZE]; // Note: I'd like to adress that at this point we might *REALLY* want to work towards a common drawString function that can take any font we want because this is really turning into a MESS. :V -Lat' patch_t *pingnum[10]; patch_t *pinggfx[5]; // small ping graphic +patch_t *mping[5]; // smaller ping graphic patch_t *framecounter; patch_t *frameslash; // framerate stuff. Used in screen.c @@ -311,6 +312,8 @@ void HU_LoadGraphics(void) { sprintf(buffer, "PINGGFX%d", i+1); pinggfx[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX); + sprintf(buffer, "MPING%d", i+1); + mping[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX); } // fps stuff @@ -2480,22 +2483,30 @@ void HU_Erase(void) // IN-LEVEL MULTIPLAYER RANKINGS //====================================================================== +static int +Ping_gfx_num (int ping) +{ + if (ping < 76) + return 0; + else if (ping < 137) + return 1; + else if (ping < 256) + return 2; + else if (ping < 500) + return 3; + else + return 4; +} + // // HU_drawPing // void HU_drawPing(INT32 x, INT32 y, UINT32 ping, INT32 flags) { - INT32 gfxnum = 4; // gfx to draw + INT32 gfxnum; // gfx to draw UINT8 const *colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SALMON, GTC_CACHE); - if (ping < 76) - gfxnum = 0; - else if (ping < 137) - gfxnum = 1; - else if (ping < 256) - gfxnum = 2; - else if (ping < 500) - gfxnum = 3; + gfxnum = Ping_gfx_num(ping); V_DrawScaledPatch(x, y, flags, pinggfx[gfxnum]); if (servermaxping && ping > servermaxping && hu_tick < 4) // flash ping red if too high @@ -2504,6 +2515,19 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 ping, INT32 flags) V_DrawPingNum(x, y+9, flags, ping, NULL); } +void +HU_drawMiniPing (INT32 x, INT32 y, UINT32 ping, INT32 flags) +{ + patch_t *patch; + + patch = mping[Ping_gfx_num(ping)]; + + if (( flags & V_SNAPTORIGHT )) + x += ( BASEVIDWIDTH - SHORT (patch->width) ); + + V_DrawScaledPatch(x, y, flags, patch); +} + // // HU_DrawTabRankings -- moved to k_kart.c // diff --git a/src/hu_stuff.h b/src/hu_stuff.h index be6798a82..c3da1d2a2 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -115,6 +115,7 @@ char HU_dequeueChatChar(void); void HU_Erase(void); void HU_clearChatChars(void); void HU_drawPing(INT32 x, INT32 y, UINT32 ping, INT32 flags); // Lat': Ping drawer for scoreboard. +void HU_drawMiniPing(INT32 x, INT32 y, UINT32 ping, INT32 flags); //void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer); //void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer); void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol); diff --git a/src/k_kart.c b/src/k_kart.c index 4b482772f..0f540943f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9884,6 +9884,35 @@ void K_drawKartFreePlay(UINT32 flashtime) LAPS_Y+3, V_HUDTRANS|V_SNAPTOBOTTOM|V_SNAPTORIGHT, "FREE PLAY"); } +static void +Draw_party_ping (int ss, INT32 snap) +{ + HU_drawMiniPing(0, 0, playerpingtable[displayplayers[ss]], V_HUDTRANS|snap); +} + +static void +K_drawMiniPing (void) +{ + if (cv_showping.value) + { + switch (r_splitscreen) + { + case 3: + Draw_party_ping(3, V_SNAPTORIGHT|V_SPLITSCREEN); + /*FALLTHRU*/ + case 2: + Draw_party_ping(2, V_SPLITSCREEN); + Draw_party_ping(1, V_SNAPTORIGHT); + Draw_party_ping(0, 0); + break; + case 1: + Draw_party_ping(1, V_SNAPTORIGHT|V_SPLITSCREEN); + Draw_party_ping(0, V_SNAPTORIGHT); + break; + } + } +} + static void K_drawDistributionDebugger(void) { patch_t *items[NUMKARTRESULTS] = { @@ -10212,6 +10241,11 @@ void K_drawKartHUD(void) K_drawKartFreePlay(leveltime); } + if (netgame && r_splitscreen) + { + K_drawMiniPing(); + } + if (cv_kartdebugdistribution.value) K_drawDistributionDebugger(); diff --git a/src/screen.c b/src/screen.c index 96a78ae8e..5b38f82db 100644 --- a/src/screen.c +++ b/src/screen.c @@ -445,7 +445,7 @@ void SCR_DisplayTicRate(void) void SCR_DisplayLocalPing(void) { UINT32 ping = playerpingtable[consoleplayer]; // consoleplayer's ping is everyone's ping in a splitnetgame :P - if (cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping)) // only show 2 (warning) if our ping is at a bad level + if (! r_splitscreen && ( cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping) )) // only show 2 (warning) if our ping is at a bad level { INT32 dispy = cv_ticrate.value ? 160 : 181; HU_drawPing(307, dispy, ping, V_SNAPTORIGHT | V_SNAPTOBOTTOM | V_HUDTRANS); From 9de1e535f2dbb6b1d95374f16311ab6415e3fc36 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 19 Mar 2020 01:35:31 -0400 Subject: [PATCH 060/117] More complete flame shield rework --- src/d_player.h | 1 + src/dehacked.c | 1 + src/k_kart.c | 130 +++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 106 insertions(+), 26 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 8414cd81d..c72c5df12 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -320,6 +320,7 @@ typedef enum k_bubbleblowup, // Bubble Shield usage blowup k_flamedash, // Flame Shield dash power k_flamemeter, // Flame Shield dash meter left + k_flamelength, // Flame Shield dash meter, number of segments k_eggmanheld, // Eggman monitor held, separate from k_itemheld so it doesn't stop you from getting items k_eggmanexplode, // Fake item recieved, explode in a few seconds k_eggmanblame, // Fake item recieved, who set this fake diff --git a/src/dehacked.c b/src/dehacked.c index 39744f7a0..3933a4207 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8530,6 +8530,7 @@ static const char *const KARTSTUFF_LIST[] = { "BUBBLEBLOWUP", "FLAMEDASH", "FLAMEMETER", + "FLAMELENGTH", "EGGMANHELD", "EGGMANEXPLODE", "EGGMANBLAME", diff --git a/src/k_kart.c b/src/k_kart.c index adbdf6836..ccce760fb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2283,7 +2283,10 @@ static void K_GetKartBoostPower(player_t *player) ADDBOOST((3*FRACUNIT)/8, 3*FRACUNIT); // + 37.5% top speed, + 300% acceleration if (player->kartstuff[k_flamedash]) // Flame Shield dash - ADDBOOST((3*FRACUNIT)/4, 6*FRACUNIT); // + 75% top speed, + 600% acceleration + { + fixed_t dashval = ((player->kartstuff[k_flamedash]<kartstuff[k_startboost]) // Startup Boost ADDBOOST(FRACUNIT/4, 6*FRACUNIT); // + 25% top speed, + 600% acceleration @@ -6283,6 +6286,23 @@ void K_StripOther(player_t *player) } } +static INT32 K_FlameShieldMax(player_t *player) +{ + UINT8 numplayers = 0; + UINT8 i; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i] && !players[i].spectator) + numplayers++; + } + + if (numplayers > 1) + return player->kartstuff[k_position] + 8; + else + return 16; // max when alone, for testing +} + // // K_MoveKartPlayer // @@ -6766,36 +6786,34 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (!HOLDING_ITEM && NO_HYUDORO) { - INT32 flamemax = 16 * (TICRATE/4); + INT32 flamemax = player->kartstuff[k_flamelength] * (TICRATE/4); if ((cmd->buttons & BT_ATTACK) && player->kartstuff[k_holdready]) { - if (player->kartstuff[k_flamemeter] > flamemax) - player->kartstuff[k_flamemeter] = flamemax; + if (player->kartstuff[k_flamemeter] < 0) + player->kartstuff[k_flamemeter] = 0; if (player->kartstuff[k_flamedash] == 0) K_PlayBoostTaunt(player->mo); player->kartstuff[k_flamedash] += 2; + player->kartstuff[k_flamemeter] += 2; - if (player->kartstuff[k_flamemeter] <= 0) + if (player->kartstuff[k_flamemeter] > flamemax) { K_FlameShieldPop(player->mo); - player->kartstuff[k_flamemeter] = flamemax; + player->kartstuff[k_flamemeter] = 0; + player->kartstuff[k_flamelength] = 0; player->kartstuff[k_holdready] = 0; player->kartstuff[k_itemamount]--; } - else - player->kartstuff[k_flamemeter] -= 2; } else { player->kartstuff[k_holdready] = 1; - if (player->kartstuff[k_flamemeter] > flamemax || player->kartstuff[k_flamemeter] == 0) - player->kartstuff[k_flamemeter] = flamemax; - else if (player->kartstuff[k_flamemeter] < flamemax) - player->kartstuff[k_flamemeter]++; + if (player->kartstuff[k_flamemeter] > 0) + player->kartstuff[k_flamemeter]--; } } break; @@ -6882,6 +6900,19 @@ void K_MoveKartPlayer(player_t *player, boolean onground) || player->kartstuff[k_growshrinktimer] < 0) indirectitemcooldown = 20*TICRATE; + if (player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) + { + INT32 destlen = K_FlameShieldMax(player); + if (player->kartstuff[k_flamelength] > destlen) + player->kartstuff[k_flamelength]--; + else if (player->kartstuff[k_flamelength] < destlen) + player->kartstuff[k_flamelength]++; + } + else + { + player->kartstuff[k_flamelength] = 0; + } + if (player->kartstuff[k_hyudorotimer] > 0) { if (splitscreen) @@ -7457,8 +7488,8 @@ static patch_t *kp_check[6]; static patch_t *kp_eggnum[4]; -static patch_t *kp_flameshieldmeter[104]; -static patch_t *kp_flameshieldmeter_bg; +static patch_t *kp_flameshieldmeter[104][2]; +static patch_t *kp_flameshieldmeter_bg[16][2]; static patch_t *kp_fpview[3]; static patch_t *kp_inputwheel[5]; @@ -7668,15 +7699,21 @@ void K_LoadKartHUDGraphics(void) kp_kitchensink[0] = W_CachePatchName("K_ITSINK", PU_HUDGFX); kp_sadface[0] = W_CachePatchName("K_ITSAD", PU_HUDGFX); - kp_flameshieldmeter_bg = W_CachePatchName("FSMBG001", PU_HUDGFX); - sprintf(buffer, "FSMFGxxx"); for (i = 0; i < 104; i++) { buffer[5] = '0'+((i+1)/100); buffer[6] = '0'+(((i+1)/10)%10); buffer[7] = '0'+((i+1)%10); - kp_flameshieldmeter[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + kp_flameshieldmeter[i][0] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + } + + sprintf(buffer, "FSMBG0xx"); + for (i = 0; i < 16; i++) + { + buffer[6] = '0'+((i+1)/10); + buffer[7] = '0'+((i+1)%10); + kp_flameshieldmeter_bg[i][0] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); } // Splitscreen @@ -7711,6 +7748,23 @@ void K_LoadKartHUDGraphics(void) kp_kitchensink[1] = W_CachePatchName("K_ISSINK", PU_HUDGFX); kp_sadface[1] = W_CachePatchName("K_ISSAD", PU_HUDGFX); + sprintf(buffer, "FSMFSxxx"); + for (i = 0; i < 104; i++) + { + buffer[5] = '0'+((i+1)/100); + buffer[6] = '0'+(((i+1)/10)%10); + buffer[7] = '0'+((i+1)%10); + kp_flameshieldmeter[i][1] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + } + + sprintf(buffer, "FSMBS0xx"); + for (i = 0; i < 16; i++) + { + buffer[6] = '0'+((i+1)/10); + buffer[7] = '0'+((i+1)%10); + kp_flameshieldmeter_bg[i][1] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + } + // CHECK indicators sprintf(buffer, "K_CHECKx"); for (i = 0; i < 6; i++) @@ -8359,19 +8413,43 @@ static void K_drawKartItem(void) if (stplyr->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) { - INT32 flamemax = 16 * (TICRATE/4); INT32 numframes = 104; - INT32 f = (stplyr->kartstuff[k_flamemeter] * numframes) / flamemax; + INT32 absolutemax = 16 * (TICRATE/4); + INT32 flamemax = stplyr->kartstuff[k_flamelength] * (TICRATE/4); + INT32 bf = 16 - (flamemax / (TICRATE/4)); + INT32 ff = numframes - ((stplyr->kartstuff[k_flamemeter] * numframes) / absolutemax); + INT32 xo = 6, yo = 4; + INT32 flip = 0; - if (f < 1) - f = 1; - if (f > numframes) - f = numframes; + if (offset) + { + xo++; - V_DrawScaledPatch(fx-6, fy-4, V_HUDTRANS|fflags, kp_flameshieldmeter_bg); + if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // Flip for P1 and P3 (yes, that's correct) + { + xo -= 62; + flip = V_FLIP; + } + } - if (stplyr->kartstuff[k_flamemeter] < flamemax) - V_DrawScaledPatch(fx-6, fy-4, V_HUDTRANS|fflags, kp_flameshieldmeter[f-1]); + if (ff < 0) {ff = 0;} + if (ff > numframes-1) {ff = numframes-1;} + + if (flamemax > 0) + V_DrawScaledPatch(fx-xo, fy-yo, V_HUDTRANS|fflags|flip, kp_flameshieldmeter_bg[bf][offset]); + + if (stplyr->kartstuff[k_flamemeter] > 0) + { + if (stplyr->kartstuff[k_flamemeter] > (flamemax - (TICRATE/2)) && (leveltime & 1)) + { + UINT8 *fsflash = R_GetTranslationColormap(TC_BLINK, SKINCOLOR_WHITE, GTC_CACHE); + V_DrawMappedPatch(fx-xo, fy-yo, V_HUDTRANS|fflags|flip, kp_flameshieldmeter[ff][offset], fsflash); + } + else + { + V_DrawScaledPatch(fx-xo, fy-yo, V_HUDTRANS|fflags|flip, kp_flameshieldmeter[ff][offset]); + } + } } } From f8d5a5bdf1b926dfc0eeb9ad069643f4d084090c Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 19 Mar 2020 02:12:09 -0400 Subject: [PATCH 061/117] Copy boost smoke effect but bigger --- src/k_kart.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index ccce760fb..bae1e6717 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3940,24 +3940,21 @@ static void K_DoThunderShield(player_t *player) static void K_FlameShieldPop(mobj_t *src) { - mobj_t *smoke; UINT8 i; - //S_StartSound(src, sfx_zio3); - - // spawn vertical bolt - for (i = 0; i < 8; i++) + for (i = 0; i < 2; i++) { - smoke = P_SpawnMobj(src->x, src->y, src->z, MT_SMOKE); - P_SetMobjState(smoke, S_OPAQUESMOKE1); - P_SetScale(smoke, 2*smoke->scale); - smoke->destscale = 8*smoke->scale; - smoke->angle = FixedAngle((i*45)<fuse = P_RandomRange(20, 50); - smoke->momx = src->momx; - smoke->momy = src->momy; - smoke->momz = src->momz + (P_RandomRange(1,4) * smoke->scale); - P_Thrust(smoke, smoke->angle, (P_RandomRange(1,2) * smoke->scale)); + mobj_t *smoke = P_SpawnMobj(src->x, src->y, src->z+(8<scale); + smoke->destscale = 3*src->scale/2; + smoke->scalespeed = src->scale/12; + + smoke->momx = src->momx/2; + smoke->momy = src->momy/2; + smoke->momz = src->momz/2; + + P_Thrust(smoke, src->angle + FixedAngle(P_RandomRange(135, 225)<scale); } } From 6969c833c2a53cf9658a7f0c283eaca4ca4891f9 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 19 Mar 2020 02:17:12 -0400 Subject: [PATCH 062/117] Add more momentum variation --- src/k_kart.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index bae1e6717..d3b213524 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3950,11 +3950,12 @@ static void K_FlameShieldPop(mobj_t *src) smoke->destscale = 3*src->scale/2; smoke->scalespeed = src->scale/12; - smoke->momx = src->momx/2; - smoke->momy = src->momy/2; - smoke->momz = src->momz/2; + smoke->momx = 3*src->momx/4; + smoke->momy = 3*src->momy/4; + smoke->momz = 3*src->momz/4; P_Thrust(smoke, src->angle + FixedAngle(P_RandomRange(135, 225)<scale); + smoke->momz += P_RandomRange(0, 4) * src->scale; } } From ac8717b981bcf436d5ac76faa5cef48b49daf9cf Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 19 Mar 2020 20:17:25 -0400 Subject: [PATCH 063/117] Make flame gauge placeholder behavior proportional to player count --- src/k_kart.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index d3b213524..bd93dcd3e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6295,10 +6295,12 @@ static INT32 K_FlameShieldMax(player_t *player) numplayers++; } - if (numplayers > 1) - return player->kartstuff[k_position] + 8; - else + if (numplayers <= 1) return 16; // max when alone, for testing + else if (player->kartstuff[k_position] == 1) + return 1; // minimum for first + else + return (player->kartstuff[k_position] * 16) / numplayers; } // From 9a1c013cfc2c3134df583634273ce3cbcc9fda2d Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 19 Mar 2020 20:23:00 -0400 Subject: [PATCH 064/117] Add basic sound effect --- src/k_kart.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index bd93dcd3e..aa2511ad0 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6794,7 +6794,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->kartstuff[k_flamemeter] = 0; if (player->kartstuff[k_flamedash] == 0) + { + S_StartSound(player->mo, sfx_s3k43); K_PlayBoostTaunt(player->mo); + } player->kartstuff[k_flamedash] += 2; player->kartstuff[k_flamemeter] += 2; From 86edea91d47408b462205da35538ef0abf1333db Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Fri, 20 Mar 2020 00:27:31 -0400 Subject: [PATCH 065/117] Scale thrown items with grow/shrink --- src/k_kart.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index aa2511ad0..a81aaf4ed 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3135,7 +3135,6 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I th = P_SpawnMobj(x, y, z, type); th->flags2 |= flags2; - th->threshold = 10; if (th->info->seesound) @@ -3143,6 +3142,9 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I P_SetTarget(&th->target, source); + P_SetScale(th, source->scale); + th->destscale = source->destscale; + if (P_IsObjectOnGround(source)) { // floorz and ceilingz aren't properly set to account for FOFs and Polyobjects on spawn @@ -3802,6 +3804,9 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map mo->threshold = 10; P_SetTarget(&mo->target, player->mo); + P_SetScale(mo, player->mo->scale); + mo->destscale = player->mo->destscale; + if (P_IsObjectOnGround(player->mo)) { // floorz and ceilingz aren't properly set to account for FOFs and Polyobjects on spawn From e83e162463600fd51bf97519101a75729182113c Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Fri, 20 Mar 2020 00:30:50 -0400 Subject: [PATCH 066/117] Thrust when you extinguish flame shield --- src/k_kart.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/k_kart.c b/src/k_kart.c index a81aaf4ed..74c41d5a9 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6810,6 +6810,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_flamemeter] > flamemax) { K_FlameShieldPop(player->mo); + P_Thrust(player->mo, R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy), player->speed); player->kartstuff[k_flamemeter] = 0; player->kartstuff[k_flamelength] = 0; player->kartstuff[k_holdready] = 0; From 2ccc3894e24ad62e87dfabf6446bd67c7f8b2d72 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Fri, 20 Mar 2020 00:35:18 -0400 Subject: [PATCH 067/117] Make size differences impact bump knockback more --- 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 74c41d5a9..d5bffd9b4 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1296,7 +1296,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) static fixed_t K_PlayerWeight(mobj_t *mobj, mobj_t *against) { - fixed_t weight = 5*mobj->scale; + fixed_t weight = 5*FRACUNIT; if (!mobj->player) return weight; @@ -1309,11 +1309,11 @@ static fixed_t K_PlayerWeight(mobj_t *mobj, mobj_t *against) } else { - weight = (mobj->player->kartweight) * mobj->scale; + weight = (mobj->player->kartweight) * FRACUNIT; if (mobj->player->speed > K_GetKartSpeed(mobj->player, false)) weight += (mobj->player->speed - K_GetKartSpeed(mobj->player, false))/8; if (mobj->player->kartstuff[k_itemtype] == KITEM_BUBBLESHIELD) - weight += 9*mobj->scale; + weight += 9*FRACUNIT; } return weight; @@ -1321,7 +1321,7 @@ static fixed_t K_PlayerWeight(mobj_t *mobj, mobj_t *against) static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) { - fixed_t weight = 5*mobj->scale; + fixed_t weight = 5*FRACUNIT; switch (mobj->type) { @@ -1351,15 +1351,15 @@ static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) case MT_JAWZ_DUD: case MT_JAWZ_SHIELD: if (against->player) - weight = K_PlayerWeight(against, NULL) + (3*against->scale); + weight = K_PlayerWeight(against, NULL) + (3*FRACUNIT); else - weight += 3*mobj->scale; + weight += 3*FRACUNIT; break; default: break; } - return weight; + return FixedMul(weight, mobj->scale); } // This kind of wipeout happens with no rings -- doesn't remove a bumper, has no invulnerability, and is much shorter. From 46364422d99c5299a86a3b0b934e71737bdc0212 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sat, 21 Mar 2020 05:58:42 -0400 Subject: [PATCH 068/117] Real dumb bug --- src/k_kart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index d5bffd9b4..d412b89cb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3974,7 +3974,7 @@ static void K_DoHyudoroSteal(player_t *player) INT32 hyu = hyudorotime; if (G_RaceGametype()) - hyu = (hyu<<1); // double in race + hyu *= 2; // double in race for (i = 0; i < MAXPLAYERS; i++) { @@ -4001,7 +4001,7 @@ static void K_DoHyudoroSteal(player_t *player) if (sink && numplayers > 0 && cv_kitchensink.value) // BEHOLD THE KITCHEN SINK { - player->kartstuff[k_hyudorotimer] = hyudorotime; + player->kartstuff[k_hyudorotimer] = hyu; player->kartstuff[k_stealingtimer] = stealtime; player->kartstuff[k_itemtype] = KITEM_KITCHENSINK; @@ -4011,7 +4011,7 @@ static void K_DoHyudoroSteal(player_t *player) } else if ((G_RaceGametype() && player->kartstuff[k_position] == 1) || numplayers == 0) // No-one can be stolen from? Oh well... { - player->kartstuff[k_hyudorotimer] = hyudorotime; + player->kartstuff[k_hyudorotimer] = hyu; player->kartstuff[k_stealingtimer] = stealtime; return; } @@ -4026,7 +4026,7 @@ static void K_DoHyudoroSteal(player_t *player) if (stealplayer > -1) // Now here's where we do the stealing, has to be done here because we still know the player we're stealing from { - player->kartstuff[k_hyudorotimer] = hyudorotime; + player->kartstuff[k_hyudorotimer] = hyu; player->kartstuff[k_stealingtimer] = stealtime; players[stealplayer].kartstuff[k_stolentimer] = stealtime; From b1db9077a41ae22e589b0e9919378178d213c828 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 21 Mar 2020 12:48:51 -0700 Subject: [PATCH 069/117] splitscreen -> r_splitscreen --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 85f93602b..e7bdb5aa6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7513,7 +7513,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall else distxy = dist; distz = -FixedMul(dist, FINESINE((pitch>>ANGLETOFINESHIFT) & FINEMASK)); - if (splitscreen == 1) // 2 player is weird, this helps keep players on screen + if (r_splitscreen == 1) // 2 player is weird, this helps keep players on screen distz = 3*distz/5; x = mo->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy); From 29ebf7ee607f723730b73a8a2fb462200faf3e55 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 21 Mar 2020 13:07:22 -0700 Subject: [PATCH 070/117] Attempt to fix Sal's compiler warnings --- src/d_netcmd.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index aec247108..fbd51ebd1 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1333,7 +1333,8 @@ static void ForceAllSkins(INT32 forcedskin) static const char * VaguePartyDescription (int playernum, int *party_sizes, int default_color) { - static char description[1 + MAXPLAYERNAME + 1 + sizeof " and x others"]; + static char party_description + [1 + MAXPLAYERNAME + 1 + sizeof " and x others"]; const char *name; int size; name = player_names[playernum]; @@ -1344,7 +1345,7 @@ VaguePartyDescription (int playernum, int *party_sizes, int default_color) */ if (size > 1 && size <= MAXSPLITSCREENPLAYERS) { - sprintf(description, + sprintf(party_description, "\x83%s%c and %d other%s", name, default_color, @@ -1354,13 +1355,13 @@ VaguePartyDescription (int playernum, int *party_sizes, int default_color) } else { - sprintf(description, + sprintf(party_description, "\x83%s%c", name, default_color ); } - return description; + return party_description; } static INT32 snacpending = 0, snac2pending = 0, snac3pending = 0, snac4pending = 0, chmappending = 0; @@ -2060,6 +2061,8 @@ static void Got_AcceptPartyInvite(UINT8 **cp,INT32 playernum) int old_party_size; int views; + (void)cp; + if (playerconsole[playernum] != playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal accept splitscreen invite received from %s\n"), player_names[playernum]); @@ -2115,7 +2118,6 @@ static void Got_CancelPartyInvite(UINT8 **cp,INT32 playernum) invitee = READUINT8 (*cp); if ( - invitee >= 0 && invitee < MAXPLAYERS && playeringame[invitee] ){ @@ -2147,6 +2149,8 @@ static void Got_CancelPartyInvite(UINT8 **cp,INT32 playernum) static void Got_LeaveParty(UINT8 **cp,INT32 playernum) { + (void)cp; + if (playerconsole[playernum] != playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal accept splitscreen invite received from %s\n"), player_names[playernum]); @@ -2431,7 +2435,9 @@ static void Command_SetViews_f(void) static void Command_Invite_f (void) { - UINT8 invitee; + UINT8 buffer[1]; + + int invitee; if (COM_Argc() != 2) { @@ -2484,13 +2490,17 @@ Command_Invite_f (void) invitee, splitscreen_original_party_size, '\x80') ); - SendNetXCmd(XD_PARTYINVITE, &invitee, 1); + buffer[0] = invitee; + + SendNetXCmd(XD_PARTYINVITE, buffer, sizeof buffer); } static void Command_CancelInvite_f (void) { - UINT8 invitee; + UINT8 buffer[1]; + + int invitee; if (COM_Argc() != 2) { @@ -2523,7 +2533,9 @@ Command_CancelInvite_f (void) invitee, splitscreen_original_party_size, '\x80') ); - SendNetXCmd(XD_CANCELPARTYINVITE, &invitee, 1); + buffer[0] = invitee; + + SendNetXCmd(XD_CANCELPARTYINVITE, buffer, sizeof buffer); } static boolean From 8a28d3cfe5ebefae04b67548b26048e95b6d0ac4 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 21 Mar 2020 13:12:50 -0700 Subject: [PATCH 071/117] Replace some instances of int with fixed width types --- src/d_clisrv.c | 4 ++-- src/d_netcmd.c | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 98476fe50..eadff6726 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -84,7 +84,7 @@ static boolean serverrunning = false; INT32 serverplayer = 0; char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support) -int playerconsole[MAXPLAYERS]; +UINT8 playerconsole[MAXPLAYERS]; // Server specific vars UINT8 playernode[MAXPLAYERS]; @@ -3491,7 +3491,7 @@ static inline void SV_AddNode(INT32 node) static void Got_AddPlayer(UINT8 **p, INT32 playernum) { INT16 node, newplayernum; - int console; + UINT8 console; UINT8 splitscreenplayer = 0; UINT8 i; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index fbd51ebd1..6814bacce 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2006,12 +2006,10 @@ static void Got_PowerLevel(UINT8 **cp,INT32 playernum) static void Got_PartyInvite(UINT8 **cp,INT32 playernum) { - int invitee; + UINT8 invitee; boolean kick = false; - invitee = READUINT8 (*cp); - if ( invitee >= 0 && invitee < MAXPLAYERS && From 52fa738ef8cca52e051651e226f6057ba40c96a7 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 21 Mar 2020 13:18:17 -0700 Subject: [PATCH 072/117] Replace even more ints with INT32 --- src/g_game.h | 6 +++--- src/g_splitscreen.c | 48 ++++++++++++++++++++++----------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/g_game.h b/src/g_game.h index 9d4a3e4d9..08af3a2b5 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -308,9 +308,9 @@ void G_ResetViews(void); void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive); void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive); -void G_AddPartyMember (int party_member, int new_party_member); -void G_RemovePartyMember (int party_member); -void G_ResetSplitscreen (int playernum); +void G_AddPartyMember (INT32 party_member, INT32 new_party_member); +void G_RemovePartyMember (INT32 party_member); +void G_ResetSplitscreen (INT32 playernum); void G_AddPlayer(INT32 playernum); diff --git a/src/g_splitscreen.c b/src/g_splitscreen.c index 7aec3f159..ffc548147 100644 --- a/src/g_splitscreen.c +++ b/src/g_splitscreen.c @@ -14,21 +14,21 @@ #include "p_local.h" #include "r_local.h" -int splitscreen_original_party_size[MAXPLAYERS]; -int splitscreen_original_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS]; +INT32 splitscreen_original_party_size[MAXPLAYERS]; +INT32 splitscreen_original_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS]; -int splitscreen_invitations[MAXPLAYERS]; -int splitscreen_party_size[MAXPLAYERS]; -int splitscreen_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS]; +INT32 splitscreen_invitations[MAXPLAYERS]; +INT32 splitscreen_party_size[MAXPLAYERS]; +INT32 splitscreen_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS]; boolean splitscreen_partied[MAXPLAYERS]; void -G_ResetSplitscreen (int playernum) +G_ResetSplitscreen (INT32 playernum) { INT32 old_displayplayers[MAXSPLITSCREENPLAYERS]; - int i; + INT32 i; splitscreen_party_size[playernum] = splitscreen_original_party_size[playernum]; @@ -63,18 +63,18 @@ G_ResetSplitscreen (int playernum) } void -G_RemovePartyMember (int playernum) +G_RemovePartyMember (INT32 playernum) { - int old_party[MAXSPLITSCREENPLAYERS]; - int new_party[MAXSPLITSCREENPLAYERS]; + INT32 old_party[MAXSPLITSCREENPLAYERS]; + INT32 new_party[MAXSPLITSCREENPLAYERS]; - int old_party_size; - int before; - int after; - int views; + INT32 old_party_size; + INT32 before; + INT32 after; + INT32 views; - int i; - int n; + INT32 i; + INT32 n; old_party_size = splitscreen_party_size[playernum]; @@ -135,18 +135,18 @@ G_RemovePartyMember (int playernum) } void -G_AddPartyMember (int invitation, int playernum) +G_AddPartyMember (INT32 invitation, INT32 playernum) { - int * party; - int *add_party; + INT32 * party; + INT32 *add_party; - int old_party_size; - int new_party_size; + INT32 old_party_size; + INT32 new_party_size; - int views; + INT32 views; - int i; - int n; + INT32 i; + INT32 n; views = splitscreen_original_party_size[playernum]; From 58df481cd3795bdb2c7e43943ce956541f010d69 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sat, 21 Mar 2020 19:08:59 -0400 Subject: [PATCH 073/117] Replace "Block Enemies" with "Block Players" We don't need the ability to make invisible walls for enemies as often as we've needed invisible walls for players that don't block their thrown items. --- src/dehacked.c | 4 ++-- src/doomdata.h | 6 +++--- src/p_ceilng.c | 2 +- src/p_floor.c | 2 +- src/p_map.c | 10 +++++----- src/p_mobj.c | 2 +- src/p_spec.c | 32 ++++++++++++++++---------------- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 8a8a159db..7f5b7037f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8175,8 +8175,8 @@ static const char *const PLAYERFLAG_LIST[] = { #ifdef HAVE_BLUA // Linedef flags static const char *const ML_LIST[16] = { - "IMPASSIBLE", - "BLOCKMONSTERS", + "IMPASSABLE", + "BLOCKPLAYERS", "TWOSIDED", "DONTPEGTOP", "DONTPEGBOTTOM", diff --git a/src/doomdata.h b/src/doomdata.h index 6319238b7..5e6324ec9 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -94,10 +94,10 @@ typedef struct // // Solid, is an obstacle. -#define ML_IMPASSIBLE 1 +#define ML_IMPASSABLE 1 -// Blocks monsters only. -#define ML_BLOCKMONSTERS 2 +// SRB2Kart: Blocks players only; items can be thrown through these. +#define ML_BLOCKPLAYERS 2 // Backside will not be present at all if not two sided. #define ML_TWOSIDED 4 diff --git a/src/p_ceilng.c b/src/p_ceilng.c index 757edebae..a2db42b2d 100644 --- a/src/p_ceilng.c +++ b/src/p_ceilng.c @@ -484,7 +484,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) } // chained linedef executing ability - if (line->flags & ML_BLOCKMONSTERS) + if (line->flags & ML_BLOCKPLAYERS) { // only set it on ONE of the moving sectors (the smallest numbered) // and front side x offset must be positive diff --git a/src/p_floor.c b/src/p_floor.c index 737a8810b..b6296090b 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2747,7 +2747,7 @@ INT32 EV_DoFloor(line_t *line, floor_e floortype) dofloor->direction = -1; // down // chained linedef executing ability - if (line->flags & ML_BLOCKMONSTERS) + if (line->flags & ML_BLOCKPLAYERS) { // Only set it on one of the moving sectors (the // smallest numbered) and only if the front side diff --git a/src/p_map.c b/src/p_map.c index 9e34e04d9..cf6670806 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2006,10 +2006,10 @@ if (tmthing->flags & MF_PAPERCOLLISION) // Caution! Turning whilst up against a // missiles can cross uncrossable lines if (!(tmthing->flags & MF_MISSILE)) { - if (ld->flags & ML_IMPASSIBLE) // block objects from moving through this linedef. + if (ld->flags & ML_IMPASSABLE) // block objects from moving through this linedef. return false; - if ((tmthing->flags & (MF_ENEMY|MF_BOSS)) && ld->flags & ML_BLOCKMONSTERS) - return false; // block monsters only + if (tmthing->player && ld->flags & ML_BLOCKPLAYERS) + return false; // SRB2Kart: Only block players, not items } // set openrange, opentop, openbottom @@ -3328,10 +3328,10 @@ static boolean PTR_SlideTraverse(intercept_t *in) if (!(slidemo->flags & MF_MISSILE)) { - if (li->flags & ML_IMPASSIBLE) + if (li->flags & ML_IMPASSABLE) goto isblocking; - if ((slidemo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS) + if (slidemo->player && li->flags & ML_BLOCKPLAYERS) goto isblocking; } diff --git a/src/p_mobj.c b/src/p_mobj.c index a532dddc5..a728e5ed6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2179,7 +2179,7 @@ boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover) *rover->topheight; if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3 - && !(rover->master->flags & ML_BLOCKMONSTERS) + && !(rover->master->flags & ML_BLOCKPLAYERS) && ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale))) return true; } diff --git a/src/p_spec.c b/src/p_spec.c index bfbdf6228..a2ed7eb71 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1651,7 +1651,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (rings > dist) return false; } - else if (triggerline->flags & ML_BLOCKMONSTERS) + else if (triggerline->flags & ML_BLOCKPLAYERS) { if (rings < dist) return false; @@ -1729,7 +1729,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (lap < (sides[triggerline->sidenum[0]].textureoffset >> FRACBITS)) return false; } - else if (triggerline->flags & ML_BLOCKMONSTERS) // Need lower than or equal to + else if (triggerline->flags & ML_BLOCKPLAYERS) // Need lower than or equal to { if (lap > (sides[triggerline->sidenum[0]].textureoffset >> FRACBITS)) return false; @@ -2298,8 +2298,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) return; if (bot) - P_Teleport(bot, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, (line->flags & ML_BLOCKMONSTERS) == 0, (line->flags & ML_EFFECT4) == ML_EFFECT4); - if (line->flags & ML_BLOCKMONSTERS) + P_Teleport(bot, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, (line->flags & ML_BLOCKPLAYERS) == 0, (line->flags & ML_EFFECT4) == ML_EFFECT4); + if (line->flags & ML_BLOCKPLAYERS) P_Teleport(mo, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, false, (line->flags & ML_EFFECT4) == ML_EFFECT4); else { @@ -2361,7 +2361,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) mapmusname[6] = 0; mapmusflags = tracknum & MUSIC_TRACKMASK; - if (!(line->flags & ML_BLOCKMONSTERS)) + if (!(line->flags & ML_BLOCKPLAYERS)) mapmusflags |= MUSIC_RELOADRESET; if (line->flags & ML_BOUNCY) mapmusflags |= MUSIC_FORCERESET; @@ -2381,7 +2381,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) } } - // Except, you can use the ML_BLOCKMONSTERS flag to change this behavior. + // Except, you can use the ML_BLOCKPLAYERS flag to change this behavior. // if (mapmusflags & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn. } break; @@ -2451,7 +2451,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) // play the sound from nowhere S_StartSound(NULL, sfxnum); } - else if (line->flags & ML_BLOCKMONSTERS) + else if (line->flags & ML_BLOCKPLAYERS) { // play the sound from calling sector's soundorg if (callsec) @@ -2800,7 +2800,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) var1 = sides[line->sidenum[0]].toptexture; //(line->dx>>FRACBITS)-1; - if (line->sidenum[1] != 0xffff && line->flags & ML_BLOCKMONSTERS) // read power from back sidedef + if (line->sidenum[1] != 0xffff && line->flags & ML_BLOCKPLAYERS) // read power from back sidedef var2 = sides[line->sidenum[1]].toptexture; else if (line->flags & ML_NOCLIMB) // 'Infinite' var2 = UINT16_MAX; @@ -3956,7 +3956,7 @@ DoneSection2: if (gametype == GT_COOP && lineindex != -1) // Custom exit! { // Special goodies with the block monsters flag depending on emeralds collected - if ((lines[lineindex].flags & ML_BLOCKMONSTERS) && ALL7EMERALDS(emeralds)) + if ((lines[lineindex].flags & ML_BLOCKPLAYERS) && ALL7EMERALDS(emeralds)) nextmapoverride = (INT16)(lines[lineindex].frontsector->ceilingheight>>FRACBITS); else nextmapoverride = (INT16)(lines[lineindex].frontsector->floorheight>>FRACBITS); @@ -5349,7 +5349,7 @@ static void P_AddRaiseThinker(sector_t *sec, line_t *sourceline) raise->thinker.function.acp1 = (actionf_p1)T_RaiseSector; - if (sourceline->flags & ML_BLOCKMONSTERS) + if (sourceline->flags & ML_BLOCKPLAYERS) raise->vars[0] = 1; else raise->vars[0] = 0; @@ -5408,7 +5408,7 @@ static void P_AddOldAirbob(sector_t *sec, line_t *sourceline, boolean noadjust) airbob->vars[3] = airbob->vars[2]; - if (sourceline->flags & ML_BLOCKMONSTERS) + if (sourceline->flags & ML_BLOCKPLAYERS) airbob->vars[0] = 1; else airbob->vars[0] = 0; @@ -5989,7 +5989,7 @@ void P_SpawnSpecials(INT32 fromnetsave) break; case 64: // Appearing/Disappearing FOF option - if (lines[i].flags & ML_BLOCKMONSTERS) { // Find FOFs by control sector tag + if (lines[i].flags & ML_BLOCKPLAYERS) { // Find FOFs by control sector tag for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) for (j = 0; (unsigned)j < sectors[s].linecount; j++) if (sectors[s].lines[j]->special >= 100 && sectors[s].lines[j]->special < 300) @@ -6217,7 +6217,7 @@ void P_SpawnSpecials(INT32 fromnetsave) case 150: // Air bobbing platform case 151: // Adjustable air bobbing platform P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - lines[i].flags |= ML_BLOCKMONSTERS; + lines[i].flags |= ML_BLOCKPLAYERS; P_AddOldAirbob(lines[i].frontsector, lines + i, (lines[i].special != 151)); break; case 152: // Adjustable air bobbing platform in reverse @@ -6272,14 +6272,14 @@ void P_SpawnSpecials(INT32 fromnetsave) case 176: // Air bobbing platform that will crumble and bob on the water when it falls and hits P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_FLOATBOB|FF_CRUMBLE, secthinkers); - lines[i].flags |= ML_BLOCKMONSTERS; + lines[i].flags |= ML_BLOCKPLAYERS; P_AddOldAirbob(lines[i].frontsector, lines + i, true); break; case 177: // Air bobbing platform that will crumble and bob on // the water when it falls and hits, then never return P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_FLOATBOB|FF_CRUMBLE|FF_NORETURN, secthinkers); - lines[i].flags |= ML_BLOCKMONSTERS; + lines[i].flags |= ML_BLOCKPLAYERS; P_AddOldAirbob(lines[i].frontsector, lines + i, true); break; @@ -6293,7 +6293,7 @@ void P_SpawnSpecials(INT32 fromnetsave) case 180: // Air bobbing platform that will crumble P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_CRUMBLE, secthinkers); - lines[i].flags |= ML_BLOCKMONSTERS; + lines[i].flags |= ML_BLOCKPLAYERS; P_AddOldAirbob(lines[i].frontsector, lines + i, true); break; From 22702f88bc32135be0bf30928e40e9956205b655 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sat, 21 Mar 2020 19:54:24 -0400 Subject: [PATCH 074/117] "Delete items" sector type --- src/p_mobj.c | 38 ++++++++++++++++++++++++++++++++++++++ src/p_spec.c | 6 +----- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index a728e5ed6..9609a8713 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8014,6 +8014,13 @@ void P_MobjThinker(mobj_t *mobj) case MT_ORBINAUT: { boolean grounded = P_IsObjectOnGround(mobj); + + if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) + { + P_RemoveMobj(mobj); + return; + } + if (mobj->flags2 & MF2_AMBUSH) { if (grounded && (mobj->flags & MF_NOCLIPTHING)) @@ -8084,6 +8091,12 @@ void P_MobjThinker(mobj_t *mobj) { mobj_t *ghost = P_SpawnGhostMobj(mobj); + if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) + { + P_RemoveMobj(mobj); + return; + } + if (mobj->target && !P_MobjWasRemoved(mobj->target) && mobj->target->player) { ghost->color = mobj->target->player->skincolor; @@ -8107,6 +8120,13 @@ void P_MobjThinker(mobj_t *mobj) case MT_JAWZ_DUD: { boolean grounded = P_IsObjectOnGround(mobj); + + if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) + { + P_RemoveMobj(mobj); + return; + } + if (mobj->flags2 & MF2_AMBUSH) { if (grounded && (mobj->flags & MF_NOCLIPTHING)) @@ -8167,6 +8187,12 @@ void P_MobjThinker(mobj_t *mobj) case MT_EGGMANITEM: mobj->friction = ORIG_FRICTION/4; + if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) + { + P_RemoveMobj(mobj); + return; + } + if (mobj->momx || mobj->momy) { mobj_t *ghost = P_SpawnGhostMobj(mobj); @@ -8196,6 +8222,12 @@ void P_MobjThinker(mobj_t *mobj) mobj_t *ghost = P_SpawnGhostMobj(mobj); ghost->fuse = 3; + if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) + { + P_RemoveMobj(mobj); + return; + } + if (mobj->target && !P_MobjWasRemoved(mobj->target) && mobj->target->player) { ghost->color = mobj->target->player->skincolor; @@ -8228,6 +8260,12 @@ void P_MobjThinker(mobj_t *mobj) mobj->threshold--; break; case MT_SSMINE: + if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) + { + P_RemoveMobj(mobj); + return; + } + if (mobj->target && mobj->target->player) mobj->color = mobj->target->player->skincolor; else diff --git a/src/p_spec.c b/src/p_spec.c index a2ed7eb71..279bbf755 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4055,11 +4055,7 @@ DoneSection2: } break; - case 7: // SRB2kart 190117 - Oil Slick (deprecated) - if (roversector || P_MobjReadyToTrigger(player->mo, sector)) - { - K_SpinPlayer(player, NULL, 0, NULL, false); - } + case 7: // SRB2Kart: Destroy items break; case 8: // Zoom Tube Start From c9cff6ccc28ca2f26bd5729cf7aec5d69ce5c4f9 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sat, 21 Mar 2020 22:06:01 -0400 Subject: [PATCH 075/117] P_MobjTouchingSectorSpecial checks polyobjects This means polyobjects can have effects like offroad --- src/p_spec.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 2 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 279bbf755..73b97632e 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3401,6 +3401,97 @@ sector_t *P_MobjTouchingSectorSpecial(mobj_t *mo, INT32 section, INT32 number, b return rover->master->frontsector; } +#ifdef POLYOBJECTS + // Allow sector specials to be applied to polyobjects! + if (mo->subsector->polyList) + { + polyobj_t *po = mo->subsector->polyList; + sector_t *polysec; + boolean touching = false; + boolean inside = false; + + while (po) + { + if (po->flags & POF_NOSPECIALS) + { + po = (polyobj_t *)(po->link.next); + continue; + } + + polysec = po->lines[0]->backsector; + + if (GETSECSPECIAL(polysec->special, section) != number) + { + po = (polyobj_t *)(po->link.next); + continue; + } + + if ((polysec->flags & SF_TRIGGERSPECIAL_TOUCH)) + touching = P_MobjTouchingPolyobj(po, mo); + else + touching = false; + + inside = P_MobjInsidePolyobj(po, mo); + + if (!(inside || touching)) + { + po = (polyobj_t *)(po->link.next); + continue; + } + + topheight = polysec->ceilingheight; + bottomheight = polysec->floorheight; + + // We're inside it! Yess... + if (!(po->flags & POF_TESTHEIGHT)) // Don't do height checking + { + } + else if (po->flags & POF_SOLID) + { + // Thing must be on top of the floor to be affected... + if ((polysec->flags & SF_FLIPSPECIAL_FLOOR) + && !(polysec->flags & SF_FLIPSPECIAL_CEILING)) + { + if ((mo->eflags & MFE_VERTICALFLIP) || mo->z != topheight) + { + po = (polyobj_t *)(po->link.next); + continue; + } + } + else if ((polysec->flags & SF_FLIPSPECIAL_CEILING) + && !(polysec->flags & SF_FLIPSPECIAL_FLOOR)) + { + if (!(mo->eflags & MFE_VERTICALFLIP) || mo->z + mo->height != bottomheight) + { + po = (polyobj_t *)(po->link.next); + continue; + } + } + else if (polysec->flags & SF_FLIPSPECIAL_BOTH) + { + if (!((mo->eflags & MFE_VERTICALFLIP && mo->z + mo->height == bottomheight) + || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z == topheight))) + { + po = (polyobj_t *)(po->link.next); + continue; + } + } + } + else + { + // Water and DEATH FOG!!! heh + if (mo->z > topheight || (mo->z + mo->height) < bottomheight) + { + po = (polyobj_t *)(po->link.next); + continue; + } + } + + return polysec; + } + } +#endif + for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next) { if (GETSECSPECIAL(node->m_sector->special, section) == number) @@ -3461,8 +3552,7 @@ sector_t *P_MobjTouchingSectorSpecial(mobj_t *mo, INT32 section, INT32 number, b else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)) { - if (!(mo->eflags & MFE_VERTICALFLIP) - || mo->z + mo->height != bottomheight) + if (!(mo->eflags & MFE_VERTICALFLIP) || mo->z + mo->height != bottomheight) continue; } else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH) From 65bd0da11de7e340c917bd7bb364b3d28d048d2b Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sat, 21 Mar 2020 23:01:51 -0400 Subject: [PATCH 076/117] Use PWRLVRECORD_START instead of PWRLVRECORD_DEF to encourage more spread --- src/k_pwrlv.c | 2 +- src/k_pwrlv.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_pwrlv.c b/src/k_pwrlv.c index 94bdb13a4..b219043c0 100644 --- a/src/k_pwrlv.c +++ b/src/k_pwrlv.c @@ -48,7 +48,7 @@ INT16 K_CalculatePowerLevelInc(INT16 diff) diff = -MAXDIFF; #undef MAXDIFF - x = ((diff-2)< Date: Sun, 22 Mar 2020 14:39:16 -0700 Subject: [PATCH 077/117] EXTERN --- src/d_clisrv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.h b/src/d_clisrv.h index c8d8693f1..49945de7c 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -610,7 +610,7 @@ SINT8 nametonum(const char *name); extern char motd[254], server_context[8]; extern UINT8 playernode[MAXPLAYERS]; /* consoleplayer of this player (splitscreen) */ -extern int playerconsole[MAXPLAYERS]; +extern UINT8 playerconsole[MAXPLAYERS]; INT32 D_NumPlayers(void); void D_ResetTiccmds(void); From 0ee74567081de4b5fced74db4153a8774746e9b5 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 22 Mar 2020 14:45:21 -0700 Subject: [PATCH 078/117] Fix shit --- src/d_netcmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 545010112..f553538c2 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2002,8 +2002,9 @@ static void Got_PartyInvite(UINT8 **cp,INT32 playernum) boolean kick = false; + invitee = READUINT8 (*cp); + if ( - invitee >= 0 && invitee < MAXPLAYERS && playeringame[invitee] && playerconsole[playernum] == playernum/* only consoleplayer may! */ From 013aa22c16e15257de533f28e58531657b141d67 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 22 Mar 2020 17:53:11 -0400 Subject: [PATCH 079/117] Minor item calculation fixes --- src/k_kart.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 93bfe32e6..3a416161e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -930,14 +930,25 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp POWERITEMODDS(newodds); break; case KITEM_SPB: - if ((indirectitemcooldown > 0) || (secondist/DISTVAR < 3) - || (first != -1 && players[first].distancetofinish > 8*DISTVAR)) // No SPB near the end of the race + if ((indirectitemcooldown > 0) || COOLDOWNONSTART + || (first != -1 && players[first].distancetofinish < 8*DISTVAR)) // No SPB near the end of the race + { newodds = 0; + } else - newodds *= min((secondist/DISTVAR)-4, 3); // POWERITEMODDS(newodds); + { + INT32 multiplier = (secondist - (4*DISTVAR)) / DISTVAR; + + if (multiplier < 0) + multiplier = 0; + if (multiplier > 3) + multiplier = 3; + + newodds *= multiplier; + } break; case KITEM_SHRINK: - if ((indirectitemcooldown > 0) || (pingame-1 <= pexiting) || COOLDOWNONSTART) + if ((indirectitemcooldown > 0) || COOLDOWNONSTART || (pingame-1 <= pexiting)) newodds = 0; else POWERITEMODDS(newodds); @@ -1135,7 +1146,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) } if (mapobjectscale != FRACUNIT) - pdis = FixedDiv(pdis, mapobjectscale); + pdis = FixedDiv(pdis * FRACUNIT, mapobjectscale); if (franticitems) // Frantic items make the distances between everyone artifically higher, for crazier items pdis = (15 * pdis) / 14; From 9379202dc4c603d76fcb0ce4f6b8f98801530881 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 22 Mar 2020 20:52:20 -0400 Subject: [PATCH 080/117] Dumb mistake --- 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 75440a28b..57a308e58 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1135,7 +1135,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) } if (mapobjectscale != FRACUNIT) - pdis = FixedDiv(pdis * FRACUNIT, mapobjectscale); + pdis = FixedDiv(pdis * FRACUNIT, mapobjectscale) / FRACUNIT; if (franticitems) // Frantic items make the distances between everyone artifically higher, for crazier items pdis = (15 * pdis) / 14; From 8a5d00d1c7a511396af89fe28db43114d3892023 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 22 Mar 2020 20:52:54 -0400 Subject: [PATCH 081/117] Increase distance for natural spb --- 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 57a308e58..f799634d7 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -926,7 +926,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp } else { - INT32 multiplier = (secondist - (4*DISTVAR)) / DISTVAR; + INT32 multiplier = (secondist - (5*DISTVAR)) / DISTVAR; if (multiplier < 0) multiplier = 0; From 90d415ccc02ace3ce627efd6adfc407fbf74ce40 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 22 Mar 2020 18:55:28 -0700 Subject: [PATCH 082/117] Ignore spectators for gentlemen's ping --- 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 087fa663d..e0db3c31c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5455,7 +5455,7 @@ static void UpdatePingTable(void) { if (playeringame[i] && playernode[i] > 0) { - if (! server_lagless && playernode[i] > 0) + if (! server_lagless && playernode[i] > 0 && !players[i].spectator) { lag = GetLag(playernode[i]); realpingtable[i] += G_TicsToMilliseconds(lag); From 227a4dcbd3fb26ba2e1f39101f936e89b8f785bb Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 22 Mar 2020 22:01:40 -0400 Subject: [PATCH 083/117] Flame Shield improvin's --- src/k_kart.c | 21 +++++++++++++++++---- src/sounds.c | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index f799634d7..ba81fd80a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7068,6 +7068,7 @@ void K_StripOther(player_t *player) static INT32 K_FlameShieldMax(player_t *player) { + UINT32 disttofinish = 0; UINT8 numplayers = 0; UINT8 i; @@ -7075,14 +7076,22 @@ static INT32 K_FlameShieldMax(player_t *player) { if (playeringame[i] && !players[i].spectator) numplayers++; + if (players[i].kartstuff[k_position] == 1) + disttofinish = players[i].distancetofinish; } if (numplayers <= 1) + { return 16; // max when alone, for testing + } else if (player->kartstuff[k_position] == 1) - return 1; // minimum for first - else - return (player->kartstuff[k_position] * 16) / numplayers; + { + return 0; // minimum for first + } + + disttofinish = player->distancetofinish - disttofinish; + + return 1 + (disttofinish / (DISTVAR*2)); } // @@ -7588,7 +7597,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_flamemeter] > flamemax) { K_FlameShieldPop(player->mo); - P_Thrust(player->mo, R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy), player->speed); + P_Thrust( + player->mo, + R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy), + 20 * K_GetKartGameSpeedScalar(gamespeed) + ); player->kartstuff[k_flamemeter] = 0; player->kartstuff[k_flamelength] = 0; player->kartstuff[k_holdready] = 0; diff --git a/src/sounds.c b/src/sounds.c index f5fd3cb6d..b64dda5cb 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -413,7 +413,7 @@ sfxinfo_t S_sfx[NUMSFX] = {"s3k40", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"s3k41", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Kart Thunder Shield spawned {"s3k42", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"s3k43", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, + {"s3k43", false, 96, 48, -1, NULL, 0, -1, -1, LUMPERROR}, {"s3k44", false, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Kart Bubble Shield reflect {"s3k45", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"s3k46", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, From e5a59c28d1ce677ee46dc2c113b77319c6ee4aa0 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 22 Mar 2020 22:09:32 -0400 Subject: [PATCH 084/117] Use smaller value --- 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 ba81fd80a..1c39f3a39 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7091,7 +7091,7 @@ static INT32 K_FlameShieldMax(player_t *player) disttofinish = player->distancetofinish - disttofinish; - return 1 + (disttofinish / (DISTVAR*2)); + return min(16, 1 + (disttofinish / DISTVAR)); } // From 4e63b39ccb74172de4887fccd4966140b38b5005 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 22 Mar 2020 23:27:27 -0400 Subject: [PATCH 085/117] Firery shield --- src/k_kart.c | 55 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 1c39f3a39..c4b66f721 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4324,7 +4324,7 @@ static void K_DoThunderShield(player_t *player) #undef THUNDERRADIUS -static void K_FlameShieldPop(mobj_t *src) +static void K_FlameDashLeftoverSmoke(mobj_t *src) { UINT8 i; @@ -4682,7 +4682,6 @@ void K_DropHnextList(player_t *player) } else if (player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) { - K_FlameShieldPop(player->mo); player->kartstuff[k_itemtype] = KITEM_NONE; player->kartstuff[k_itemamount] = 0; player->kartstuff[k_curshield] = KSHIELD_NONE; @@ -6187,7 +6186,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_itemtype] != KITEM_FLAMESHIELD || player->exiting) { if (player->kartstuff[k_flamedash]) - K_FlameShieldPop(player->mo); + K_FlameDashLeftoverSmoke(player->mo); } if (player->kartstuff[k_comebacktimer]) @@ -7578,7 +7577,16 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (!HOLDING_ITEM && NO_HYUDORO) { - INT32 flamemax = player->kartstuff[k_flamelength] * (TICRATE/4); + INT32 destlen = K_FlameShieldMax(player); + INT32 flamemax = 0; + + if (player->kartstuff[k_flamelength] < destlen) + player->kartstuff[k_flamelength]++; // Can always go up! + + flamemax = player->kartstuff[k_flamelength] * (TICRATE/4); + + if (flamemax > 0) + flamemax += (TICRATE/4); if ((cmd->buttons & BT_ATTACK) && player->kartstuff[k_holdready]) { @@ -7596,12 +7604,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_flamemeter] > flamemax) { - K_FlameShieldPop(player->mo); P_Thrust( - player->mo, - R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy), - 20 * K_GetKartGameSpeedScalar(gamespeed) + player->mo, player->mo->angle, + FixedMul((50*mapobjectscale), K_GetKartGameSpeedScalar(gamespeed)) ); + player->kartstuff[k_flamemeter] = 0; player->kartstuff[k_flamelength] = 0; player->kartstuff[k_holdready] = 0; @@ -7614,6 +7621,18 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_flamemeter] > 0) player->kartstuff[k_flamemeter]--; + + if (player->kartstuff[k_flamelength] > destlen) + { + player->kartstuff[k_flamelength]--; // Can ONLY go down if you're not using it + + flamemax = player->kartstuff[k_flamelength] * (TICRATE/4); + if (flamemax > 0) + flamemax += (TICRATE/4); + } + + if (player->kartstuff[k_flamemeter] > flamemax) + player->kartstuff[k_flamemeter] = flamemax; } } break; @@ -7700,15 +7719,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) || player->kartstuff[k_growshrinktimer] < 0) indirectitemcooldown = 20*TICRATE; - if (player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) - { - INT32 destlen = K_FlameShieldMax(player); - if (player->kartstuff[k_flamelength] > destlen) - player->kartstuff[k_flamelength]--; - else if (player->kartstuff[k_flamelength] < destlen) - player->kartstuff[k_flamelength]++; - } - else + if (player->kartstuff[k_itemtype] != KITEM_FLAMESHIELD) { player->kartstuff[k_flamelength] = 0; } @@ -9047,6 +9058,7 @@ static void K_drawKartItem(void) INT32 numframes = 104; INT32 absolutemax = 16 * (TICRATE/4); INT32 flamemax = stplyr->kartstuff[k_flamelength] * (TICRATE/4); + INT32 flen = 1; INT32 bf = 16 - (flamemax / (TICRATE/4)); INT32 ff = numframes - ((stplyr->kartstuff[k_flamemeter] * numframes) / absolutemax); INT32 xo = 6, yo = 4; @@ -9063,15 +9075,20 @@ static void K_drawKartItem(void) } } + if (stplyr->kartstuff[k_flamelength] > 0) + { + flen = (numframes * 16) / stplyr->kartstuff[k_flamelength]; + } + if (ff < 0) {ff = 0;} - if (ff > numframes-1) {ff = numframes-1;} + if (ff > flen-1) {ff = flen-1;} if (flamemax > 0) V_DrawScaledPatch(fx-xo, fy-yo, V_HUDTRANS|fflags|flip, kp_flameshieldmeter_bg[bf][offset]); if (stplyr->kartstuff[k_flamemeter] > 0) { - if (stplyr->kartstuff[k_flamemeter] > (flamemax - (TICRATE/2)) && (leveltime & 1)) + if (stplyr->kartstuff[k_flamemeter] > (flamemax - (TICRATE/4)) && (leveltime & 1)) { UINT8 *fsflash = R_GetTranslationColormap(TC_BLINK, SKINCOLOR_WHITE, GTC_CACHE); V_DrawMappedPatch(fx-xo, fy-yo, V_HUDTRANS|fflags|flip, kp_flameshieldmeter[ff][offset], fsflash); From 88709aafaa2ba7080021e90e3ae25ba9fb608c5a Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Tue, 24 Mar 2020 12:55:48 -0400 Subject: [PATCH 086/117] Fix eggman items having no collision --- src/k_collide.c | 4 +++- src/p_inter.c | 4 +--- src/p_map.c | 10 ++++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/k_collide.c b/src/k_collide.c index 7edbe3e87..bbd5c2974 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -183,7 +183,9 @@ boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2) if (t2->type == MT_RANDOMITEM || t2->type == MT_EGGMANITEM) P_InstaThrust(t1, R_PointToAngle2(t2->x, t2->y, t1->x, t1->y), t2->radius/4); - // Player collision is handled by TouchSpecial + if (t1->type == MT_EGGMANITEM && t2->player) + P_TouchSpecialThing(t1, t2, false); + return true; } diff --git a/src/p_inter.c b/src/p_inter.c index b729fde8d..6d1051e82 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -117,9 +117,7 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon) if (weapon == 2) { // Invulnerable - if (player->powers[pw_flashing] > 0 - || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinouttype] != 2) - || player->kartstuff[k_squishedtimer] > 0) + if (player->powers[pw_flashing] > 0) return false; // Already have fake diff --git a/src/p_map.c b/src/p_map.c index a57c4da31..262017570 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -841,7 +841,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return K_SMKIceBlockCollide(thing, tmthing); } - if (tmthing->type == MT_EGGMANITEM) + if (tmthing->type == MT_EGGMANITEM || tmthing->type == MT_EGGMANITEM_SHIELD) { // see if it went over / under if (tmthing->z > thing->z + thing->height) @@ -849,10 +849,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->z + tmthing->height < thing->z) return true; // underneath - K_EggItemCollide(tmthing, thing); - return true; + return K_EggItemCollide(tmthing, thing); } - else if (thing->type == MT_EGGMANITEM) + else if (thing->type == MT_EGGMANITEM || thing->type == MT_EGGMANITEM_SHIELD) { // see if it went over / under if (tmthing->z > thing->z + thing->height) @@ -860,8 +859,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->z + tmthing->height < thing->z) return true; // underneath - K_EggItemCollide(thing, tmthing); - return true; + return K_EggItemCollide(thing, tmthing); } if (tmthing->type == MT_RANDOMITEM) From e9110b660cbd21bd62f56e0ea422e47fbc4e38d5 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Tue, 24 Mar 2020 15:36:44 -0700 Subject: [PATCH 087/117] Better directory structure (cherry picked from commit 8ee0a9309b289a1a3d1a7260a44a43c776180686) # Conflicts: # src/m_menu.c # src/m_menu.h # src/m_misc.h --- src/d_main.c | 6 +++++- src/d_netcmd.c | 2 ++ src/m_misc.c | 44 ++++++++++++++++++++++++++++++-------------- src/m_misc.h | 2 +- src/sdl/i_main.c | 36 ++++++++++++++++++++++++++++++------ 5 files changed, 68 insertions(+), 22 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 88c501345..b63f6ba42 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -152,6 +152,7 @@ char srb2path[256] = "."; #endif boolean usehome = true; const char *pandf = "%s" PATHSEP "%s"; +static char addonsdir[MAX_WADPATH]; // // EVENT HANDLING @@ -1090,7 +1091,6 @@ void D_SRB2Main(void) // can't use sprintf since there is %u in savegamename strcatbf(savegamename, srb2home, PATHSEP); - I_mkdir(srb2home, 0700); #else snprintf(srb2home, sizeof srb2home, "%s", userhome); snprintf(downloaddir, sizeof downloaddir, "%s", userhome); @@ -1111,6 +1111,10 @@ void D_SRB2Main(void) #endif } + // Create addons dir + snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons"); + I_mkdir(addonsdir, 0755); + // rand() needs seeded regardless of password srand((unsigned int)time(NULL)); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 88621ee66..f061e3090 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -790,6 +790,8 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_screenshot_option); CV_RegisterVar(&cv_screenshot_folder); CV_RegisterVar(&cv_moviemode); + CV_RegisterVar(&cv_movie_option); + CV_RegisterVar(&cv_movie_folder); // PNG variables CV_RegisterVar(&cv_zlib_level); CV_RegisterVar(&cv_zlib_memory); diff --git a/src/m_misc.c b/src/m_misc.c index f4a4ec291..9b1bff285 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -107,6 +107,9 @@ consvar_t cv_screenshot_folder = {"screenshot_folder", "", CV_SAVE, NULL, NULL, static CV_PossibleValue_t moviemode_cons_t[] = {{MM_GIF, "GIF"}, {MM_APNG, "aPNG"}, {MM_SCREENSHOT, "Screenshots"}, {0, NULL}}; consvar_t cv_moviemode = {"moviemode_mode", "GIF", CV_SAVE|CV_CALL, moviemode_cons_t, Moviemode_mode_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_movie_option = {"movie_option", "Default", CV_SAVE|CV_CALL, screenshot_cons_t, Moviemode_option_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_movie_folder = {"movie_folder", "", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + static CV_PossibleValue_t zlib_mem_level_t[] = { {1, "(Min Memory) 1"}, {2, "2"}, {3, "3"}, {4, "4"}, {5, "5"}, {6, "6"}, {7, "7"}, @@ -1080,19 +1083,25 @@ static inline moviemode_t M_StartMovieGIF(const char *pathname) void M_StartMovie(void) { #if NUMSCREENS > 2 - const char *pathname = "."; + char pathname[MAX_WADPATH]; if (moviemode) return; - if (cv_screenshot_option.value == 0) - pathname = usehome ? srb2home : srb2path; - else if (cv_screenshot_option.value == 1) - pathname = srb2home; - else if (cv_screenshot_option.value == 2) - pathname = srb2path; - else if (cv_screenshot_option.value == 3 && *cv_screenshot_folder.string != '\0') - pathname = cv_screenshot_folder.string; + if (cv_movie_option.value == 0) + strcpy(pathname, usehome ? srb2home : srb2path); + else if (cv_movie_option.value == 1) + strcpy(pathname, srb2home); + else if (cv_movie_option.value == 2) + strcpy(pathname, srb2path); + else if (cv_movie_option.value == 3 && *cv_movie_folder.string != '\0') + strcpy(pathname, cv_screenshot_folder.string); + + if (cv_movie_option.value != 3) + { + strcat(pathname, PATHSEP"movies"PATHSEP); + I_mkdir(pathname, 0755); + } if (rendermode == render_none) I_Error("Can't make a movie without a render system\n"); @@ -1424,7 +1433,8 @@ void M_ScreenShot(void) void M_DoScreenShot(void) { #if NUMSCREENS > 2 - const char *freename = NULL, *pathname = "."; + const char *freename = NULL; + char pathname[MAX_WADPATH]; boolean ret = false; UINT8 *linear = NULL; @@ -1432,13 +1442,19 @@ void M_DoScreenShot(void) takescreenshot = false; if (cv_screenshot_option.value == 0) - pathname = usehome ? srb2home : srb2path; + strcpy(pathname, usehome ? srb2home : srb2path); else if (cv_screenshot_option.value == 1) - pathname = srb2home; + strcpy(pathname, srb2home); else if (cv_screenshot_option.value == 2) - pathname = srb2path; + strcpy(pathname, srb2path); else if (cv_screenshot_option.value == 3 && *cv_screenshot_folder.string != '\0') - pathname = cv_screenshot_folder.string; + strcpy(pathname, cv_screenshot_folder.string); + + if (cv_screenshot_option.value != 3) + { + strcat(pathname, PATHSEP"screenshots"PATHSEP); + I_mkdir(pathname, 0755); + } #ifdef USE_PNG if (rendermode != render_none) diff --git a/src/m_misc.h b/src/m_misc.h index 658028b44..990555971 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -30,7 +30,7 @@ typedef enum { extern moviemode_t moviemode; extern consvar_t cv_screenshot_option, cv_screenshot_folder; -extern consvar_t cv_moviemode; +extern consvar_t cv_moviemode, cv_movie_folder, cv_movie_option; extern consvar_t cv_zlib_memory, cv_zlib_level, cv_zlib_strategy, cv_zlib_window_bits; extern consvar_t cv_zlib_memorya, cv_zlib_levela, cv_zlib_strategya, cv_zlib_window_bitsa; extern consvar_t cv_apng_delay; diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 41a9d7cd6..5aea78210 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -26,6 +26,8 @@ #include #endif +#include "time.h" // For log timestamps + #ifdef HAVE_SDL #ifdef HAVE_TTF @@ -114,6 +116,7 @@ int main(int argc, char **argv) #endif { const char *logdir = NULL; + char logfile[MAX_WADPATH]; myargc = argc; myargv = argv; /// \todo pull out path to exe from this string @@ -125,15 +128,35 @@ int main(int argc, char **argv) #endif #endif - logdir = D_Home(); - #ifdef LOGMESSAGES + if (!M_CheckParm("-nolog")) + { + logdir = D_Home(); + + time_t my_time; + struct tm * timeinfo; + char buf[26]; + my_time = time(NULL); + timeinfo = localtime(&my_time); + + strftime(buf, 26, "%Y-%m-%d %H-%M-%S", timeinfo); + strcpy(logfile, va("log-%s.txt", buf)); + #ifdef DEFAULTDIR - if (logdir) - logstream = fopen(va("%s/"DEFAULTDIR"/log.txt",logdir), "wt"); - else + if (logdir) + { + // Create dirs here because D_SRB2Main() is too late. + I_mkdir(va("%s%s"DEFAULTDIR, logdir, PATHSEP), 0755); + I_mkdir(va("%s%s"DEFAULTDIR"%slogs",logdir, PATHSEP, PATHSEP), 0755); + logstream = fopen(va("%s%s"DEFAULTDIR"%slogs%s%s",logdir, PATHSEP, PATHSEP, PATHSEP, logfile), "wt"); + } + else #endif - logstream = fopen("./log.txt", "wt"); + { + I_mkdir("."PATHSEP"logs"PATHSEP, 0755); + logstream = fopen(va("."PATHSEP"logs"PATHSEP"%s", logfile), "wt"); + } + } #endif //I_OutputMsg("I_StartupSystem() ...\n"); @@ -161,6 +184,7 @@ int main(int argc, char **argv) CONS_Printf("Setting up SRB2Kart...\n"); D_SRB2Main(); CONS_Printf("Entering main game loop...\n"); + CONS_Printf("%s\n", logfile); // never return D_SRB2Loop(); From d6c8306858c656d0254effa14f430d077b2c4fc8 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 8 Sep 2019 16:54:40 -0400 Subject: [PATCH 088/117] Fix this mistake (cherry picked from commit cc80cd77c531d23f88ae5f7ee417a453172fdc09) --- src/m_misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index 9b1bff285..8c0070270 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -107,7 +107,7 @@ consvar_t cv_screenshot_folder = {"screenshot_folder", "", CV_SAVE, NULL, NULL, static CV_PossibleValue_t moviemode_cons_t[] = {{MM_GIF, "GIF"}, {MM_APNG, "aPNG"}, {MM_SCREENSHOT, "Screenshots"}, {0, NULL}}; consvar_t cv_moviemode = {"moviemode_mode", "GIF", CV_SAVE|CV_CALL, moviemode_cons_t, Moviemode_mode_Onchange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_movie_option = {"movie_option", "Default", CV_SAVE|CV_CALL, screenshot_cons_t, Moviemode_option_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_movie_option = {"movie_option", "Default", CV_SAVE, screenshot_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_movie_folder = {"movie_folder", "", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t zlib_mem_level_t[] = { @@ -1095,7 +1095,7 @@ void M_StartMovie(void) else if (cv_movie_option.value == 2) strcpy(pathname, srb2path); else if (cv_movie_option.value == 3 && *cv_movie_folder.string != '\0') - strcpy(pathname, cv_screenshot_folder.string); + strcpy(pathname, cv_movie_folder.string); if (cv_movie_option.value != 3) { From 5653a7214192d37ff97145adcad12f5b315f355f Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 20 Sep 2019 17:22:09 +0100 Subject: [PATCH 089/117] * Resolve compiling issues with logmessages. * Improve logfile print. (I know Steel wanted it gone entirely, but I feel like it's relevant to have it in game..?) (cherry picked from commit 113568095a609c662e33e67f311c94e28be127d9) --- src/sdl/i_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 5aea78210..10f14f36f 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -131,11 +131,12 @@ int main(int argc, char **argv) #ifdef LOGMESSAGES if (!M_CheckParm("-nolog")) { - logdir = D_Home(); - time_t my_time; struct tm * timeinfo; char buf[26]; + + logdir = D_Home(); + my_time = time(NULL); timeinfo = localtime(&my_time); @@ -183,8 +184,11 @@ int main(int argc, char **argv) // startup SRB2 CONS_Printf("Setting up SRB2Kart...\n"); D_SRB2Main(); +#ifdef LOGMESSAGES + if (!M_CheckParm("-nolog")) + CONS_Printf("Logfile: %s\n", logfile); +#endif CONS_Printf("Entering main game loop...\n"); - CONS_Printf("%s\n", logfile); // never return D_SRB2Loop(); From f400d33947b3d517a9265791c53da5138eea7f6a Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 20 Sep 2019 17:43:41 +0100 Subject: [PATCH 090/117] Mark new-style log names as loaded. (cherry picked from commit c36123aa5687c5151aad98fd1941412f7407ae52) --- src/filesrch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filesrch.c b/src/filesrch.c index d132e9fb4..1be74f9b9 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -868,7 +868,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut) } else if (ext == EXT_TXT) { - if (!strcmp(dent->d_name, "log.txt") || !strcmp(dent->d_name, "errorlog.txt")) + if (!strncmp(dent->d_name, "log-", 4) || !strcmp(dent->d_name, "errorlog.txt")) ext |= EXT_LOADED; } From 6274b9fde11a7e985b85246cc9b66983798425c5 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 7 Oct 2019 17:55:31 -0700 Subject: [PATCH 091/117] ferror does not return errno, are you stupid? Use M_FileError to return the proper error description, or "end-of-file". (cherry picked from commit 2f521f2eb18a79fd7e0a6aca2f2b7b6113042d6c) --- src/d_netfil.c | 4 ++-- src/m_argv.c | 2 +- src/m_misc.c | 10 ++++++++++ src/m_misc.h | 2 ++ src/sdl12/sdl_sound.c | 2 +- src/w_wad.c | 12 ++++++------ 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index 155700807..cac5a2d80 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -742,7 +742,7 @@ void SV_FileSendTicker(void) if (ram) M_Memcpy(p->data, &f->id.ram[transfer[i].position], size); else if (fread(p->data, 1, size, transfer[i].currentfile) != size) - I_Error("SV_FileSendTicker: can't read %s byte on %s at %d because %s", sizeu1(size), f->id.filename, transfer[i].position, strerror(ferror(transfer[i].currentfile))); + I_Error("SV_FileSendTicker: can't read %s byte on %s at %d because %s", sizeu1(size), f->id.filename, transfer[i].position, M_FileError(transfer[i].currentfile)); p->position = LONG(transfer[i].position); // Put flag so receiver knows the total size if (transfer[i].position + size == f->size) @@ -818,7 +818,7 @@ void Got_Filetxpak(void) // We can receive packet in the wrong order, anyway all os support gaped file fseek(file->file, pos, SEEK_SET); if (fwrite(netbuffer->u.filetxpak.data,size,1,file->file) != 1) - I_Error("Can't write to %s: %s\n",filename, strerror(ferror(file->file))); + I_Error("Can't write to %s: %s\n",filename, M_FileError(file->file)); file->currentsize += size; // Finished? diff --git a/src/m_argv.c b/src/m_argv.c index e8bfdd3db..a23f938a8 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -166,7 +166,7 @@ void M_FindResponseFile(void) if (!file) I_Error("No more free memory for the response file"); if (fread(file, size, 1, handle) != 1) - I_Error("Couldn't read response file because %s", strerror(ferror(handle))); + I_Error("Couldn't read response file because %s", M_FileError(handle)); fclose(handle); // keep all the command line arguments following @responsefile diff --git a/src/m_misc.c b/src/m_misc.c index 8c0070270..91f8f18c5 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -2371,3 +2371,13 @@ void M_SetupMemcpy(void) M_Memcpy = cpu_cpy; #endif } + +/** Return the appropriate message for a file error or end of file. +*/ +const char *M_FileError(FILE *fp) +{ + if (ferror(fp)) + return strerror(errno); + else + return "end-of-file"; +} diff --git a/src/m_misc.h b/src/m_misc.h index 990555971..fb4012b8e 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -100,6 +100,8 @@ void strcatbf(char *s1, const char *s2, const char *s3); void M_SetupMemcpy(void); +const char *M_FileError(FILE *handle); + // counting bits, for weapon ammo code, usually FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size); diff --git a/src/sdl12/sdl_sound.c b/src/sdl12/sdl_sound.c index ed1afd8e2..1a7525fee 100644 --- a/src/sdl12/sdl_sound.c +++ b/src/sdl12/sdl_sound.c @@ -1435,7 +1435,7 @@ static boolean LoadSong(void *data, size_t lumplength, size_t selectpos) if (fwrite(data, lumplength, 1, midfile) == 0) { - CONS_Printf(M_GetText("Couldn't write music into file %s because %s\n"), tempname, strerror(ferror(midfile))); + CONS_Printf(M_GetText("Couldn't write music into file %s because %s\n"), tempname, M_FileError(midfile)); Z_Free(data); fclose(midfile); return false; diff --git a/src/w_wad.c b/src/w_wad.c index da82a276d..734308956 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -366,7 +366,7 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen // read the header if (fread(&header, 1, sizeof header, handle) < sizeof header) { - CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header because %s\n"), strerror(ferror(handle))); + CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header because %s\n"), M_FileError(handle)); return NULL; } @@ -389,7 +389,7 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen if (fseek(handle, header.infotableofs, SEEK_SET) == -1 || fread(fileinfo, 1, i, handle) < i) { - CONS_Alert(CONS_ERROR, M_GetText("Corrupt wadfile directory (%s)\n"), strerror(ferror(handle))); + CONS_Alert(CONS_ERROR, M_GetText("Corrupt wadfile directory (%s)\n"), M_FileError(handle)); free(fileinfov); return NULL; } @@ -410,7 +410,7 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen handle) < sizeof realsize) { I_Error("corrupt compressed file: %s; maybe %s", /// \todo Avoid the bailout? - filename, strerror(ferror(handle))); + filename, M_FileError(handle)); } realsize = LONG(realsize); if (realsize != 0) @@ -548,7 +548,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) fseek(handle, -4, SEEK_CUR); if (fread(&zend, 1, sizeof zend, handle) < sizeof zend) { - CONS_Alert(CONS_ERROR, "Corrupt central directory (%s)\n", strerror(ferror(handle))); + CONS_Alert(CONS_ERROR, "Corrupt central directory (%s)\n", M_FileError(handle)); return NULL; } numlumps = zend.entries; @@ -565,7 +565,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) if (fread(zentry, 1, sizeof(zentry_t), handle) < sizeof(zentry_t)) { - CONS_Alert(CONS_ERROR, "Failed to read central directory (%s)\n", strerror(ferror(handle))); + CONS_Alert(CONS_ERROR, "Failed to read central directory (%s)\n", M_FileError(handle)); Z_Free(lumpinfo); free(zentry); return NULL; @@ -585,7 +585,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) fullname = malloc(zentry->namelen + 1); if (fgets(fullname, zentry->namelen + 1, handle) != fullname) { - CONS_Alert(CONS_ERROR, "Unable to read lumpname (%s)\n", strerror(ferror(handle))); + CONS_Alert(CONS_ERROR, "Unable to read lumpname (%s)\n", M_FileError(handle)); Z_Free(lumpinfo); free(zentry); free(fullname); From c79ceca65e0dbb21c693bd573acc05d2908e2523 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 7 Oct 2019 18:10:33 -0700 Subject: [PATCH 092/117] Forgot includes (cherry picked from commit 92dd9d20663c8c601053354326fd9412694e3078) --- src/m_argv.c | 1 + src/m_misc.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/m_argv.c b/src/m_argv.c index a23f938a8..e1046f8a7 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -16,6 +16,7 @@ #include "doomdef.h" #include "command.h" #include "m_argv.h" +#include "m_misc.h" /** \brief number of arg */ diff --git a/src/m_misc.c b/src/m_misc.c index 91f8f18c5..a7bcd6ff4 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -23,6 +23,8 @@ #include #endif +#include + // Extended map support. #include From ccde660cdf19ed01eda5a49063fb629f061ed838 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 23 Dec 2019 15:31:50 -0800 Subject: [PATCH 093/117] -logfile to let the user change the log file name (cherry picked from commit d9d13764e6840e036c095c6d87838a4dfede80f4) --- src/sdl/i_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 10f14f36f..61e15f2ba 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -133,15 +133,19 @@ int main(int argc, char **argv) { time_t my_time; struct tm * timeinfo; - char buf[26]; + const char *format; logdir = D_Home(); my_time = time(NULL); timeinfo = localtime(&my_time); - strftime(buf, 26, "%Y-%m-%d %H-%M-%S", timeinfo); - strcpy(logfile, va("log-%s.txt", buf)); + if (M_CheckParm("-logfile") && M_IsNextParm()) + format = M_GetNextParm(); + else + format = "log-%Y-%m-%d %H-%M-%S.txt"; + + strftime(logfile, sizeof logfile, format, timeinfo); #ifdef DEFAULTDIR if (logdir) From 599452af7beb4e14a4d1c57b7b1ddf59d82881db Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 23 Dec 2019 15:34:27 -0800 Subject: [PATCH 094/117] Change default log filename to not use a space bleh (cherry picked from commit c285000c5668ab82545ec9ee4989aabf65e2585e) --- src/sdl/i_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 61e15f2ba..82367aaaa 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -143,7 +143,7 @@ int main(int argc, char **argv) if (M_CheckParm("-logfile") && M_IsNextParm()) format = M_GetNextParm(); else - format = "log-%Y-%m-%d %H-%M-%S.txt"; + format = "log-%Y-%m-%d_%H-%M-%S.txt"; strftime(logfile, sizeof logfile, format, timeinfo); From 45a2e22abc767b4e3076db09c256162dbb0629db Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 23 Dec 2019 17:21:58 -0800 Subject: [PATCH 095/117] -logdir lets the user change the log directory (cherry picked from commit 457e986b7514c0e9fa921c1961344012443ac164) --- src/m_misc.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ src/m_misc.h | 4 +++ src/sdl/i_main.c | 34 ++++++++++++++++------ 3 files changed, 102 insertions(+), 9 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index a7bcd6ff4..2754bac74 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -2383,3 +2383,76 @@ const char *M_FileError(FILE *fp) else return "end-of-file"; } + +/** Return the number of parts of this path. +*/ +int M_PathParts(const char *path) +{ + int n; + const char *p; + const char *t; + for (n = 0, p = path ;; ++n) + { + t = p; + if (( p = strchr(p, PATHSEP[0]) )) + p += strspn(p, PATHSEP); + else + { + if (*t)/* there is something after the final delimiter */ + n++; + break; + } + } + return n; +} + +/** Check whether a path is an absolute path. +*/ +boolean M_IsPathAbsolute(const char *path) +{ +#ifdef _WIN32 + return ( strncmp(&path[1], ":\\", 2) == 0 ); +#else + return ( path[0] == '/' ); +#endif +} + +/** I_mkdir for each part of the path. +*/ +void M_MkdirEach(const char *cpath, int start, int mode) +{ + char path[MAX_WADPATH]; + char *p; + char *t; + strlcpy(path, cpath, sizeof path); +#ifdef _WIN32 + if (strncmp(&path[1], ":\\", 2) == 0) + p = &path[3]; + else +#endif + p = path; + for (; start > 0; --start) + { + p += strspn(p, PATHSEP); + if (!( p = strchr(p, PATHSEP[0]) )) + return; + } + p += strspn(p, PATHSEP); + for (;;) + { + t = p; + if (( p = strchr(p, PATHSEP[0]) )) + { + *p = '\0'; + I_mkdir(path, mode); + *p = PATHSEP[0]; + p += strspn(p, PATHSEP); + } + else + { + if (*t) + I_mkdir(path, mode); + break; + } + } +} diff --git a/src/m_misc.h b/src/m_misc.h index fb4012b8e..0a82322b0 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -102,6 +102,10 @@ void M_SetupMemcpy(void); const char *M_FileError(FILE *handle); +int M_PathParts (const char *path); +boolean M_IsPathAbsolute (const char *path); +void M_MkdirEach (const char *path, int start, int mode); + // counting bits, for weapon ammo code, usually FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size); diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 82367aaaa..e7f47bfae 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -20,6 +20,7 @@ #include "../doomdef.h" #include "../m_argv.h" #include "../d_main.h" +#include "../m_misc.h"/* path shit */ #include "../i_system.h" #ifdef __GNUC__ @@ -134,6 +135,8 @@ int main(int argc, char **argv) time_t my_time; struct tm * timeinfo; const char *format; + const char *reldir; + int left; logdir = D_Home(); @@ -145,24 +148,37 @@ int main(int argc, char **argv) else format = "log-%Y-%m-%d_%H-%M-%S.txt"; - strftime(logfile, sizeof logfile, format, timeinfo); + if (M_CheckParm("-logdir") && M_IsNextParm()) + reldir = M_GetNextParm(); + else + reldir = "logs"; + if (M_IsPathAbsolute(reldir)) + { + left = snprintf(logfile, sizeof logfile, + "%s"PATHSEP, reldir); + } + else #ifdef DEFAULTDIR if (logdir) { - // Create dirs here because D_SRB2Main() is too late. - I_mkdir(va("%s%s"DEFAULTDIR, logdir, PATHSEP), 0755); - I_mkdir(va("%s%s"DEFAULTDIR"%slogs",logdir, PATHSEP, PATHSEP), 0755); - logstream = fopen(va("%s%s"DEFAULTDIR"%slogs%s%s",logdir, PATHSEP, PATHSEP, PATHSEP, logfile), "wt"); + left = snprintf(logfile, sizeof logfile, + "%s"PATHSEP DEFAULTDIR PATHSEP"%s"PATHSEP, logdir, reldir); } else -#endif +#endif/*DEFAULTDIR*/ { - I_mkdir("."PATHSEP"logs"PATHSEP, 0755); - logstream = fopen(va("."PATHSEP"logs"PATHSEP"%s", logfile), "wt"); + left = snprintf(logfile, sizeof logfile, + "."PATHSEP"%s"PATHSEP, reldir); } +#endif/*LOGMESSAGES*/ + + M_MkdirEach(logfile, M_PathParts(logdir) - 1, 0755); + + strftime(&logfile[left], sizeof logfile - left, format, timeinfo); + + logstream = fopen(logfile, "wt"); } -#endif //I_OutputMsg("I_StartupSystem() ...\n"); I_StartupSystem(); From b4f93fea8e16f7695a4fb665cb3312487fe7205c Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 23 Dec 2019 17:40:43 -0800 Subject: [PATCH 096/117] Let an asbolute path work with -logfile (cherry picked from commit 5fbe77cdda7ec52bc2ca10ab9253df8dc56d2317) --- src/m_misc.c | 18 ++++++++++++++- src/m_misc.h | 1 + src/sdl/i_main.c | 58 +++++++++++++++++++++++++++++++----------------- 3 files changed, 56 insertions(+), 21 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index 2754bac74..8363e9d17 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -2419,11 +2419,15 @@ boolean M_IsPathAbsolute(const char *path) /** I_mkdir for each part of the path. */ -void M_MkdirEach(const char *cpath, int start, int mode) +void M_MkdirEachUntil(const char *cpath, int start, int end, int mode) { char path[MAX_WADPATH]; char *p; char *t; + + if (end > 0 && end <= start) + return; + strlcpy(path, cpath, sizeof path); #ifdef _WIN32 if (strncmp(&path[1], ":\\", 2) == 0) @@ -2431,6 +2435,10 @@ void M_MkdirEach(const char *cpath, int start, int mode) else #endif p = path; + + if (end > 0) + end -= start; + for (; start > 0; --start) { p += strspn(p, PATHSEP); @@ -2440,6 +2448,9 @@ void M_MkdirEach(const char *cpath, int start, int mode) p += strspn(p, PATHSEP); for (;;) { + if (end > 0 && !--end) + break; + t = p; if (( p = strchr(p, PATHSEP[0]) )) { @@ -2456,3 +2467,8 @@ void M_MkdirEach(const char *cpath, int start, int mode) } } } + +void M_MkdirEach(const char *path, int start, int mode) +{ + M_MkdirEachUntil(path, start, -1, mode); +} diff --git a/src/m_misc.h b/src/m_misc.h index 0a82322b0..9e43b20c9 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -105,6 +105,7 @@ const char *M_FileError(FILE *handle); int M_PathParts (const char *path); boolean M_IsPathAbsolute (const char *path); void M_MkdirEach (const char *path, int start, int mode); +void M_MkdirEachUntil (const char *path, int start, int end, int mode); // counting bits, for weapon ammo code, usually FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size); diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index e7f47bfae..7059348b7 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -137,6 +137,7 @@ int main(int argc, char **argv) const char *format; const char *reldir; int left; + boolean fileabs; logdir = D_Home(); @@ -144,38 +145,55 @@ int main(int argc, char **argv) timeinfo = localtime(&my_time); if (M_CheckParm("-logfile") && M_IsNextParm()) + { format = M_GetNextParm(); + fileabs = M_IsPathAbsolute(format); + } else + { format = "log-%Y-%m-%d_%H-%M-%S.txt"; + fileabs = false; + } - if (M_CheckParm("-logdir") && M_IsNextParm()) - reldir = M_GetNextParm(); - else - reldir = "logs"; - - if (M_IsPathAbsolute(reldir)) + if (fileabs) { - left = snprintf(logfile, sizeof logfile, - "%s"PATHSEP, reldir); + strftime(logfile, sizeof logfile, format, timeinfo); + + M_MkdirEachUntil(logfile, + M_PathParts(logdir) - 1, + M_PathParts(logfile) - 1, 0755); } else + { + if (M_CheckParm("-logdir") && M_IsNextParm()) + reldir = M_GetNextParm(); + else + reldir = "logs"; + + if (M_IsPathAbsolute(reldir)) + { + left = snprintf(logfile, sizeof logfile, + "%s"PATHSEP, reldir); + } + else #ifdef DEFAULTDIR - if (logdir) - { - left = snprintf(logfile, sizeof logfile, - "%s"PATHSEP DEFAULTDIR PATHSEP"%s"PATHSEP, logdir, reldir); - } - else + if (logdir) + { + left = snprintf(logfile, sizeof logfile, + "%s"PATHSEP DEFAULTDIR PATHSEP"%s"PATHSEP, logdir, reldir); + } + else #endif/*DEFAULTDIR*/ - { - left = snprintf(logfile, sizeof logfile, - "."PATHSEP"%s"PATHSEP, reldir); - } + { + left = snprintf(logfile, sizeof logfile, + "."PATHSEP"%s"PATHSEP, reldir); + } #endif/*LOGMESSAGES*/ - M_MkdirEach(logfile, M_PathParts(logdir) - 1, 0755); + M_MkdirEach(logfile, M_PathParts(logdir) - 1, 0755); - strftime(&logfile[left], sizeof logfile - left, format, timeinfo); + strftime(&logfile[left], sizeof logfile - left, format, timeinfo); + } logstream = fopen(logfile, "wt"); } From 294dfbacc5886dfa13ea708e932cedbd72b854f7 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 23 Dec 2019 17:43:42 -0800 Subject: [PATCH 097/117] Create directories from -logfile too (cherry picked from commit 98cb238d36e0f85d9d4b4d2cff59c720e1630bdd) --- src/sdl/i_main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 7059348b7..932861353 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -158,10 +158,6 @@ int main(int argc, char **argv) if (fileabs) { strftime(logfile, sizeof logfile, format, timeinfo); - - M_MkdirEachUntil(logfile, - M_PathParts(logdir) - 1, - M_PathParts(logfile) - 1, 0755); } else { @@ -190,11 +186,13 @@ int main(int argc, char **argv) } #endif/*LOGMESSAGES*/ - M_MkdirEach(logfile, M_PathParts(logdir) - 1, 0755); - strftime(&logfile[left], sizeof logfile - left, format, timeinfo); } + M_MkdirEachUntil(logfile, + M_PathParts(logdir) - 1, + M_PathParts(logfile) - 1, 0755); + logstream = fopen(logfile, "wt"); } From 10a9a05cd89ed234062b5464c41efc8b8c78ae79 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 23 Dec 2019 18:20:04 -0800 Subject: [PATCH 098/117] symlink latest-log.txt on nix, copy to the real log file everywhere else (cherry picked from commit 25525a6aae84581ac03ca3089950ad4ff25b8512) --- src/doomdef.h | 1 + src/sdl/i_main.c | 40 +++++++++++++++++++++++++++++----------- src/sdl/i_system.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 11 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index bb21e3d0f..a3e473acc 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -138,6 +138,7 @@ #ifdef LOGMESSAGES extern FILE *logstream; +extern char logfilename[1024]; #endif //#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 932861353..0550b8e02 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -23,10 +23,14 @@ #include "../m_misc.h"/* path shit */ #include "../i_system.h" -#ifdef __GNUC__ +#if defined (__GNUC__) || defined (__unix__) #include #endif +#ifdef __unix__ +#include +#endif + #include "time.h" // For log timestamps #ifdef HAVE_SDL @@ -48,6 +52,7 @@ extern int SDL_main(int argc, char *argv[]); #ifdef LOGMESSAGES FILE *logstream = NULL; +char logfilename[1024]; #endif #ifndef DOXYGEN @@ -117,7 +122,6 @@ int main(int argc, char **argv) #endif { const char *logdir = NULL; - char logfile[MAX_WADPATH]; myargc = argc; myargv = argv; /// \todo pull out path to exe from this string @@ -157,7 +161,7 @@ int main(int argc, char **argv) if (fileabs) { - strftime(logfile, sizeof logfile, format, timeinfo); + strftime(logfilename, sizeof logfilename, format, timeinfo); } else { @@ -168,32 +172,46 @@ int main(int argc, char **argv) if (M_IsPathAbsolute(reldir)) { - left = snprintf(logfile, sizeof logfile, + left = snprintf(logfilename, sizeof logfilename, "%s"PATHSEP, reldir); } else #ifdef DEFAULTDIR if (logdir) { - left = snprintf(logfile, sizeof logfile, + left = snprintf(logfilename, sizeof logfilename, "%s"PATHSEP DEFAULTDIR PATHSEP"%s"PATHSEP, logdir, reldir); } else #endif/*DEFAULTDIR*/ { - left = snprintf(logfile, sizeof logfile, + left = snprintf(logfilename, sizeof logfilename, "."PATHSEP"%s"PATHSEP, reldir); } #endif/*LOGMESSAGES*/ - strftime(&logfile[left], sizeof logfile - left, format, timeinfo); + strftime(&logfilename[left], sizeof logfilename - left, + format, timeinfo); } - M_MkdirEachUntil(logfile, + M_MkdirEachUntil(logfilename, M_PathParts(logdir) - 1, - M_PathParts(logfile) - 1, 0755); + M_PathParts(logfilename) - 1, 0755); - logstream = fopen(logfile, "wt"); +#ifdef __unix__ + logstream = fopen(logfilename, "w"); +#ifdef DEFAULTDIR + if (symlink(logfilename, + va("%s/"DEFAULTDIR"/latest-log.txt", logdir)) == -1) +#else + if (symlink(logfilename, va("%s/latest-log.txt", logdir)) == -1) +#endif/*DEFAULTDIR*/ + { + I_OutputMsg("Error symlinking latest-log.txt: %s\n", strerror(errno)); + } +#else/*__unix__*/ + logstream = fopen("latest-log.txt", "wt+"); +#endif/*__unix__*/ } //I_OutputMsg("I_StartupSystem() ...\n"); @@ -222,7 +240,7 @@ int main(int argc, char **argv) D_SRB2Main(); #ifdef LOGMESSAGES if (!M_CheckParm("-nolog")) - CONS_Printf("Logfile: %s\n", logfile); + CONS_Printf("Logfile: %s\n", logfilename); #endif CONS_Printf("Entering main game loop...\n"); // never return diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index f75a42117..2ccdec5c4 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -3268,6 +3268,48 @@ void I_RemoveExitFunc(void (*func)()) } } +#ifndef __unix__ +static void Shittycopyerror(const char *name) +{ + I_OutputMsg( + "Error copying log file: %s: %s\n", + name, + strerror(errno) + ); +} + +static void Shittylogcopy(void) +{ + char buf[8192]; + FILE *fp; + int n; + if (fseek(logstream, 0, SEEK_SET) == -1) + { + Shittycopyerror("fseek"); + } + else if (( fp = fopen(logfilename, "wt") )) + { + while (( n = fread(buf, 1, sizeof buf, logstream) )) + { + if (fwrite(buf, 1, n, fp) < n) + { + Shittycopyerror("fwrite"); + break; + } + } + if (ferror(logstream)) + { + Shittycopyerror("fread"); + } + fclose(fp); + } + else + { + Shittycopyerror(logfilename); + } +} +#endif/*__unix__*/ + // // Closes down everything. This includes restoring the initial // palette and video mode, and removing whatever mouse, keyboard, and @@ -3286,6 +3328,9 @@ void I_ShutdownSystem(void) if (logstream) { I_OutputMsg("I_ShutdownSystem(): end of logstream.\n"); +#ifndef __unix__ + Shittylogcopy(); +#endif fclose(logstream); logstream = NULL; } From d1de8cc2ebcc0dcd6bd2a0fc638a6928f6959ca5 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 24 Dec 2019 01:55:47 -0800 Subject: [PATCH 099/117] Overwrite an already existing symlink (cherry picked from commit f2c2836301d4dc59242d09f08a5473341c4d692c) --- src/sdl/i_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 0550b8e02..f8dcc3c3b 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -142,6 +142,7 @@ int main(int argc, char **argv) const char *reldir; int left; boolean fileabs; + const char *link; logdir = D_Home(); @@ -201,11 +202,12 @@ int main(int argc, char **argv) #ifdef __unix__ logstream = fopen(logfilename, "w"); #ifdef DEFAULTDIR - if (symlink(logfilename, - va("%s/"DEFAULTDIR"/latest-log.txt", logdir)) == -1) + link = va("%s/"DEFAULTDIR"/latest-log.txt", logdir); #else - if (symlink(logfilename, va("%s/latest-log.txt", logdir)) == -1) + link = va("%s/latest-log.txt", logdir); #endif/*DEFAULTDIR*/ + unlink(link); + if (symlink(logfilename, link) == -1) { I_OutputMsg("Error symlinking latest-log.txt: %s\n", strerror(errno)); } From 7ef8e81713dc2f20b4855e1389d34772d45e5cdc Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 24 Dec 2019 01:58:39 -0800 Subject: [PATCH 100/117] Correct usage of logdir (cherry picked from commit b7b4945c36fb95f406a365d64f109cfc83ad4d63) --- src/sdl/i_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index f8dcc3c3b..816142d72 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -202,10 +202,11 @@ int main(int argc, char **argv) #ifdef __unix__ logstream = fopen(logfilename, "w"); #ifdef DEFAULTDIR - link = va("%s/"DEFAULTDIR"/latest-log.txt", logdir); -#else - link = va("%s/latest-log.txt", logdir); + if (logdir) + link = va("%s/"DEFAULTDIR"/latest-log.txt", logdir); + else #endif/*DEFAULTDIR*/ + link = "latest-log.txt"; unlink(link); if (symlink(logfilename, link) == -1) { From f74adb0ad99d72ce710dd0d34da9f7231cacc4af Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 28 Dec 2019 22:14:23 -0300 Subject: [PATCH 101/117] Fix logfiles crashing Windoze (cherry picked from commit 3bb7fd4cbf2bb92f5548cafad00b80cb366395a4) --- src/sdl/i_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 816142d72..9daca99fa 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -195,9 +195,12 @@ int main(int argc, char **argv) format, timeinfo); } - M_MkdirEachUntil(logfilename, - M_PathParts(logdir) - 1, - M_PathParts(logfilename) - 1, 0755); + if (logdir) + { + M_MkdirEachUntil(logfilename, + M_PathParts(logdir) - 1, + M_PathParts(logfilename) - 1, 0755); + } #ifdef __unix__ logstream = fopen(logfilename, "w"); From 21a3067936003c441460a3b721d838dae57c619f Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 28 Dec 2019 22:18:41 -0300 Subject: [PATCH 102/117] Fix M_PathParts instead (cherry picked from commit 244f0b228fefb69fb59c1f7f70d4815c0388a634) --- src/m_misc.c | 2 ++ src/sdl/i_main.c | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index 8363e9d17..f2f3bbdf5 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -2391,6 +2391,8 @@ int M_PathParts(const char *path) int n; const char *p; const char *t; + if (path == NULL) + return 0; for (n = 0, p = path ;; ++n) { t = p; diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 9daca99fa..816142d72 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -195,12 +195,9 @@ int main(int argc, char **argv) format, timeinfo); } - if (logdir) - { - M_MkdirEachUntil(logfilename, - M_PathParts(logdir) - 1, - M_PathParts(logfilename) - 1, 0755); - } + M_MkdirEachUntil(logfilename, + M_PathParts(logdir) - 1, + M_PathParts(logfilename) - 1, 0755); #ifdef __unix__ logstream = fopen(logfilename, "w"); From 14fdc8a90af61c2849e63dfc8dd91c835a8f82a5 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Wed, 25 Mar 2020 05:36:46 -0400 Subject: [PATCH 103/117] Savegame is a stupid term for this --- src/p_saveg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index ee2dc62ea..ccae035ee 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -2018,7 +2018,7 @@ static void LoadMobjThinker(actionf_p1 thinker) CONS_Alert(CONS_ERROR, "Found mobj with unknown map thing type %d\n", mobj->spawnpoint->type); else CONS_Alert(CONS_ERROR, "Found mobj with unknown map thing type NULL\n"); - I_Error("Savegame corrupted"); + I_Error("Netsave corrupted"); } mobj->type = i; } From 505b0176c0bb67412a9e4afb250f9fd8738ce1e7 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Wed, 25 Mar 2020 22:30:52 -0400 Subject: [PATCH 104/117] Horizon line apply to FOFs backport --- src/hardware/hw_main.c | 2 +- src/r_defs.h | 2 ++ src/r_segs.c | 23 +++++++++++++++++------ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index b7675a21b..01cc9b01f 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2023,7 +2023,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) // Single sided line... Deal only with the middletexture (if one exists) gr_midtexture = R_GetTextureNum(gr_sidedef->midtexture); if (gr_midtexture - && gr_linedef->special != 41) // Ignore horizon line for OGL + && gr_linedef->special != HORIZONSPECIAL) // Ignore horizon line for OGL { { fixed_t texturevpeg; diff --git a/src/r_defs.h b/src/r_defs.h index 52a3be80e..c8a72044d 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -406,6 +406,8 @@ typedef enum ST_NEGATIVE } slopetype_t; +#define HORIZONSPECIAL 41 + typedef struct line_s { // Vertices, from v1 to v2. diff --git a/src/r_segs.c b/src/r_segs.c index 399f514bc..2304540fe 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2687,7 +2687,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) worldbottomslope >>= 4; #endif - if (linedef->special == 41) { // HORIZON LINES + if (linedef->special == HORIZONSPECIAL) { // HORIZON LINES topstep = bottomstep = 0; topfrac = bottomfrac = (centeryfrac>>4); topfrac++; // Prevent 1px HOM @@ -2817,12 +2817,23 @@ void R_StoreWallRange(INT32 start, INT32 stop) ffloor[i].f_pos >>= 4; #ifdef ESLOPE ffloor[i].f_pos_slope >>= 4; - ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); - ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(range); -#else - ffloor[i].f_step = FixedMul(-rw_scalestep, ffloor[i].f_pos); - ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); #endif + if (linedef->special == HORIZONSPECIAL) // Horizon lines extend FOFs in contact with them too. + { + ffloor[i].f_step = 0; + ffloor[i].f_frac = (centeryfrac>>4); + topfrac++; // Prevent 1px HOM + } + else + { +#ifdef ESLOPE + ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); + ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(range); +#else + ffloor[i].f_step = FixedMul(-rw_scalestep, ffloor[i].f_pos); + ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); +#endif + } } } From 81fa5d7f513c0b52cc5f792563ab834cdf79922e Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Wed, 25 Mar 2020 23:49:39 -0400 Subject: [PATCH 105/117] Start on new flame shield dash visuals --- src/dehacked.c | 13 ++++++++++++- src/info.c | 14 ++++++++++++-- src/info.h | 15 ++++++++++++++- src/p_enemy.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/p_mobj.c | 10 ++++------ 5 files changed, 86 insertions(+), 10 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index e6508721e..da740a7a9 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1887,6 +1887,7 @@ static actionpointer_t actionpointers[] = {{A_ReaperThinker}, "A_REAPERTHINKER"}, //SRB2kart {{A_MementosTPParticles}, "A_MEMENTOSTPPARTICLES"}, //SRB2kart {{A_FlameParticle}, "A_FLAMEPARTICLE"}, // SRB2kart + {{A_FlameShieldPaper}, "A_FLAMESHIELDPAPER"}, // SRB2kart {{A_OrbitNights}, "A_ORBITNIGHTS"}, {{A_GhostMe}, "A_GHOSTME"}, {{A_SetObjectState}, "A_SETOBJECTSTATE"}, @@ -6700,7 +6701,17 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLAMESHIELD16", "S_FLAMESHIELD17", "S_FLAMESHIELD18", - "S_FLAMESHIELDDASH", + + "S_FLAMESHIELDDASH1", + "S_FLAMESHIELDDASH2", + "S_FLAMESHIELDDASH3", + "S_FLAMESHIELDDASH4", + "S_FLAMESHIELDDASH5", + "S_FLAMESHIELDDASH6", + "S_FLAMESHIELDDASH7", + "S_FLAMESHIELDDASH8", + + "S_FLAMESHIELDPAPER", // The legend "S_SINK", diff --git a/src/info.c b/src/info.c index 11f669535..2c3399608 100644 --- a/src/info.c +++ b/src/info.c @@ -58,7 +58,7 @@ char sprnames[NUMSPRITES + 1][5] = //SRB2kart Sprites "RNDM","RPOP","SGNS","FAST","DSHR","BOST","BOSM","KFRE","KINV","KINF", "WIPD","DRIF","BDRF","DUST","DRWS","RSHE","FITM","BANA","ORBN","JAWZ","SSMN", - "KRBM","BHOG","BHBM","SPBM","THNS","BUBS","BWVE","FLMS","SINK","SITR", + "KRBM","BHOG","BHBM","SPBM","THNS","BUBS","BWVE","FLMS","FLMD","FLMP","SINK","SITR", "KBLN","DEZL","POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB", "CHOM","SACO","CRAB","BRNG","BUMP","FLEN","CLAS","PSHW","ISTA", "ISTB","ARRO","ITEM","ITMO","ITMI","ITMN","WANT","PBOM","HIT1","HIT2", @@ -2918,7 +2918,17 @@ state_t states[NUMSTATES] = {SPR_FLMS, FF_FULLBRIGHT|16, 2, {NULL}, 0, 0, S_FLAMESHIELD17}, // S_FLAMESHIELD16 {SPR_FLMS, FF_FULLBRIGHT|8, 2, {NULL}, 0, 0, S_FLAMESHIELD18}, // S_FLAMESHIELD17 {SPR_FLMS, FF_FULLBRIGHT|17, 2, {NULL}, 0, 0, S_FLAMESHIELD1}, // S_FLAMESHIELD18 - {SPR_FLMS, FF_FULLBRIGHT|18, -1, {NULL}, 0, 0, S_FLAMESHIELDDASH}, // S_FLAMESHIELDDASH + + {SPR_FLMD, FF_FULLBRIGHT|1, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH2}, // S_FLAMESHIELDDASH1 + {SPR_FLMD, FF_FULLBRIGHT, 1, {A_FlameShieldPaper}, 0, 2, S_FLAMESHIELDDASH3}, // S_FLAMESHIELDDASH2 + {SPR_FLMD, FF_FULLBRIGHT|2, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH4}, // S_FLAMESHIELDDASH3 + {SPR_FLMD, FF_FULLBRIGHT, 1, {A_FlameShieldPaper}, 1, 3, S_FLAMESHIELDDASH5}, // S_FLAMESHIELDDASH4 + {SPR_FLMD, FF_FULLBRIGHT|3, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH6}, // S_FLAMESHIELDDASH5 + {SPR_FLMD, FF_FULLBRIGHT, 1, {A_FlameShieldPaper}, 2, 0, S_FLAMESHIELDDASH7}, // S_FLAMESHIELDDASH6 + {SPR_FLMD, FF_FULLBRIGHT|4, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH8}, // S_FLAMESHIELDDASH7 + {SPR_FLMD, FF_FULLBRIGHT, 1, {A_FlameShieldPaper}, 3, 1, S_FLAMESHIELDDASH1}, // S_FLAMESHIELDDASH8 + + {SPR_FLMP, FF_FULLBRIGHT|FF_PAPERSPRITE, 2, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDPAPER {SPR_SINK, 0, 1, {A_SmokeTrailer}, MT_SINKTRAIL, 0, S_SINK}, // S_SINK {SPR_SINK, 0|FF_TRANS80|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_SINK_SHIELD}, // S_SINK_SHIELD diff --git a/src/info.h b/src/info.h index a51984ad2..5c9a3de51 100644 --- a/src/info.h +++ b/src/info.h @@ -177,6 +177,7 @@ void A_MayonakaArrow(); //SRB2kart: midnight channel arrow sign void A_ReaperThinker(); //SRB2kart: mementos reaper void A_MementosTPParticles(); //SRB2kart: mementos teleporter particles. Man that's a lot of actions for my shite. void A_FlameParticle(); // SRB2kart +void A_FlameShieldPaper(); void A_OrbitNights(); void A_GhostMe(); void A_SetObjectState(); @@ -625,6 +626,8 @@ typedef enum sprite SPR_BUBS, // Bubble Shield (not Bubs) SPR_BWVE, // Bubble Shield waves SPR_FLMS, // Flame Shield + SPR_FLMD, // Flame Shield dash + SPR_FLMP, // Flame Shield paper sprites SPR_SINK, // Kitchen Sink SPR_SITR, // Kitchen Sink Trail SPR_KBLN, // Battle Mode Bumper @@ -3595,7 +3598,17 @@ typedef enum state S_FLAMESHIELD16, S_FLAMESHIELD17, S_FLAMESHIELD18, - S_FLAMESHIELDDASH, + + S_FLAMESHIELDDASH1, + S_FLAMESHIELDDASH2, + S_FLAMESHIELDDASH3, + S_FLAMESHIELDDASH4, + S_FLAMESHIELDDASH5, + S_FLAMESHIELDDASH6, + S_FLAMESHIELDDASH7, + S_FLAMESHIELDDASH8, + + S_FLAMESHIELDPAPER, // The legend S_SINK, diff --git a/src/p_enemy.c b/src/p_enemy.c index 444840e79..d2931d17e 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -203,6 +203,7 @@ void A_MayonakaArrow(mobj_t *actor); //SRB2kart void A_ReaperThinker(mobj_t *actor); //SRB2kart void A_MementosTPParticles(mobj_t *actor); //SRB2kart void A_FlameParticle(mobj_t *actor); // SRB2kart +void A_FlameShieldPaper(mobj_t *actor); // SRB2kart void A_OrbitNights(mobj_t *actor); void A_GhostMe(mobj_t *actor); void A_SetObjectState(mobj_t *actor); @@ -9328,6 +9329,49 @@ void A_FlameParticle(mobj_t *actor) par->momz = actor->scale<<1; } +void A_FlameShieldPaper(mobj_t *actor) +{ + INT32 framea = 0; + INT32 frameb = 0; + INT32 locvar1 = var1; + INT32 locvar2 = var2; + UINT8 i; + +#ifdef HAVE_BLUA + if (LUA_CallAction("A_FlameShieldPaper", actor)) + return; +#endif + + framea = (locvar1 & FF_FRAMEMASK); + frameb = (locvar2 & FF_FRAMEMASK); + + for (i = 0; i < 2; i++) + { + INT32 perpendicular = ((i & 1) ? -ANGLE_90 : ANGLE_90); + fixed_t newx = actor->x + P_ReturnThrustX(NULL, actor->angle + perpendicular, 8*actor->scale); + fixed_t newy = actor->y + P_ReturnThrustY(NULL, actor->angle + perpendicular, 8*actor->scale); + mobj_t *paper = P_SpawnMobj(newx + actor->momx, newy + actor->momy, actor->z + actor->momz, MT_THOK); + + P_SetScale(paper, actor->scale); + paper->destscale = actor->destscale; + + P_SetMobjState(paper, S_FLAMESHIELDPAPER); + paper->frame &= ~FF_FRAMEMASK; + + paper->angle = actor->angle + ANGLE_45; + + if (i & 1) + { + paper->angle -= ANGLE_90; + paper->frame |= frameb; + } + else + { + paper->frame |= framea; + } + } +} + //} // Function: A_OrbitNights diff --git a/src/p_mobj.c b/src/p_mobj.c index 25acd0c89..773ed3709 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8603,15 +8603,13 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->target->player->kartstuff[k_flamedash]) { - if (curstate != S_FLAMESHIELDDASH) - P_SetMobjState(mobj, S_FLAMESHIELDDASH); - mobj->flags2 ^= MF2_DONTDRAW; + if (!(curstate >= S_FLAMESHIELDDASH1 && curstate <= S_FLAMESHIELDDASH8)) + P_SetMobjState(mobj, S_FLAMESHIELDDASH1); } else { - if (curstate == S_FLAMESHIELDDASH) + if (curstate >= S_FLAMESHIELDDASH1 && curstate <= S_FLAMESHIELDDASH8) P_SetMobjState(mobj, S_FLAMESHIELD1); - mobj->flags2 &= ~MF2_DONTDRAW; } if (!splitscreen /*&& rendermode != render_soft*/) @@ -8625,7 +8623,7 @@ void P_MobjThinker(mobj_t *mobj) else viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, camera[0].x, camera[0].y); - if (curstate >= S_FLAMESHIELD1 && curstate < S_FLAMESHIELDDASH && ((curstate-S_FLAMESHIELD1) & 1)) + if (curstate >= S_FLAMESHIELD1 && curstate < S_FLAMESHIELDDASH1 && ((curstate-S_FLAMESHIELD1) & 1)) viewingangle += ANGLE_180; destx = mobj->target->x + P_ReturnThrustX(mobj->target, viewingangle, mobj->scale>>4); From 46209a96cfeb76c00b4c56ad10b0613266775b5c Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Wed, 25 Mar 2020 23:52:45 -0400 Subject: [PATCH 106/117] Double leniency period --- 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 c4b66f721..8cb2a472e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7586,7 +7586,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) flamemax = player->kartstuff[k_flamelength] * (TICRATE/4); if (flamemax > 0) - flamemax += (TICRATE/4); + flamemax += (TICRATE/2); if ((cmd->buttons & BT_ATTACK) && player->kartstuff[k_holdready]) { @@ -7628,7 +7628,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) flamemax = player->kartstuff[k_flamelength] * (TICRATE/4); if (flamemax > 0) - flamemax += (TICRATE/4); + flamemax += (TICRATE/2); } if (player->kartstuff[k_flamemeter] > flamemax) From 6333dc47370641268bb852a4d891e06f3f95903a Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 26 Mar 2020 00:07:03 -0400 Subject: [PATCH 107/117] Thrust slightly when used in the air --- src/k_kart.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 8cb2a472e..0ce0276e3 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7602,11 +7602,19 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->kartstuff[k_flamedash] += 2; player->kartstuff[k_flamemeter] += 2; + if (!onground) + { + P_Thrust( + player->mo, R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy), + FixedMul(player->mo->scale, K_GetKartGameSpeedScalar(gamespeed)) + ); + } + if (player->kartstuff[k_flamemeter] > flamemax) { P_Thrust( player->mo, player->mo->angle, - FixedMul((50*mapobjectscale), K_GetKartGameSpeedScalar(gamespeed)) + FixedMul((50*player->mo->scale), K_GetKartGameSpeedScalar(gamespeed)) ); player->kartstuff[k_flamemeter] = 0; From 985aa44c95caffdfc02b322618fa01f9882f9dd3 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 26 Mar 2020 00:47:03 -0400 Subject: [PATCH 108/117] Flame shield destroys items while being used --- src/k_collide.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/k_collide.c b/src/k_collide.c index bbd5c2974..8cdbe14f4 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -36,10 +36,18 @@ boolean K_OrbinautJawzCollide(mobj_t *t1, mobj_t *t2) if (t2->player->kartstuff[k_hyudorotimer]) return true; // no interaction - // Player Damage - P_DamageMobj(t2, t1, t1->target, 1); - K_KartBouncing(t2, t1, false, false); - S_StartSound(t2, sfx_s3k7b); + if (t2->player->kartstuff[k_flamedash] && t2->player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) + { + // Melt item + S_StartSound(t2, sfx_s3k43); + } + else + { + // Player Damage + P_DamageMobj(t2, t1, t1->target, 1); + K_KartBouncing(t2, t1, false, false); + S_StartSound(t2, sfx_s3k7b); + } damageitem = true; } @@ -126,8 +134,16 @@ boolean K_BananaBallhogCollide(mobj_t *t1, mobj_t *t2) if (t1->type == MT_BANANA && t1->health > 1) S_StartSound(t2, sfx_bsnipe); - // Player Damage - K_SpinPlayer(t2->player, t1->target, 0, t1, (t1->type == MT_BANANA || t1->type == MT_BANANA_SHIELD)); + if (t2->player->kartstuff[k_flamedash] && t2->player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) + { + // Melt item + S_StartSound(t2, sfx_s3k43); + } + else + { + // Player Damage + K_SpinPlayer(t2->player, t1->target, 0, t1, (t1->type == MT_BANANA || t1->type == MT_BANANA_SHIELD)); + } damageitem = true; } From b6c282ec12f005d28e4a140523e701b1adabe273 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 26 Mar 2020 00:47:30 -0400 Subject: [PATCH 109/117] Move Eggman item code to k_collide --- src/info.c | 4 +-- src/k_collide.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++-- src/p_inter.c | 52 -------------------------------------- 3 files changed, 66 insertions(+), 56 deletions(-) diff --git a/src/info.c b/src/info.c index 2c3399608..264fd8778 100644 --- a/src/info.c +++ b/src/info.c @@ -15646,7 +15646,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_cdfm28, // activesound - MF_SPECIAL|MF_BOUNCE|MF_SHOOTABLE|MF_DONTENCOREMAP, // flags + MF_BOUNCE|MF_SHOOTABLE|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -15673,7 +15673,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_None, // activesound - MF_SPECIAL|MF_SHOOTABLE|MF_NOGRAVITY|MF_SCENERY|MF_DONTENCOREMAP, // flags + MF_SHOOTABLE|MF_NOGRAVITY|MF_SCENERY|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, diff --git a/src/k_collide.c b/src/k_collide.c index 8cdbe14f4..f13ba3423 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -197,10 +197,72 @@ boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2) { // Push fakes out of other item boxes if (t2->type == MT_RANDOMITEM || t2->type == MT_EGGMANITEM) + { P_InstaThrust(t1, R_PointToAngle2(t2->x, t2->y, t1->x, t1->y), t2->radius/4); + return true; + } - if (t1->type == MT_EGGMANITEM && t2->player) - P_TouchSpecialThing(t1, t2, false); + if (t2->player) + { + if ((t1->target == t2 || t1->target == t2->target) && (t1->threshold > 0)) + return true; + + if (t1->health <= 0 || t2->health <= 0) + return true; + + if (!P_CanPickupItem(t2->player, 2)) + return true; + + if (G_BattleGametype() && t2->player->kartstuff[k_bumper] <= 0) + { + if (t2->player->kartstuff[k_comebackmode] || t2->player->kartstuff[k_comebacktimer]) + return true; + t2->player->kartstuff[k_comebackmode] = 2; + } + else + { + K_DropItems(t2->player); //K_StripItems(t2->player); + //K_StripOther(t2->player); + t2->player->kartstuff[k_itemroulette] = 1; + t2->player->kartstuff[k_roulettetype] = 2; + } + + if (t2->player->kartstuff[k_flamedash] && t2->player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) + { + // Melt item + S_StartSound(t2, sfx_s3k43); + P_KillMobj(t1, t2, t2); + return true; + } + else + { + mobj_t *poof = P_SpawnMobj(t1->x, t1->y, t1->z, MT_EXPLODE); + S_StartSound(poof, t1->info->deathsound); + +#if 0 + // Eggbox snipe! + if (t1->type == MT_EGGMANITEM && t1->health > 1) + S_StartSound(t2, sfx_bsnipe); +#endif + + if (t1->target && t1->target->player) + { + if (G_RaceGametype() || t1->target->player->kartstuff[k_bumper] > 0) + t2->player->kartstuff[k_eggmanblame] = t1->target->player-players; + else + t2->player->kartstuff[k_eggmanblame] = t2->player-players; + + if (t1->target->hnext == t1) + { + P_SetTarget(&t1->target->hnext, NULL); + t1->target->player->kartstuff[k_eggmanheld] = 0; + } + } + + P_RemoveMobj(t1); + return true; + } + } return true; } diff --git a/src/p_inter.c b/src/p_inter.c index 6d1051e82..2c8324972 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -386,58 +386,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_SetTarget(&special->target, toucher); P_KillMobj(special, toucher, toucher); break; - case MT_EGGMANITEM_SHIELD: // SRB2kart - case MT_EGGMANITEM: - if ((special->target == toucher || special->target == toucher->target) && (special->threshold > 0)) - return; - - if (special->health <= 0 || toucher->health <= 0) - return; - - if (!P_CanPickupItem(player, 2)) - return; - - if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) - { - if (player->kartstuff[k_comebackmode] || player->kartstuff[k_comebacktimer]) - return; - player->kartstuff[k_comebackmode] = 2; - } - else - { - K_DropItems(player); //K_StripItems(player); - //K_StripOther(player); - player->kartstuff[k_itemroulette] = 1; - player->kartstuff[k_roulettetype] = 2; - } - -#if 0 - // Eggbox snipe! - if (special->type == MT_EGGMANITEM && special->health > 1) - S_StartSound(toucher, sfx_bsnipe); -#endif - - { - mobj_t *poof = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE); - S_StartSound(poof, special->info->deathsound); - } - - if (special->target && special->target->player) - { - if (G_RaceGametype() || special->target->player->kartstuff[k_bumper] > 0) - player->kartstuff[k_eggmanblame] = special->target->player-players; - else - player->kartstuff[k_eggmanblame] = player-players; - - if (special->target->hnext == special) - { - P_SetTarget(&special->target->hnext, NULL); - special->target->player->kartstuff[k_eggmanheld] = 0; - } - } - - P_RemoveMobj(special); - return; case MT_KARMAHITBOX: if (!special->target->player) return; From 4ddf1e4280ae3f8942d40d47bb5ba69f4dc41816 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 26 Mar 2020 01:14:57 -0400 Subject: [PATCH 110/117] Don't allow k_flamedash to damage without flame shield --- src/k_kart.c | 17 +++++++++-------- src/p_map.c | 7 ++++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 0ce0276e3..ddc6121ed 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7716,22 +7716,23 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->kartstuff[k_itemtype] = KITEM_NONE; } + if (K_GetShieldFromItem(player->kartstuff[k_itemtype]) == KSHIELD_NONE) + { + player->kartstuff[k_curshield] = KSHIELD_NONE; // RESET shield type + player->kartstuff[k_bubbleblowup] = 0; + player->kartstuff[k_bubblecool] = 0; + player->kartstuff[k_flamelength] = 0; + player->kartstuff[k_flamemeter] = 0; + } + if (spbplace == -1 || player->kartstuff[k_position] != spbplace) player->kartstuff[k_ringlock] = 0; // reset ring lock - if (K_GetShieldFromItem(player->kartstuff[k_itemtype]) == KSHIELD_NONE) - player->kartstuff[k_curshield] = KSHIELD_NONE; // RESET shield type - if (player->kartstuff[k_itemtype] == KITEM_SPB || player->kartstuff[k_itemtype] == KITEM_SHRINK || player->kartstuff[k_growshrinktimer] < 0) indirectitemcooldown = 20*TICRATE; - if (player->kartstuff[k_itemtype] != KITEM_FLAMESHIELD) - { - player->kartstuff[k_flamelength] = 0; - } - if (player->kartstuff[k_hyudorotimer] > 0) { if (splitscreen) diff --git a/src/p_map.c b/src/p_map.c index 262017570..6b54f956d 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1416,7 +1416,6 @@ 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)) { - if (tmthing->scale > thing->scale + (mapobjectscale/8)) // SRB2kart - Handle squishes first! K_SquishPlayer(thing->player, tmthing, tmthing); else if (thing->scale > tmthing->scale + (mapobjectscale/8)) @@ -1425,9 +1424,11 @@ static boolean PIT_CheckThing(mobj_t *thing) P_DamageMobj(thing, tmthing, tmthing, 1); else if (thing->player->kartstuff[k_invincibilitytimer] && !tmthing->player->kartstuff[k_invincibilitytimer]) P_DamageMobj(tmthing, thing, thing, 1); - else if (tmthing->player->kartstuff[k_flamedash] && !thing->player->kartstuff[k_flamedash]) // SRB2kart - Then flame shield! + else if ((tmthing->player->kartstuff[k_flamedash] && tmthing->player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) + && !(thing->player->kartstuff[k_flamedash] && thing->player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD)) // SRB2kart - Then flame shield! P_DamageMobj(thing, tmthing, tmthing, 1); - else if (thing->player->kartstuff[k_flamedash] && !tmthing->player->kartstuff[k_flamedash]) + else if ((thing->player->kartstuff[k_flamedash] && thing->player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) + && !(tmthing->player->kartstuff[k_flamedash] && tmthing->player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD)) // SRB2kart - Then flame shield! P_DamageMobj(tmthing, thing, thing, 1); /*if (G_BattleGametype() && (!G_GametypeHasTeams() || tmthing->player->ctfteam != thing->player->ctfteam)) From bf221c7afa575a0c089dde0d859a12b374df6fde Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 26 Mar 2020 01:16:04 -0400 Subject: [PATCH 111/117] Another bugfix for hyu stuff --- src/k_kart.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index ddc6121ed..8d15067f1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7735,6 +7735,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_hyudorotimer] > 0) { + INT32 hyu = hyudorotime; + + if (G_RaceGametype()) + hyu *= 2; // double in race + if (splitscreen) { if (leveltime & 1) @@ -7742,7 +7747,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else player->mo->flags2 &= ~MF2_DONTDRAW; - if (player->kartstuff[k_hyudorotimer] >= (TICRATE/2) && player->kartstuff[k_hyudorotimer] <= hyudorotime-(TICRATE/2)) + if (player->kartstuff[k_hyudorotimer] >= (TICRATE/2) && player->kartstuff[k_hyudorotimer] <= hyu-(TICRATE/2)) { if (player == &players[displayplayers[1]]) player->mo->eflags |= MFE_DRAWONLYFORP2; @@ -7761,7 +7766,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else { if (P_IsDisplayPlayer(player) - || (!P_IsDisplayPlayer(player) && (player->kartstuff[k_hyudorotimer] < (TICRATE/2) || player->kartstuff[k_hyudorotimer] > hyudorotime-(TICRATE/2)))) + || (!P_IsDisplayPlayer(player) && (player->kartstuff[k_hyudorotimer] < (TICRATE/2) || player->kartstuff[k_hyudorotimer] > hyu-(TICRATE/2)))) { if (leveltime & 1) player->mo->flags2 |= MF2_DONTDRAW; From 7ec398e579cde8d729c7fb6095f416cf10f7c77d Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 26 Mar 2020 03:13:10 -0400 Subject: [PATCH 112/117] Slow down animation speed, fix meter bugs --- src/dehacked.c | 1 + src/info.c | 45 ++++++++++++++++++++++++++++++++++++--------- src/info.h | 1 + src/k_kart.c | 28 +++++++++++++--------------- src/p_enemy.c | 5 ++++- src/p_mobj.c | 24 ++++++++++++++++++++++++ 6 files changed, 79 insertions(+), 25 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index da740a7a9..bf12bcb86 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7872,6 +7872,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_THUNDERSHIELD", // Shields "MT_BUBBLESHIELD", "MT_FLAMESHIELD", + "MT_FLAMESHIELDPAPER", "MT_BUBBLESHIELDTRAP", "MT_SINK", // Kitchen Sink Stuff diff --git a/src/info.c b/src/info.c index 264fd8778..179d6e584 100644 --- a/src/info.c +++ b/src/info.c @@ -2919,16 +2919,16 @@ state_t states[NUMSTATES] = {SPR_FLMS, FF_FULLBRIGHT|8, 2, {NULL}, 0, 0, S_FLAMESHIELD18}, // S_FLAMESHIELD17 {SPR_FLMS, FF_FULLBRIGHT|17, 2, {NULL}, 0, 0, S_FLAMESHIELD1}, // S_FLAMESHIELD18 - {SPR_FLMD, FF_FULLBRIGHT|1, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH2}, // S_FLAMESHIELDDASH1 - {SPR_FLMD, FF_FULLBRIGHT, 1, {A_FlameShieldPaper}, 0, 2, S_FLAMESHIELDDASH3}, // S_FLAMESHIELDDASH2 - {SPR_FLMD, FF_FULLBRIGHT|2, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH4}, // S_FLAMESHIELDDASH3 - {SPR_FLMD, FF_FULLBRIGHT, 1, {A_FlameShieldPaper}, 1, 3, S_FLAMESHIELDDASH5}, // S_FLAMESHIELDDASH4 - {SPR_FLMD, FF_FULLBRIGHT|3, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH6}, // S_FLAMESHIELDDASH5 - {SPR_FLMD, FF_FULLBRIGHT, 1, {A_FlameShieldPaper}, 2, 0, S_FLAMESHIELDDASH7}, // S_FLAMESHIELDDASH6 - {SPR_FLMD, FF_FULLBRIGHT|4, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH8}, // S_FLAMESHIELDDASH7 - {SPR_FLMD, FF_FULLBRIGHT, 1, {A_FlameShieldPaper}, 3, 1, S_FLAMESHIELDDASH1}, // S_FLAMESHIELDDASH8 + {SPR_FLMD, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_FLAMESHIELDDASH2}, // S_FLAMESHIELDDASH1 + {SPR_FLMD, FF_FULLBRIGHT, 2, {A_FlameShieldPaper}, 0, 2, S_FLAMESHIELDDASH3}, // S_FLAMESHIELDDASH2 + {SPR_FLMD, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_FLAMESHIELDDASH4}, // S_FLAMESHIELDDASH3 + {SPR_FLMD, FF_FULLBRIGHT, 2, {A_FlameShieldPaper}, 1, 3, S_FLAMESHIELDDASH5}, // S_FLAMESHIELDDASH4 + {SPR_FLMD, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_FLAMESHIELDDASH6}, // S_FLAMESHIELDDASH5 + {SPR_FLMD, FF_FULLBRIGHT, 2, {A_FlameShieldPaper}, 2, 0, S_FLAMESHIELDDASH7}, // S_FLAMESHIELDDASH6 + {SPR_FLMD, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_FLAMESHIELDDASH8}, // S_FLAMESHIELDDASH7 + {SPR_FLMD, FF_FULLBRIGHT, 2, {A_FlameShieldPaper}, 3, 1, S_FLAMESHIELDDASH1}, // S_FLAMESHIELDDASH8 - {SPR_FLMP, FF_FULLBRIGHT|FF_PAPERSPRITE, 2, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDPAPER + {SPR_FLMP, FF_FULLBRIGHT|FF_PAPERSPRITE, 3, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDPAPER {SPR_SINK, 0, 1, {A_SmokeTrailer}, MT_SINKTRAIL, 0, S_SINK}, // S_SINK {SPR_SINK, 0|FF_TRANS80|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_SINK_SHIELD}, // S_SINK_SHIELD @@ -16271,6 +16271,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_FLAMESHIELDPAPER + -1, // doomednum + S_FLAMESHIELDPAPER, // 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 + 0, // speed + 8<kartstuff[k_flamelength] * (TICRATE/4); if (flamemax > 0) - flamemax += (TICRATE/2); + flamemax += 3*(TICRATE/4); if ((cmd->buttons & BT_ATTACK) && player->kartstuff[k_holdready]) { @@ -7636,7 +7636,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) flamemax = player->kartstuff[k_flamelength] * (TICRATE/4); if (flamemax > 0) - flamemax += (TICRATE/2); + flamemax += 3*(TICRATE/4); } if (player->kartstuff[k_flamemeter] > flamemax) @@ -9067,14 +9067,17 @@ static void K_drawKartItem(void) if (stplyr->kartstuff[k_eggmanexplode] > 1 /*&& stplyr->kartstuff[k_eggmanexplode] <= 3*TICRATE*/) V_DrawScaledPatch(fx+17, fy+13-offset, V_HUDTRANS|fflags, kp_eggnum[min(3, G_TicsToSeconds(stplyr->kartstuff[k_eggmanexplode]))]); - if (stplyr->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) + if (stplyr->kartstuff[k_itemtype] == KITEM_FLAMESHIELD && stplyr->kartstuff[k_flamelength] > 0) { INT32 numframes = 104; INT32 absolutemax = 16 * (TICRATE/4); INT32 flamemax = stplyr->kartstuff[k_flamelength] * (TICRATE/4); - INT32 flen = 1; - INT32 bf = 16 - (flamemax / (TICRATE/4)); - INT32 ff = numframes - ((stplyr->kartstuff[k_flamemeter] * numframes) / absolutemax); + INT32 flamemeter = min(stplyr->kartstuff[k_flamemeter], flamemax); + + INT32 bf = 16 - stplyr->kartstuff[k_flamelength]; + INT32 ff = numframes - ((flamemeter * numframes) / absolutemax); + INT32 fmin = (8 * (bf-1)); + INT32 xo = 6, yo = 4; INT32 flip = 0; @@ -9089,18 +9092,13 @@ static void K_drawKartItem(void) } } - if (stplyr->kartstuff[k_flamelength] > 0) - { - flen = (numframes * 16) / stplyr->kartstuff[k_flamelength]; - } + if (ff < fmin) + ff = fmin; - if (ff < 0) {ff = 0;} - if (ff > flen-1) {ff = flen-1;} - - if (flamemax > 0) + if (bf >= 0 && bf < 16) V_DrawScaledPatch(fx-xo, fy-yo, V_HUDTRANS|fflags|flip, kp_flameshieldmeter_bg[bf][offset]); - if (stplyr->kartstuff[k_flamemeter] > 0) + if (ff >= 0 && ff < numframes && stplyr->kartstuff[k_flamemeter] > 0) { if (stplyr->kartstuff[k_flamemeter] > (flamemax - (TICRATE/4)) && (leveltime & 1)) { diff --git a/src/p_enemy.c b/src/p_enemy.c index d2931d17e..290b49c52 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -9350,8 +9350,9 @@ void A_FlameShieldPaper(mobj_t *actor) INT32 perpendicular = ((i & 1) ? -ANGLE_90 : ANGLE_90); fixed_t newx = actor->x + P_ReturnThrustX(NULL, actor->angle + perpendicular, 8*actor->scale); fixed_t newy = actor->y + P_ReturnThrustY(NULL, actor->angle + perpendicular, 8*actor->scale); - mobj_t *paper = P_SpawnMobj(newx + actor->momx, newy + actor->momy, actor->z + actor->momz, MT_THOK); + mobj_t *paper = P_SpawnMobj(newx, newy, actor->z, MT_FLAMESHIELDPAPER); + P_SetTarget(&paper->target, actor); P_SetScale(paper, actor->scale); paper->destscale = actor->destscale; @@ -9369,6 +9370,8 @@ void A_FlameShieldPaper(mobj_t *actor) { paper->frame |= framea; } + + paper->extravalue1 = i; } } diff --git a/src/p_mobj.c b/src/p_mobj.c index 773ed3709..d1134257a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8370,6 +8370,30 @@ void P_MobjThinker(mobj_t *mobj) mobj->target->y + FINESINE(mobj->angle >> ANGLETOFINESHIFT), mobj->z + mobj->target->height * P_MobjFlip(mobj)); break; + case MT_FLAMESHIELDPAPER: + if (!mobj->target || P_MobjWasRemoved(mobj->target)) + { + P_RemoveMobj(mobj); + return; + } + + mobj->z = mobj->target->z; + + K_MatchGenericExtraFlags(mobj, mobj->target); + + { + INT32 perpendicular = ((mobj->extravalue1 & 1) ? -ANGLE_90 : ANGLE_90); + fixed_t newx = mobj->target->x + P_ReturnThrustX(NULL, mobj->target->angle + perpendicular, 8*mobj->target->scale); + fixed_t newy = mobj->target->y + P_ReturnThrustY(NULL, mobj->target->angle + perpendicular, 8*mobj->target->scale); + + P_TeleportMove(mobj, newx, newy, mobj->target->z); + + if (mobj->extravalue1 & 1) + mobj->angle = mobj->target->angle - ANGLE_45; + else + mobj->angle = mobj->target->angle + ANGLE_45; + } + break; case MT_TIREGREASE: if (!mobj->target || P_MobjWasRemoved(mobj->target) || !mobj->target->player || !mobj->target->player->kartstuff[k_tiregrease]) From 8a3c7ad2fbba7c7781a6a9944422a798dfe1b83c Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 26 Mar 2020 03:13:49 -0400 Subject: [PATCH 113/117] Add fire trail to flame shield --- src/p_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 846baee8f..5d2b4fe0c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6134,7 +6134,8 @@ static void P_MovePlayer(player_t *player) //////////////////////////// // SRB2kart - Drifting smoke and fire - if (EITHERSNEAKER(player) && onground && (leveltime & 1)) + if ((EITHERSNEAKER(player) || player->kartstuff[k_flamedash]) + && onground && (leveltime & 1)) K_SpawnBoostTrail(player); if (player->kartstuff[k_invincibilitytimer] > 0) From d1580a5b421583bba3df699b6bf045d0de87495c Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 26 Mar 2020 08:48:02 -0400 Subject: [PATCH 114/117] More Flame Shield visuals --- src/dehacked.c | 4 ++++ src/doomstat.h | 1 + src/g_game.c | 1 + src/info.c | 10 ++++++++-- src/info.h | 6 ++++++ src/k_kart.c | 15 +++++++-------- src/p_mobj.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 70 insertions(+), 10 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index bf12bcb86..7d4aa6c73 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6712,6 +6712,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLAMESHIELDDASH8", "S_FLAMESHIELDPAPER", + "S_FLAMESHIELDLINE1", + "S_FLAMESHIELDLINE2", + "S_FLAMESHIELDLINE3", + "S_FLAMESHIELDFLASH", // The legend "S_SINK", diff --git a/src/doomstat.h b/src/doomstat.h index 62b63dad5..194de85cf 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -458,6 +458,7 @@ extern INT32 greasetics; extern INT32 wipeoutslowtime; extern INT32 wantedreduce; extern INT32 wantedfrequency; +extern INT32 flameseg; extern UINT8 introtoplay; extern UINT8 creditscutscene; diff --git a/src/g_game.c b/src/g_game.c index 0eb457a6a..811063c90 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -232,6 +232,7 @@ INT32 greasetics = 3*TICRATE; INT32 wipeoutslowtime = 20; INT32 wantedreduce = 5*TICRATE; INT32 wantedfrequency = 10*TICRATE; +INT32 flameseg = TICRATE/4; INT32 gameovertics = 15*TICRATE; diff --git a/src/info.c b/src/info.c index 179d6e584..934f509fc 100644 --- a/src/info.c +++ b/src/info.c @@ -58,7 +58,9 @@ char sprnames[NUMSPRITES + 1][5] = //SRB2kart Sprites "RNDM","RPOP","SGNS","FAST","DSHR","BOST","BOSM","KFRE","KINV","KINF", "WIPD","DRIF","BDRF","DUST","DRWS","RSHE","FITM","BANA","ORBN","JAWZ","SSMN", - "KRBM","BHOG","BHBM","SPBM","THNS","BUBS","BWVE","FLMS","FLMD","FLMP","SINK","SITR", + "KRBM","BHOG","BHBM","SPBM","THNS","BUBS","BWVE", + "FLMS","FLMD","FLMP","FLML","FLMF", + "SINK","SITR", "KBLN","DEZL","POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB", "CHOM","SACO","CRAB","BRNG","BUMP","FLEN","CLAS","PSHW","ISTA", "ISTB","ARRO","ITEM","ITMO","ITMI","ITMN","WANT","PBOM","HIT1","HIT2", @@ -2928,7 +2930,11 @@ state_t states[NUMSTATES] = {SPR_FLMD, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_FLAMESHIELDDASH8}, // S_FLAMESHIELDDASH7 {SPR_FLMD, FF_FULLBRIGHT, 2, {A_FlameShieldPaper}, 3, 1, S_FLAMESHIELDDASH1}, // S_FLAMESHIELDDASH8 - {SPR_FLMP, FF_FULLBRIGHT|FF_PAPERSPRITE, 3, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDPAPER + {SPR_FLMP, FF_FULLBRIGHT|FF_PAPERSPRITE, 3, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDPAPER + {SPR_FLML, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, 7, {NULL}, 6, 1, S_NULL}, // S_FLAMESHIELDLINE1 + {SPR_FLML, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE|7, 7, {NULL}, 6, 1, S_NULL}, // S_FLAMESHIELDLINE2 + {SPR_FLML, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE|14, 7, {NULL}, 6, 1, S_NULL}, // S_FLAMESHIELDLINE3 + {SPR_FLMF, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDFLASH {SPR_SINK, 0, 1, {A_SmokeTrailer}, MT_SINKTRAIL, 0, S_SINK}, // S_SINK {SPR_SINK, 0|FF_TRANS80|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_SINK_SHIELD}, // S_SINK_SHIELD diff --git a/src/info.h b/src/info.h index 79d89fd2e..c1ab2528b 100644 --- a/src/info.h +++ b/src/info.h @@ -628,6 +628,8 @@ typedef enum sprite SPR_FLMS, // Flame Shield SPR_FLMD, // Flame Shield dash SPR_FLMP, // Flame Shield paper sprites + SPR_FLML, // Flame Shield speed lines + SPR_FLMF, // Flame Shield flash SPR_SINK, // Kitchen Sink SPR_SITR, // Kitchen Sink Trail SPR_KBLN, // Battle Mode Bumper @@ -3609,6 +3611,10 @@ typedef enum state S_FLAMESHIELDDASH8, S_FLAMESHIELDPAPER, + S_FLAMESHIELDLINE1, + S_FLAMESHIELDLINE2, + S_FLAMESHIELDLINE3, + S_FLAMESHIELDFLASH, // The legend S_SINK, diff --git a/src/k_kart.c b/src/k_kart.c index 88c94a333..81c139ce6 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7583,10 +7583,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_flamelength] < destlen) player->kartstuff[k_flamelength]++; // Can always go up! - flamemax = player->kartstuff[k_flamelength] * (TICRATE/4); - + flamemax = player->kartstuff[k_flamelength] * flameseg; if (flamemax > 0) - flamemax += 3*(TICRATE/4); + flamemax += TICRATE; // leniency period if ((cmd->buttons & BT_ATTACK) && player->kartstuff[k_holdready]) { @@ -7634,9 +7633,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { player->kartstuff[k_flamelength]--; // Can ONLY go down if you're not using it - flamemax = player->kartstuff[k_flamelength] * (TICRATE/4); + flamemax = player->kartstuff[k_flamelength] * flameseg; if (flamemax > 0) - flamemax += 3*(TICRATE/4); + flamemax += TICRATE; // leniency period } if (player->kartstuff[k_flamemeter] > flamemax) @@ -9070,8 +9069,8 @@ static void K_drawKartItem(void) if (stplyr->kartstuff[k_itemtype] == KITEM_FLAMESHIELD && stplyr->kartstuff[k_flamelength] > 0) { INT32 numframes = 104; - INT32 absolutemax = 16 * (TICRATE/4); - INT32 flamemax = stplyr->kartstuff[k_flamelength] * (TICRATE/4); + INT32 absolutemax = 16 * flameseg; + INT32 flamemax = stplyr->kartstuff[k_flamelength] * flameseg; INT32 flamemeter = min(stplyr->kartstuff[k_flamemeter], flamemax); INT32 bf = 16 - stplyr->kartstuff[k_flamelength]; @@ -9100,7 +9099,7 @@ static void K_drawKartItem(void) if (ff >= 0 && ff < numframes && stplyr->kartstuff[k_flamemeter] > 0) { - if (stplyr->kartstuff[k_flamemeter] > (flamemax - (TICRATE/4)) && (leveltime & 1)) + if ((stplyr->kartstuff[k_flamemeter] > flamemax) && (leveltime & 1)) { UINT8 *fsflash = R_GetTranslationColormap(TC_BLINK, SKINCOLOR_WHITE, GTC_CACHE); V_DrawMappedPatch(fx-xo, fy-yo, V_HUDTRANS|fflags|flip, kp_flameshieldmeter[ff][offset], fsflash); diff --git a/src/p_mobj.c b/src/p_mobj.c index d1134257a..06cdfa4b8 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8614,6 +8614,7 @@ void P_MobjThinker(mobj_t *mobj) { fixed_t destx, desty; statenum_t curstate; + INT32 flamemax = mobj->target->player->kartstuff[k_flamelength] * flameseg; if (!mobj->target || !mobj->target->health || !mobj->target->player || mobj->target->player->kartstuff[k_curshield] != KSHIELD_FLAME) @@ -8629,6 +8630,31 @@ void P_MobjThinker(mobj_t *mobj) { if (!(curstate >= S_FLAMESHIELDDASH1 && curstate <= S_FLAMESHIELDDASH8)) P_SetMobjState(mobj, S_FLAMESHIELDDASH1); + + if (leveltime & 1) + { + UINT8 i; + UINT8 nl = 2; + + if (mobj->target->player->kartstuff[k_flamedash] > mobj->extravalue1) + nl = 3; + + for (i = 0; i < nl; i++) + { + mobj_t *fast = P_SpawnMobj(mobj->x + (P_RandomRange(-36,36) * mobj->scale), + mobj->y + (P_RandomRange(-36,36) * mobj->scale), + mobj->z + (mobj->height/2) + (P_RandomRange(-20,20) * mobj->scale), + MT_FASTLINE); + + fast->angle = mobj->angle; + fast->momx = 3*mobj->target->momx/4; + fast->momy = 3*mobj->target->momy/4; + fast->momz = 3*mobj->target->momz/4; + + K_MatchGenericExtraFlags(fast, mobj); + P_SetMobjState(fast, S_FLAMESHIELDLINE1 + i); + } + } } else { @@ -8636,6 +8662,23 @@ void P_MobjThinker(mobj_t *mobj) P_SetMobjState(mobj, S_FLAMESHIELD1); } + mobj->extravalue1 = mobj->target->player->kartstuff[k_flamedash]; + + if (mobj->target->player->kartstuff[k_flamemeter] > flamemax) + { + mobj_t *flash = P_SpawnMobj(mobj->x + mobj->target->momx, mobj->y + mobj->target->momy, mobj->z + mobj->target->momz, MT_THOK); + P_SetMobjState(flash, S_FLAMESHIELDFLASH); + + if (leveltime & 1) + { + flash->frame |= 2 + ((leveltime / 2) % 4); + } + else + { + flash->frame |= ((leveltime / 2) % 2); + } + } + if (!splitscreen /*&& rendermode != render_soft*/) { angle_t viewingangle; From 2ca00cf2e96c3f964cdf5f50e624734c4d75d746 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sat, 28 Mar 2020 00:21:41 -0400 Subject: [PATCH 115/117] Try to prevent bubble from going out of bounds --- src/p_inter.c | 2 -- src/p_mobj.c | 38 +++++++++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 2c8324972..43544447e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -637,8 +637,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // attach to player! P_SetTarget(&special->tracer, toucher); toucher->flags |= MF_NOGRAVITY; - toucher->momx = (15*toucher->momx)/16; // Huge initial speed cut - toucher->momy = (15*toucher->momy)/16; toucher->momz = (8*toucher->scale) * P_MobjFlip(toucher); S_StartSound(toucher, sfx_s1b2); return; diff --git a/src/p_mobj.c b/src/p_mobj.c index 06cdfa4b8..a3b526b7c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9454,6 +9454,8 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->tracer && !P_MobjWasRemoved(mobj->tracer) && mobj->tracer->player) { player_t *player = mobj->tracer->player; + fixed_t destx, desty, curfz, destfz; + boolean blockmove = false; mobj->flags = MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOCLIPTHING|MF_NOGRAVITY|MF_DONTENCOREMAP; mobj->extravalue1 = 1; @@ -9462,16 +9464,38 @@ void P_MobjThinker(mobj_t *mobj) mobj->momz = 0; mobj->destscale = ((5*mobj->tracer->scale)>>2) + (mobj->tracer->scale>>3); - mobj->tracer->momx = (63*mobj->tracer->momx)/64; - mobj->tracer->momy = (63*mobj->tracer->momy)/64; mobj->tracer->momz = (8*mobj->tracer->scale) * P_MobjFlip(mobj->tracer); - P_TeleportMove(mobj, - mobj->tracer->x + mobj->tracer->momx + P_ReturnThrustX(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->y + mobj->tracer->momy + P_ReturnThrustY(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->z + mobj->tracer->momz - (4*mobj->tracer->scale) + (P_RandomRange(-abs(mobj->cvmem), abs(mobj->cvmem))<tracer->momx = (31*mobj->tracer->momx)/32; + mobj->tracer->momy = (31*mobj->tracer->momy)/32; - if (mobj->movecount > 8*TICRATE) + destx = mobj->x + mobj->tracer->momx; + desty = mobj->y + mobj->tracer->momy; + + if (mobj->tracer->eflags & MFE_VERTICALFLIP) + { + curfz = P_GetCeilingZ(mobj->tracer, mobj->tracer->subsector->sector, mobj->tracer->x, mobj->tracer->y, NULL); + destfz = P_GetCeilingZ(mobj->tracer, R_PointInSubsector(destx, desty)->sector, destx, desty, NULL); + blockmove = (curfz - destfz >= 24*mobj->scale); + } + else + { + curfz = P_GetFloorZ(mobj->tracer, mobj->tracer->subsector->sector, mobj->tracer->x, mobj->tracer->y, NULL); + destfz = P_GetFloorZ(mobj->tracer, R_PointInSubsector(destx, desty)->sector, destx, desty, NULL); + blockmove = (destfz - curfz >= 24*mobj->scale); + } + + if (blockmove) + { + mobj->tracer->momx = mobj->tracer->momy = 0; + } + + P_TeleportMove(mobj, + mobj->tracer->x + P_ReturnThrustX(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->y + P_ReturnThrustY(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<tracer->z - (4*mobj->tracer->scale) + (P_RandomRange(-abs(mobj->cvmem), abs(mobj->cvmem))<movecount > 4*TICRATE) { S_StartSound(mobj->tracer, sfx_s3k77); mobj->tracer->flags &= ~MF_NOGRAVITY; From bee6bbf619de1f725184d23a4522f8cc80135274 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sat, 28 Mar 2020 03:56:39 -0400 Subject: [PATCH 116/117] Firework frames for fire shield --- src/dehacked.c | 10 ++++++++++ src/info.c | 54 +++++++++++++++++++++++++++++++++++++++++--------- src/info.h | 10 ++++++++++ src/p_mobj.c | 21 ++++++++++++++++++-- 4 files changed, 84 insertions(+), 11 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 247101a80..e2a95eb83 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6710,6 +6710,15 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLAMESHIELDDASH6", "S_FLAMESHIELDDASH7", "S_FLAMESHIELDDASH8", + "S_FLAMESHIELDDASH9", + "S_FLAMESHIELDDASH10", + "S_FLAMESHIELDDASH11", + "S_FLAMESHIELDDASH12", + + "S_FLAMESHIELDDASH2_UNDERLAY", + "S_FLAMESHIELDDASH5_UNDERLAY", + "S_FLAMESHIELDDASH8_UNDERLAY", + "S_FLAMESHIELDDASH11_UNDERLAY", "S_FLAMESHIELDPAPER", "S_FLAMESHIELDLINE1", @@ -7876,6 +7885,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_THUNDERSHIELD", // Shields "MT_BUBBLESHIELD", "MT_FLAMESHIELD", + "MT_FLAMESHIELDUNDERLAY", "MT_FLAMESHIELDPAPER", "MT_BUBBLESHIELDTRAP", diff --git a/src/info.c b/src/info.c index 934f509fc..33e1622b2 100644 --- a/src/info.c +++ b/src/info.c @@ -2921,14 +2921,23 @@ state_t states[NUMSTATES] = {SPR_FLMS, FF_FULLBRIGHT|8, 2, {NULL}, 0, 0, S_FLAMESHIELD18}, // S_FLAMESHIELD17 {SPR_FLMS, FF_FULLBRIGHT|17, 2, {NULL}, 0, 0, S_FLAMESHIELD1}, // S_FLAMESHIELD18 - {SPR_FLMD, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_FLAMESHIELDDASH2}, // S_FLAMESHIELDDASH1 - {SPR_FLMD, FF_FULLBRIGHT, 2, {A_FlameShieldPaper}, 0, 2, S_FLAMESHIELDDASH3}, // S_FLAMESHIELDDASH2 - {SPR_FLMD, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_FLAMESHIELDDASH4}, // S_FLAMESHIELDDASH3 - {SPR_FLMD, FF_FULLBRIGHT, 2, {A_FlameShieldPaper}, 1, 3, S_FLAMESHIELDDASH5}, // S_FLAMESHIELDDASH4 - {SPR_FLMD, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_FLAMESHIELDDASH6}, // S_FLAMESHIELDDASH5 - {SPR_FLMD, FF_FULLBRIGHT, 2, {A_FlameShieldPaper}, 2, 0, S_FLAMESHIELDDASH7}, // S_FLAMESHIELDDASH6 - {SPR_FLMD, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_FLAMESHIELDDASH8}, // S_FLAMESHIELDDASH7 - {SPR_FLMD, FF_FULLBRIGHT, 2, {A_FlameShieldPaper}, 3, 1, S_FLAMESHIELDDASH1}, // S_FLAMESHIELDDASH8 + {SPR_FLMD, FF_FULLBRIGHT|1, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH2}, // S_FLAMESHIELDDASH1 + {SPR_FLMD, FF_FULLBRIGHT|5, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH3}, // S_FLAMESHIELDDASH2 + {SPR_FLMD, FF_FULLBRIGHT, 1, {A_FlameShieldPaper}, 0, 2, S_FLAMESHIELDDASH4}, // S_FLAMESHIELDDASH3 + {SPR_FLMD, FF_FULLBRIGHT|2, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH5}, // S_FLAMESHIELDDASH4 + {SPR_FLMD, FF_FULLBRIGHT|6, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH6}, // S_FLAMESHIELDDASH5 + {SPR_FLMD, FF_FULLBRIGHT, 1, {A_FlameShieldPaper}, 1, 3, S_FLAMESHIELDDASH7}, // S_FLAMESHIELDDASH6 + {SPR_FLMD, FF_FULLBRIGHT|3, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH8}, // S_FLAMESHIELDDASH7 + {SPR_FLMD, FF_FULLBRIGHT|7, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH9}, // S_FLAMESHIELDDASH8 + {SPR_FLMD, FF_FULLBRIGHT, 1, {A_FlameShieldPaper}, 2, 0, S_FLAMESHIELDDASH10}, // S_FLAMESHIELDDASH9 + {SPR_FLMD, FF_FULLBRIGHT|4, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH11}, // S_FLAMESHIELDDASH10 + {SPR_FLMD, FF_FULLBRIGHT|8, 1, {NULL}, 0, 0, S_FLAMESHIELDDASH12}, // S_FLAMESHIELDDASH11 + {SPR_FLMD, FF_FULLBRIGHT, 1, {A_FlameShieldPaper}, 3, 1, S_FLAMESHIELDDASH1}, // S_FLAMESHIELDDASH12 + + {SPR_FLMD, FF_FULLBRIGHT|9, 2, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDDASH2_UNDERLAY + {SPR_FLMD, FF_FULLBRIGHT|10, 2, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDDASH5_UNDERLAY + {SPR_FLMD, FF_FULLBRIGHT|11, 2, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDDASH8_UNDERLAY + {SPR_FLMD, FF_FULLBRIGHT|12, 2, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDDASH11_UNDERLAY {SPR_FLMP, FF_FULLBRIGHT|FF_PAPERSPRITE, 3, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDPAPER {SPR_FLML, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, 7, {NULL}, 6, 1, S_NULL}, // S_FLAMESHIELDLINE1 @@ -16277,6 +16286,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_FLAMESHIELDUNDERLAY + -1, // doomednum + S_FLAMESHIELDDASH2_UNDERLAY, // 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 + 0, // speed + 8<target->player->kartstuff[k_flamelength] * flameseg; if (!mobj->target || !mobj->target->health || !mobj->target->player @@ -8666,9 +8667,18 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->target->player->kartstuff[k_flamedash]) { - if (!(curstate >= S_FLAMESHIELDDASH1 && curstate <= S_FLAMESHIELDDASH8)) + if (!(curstate >= S_FLAMESHIELDDASH1 && curstate <= S_FLAMESHIELDDASH12)) P_SetMobjState(mobj, S_FLAMESHIELDDASH1); + if (curstate == S_FLAMESHIELDDASH2) + underlayst = S_FLAMESHIELDDASH2_UNDERLAY; + else if (curstate == S_FLAMESHIELDDASH5) + underlayst = S_FLAMESHIELDDASH5_UNDERLAY; + else if (curstate == S_FLAMESHIELDDASH8) + underlayst = S_FLAMESHIELDDASH8_UNDERLAY; + else if (curstate == S_FLAMESHIELDDASH11) + underlayst = S_FLAMESHIELDDASH11_UNDERLAY; + if (leveltime & 1) { UINT8 i; @@ -8696,7 +8706,7 @@ void P_MobjThinker(mobj_t *mobj) } else { - if (curstate >= S_FLAMESHIELDDASH1 && curstate <= S_FLAMESHIELDDASH8) + if (curstate >= S_FLAMESHIELDDASH1 && curstate <= S_FLAMESHIELDDASH12) P_SetMobjState(mobj, S_FLAMESHIELD1); } @@ -8745,6 +8755,13 @@ void P_MobjThinker(mobj_t *mobj) mobj->angle = R_PointToAngle2(0, 0, mobj->target->momx, mobj->target->momy); else mobj->angle = mobj->target->angle; + + if (underlayst != S_NULL) + { + mobj_t *underlay = P_SpawnMobj(mobj->target->x, mobj->target->y, mobj->target->z, MT_FLAMESHIELDUNDERLAY); + underlay->angle = mobj->angle; + P_SetMobjState(underlay, underlayst); + } break; } case MT_ROCKETSNEAKER: From 9a8e3aecd9fa4482ffb201bd4e3ec0e17681f2c0 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sat, 28 Mar 2020 06:19:25 -0400 Subject: [PATCH 117/117] Fix papersprite appearing on wrong frames --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 33e1622b2..981773387 100644 --- a/src/info.c +++ b/src/info.c @@ -2939,7 +2939,7 @@ state_t states[NUMSTATES] = {SPR_FLMD, FF_FULLBRIGHT|11, 2, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDDASH8_UNDERLAY {SPR_FLMD, FF_FULLBRIGHT|12, 2, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDDASH11_UNDERLAY - {SPR_FLMP, FF_FULLBRIGHT|FF_PAPERSPRITE, 3, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDPAPER + {SPR_FLMP, FF_FULLBRIGHT|FF_PAPERSPRITE, 2, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDPAPER {SPR_FLML, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, 7, {NULL}, 6, 1, S_NULL}, // S_FLAMESHIELDLINE1 {SPR_FLML, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE|7, 7, {NULL}, 6, 1, S_NULL}, // S_FLAMESHIELDLINE2 {SPR_FLML, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE|14, 7, {NULL}, 6, 1, S_NULL}, // S_FLAMESHIELDLINE3