- Added MAPINFO flag "SpawnWithWeaponRaised".

SVN r4013 (trunk)
This commit is contained in:
Randy Heit 2013-01-03 02:08:08 +00:00
parent 549712e719
commit 787c338871
8 changed files with 19 additions and 17 deletions

View file

@ -1128,7 +1128,7 @@ void G_FinishTravel ()
// The player being spawned here is a short lived dummy and
// must not start any ENTER script or big problems will happen.
pawndup = P_SpawnPlayer (&playerstarts[pawn->player - players], int(pawn->player - players), true);
pawndup = P_SpawnPlayer (&playerstarts[pawn->player - players], int(pawn->player - players), SPF_TEMPPLAYER);
if (!(changeflags & CHANGELEVEL_KEEPFACING))
{
pawn->angle = pawndup->angle;

View file

@ -181,7 +181,7 @@ enum ELevelFlags
LEVEL2_KEEPFULLINVENTORY = 0x00000040, // doesn't reduce the amount of inventory items to 1
/* = 0x00000080, */
LEVEL2_PRERAISEWEAPON = 0x00000080, // players should spawn with their weapons fully raised (but not when respawning it multiplayer)
LEVEL2_MONSTERFALLINGDAMAGE = 0x00000100,
LEVEL2_CLIPMIDTEX = 0x00000200,
LEVEL2_WRAPMIDTEX = 0x00000400,

View file

@ -1271,6 +1271,7 @@ MapFlagHandlers[] =
{ "forgetstate", MITYPE_SETFLAG2, LEVEL2_FORGETSTATE, 0 },
{ "rememberstate", MITYPE_CLRFLAG2, LEVEL2_FORGETSTATE, 0 },
{ "unfreezesingleplayerconversations",MITYPE_SETFLAG2, LEVEL2_CONV_SINGLE_UNFREEZE, 0 },
{ "spawnwithweaponraised", MITYPE_SETFLAG2, LEVEL2_PRERAISEWEAPON, 0 },
{ "nobotnodes", MITYPE_IGNORE, 0, 0 }, // Skulltag option: nobotnodes
{ "compat_shorttex", MITYPE_COMPATFLAG, COMPATF_SHORTTEX, 0 },
{ "compat_stairs", MITYPE_COMPATFLAG, COMPATF_STAIRINDEX, 0 },

View file

@ -93,7 +93,7 @@ inline int GetSafeBlockY(long long blocky)
//
// P_PSPR
//
void P_SetupPsprites (player_t* curplayer);
void P_SetupPsprites (player_t* curplayer, bool startweaponup);
void P_MovePsprites (player_t* curplayer);
void P_DropWeapon (player_t* player);
@ -114,7 +114,10 @@ void P_UnPredictPlayer ();
#define ONCEILINGZ FIXED_MAX
#define FLOATRANDZ (FIXED_MAX-1)
APlayerPawn *P_SpawnPlayer (struct FPlayerStart *mthing, int playernum, bool tempplayer=false);
#define SPF_TEMPPLAYER 1 // spawning a short-lived dummy player
#define SPF_WEAPONFULLYUP 2 // spawn with weapon already raised
APlayerPawn *P_SpawnPlayer (struct FPlayerStart *mthing, int playernum, int flags=0);
void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move);
int P_FaceMobj (AActor *source, AActor *target, angle_t *delta);

View file

@ -4138,7 +4138,7 @@ EXTERN_CVAR (Bool, chasedemo)
extern bool demonew;
APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, bool tempplayer)
APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
{
player_t *p;
APlayerPawn *mobj, *oldactor;
@ -4239,7 +4239,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, bool tempplayer
{
G_PlayerReborn (playernum);
}
else if (oldactor != NULL && oldactor->player == p && !tempplayer)
else if (oldactor != NULL && oldactor->player == p && !(flags & SPF_TEMPPLAYER))
{
// Move the voodoo doll's inventory to the new player.
mobj->ObtainInventory (oldactor);
@ -4312,11 +4312,9 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, bool tempplayer
p->cheats = CF_CHASECAM;
// setup gun psprite
if (!tempplayer)
{
// This can also start a script so don't do it for
// the dummy player.
P_SetupPsprites (p);
if (!(flags & SPF_TEMPPLAYER))
{ // This can also start a script so don't do it for the dummy player.
P_SetupPsprites (p, !!(flags & SPF_WEAPONFULLYUP));
}
if (deathmatch)
@ -4362,7 +4360,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, bool tempplayer
}
// [BC] Do script stuff
if (!tempplayer)
if (!(flags & SPF_TEMPPLAYER))
{
if (state == PST_ENTER || (state == PST_LIVE && !savegamerestore))
{
@ -4548,7 +4546,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
AllPlayerStarts.Push(start);
if (!deathmatch && !(level.flags2 & LEVEL2_RANDOMPLAYERSTARTS))
{
return P_SpawnPlayer(&start, pnum);
return P_SpawnPlayer(&start, pnum, (level.flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0);
}
return NULL;
}

View file

@ -989,7 +989,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_Light)
//
//------------------------------------------------------------------------
void P_SetupPsprites(player_t *player)
void P_SetupPsprites(player_t *player, bool startweaponup)
{
int i;
@ -999,7 +999,7 @@ void P_SetupPsprites(player_t *player)
player->psprites[i].state = NULL;
}
// Spawn the ready weapon
player->PendingWeapon = player->ReadyWeapon;
player->PendingWeapon = !startweaponup ? player->ReadyWeapon : WP_NOCHANGE;
P_BringUpWeapon (player);
}

View file

@ -310,7 +310,7 @@ static void SpawnExtraPlayers ()
if (playeringame[i] && players[i].mo == NULL)
{
players[i].playerstate = PST_ENTER;
P_SpawnPlayer(&playerstarts[i], i);
P_SpawnPlayer(&playerstarts[i], i, (level.flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0);
}
}
}

View file

@ -3986,7 +3986,7 @@ void P_SetupLevel (char *lumpname, int position)
{
players[i].mo = NULL;
FPlayerStart *mthing = G_PickPlayerStart(i);
P_SpawnPlayer(mthing, i);
P_SpawnPlayer(mthing, i, (level.flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0);
}
}
}