2021-10-29 18:49:57 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// included by game.h
|
|
|
|
|
|
|
|
BEGIN_SW_NS
|
|
|
|
|
|
|
|
|
2021-11-25 21:33:55 +00:00
|
|
|
class DSWActor : public DCoreActor
|
2021-10-29 18:49:57 +00:00
|
|
|
{
|
2021-12-05 19:55:19 +00:00
|
|
|
DECLARE_CLASS(DSWActor, DCoreActor)
|
|
|
|
HAS_OBJECT_POINTERS
|
2021-10-29 18:49:57 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2021-11-19 23:18:23 +00:00
|
|
|
bool hasUser;
|
|
|
|
USER user;
|
2021-11-24 19:11:50 +00:00
|
|
|
walltype* tempwall; // transient, to replace a hack using a 16 bit sprite field.
|
2021-12-05 23:35:12 +00:00
|
|
|
TObjPtr<DSWActor*> ownerActor;
|
2021-11-19 23:18:23 +00:00
|
|
|
|
2021-12-05 19:55:19 +00:00
|
|
|
DSWActor() = default;
|
2021-10-29 18:49:57 +00:00
|
|
|
|
2021-11-19 23:18:23 +00:00
|
|
|
bool hasU() { return hasUser; }
|
2021-11-06 09:40:57 +00:00
|
|
|
|
2021-11-17 16:01:10 +00:00
|
|
|
|
2021-12-26 00:47:05 +00:00
|
|
|
void allocUser()
|
2021-10-31 22:01:00 +00:00
|
|
|
{
|
2021-11-19 23:18:23 +00:00
|
|
|
hasUser = true;
|
2021-10-31 22:01:00 +00:00
|
|
|
}
|
2021-10-29 18:49:57 +00:00
|
|
|
|
2021-11-01 22:26:13 +00:00
|
|
|
void clearUser()
|
|
|
|
{
|
2021-11-19 23:18:23 +00:00
|
|
|
hasUser = false;
|
|
|
|
user.Clear();
|
2021-11-01 22:26:13 +00:00
|
|
|
}
|
2021-12-05 08:20:41 +00:00
|
|
|
|
|
|
|
void Serialize(FSerializer& arc) override;
|
2021-10-29 18:49:57 +00:00
|
|
|
};
|
|
|
|
|
2022-08-30 21:12:26 +00:00
|
|
|
inline void UpdateChangeXY(DSWActor* actor)
|
|
|
|
{
|
2022-11-25 12:13:50 +00:00
|
|
|
actor->user.change.XY() = actor->spr.Angles.Yaw.ToVector() * actor->vel.X;
|
2022-08-30 21:12:26 +00:00
|
|
|
}
|
|
|
|
|
2022-08-30 22:41:50 +00:00
|
|
|
inline void UpdateChange(DSWActor* actor, double zfactor = 1.0)
|
|
|
|
{
|
|
|
|
UpdateChangeXY(actor);
|
2022-09-04 22:25:15 +00:00
|
|
|
actor->user.change.Z = actor->vel.Z * zfactor;
|
2022-08-30 22:41:50 +00:00
|
|
|
}
|
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
|
2021-11-26 00:01:16 +00:00
|
|
|
// subclassed to add a game specific actor() method
|
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
// Iterator wrappers that return an actor pointer, not an index.
|
2021-11-26 20:13:19 +00:00
|
|
|
using SWStatIterator = TStatIterator<DSWActor>;
|
|
|
|
using SWSectIterator = TSectIterator<DSWActor>;
|
|
|
|
using SWSpriteIterator = TSpriteIterator<DSWActor>;
|
2021-10-29 18:49:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
END_SW_NS
|