From 419b83ee276f95e9bd25d8981e3e3bb200706938 Mon Sep 17 00:00:00 2001 From: Sryder Date: Mon, 12 Mar 2018 00:21:14 +0000 Subject: [PATCH 1/8] Update dehacked lists Why were all of these states and objects missing --- src/dehacked.c | 194 ++++++++++++++++++++++++++++++++++++++++++++++++- src/info.h | 2 + 2 files changed, 195 insertions(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 6d70d327..d1dcf059 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5815,9 +5815,15 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FIREBALL2", "S_FIREBALL3", "S_FIREBALL4", + "S_FIREBALL5", + "S_FIREBALL6", + "S_FIREBALL7", "S_FIREBALLEXP1", "S_FIREBALLEXP2", "S_FIREBALLEXP3", + "S_FIREBALLEXP4", + "S_FIREBALLEXP5", + "S_FIREBALLEXP6", "S_SHELL", "S_SHELL1", "S_SHELL2", @@ -6410,6 +6416,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_BATTLEBALLOON2", "S_BATTLEBALLOON3", + // Lakitu + "S_LAKITU1", + "S_LAKITU2", + // Pokey "S_POKEY1", "S_POKEY2", @@ -6421,6 +6431,130 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_POKEY8", "S_POKEYIDLE", + // Audience Members + "S_RANDOMAUDIENCE", + "S_AUDIENCE_TOAD1", + "S_AUDIENCE_TOAD2", + "S_AUDIENCE_BOO1", + "S_AUDIENCE_BOO2", + "S_AUDIENCE_GMBA1", + "S_AUDIENCE_GMBA2", + "S_AUDIENCE_SHYG1", + "S_AUDIENCE_SHYG2", + "S_AUDIENCE_SNIF1", + "S_AUDIENCE_SNIF2", + + "S_FANCHAR_KOTE", + "S_FANCHAR_RYAN", + "S_FANCHAR_WENDY", + "S_FANCHAR_FREEZOR", + "S_FANCHAR_METALKO", + "S_FANCHAR_BLACKOUT", + "S_FANCHAR_BLADE", + "S_FANCHAR_HINOTE", + + // 1.0 Kart Decoratives + "S_FLAYM1", + "S_FLAYM2", + "S_FLAYM3", + "S_FLAYM4", + "S_DEVIL", + "S_ANGEL", + "S_PALMTREE", + "S_FLAG", + "S_HEDGEHOG", // (Rimshot) + "S_BUSH1", + "S_TWEE", + "S_HYDRANT", + + // New Misc Decorations + "S_BIGPUMA1", + "S_BIGPUMA2", + "S_BIGPUMA3", + "S_BIGPUMA4", + "S_BIGPUMA5", + "S_BIGPUMA6", + "S_APPLE1", + "S_APPLE2", + "S_APPLE3", + "S_APPLE4", + "S_APPLE5", + "S_APPLE6", + "S_APPLE7", + "S_APPLE8", + + // D00Dkart - Fall Flowers + "S_DOOD_FLOWER1", + "S_DOOD_FLOWER2", + "S_DOOD_FLOWER3", + "S_DOOD_FLOWER4", + "S_DOOD_FLOWER5", + "S_DOOD_FLOWER6", + + // D00Dkart - Super Circuit Box + "S_DOOD_BOX1", + "S_DOOD_BOX2", + "S_DOOD_BOX3", + "S_DOOD_BOX4", + "S_DOOD_BOX5", + + // D00Dkart - Diddy Kong Racing Balloon + "S_DOOD_BALLOON", + + // D00Dkart - Big Ring + "S_DOOD_RING1", + "S_DOOD_RING2", + "S_DOOD_RING3", + "S_DOOD_RING4", + "S_DOOD_RING5", + + // SNES Objects + "S_SNES_DONUTBUSH1", + "S_SNES_DONUTBUSH2", + "S_SNES_DONUTBUSH3", + + // GBA Objects + "S_GBA_BOO1", + "S_GBA_BOO2", + "S_GBA_BOO3", + "S_GBA_BOO4", + + // Sapphire Coast Mobs + "S_BUZZBOMBER_LOOK1", + "S_BUZZBOMBER_LOOK2", + "S_BUZZBOMBER_FLY1", + "S_BUZZBOMBER_FLY2", + "S_BUZZBOMBER_FLY3", + "S_BUZZBOMBER_FLY4", + + "S_CHOMPER_SPAWN", + "S_CHOMPER_HOP1", + "S_CHOMPER_HOP2", + "S_CHOMPER_TURNAROUND", + + "S_PALMTREE2", + "S_PURPLEFLOWER1", + "S_PURPLEFLOWER2", + "S_YELLOWFLOWER1", + "S_YELLOWFLOWER2", + "S_PLANT2", + "S_PLANT3", + "S_PLANT4", + + // Crystal Abyss Mobs + "S_SKULL", + "S_PHANTREE", + "S_FLYINGGARG1", + "S_FLYINGGARG2", + "S_FLYINGGARG3", + "S_FLYINGGARG4", + "S_FLYINGGARG5", + "S_FLYINGGARG6", + "S_FLYINGGARG7", + "S_FLYINGGARG8", + "S_LAMPPOST", + "S_MOSSYTREE", + "S_SHADOW", "S_WHITESHADOW", @@ -7032,14 +7166,72 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_LAKITU", "MT_POKEY", // Huh, thought this was a default asset for some reason, guess not. + "MT_ENEMYFLIP", "MT_WAYPOINT", + + "MT_RANDOMAUDIENCE", + "MT_FANCHAR_KOTE", + "MT_FANCHAR_RYAN", + "MT_FANCHAR_WENDY", + "MT_FANCHAR_FREEZOR", + "MT_FANCHAR_METALKO", + "MT_FANCHAR_BLACKOUT", + "MT_FANCHAR_BLADE", + "MT_FANCHAR_HINOTE", + + "MT_FLAYM", + "MT_DEVIL", + "MT_ANGEL", + "MT_PALMTREE", + "MT_FLAG", + "MT_HEDGEHOG", + "MT_BUSH1", + "MT_TWEE", + "MT_HYDRANT", + + "MT_BIGPUMA", + "MT_APPLE", + + "MT_DOOD_FLOWER1", + "MT_DOOD_FLOWER2", + "MT_DOOD_FLOWER3", + "MT_DOOD_FLOWER4", + "MT_DOOD_BOX", + "MT_DOOD_BALLOON", + "MT_DOOD_RING", + + "MT_SNES_DONUTBUSH1", + "MT_SNES_DONUTBUSH2", + "MT_SNES_DONUTBUSH3", + + "MT_GBA_BOO", + + "MT_BUZZBOMBER", + "MT_CHOMPER", + "MT_PALMTREE2", + "MT_PURPLEFLOWER1", + "MT_PURPLEFLOWER2", + "MT_YELLOWFLOWER1", + "MT_YELLOWFLOWER2", + "MT_PLANT2", + "MT_PLANT3", + "MT_PLANT4", + + "MT_SKULL", + "MT_PHANTREE", + "MT_FLYINGGARG", + "MT_LAMPPOST", + "MT_MOSSYTREE", + "MT_SHADOW", "MT_BUMP", + "MT_FLINGENERGY", + "MT_ITEMCLASH", - + "MT_FIREDITEM", "MT_PLAYERARROW", diff --git a/src/info.h b/src/info.h index d7ec70b5..30bc6d5c 100644 --- a/src/info.h +++ b/src/info.h @@ -3386,6 +3386,7 @@ typedef enum state S_FLYINGGARG8, S_LAMPPOST, S_MOSSYTREE, + S_SHADOW, S_WHITESHADOW, @@ -4071,6 +4072,7 @@ typedef enum mobj_type MT_FLYINGGARG, MT_LAMPPOST, MT_MOSSYTREE, + MT_SHADOW, MT_BUMP, From be0e5fe6275dd90447ee2f6b52439798bd6eb8ed Mon Sep 17 00:00:00 2001 From: Sryder Date: Mon, 12 Mar 2018 03:18:45 +0000 Subject: [PATCH 2/8] Comment out calls to CV_SetValue for cv_analog --- src/b_bot.c | 2 +- src/g_game.c | 34 +++++++++++++++++----------------- src/p_map.c | 6 +++--- src/p_setup.c | 12 ++++++------ src/p_user.c | 16 ++++++++-------- src/r_main.c | 16 ++++++++-------- 6 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index de311c0e..ca48a98b 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -121,7 +121,7 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd) } // Bot AI isn't programmed in analog. - CV_SetValue(&cv_analog2, false); + //CV_SetValue(&cv_analog2, false); #ifdef HAVE_BLUA // Let Lua scripts build ticcmds diff --git a/src/g_game.c b/src/g_game.c index 2013d77e..6f627962 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1520,7 +1520,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (!player->powers[pw_tailsfly] && (cmd->forwardmove || cmd->sidemove || cmd->buttons)) { player->bot = 2; // A player-controlled bot. Returns to AI when it respawns. - CV_SetValue(&cv_analog2, true); + //CV_SetValue(&cv_analog2, true); } else { @@ -1616,40 +1616,40 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) // fudging with it. static void UserAnalog_OnChange(void) { - if (cv_useranalog.value) + /*if (cv_useranalog.value) CV_SetValue(&cv_analog, 1); else - CV_SetValue(&cv_analog, 0); + CV_SetValue(&cv_analog, 0);*/ } static void UserAnalog2_OnChange(void) { if (botingame) return; - if (cv_useranalog2.value) + /*if (cv_useranalog2.value) CV_SetValue(&cv_analog2, 1); else - CV_SetValue(&cv_analog2, 0); + CV_SetValue(&cv_analog2, 0);*/ } static void UserAnalog3_OnChange(void) { if (botingame) return; - if (cv_useranalog3.value) + /*if (cv_useranalog3.value) CV_SetValue(&cv_analog3, 1); else - CV_SetValue(&cv_analog3, 0); + CV_SetValue(&cv_analog3, 0);*/ } static void UserAnalog4_OnChange(void) { if (botingame) return; - if (cv_useranalog4.value) + /*if (cv_useranalog4.value) CV_SetValue(&cv_analog4, 1); else - CV_SetValue(&cv_analog4, 0); + CV_SetValue(&cv_analog4, 0);*/ } static void Analog_OnChange(void) @@ -1659,10 +1659,10 @@ static void Analog_OnChange(void) // cameras are not initialized at this point - if (!cv_chasecam.value && cv_analog.value) { + /*if (!cv_chasecam.value && cv_analog.value) { CV_SetValue(&cv_analog, 0); return; - } + }*/ if (cv_analog.value) players[consoleplayer].pflags |= PF_ANALOGMODE; @@ -1679,10 +1679,10 @@ static void Analog2_OnChange(void) // cameras are not initialized at this point - if (!cv_chasecam2.value && cv_analog2.value) { + /*if (!cv_chasecam2.value && cv_analog2.value) { CV_SetValue(&cv_analog2, 0); return; - } + }*/ if (cv_analog2.value) players[secondarydisplayplayer].pflags |= PF_ANALOGMODE; @@ -1699,10 +1699,10 @@ static void Analog3_OnChange(void) // cameras are not initialized at this point - if (!cv_chasecam3.value && cv_analog3.value) { + /*if (!cv_chasecam3.value && cv_analog3.value) { CV_SetValue(&cv_analog3, 0); return; - } + }*/ if (cv_analog3.value) players[thirddisplayplayer].pflags |= PF_ANALOGMODE; @@ -1719,10 +1719,10 @@ static void Analog4_OnChange(void) // cameras are not initialized at this point - if (!cv_chasecam4.value && cv_analog4.value) { + /*if (!cv_chasecam4.value && cv_analog4.value) { CV_SetValue(&cv_analog4, 0); return; - } + }*/ if (cv_analog4.value) players[fourthdisplayplayer].pflags |= PF_ANALOGMODE; diff --git a/src/p_map.c b/src/p_map.c index 15557ed4..15b8f7d8 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -388,7 +388,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails) else { if (sonic-players == consoleplayer && botingame) - CV_SetValue(&cv_analog2, false); + //CV_SetValue(&cv_analog2, false); P_ResetPlayer(sonic); P_SetTarget(&sonic->mo->tracer, tails->mo); sonic->pflags |= PF_CARRIED; @@ -401,7 +401,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails) } else { if (sonic-players == consoleplayer && botingame) - CV_SetValue(&cv_analog2, true); + //CV_SetValue(&cv_analog2, true); sonic->pflags &= ~PF_CARRIED; } } @@ -1593,7 +1593,7 @@ static boolean PIT_CheckThing(mobj_t *thing) } else if (thing->player) { if (thing->player-players == consoleplayer && botingame) - CV_SetValue(&cv_analog2, true); + //CV_SetValue(&cv_analog2, true); thing->player->pflags &= ~PF_CARRIED; }*/ diff --git a/src/p_setup.c b/src/p_setup.c index 7f722548..f3ef207e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2477,7 +2477,7 @@ static void P_LoadRecordGhosts(void) // Guest ghost if (cv_ghost_guest.value && FIL_FileExists(va("%s-guest.lmp", gpath))) G_AddGhost(va("%s-guest.lmp", gpath)); - + // Staff Attack ghosts if (cv_ghost_staff.value) { @@ -2918,7 +2918,7 @@ boolean P_SetupLevel(boolean skipprecip) if (!cv_cam2_height.changed) CV_Set(&cv_cam2_height, cv_cam2_height.defaultvalue); - + if (!cv_cam_dist.changed) CV_Set(&cv_cam_dist, cv_cam_dist.defaultvalue); @@ -2938,14 +2938,14 @@ boolean P_SetupLevel(boolean skipprecip) if (!cv_cam4_rotate.changed) CV_Set(&cv_cam4_rotate, cv_cam4_rotate.defaultvalue); - if (!cv_analog.changed) + /*if (!cv_analog.changed) CV_SetValue(&cv_analog, 0); if (!cv_analog2.changed) CV_SetValue(&cv_analog2, 0); if (!cv_analog3.changed) CV_SetValue(&cv_analog3, 0); if (!cv_analog4.changed) - CV_SetValue(&cv_analog4, 0); + CV_SetValue(&cv_analog4, 0);*/ #ifdef HWRENDER if (rendermode != render_soft && rendermode != render_none) @@ -2955,7 +2955,7 @@ boolean P_SetupLevel(boolean skipprecip) displayplayer = consoleplayer; // Start with your OWN view, please! } - if (cv_useranalog.value) + /*if (cv_useranalog.value) CV_SetValue(&cv_analog, true); if ((splitscreen && cv_useranalog2.value) || botingame) @@ -2973,7 +2973,7 @@ boolean P_SetupLevel(boolean skipprecip) CV_SetValue(&cv_analog3, false); CV_SetValue(&cv_analog2, false); CV_SetValue(&cv_analog, false); - } + }*/ // SRB2Kart: map load variables if (modeattacking) diff --git a/src/p_user.c b/src/p_user.c index 155694fa..19767643 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -889,8 +889,8 @@ void P_ResetPlayer(player_t *player) player->powers[pw_tailsfly] = 0; player->onconveyor = 0; player->skidtime = 0; - if (player-players == consoleplayer && botingame) - CV_SetValue(&cv_analog2, true); + /*if (player-players == consoleplayer && botingame) + CV_SetValue(&cv_analog2, true);*/ } // @@ -3738,8 +3738,8 @@ void P_DoJump(player_t *player, boolean soundandstate) { player->mo->momz = 9*FRACUNIT; player->pflags &= ~PF_CARRIED; - if (player-players == consoleplayer && botingame) - CV_SetValue(&cv_analog2, true); + /*if (player-players == consoleplayer && botingame) + CV_SetValue(&cv_analog2, true);*/ } else if (player->pflags & PF_ITEMHANG) { @@ -8110,7 +8110,7 @@ static void P_DeathThink(player_t *player) curlap = 0; } } - + if ((G_RaceGametype() || (gametype == GT_COOP && (multiplayer || netgame))) && (player->lives <= 0)) { // Return to level music @@ -9137,7 +9137,7 @@ static void P_CalcPostImg(player_t *player) *param = 5; } #endif - + if (mirrormode) // srb2kart *type = postimg_mirror; } @@ -9971,8 +9971,8 @@ void P_PlayerAfterThink(player_t *player) P_SetPlayerMobjState(player->mo, S_PLAY_CARRY); - if (player-players == consoleplayer && botingame) - CV_SetValue(&cv_analog2, !(player->pflags & PF_CARRIED)); + //if (player-players == consoleplayer && botingame) + //CV_SetValue(&cv_analog2, !(player->pflags & PF_CARRIED)); } else if (player->pflags & PF_ITEMHANG && player->mo->tracer) { diff --git a/src/r_main.c b/src/r_main.c index 915bf83c..82b2b6d5 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -234,36 +234,36 @@ void SplitScreen_OnChange(void) static void ChaseCam_OnChange(void) { - if (!cv_chasecam.value || !cv_useranalog.value) + /*if (!cv_chasecam.value || !cv_useranalog.value) CV_SetValue(&cv_analog, 0); else - CV_SetValue(&cv_analog, 1); + CV_SetValue(&cv_analog, 1);*/ } static void ChaseCam2_OnChange(void) { if (botingame) return; - if (!cv_chasecam2.value || !cv_useranalog2.value) + /*if (!cv_chasecam2.value || !cv_useranalog2.value) CV_SetValue(&cv_analog2, 0); else - CV_SetValue(&cv_analog2, 1); + CV_SetValue(&cv_analog2, 1);*/ } static void ChaseCam3_OnChange(void) { - if (!cv_chasecam3.value || !cv_useranalog3.value) + /*if (!cv_chasecam3.value || !cv_useranalog3.value) CV_SetValue(&cv_analog3, 0); else - CV_SetValue(&cv_analog3, 1); + CV_SetValue(&cv_analog3, 1);*/ } static void ChaseCam4_OnChange(void) { - if (!cv_chasecam4.value || !cv_useranalog4.value) + /*if (!cv_chasecam4.value || !cv_useranalog4.value) CV_SetValue(&cv_analog4, 0); else - CV_SetValue(&cv_analog4, 1); + CV_SetValue(&cv_analog4, 1);*/ } static void FlipCam_OnChange(void) From e3de8ae75f865a7a3f0b6ddc3abaa66b37f1a176 Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 13 Mar 2018 02:51:14 +0000 Subject: [PATCH 3/8] Stop touching a random item box crashing debug builds --- src/p_inter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 7d4b70c7..0da3d01a 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1553,8 +1553,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } } - S_StartSound(toucher, special->info->deathsound); // was NULL, but changed to player so you could hear others pick up rings - P_KillMobj(special, NULL, toucher); + if (!P_MobjWasRemoved(special)) + { + S_StartSound(toucher, special->info->deathsound); // was NULL, but changed to player so you could hear others pick up rings + P_KillMobj(special, NULL, toucher); + } } // From 71c1a5b7e2acad1b0d046bdc501dac0daddbce20 Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 13 Mar 2018 02:54:49 +0000 Subject: [PATCH 4/8] Use the constant, not a magic number --- src/p_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_setup.c b/src/p_setup.c index f3ef207e..a38def23 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -991,7 +991,7 @@ static void P_LoadThings(void) || mt->type == 1702) // MT_AXISTRANSFERLINE continue; // These were already spawned - if (mt->type == 2000) // MT_RANDOMITEM + if (mt->type == MT_RANDOMITEM) // MT_RANDOMITEM nummapboxes++; mt->mobj = NULL; From 07c7bc05c5a003ab25ced53f531ec21c6193f2f4 Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 13 Mar 2018 05:20:47 +0000 Subject: [PATCH 5/8] Fix the item box related crashes Removed Magnet item box pulling code. It's a mess, hacky, doesn't really help in races, and breaks things. We will implement something new for it soon. --- src/dehacked.c | 1 - src/info.c | 39 ++++++--------------------------------- src/info.h | 1 - src/k_kart.c | 10 +++++----- src/p_enemy.c | 46 ++++++++++++++++++++++++++-------------------- src/p_floor.c | 2 +- src/p_inter.c | 8 ++------ src/p_mobj.c | 39 ++++++++++++++++++++------------------- src/p_setup.c | 2 +- src/p_user.c | 2 +- 10 files changed, 62 insertions(+), 88 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index d1dcf059..27fa61e7 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7115,7 +7115,6 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_INVISSPRING", "MT_BLUEDIAG", "MT_RANDOMITEM", - "MT_FLINGRANDOMITEM", "MT_RANDOMITEMPOP", "MT_MUSHROOMTRAIL", diff --git a/src/info.c b/src/info.c index 96d34dbf..23bdee72 100644 --- a/src/info.c +++ b/src/info.c @@ -2564,7 +2564,7 @@ state_t states[NUMSTATES] = {SPR_RNDM, 21, 3, {NULL}, 0, 0, S_RANDOMITEM23}, // S_RANDOMITEM22 {SPR_RNDM, 22, 3, {NULL}, 0, 0, S_RANDOMITEM24}, // S_RANDOMITEM23 {SPR_RNDM, 23, 3, {NULL}, 0, 0, S_RANDOMITEM1}, // S_RANDOMITEM24 - {SPR_RNDM, 0, 1, {A_ItemPop}, 0, 0, S_NULL}, // S_DEADRANDOMITEM + {SPR_RNDM, 0, 1, {A_ItemPop}, 0, 0, S_NULL}, // S_DEADRANDOMITEM {SPR_RPOP, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_RANDOMITEMPOP2}, // S_RANDOMITEMPOP1 {SPR_RPOP, FF_FULLBRIGHT|1, 5, {NULL}, 0, 0, S_RANDOMITEMPOP3}, // S_RANDOMITEMPOP2 @@ -14252,7 +14252,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound - MT_FLINGRANDOMITEM, // reactiontime + 0, // reactiontime sfx_None, // attacksound S_NULL, // painstate 0, // painchance @@ -14267,48 +14267,21 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 36*FRACUNIT, // height 0, // display offset 100, // mass - 0, // damage + MT_RANDOMITEMPOP, // damage sfx_None, // activesound MF_SLIDEME|MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT, // flags S_NULL // raisestate }, - { // MT_FLINGRANDOMITEM - -1, // doomednum - S_RANDOMITEM1, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - MT_FLINGRANDOMITEM, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - MT_RANDOMITEM, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_DEADRANDOMITEM, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - 60*FRACUNIT, // speed - 31*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_SLIDEME|MF_SPECIAL, // flags - S_NULL // raisestate - }, - { // MT_RANDOMITEMPOP -1, // doomednum - S_SPRK1, // spawnstate + S_INVISIBLE, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 0, // reactiontime sfx_None, // attacksound - S_SPRK1, // painstate + S_NULL, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate @@ -14320,7 +14293,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 16*FRACUNIT, // radius 32*FRACUNIT, // height 0, // display offset - 100, // mass + MT_SPARK, // mass 0, // damage sfx_None, // activesound MF_NOCLIP, // flags diff --git a/src/info.h b/src/info.h index 30bc6d5c..c8e6758a 100644 --- a/src/info.h +++ b/src/info.h @@ -3964,7 +3964,6 @@ typedef enum mobj_type MT_INVISSPRING, MT_BLUEDIAG, MT_RANDOMITEM, - MT_FLINGRANDOMITEM, MT_RANDOMITEMPOP, MT_MUSHROOMTRAIL, diff --git a/src/k_kart.c b/src/k_kart.c index d1c563a6..8cc8e418 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -587,7 +587,7 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd) && players[i].kartstuff[k_position] < player->kartstuff[k_position]) pdis += P_AproxDistance(P_AproxDistance(players[i].mo->x - player->mo->x, players[i].mo->y - player->mo->y), - players[i].mo->z - player->mo->z) / mapheaderinfo[gamemap-1]->mobj_scale + players[i].mo->z - player->mo->z) / mapheaderinfo[gamemap-1]->mobj_scale * (pingame - players[i].kartstuff[k_position]) / ((pingame - 1) * (pingame + 1) / 3); } @@ -654,7 +654,7 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd) //} /*else if (gametype == GT_NEO) { - + } else CONS_Printf("ERROR: P_KartItemRoulette - There's no applicable game type!\n"); @@ -840,7 +840,7 @@ static void K_UpdateOffroad(player_t *player) offroadstrength = 3; // If you are offroad, a timer starts. Depending on your weight value, the timer increments differently. - //if ((nextsector->special & 256) && nextsector->special != 768 + //if ((nextsector->special & 256) && nextsector->special != 768 // && nextsector->special != 1024 && nextsector->special != 4864) if (offroadstrength) { @@ -4227,7 +4227,7 @@ static void K_DrawKartPositionNum(INT32 num) // Alternate frame every three frames switch (leveltime % 21) { - case 1: case 2: case 3: + case 1: case 2: case 3: localpatch = kp_winnernum[0]; break; case 4: case 5: case 6: @@ -4998,7 +4998,7 @@ void K_drawKartHUD(void) { if (leveltime < 178) K_drawStartLakitu(); - + if (stplyr->kartstuff[k_lapanimation]) K_drawLapLakitu(); diff --git a/src/p_enemy.c b/src/p_enemy.c index 7508b39c..9767edbc 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -740,8 +740,7 @@ static boolean P_LookForShield(mobj_t *actor) (actor->type == MT_BLUETEAMRING && player->ctfteam != 2)) continue; - // SRB2kart - magnet item - if (player->kartstuff[k_magnettimer] //(player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT && (P_AproxDistance(P_AproxDistance(actor->x-player->mo->x, actor->y-player->mo->y), actor->z-player->mo->z) < FixedMul(RING_DIST/4, player->mo->scale))) { P_SetTarget(&actor->tracer, player->mo); @@ -3613,7 +3612,7 @@ void A_AttractChase(mobj_t *actor) // Turn flingrings back into regular rings if attracted. if (actor->tracer && actor->tracer->player - && actor->tracer->player->kartstuff[k_magnettimer] //&& (actor->tracer->player->powers[pw_shield] & SH_NOSTACK) != SH_ATTRACT + && (actor->tracer->player->powers[pw_shield] & SH_NOSTACK) != SH_ATTRACT && actor->info->reactiontime && actor->type != (mobjtype_t)actor->info->reactiontime) { mobj_t *newring; @@ -3627,9 +3626,7 @@ void A_AttractChase(mobj_t *actor) P_LookForShield(actor); // Go find 'em, boy! - if (actor->tracer && actor->tracer->player && actor->tracer->player->kartstuff[k_comebackmode] == 1) - ; - else if (!actor->tracer + if (!actor->tracer || !actor->tracer->player || !actor->tracer->health || !P_CheckSight(actor, actor->tracer)) // You have to be able to SEE it...sorta @@ -8094,6 +8091,7 @@ void A_ToggleFlameJet(mobj_t* actor) void A_ItemPop(mobj_t *actor) { mobj_t *remains; + mobjtype_t explode; #ifdef HAVE_BLUA if (LUA_CallAction("A_ItemPop", actor)) return; @@ -8107,12 +8105,24 @@ void A_ItemPop(mobj_t *actor) } // de-solidify - //P_UnsetThingPosition(actor); - //actor->flags &= ~MF_SOLID; - //actor->flags |= MF_NOCLIP; - //P_SetThingPosition(actor); + P_UnsetThingPosition(actor); + actor->flags &= ~MF_SOLID; + actor->flags |= MF_NOCLIP; + P_SetThingPosition(actor); - remains = P_SpawnMobj(actor->x, actor->y, actor->z, MT_RANDOMITEMPOP); + // item explosion + explode = mobjinfo[actor->info->damage].mass; + remains = P_SpawnMobj(actor->x, actor->y, + ((actor->eflags & MFE_VERTICALFLIP) ? (actor->z + 3*(actor->height/4) - FixedMul(mobjinfo[explode].height, actor->scale)) : (actor->z + actor->height/4)), explode); + if (actor->eflags & MFE_VERTICALFLIP) + { + remains->eflags |= MFE_VERTICALFLIP; + remains->flags2 |= MF2_OBJECTFLIP; + } + remains->destscale = actor->destscale; + P_SetScale(remains, actor->scale); + + remains = P_SpawnMobj(actor->x, actor->y, actor->z, actor->info->damage); remains->type = actor->type; // Transfer type information P_UnsetThingPosition(remains); if (sector_list) @@ -8120,25 +8130,21 @@ void A_ItemPop(mobj_t *actor) P_DelSeclist(sector_list); sector_list = NULL; } - remains->flags = actor->flags; // Transfer flags P_SetThingPosition(remains); + remains->destscale = actor->destscale; + P_SetScale(remains, actor->scale); + remains->flags = actor->flags; // Transfer flags remains->flags2 = actor->flags2; // Transfer flags2 remains->fuse = actor->fuse; // Transfer respawn timer remains->threshold = 68; remains->skin = NULL; + remains->spawnpoint = actor->spawnpoint; - actor->flags2 |= MF2_BOSSNOTRAP; // Dummy flag to mark this as an exploded TV until it respawns - tmthing = remains; + P_SetTarget(&tmthing, remains); if (actor->info->deathsound) S_StartSound(remains, actor->info->deathsound); - if (actor->type != MT_RANDOMITEM) - { - P_RemoveMobj(actor); - return; - } - actor->target->player->kartstuff[k_itemroulette] = 1; remains->flags2 &= ~MF2_AMBUSH; diff --git a/src/p_floor.c b/src/p_floor.c index e761903c..9e37e70f 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1787,7 +1787,7 @@ static mobj_t *SearchMarioNode(msecnode_t *node) break; } // Ignore popped monitors, too. - if (node->m_thing->flags & MF_MONITOR + if (node->m_thing->flags & MF_MONITOR || node->m_thing->type == MT_RANDOMITEM && node->m_thing->threshold == 68) continue; // Okay, we found something valid. diff --git a/src/p_inter.c b/src/p_inter.c index 0da3d01a..e24a3ddf 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -161,9 +161,6 @@ boolean P_CanPickupItem(player_t *player, boolean weapon) if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) // No balloons in Match return false; - if (player->kartstuff[k_magnettimer]) // You should probably collect stuff when you're attracting it :V - return true; - if (player->kartstuff[k_bootaketimer] || player->kartstuff[k_boostolentimer] || player->kartstuff[k_growshrinktimer] > 1 || player->kartstuff[k_goldshroomtimer]) // Item-specific timer going off return false; @@ -417,7 +414,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) switch (special->type) { case MT_RANDOMITEM: // SRB2kart - case MT_FLINGRANDOMITEM: if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) { if (player->kartstuff[k_comebackmode] == 0 && !player->kartstuff[k_comebacktimer]) @@ -450,7 +446,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) special->momx = special->momy = special->momz = 0; P_SetTarget(&special->target, toucher); - P_SetMobjState(special, special->info->deathstate); + P_KillMobj(special, toucher, toucher); break; // ***************************************** // // Rings, coins, spheres, weapon panels, etc // @@ -2128,7 +2124,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) // if killed by a player if (source && source->player) { - if (target->flags & MF_MONITOR) + if (target->flags & MF_MONITOR || target->type == MT_RANDOMITEM) { P_SetTarget(&target->target, source); source->player->numboxes++; diff --git a/src/p_mobj.c b/src/p_mobj.c index 4fa18fdb..7bfd7375 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1371,7 +1371,6 @@ fixed_t P_GetMobjGravity(mobj_t *mo) { case MT_FLINGRING: case MT_FLINGCOIN: - case MT_FLINGRANDOMITEM: // SRB2kart case MT_FLINGEMERALD: case MT_BOUNCERING: case MT_RAILRING: @@ -2357,7 +2356,6 @@ static boolean P_ZMovement(mobj_t *mo) case MT_BLUETEAMRING: case MT_FLINGRING: case MT_FLINGCOIN: - case MT_FLINGRANDOMITEM: case MT_FLINGEMERALD: // Remove flinged stuff from death pits. if (P_CheckDeathPitCollide(mo)) @@ -2550,7 +2548,6 @@ static boolean P_ZMovement(mobj_t *mo) // Flingrings bounce if (mo->type == MT_FLINGRING || mo->type == MT_FLINGCOIN - || mo->type == MT_FLINGRANDOMITEM || P_WeaponOrPanel(mo->type) || mo->type == MT_FLINGEMERALD || mo->type == MT_BIGTUMBLEWEED @@ -5968,9 +5965,6 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y fixed_t ty = dest->y; fixed_t tz = dest->z + (dest->height/2); // Aim for center - if (source->type == MT_RANDOMITEM || source->type == MT_FLINGRANDOMITEM) // SRB2kart - item boxes are sorta tall - tz = dest->z; - if (!dest || dest->health <= 0 || !dest->player || !source->tracer) return; @@ -7696,7 +7690,6 @@ void P_MobjThinker(mobj_t *mobj) case MT_BLUEBALL: case MT_REDTEAMRING: case MT_BLUETEAMRING: - case MT_RANDOMITEM: // No need to check water. Who cares? P_RingThinker(mobj); if (mobj->flags2 & MF2_NIGHTSPULL) @@ -7707,7 +7700,6 @@ void P_MobjThinker(mobj_t *mobj) // Flung items case MT_FLINGRING: case MT_FLINGCOIN: - case MT_FLINGRANDOMITEM: if (mobj->flags2 & MF2_NIGHTSPULL) P_NightsItemChase(mobj); else @@ -8239,6 +8231,20 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s } P_RemoveMobj(mobj); // make sure they disappear return; + case MT_RANDOMITEM: + // Respawn from mapthing if you have one! + if (mobj->spawnpoint) + { + P_SpawnMapThing(mobj->spawnpoint); + newmobj = mobj->spawnpoint->mobj; // this is set to the new mobj in P_SpawnMapThing + } + else + newmobj = P_SpawnMobj(mobj->x, mobj->y, mobj->z, mobj->type); + + // Transfer flags2 (strongbox, objectflip) + newmobj->flags2 = mobj->flags2; + P_RemoveMobj(mobj); // make sure they disappear + return; case MT_METALSONIC_BATTLE: break; // don't remove case MT_SPIKE: @@ -8293,7 +8299,6 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s #ifdef ESLOPE // Sliding physics for slidey mobjs! if (mobj->type == MT_FLINGRING || mobj->type == MT_FLINGCOIN - || mobj->type == MT_FLINGRANDOMITEM || P_WeaponOrPanel(mobj->type) || mobj->type == MT_FLINGEMERALD || mobj->type == MT_BIGTUMBLEWEED @@ -8737,12 +8742,12 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) case MT_BANANAITEM: case MT_BANANASHIELD: case MT_TRIPLEBANANASHIELD1: case MT_TRIPLEBANANASHIELD2: case MT_TRIPLEBANANASHIELD3: case MT_GREENITEM: case MT_GREENSHIELD: - case MT_TRIPLEGREENSHIELD1: case MT_TRIPLEGREENSHIELD2: case MT_TRIPLEGREENSHIELD3: - case MT_REDITEM: case MT_REDSHIELD: case MT_REDITEMDUD: + case MT_TRIPLEGREENSHIELD1: case MT_TRIPLEGREENSHIELD2: case MT_TRIPLEGREENSHIELD3: + case MT_REDITEM: case MT_REDSHIELD: case MT_REDITEMDUD: case MT_TRIPLEREDSHIELD1: case MT_TRIPLEREDSHIELD2: case MT_TRIPLEREDSHIELD3: case MT_BATTLEBALLOON: case MT_FIREBALL: - case MT_FAKEITEM: case MT_FAKESHIELD: - case MT_BOMBITEM: case MT_BOMBSHIELD: + case MT_FAKEITEM: case MT_FAKESHIELD: + case MT_BOMBITEM: case MT_BOMBSHIELD: P_SpawnShadowMobj(mobj); default: break; @@ -8985,7 +8990,6 @@ void P_RemoveMobj(mobj_t *mobj) if (mobj->spawnpoint && (mobj->type == MT_RING || mobj->type == MT_COIN - || mobj->type == MT_RANDOMITEM || mobj->type == MT_BLUEBALL || mobj->type == MT_REDTEAMRING || mobj->type == MT_BLUETEAMRING @@ -9499,7 +9503,7 @@ void P_RespawnBattleSpecials(void) // pull it from the que iquetail = (iquetail+1)&(ITEMQUESIZE-1); } - + numgotboxes = 0; } @@ -10963,7 +10967,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) mthing->mobj = mobj; } // All manners of rings and coins - else if (mthing->type == mobjinfo[MT_RING].doomednum || mthing->type == mobjinfo[MT_COIN].doomednum || mthing->type == mobjinfo[MT_RANDOMITEM].doomednum || + else if (mthing->type == mobjinfo[MT_RING].doomednum || mthing->type == mobjinfo[MT_COIN].doomednum || mthing->type == mobjinfo[MT_REDTEAMRING].doomednum || mthing->type == mobjinfo[MT_BLUETEAMRING].doomednum) { mobjtype_t ringthing = MT_RING; @@ -10984,9 +10988,6 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) case 309: // No team rings in non-CTF ringthing = (gametype == GT_CTF) ? MT_BLUETEAMRING : MT_RING; break; - case 2000: // SRB2kart - ringthing = MT_RANDOMITEM; - break; default: // Spawn rings as blue spheres in special stages, ala S3+K. if (G_IsSpecialStage(gamemap) && useNightsSS) diff --git a/src/p_setup.c b/src/p_setup.c index a38def23..4cecb941 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -827,7 +827,7 @@ void P_ReloadRings(void) continue; } if (!(mo->type == MT_RING || mo->type == MT_NIGHTSWING || mo->type == MT_COIN - || mo->type == MT_BLUEBALL || mo->type == MT_RANDOMITEM)) + || mo->type == MT_BLUEBALL)) continue; // Don't auto-disintegrate things being pulled to us diff --git a/src/p_user.c b/src/p_user.c index 19767643..f2cf84f4 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9444,7 +9444,7 @@ void P_PlayerThink(player_t *player) mo2 = (mobj_t *)th; if (!(mo2->type == MT_NIGHTSWING || mo2->type == MT_RING || mo2->type == MT_COIN - || mo2->type == MT_BLUEBALL || mo2->type == MT_RANDOMITEM)) + || mo2->type == MT_BLUEBALL)) continue; if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale)) From f26c96175da4965217707482bc78a8aad8670d4f Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 13 Mar 2018 05:25:04 +0000 Subject: [PATCH 6/8] Make sure it's a waypoint before doing distance calculations --- src/k_kart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 8cc8e418..4f04f46a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2576,6 +2576,9 @@ static void K_KartUpdatePosition(player_t *player) mo = (mobj_t *)th; + if (mo->type != MT_BOSS3WAYPOINT) // TODO: Change to 'MT_WAYPOINT'? + continue; + pmo = P_AproxDistance(P_AproxDistance( mo->x - player->mo->x, mo->y - player->mo->y), mo->z - player->mo->z) / FRACUNIT; @@ -2583,9 +2586,6 @@ static void K_KartUpdatePosition(player_t *player) mo->y - players[i].mo->y), mo->z - players[i].mo->z) / FRACUNIT; - if (mo->type != MT_BOSS3WAYPOINT) // TODO: Change to 'MT_WAYPOINT'? - continue; - if (mo->health == player->starpostnum) { player->kartstuff[k_prevcheck] += pmo; From 0483c882cd59f9e5852d268015a72fff5d9c5974 Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 13 Mar 2018 05:58:57 +0000 Subject: [PATCH 7/8] Shadow optimisation Done like Overlays, goes through a list of shadows ONLY --- src/p_mobj.c | 129 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 88 insertions(+), 41 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 7bfd7375..3f7ffb88 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -47,6 +47,7 @@ consvar_t cv_splats = {"splats", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0 actioncache_t actioncachehead; static mobj_t *overlaycap = NULL; +static mobj_t *shadowcap = NULL; void P_InitCachedActions(void) { @@ -6246,62 +6247,96 @@ static void P_RemoveOverlay(mobj_t *thing) void P_RunShadows(void) { - thinker_t * th; - mobj_t * mobj; + mobj_t *mobj; + mobj_t *next; - for (th = thinkercap.next; th != &thinkercap; th = th->next) + for (mobj = shadowcap; mobj; mobj = next) { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; + next = mobj->hnext; + P_SetTarget(&mobj->hnext, NULL); - mobj = (mobj_t *)th; + if (!mobj->target) + continue; // shouldn't you already be dead? - if (mobj->type != MT_SHADOW) - continue; + if ((mobj->target->flags2 & MF2_DONTDRAW) + || (((mobj->target->eflags & MFE_VERTICALFLIP) && mobj->target->z+mobj->target->height > mobj->target->ceilingz) + || (!(mobj->target->eflags & MFE_VERTICALFLIP) && mobj->target->z < mobj->target->floorz))) + mobj->flags2 |= MF2_DONTDRAW; + else + mobj->flags2 &= ~MF2_DONTDRAW; - if (mobj->target) + // First scale to the same radius + P_SetScale(mobj, FixedDiv(mobj->target->radius, mobj->info->radius)); + + P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z); + + if (mobj->floorz < mobj->z) { - if ((mobj->target->flags2 & MF2_DONTDRAW) - || (((mobj->target->eflags & MFE_VERTICALFLIP) && mobj->target->z+mobj->target->height > mobj->target->ceilingz) - || (!(mobj->target->eflags & MFE_VERTICALFLIP) && mobj->target->z < mobj->target->floorz))) - mobj->flags2 |= MF2_DONTDRAW; - else - mobj->flags2 &= ~MF2_DONTDRAW; + INT32 i; + fixed_t prevz; - // First scale to the same radius - P_SetScale(mobj, FixedDiv(mobj->target->radius, mobj->info->radius)); + mobj->z = mobj->floorz; - P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z); - - if (mobj->floorz < mobj->z) + for (i = 0; i < MAXFFLOORS; i++) { - INT32 i; - fixed_t prevz; + prevz = mobj->z; + + // Now scale again based on height difference + P_SetScale(mobj, FixedDiv(mobj->scale, max(FRACUNIT, ((mobj->target->z-mobj->z)/200)+FRACUNIT))); + + // Check new position to see if you should still be on that ledge + P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->z); mobj->z = mobj->floorz; - for (i = 0; i < MAXFFLOORS; i++) - { - prevz = mobj->z; - - // Now scale again based on height difference - P_SetScale(mobj, FixedDiv(mobj->scale, max(FRACUNIT, ((mobj->target->z-mobj->z)/200)+FRACUNIT))); - - // Check new position to see if you should still be on that ledge - P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->z); - - mobj->z = mobj->floorz; - - if (mobj->z == prevz) - break; - } + if (mobj->z == prevz) + break; } } - else - { - P_KillMobj(mobj, NULL, NULL); - } } + P_SetTarget(&shadowcap, NULL); +} + +// called whenever shadows think +// It must be done this way so that level changes don't break when the shadowcap can't be reset +static void P_AddShadow(mobj_t *thing) +{ + I_Assert(thing != NULL); + + if (shadowcap == NULL) + P_SetTarget(&shadowcap, thing); + else { + mobj_t *mo; + for (mo = shadowcap; mo && mo->hnext; mo = mo->hnext) + ; + + I_Assert(mo != NULL); + I_Assert(mo->hnext == NULL); + + P_SetTarget(&mo->hnext, thing); + } + P_SetTarget(&thing->hnext, NULL); +} + +// Called only when MT_SHADOW (or anything else in the shadowcap list) is removed. +// Keeps the hnext list from corrupting. +static void P_RemoveShadow(mobj_t *thing) +{ + mobj_t *mo; + if (shadowcap == thing) + { + P_SetTarget(&shadowcap, thing->hnext); + P_SetTarget(&thing->hnext, NULL); + return; + } + + for (mo = shadowcap; mo; mo = mo->hnext) + if (mo->hnext == thing) + { + P_SetTarget(&mo->hnext, thing->hnext); + P_SetTarget(&thing->hnext, NULL); + return; + } } void A_BossDeath(mobj_t *mo); @@ -6500,6 +6535,15 @@ void P_MobjThinker(mobj_t *mobj) else P_AddOverlay(mobj); break; + case MT_SHADOW: + if (!mobj->target) + { + P_RemoveMobj(mobj); + return; + } + else + P_AddShadow(mobj); + break; case MT_BLACKORB: case MT_WHITEORB: case MT_GREENORB: @@ -9007,6 +9051,9 @@ void P_RemoveMobj(mobj_t *mobj) if (mobj->type == MT_OVERLAY) P_RemoveOverlay(mobj); + if (mobj->type == MT_SHADOW) + P_RemoveShadow(mobj); + mobj->health = 0; // Just because // unlink from sector and block lists From 2a4a0f24d436e6ef466ddadae421c1a0631a0dd6 Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 13 Mar 2018 10:40:02 +0000 Subject: [PATCH 8/8] Fix Bombs Use reactiontime instead of health so chain reactions can occur when multiple bombs are layered. Make the check for nearby players happen BEFORE the spawning of explosion objects. Remove MF_NOCLIPTHING and MF_MISSILE from bombs so they don't try and die when they hit the floor sometimes. --- src/info.c | 6 +++--- src/p_enemy.c | 26 ++++++++++++++------------ src/p_mobj.c | 12 +++++++++--- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/info.c b/src/info.c index 23bdee72..f7b6fed7 100644 --- a/src/info.c +++ b/src/info.c @@ -14924,10 +14924,10 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_BOMBITEM -1, // doomednum S_BOMBAIR, // spawnstate - 105, // spawnhealth + 1, // spawnhealth S_NULL, // seestate sfx_tossed, // seesound - 8, // reactiontime + 105, // reactiontime sfx_None, // attacksound S_NULL, // painstate 288*FRACUNIT, // painchance @@ -14944,7 +14944,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_bomb, // activesound - MF_BOUNCE|MF_NOCLIPTHING|MF_MISSILE|MF_SHOOTABLE, // flags + MF_BOUNCE|MF_SHOOTABLE, // flags S_NULL // raisestate }, diff --git a/src/p_enemy.c b/src/p_enemy.c index 9767edbc..788cafa1 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8273,20 +8273,11 @@ void A_BobombExplode(mobj_t *actor) type = (mobjtype_t)locvar1; - for (d = 0; d < 16; d++) - K_SpawnKartExplosion(actor->x, actor->y, actor->z, actor->info->painchance + 32*FRACUNIT, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64 - - if (actor->target->player) - K_SpawnBobombExplosion(actor, actor->target->player->skincolor); - else - K_SpawnBobombExplosion(actor, SKINCOLOR_RED); - - P_SpawnMobj(actor->x, actor->y, actor->z, MT_BOMBEXPLOSIONSOUND); - - //S_StartSound(actor, sfx_prloop); - for (th = thinkercap.next; th != &thinkercap; th = th->next) { + if (P_MobjWasRemoved(actor)) + return; // There's the possibility these can chain react onto themselves after they've already died if there are enough all in one spot + if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; @@ -8313,6 +8304,17 @@ void A_BobombExplode(mobj_t *actor) continue; } } + + for (d = 0; d < 16; d++) + K_SpawnKartExplosion(actor->x, actor->y, actor->z, actor->info->painchance + 32*FRACUNIT, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64 + + if (actor->target && actor->target->player) + K_SpawnBobombExplosion(actor, actor->target->player->skincolor); + else + K_SpawnBobombExplosion(actor, SKINCOLOR_RED); + + P_SpawnMobj(actor->x, actor->y, actor->z, MT_BOMBEXPLOSIONSOUND); + return; } //} diff --git a/src/p_mobj.c b/src/p_mobj.c index 3f7ffb88..353f7844 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7970,17 +7970,23 @@ void P_MobjThinker(mobj_t *mobj) case MT_BOMBITEM: if (mobj->momx || mobj->momy) P_SpawnGhostMobj(mobj); - if (mobj->z <= mobj->floorz) + if (P_IsObjectOnGround(mobj)) { - if (mobj->health > mobj->info->spawnhealth-1) + if (mobj->reactiontime >= mobj->info->reactiontime) { if (mobj->state == &states[S_BOMBAIR]) P_SetMobjState(mobj, S_BOMBITEM); mobj->momx = mobj->momy = 0; S_StartSound(mobj, mobj->info->activesound); + mobj->reactiontime--; } - mobj->health--; + } + if (mobj->reactiontime && mobj->reactiontime < mobj->info->reactiontime) + { + mobj->reactiontime--; + if (!mobj->reactiontime) + P_KillMobj(mobj, NULL, NULL); } if (mobj->threshold > 0) mobj->threshold--;