From f0d60ddcee4b474dbfd6849ed5c304c494963d1a Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 7 Jul 2012 03:18:09 +0000 Subject: [PATCH] - Added UsePlayerStartZ MAPINFO option to cause P_SpawnPlayer() to offset the spawned player's Z position by the MapThing's Z, just like for any other MapThing. - P_SpawnPlayer() now respects a player's SPAWNCEILING and SPAWNFLOAT flags. SVN r3746 (trunk) --- src/g_level.h | 2 +- src/g_mapinfo.cpp | 1 + src/p_mobj.cpp | 20 ++++++++++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/g_level.h b/src/g_level.h index 74df29ea37..522ea2478a 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -162,7 +162,7 @@ enum ELevelFlags LEVEL_STARTLIGHTNING = 0x01000000, // Automatically start lightning LEVEL_FILTERSTARTS = 0x02000000, // Apply mapthing filtering to player starts LEVEL_LOOKUPLEVELNAME = 0x04000000, // Level name is the name of a language string - //LEVEL_HEXENFORMAT = 0x08000000, // Level uses the Hexen map format + LEVEL_USEPLAYERSTARTZ = 0x08000000, // Use the Z position of player starts LEVEL_SWAPSKIES = 0x10000000, // Used by lightning LEVEL_NOALLIES = 0x20000000, // i.e. Inside Strife's front base diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 710470bbdf..51ae640ee8 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1208,6 +1208,7 @@ MapFlagHandlers[] = { "nofallingdamage", MITYPE_SCFLAGS, 0, ~(LEVEL_FALLDMG_ZD|LEVEL_FALLDMG_HX) }, { "noallies", MITYPE_SETFLAG, LEVEL_NOALLIES, 0 }, { "filterstarts", MITYPE_SETFLAG, LEVEL_FILTERSTARTS, 0 }, + { "useplayerstartz", MITYPE_SETFLAG, LEVEL_USEPLAYERSTARTZ, 0 }, { "activateowndeathspecials", MITYPE_SETFLAG, LEVEL_ACTOWNSPECIAL, 0 }, { "killeractivatesdeathspecials", MITYPE_CLRFLAG, LEVEL_ACTOWNSPECIAL, 0 }, { "missilesactivateimpactlines", MITYPE_SETFLAG2, LEVEL2_MISSILESACTIVATEIMPACT, 0 }, diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 92ea2a6f9e..10f5de9d90 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4080,7 +4080,7 @@ APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer) player_t *p; APlayerPawn *mobj, *oldactor; BYTE state; - fixed_t spawn_x, spawn_y; + fixed_t spawn_x, spawn_y, spawn_z; angle_t spawn_angle; // [RH] Things 4001-? are also multiplayer starts. Just like 1-4. @@ -4160,8 +4160,24 @@ APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer) } } + if (GetDefaultByType(p->cls)->flags & MF_SPAWNCEILING) + spawn_z = ONCEILINGZ; + else if (GetDefaultByType(p->cls)->flags2 & MF2_SPAWNFLOAT) + spawn_z = FLOATRANDZ; + else + spawn_z = ONFLOORZ; + mobj = static_cast - (Spawn (p->cls, spawn_x, spawn_y, ONFLOORZ, NO_REPLACE)); + (Spawn (p->cls, spawn_x, spawn_y, spawn_z, NO_REPLACE)); + + if (level.flags & LEVEL_USEPLAYERSTARTZ) + { + if (spawn_z == ONFLOORZ) + mobj->z += mthing->z; + else if (spawn_z == ONCEILINGZ) + mobj->z -= mthing->z; + P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT); + } mobj->FriendPlayer = playernum + 1; // [RH] players are their own friends oldactor = p->mo;