2006-02-24 04:48:15 +00:00
|
|
|
/*
|
|
|
|
** info.h
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2007-03-07 17:31:40 +00:00
|
|
|
** Copyright 1998-2007 Randy Heit
|
2006-02-24 04:48:15 +00:00
|
|
|
** 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>
|
2006-04-12 03:03:58 +00:00
|
|
|
#if !defined(_WIN32)
|
2006-02-24 04:48:15 +00:00
|
|
|
#include <inttypes.h> // for intptr_t
|
2006-04-12 03:03:58 +00:00
|
|
|
#elif !defined(_MSC_VER)
|
|
|
|
#include <stdint.h> // for mingw
|
2006-02-24 04:48:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "dobject.h"
|
|
|
|
#include "doomdef.h"
|
2009-09-17 01:36:14 +00:00
|
|
|
#include "vm.h"
|
2010-03-25 20:38:00 +00:00
|
|
|
#include "s_sound.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2012-04-07 12:11:17 +00:00
|
|
|
#include "m_fixed.h"
|
2012-08-23 01:00:30 +00:00
|
|
|
#include "m_random.h"
|
2012-04-07 12:11:17 +00:00
|
|
|
|
2008-08-12 14:30:07 +00:00
|
|
|
struct Baggage;
|
|
|
|
class FScanner;
|
|
|
|
struct FActorInfo;
|
2008-09-15 00:47:31 +00:00
|
|
|
class FArchive;
|
2008-08-12 14:30:07 +00:00
|
|
|
|
2010-04-19 02:46:50 +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)
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
struct FState
|
|
|
|
{
|
2012-08-23 01:00:30 +00:00
|
|
|
FState *NextState;
|
2012-10-17 04:24:54 +00:00
|
|
|
VMFunction *ActionFunc;
|
2008-08-10 14:19:47 +00:00
|
|
|
WORD sprite;
|
|
|
|
SWORD Tics;
|
2012-08-23 01:00:30 +00:00
|
|
|
WORD TicRange;
|
2012-06-16 08:35:51 +00:00
|
|
|
BYTE Frame;
|
2008-09-22 18:55:29 +00:00
|
|
|
BYTE DefineFlags; // Unused byte so let's use it during state creation.
|
2012-08-23 01:00:30 +00:00
|
|
|
int Misc1; // Was changed to SBYTE, reverted to long for MBF compat
|
|
|
|
int Misc2; // Was changed to BYTE, reverted to long for MBF compat
|
2009-10-25 15:26:19 +00:00
|
|
|
short Light;
|
2012-06-16 08:35:51 +00:00
|
|
|
BYTE Fullbright:1; // State is fullbright
|
|
|
|
BYTE SameFrame:1; // Ignore Frame (except when spawning actor)
|
|
|
|
BYTE Fast:1;
|
2013-04-30 04:20:09 +00:00
|
|
|
BYTE NoDelay:1; // Spawn states executes its action normally
|
2014-04-12 10:02:19 +00:00
|
|
|
BYTE CanRaise:1; // Allows a monster to be resurrected without waiting for an infinate frame
|
2014-04-15 19:01:49 +00:00
|
|
|
BYTE Slow:1; // Inverse of fast
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
inline int GetFrame() const
|
|
|
|
{
|
2010-04-19 02:46:50 +00:00
|
|
|
return Frame;
|
|
|
|
}
|
|
|
|
inline bool GetSameFrame() const
|
|
|
|
{
|
|
|
|
return SameFrame;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
inline int GetFullbright() const
|
|
|
|
{
|
2010-04-19 02:46:50 +00:00
|
|
|
return Fullbright ? 0x10 /*RF_FULLBRIGHT*/ : 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
inline int GetTics() const
|
|
|
|
{
|
2012-08-23 01:00:30 +00:00
|
|
|
if (TicRange == 0)
|
|
|
|
{
|
|
|
|
return Tics;
|
|
|
|
}
|
|
|
|
return Tics + pr_statetics.GenRand32() % (TicRange + 1);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
inline int GetMisc1() const
|
|
|
|
{
|
2008-08-10 14:19:47 +00:00
|
|
|
return Misc1;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
inline int GetMisc2() const
|
|
|
|
{
|
|
|
|
return Misc2;
|
|
|
|
}
|
|
|
|
inline FState *GetNextState() const
|
|
|
|
{
|
|
|
|
return NextState;
|
|
|
|
}
|
2013-04-30 04:20:09 +00:00
|
|
|
inline bool GetNoDelay() const
|
|
|
|
{
|
|
|
|
return NoDelay;
|
|
|
|
}
|
2014-04-12 10:02:19 +00:00
|
|
|
inline bool GetCanRaise() const
|
|
|
|
{
|
|
|
|
return CanRaise;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
inline void SetFrame(BYTE frame)
|
|
|
|
{
|
2010-04-19 02:46:50 +00:00
|
|
|
Frame = frame - 'A';
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
void SetAction(VMFunction *func) { ActionFunc = func; }
|
2012-07-17 05:31:41 +00:00
|
|
|
bool CallAction(AActor *self, AActor *stateowner);
|
2010-04-03 04:07:17 +00:00
|
|
|
static PClassActor *StaticFindStateOwner (const FState *state);
|
|
|
|
static PClassActor *StaticFindStateOwner (const FState *state, PClassActor *info);
|
2012-08-23 01:00:30 +00:00
|
|
|
static FRandom pr_statetics;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2006-10-31 14:53:21 +00:00
|
|
|
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!
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
FArchive &operator<< (FArchive &arc, FState *&state);
|
|
|
|
|
2009-03-22 11:37:56 +00:00
|
|
|
#include "gametype.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2012-03-23 01:20:45 +00:00
|
|
|
struct DmgFactors : public TMap<FName, fixed_t>
|
|
|
|
{
|
|
|
|
fixed_t *CheckFactor(FName type);
|
|
|
|
};
|
2010-03-22 21:18:54 +00:00
|
|
|
typedef TMap<FName, int> PainChanceList;
|
2012-04-07 12:11:17 +00:00
|
|
|
|
|
|
|
struct DamageTypeDefinition
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DamageTypeDefinition() { Clear(); }
|
|
|
|
|
|
|
|
fixed_t DefaultFactor;
|
|
|
|
bool ReplaceFactor;
|
|
|
|
bool NoArmor;
|
|
|
|
|
2015-02-07 18:04:43 +00:00
|
|
|
void Apply(FName type);
|
2012-04-07 12:11:17 +00:00
|
|
|
void Clear()
|
|
|
|
{
|
2012-04-07 15:29:47 +00:00
|
|
|
DefaultFactor = FRACUNIT;
|
2012-04-07 12:11:17 +00:00
|
|
|
ReplaceFactor = false;
|
|
|
|
NoArmor = false;
|
|
|
|
}
|
|
|
|
|
2015-02-07 16:02:46 +00:00
|
|
|
static DamageTypeDefinition *Get(FName type);
|
|
|
|
static bool IgnoreArmor(FName type);
|
|
|
|
static int ApplyMobjDamageFactor(int damage, FName type, DmgFactors const * const factors);
|
2012-04-07 12:11:17 +00:00
|
|
|
};
|
|
|
|
|
2010-03-25 20:38:00 +00:00
|
|
|
class DDropItem;
|
2012-07-14 03:04:41 +00:00
|
|
|
class PClassPlayerPawn;
|
2007-04-28 09:06:32 +00:00
|
|
|
|
2010-03-24 02:49:37 +00:00
|
|
|
class PClassActor : public PClass
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-03-24 02:49:37 +00:00
|
|
|
DECLARE_CLASS(PClassActor, PClass);
|
2010-03-25 20:38:00 +00:00
|
|
|
HAS_OBJECT_POINTERS;
|
|
|
|
protected:
|
|
|
|
virtual void Derive(PClass *newclass);
|
2010-03-24 02:49:37 +00:00
|
|
|
public:
|
2006-02-24 04:48:15 +00:00
|
|
|
static void StaticInit ();
|
|
|
|
static void StaticSetActorNums ();
|
|
|
|
|
2010-03-24 02:49:37 +00:00
|
|
|
PClassActor();
|
|
|
|
~PClassActor();
|
|
|
|
|
2016-02-09 22:08:51 +00:00
|
|
|
virtual void ReplaceClassRef(PClass *oldclass, PClass *newclass);
|
2010-03-24 02:49:37 +00:00
|
|
|
void BuildDefaults();
|
|
|
|
void ApplyDefaults(BYTE *defaults);
|
|
|
|
void RegisterIDs();
|
2008-08-23 08:48:19 +00:00
|
|
|
void SetDamageFactor(FName type, fixed_t factor);
|
|
|
|
void SetPainChance(FName type, int chance);
|
2010-03-24 02:49:37 +00:00
|
|
|
size_t PropagateMark();
|
|
|
|
void InitializeNativeDefaults();
|
2006-10-31 14:53:21 +00:00
|
|
|
|
2010-03-24 02:49:37 +00:00
|
|
|
FState *FindState(int numnames, FName *names, bool exact=false) const;
|
2008-09-22 18:55:29 +00:00
|
|
|
FState *FindStateByString(const char *name, bool exact=false);
|
2010-03-24 02:49:37 +00:00
|
|
|
FState *FindState(FName name) const
|
2008-09-22 18:55:29 +00:00
|
|
|
{
|
|
|
|
return FindState(1, &name);
|
|
|
|
}
|
2006-12-16 14:06:21 +00:00
|
|
|
|
2012-04-22 07:23:59 +00:00
|
|
|
bool OwnsState(const FState *state)
|
|
|
|
{
|
|
|
|
return state >= OwnedStates && state < OwnedStates + NumOwnedStates;
|
|
|
|
}
|
|
|
|
|
2010-03-24 02:49:37 +00:00
|
|
|
PClassActor *GetReplacement(bool lookskill=true);
|
|
|
|
PClassActor *GetReplacee(bool lookskill=true);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
FState *OwnedStates;
|
2010-03-24 02:49:37 +00:00
|
|
|
PClassActor *Replacement;
|
|
|
|
PClassActor *Replacee;
|
2006-02-24 04:48:15 +00:00
|
|
|
int NumOwnedStates;
|
|
|
|
BYTE GameFilter;
|
2015-04-04 22:31:15 +00:00
|
|
|
WORD SpawnID;
|
|
|
|
WORD ConversationID;
|
2006-02-24 04:48:15 +00:00
|
|
|
SWORD DoomEdNum;
|
2010-03-24 02:49:37 +00:00
|
|
|
FStateLabels *StateList;
|
2007-04-28 09:06:32 +00:00
|
|
|
DmgFactors *DamageFactors;
|
2010-03-24 02:49:37 +00:00
|
|
|
PainChanceList *PainChances;
|
2012-07-14 03:04:41 +00:00
|
|
|
|
|
|
|
TArray<PClassPlayerPawn *> VisibleToPlayerClass;
|
|
|
|
TArray<PClassPlayerPawn *> RestrictedToPlayerClass;
|
|
|
|
TArray<PClassPlayerPawn *> ForbiddenToPlayerClass;
|
|
|
|
|
2010-03-25 20:38:00 +00:00
|
|
|
FString Obituary; // Player was killed by this actor
|
|
|
|
FString HitObituary; // Player was killed by this actor in melee
|
|
|
|
fixed_t DeathHeight; // Height on normal death
|
|
|
|
fixed_t BurnHeight; // Height on burning death
|
|
|
|
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
|
|
|
|
fixed_t FastSpeed; // Speed in fast mode
|
|
|
|
fixed_t RDFactor; // Radius damage factor
|
|
|
|
fixed_t CameraHeight; // Height of camera when used as such
|
|
|
|
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;
|
2010-09-16 03:14:32 +00:00
|
|
|
FString SourceLumpName;
|
2010-03-25 20:38:00 +00:00
|
|
|
|
|
|
|
// Old Decorate compatibility stuff
|
|
|
|
bool DontHurtShooter;
|
|
|
|
int ExplosionRadius;
|
|
|
|
int ExplosionDamage;
|
|
|
|
int MeleeDamage;
|
|
|
|
FSoundID MeleeSound;
|
|
|
|
FName MissileName;
|
|
|
|
fixed_t MissileHeight;
|
2010-04-16 02:57:51 +00:00
|
|
|
|
|
|
|
// For those times when being able to scan every kind of actor is convenient
|
|
|
|
static TArray<PClassActor *> AllActorClasses;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2010-03-24 02:49:37 +00:00
|
|
|
inline PClassActor *PClass::FindActor(FName name)
|
|
|
|
{
|
|
|
|
return dyn_cast<PClassActor>(FindClass(name));
|
|
|
|
}
|
|
|
|
|
2015-04-03 14:51:45 +00:00
|
|
|
struct FDoomEdEntry
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2015-04-28 10:48:33 +00:00
|
|
|
PClassActor *Type;
|
2015-04-07 14:27:57 +00:00
|
|
|
short Special;
|
2016-01-04 10:52:07 +00:00
|
|
|
signed char ArgsDefined;
|
2015-04-03 14:51:45 +00:00
|
|
|
int Args[5];
|
|
|
|
};
|
2006-05-09 03:40:15 +00:00
|
|
|
|
2015-04-03 19:17:10 +00:00
|
|
|
enum ESpecialMapthings
|
|
|
|
{
|
2015-04-04 08:25:01 +00:00
|
|
|
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,
|
2016-02-05 22:51:28 +00:00
|
|
|
SMT_EDThing,
|
2015-04-04 08:25:01 +00:00
|
|
|
|
2015-04-03 19:17:10 +00:00
|
|
|
};
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
|
2015-04-03 14:51:45 +00:00
|
|
|
typedef TMap<int, FDoomEdEntry> FDoomEdMap;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2015-04-03 14:51:45 +00:00
|
|
|
extern FDoomEdMap DoomEdMap;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2015-04-03 14:51:45 +00:00
|
|
|
void InitActorNumsFromMapinfo();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
|
2011-07-04 20:22:55 +00:00
|
|
|
int GetSpriteIndex(const char * spritename, bool add = true);
|
2008-09-22 18:55:29 +00:00
|
|
|
TArray<FName> &MakeStateNameList(const char * fname);
|
2009-10-25 15:26:19 +00:00
|
|
|
void AddStateLight(FState *state, const char *lname);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-02-12 06:04:57 +00:00
|
|
|
// Standard parameters for all action functons
|
|
|
|
// self - Actor this action is to operate on (player if a weapon)
|
2012-07-17 05:31:41 +00:00
|
|
|
// stateowner - Actor this action really belongs to (may be an item)
|
2010-02-12 06:04:57 +00:00
|
|
|
// callingstate - State this action was called from
|
|
|
|
#define PARAM_ACTION_PROLOGUE_TYPE(type) \
|
|
|
|
PARAM_PROLOGUE; \
|
|
|
|
PARAM_OBJECT (self, type); \
|
|
|
|
PARAM_OBJECT_OPT (stateowner, AActor) { stateowner = self; } \
|
|
|
|
PARAM_STATE_OPT (callingstate) { callingstate = NULL; } \
|
|
|
|
|
|
|
|
#define PARAM_ACTION_PROLOGUE PARAM_ACTION_PROLOGUE_TYPE(AActor)
|
|
|
|
|
|
|
|
// Number of action paramaters
|
2012-07-17 05:31:41 +00:00
|
|
|
#define NAP 3
|
2010-02-12 06:04:57 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#endif // __INFO_H__
|