mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- turn the SO's Animator and PostMoveAnimator into non-functions as well.
What little is here can be done just as easily by more traditional means which are easier to serialize.
This commit is contained in:
parent
5e64d6c7aa
commit
8d57281101
7 changed files with 38 additions and 64 deletions
|
@ -1209,11 +1209,18 @@ enum
|
|||
|
||||
extern TRACK Track[MAX_TRACKS];
|
||||
|
||||
enum
|
||||
{
|
||||
SOType_None = 0,
|
||||
SOType_Floor = 1,
|
||||
SOType_Tornado = 2,
|
||||
SOType_AutoTurret = 3
|
||||
};
|
||||
|
||||
struct SECTOR_OBJECT
|
||||
{
|
||||
bool PreMoveScale;
|
||||
soANIMATORp PostMoveAnimator;
|
||||
soANIMATORp Animator;
|
||||
uint8_t AnimType;
|
||||
TObjPtr<DSWActor*> controller;
|
||||
|
||||
TObjPtr<DSWActor*> sp_child; // child sprite that holds info for the sector object
|
||||
|
|
|
@ -533,21 +533,4 @@ void SpikeFloor(SECTOR_OBJECT* sop)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include "saveable.h"
|
||||
|
||||
static saveable_code saveable_morph_code[] =
|
||||
{
|
||||
SAVE_CODE(MorphTornado),
|
||||
SAVE_CODE(MorphFloor),
|
||||
};
|
||||
|
||||
saveable_module saveable_morph =
|
||||
{
|
||||
// code
|
||||
saveable_morph_code,
|
||||
SIZ(saveable_morph_code),
|
||||
|
||||
// data
|
||||
nullptr,0
|
||||
};
|
||||
END_SW_NS
|
||||
|
|
|
@ -693,10 +693,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, SECTOR_OBJECT& w,
|
|||
("limit_ang_center", w.limit_ang_center, def->limit_ang_center)
|
||||
("limit_ang_delta", w.limit_ang_delta, def->limit_ang_delta)
|
||||
("premovescale", w.PreMoveScale, def->PreMoveScale);
|
||||
|
||||
|
||||
SerializeCodePtr(arc, "postanimator", (void**)&w.PostMoveAnimator);
|
||||
SerializeCodePtr(arc, "animator", (void**)&w.Animator);
|
||||
("animtype", w.AnimType, def->AnimType);
|
||||
|
||||
arc.EndObject();
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ void Saveable_Init(void)
|
|||
MODULE(jweapon)
|
||||
MODULE(lava)
|
||||
MODULE(miscactr)
|
||||
MODULE(morph)
|
||||
MODULE(ninja)
|
||||
MODULE(panel)
|
||||
MODULE(player)
|
||||
|
@ -61,7 +60,6 @@ void Saveable_Init(void)
|
|||
MODULE(skull)
|
||||
MODULE(sprite)
|
||||
MODULE(sumo)
|
||||
MODULE(track)
|
||||
MODULE(weapon)
|
||||
MODULE(zilla)
|
||||
MODULE(zombie)
|
||||
|
|
|
@ -74,6 +74,9 @@ void DoRotatorMatch(PLAYER* pp, short match, bool);
|
|||
void DoSlidorOperate(PLAYER*, sectortype*);
|
||||
void DoSlidorMatch(PLAYER* pp, short match, bool);
|
||||
|
||||
void DoTornadoObject(SECTOR_OBJECT* sop);
|
||||
void DoAutoTurretObject(SECTOR_OBJECT* sop);
|
||||
|
||||
void KillMatchingCrackSprites(short match);
|
||||
int DoTrapReset(short match);
|
||||
int DoTrapMatch(short match);
|
||||
|
@ -392,8 +395,7 @@ void SectorSetup(void)
|
|||
memset(&SectorObject[ndx].so_actors, 0, sizeof(SectorObject[0].so_actors));
|
||||
SectorObject[ndx].match_event_actor = nullptr;
|
||||
SectorObject[ndx].PreMoveScale = false;
|
||||
SectorObject[ndx].PostMoveAnimator = nullptr;
|
||||
SectorObject[ndx].Animator = nullptr;
|
||||
SectorObject[ndx].AnimType = SOType_None;
|
||||
SectorObject[ndx].controller = nullptr;
|
||||
SectorObject[ndx].sp_child = nullptr;
|
||||
SectorObject[ndx].mid_sector = nullptr;
|
||||
|
@ -2933,10 +2935,14 @@ void DoSector(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (sop->Animator)
|
||||
switch (sop->AnimType)
|
||||
{
|
||||
(*sop->Animator)(sop);
|
||||
continue;
|
||||
case SOType_AutoTurret:
|
||||
DoAutoTurretObject(sop);
|
||||
break;
|
||||
case SOType_Tornado:
|
||||
DoTornadoObject(sop);
|
||||
break;
|
||||
}
|
||||
|
||||
// force sync SOs to be updated regularly
|
||||
|
|
|
@ -42,8 +42,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
BEGIN_SW_NS
|
||||
|
||||
DVector2 DoTrack(SECTOR_OBJECT* sop, short locktics);
|
||||
void DoAutoTurretObject(SECTOR_OBJECT* sop);
|
||||
void DoTornadoObject(SECTOR_OBJECT* sop);
|
||||
int PickJumpSpeed(DSWActor*, int pix_height);
|
||||
DSWActor* FindNearSprite(DSWActor, short);
|
||||
|
||||
|
@ -929,11 +927,6 @@ void SetupSectorObject(sectortype* sectp, short tag)
|
|||
// initialize stuff first time through
|
||||
if (sop->num_sectors == -1)
|
||||
{
|
||||
void DoTornadoObject(SECTOR_OBJECT* sop);
|
||||
void MorphTornado(SECTOR_OBJECT* sop);
|
||||
void MorphFloor(SECTOR_OBJECT* sop);
|
||||
void DoAutoTurretObject(SECTOR_OBJECT* sop);
|
||||
|
||||
memset(sop->sectp, 0, sizeof(sop->sectp));
|
||||
memset(sop->so_actors, 0, sizeof(sop->so_actors));
|
||||
sop->morph_wall_point = nullptr;
|
||||
|
@ -987,8 +980,7 @@ void SetupSectorObject(sectortype* sectp, short tag)
|
|||
sop->morph_off = { 0,0 };
|
||||
|
||||
sop->PreMoveScale = false;
|
||||
sop->PostMoveAnimator = nullptr;
|
||||
sop->Animator = nullptr;
|
||||
sop->AnimType = SOType_None;
|
||||
}
|
||||
|
||||
switch (tag % 5)
|
||||
|
@ -1074,7 +1066,7 @@ void SetupSectorObject(sectortype* sectp, short tag)
|
|||
break;
|
||||
|
||||
case SO_AUTO_TURRET:
|
||||
sop->Animator = DoAutoTurretObject;
|
||||
sop->AnimType = SOType_AutoTurret;
|
||||
KillActor(actor);
|
||||
break;
|
||||
|
||||
|
@ -1087,9 +1079,8 @@ void SetupSectorObject(sectortype* sectp, short tag)
|
|||
sop->spin_speed = DAngle22_5 * (1. / 16);
|
||||
sop->last_ang = sop->ang;
|
||||
// animators
|
||||
sop->Animator = DoTornadoObject;
|
||||
sop->PreMoveScale = true;
|
||||
sop->PostMoveAnimator = MorphTornado;
|
||||
sop->AnimType = SOType_Tornado;
|
||||
// clip
|
||||
sop->clipdist = 156.25;
|
||||
// morph point
|
||||
|
@ -1106,7 +1097,7 @@ void SetupSectorObject(sectortype* sectp, short tag)
|
|||
sop->scale_type = SO_SCALE_NONE;
|
||||
sop->morph_speed = 7.5;
|
||||
sop->morph_z_speed = 7;
|
||||
sop->PostMoveAnimator = MorphFloor;
|
||||
sop->AnimType = SOType_Floor;
|
||||
sop->morph_dist_max = 250;
|
||||
sop->morph_rand_freq = 8;
|
||||
KillActor(actor);
|
||||
|
@ -1841,8 +1832,18 @@ void RefreshPoints(SECTOR_OBJECT* sop, const DVector2& move, bool dynamic)
|
|||
MovePoints(sop, delta_ang_from_orig, move);
|
||||
|
||||
// do morphing - angle independent
|
||||
if (dynamic && sop->PostMoveAnimator)
|
||||
(*sop->PostMoveAnimator)(sop);
|
||||
if (dynamic)
|
||||
{
|
||||
switch (sop->AnimType)
|
||||
{
|
||||
case SOType_Floor:
|
||||
MorphFloor(sop);
|
||||
break;
|
||||
case SOType_Tornado:
|
||||
MorphTornado(sop);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KillSectorObjectSprites(SECTOR_OBJECT* sop)
|
||||
|
@ -3465,22 +3466,4 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
|
|||
}
|
||||
|
||||
|
||||
#include "saveable.h"
|
||||
|
||||
static saveable_code saveable_track_code[] =
|
||||
{
|
||||
SAVE_CODE(DoTornadoObject),
|
||||
SAVE_CODE(DoAutoTurretObject),
|
||||
};
|
||||
|
||||
saveable_module saveable_track =
|
||||
{
|
||||
// code
|
||||
saveable_track_code,
|
||||
SIZ(saveable_track_code),
|
||||
|
||||
// data
|
||||
nullptr,0
|
||||
};
|
||||
|
||||
END_SW_NS
|
||||
|
|
|
@ -16107,7 +16107,7 @@ int InitTurretMgun(SECTOR_OBJECT* sop)
|
|||
double daz = npos.Z;
|
||||
|
||||
// if its not operated by a player
|
||||
if (sop->Animator)
|
||||
if (sop->AnimType == SOType_AutoTurret)
|
||||
{
|
||||
// only auto aim for Z
|
||||
daang = DAngle90;
|
||||
|
|
Loading…
Reference in a new issue