From 7dd75670f4ae2567187b0bee9a910ef7702fbee4 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 13 Mar 2009 03:18:06 +0000 Subject: [PATCH] - Fixed: After loading a savegame or unmorphing, a player's weapon slots were empty. SVN r1477 (trunk) --- docs/rh-log.txt | 6 +++++- src/d_player.h | 1 + src/g_level.cpp | 16 +++++++++++++--- src/g_shared/a_morph.cpp | 3 ++- src/p_user.cpp | 16 +++++++++++++++- wadsrc/wadsrc.vcproj | 4 ++-- 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 50172f5d45..2b3237caeb 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,8 @@ -March 11, 2009 +March 12, 2009 +- Fixed: After loading a savegame or unmorphing, a player's weapon slots + were empty. + +March 11, 2009 - Moved weapon slot initialization into APlayerPawn::PostBeginPlay() so that they can be initialized when players respawn in multiplayer. diff --git a/src/d_player.h b/src/d_player.h index ec3cab9289..ba72c2d600 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -98,6 +98,7 @@ public: virtual void GiveDeathmatchInventory (); virtual void FilterCoopRespawnInventory (APlayerPawn *oldplayer); + void SetupWeaponSlots (); void GiveDefaultInventory (); void PlayAttacking (); void PlayAttacking2 (); diff --git a/src/g_level.cpp b/src/g_level.cpp index e368688f91..2f83495adc 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1412,7 +1412,7 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad) // Hub transitions must keep the current total time if (!hubLoad) - level.totaltime=i; + level.totaltime = i; if (arc.IsStoring ()) { @@ -1501,9 +1501,19 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad) P_SerializePlayers (arc, hubLoad); P_SerializeSounds (arc); - if (arc.IsLoading()) for(i=0;iSetupWeaponSlots(); + } + } } } diff --git a/src/g_shared/a_morph.cpp b/src/g_shared/a_morph.cpp index e5912c6f4a..0979c88cf6 100644 --- a/src/g_shared/a_morph.cpp +++ b/src/g_shared/a_morph.cpp @@ -97,7 +97,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, const PClass *spawntype, i // [MH] Used by SBARINFO to speed up face drawing p->MorphedPlayerClass = 0; - for (unsigned int i = 1; i < PlayerClasses.Size (); i++) + for (unsigned int i = 1; i < PlayerClasses.Size(); i++) { if (PlayerClasses[i].Type == spawntype) { @@ -309,6 +309,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, bool force) angle = mo->angle >> ANGLETOFINESHIFT; Spawn(exit_flash, pmo->x + 20*finecosine[angle], pmo->y + 20*finesine[angle], pmo->z + TELEFOGHEIGHT, ALLOW_REPLACE); + mo->SetupWeaponSlots(); // Use original class's weapon slots. beastweap = player->ReadyWeapon; if (player->PremorphWeapon != NULL) { diff --git a/src/p_user.cpp b/src/p_user.cpp index f54c6b5bcc..647c1e982c 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -499,7 +499,21 @@ void APlayerPawn::Tick() void APlayerPawn::PostBeginPlay() { - // If we're not a voodoo doll, set up our weapons. + SetupWeaponSlots(); +} + +//=========================================================================== +// +// APlayerPawn :: SetupWeaponSlots +// +// Sets up the default weapon slots for this player. If this is also the +// local player, determines local modifications and sends those across the +// network. Ignores voodoo dolls. +// +//=========================================================================== + +void APlayerPawn::SetupWeaponSlots() +{ if (player != NULL && player->mo == this) { player->weapons.StandardSetup(GetClass()); diff --git a/wadsrc/wadsrc.vcproj b/wadsrc/wadsrc.vcproj index 45bc588450..ff7295451e 100644 --- a/wadsrc/wadsrc.vcproj +++ b/wadsrc/wadsrc.vcproj @@ -37,7 +37,7 @@