Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Added UsePlayerStartZ MAPINFO option to cause P_SpawnPlayer() to of…

…fset 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.

git-svn-id: http://mancubus.net/svn/hosted/zdoom/zdoom/trunk@3746 a95907f1-e10c-0410-b46f-9e587ccb1026
  • Loading branch information...
commit ed4b6a90760dae03e42ff3d10044731786b547f3 1 parent 92a91ca
rheit authored
Showing with 20 additions and 3 deletions.
  1. +1 −1  src/g_level.h
  2. +1 −0  src/g_mapinfo.cpp
  3. +18 −2 src/p_mobj.cpp
View
2  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
View
1  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 },
View
20 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<APlayerPawn *>
- (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;
Please sign in to comment.
Something went wrong with that request. Please try again.