mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 20:43:15 +00:00
- fixed: When loading a savegame the player class in the userinfo needs to be updated.
- fixed: Class pointers should not be added to the list of garbage collected pointers. - fixed several warnings in the event code.
This commit is contained in:
parent
6fef653aa1
commit
d8ebbcfc08
8 changed files with 20 additions and 6 deletions
|
@ -1529,6 +1529,17 @@ bool PClassPointer::isCompatible(PType *type)
|
|||
return (other != nullptr && other->ClassRestriction->IsDescendantOf(ClassRestriction));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PClassPointer :: SetPointer
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void PClassPointer::SetPointer(void *base, unsigned offset, TArray<size_t> *special) const
|
||||
{
|
||||
// Class pointers do not get added to FlatPointers because they are released from the GC.
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PClassPointer :: IsMatch
|
||||
|
|
|
@ -401,6 +401,7 @@ public:
|
|||
|
||||
bool isCompatible(PType *type);
|
||||
|
||||
void SetPointer(void *base, unsigned offset, TArray<size_t> *special = NULL) const override;
|
||||
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
||||
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const;
|
||||
};
|
||||
|
|
|
@ -1365,7 +1365,7 @@ void G_FinishTravel ()
|
|||
for (int i = 0; i < pawnsnum; i++)
|
||||
{
|
||||
// [ZZ] fire the enter hook.
|
||||
E_PlayerEntered(pawns[i]->player - players, true);
|
||||
E_PlayerEntered(int(pawns[i]->player - players), true);
|
||||
//
|
||||
FBehavior::StaticStartTypedScripts(SCRIPT_Return, pawns[i], true);
|
||||
}
|
||||
|
|
|
@ -350,7 +350,7 @@ void cht_DoCheat (player_t *player, int cheat)
|
|||
|
||||
// player is now alive.
|
||||
// fire E_PlayerRespawned and start the ACS SCRIPT_Respawn.
|
||||
E_PlayerRespawned(player - players);
|
||||
E_PlayerRespawned(int(player - players));
|
||||
//
|
||||
FBehavior::StaticStartTypedScripts(SCRIPT_Respawn, player->mo, true);
|
||||
|
||||
|
|
|
@ -611,7 +611,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags)
|
|||
ClientObituary (this, inflictor, source, dmgflags);
|
||||
|
||||
// [ZZ] fire player death hook
|
||||
E_PlayerDied(player - players);
|
||||
E_PlayerDied(int(player - players));
|
||||
|
||||
// Death script execution, care of Skull Tag
|
||||
FBehavior::StaticStartTypedScripts (SCRIPT_Death, this, true);
|
||||
|
|
|
@ -143,7 +143,6 @@ IMPLEMENT_POINTERS_START(AActor)
|
|||
IMPLEMENT_POINTER(LastHeard)
|
||||
IMPLEMENT_POINTER(master)
|
||||
IMPLEMENT_POINTER(Poisoner)
|
||||
IMPLEMENT_POINTER(DamageFunc)
|
||||
IMPLEMENT_POINTER(alternative)
|
||||
IMPLEMENT_POINTERS_END
|
||||
|
||||
|
@ -5513,7 +5512,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
|||
{
|
||||
// [ZZ] fire non-hub ENTER event
|
||||
// level.time is a hack to make sure that we don't call it on dummy player initialization during hub return.
|
||||
if (!level.time) E_PlayerEntered(p - players, false);
|
||||
if (!level.time) E_PlayerEntered(int(p - players), false);
|
||||
FBehavior::StaticStartTypedScripts (SCRIPT_Enter, p->mo, true);
|
||||
}
|
||||
else if (state == PST_REBORN)
|
||||
|
|
|
@ -832,7 +832,10 @@ void CopyPlayer(player_t *dst, player_t *src, const char *name)
|
|||
else
|
||||
{
|
||||
dst->userinfo.TransferFrom(uibackup);
|
||||
// The player class must come from the save, so that the menu reflects the currently playing one.
|
||||
dst->userinfo.PlayerClassChanged(src->mo->GetClass()->DisplayName);
|
||||
}
|
||||
|
||||
// Validate the skin
|
||||
dst->userinfo.SkinNumChanged(R_FindSkin(skins[dst->userinfo.GetSkin()].name, dst->CurrentPlayerClass));
|
||||
|
||||
|
|
|
@ -1337,7 +1337,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n
|
|||
_CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF);
|
||||
|
||||
// Use this to break at a specific allocation number.
|
||||
//_crtBreakAlloc = 53039;
|
||||
_crtBreakAlloc = 165966;
|
||||
#endif
|
||||
|
||||
DoMain (hInstance);
|
||||
|
|
Loading…
Reference in a new issue