mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-22 18:30:27 +01:00
209 lines
7.3 KiB
C
209 lines
7.3 KiB
C
// common headers for flesh entity classes
|
|
|
|
#include <Entities/Debris.h> /* rcg10062001 need enum definition... */
|
|
#include <Entities/KeyItem.h> /* rcg10062001 need enum definition... */
|
|
|
|
#define SURFACE_SAND 9
|
|
#define SURFACE_WATER 12
|
|
#define SURFACE_RED_SAND 13
|
|
|
|
// Max ammo
|
|
#define MAX_BULLETS INDEX(500)
|
|
#define MAX_SHELLS INDEX(100)
|
|
#define MAX_ROCKETS INDEX(50)
|
|
#define MAX_GRENADES INDEX(50)
|
|
//#define MAX_NAPALM INDEX(250)
|
|
#define MAX_ELECTRICITY INDEX(400)
|
|
#define MAX_IRONBALLS INDEX(30)
|
|
//#define MAX_NUKEBALLS INDEX(3)
|
|
|
|
// Bit shifters for ammo
|
|
#define AMMO_BULLETS 0
|
|
#define AMMO_SHELLS 1
|
|
#define AMMO_ROCKETS 2
|
|
#define AMMO_GRENADES 3
|
|
//#define AMMO_NAPALM 4
|
|
#define AMMO_ELECTRICITY 5
|
|
//#define AMMO_NUKEBALLS 6
|
|
#define AMMO_IRONBALLS 7
|
|
|
|
|
|
// Ammo mana Value
|
|
#define AV_SHELLS INDEX(70)
|
|
#define AV_BULLETS INDEX(10)
|
|
#define AV_ROCKETS INDEX(150)
|
|
#define AV_GRENADES INDEX(150)
|
|
#define AV_ELECTRICITY INDEX(250)
|
|
#define AV_IRONBALLS INDEX(700)
|
|
//#define AV_NUKEBALLS INDEX(1800)
|
|
//#define AV_NAPALM INDEX(200)
|
|
|
|
enum EmptyShellType {
|
|
ESL_BULLET = 0,
|
|
ESL_SHOTGUN = 1,
|
|
ESL_BUBBLE = 2,
|
|
ESL_BULLET_SMOKE = 3,
|
|
ESL_SHOTGUN_SMOKE = 4,
|
|
ESL_COLT_SMOKE = 5,
|
|
};
|
|
// empty shell launch info
|
|
#define MAX_FLYING_SHELLS 32
|
|
struct ShellLaunchData {
|
|
FLOAT sld_fSize; // size multiplier
|
|
FLOAT3D sld_vPos; // launch position
|
|
FLOAT3D sld_vSpeed; // launch speed
|
|
FLOAT3D sld_vUp; // up vector in moment of launch
|
|
FLOAT sld_tmLaunch; // time of launch
|
|
EmptyShellType sld_estType; // shell type
|
|
};
|
|
#define ShellLaunchData_array m_asldData[MAX_FLYING_SHELLS]
|
|
|
|
// world change
|
|
struct WorldChange {
|
|
CTString strGroup; // group name
|
|
CPlacement3D plLink; // link placement for relative change
|
|
INDEX iType; // change type
|
|
};
|
|
extern struct WorldChange _SwcWorldChange;
|
|
|
|
// entity info
|
|
struct EntityInfo {
|
|
EntityInfoBodyType Eeibt; // body type
|
|
FLOAT fMass; // mass (in kg)
|
|
FLOAT vSourceCenter[3]; // body point (offset from handle) when entity look another entity
|
|
FLOAT vTargetCenter[3]; // body point (offset from handle) when entity is target of look
|
|
};
|
|
|
|
// entity info
|
|
struct EntityStats {
|
|
CTString es_strName;
|
|
INDEX es_ctCount;
|
|
INDEX es_ctAmmount;
|
|
FLOAT es_fValue;
|
|
INDEX es_iScore;
|
|
inline void Clear() { es_strName.Clear(); }
|
|
};
|
|
|
|
// statistics data for player stats management
|
|
struct DECL_DLL PlayerStats {
|
|
INDEX ps_iScore;
|
|
INDEX ps_iKills;
|
|
INDEX ps_iDeaths;
|
|
INDEX ps_iSecrets;
|
|
TIME ps_tmTime;
|
|
|
|
PlayerStats(void): ps_iScore(0), ps_iKills(0), ps_iDeaths(0), ps_iSecrets(0), ps_tmTime(0.0f){}
|
|
};
|
|
|
|
// get info position for entity
|
|
DECL_DLL void GetEntityInfoPosition(CEntity *pen, FLOAT *pf, FLOAT3D &vPos);
|
|
// get source and target positions for ray cast
|
|
DECL_DLL void GetPositionCastRay(CEntity *penSource, CEntity *penTarget, FLOAT3D &vSource, FLOAT3D &vTarget);
|
|
|
|
// set bool from bool enum type
|
|
DECL_DLL void SetBoolFromBoolEType(BOOL &bSet, BoolEType bet);
|
|
// send event to target
|
|
DECL_DLL void SendToTarget(CEntity *penSendEvent, EventEType eetEventType, CEntity *penCaused = NULL);
|
|
// send event in range
|
|
DECL_DLL void SendInRange(CEntity *penSource, EventEType eetEventType, const FLOATaabbox3D &boxRange);
|
|
|
|
// spawn reminder
|
|
DECL_DLL CEntityPointer SpawnReminder(CEntity *penOwner, FLOAT fWaitTime, INDEX iValue);
|
|
// spawn flame
|
|
//CEntityPointer SpawnFlame(CEntity *penOwner, CEntity *penAttach, const FLOAT3D &vSource);
|
|
|
|
// Set components
|
|
DECL_DLL void SetComponents(CEntity *pen, CModelObject &mo, ULONG ulIDModel, ULONG ulIDTexture,
|
|
ULONG ulIDReflectionTexture, ULONG ulIDSpecularTexture, ULONG ulIDBumpTexture);
|
|
// Add attachment to model
|
|
DECL_DLL void AddAttachmentToModel(CEntity *pen, CModelObject &mo, INDEX iAttachment, ULONG ulIDModel, ULONG ulIDTexture,
|
|
ULONG ulIDReflectionTexture, ULONG ulIDSpecularTexture, ULONG ulIDBumpTexture);
|
|
// Remove attachment from model
|
|
DECL_DLL void RemoveAttachmentFromModel(CModelObject &mo, INDEX iAttachment);
|
|
|
|
// Kick entity
|
|
DECL_DLL void KickEntity(CEntity *penTarget, FLOAT3D vSpeed);
|
|
|
|
|
|
// lens flare variables
|
|
extern CLensFlareType _lftStandard;
|
|
extern CLensFlareType _lftStandardReflections;
|
|
extern CLensFlareType _lftYellowStarRedRing;
|
|
extern CLensFlareType _lftYellowStarRedRingFar;
|
|
extern CLensFlareType _lftWhiteGlowStarRedRing;
|
|
extern CLensFlareType _lftWhiteGlowStar;
|
|
extern CLensFlareType _lftWhiteGlowStarNG;
|
|
extern CLensFlareType _lftWhiteStarRedRingStreaks;
|
|
extern CLensFlareType _lftWhiteStarRedReflections;
|
|
extern CLensFlareType _lftBlueStarBlueReflections;
|
|
extern CLensFlareType _lftProjectileStarGlow;
|
|
extern CLensFlareType _lftProjectileWhiteBubbleGlow;
|
|
extern CLensFlareType _lftProjectileYellowBubbleGlow;
|
|
extern CLensFlareType _lftPVSpaceShipWindowFlare;
|
|
extern CLensFlareType _lftCatmanFireGlow;
|
|
extern CLensFlareType _lftWhiteGlowFar;
|
|
// init lens flare effects
|
|
void InitLensFlares(void);
|
|
// close lens flares effects
|
|
void CloseLensFlares(void);
|
|
|
|
DECL_DLL BOOL SetPlayerAppearance(CModelObject *mo, CPlayerCharacter *ppc, CTString &strName, BOOL bPreview);
|
|
|
|
// debugging functions
|
|
DECL_DLL const char *PrintConsole(void);
|
|
DECL_DLL const char *PrintStack(CEntity *pen);
|
|
|
|
// debris spawning
|
|
DECL_DLL void Debris_Begin(
|
|
EntityInfoBodyType Eeibt,
|
|
enum DebrisParticlesType dptParticles,
|
|
enum BasicEffectType betStain,
|
|
FLOAT fEntitySize, // entity size in meters
|
|
const FLOAT3D &vSpeed,
|
|
const FLOAT3D &vSpawnerSpeed, // how fast was the entity moving
|
|
const FLOAT fConeSize, // size multiplier for debris cone
|
|
const FLOAT fSpeedUp, // size multiplier for debris catapulting up (0-no multiply)
|
|
const COLOR colDebris=C_WHITE // multiply color
|
|
);
|
|
DECL_DLL CEntityPointer Debris_Spawn(
|
|
CEntity *penSpawner,
|
|
CEntity *penComponents,
|
|
SLONG idModelComponent,
|
|
SLONG idTextureComponent,
|
|
SLONG idReflectionTextureComponent,
|
|
SLONG idSpecularTextureComponent,
|
|
SLONG idBumpTextureComponent,
|
|
INDEX iModelAnim,
|
|
FLOAT fSize, // size relative to entity size (or 0 for absolute stretch of 1)
|
|
const FLOAT3D &vPosRatio);
|
|
|
|
// get default entity info for given body type
|
|
DECL_DLL EntityInfo *GetStdEntityInfo(EntityInfoBodyType eibt);
|
|
// damage control functions
|
|
DECL_DLL FLOAT DamageStrength(EntityInfoBodyType eibtBody, enum DamageType dtDamage);
|
|
|
|
// Print center screen message
|
|
DECL_DLL void PrintCenterMessage(CEntity *penThis, CEntity *penTarget,
|
|
const CTString &strMessage, TIME tmLength, enum MessageSound mssSound);
|
|
|
|
// get name of a key item
|
|
DECL_DLL const char *GetKeyName(enum KeyItemType kit);
|
|
|
|
// get session properties
|
|
DECL_DLL inline const CSessionProperties *GetSP(void)
|
|
{
|
|
return ((const CSessionProperties *)_pNetwork->GetSessionProperties());
|
|
}
|
|
|
|
// i.e. weapon sound when fireing or exploding
|
|
DECL_DLL void SpawnRangeSound( CEntity *penPlayer, CEntity *penPos, enum SoundType st, FLOAT fRange);
|
|
|
|
// get some player for trigger source if any is existing
|
|
DECL_DLL CEntity *FixupCausedToPlayer(CEntity *penThis, CEntity *penCaused, BOOL bWarning=TRUE);
|
|
|
|
// precisely lerp between two placement using quaternions
|
|
DECL_DLL CPlacement3D LerpPlacementsPrecise(const CPlacement3D &pl0, const CPlacement3D &pl1, FLOAT fRatio);
|
|
|
|
// obtain game extra damage per enemy and per player
|
|
DECL_DLL FLOAT GetGameDamageMultiplier(void);
|