mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Merge branch 'level-specials-setup-stuff' into 'master'
Level specials setup stuff Some changes to level setup, largely inconsequential for gameplay but maybe helpful for Lua scripting: * gravity, weather, and some other internal variables are set to their defaults before loading things, so their values from a previous level don't affect mobj spawning potentially * Tag lists are also initialised before loading things, so that tag-based search functions (such as P_FindSpecialLineFromTag) can be used internally for the maces and particle generator. This should probably extend to Lua as well * the level header "forcecharacter" no longer recognises "255" as "None" anymore. This is because it no longer takes skin numbers (as of whenever that change was added... version 2.0?), and level headers are auto-cleared when edited anyway. See merge request !88
This commit is contained in:
commit
9238b2d50f
4 changed files with 56 additions and 45 deletions
29
src/p_mobj.c
29
src/p_mobj.c
|
@ -9765,20 +9765,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;
|
||||
}
|
||||
/*
|
||||
|
@ -9876,18 +9872,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -2589,8 +2589,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
|
||||
|
@ -2750,6 +2749,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
|
||||
|
@ -2771,8 +2774,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)
|
||||
{
|
||||
|
|
62
src/p_spec.c
62
src/p_spec.c
|
@ -5589,6 +5589,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.
|
||||
*
|
||||
|
@ -5610,15 +5649,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++)
|
||||
|
@ -5667,20 +5697,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
|
||||
|
|
|
@ -34,6 +34,7 @@ void P_InitPicAnims(void);
|
|||
void P_SetupLevelFlatAnims(void);
|
||||
|
||||
// at map load
|
||||
void P_InitSpecials(void);
|
||||
void P_SpawnSpecials(INT32 fromnetsave);
|
||||
|
||||
// every tic
|
||||
|
|
Loading…
Reference in a new issue