mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-06-04 19:10:59 +00:00
- moved new code to its proper location and started moving the replaced old archive code to a placeholder file for easy removal later.
This commit is contained in:
parent
65c6388d44
commit
c665cc53f9
13 changed files with 1431 additions and 1293 deletions
388
src/p_mobj.cpp
388
src/p_mobj.cpp
|
@ -70,6 +70,7 @@
|
|||
#include "po_man.h"
|
||||
#include "p_spec.h"
|
||||
#include "p_checkposition.h"
|
||||
#include "serializer.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -155,214 +156,195 @@ AActor::~AActor ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void AActor::Serialize(FArchive &arc)
|
||||
#define A(a,b) ((a), (b), def->b)
|
||||
|
||||
void AActor::Serialize(FSerializer &arc)
|
||||
{
|
||||
AActor *def = GetDefault();
|
||||
|
||||
Super::Serialize(arc);
|
||||
|
||||
if (arc.IsStoring())
|
||||
{
|
||||
arc.WriteSprite(sprite);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite = arc.ReadSprite();
|
||||
}
|
||||
|
||||
arc << __Pos
|
||||
<< Angles.Yaw
|
||||
<< Angles.Pitch
|
||||
<< Angles.Roll
|
||||
<< frame
|
||||
<< Scale
|
||||
<< RenderStyle
|
||||
<< renderflags
|
||||
<< picnum
|
||||
<< floorpic
|
||||
<< ceilingpic
|
||||
<< TIDtoHate
|
||||
<< LastLookPlayerNumber
|
||||
<< LastLookActor
|
||||
<< effects
|
||||
<< Alpha
|
||||
<< fillcolor
|
||||
<< Sector
|
||||
<< floorz
|
||||
<< ceilingz
|
||||
<< dropoffz
|
||||
<< floorsector
|
||||
<< ceilingsector
|
||||
<< radius
|
||||
<< Height
|
||||
<< projectilepassheight
|
||||
<< Vel
|
||||
<< tics
|
||||
<< state
|
||||
<< DamageVal;
|
||||
if (DamageVal == 0x40000000 || DamageVal == -1)
|
||||
{
|
||||
DamageVal = -1;
|
||||
DamageFunc = GetDefault()->DamageFunc;
|
||||
}
|
||||
else
|
||||
{
|
||||
DamageFunc = nullptr;
|
||||
}
|
||||
P_SerializeTerrain(arc, floorterrain);
|
||||
arc << projectileKickback
|
||||
<< flags
|
||||
<< flags2
|
||||
<< flags3
|
||||
<< flags4
|
||||
<< flags5
|
||||
<< flags6
|
||||
<< flags7
|
||||
<< weaponspecial
|
||||
<< special1
|
||||
<< special2
|
||||
<< specialf1
|
||||
<< specialf2
|
||||
<< health
|
||||
<< movedir
|
||||
<< visdir
|
||||
<< movecount
|
||||
<< strafecount
|
||||
<< target
|
||||
<< lastenemy
|
||||
<< LastHeard
|
||||
<< reactiontime
|
||||
<< threshold
|
||||
<< player
|
||||
<< SpawnPoint
|
||||
<< SpawnAngle
|
||||
<< StartHealth
|
||||
<< skillrespawncount
|
||||
<< tracer
|
||||
<< Floorclip
|
||||
<< tid
|
||||
<< special;
|
||||
if (P_IsACSSpecial(special))
|
||||
{
|
||||
P_SerializeACSScriptNumber(arc, args[0], false);
|
||||
}
|
||||
else
|
||||
{
|
||||
arc << args[0];
|
||||
}
|
||||
arc << args[1] << args[2] << args[3] << args[4];
|
||||
arc << accuracy << stamina;
|
||||
arc << goal
|
||||
<< waterlevel
|
||||
<< MinMissileChance
|
||||
<< SpawnFlags
|
||||
<< Inventory
|
||||
<< InventoryID;
|
||||
arc << FloatBobPhase
|
||||
<< Translation
|
||||
<< SeeSound
|
||||
<< AttackSound
|
||||
<< PainSound
|
||||
<< DeathSound
|
||||
<< ActiveSound
|
||||
<< UseSound
|
||||
<< BounceSound
|
||||
<< WallBounceSound
|
||||
<< CrushPainSound
|
||||
<< Speed
|
||||
<< FloatSpeed
|
||||
<< Mass
|
||||
<< PainChance
|
||||
<< SpawnState
|
||||
<< SeeState
|
||||
<< MeleeState
|
||||
<< MissileState
|
||||
<< MaxDropOffHeight
|
||||
<< MaxStepHeight
|
||||
<< BounceFlags
|
||||
<< bouncefactor
|
||||
<< wallbouncefactor
|
||||
<< bouncecount
|
||||
<< maxtargetrange
|
||||
<< meleethreshold
|
||||
<< meleerange
|
||||
<< DamageType;
|
||||
arc << DamageTypeReceived;
|
||||
arc << PainType
|
||||
<< DeathType;
|
||||
arc << Gravity
|
||||
<< FastChaseStrafeCount
|
||||
<< master
|
||||
<< smokecounter
|
||||
<< BlockingMobj
|
||||
<< BlockingLine
|
||||
<< VisibleToTeam // [BB]
|
||||
<< pushfactor
|
||||
<< Species
|
||||
<< Score;
|
||||
arc << DesignatedTeam;
|
||||
arc << lastpush << lastbump
|
||||
<< PainThreshold
|
||||
<< DamageFactor;
|
||||
arc << DamageMultiply;
|
||||
arc << WeaveIndexXY << WeaveIndexZ
|
||||
<< PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner
|
||||
<< PoisonDamage << PoisonDuration << PoisonPeriod;
|
||||
arc << PoisonDamageType << PoisonDamageTypeReceived;
|
||||
arc << ConversationRoot << Conversation;
|
||||
arc << FriendPlayer;
|
||||
arc << TeleFogSourceType
|
||||
<< TeleFogDestType;
|
||||
arc << RipperLevel
|
||||
<< RipLevelMin
|
||||
<< RipLevelMax;
|
||||
arc << DefThreshold;
|
||||
if (SaveVersion >= 4549)
|
||||
{
|
||||
arc << SpriteAngle;
|
||||
arc << SpriteRotation;
|
||||
}
|
||||
|
||||
if (SaveVersion >= 4550)
|
||||
{
|
||||
arc << alternative;
|
||||
}
|
||||
|
||||
{
|
||||
FString tagstr;
|
||||
if (arc.IsStoring() && Tag != NULL && Tag->Len() > 0) tagstr = *Tag;
|
||||
arc << tagstr;
|
||||
if (arc.IsLoading())
|
||||
{
|
||||
if (tagstr.Len() == 0) Tag = NULL;
|
||||
else Tag = mStringPropertyData.Alloc(tagstr);
|
||||
}
|
||||
}
|
||||
|
||||
if (arc.IsLoading ())
|
||||
{
|
||||
touching_sectorlist = NULL;
|
||||
LinkToWorld(false, Sector);
|
||||
|
||||
AddToHash ();
|
||||
SetShade (fillcolor);
|
||||
if (player)
|
||||
{
|
||||
if (playeringame[player - players] &&
|
||||
player->cls != NULL &&
|
||||
!(flags4 & MF4_NOSKIN) &&
|
||||
state->sprite == GetDefaultByType (player->cls)->SpawnState->sprite)
|
||||
{ // Give player back the skin
|
||||
sprite = skins[player->userinfo.GetSkin()].sprite;
|
||||
}
|
||||
if (Speed == 0)
|
||||
{
|
||||
Speed = GetDefault()->Speed;
|
||||
}
|
||||
}
|
||||
ClearInterpolation();
|
||||
UpdateWaterLevel(false);
|
||||
}
|
||||
arc
|
||||
.Sprite("sprite", sprite, &def->sprite)
|
||||
A("pos", __Pos)
|
||||
A("angles", Angles)
|
||||
A("frame", frame)
|
||||
A("scale", Scale)
|
||||
A("renderstyle", RenderStyle)
|
||||
A("renderflags", renderflags)
|
||||
A("picnum", picnum)
|
||||
A("floorpic", floorpic)
|
||||
A("ceilingpic", ceilingpic)
|
||||
A("tidtohate", TIDtoHate)
|
||||
A("lastlookpn", LastLookPlayerNumber)
|
||||
("lastlookactor", LastLookActor)
|
||||
A("effects", effects)
|
||||
A("alpha", Alpha)
|
||||
A("fillcolor", fillcolor)
|
||||
A("sector", Sector)
|
||||
A("floorz", floorz)
|
||||
A("ceilingz", ceilingz)
|
||||
A("dropoffz", dropoffz)
|
||||
A("floorsector", floorsector)
|
||||
A("ceilingsector", ceilingsector)
|
||||
A("radius", radius)
|
||||
A("height", Height)
|
||||
A("ppassheight", projectilepassheight)
|
||||
A("vel", Vel)
|
||||
A("tics", tics)
|
||||
A("state", state)
|
||||
A("damage", DamageVal)
|
||||
.Terrain("floorterrain", floorterrain, &def->floorterrain)
|
||||
A("projectilekickback", projectileKickback)
|
||||
A("flags", flags)
|
||||
A("flags2", flags2)
|
||||
A("flags3", flags3)
|
||||
A("flags4", flags4)
|
||||
A("flags5", flags5)
|
||||
A("flags6", flags6)
|
||||
A("flags7", flags7)
|
||||
A("weaponspecial", weaponspecial)
|
||||
A("special1", special1)
|
||||
A("special2", special2)
|
||||
A("specialf1", specialf1)
|
||||
A("specialf2", specialf2)
|
||||
A("health", health)
|
||||
A("movedir", movedir)
|
||||
A("visdir", visdir)
|
||||
A("movecount", movecount)
|
||||
A("strafecount", strafecount)
|
||||
("target", target)
|
||||
("lastenemy", lastenemy)
|
||||
("lastheard", LastHeard)
|
||||
A("reactiontime", reactiontime)
|
||||
A("threshold", threshold)
|
||||
A("player", player)
|
||||
A("spawnpoint", SpawnPoint)
|
||||
A("spawnangle", SpawnAngle)
|
||||
A("starthealth", StartHealth)
|
||||
A("skillrespawncount", skillrespawncount)
|
||||
("tracer", tracer)
|
||||
A("floorclip", Floorclip)
|
||||
A("tid", tid)
|
||||
A("special", special)
|
||||
.Args("args", args, def->args, special)
|
||||
A("accuracy", accuracy)
|
||||
A("stamina", stamina)
|
||||
("goal", goal)
|
||||
A("waterlevel", waterlevel)
|
||||
A("minmissilechance", MinMissileChance)
|
||||
A("spawnflags", SpawnFlags)
|
||||
("inventory", Inventory)
|
||||
A("inventoryid", InventoryID)
|
||||
A("floatbobphase", FloatBobPhase)
|
||||
A("translation", Translation)
|
||||
A("seesound", SeeSound)
|
||||
A("attacksound", AttackSound)
|
||||
A("paimsound", PainSound)
|
||||
A("deathsound", DeathSound)
|
||||
A("activesound", ActiveSound)
|
||||
A("usesound", UseSound)
|
||||
A("bouncesound", BounceSound)
|
||||
A("wallbouncesound", WallBounceSound)
|
||||
A("crushpainsound", CrushPainSound)
|
||||
A("speed", Speed)
|
||||
A("floatspeed", FloatSpeed)
|
||||
A("mass", Mass)
|
||||
A("painchance", PainChance)
|
||||
A("spawnstate", SpawnState)
|
||||
A("seestate", SeeState)
|
||||
A("meleestate", MeleeState)
|
||||
A("missilestate", MissileState)
|
||||
A("maxdropoffheight", MaxDropOffHeight)
|
||||
A("maxstepheight", MaxStepHeight)
|
||||
A("bounceflags", BounceFlags)
|
||||
A("bouncefactor", bouncefactor)
|
||||
A("wallbouncefactor", wallbouncefactor)
|
||||
A("bouncecount", bouncecount)
|
||||
A("maxtargetrange", maxtargetrange)
|
||||
A("meleethreshold", meleethreshold)
|
||||
A("meleerange", meleerange)
|
||||
A("damagetype", DamageType)
|
||||
A("damagetypereceived", DamageTypeReceived)
|
||||
A("paintype", PainType)
|
||||
A("deathtype", DeathType)
|
||||
A("gravity", Gravity)
|
||||
A("fastchasestrafecount", FastChaseStrafeCount)
|
||||
("master", master)
|
||||
A("smokecounter", smokecounter)
|
||||
("blockingmobj", BlockingMobj)
|
||||
A("blockingline", BlockingLine)
|
||||
A("visibletoteam", VisibleToTeam)
|
||||
A("pushfactor", pushfactor)
|
||||
A("species", Species)
|
||||
A("score", Score)
|
||||
A("designatedteam", DesignatedTeam)
|
||||
A("lastpush", lastpush)
|
||||
A("lastbump", lastbump)
|
||||
A("painthreshold", PainThreshold)
|
||||
A("damagefactor", DamageFactor)
|
||||
A("damagemultiply", DamageMultiply)
|
||||
A("waveindexxy", WeaveIndexXY)
|
||||
A("weaveindexz", WeaveIndexZ)
|
||||
A("pdmgreceived", PoisonDamageReceived)
|
||||
A("pdurreceived", PoisonDurationReceived)
|
||||
A("ppreceived", PoisonPeriodReceived)
|
||||
("poisoner", Poisoner)
|
||||
A("posiondamage", PoisonDamage)
|
||||
A("poisonduration", PoisonDuration)
|
||||
A("poisonperiod", PoisonPeriod)
|
||||
A("poisondamagetype", PoisonDamageType)
|
||||
A("poisondmgtypereceived", PoisonDamageTypeReceived)
|
||||
A("conversationroot", ConversationRoot)
|
||||
A("conversation", Conversation)
|
||||
A("friendplayer", FriendPlayer)
|
||||
A("telefogsourcetype", TeleFogSourceType)
|
||||
A("telefogdesttype", TeleFogDestType)
|
||||
A("ripperlevel", RipperLevel)
|
||||
A("riplevelmin", RipLevelMin)
|
||||
A("riplevelmax", RipLevelMax)
|
||||
A("devthreshold", DefThreshold)
|
||||
A("spriteangle", SpriteAngle)
|
||||
A("spriterotation", SpriteRotation)
|
||||
("alternative", alternative)
|
||||
A("tag", Tag);
|
||||
}
|
||||
|
||||
#undef A
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// This must be done after the world is set up.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void AActor::PostSerialize()
|
||||
{
|
||||
touching_sectorlist = NULL;
|
||||
LinkToWorld(false, Sector);
|
||||
|
||||
AddToHash();
|
||||
SetShade(fillcolor);
|
||||
if (player)
|
||||
{
|
||||
if (playeringame[player - players] &&
|
||||
player->cls != NULL &&
|
||||
!(flags4 & MF4_NOSKIN) &&
|
||||
state->sprite == GetDefaultByType(player->cls)->SpawnState->sprite)
|
||||
{ // Give player back the skin
|
||||
sprite = skins[player->userinfo.GetSkin()].sprite;
|
||||
}
|
||||
if (Speed == 0)
|
||||
{
|
||||
Speed = GetDefault()->Speed;
|
||||
}
|
||||
}
|
||||
ClearInterpolation();
|
||||
UpdateWaterLevel(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
AActor::AActor () throw()
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue