From 4e96f624e790877d1faa2ce0b570ed29c4b9352b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 24 Apr 2017 20:33:39 +0100 Subject: [PATCH 1/5] Split off part of P_SpawnSpecials into a new function called P_InitSpecials This allows tag lists, gravity, weather, and the "CheckFor" vars to be initialised before running P_LoadThings or P_ResetDynamicSlopes, in case they could affect mobj spawning or cause a netgame desync somehow by carrying over the previous level's values --- src/p_setup.c | 6 +++-- src/p_spec.c | 62 ++++++++++++++++++++++++++++++++------------------- src/p_spec.h | 1 + 3 files changed, 44 insertions(+), 25 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index a0c745e60..43c152035 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2732,6 +2732,10 @@ boolean P_SetupLevel(boolean skipprecip) P_PrepareThings(lastloadedmaplumpnum + ML_THINGS); + // init gravity, tag lists, + // anything that P_ResetDynamicSlopes/P_LoadThings needs to know + P_InitSpecials(); + #ifdef ESLOPE P_ResetDynamicSlopes(); #endif @@ -2750,8 +2754,6 @@ boolean P_SetupLevel(boolean skipprecip) if (loadprecip) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame) P_SpawnPrecipitation(); - globalweather = mapheaderinfo[gamemap-1]->weather; - #ifdef HWRENDER // not win32 only 19990829 by Kin if (rendermode != render_soft && rendermode != render_none) { diff --git a/src/p_spec.c b/src/p_spec.c index db7b852f5..75eec033c 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5546,6 +5546,45 @@ static void P_RunLevelLoadExecutors(void) } } +/** Before things are loaded, initialises certain stuff in case they're needed + * by P_ResetDynamicSlopes or P_LoadThings. This was split off from + * P_SpawnSpecials, in case you couldn't tell. + * + * \sa P_SpawnSpecials, P_InitTagLists + * \author Monster Iestyn + */ +void P_InitSpecials(void) +{ + // Set the default gravity. Custom gravity overrides this setting. + gravity = FRACUNIT/2; + + // Defaults in case levels don't have them set. + sstimer = 90*TICRATE + 6; + totalrings = 1; + + CheckForBustableBlocks = CheckForBouncySector = CheckForQuicksand = CheckForMarioBlocks = CheckForFloatBob = CheckForReverseGravity = false; + + // Set curWeather + switch (mapheaderinfo[gamemap-1]->weather) + { + case PRECIP_SNOW: // snow + case PRECIP_RAIN: // rain + case PRECIP_STORM: // storm + case PRECIP_STORM_NORAIN: // storm w/o rain + case PRECIP_STORM_NOSTRIKES: // storm w/o lightning + curWeather = mapheaderinfo[gamemap-1]->weather; + break; + default: // blank/none + curWeather = PRECIP_NONE: + break; + } + + // Set globalweather + globalweather = mapheaderinfo[gamemap-1]->weather; + + P_InitTagLists(); // Create xref tables for tags +} + /** After the map has loaded, scans for specials that spawn 3Dfloors and * thinkers. * @@ -5567,15 +5606,6 @@ void P_SpawnSpecials(INT32 fromnetsave) // but currently isn't. (void)fromnetsave; - // Set the default gravity. Custom gravity overrides this setting. - gravity = FRACUNIT/2; - - // Defaults in case levels don't have them set. - sstimer = 90*TICRATE + 6; - totalrings = 1; - - CheckForBustableBlocks = CheckForBouncySector = CheckForQuicksand = CheckForMarioBlocks = CheckForFloatBob = CheckForReverseGravity = false; - // Init special SECTORs. sector = sectors; for (i = 0; i < numsectors; i++, sector++) @@ -5624,20 +5654,6 @@ void P_SpawnSpecials(INT32 fromnetsave) } } - if (mapheaderinfo[gamemap-1]->weather == 2) // snow - curWeather = PRECIP_SNOW; - else if (mapheaderinfo[gamemap-1]->weather == 3) // rain - curWeather = PRECIP_RAIN; - else if (mapheaderinfo[gamemap-1]->weather == 1) // storm - curWeather = PRECIP_STORM; - else if (mapheaderinfo[gamemap-1]->weather == 5) // storm w/o rain - curWeather = PRECIP_STORM_NORAIN; - else if (mapheaderinfo[gamemap-1]->weather == 6) // storm w/o lightning - curWeather = PRECIP_STORM_NOSTRIKES; - else - curWeather = PRECIP_NONE; - - P_InitTagLists(); // Create xref tables for tags P_SearchForDisableLinedefs(); // Disable linedefs are now allowed to disable *any* line P_SpawnScrollers(); // Add generalized scrollers diff --git a/src/p_spec.h b/src/p_spec.h index e34b0d08e..c7c5d7031 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -32,6 +32,7 @@ void P_InitPicAnims(void); void P_SetupLevelFlatAnims(void); // at map load +void P_InitSpecials(void); void P_SpawnSpecials(INT32 fromnetsave); // every tic From 13cb656f0bd10c1e9dd398f0a5217f245925de28 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 24 Apr 2017 20:43:58 +0100 Subject: [PATCH 2/5] Whoops forgot this --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 75eec033c..e5f8d57ec 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5575,7 +5575,7 @@ void P_InitSpecials(void) curWeather = mapheaderinfo[gamemap-1]->weather; break; default: // blank/none - curWeather = PRECIP_NONE: + curWeather = PRECIP_NONE; break; } From f099782c912896941eb98014b4a45d1baf060fce Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 24 Apr 2017 21:05:28 +0100 Subject: [PATCH 3/5] Spinning/swinging maces/chains and Particle generators can now use P_FindSpecialLineFromTag! --- src/p_mobj.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index b7cb83881..861dac3a6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9754,20 +9754,16 @@ void P_SpawnMapThing(mapthing_t *mthing) mobjtype_t macetype = MT_SMALLMACE; boolean firsttime; mobj_t *spawnee; - size_t line; + INT32 line; const size_t mthingi = (size_t)(mthing - mapthings); - // Why does P_FindSpecialLineFromTag not work here?!? - // Monster Iestyn: tag lists haven't been initialised yet for the map, that's why - for (line = 0; line < numlines; line++) - { - if (lines[line].special == 9 && lines[line].tag == mthing->angle) - break; - } + // Find the corresponding linedef special, using angle as tag + // P_FindSpecialLineFromTag works here now =D + line = P_FindSpecialLineFromTag(9, mthing->angle, -1); - if (line == numlines) + if (line == -1) { - CONS_Debug(DBG_GAMELOGIC, "Mace chain (mapthing #%s) needs tagged to a #9 parameter line (trying to find tag %d).\n", sizeu1(mthingi), mthing->angle); + CONS_Debug(DBG_GAMELOGIC, "Mace chain (mapthing #%s) needs to be tagged to a #9 parameter line (trying to find tag %d).\n", sizeu1(mthingi), mthing->angle); return; } /* @@ -9865,18 +9861,15 @@ ML_NOCLIMB : Direction not controllable fixed_t radius, speed, bottomheight, topheight; INT32 type, numdivisions, time, anglespeed; angle_t angledivision; - size_t line; + INT32 line; const size_t mthingi = (size_t)(mthing - mapthings); - for (line = 0; line < numlines; line++) - { - if (lines[line].special == 15 && lines[line].tag == mthing->angle) - break; - } + // Find the corresponding linedef special, using angle as tag + line = P_FindSpecialLineFromTag(15, mthing->angle, -1); - if (line == numlines) + if (line == -1) { - CONS_Debug(DBG_GAMELOGIC, "Particle generator (mapthing #%s) needs tagged to a #15 parameter line (trying to find tag %d).\n", sizeu1(mthingi), mthing->angle); + CONS_Debug(DBG_GAMELOGIC, "Particle generator (mapthing #%s) needs to be tagged to a #15 parameter line (trying to find tag %d).\n", sizeu1(mthingi), mthing->angle); return; } From d4c330678a0a4c227d64586284840aa9dff7d12b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 25 Apr 2017 20:39:32 +0100 Subject: [PATCH 4/5] level header's "forcecharacter" parameter doesn't take skin numbers anymore, so this isn't needed! --- src/p_setup.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 43c152035..0bb4c5b80 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2574,8 +2574,7 @@ boolean P_SetupLevel(boolean skipprecip) postimgtype = postimgtype2 = postimg_none; - if (mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0' - && atoi(mapheaderinfo[gamemap-1]->forcecharacter) != 255) + if (mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0') P_ForceCharacter(mapheaderinfo[gamemap-1]->forcecharacter); // chasecam on in chaos, race, coop From 1745966aa62876f2951914f0e034324898fd7f19 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 8 May 2017 15:54:17 +0100 Subject: [PATCH 5/5] Re-add all the folders present in objs before my .gitignore changes, by adding .gitignore files again to keep them from disappearing --- objs/DC/SDL/Debug/.gitignore | 2 ++ objs/DC/SDL/Release/.gitignore | 2 ++ objs/Linux/SDL/Debug/.gitignore | 2 ++ objs/Linux/SDL/Release/.gitignore | 2 ++ objs/Linux64/SDL/Debug/.gitignore | 2 ++ objs/Linux64/SDL/Release/.gitignore | 2 ++ objs/Mingw/Debug/.gitignore | 2 ++ objs/Mingw/Release/.gitignore | 2 ++ objs/Mingw/SDL/Debug/.gitignore | 2 ++ objs/Mingw/SDL/Release/.gitignore | 2 ++ objs/Mingw64/Debug/.gitignore | 2 ++ objs/Mingw64/Release/.gitignore | 2 ++ objs/Mingw64/SDL/Debug/.gitignore | 2 ++ objs/Mingw64/SDL/Release/.gitignore | 2 ++ objs/PS3/SDL/Debug/.gitignore | 2 ++ objs/PS3/SDL/Release/.gitignore | 2 ++ objs/PSP/SDL/Release/.gitignore | 2 ++ objs/SDL/Release/.gitignore | 2 ++ objs/VC/.gitignore | 2 ++ objs/VC9/.gitignore | 2 ++ objs/Wii/SDL/Debug/.gitignore | 2 ++ objs/Wii/SDL/Release/.gitignore | 2 ++ objs/WinCE/SDL/Release/.gitignore | 2 ++ objs/djgppdos/Debug/.gitignore | 2 ++ objs/djgppdos/Release/.gitignore | 2 ++ objs/nds/Debug/.gitignore | 2 ++ objs/nds/Release/.gitignore | 2 ++ 27 files changed, 54 insertions(+) create mode 100644 objs/DC/SDL/Debug/.gitignore create mode 100644 objs/DC/SDL/Release/.gitignore create mode 100644 objs/Linux/SDL/Debug/.gitignore create mode 100644 objs/Linux/SDL/Release/.gitignore create mode 100644 objs/Linux64/SDL/Debug/.gitignore create mode 100644 objs/Linux64/SDL/Release/.gitignore create mode 100644 objs/Mingw/Debug/.gitignore create mode 100644 objs/Mingw/Release/.gitignore create mode 100644 objs/Mingw/SDL/Debug/.gitignore create mode 100644 objs/Mingw/SDL/Release/.gitignore create mode 100644 objs/Mingw64/Debug/.gitignore create mode 100644 objs/Mingw64/Release/.gitignore create mode 100644 objs/Mingw64/SDL/Debug/.gitignore create mode 100644 objs/Mingw64/SDL/Release/.gitignore create mode 100644 objs/PS3/SDL/Debug/.gitignore create mode 100644 objs/PS3/SDL/Release/.gitignore create mode 100644 objs/PSP/SDL/Release/.gitignore create mode 100644 objs/SDL/Release/.gitignore create mode 100644 objs/VC/.gitignore create mode 100644 objs/VC9/.gitignore create mode 100644 objs/Wii/SDL/Debug/.gitignore create mode 100644 objs/Wii/SDL/Release/.gitignore create mode 100644 objs/WinCE/SDL/Release/.gitignore create mode 100644 objs/djgppdos/Debug/.gitignore create mode 100644 objs/djgppdos/Release/.gitignore create mode 100644 objs/nds/Debug/.gitignore create mode 100644 objs/nds/Release/.gitignore diff --git a/objs/DC/SDL/Debug/.gitignore b/objs/DC/SDL/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/DC/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/DC/SDL/Release/.gitignore b/objs/DC/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/DC/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Linux/SDL/Debug/.gitignore b/objs/Linux/SDL/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Linux/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Linux/SDL/Release/.gitignore b/objs/Linux/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Linux/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Linux64/SDL/Debug/.gitignore b/objs/Linux64/SDL/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Linux64/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Linux64/SDL/Release/.gitignore b/objs/Linux64/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Linux64/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw/Debug/.gitignore b/objs/Mingw/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Mingw/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw/Release/.gitignore b/objs/Mingw/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Mingw/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw/SDL/Debug/.gitignore b/objs/Mingw/SDL/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Mingw/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw/SDL/Release/.gitignore b/objs/Mingw/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Mingw/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw64/Debug/.gitignore b/objs/Mingw64/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Mingw64/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw64/Release/.gitignore b/objs/Mingw64/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Mingw64/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw64/SDL/Debug/.gitignore b/objs/Mingw64/SDL/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Mingw64/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw64/SDL/Release/.gitignore b/objs/Mingw64/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Mingw64/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/PS3/SDL/Debug/.gitignore b/objs/PS3/SDL/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/PS3/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/PS3/SDL/Release/.gitignore b/objs/PS3/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/PS3/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/PSP/SDL/Release/.gitignore b/objs/PSP/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/PSP/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/SDL/Release/.gitignore b/objs/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/VC/.gitignore b/objs/VC/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/VC/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/VC9/.gitignore b/objs/VC9/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/VC9/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Wii/SDL/Debug/.gitignore b/objs/Wii/SDL/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Wii/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Wii/SDL/Release/.gitignore b/objs/Wii/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/Wii/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/WinCE/SDL/Release/.gitignore b/objs/WinCE/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/WinCE/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/djgppdos/Debug/.gitignore b/objs/djgppdos/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/djgppdos/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/djgppdos/Release/.gitignore b/objs/djgppdos/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/djgppdos/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/nds/Debug/.gitignore b/objs/nds/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/nds/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/nds/Release/.gitignore b/objs/nds/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/objs/nds/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing