2016-03-01 15:47:10 +00:00
|
|
|
/*
|
|
|
|
** info.h
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
** Copyright 1998-2007 Randy Heit
|
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __INFO_H__
|
|
|
|
#define __INFO_H__
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#if !defined(_WIN32)
|
|
|
|
#include <inttypes.h> // for intptr_t
|
2016-03-24 10:30:11 +00:00
|
|
|
#else
|
2016-03-01 15:47:10 +00:00
|
|
|
#include <stdint.h> // for mingw
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "dobject.h"
|
|
|
|
#include "doomdef.h"
|
|
|
|
#include "vm.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
|
|
|
|
#include "m_fixed.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
|
|
|
|
struct Baggage;
|
|
|
|
class FScanner;
|
|
|
|
struct FActorInfo;
|
2016-04-12 17:44:12 +00:00
|
|
|
class FIntCVar;
|
2016-10-12 18:42:41 +00:00
|
|
|
class FStateDefinitions;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-10-12 17:22:33 +00:00
|
|
|
enum EStateDefineFlags
|
|
|
|
{
|
|
|
|
SDF_NEXT = 0,
|
|
|
|
SDF_STATE = 1,
|
|
|
|
SDF_STOP = 2,
|
|
|
|
SDF_WAIT = 3,
|
|
|
|
SDF_LABEL = 4,
|
|
|
|
SDF_INDEX = 5,
|
|
|
|
SDF_MASK = 7,
|
|
|
|
SDF_DEHACKED = 8, // Identify a state as having been modified by a dehacked lump
|
|
|
|
};
|
|
|
|
|
2016-10-30 13:00:11 +00:00
|
|
|
enum EStateType : int // this must ensure proper alignment.
|
2016-06-16 14:11:00 +00:00
|
|
|
{
|
|
|
|
STATE_Actor,
|
|
|
|
STATE_Psprite,
|
|
|
|
STATE_StateChain,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FStateParamInfo
|
|
|
|
{
|
|
|
|
FState *mCallingState;
|
|
|
|
EStateType mStateType;
|
|
|
|
int mPSPIndex;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
// Sprites that are fixed in position because they can have special meanings.
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
SPR_TNT1, // The empty sprite
|
|
|
|
SPR_FIXED, // Do not change sprite or frame
|
|
|
|
SPR_NOCHANGE, // Do not change sprite (frame change is okay)
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FState
|
|
|
|
{
|
|
|
|
FState *NextState;
|
|
|
|
VMFunction *ActionFunc;
|
|
|
|
WORD sprite;
|
|
|
|
SWORD Tics;
|
|
|
|
WORD TicRange;
|
|
|
|
BYTE Frame;
|
|
|
|
BYTE DefineFlags; // Unused byte so let's use it during state creation.
|
|
|
|
int Misc1; // Was changed to SBYTE, reverted to long for MBF compat
|
|
|
|
int Misc2; // Was changed to BYTE, reverted to long for MBF compat
|
|
|
|
short Light;
|
|
|
|
BYTE Fullbright:1; // State is fullbright
|
|
|
|
BYTE SameFrame:1; // Ignore Frame (except when spawning actor)
|
|
|
|
BYTE Fast:1;
|
|
|
|
BYTE NoDelay:1; // Spawn states executes its action normally
|
|
|
|
BYTE CanRaise:1; // Allows a monster to be resurrected without waiting for an infinate frame
|
|
|
|
BYTE Slow:1; // Inverse of fast
|
|
|
|
|
|
|
|
inline int GetFrame() const
|
|
|
|
{
|
|
|
|
return Frame;
|
|
|
|
}
|
|
|
|
inline bool GetSameFrame() const
|
|
|
|
{
|
|
|
|
return SameFrame;
|
|
|
|
}
|
|
|
|
inline int GetFullbright() const
|
|
|
|
{
|
|
|
|
return Fullbright ? 0x10 /*RF_FULLBRIGHT*/ : 0;
|
|
|
|
}
|
|
|
|
inline int GetTics() const
|
|
|
|
{
|
|
|
|
if (TicRange == 0)
|
|
|
|
{
|
|
|
|
return Tics;
|
|
|
|
}
|
|
|
|
return Tics + pr_statetics.GenRand32() % (TicRange + 1);
|
|
|
|
}
|
|
|
|
inline int GetMisc1() const
|
|
|
|
{
|
|
|
|
return Misc1;
|
|
|
|
}
|
|
|
|
inline int GetMisc2() const
|
|
|
|
{
|
|
|
|
return Misc2;
|
|
|
|
}
|
|
|
|
inline FState *GetNextState() const
|
|
|
|
{
|
|
|
|
return NextState;
|
|
|
|
}
|
|
|
|
inline bool GetNoDelay() const
|
|
|
|
{
|
|
|
|
return NoDelay;
|
|
|
|
}
|
|
|
|
inline bool GetCanRaise() const
|
|
|
|
{
|
|
|
|
return CanRaise;
|
|
|
|
}
|
|
|
|
inline void SetFrame(BYTE frame)
|
|
|
|
{
|
|
|
|
Frame = frame - 'A';
|
|
|
|
}
|
|
|
|
void SetAction(VMFunction *func) { ActionFunc = func; }
|
|
|
|
void ClearAction() { ActionFunc = NULL; }
|
|
|
|
void SetAction(const char *name);
|
2016-06-16 14:11:00 +00:00
|
|
|
bool CallAction(AActor *self, AActor *stateowner, FStateParamInfo *stateinfo, FState **stateret);
|
2016-03-01 15:47:10 +00:00
|
|
|
static PClassActor *StaticFindStateOwner (const FState *state);
|
|
|
|
static PClassActor *StaticFindStateOwner (const FState *state, PClassActor *info);
|
|
|
|
static FRandom pr_statetics;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FStateLabels;
|
|
|
|
struct FStateLabel
|
|
|
|
{
|
|
|
|
FName Label;
|
|
|
|
FState *State;
|
|
|
|
FStateLabels *Children;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FStateLabels
|
|
|
|
{
|
|
|
|
int NumLabels;
|
|
|
|
FStateLabel Labels[1];
|
|
|
|
|
|
|
|
FStateLabel *FindLabel (FName label);
|
|
|
|
|
|
|
|
void Destroy(); // intentionally not a destructor!
|
|
|
|
};
|
|
|
|
|
|
|
|
#include "gametype.h"
|
|
|
|
|
2016-03-22 15:35:41 +00:00
|
|
|
struct DmgFactors : public TMap<FName, double>
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-03-22 15:35:41 +00:00
|
|
|
int Apply(FName type, int damage);
|
2016-03-01 15:47:10 +00:00
|
|
|
};
|
|
|
|
typedef TMap<FName, int> PainChanceList;
|
|
|
|
|
|
|
|
struct DamageTypeDefinition
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DamageTypeDefinition() { Clear(); }
|
|
|
|
|
2016-03-22 15:35:41 +00:00
|
|
|
double DefaultFactor;
|
2016-03-01 15:47:10 +00:00
|
|
|
bool ReplaceFactor;
|
|
|
|
bool NoArmor;
|
|
|
|
|
|
|
|
void Apply(FName type);
|
|
|
|
void Clear()
|
|
|
|
{
|
2016-03-22 15:35:41 +00:00
|
|
|
DefaultFactor = 1.;
|
2016-03-01 15:47:10 +00:00
|
|
|
ReplaceFactor = false;
|
|
|
|
NoArmor = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static DamageTypeDefinition *Get(FName type);
|
|
|
|
static bool IgnoreArmor(FName type);
|
2016-03-22 15:35:41 +00:00
|
|
|
static double GetMobjDamageFactor(FName type, DmgFactors const * const factors);
|
2016-03-01 15:47:10 +00:00
|
|
|
static int ApplyMobjDamageFactor(int damage, FName type, DmgFactors const * const factors);
|
|
|
|
};
|
|
|
|
|
|
|
|
class DDropItem;
|
|
|
|
class PClassPlayerPawn;
|
|
|
|
|
|
|
|
class PClassActor : public PClass
|
|
|
|
{
|
|
|
|
DECLARE_CLASS(PClassActor, PClass);
|
|
|
|
HAS_OBJECT_POINTERS;
|
|
|
|
protected:
|
|
|
|
public:
|
|
|
|
static void StaticInit ();
|
|
|
|
static void StaticSetActorNums ();
|
|
|
|
virtual void DeriveData(PClass *newclass);
|
|
|
|
|
|
|
|
PClassActor();
|
|
|
|
~PClassActor();
|
|
|
|
|
|
|
|
virtual void ReplaceClassRef(PClass *oldclass, PClass *newclass);
|
|
|
|
void BuildDefaults();
|
|
|
|
void ApplyDefaults(BYTE *defaults);
|
|
|
|
void RegisterIDs();
|
2016-03-22 15:35:41 +00:00
|
|
|
void SetDamageFactor(FName type, double factor);
|
2016-03-01 15:47:10 +00:00
|
|
|
void SetPainChance(FName type, int chance);
|
|
|
|
size_t PropagateMark();
|
|
|
|
void InitializeNativeDefaults();
|
2016-10-12 18:42:41 +00:00
|
|
|
bool SetReplacement(FName replaceName);
|
|
|
|
void SetDropItems(DDropItem *drops);
|
|
|
|
virtual void Finalize(FStateDefinitions &statedef);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OwnsState(const FState *state)
|
|
|
|
{
|
|
|
|
return state >= OwnedStates && state < OwnedStates + NumOwnedStates;
|
|
|
|
}
|
|
|
|
|
|
|
|
PClassActor *GetReplacement(bool lookskill=true);
|
|
|
|
PClassActor *GetReplacee(bool lookskill=true);
|
|
|
|
|
|
|
|
FState *OwnedStates;
|
|
|
|
PClassActor *Replacement;
|
|
|
|
PClassActor *Replacee;
|
|
|
|
int NumOwnedStates;
|
|
|
|
BYTE GameFilter;
|
|
|
|
WORD SpawnID;
|
|
|
|
WORD ConversationID;
|
|
|
|
SWORD DoomEdNum;
|
|
|
|
FStateLabels *StateList;
|
|
|
|
DmgFactors *DamageFactors;
|
|
|
|
PainChanceList *PainChances;
|
|
|
|
|
|
|
|
TArray<PClassPlayerPawn *> VisibleToPlayerClass;
|
|
|
|
|
|
|
|
FString Obituary; // Player was killed by this actor
|
|
|
|
FString HitObituary; // Player was killed by this actor in melee
|
2016-03-20 19:55:06 +00:00
|
|
|
double DeathHeight; // Height on normal death
|
|
|
|
double BurnHeight; // Height on burning death
|
2016-03-01 15:47:10 +00:00
|
|
|
PalEntry BloodColor; // Colorized blood
|
|
|
|
int GibHealth; // Negative health below which this monster dies an extreme death
|
|
|
|
int WoundHealth; // Health needed to enter wound state
|
|
|
|
int PoisonDamage; // Amount of poison damage
|
2016-03-19 23:54:18 +00:00
|
|
|
double FastSpeed; // speed in fast mode
|
2016-03-24 20:31:04 +00:00
|
|
|
double RDFactor; // Radius damage factor
|
2016-03-20 19:55:06 +00:00
|
|
|
double CameraHeight; // Height of camera when used as such
|
2016-03-01 15:47:10 +00:00
|
|
|
FSoundID HowlSound; // Sound being played when electrocuted or poisoned
|
|
|
|
FName BloodType; // Blood replacement type
|
|
|
|
FName BloodType2; // Bloopsplatter replacement type
|
|
|
|
FName BloodType3; // AxeBlood replacement type
|
|
|
|
|
|
|
|
DDropItem *DropItems;
|
|
|
|
FString SourceLumpName;
|
2016-04-12 17:44:12 +00:00
|
|
|
FIntCVar *distancecheck;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
// Old Decorate compatibility stuff
|
|
|
|
bool DontHurtShooter;
|
|
|
|
int ExplosionRadius;
|
|
|
|
int ExplosionDamage;
|
|
|
|
int MeleeDamage;
|
|
|
|
FSoundID MeleeSound;
|
|
|
|
FName MissileName;
|
2016-03-20 18:52:35 +00:00
|
|
|
double MissileHeight;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
// For those times when being able to scan every kind of actor is convenient
|
|
|
|
static TArray<PClassActor *> AllActorClasses;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline PClassActor *PClass::FindActor(FName name)
|
|
|
|
{
|
|
|
|
return dyn_cast<PClassActor>(FindClass(name));
|
|
|
|
}
|
|
|
|
|
|
|
|
struct FDoomEdEntry
|
|
|
|
{
|
|
|
|
PClassActor *Type;
|
|
|
|
short Special;
|
|
|
|
signed char ArgsDefined;
|
|
|
|
int Args[5];
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ESpecialMapthings
|
|
|
|
{
|
|
|
|
SMT_Player1Start = 1,
|
|
|
|
SMT_Player2Start,
|
|
|
|
SMT_Player3Start,
|
|
|
|
SMT_Player4Start,
|
|
|
|
SMT_Player5Start,
|
|
|
|
SMT_Player6Start,
|
|
|
|
SMT_Player7Start,
|
|
|
|
SMT_Player8Start,
|
|
|
|
SMT_DeathmatchStart,
|
|
|
|
SMT_SSeqOverride,
|
|
|
|
SMT_PolyAnchor,
|
|
|
|
SMT_PolySpawn,
|
|
|
|
SMT_PolySpawnCrush,
|
|
|
|
SMT_PolySpawnHurt,
|
|
|
|
SMT_SlopeFloorPointLine,
|
|
|
|
SMT_SlopeCeilingPointLine,
|
|
|
|
SMT_SetFloorSlope,
|
|
|
|
SMT_SetCeilingSlope,
|
|
|
|
SMT_VavoomFloor,
|
|
|
|
SMT_VavoomCeiling,
|
|
|
|
SMT_CopyFloorPlane,
|
|
|
|
SMT_CopyCeilingPlane,
|
|
|
|
SMT_VertexFloorZ,
|
|
|
|
SMT_VertexCeilingZ,
|
|
|
|
SMT_EDThing,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef TMap<int, FDoomEdEntry> FDoomEdMap;
|
|
|
|
|
|
|
|
extern FDoomEdMap DoomEdMap;
|
|
|
|
|
|
|
|
void InitActorNumsFromMapinfo();
|
|
|
|
|
|
|
|
|
|
|
|
int GetSpriteIndex(const char * spritename, bool add = true);
|
|
|
|
TArray<FName> &MakeStateNameList(const char * fname);
|
|
|
|
void AddStateLight(FState *state, const char *lname);
|
|
|
|
|
|
|
|
#endif // __INFO_H__
|