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
|
|
|
|
|
|
|
const BYTE SF_FULLBRIGHT = 0x40;
|
|
|
|
|
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
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
struct FState
|
|
|
|
{
|
2008-08-10 14:19:47 +00:00
|
|
|
WORD sprite;
|
|
|
|
SWORD Tics;
|
2009-09-14 22:12:31 +00:00
|
|
|
long Misc1; // Was changed to SBYTE, reverted to long for MBF compat
|
|
|
|
long Misc2; // Was changed to BYTE, reverted to long for MBF compat
|
2006-02-24 04:48:15 +00:00
|
|
|
BYTE Frame;
|
2008-09-22 18:55:29 +00:00
|
|
|
BYTE DefineFlags; // Unused byte so let's use it during state creation.
|
2009-10-25 15:26:19 +00:00
|
|
|
short Light;
|
2006-02-24 04:48:15 +00:00
|
|
|
FState *NextState;
|
2009-09-17 01:36:14 +00:00
|
|
|
VMFunction *ActionFunc;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
inline int GetFrame() const
|
|
|
|
{
|
2008-08-10 14:19:47 +00:00
|
|
|
return Frame & ~(SF_FULLBRIGHT);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
inline int GetFullbright() const
|
|
|
|
{
|
|
|
|
return Frame & SF_FULLBRIGHT ? 0x10 /*RF_FULLBRIGHT*/ : 0;
|
|
|
|
}
|
|
|
|
inline int GetTics() const
|
|
|
|
{
|
2008-08-10 14:19:47 +00:00
|
|
|
return Tics;
|
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;
|
|
|
|
}
|
|
|
|
inline void SetFrame(BYTE frame)
|
|
|
|
{
|
2008-08-10 14:19:47 +00:00
|
|
|
Frame = (Frame & SF_FULLBRIGHT) | (frame-'A');
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2010-02-12 06:04:57 +00:00
|
|
|
void SetAction(VMFunction *func) { ActionFunc = func; }
|
2009-09-17 01:36:14 +00:00
|
|
|
bool CallAction(AActor *self, AActor *stateowner, StateCallData *statecall = NULL);
|
2010-04-03 04:07:17 +00:00
|
|
|
static PClassActor *StaticFindStateOwner (const FState *state);
|
|
|
|
static PClassActor *StaticFindStateOwner (const FState *state, PClassActor *info);
|
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
|
|
|
|
2007-04-28 09:06:32 +00:00
|
|
|
typedef TMap<FName, fixed_t> DmgFactors;
|
2010-03-22 21:18:54 +00:00
|
|
|
typedef TMap<FName, int> PainChanceList;
|
2010-03-25 20:38:00 +00:00
|
|
|
class DDropItem;
|
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();
|
|
|
|
|
|
|
|
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
|
|
|
|
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;
|
|
|
|
BYTE SpawnID;
|
|
|
|
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;
|
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;
|
|
|
|
|
|
|
|
// 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));
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
class FDoomEdMap
|
|
|
|
{
|
|
|
|
public:
|
2006-05-09 03:40:15 +00:00
|
|
|
~FDoomEdMap();
|
|
|
|
|
2010-03-24 02:49:37 +00:00
|
|
|
PClassActor *FindType (int doomednum) const;
|
|
|
|
void AddType (int doomednum, PClassActor *type, bool temporary = false);
|
2006-02-24 04:48:15 +00:00
|
|
|
void DelType (int doomednum);
|
|
|
|
void Empty ();
|
|
|
|
|
|
|
|
static void DumpMapThings ();
|
|
|
|
|
|
|
|
private:
|
|
|
|
enum { DOOMED_HASHSIZE = 256 };
|
|
|
|
|
|
|
|
struct FDoomEdEntry
|
|
|
|
{
|
|
|
|
FDoomEdEntry *HashNext;
|
2010-03-24 02:49:37 +00:00
|
|
|
PClassActor *Type;
|
2006-02-24 04:48:15 +00:00
|
|
|
int DoomEdNum;
|
2008-09-01 19:56:32 +00:00
|
|
|
bool temp;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static FDoomEdEntry *DoomEdHash[DOOMED_HASHSIZE];
|
|
|
|
};
|
|
|
|
|
|
|
|
extern FDoomEdMap DoomEdMap;
|
|
|
|
|
2006-07-13 10:17:56 +00:00
|
|
|
int GetSpriteIndex(const char * spritename);
|
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)
|
|
|
|
// stateowner - Actor this action really belongs to (may be a weapon)
|
|
|
|
// callingstate - State this action was called from
|
|
|
|
// statecall - CustomInventory stuff
|
|
|
|
#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; } \
|
|
|
|
PARAM_POINTER_OPT(statecall, StateCallData) { statecall = NULL; }
|
|
|
|
|
|
|
|
#define PARAM_ACTION_PROLOGUE PARAM_ACTION_PROLOGUE_TYPE(AActor)
|
|
|
|
|
|
|
|
// Number of action paramaters
|
|
|
|
#define NAP 4
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#endif // __INFO_H__
|