diff --git a/src/g_level.cpp b/src/g_level.cpp index 32acf14cb..ebd19074a 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -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; diff --git a/src/g_level.h b/src/g_level.h index 105b07100..53b7cbf59 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -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, diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 9df7b39eb..adfd626c3 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -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 }, diff --git a/src/p_local.h b/src/p_local.h index eb6690726..f1dd56f19 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -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); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index cfb909a01..5d05b8c80 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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; } diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index fb3cf68d4..f5a1c45db 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -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); } diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 205e91443..5fa41da99 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -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); } } } diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 1edbb181f..ee596a74c 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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); } } }