2021-11-25 20:42:49 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2021-12-30 11:21:51 +00:00
|
|
|
#include "maptypes.h"
|
2022-01-23 08:54:49 +00:00
|
|
|
#include "build.h"
|
|
|
|
#include "actorinfo.h"
|
2022-12-08 11:44:06 +00:00
|
|
|
#include "clip.h"
|
2022-01-23 08:54:49 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
MAXSTATUS = 1024
|
|
|
|
};
|
2021-11-25 20:42:49 +00:00
|
|
|
|
2022-05-27 11:55:38 +00:00
|
|
|
struct FWallSpriteDesc
|
|
|
|
{
|
|
|
|
walltype* wall;
|
|
|
|
float offsetOnWall;
|
|
|
|
};
|
|
|
|
|
|
|
|
// This is for quick determination of walls a wall sprite is attached to.
|
|
|
|
struct FWallSpriteInfo
|
|
|
|
{
|
|
|
|
tspritetype base; // this is needed for checking if something has changed.
|
|
|
|
TArray<FWallSpriteDesc> connections[2]; // two lists - for front and back
|
|
|
|
};
|
|
|
|
|
2021-12-05 19:55:19 +00:00
|
|
|
class DCoreActor : public DObject
|
2021-11-25 20:42:49 +00:00
|
|
|
{
|
2021-12-05 19:55:19 +00:00
|
|
|
DECLARE_CLASS(DCoreActor, DObject)
|
|
|
|
HAS_OBJECT_POINTERS
|
2021-11-25 20:42:49 +00:00
|
|
|
// common part of the game actors
|
|
|
|
public:
|
|
|
|
|
2021-12-04 21:04:16 +00:00
|
|
|
// These two are needed because we cannot rely on the ones in the sprites for unlinking.
|
|
|
|
int link_stat;
|
|
|
|
sectortype* link_sector;
|
|
|
|
DCoreActor* prevStat, * nextStat;
|
|
|
|
DCoreActor* prevSect, * nextSect;
|
2022-05-27 11:55:38 +00:00
|
|
|
FWallSpriteInfo* wallspriteinfo; // this is render data but needs to be attached to the actor so it can be found.
|
2021-12-04 21:04:16 +00:00
|
|
|
|
2021-12-05 08:34:30 +00:00
|
|
|
spritetype spr;
|
|
|
|
spriteext_t sprext;
|
|
|
|
spritesmooth_t spsmooth;
|
|
|
|
|
2022-02-03 21:06:09 +00:00
|
|
|
DVector3 opos;
|
2022-11-25 03:13:13 +00:00
|
|
|
DRotator PrevAngles;
|
2022-09-03 07:41:02 +00:00
|
|
|
DVector3 vel;
|
2022-11-21 03:53:52 +00:00
|
|
|
double oviewzoffset, viewzoffset;
|
2022-10-04 17:06:49 +00:00
|
|
|
double clipdist;
|
2022-09-01 18:33:22 +00:00
|
|
|
|
2022-10-04 17:06:49 +00:00
|
|
|
int time;
|
2022-02-13 10:38:21 +00:00
|
|
|
int16_t spritesetindex;
|
2023-04-23 08:32:58 +00:00
|
|
|
FTextureID dispictex;
|
2022-02-13 10:38:21 +00:00
|
|
|
|
2021-12-30 17:21:02 +00:00
|
|
|
|
2021-12-05 19:55:19 +00:00
|
|
|
DCoreActor() = default;
|
2021-12-05 08:20:41 +00:00
|
|
|
virtual ~DCoreActor() = default;
|
2021-12-05 19:55:19 +00:00
|
|
|
DCoreActor(const DCoreActor& other) = delete; // we also do not want to allow copies.
|
|
|
|
DCoreActor& operator=(const DCoreActor& other) = delete;
|
|
|
|
|
2021-12-05 08:20:41 +00:00
|
|
|
virtual void Serialize(FSerializer& arc);
|
|
|
|
|
2021-12-06 16:00:15 +00:00
|
|
|
virtual void BeginPlay() {}
|
|
|
|
void OnDestroy() override;
|
2021-12-05 19:55:19 +00:00
|
|
|
size_t PropagateMark() override;
|
2022-09-24 20:53:45 +00:00
|
|
|
double GetOffsetAndHeight(double& height);
|
2022-10-04 17:06:49 +00:00
|
|
|
|
2022-11-19 09:58:35 +00:00
|
|
|
void initFromSprite(spritetype* pspr);
|
2021-12-05 19:55:19 +00:00
|
|
|
|
2021-12-03 20:36:32 +00:00
|
|
|
bool exists() const
|
|
|
|
{
|
2021-12-23 22:48:39 +00:00
|
|
|
return (unsigned)spr.statnum < MAXSTATUS;
|
2021-12-03 20:36:32 +00:00
|
|
|
}
|
|
|
|
|
2021-11-25 21:33:55 +00:00
|
|
|
int GetIndex() const
|
2021-11-25 20:42:49 +00:00
|
|
|
{
|
2021-12-22 20:06:31 +00:00
|
|
|
// This is only identical with the sprite index for items spawned at map start.
|
2022-01-08 20:18:18 +00:00
|
|
|
return time;
|
2022-08-08 22:11:21 +00:00
|
|
|
}
|
|
|
|
|
2022-01-31 18:20:53 +00:00
|
|
|
const vec3_t int_pos() const
|
2022-01-30 14:38:30 +00:00
|
|
|
{
|
2022-02-02 23:32:59 +00:00
|
|
|
return { int(spr.pos.X * worldtoint), int(spr.pos.Y * worldtoint), int(spr.pos.Z * zworldtoint) };
|
2022-01-30 14:38:30 +00:00
|
|
|
}
|
|
|
|
|
2022-08-16 22:50:50 +00:00
|
|
|
constexpr int int_ang() const
|
2022-08-16 21:15:16 +00:00
|
|
|
{
|
2022-11-25 12:13:50 +00:00
|
|
|
return spr.Angles.Yaw.Buildang();
|
2022-08-16 21:15:16 +00:00
|
|
|
}
|
|
|
|
|
2022-08-16 21:27:44 +00:00
|
|
|
void norm_ang()
|
|
|
|
{
|
2022-11-25 12:13:50 +00:00
|
|
|
spr.Angles.Yaw = spr.Angles.Yaw.Normalized360();
|
2022-08-16 21:27:44 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 04:26:39 +00:00
|
|
|
DVector3 interpolatedpos(double const interpfrac)
|
2022-02-03 21:06:09 +00:00
|
|
|
{
|
2022-11-20 10:26:34 +00:00
|
|
|
return interpolatedvalue(opos, spr.pos, interpfrac);
|
2022-02-03 21:06:09 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 10:21:14 +00:00
|
|
|
DAngle interpolatedyaw(double const interpfrac)
|
2021-12-30 16:32:31 +00:00
|
|
|
{
|
2022-11-25 03:13:13 +00:00
|
|
|
return interpolatedvalue(PrevAngles.Yaw, spr.Angles.Yaw, interpfrac);
|
2021-12-30 16:32:31 +00:00
|
|
|
}
|
|
|
|
|
2021-12-30 16:10:08 +00:00
|
|
|
void backupz()
|
|
|
|
{
|
2022-02-03 21:06:09 +00:00
|
|
|
opos.Z = spr.pos.Z;
|
2022-11-21 03:53:52 +00:00
|
|
|
oviewzoffset = viewzoffset;
|
2021-12-30 16:10:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void backupvec2()
|
|
|
|
{
|
2022-08-29 09:47:05 +00:00
|
|
|
opos.XY() = spr.pos.XY();
|
2021-12-30 16:10:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void backuppos()
|
|
|
|
{
|
2022-02-03 21:06:09 +00:00
|
|
|
opos = spr.pos;
|
2022-11-21 03:53:52 +00:00
|
|
|
oviewzoffset = viewzoffset;
|
2021-12-30 16:10:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void backupang()
|
|
|
|
{
|
2022-11-25 07:50:35 +00:00
|
|
|
PrevAngles = spr.Angles;
|
2021-12-30 16:10:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void backuploc()
|
|
|
|
{
|
|
|
|
backuppos();
|
|
|
|
backupang();
|
|
|
|
}
|
|
|
|
|
2022-11-21 04:34:37 +00:00
|
|
|
void restorez()
|
|
|
|
{
|
|
|
|
spr.pos.Z = opos.Z;
|
|
|
|
viewzoffset = oviewzoffset;
|
|
|
|
}
|
|
|
|
|
2022-11-21 02:29:33 +00:00
|
|
|
void restorevec2()
|
|
|
|
{
|
|
|
|
spr.pos.XY() = opos.XY();
|
|
|
|
}
|
|
|
|
|
2022-11-20 08:03:27 +00:00
|
|
|
void restorepos()
|
|
|
|
{
|
|
|
|
spr.pos = opos;
|
|
|
|
viewzoffset = oviewzoffset;
|
|
|
|
}
|
|
|
|
|
2022-11-29 10:12:36 +00:00
|
|
|
void restoreang()
|
|
|
|
{
|
|
|
|
spr.Angles = PrevAngles;
|
|
|
|
}
|
|
|
|
|
|
|
|
void restoreloc()
|
|
|
|
{
|
|
|
|
restorepos();
|
|
|
|
restoreang();
|
|
|
|
}
|
|
|
|
|
2022-11-21 04:20:08 +00:00
|
|
|
double getOffsetZ()
|
|
|
|
{
|
|
|
|
return spr.pos.Z + viewzoffset;
|
|
|
|
}
|
|
|
|
|
2022-11-24 08:47:02 +00:00
|
|
|
double getPrevOffsetZ()
|
|
|
|
{
|
|
|
|
return opos.Z + oviewzoffset;
|
|
|
|
}
|
|
|
|
|
2022-11-24 02:20:17 +00:00
|
|
|
DVector3 getPosWithOffsetZ()
|
|
|
|
{
|
|
|
|
return spr.pos.plusZ(viewzoffset);
|
|
|
|
}
|
|
|
|
|
2022-11-21 04:24:01 +00:00
|
|
|
DVector3 getPrevPosWithOffsetZ()
|
|
|
|
{
|
|
|
|
return opos.plusZ(oviewzoffset);
|
|
|
|
}
|
|
|
|
|
2022-11-21 04:24:25 +00:00
|
|
|
DVector3 getRenderPos(const double interpfrac)
|
|
|
|
{
|
|
|
|
return interpolatedpos(interpfrac).plusZ(interpolatedvalue(oviewzoffset, viewzoffset, interpfrac));
|
|
|
|
}
|
|
|
|
|
2021-11-25 21:33:55 +00:00
|
|
|
sectortype* sector() const
|
2021-11-25 20:42:49 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
return spr.sectp;
|
2021-11-25 20:42:49 +00:00
|
|
|
}
|
|
|
|
|
2021-11-25 21:33:55 +00:00
|
|
|
bool insector() const
|
|
|
|
{
|
2021-12-30 15:24:51 +00:00
|
|
|
return spr.sectp != nullptr;
|
2021-11-25 21:33:55 +00:00
|
|
|
}
|
2021-11-25 20:42:49 +00:00
|
|
|
|
2021-12-30 15:36:04 +00:00
|
|
|
void setsector(sectortype* sect)
|
|
|
|
{
|
|
|
|
// place for asserts.
|
|
|
|
spr.sectp = sect;
|
|
|
|
}
|
|
|
|
|
2021-12-30 15:39:43 +00:00
|
|
|
int sectno() const
|
|
|
|
{
|
|
|
|
return spr.sectp ? ::sector.IndexOf(spr.sectp) : -1;
|
|
|
|
}
|
|
|
|
|
2022-02-20 23:12:51 +00:00
|
|
|
auto spriteset() const
|
|
|
|
{
|
|
|
|
return static_cast<PClassActor*>(GetClass())->ActorInfo()->SpriteSet;
|
|
|
|
}
|
2022-09-09 16:05:03 +00:00
|
|
|
|
2022-09-09 16:32:42 +00:00
|
|
|
int native_clipdist()
|
|
|
|
{
|
2022-10-12 17:00:29 +00:00
|
|
|
return int(clipdist * 4);
|
2022-09-09 16:32:42 +00:00
|
|
|
}
|
|
|
|
|
2022-09-09 16:22:20 +00:00
|
|
|
void copy_clipdist(DCoreActor* other)
|
|
|
|
{
|
2022-10-04 17:06:49 +00:00
|
|
|
clipdist = other->clipdist;
|
2022-09-09 16:22:20 +00:00
|
|
|
}
|
2021-12-30 15:39:43 +00:00
|
|
|
|
2021-11-25 20:42:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// holds pointers to the game-side actors.
|
|
|
|
extern TArray<sectortype> sector;
|
|
|
|
extern TArray<walltype> wall;
|
|
|
|
|
|
|
|
|
|
|
|
// Masking these into the object index to keep it in 16 bit was probably the single most dumbest and pointless thing Build ever did.
|
|
|
|
// Names taken from DukeGDX
|
|
|
|
enum EHitBits
|
|
|
|
{
|
2021-12-29 18:41:41 +00:00
|
|
|
kHitNone = 0,
|
|
|
|
kHitSector = 0x4000,
|
|
|
|
kHitWall = 0x8000,
|
|
|
|
kHitSprite = 0xC000,
|
|
|
|
kHitVoid = 0x10000, // SW only
|
2021-11-25 20:42:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// This serves as input/output for all functions dealing with collisions, hits, etc.
|
|
|
|
// Not all utilities use all variables.
|
|
|
|
struct HitInfoBase
|
|
|
|
{
|
2022-08-17 16:53:45 +00:00
|
|
|
DVector3 hitpos;
|
2021-11-25 20:42:49 +00:00
|
|
|
sectortype* hitSector;
|
|
|
|
walltype* hitWall;
|
2021-12-29 18:41:41 +00:00
|
|
|
DCoreActor* hitActor;
|
2021-11-25 20:42:49 +00:00
|
|
|
|
2021-11-26 12:41:15 +00:00
|
|
|
void clearObj()
|
|
|
|
{
|
|
|
|
hitSector = nullptr;
|
|
|
|
hitWall = nullptr;
|
|
|
|
hitActor = nullptr;
|
|
|
|
}
|
2022-09-26 06:33:23 +00:00
|
|
|
|
|
|
|
void set(sectortype* sect, walltype* wal, DCoreActor* actor, const DVector3& pos)
|
|
|
|
{
|
|
|
|
hitSector = sect;
|
|
|
|
hitWall = wal;
|
|
|
|
hitActor = actor;
|
|
|
|
hitpos = pos;
|
|
|
|
}
|
2021-11-26 12:41:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
struct THitInfo : public HitInfoBase
|
|
|
|
{
|
|
|
|
T* actor() const { return static_cast<T*>(hitActor); }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct CollisionBase
|
|
|
|
{
|
|
|
|
int type;
|
2021-11-26 13:26:03 +00:00
|
|
|
int exbits; // extended game-side info (only used by Exhumed)
|
2021-11-26 12:41:15 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
// can only have one at a time
|
|
|
|
sectortype* hitSector;
|
|
|
|
walltype* hitWall;
|
|
|
|
DCoreActor* hitActor;
|
|
|
|
};
|
2021-11-25 20:42:49 +00:00
|
|
|
|
|
|
|
void invalidate()
|
|
|
|
{
|
|
|
|
type = -1; // something invalid that's not a valid hit type.
|
2021-11-26 12:41:15 +00:00
|
|
|
hitSector = nullptr;
|
2021-11-25 20:42:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int setNone()
|
|
|
|
{
|
|
|
|
*this = {};
|
|
|
|
return kHitNone;
|
|
|
|
}
|
|
|
|
|
|
|
|
int setSector(int num)
|
|
|
|
{
|
|
|
|
*this = {};
|
|
|
|
type = kHitSector;
|
|
|
|
hitSector = §or[num];
|
|
|
|
return kHitSector;
|
|
|
|
}
|
|
|
|
|
2021-11-26 00:01:16 +00:00
|
|
|
int setSector(sectortype* num)
|
|
|
|
{
|
|
|
|
*this = {};
|
|
|
|
type = kHitSector;
|
|
|
|
hitSector = num;
|
|
|
|
return kHitSector;
|
|
|
|
}
|
|
|
|
|
2021-11-25 20:42:49 +00:00
|
|
|
int setWall(int num)
|
|
|
|
{
|
|
|
|
*this = {};
|
|
|
|
type = kHitWall;
|
|
|
|
hitWall = &wall[num];
|
|
|
|
return kHitWall;
|
|
|
|
}
|
|
|
|
|
2021-11-26 00:01:16 +00:00
|
|
|
int setWall(walltype* num)
|
|
|
|
{
|
|
|
|
*this = {};
|
|
|
|
type = kHitWall;
|
|
|
|
hitWall = num;
|
|
|
|
return kHitWall;
|
|
|
|
}
|
|
|
|
|
2021-11-25 21:33:55 +00:00
|
|
|
int setSprite(DCoreActor* num)
|
2021-11-25 20:42:49 +00:00
|
|
|
{
|
|
|
|
*this = {};
|
|
|
|
type = kHitSprite;
|
|
|
|
hitActor = num;
|
|
|
|
return kHitSprite;
|
|
|
|
}
|
|
|
|
|
2021-11-26 12:41:15 +00:00
|
|
|
int setVoid()
|
|
|
|
{
|
|
|
|
hitSector = nullptr;
|
2021-11-25 20:42:49 +00:00
|
|
|
type = kHitVoid;
|
2021-11-26 12:41:15 +00:00
|
|
|
return kHitVoid;
|
2021-11-25 20:42:49 +00:00
|
|
|
}
|
|
|
|
};
|
2021-11-25 21:33:55 +00:00
|
|
|
|
2021-11-26 12:00:33 +00:00
|
|
|
template<class T>
|
2021-11-26 12:41:15 +00:00
|
|
|
struct TCollision : public CollisionBase
|
2021-11-26 12:00:33 +00:00
|
|
|
{
|
2021-12-05 19:55:19 +00:00
|
|
|
T* actor() const
|
|
|
|
{
|
|
|
|
return static_cast<T*>(hitActor);
|
|
|
|
}
|
|
|
|
|
|
|
|
// normally collision data is short lived, this is only needed in some very rare circumstances.
|
|
|
|
T* safeActor()
|
|
|
|
{
|
|
|
|
return static_cast<T*>(GC::ReadBarrier(hitActor));
|
|
|
|
}
|
|
|
|
|
|
|
|
auto operator=(const CollisionBase& other)
|
|
|
|
{
|
|
|
|
*(CollisionBase*)this = other;
|
|
|
|
return *this;
|
|
|
|
}
|
2021-11-26 12:00:33 +00:00
|
|
|
};
|
2021-11-25 21:33:55 +00:00
|
|
|
|
2021-11-26 12:41:15 +00:00
|
|
|
|
2021-12-04 21:04:16 +00:00
|
|
|
struct ActorStatList
|
|
|
|
{
|
|
|
|
DCoreActor* firstEntry, * lastEntry;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern ActorStatList statList[MAXSTATUS];
|
2021-11-26 12:41:15 +00:00
|
|
|
|
2021-11-25 21:33:55 +00:00
|
|
|
template<class TActor>
|
2021-12-04 21:04:16 +00:00
|
|
|
class TStatIterator
|
2021-11-25 21:33:55 +00:00
|
|
|
{
|
2021-12-04 21:04:16 +00:00
|
|
|
DCoreActor* next;
|
2021-11-25 21:33:55 +00:00
|
|
|
public:
|
2021-12-04 21:04:16 +00:00
|
|
|
TStatIterator(int stat)
|
|
|
|
{
|
|
|
|
next = statList[stat].firstEntry;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Reset(int stat)
|
2021-11-25 21:33:55 +00:00
|
|
|
{
|
2021-12-04 21:04:16 +00:00
|
|
|
next = statList[stat].firstEntry;
|
2021-11-25 21:33:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TActor* Next()
|
|
|
|
{
|
2021-12-04 21:04:16 +00:00
|
|
|
auto n = next;
|
|
|
|
if (next) next = next->nextStat;
|
|
|
|
return static_cast<TActor*>(n);
|
2021-11-25 21:33:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TActor* Peek()
|
|
|
|
{
|
2021-12-04 21:04:16 +00:00
|
|
|
return static_cast<TActor*>(next);
|
2021-11-25 21:33:55 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class TActor>
|
2021-12-04 21:04:16 +00:00
|
|
|
class TSectIterator
|
2021-11-25 21:33:55 +00:00
|
|
|
{
|
2021-12-04 21:04:16 +00:00
|
|
|
DCoreActor* next;
|
2021-11-25 21:33:55 +00:00
|
|
|
public:
|
2022-11-01 07:38:40 +00:00
|
|
|
|
2021-12-04 21:04:16 +00:00
|
|
|
TSectIterator(int stat)
|
|
|
|
{
|
|
|
|
next = sector[stat].firstEntry;
|
|
|
|
}
|
|
|
|
|
|
|
|
TSectIterator(sectortype* stat)
|
2021-11-25 21:33:55 +00:00
|
|
|
{
|
2021-12-04 21:04:16 +00:00
|
|
|
next = stat->firstEntry;
|
2021-11-25 21:33:55 +00:00
|
|
|
}
|
|
|
|
|
2021-12-04 21:04:16 +00:00
|
|
|
void Reset(int stat)
|
2021-11-25 21:33:55 +00:00
|
|
|
{
|
2021-12-04 21:04:16 +00:00
|
|
|
next = sector[stat].firstEntry;
|
2021-11-25 21:33:55 +00:00
|
|
|
}
|
|
|
|
|
2021-12-04 21:04:16 +00:00
|
|
|
void Reset(sectortype* stat)
|
|
|
|
{
|
|
|
|
next = stat->firstEntry;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-11-25 21:33:55 +00:00
|
|
|
TActor* Next()
|
|
|
|
{
|
2021-12-04 21:04:16 +00:00
|
|
|
auto n = next;
|
|
|
|
if (next) next = next->nextSect;
|
|
|
|
return static_cast<TActor*>(n);
|
2021-11-25 21:33:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TActor* Peek()
|
|
|
|
{
|
2021-12-04 21:04:16 +00:00
|
|
|
return static_cast<TActor*>(next);
|
2021-11-25 21:33:55 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// An iterator to iterate over all sprites.
|
|
|
|
template<class TActor>
|
|
|
|
class TSpriteIterator
|
|
|
|
{
|
|
|
|
TStatIterator<TActor> it;
|
|
|
|
int stat = 0;
|
|
|
|
|
|
|
|
public:
|
|
|
|
TSpriteIterator() : it(0) {}
|
|
|
|
|
|
|
|
TActor* Next()
|
|
|
|
{
|
|
|
|
while (stat < MAXSTATUS)
|
|
|
|
{
|
|
|
|
auto ac = it.Next();
|
|
|
|
if (ac) return ac;
|
|
|
|
stat++;
|
|
|
|
if (stat < MAXSTATUS) it.Reset(stat);
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
2021-12-03 20:36:32 +00:00
|
|
|
|
|
|
|
void Reset()
|
|
|
|
{
|
|
|
|
stat = 0;
|
|
|
|
it.Reset(0);
|
|
|
|
}
|
2021-11-25 21:33:55 +00:00
|
|
|
};
|
|
|
|
|
2021-11-26 20:52:01 +00:00
|
|
|
using CoreSectIterator = TSectIterator<DCoreActor>;
|
|
|
|
|
2021-12-06 16:00:15 +00:00
|
|
|
DCoreActor* InsertActor(PClass* type, sectortype* sector, int stat, bool forcetail = false);
|
2021-12-04 21:04:16 +00:00
|
|
|
void ChangeActorSect(DCoreActor* actor, sectortype* sector, bool forcetail = false);
|
|
|
|
int ChangeActorStat(DCoreActor* actor, int nStatus, bool forcetail = false);
|
|
|
|
void InitSpriteLists();
|
2021-11-26 20:52:01 +00:00
|
|
|
|
|
|
|
|
2022-08-22 21:49:25 +00:00
|
|
|
void SetActorZ(DCoreActor* actor, const DVector3& newpos);
|
|
|
|
void SetActor(DCoreActor* actor, const DVector3& newpos);
|
2021-11-26 20:52:01 +00:00
|
|
|
|
2022-08-30 22:39:32 +00:00
|
|
|
inline int clipmove(DVector3& pos, sectortype** const sect, const DVector2& mvec,
|
|
|
|
double const walldist, double const ceildist, double const flordist, unsigned const cliptype, CollisionBase& result, int clipmoveboxtracenum = 3)
|
|
|
|
{
|
2022-10-12 17:00:29 +00:00
|
|
|
auto vect = vec3_t(int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint));
|
2022-09-30 15:57:22 +00:00
|
|
|
int sectno = *sect ? sector.IndexOf(*sect) : -1;
|
|
|
|
result = clipmove_(&vect, §no, FloatToFixed<18>(mvec.X), FloatToFixed<18>(mvec.Y), int(walldist * worldtoint), int(ceildist * zworldtoint), int(flordist * zworldtoint), cliptype, clipmoveboxtracenum);
|
2022-08-30 22:39:32 +00:00
|
|
|
pos = { vect.X * inttoworld, vect.Y * inttoworld, vect.Z * zinttoworld };
|
2022-09-30 15:57:22 +00:00
|
|
|
*sect = sectno == -1 ? nullptr : §or[sectno];
|
|
|
|
return result.type;
|
2022-08-30 22:39:32 +00:00
|
|
|
}
|
|
|
|
|
2022-11-20 07:46:19 +00:00
|
|
|
inline int clipmove(DVector2& pos, double z, sectortype** const sect, const DVector2& mvec,
|
|
|
|
double const walldist, double const ceildist, double const flordist, unsigned const cliptype, CollisionBase& result, int clipmoveboxtracenum = 3)
|
|
|
|
{
|
|
|
|
auto vect = DVector3(pos, z);
|
|
|
|
auto res = clipmove(vect, sect, mvec, walldist, ceildist, flordist, cliptype, result);
|
|
|
|
pos = vect.XY();
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2022-01-23 08:54:49 +00:00
|
|
|
|
|
|
|
inline PClassActor* PClass::FindActor(FName name)
|
|
|
|
{
|
|
|
|
auto cls = FindClass(name);
|
|
|
|
return cls && cls->IsDescendantOf(RUNTIME_CLASS(DCoreActor)) ? static_cast<PClassActor*>(cls) : nullptr;
|
|
|
|
}
|
2022-01-23 09:54:56 +00:00
|
|
|
|
|
|
|
inline DCoreActor* GetDefaultByType(const PClass* type)
|
|
|
|
{
|
|
|
|
return (DCoreActor*)(type->Defaults);
|
|
|
|
}
|
|
|
|
|