2022-01-23 08:54:49 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2022-02-13 09:44:39 +00:00
|
|
|
|
#include "maptypes.h"
|
2022-01-23 08:54:49 +00:00
|
|
|
|
#include "dobject.h"
|
|
|
|
|
#include "m_fixed.h"
|
|
|
|
|
#include "m_random.h"
|
2023-05-21 07:59:22 +00:00
|
|
|
|
#include "states.h"
|
2022-01-23 08:54:49 +00:00
|
|
|
|
|
|
|
|
|
class FScanner;
|
|
|
|
|
class FInternalLightAssociation;
|
|
|
|
|
|
2022-01-23 18:03:14 +00:00
|
|
|
|
enum EDefaultFlags
|
|
|
|
|
{
|
|
|
|
|
DEFF_PICNUM = 1,
|
|
|
|
|
DEFF_STATNUM = 2,
|
2023-04-08 07:38:46 +00:00
|
|
|
|
DEFF_SCALE = 4,
|
2022-01-23 18:03:14 +00:00
|
|
|
|
};
|
|
|
|
|
|
2022-01-23 08:54:49 +00:00
|
|
|
|
struct FActorInfo
|
|
|
|
|
{
|
|
|
|
|
TArray<FInternalLightAssociation *> LightAssociations;
|
2023-10-03 20:25:28 +00:00
|
|
|
|
TArrayView<FTextureID> SpriteSet;
|
2022-01-23 08:54:49 +00:00
|
|
|
|
PClassActor *Replacement = nullptr;
|
|
|
|
|
PClassActor *Replacee = nullptr;
|
2023-04-08 07:38:46 +00:00
|
|
|
|
DVector2 DefaultScale = { 0, 0 };
|
2022-12-21 21:06:34 +00:00
|
|
|
|
int TypeNum = -1; // game specific identifier.
|
2023-01-01 15:16:17 +00:00
|
|
|
|
int FirstAction = -1;
|
|
|
|
|
int NumActions = 0;
|
|
|
|
|
int FirstMove = -1;
|
|
|
|
|
int NumMoves = 0;
|
|
|
|
|
int FirstAI = -1;
|
|
|
|
|
int NumAIs = 0;
|
2023-04-30 06:07:10 +00:00
|
|
|
|
FName DefaultAction = NAME_Null; // 'none' is val<61>d content here so use 'null' as 'not set'.
|
|
|
|
|
FName DefaultMove = NAME_Null;
|
|
|
|
|
int DefaultMoveflags = 0;
|
|
|
|
|
|
2022-01-23 18:03:14 +00:00
|
|
|
|
int DefaultFlags = 0;
|
|
|
|
|
int DefaultCstat = 0;
|
2022-12-15 20:12:20 +00:00
|
|
|
|
FName DamageType = NAME_None; // damage type this item inflicts
|
2022-12-31 17:32:05 +00:00
|
|
|
|
TArray<PClassActor*> precacheClasses;
|
2022-01-23 08:54:49 +00:00
|
|
|
|
|
2022-01-16 23:51:40 +00:00
|
|
|
|
// these are temporary. Due to how Build games handle their tiles, we cannot look up the textures when scripts are being parsed.
|
|
|
|
|
TArray<FString> SpriteSetNames;
|
|
|
|
|
|
2023-05-21 07:59:22 +00:00
|
|
|
|
FState* OwnedStates = nullptr;
|
|
|
|
|
int NumOwnedStates = 0;
|
|
|
|
|
FStateLabels* StateList = nullptr;
|
|
|
|
|
|
2022-01-23 08:54:49 +00:00
|
|
|
|
FActorInfo() = default;
|
2022-11-14 17:15:58 +00:00
|
|
|
|
FActorInfo(const FActorInfo& other)
|
|
|
|
|
{
|
|
|
|
|
// only copy the fields that get inherited
|
|
|
|
|
TypeNum = other.TypeNum;
|
|
|
|
|
DefaultFlags = other.DefaultFlags;
|
|
|
|
|
DefaultCstat = other.DefaultCstat;
|
|
|
|
|
SpriteSetNames = other.SpriteSetNames;
|
2023-04-08 07:38:46 +00:00
|
|
|
|
DefaultScale = other.DefaultScale;
|
2023-05-01 10:10:37 +00:00
|
|
|
|
DefaultAction = other.DefaultAction;
|
|
|
|
|
DefaultMove = other.DefaultMove;
|
|
|
|
|
DefaultMoveflags = other.DefaultMoveflags;
|
2022-11-14 17:15:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 09:58:35 +00:00
|
|
|
|
void ResolveTextures(const char* clsname, DCoreActor *defaults);
|
2023-05-21 07:59:22 +00:00
|
|
|
|
|
2022-01-23 08:54:49 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// No objects of this type will be created ever - its only use is to static_cast
|
|
|
|
|
// PClass to it.
|
|
|
|
|
class PClassActor : public PClass
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
public:
|
|
|
|
|
static void StaticInit ();
|
|
|
|
|
|
|
|
|
|
void BuildDefaults();
|
|
|
|
|
void ApplyDefaults(uint8_t *defaults);
|
|
|
|
|
bool SetReplacement(FName replaceName);
|
|
|
|
|
void InitializeDefaults();
|
|
|
|
|
|
|
|
|
|
FActorInfo *ActorInfo() const
|
|
|
|
|
{
|
|
|
|
|
return (FActorInfo*)Meta;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PClassActor *GetReplacement();
|
|
|
|
|
PClassActor *GetReplacee();
|
|
|
|
|
|
2023-05-21 07:59:22 +00:00
|
|
|
|
bool OwnsState(const FState* state) const
|
|
|
|
|
{
|
|
|
|
|
auto i = ActorInfo();
|
|
|
|
|
return i != nullptr && state >= i->OwnedStates && state < i->OwnedStates + i->NumOwnedStates;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FState* GetStates() const
|
|
|
|
|
{
|
|
|
|
|
return ActorInfo()->OwnedStates;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FStateLabels* GetStateLabels() const
|
|
|
|
|
{
|
|
|
|
|
return ActorInfo()->StateList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FState* FindState(int numnames, FName* names, bool exact = false) const;
|
|
|
|
|
FState* FindStateByString(const char* name, bool exact = false);
|
|
|
|
|
FState* FindState(FName name) const
|
|
|
|
|
{
|
|
|
|
|
return FindState(1, &name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-01-23 08:54:49 +00:00
|
|
|
|
// For those times when being able to scan every kind of actor is convenient
|
|
|
|
|
inline static TArray<PClassActor *> AllActorClasses;
|
|
|
|
|
};
|