reorder folders
This commit is contained in:
102
src/engine/custom.h
Normal file
102
src/engine/custom.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 1999, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
// Customization.h
|
||||
|
||||
#ifndef CUSTOM_H
|
||||
#define CUSTOM_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "const.h"
|
||||
|
||||
#define MAX_QPATH 64 // Must match value in quakedefs.h
|
||||
|
||||
/////////////////
|
||||
// Customization
|
||||
// passed to pfnPlayerCustomization
|
||||
// For automatic downloading.
|
||||
typedef enum
|
||||
{
|
||||
t_sound = 0,
|
||||
t_skin,
|
||||
t_model,
|
||||
t_decal,
|
||||
t_generic,
|
||||
t_eventscript
|
||||
} resourcetype_t;
|
||||
|
||||
// Fake type for world
|
||||
#define t_world 6
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int size;
|
||||
} _resourceinfo_t;
|
||||
|
||||
typedef struct resourceinfo_s
|
||||
{
|
||||
_resourceinfo_t info[ 7 ];
|
||||
} resourceinfo_t;
|
||||
|
||||
#define RES_FATALIFMISSING (1<<0) // Disconnect if we can't get this file.
|
||||
#define RES_WASMISSING (1<<1) // Do we have the file locally, did we get it ok?
|
||||
#define RES_CUSTOM (1<<2) // Is this resource one that corresponds to another player's customization
|
||||
// or is it a server startup resource.
|
||||
#define RES_REQUESTED (1<<3) // Already requested a download of this one
|
||||
#define RES_PRECACHED (1<<4) // Already precached
|
||||
|
||||
#include "crc.h"
|
||||
|
||||
typedef struct resource_s
|
||||
{
|
||||
char szFileName[MAX_QPATH]; // File name to download/precache.
|
||||
resourcetype_t type; // t_sound, t_skin, t_model, t_decal.
|
||||
int nIndex; // For t_decals
|
||||
int nDownloadSize; // Size in Bytes if this must be downloaded.
|
||||
unsigned char ucFlags;
|
||||
|
||||
// For handling client to client resource propagation
|
||||
unsigned char rgucMD5_hash[16]; // To determine if we already have it.
|
||||
unsigned char playernum; // Which player index this resource is associated with, if it's a custom resource.
|
||||
|
||||
unsigned char rguc_reserved[ 32 ]; // For future expansion
|
||||
struct resource_s *pNext; // Next in chain.
|
||||
struct resource_s *pPrev;
|
||||
} resource_t;
|
||||
|
||||
typedef struct customization_s
|
||||
{
|
||||
qboolean bInUse; // Is this customization in use;
|
||||
resource_t resource; // The resource_t for this customization
|
||||
qboolean bTranslated; // Has the raw data been translated into a useable format?
|
||||
// (e.g., raw decal .wad make into texture_t *)
|
||||
int nUserData1; // Customization specific data
|
||||
int nUserData2; // Customization specific data
|
||||
void *pInfo; // Buffer that holds the data structure that references the data (e.g., the cachewad_t)
|
||||
void *pBuffer; // Buffer that holds the data for the customization (the raw .wad data)
|
||||
struct customization_s *pNext; // Next in chain
|
||||
} customization_t;
|
||||
|
||||
#define FCUST_FROMHPAK ( 1<<0 )
|
||||
#define FCUST_WIPEDATA ( 1<<1 )
|
||||
#define FCUST_IGNOREINIT ( 1<<2 )
|
||||
|
||||
void COM_ClearCustomizationList( struct customization_s *pHead, qboolean bCleanDecals);
|
||||
qboolean COM_CreateCustomization( struct customization_s *pListHead, struct resource_s *pResource, int playernumber, int flags,
|
||||
struct customization_s **pCustomization, int *nLumps );
|
||||
int COM_SizeofResourceList ( struct resource_s *pList, struct resourceinfo_s *ri );
|
||||
|
||||
#endif // CUSTOM_H
|
||||
38
src/engine/customentity.h
Normal file
38
src/engine/customentity.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#ifndef CUSTOMENTITY_H
|
||||
#define CUSTOMENTITY_H
|
||||
|
||||
// Custom Entities
|
||||
|
||||
// Start/End Entity is encoded as 12 bits of entity index, and 4 bits of attachment (4:12)
|
||||
#define BEAMENT_ENTITY(x) ((x)&0xFFF)
|
||||
#define BEAMENT_ATTACHMENT(x) (((x)>>12)&0xF)
|
||||
|
||||
// Beam types, encoded as a byte
|
||||
enum
|
||||
{
|
||||
BEAM_POINTS = 0,
|
||||
BEAM_ENTPOINT,
|
||||
BEAM_ENTS,
|
||||
BEAM_HOSE,
|
||||
};
|
||||
|
||||
#define BEAM_FSINE 0x10
|
||||
#define BEAM_FSOLID 0x20
|
||||
#define BEAM_FSHADEIN 0x40
|
||||
#define BEAM_FSHADEOUT 0x80
|
||||
|
||||
#endif //CUSTOMENTITY_H
|
||||
29
src/engine/edict.h
Normal file
29
src/engine/edict.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#if !defined EDICT_H
|
||||
#define EDICT_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
#define MAX_ENT_LEAFS 48
|
||||
|
||||
#include "progdefs.h"
|
||||
|
||||
struct edict_s
|
||||
{
|
||||
qboolean free;
|
||||
int serialnumber;
|
||||
link_t area; // linked to a division node or leaf
|
||||
|
||||
int headnode; // -1 to use normal leaf check
|
||||
int num_leafs;
|
||||
short leafnums[MAX_ENT_LEAFS];
|
||||
|
||||
float freetime; // sv.time when the object was freed
|
||||
|
||||
void* pvPrivateData; // Alloced and freed by engine, used by DLLs
|
||||
|
||||
entvars_t v; // C exported fields from progs
|
||||
|
||||
// other fields from progs come immediately after
|
||||
};
|
||||
|
||||
#endif
|
||||
493
src/engine/eiface.h
Normal file
493
src/engine/eiface.h
Normal file
@@ -0,0 +1,493 @@
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#ifndef EIFACE_H
|
||||
#define EIFACE_H
|
||||
|
||||
#ifdef HLDEMO_BUILD
|
||||
#define INTERFACE_VERSION 001
|
||||
#else // !HLDEMO_BUILD, i.e., regular version of HL
|
||||
#define INTERFACE_VERSION 140
|
||||
#endif // !HLDEMO_BUILD
|
||||
|
||||
#include <stdio.h>
|
||||
#include "custom.h"
|
||||
#include "cvardef.h"
|
||||
//
|
||||
// Defines entity interface between engine and DLLs.
|
||||
// This header file included by engine files and DLL files.
|
||||
//
|
||||
// Before including this header, DLLs must:
|
||||
// include progdefs.h
|
||||
// This is conveniently done for them in extdll.h
|
||||
//
|
||||
|
||||
#ifdef _WIN32
|
||||
#define DLLEXPORT __stdcall
|
||||
#else
|
||||
#define DLLEXPORT /* */
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
at_notice,
|
||||
at_console, // same as at_notice, but forces a ConPrintf, not a message box
|
||||
at_aiconsole, // same as at_console, but only shown if developer level is 2!
|
||||
at_warning,
|
||||
at_error,
|
||||
at_logged // Server print to console ( only in multiplayer games ).
|
||||
} ALERT_TYPE;
|
||||
|
||||
// 4-22-98 JOHN: added for use in pfnClientPrintf
|
||||
typedef enum
|
||||
{
|
||||
print_console,
|
||||
print_center,
|
||||
print_chat,
|
||||
} PRINT_TYPE;
|
||||
|
||||
// For integrity checking of content on clients
|
||||
typedef enum
|
||||
{
|
||||
force_exactfile, // File on client must exactly match server's file
|
||||
force_model_samebounds, // For model files only, the geometry must fit in the same bbox
|
||||
force_model_specifybounds, // For model files only, the geometry must fit in the specified bbox
|
||||
} FORCE_TYPE;
|
||||
|
||||
// Returned by TraceLine
|
||||
typedef struct
|
||||
{
|
||||
int fAllSolid; // if true, plane is not valid
|
||||
int fStartSolid; // if true, the initial point was in a solid area
|
||||
int fInOpen;
|
||||
int fInWater;
|
||||
float flFraction; // time completed, 1.0 = didn't hit anything
|
||||
vec3_t vecEndPos; // final position
|
||||
float flPlaneDist;
|
||||
vec3_t vecPlaneNormal; // surface normal at impact
|
||||
edict_t *pHit; // entity the surface is on
|
||||
int iHitgroup; // 0 == generic, non zero is specific body part
|
||||
} TraceResult;
|
||||
|
||||
// CD audio status
|
||||
typedef struct
|
||||
{
|
||||
int fPlaying;// is sound playing right now?
|
||||
int fWasPlaying;// if not, CD is paused if WasPlaying is true.
|
||||
int fInitialized;
|
||||
int fEnabled;
|
||||
int fPlayLooping;
|
||||
float cdvolume;
|
||||
//BYTE remap[100];
|
||||
int fCDRom;
|
||||
int fPlayTrack;
|
||||
} CDStatus;
|
||||
|
||||
#include "../common/crc.h"
|
||||
|
||||
// Engine hands this to DLLs for functionality callbacks
|
||||
typedef struct enginefuncs_s
|
||||
{
|
||||
int (*pfnPrecacheModel) (char* s);
|
||||
int (*pfnPrecacheSound) (char* s);
|
||||
void (*pfnSetModel) (edict_t *e, const char *m);
|
||||
int (*pfnModelIndex) (const char *m);
|
||||
int (*pfnModelFrames) (int modelIndex);
|
||||
void (*pfnSetSize) (edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
void (*pfnChangeLevel) (char* s1, char* s2);
|
||||
void (*pfnGetSpawnParms) (edict_t *ent);
|
||||
void (*pfnSaveSpawnParms) (edict_t *ent);
|
||||
float (*pfnVecToYaw) (const float *rgflVector);
|
||||
void (*pfnVecToAngles) (const float *rgflVectorIn, float *rgflVectorOut);
|
||||
void (*pfnMoveToOrigin) (edict_t *ent, const float *pflGoal, float dist, int iMoveType);
|
||||
void (*pfnChangeYaw) (edict_t* ent);
|
||||
void (*pfnChangePitch) (edict_t* ent);
|
||||
edict_t* (*pfnFindEntityByString) (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
|
||||
int (*pfnGetEntityIllum) (edict_t* pEnt);
|
||||
edict_t* (*pfnFindEntityInSphere) (edict_t *pEdictStartSearchAfter, const float *org, float rad);
|
||||
edict_t* (*pfnFindClientInPVS) (edict_t *pEdict);
|
||||
edict_t* (*pfnEntitiesInPVS) (edict_t *pplayer);
|
||||
void (*pfnMakeVectors) (const float *rgflVector);
|
||||
void (*pfnAngleVectors) (const float *rgflVector, float *forward, float *right, float *up);
|
||||
edict_t* (*pfnCreateEntity) (void);
|
||||
void (*pfnRemoveEntity) (edict_t* e);
|
||||
edict_t* (*pfnCreateNamedEntity) (int className);
|
||||
void (*pfnMakeStatic) (edict_t *ent);
|
||||
int (*pfnEntIsOnFloor) (edict_t *e);
|
||||
int (*pfnDropToFloor) (edict_t* e);
|
||||
int (*pfnWalkMove) (edict_t *ent, float yaw, float dist, int iMode);
|
||||
void (*pfnSetOrigin) (edict_t *e, const float *rgflOrigin);
|
||||
void (*pfnEmitSound) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch);
|
||||
void (*pfnEmitAmbientSound) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);
|
||||
void (*pfnTraceLine) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
|
||||
void (*pfnTraceToss) (edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr);
|
||||
int (*pfnTraceMonsterHull) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
|
||||
void (*pfnTraceHull) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);
|
||||
void (*pfnTraceModel) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);
|
||||
const char *(*pfnTraceTexture) (edict_t *pTextureEntity, const float *v1, const float *v2 );
|
||||
void (*pfnTraceSphere) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
|
||||
void (*pfnGetAimVector) (edict_t* ent, float speed, float *rgflReturn);
|
||||
void (*pfnServerCommand) (char* str);
|
||||
void (*pfnServerExecute) (void);
|
||||
void (*pfnClientCommand) (edict_t* pEdict, char* szFmt, ...);
|
||||
void (*pfnParticleEffect) (const float *org, const float *dir, float color, float count);
|
||||
void (*pfnLightStyle) (int style, char* val);
|
||||
int (*pfnDecalIndex) (const char *name);
|
||||
int (*pfnPointContents) (const float *rgflVector);
|
||||
void (*pfnMessageBegin) (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
|
||||
void (*pfnMessageEnd) (void);
|
||||
void (*pfnWriteByte) (int iValue);
|
||||
void (*pfnWriteChar) (int iValue);
|
||||
void (*pfnWriteShort) (int iValue);
|
||||
void (*pfnWriteLong) (int iValue);
|
||||
void (*pfnWriteAngle) (float flValue);
|
||||
void (*pfnWriteCoord) (float flValue);
|
||||
void (*pfnWriteString) (const char *sz);
|
||||
void (*pfnWriteEntity) (int iValue);
|
||||
void (*pfnCVarRegister) (cvar_t *pCvar);
|
||||
float (*pfnCVarGetFloat) (const char *szVarName);
|
||||
const char* (*pfnCVarGetString) (const char *szVarName);
|
||||
void (*pfnCVarSetFloat) (const char *szVarName, float flValue);
|
||||
void (*pfnCVarSetString) (const char *szVarName, const char *szValue);
|
||||
void (*pfnAlertMessage) (ALERT_TYPE atype, char *szFmt, ...);
|
||||
void (*pfnEngineFprintf) (FILE *pfile, char *szFmt, ...);
|
||||
void* (*pfnPvAllocEntPrivateData) (edict_t *pEdict, long cb);
|
||||
void* (*pfnPvEntPrivateData) (edict_t *pEdict);
|
||||
void (*pfnFreeEntPrivateData) (edict_t *pEdict);
|
||||
const char* (*pfnSzFromIndex) (int iString);
|
||||
int (*pfnAllocString) (const char *szValue);
|
||||
struct entvars_s* (*pfnGetVarsOfEnt) (edict_t *pEdict);
|
||||
edict_t* (*pfnPEntityOfEntOffset) (int iEntOffset);
|
||||
int (*pfnEntOffsetOfPEntity) (const edict_t *pEdict);
|
||||
int (*pfnIndexOfEdict) (const edict_t *pEdict);
|
||||
edict_t* (*pfnPEntityOfEntIndex) (int iEntIndex);
|
||||
edict_t* (*pfnFindEntityByVars) (struct entvars_s* pvars);
|
||||
void* (*pfnGetModelPtr) (edict_t* pEdict);
|
||||
int (*pfnRegUserMsg) (const char *pszName, int iSize);
|
||||
void (*pfnAnimationAutomove) (const edict_t* pEdict, float flTime);
|
||||
void (*pfnGetBonePosition) (const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
|
||||
unsigned long (*pfnFunctionFromName) ( const char *pName );
|
||||
const char *(*pfnNameForFunction) ( unsigned long function );
|
||||
void (*pfnClientPrintf) ( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients
|
||||
void (*pfnServerPrint) ( const char *szMsg );
|
||||
const char *(*pfnCmd_Args) ( void ); // these 3 added
|
||||
const char *(*pfnCmd_Argv) ( int argc ); // so game DLL can easily
|
||||
int (*pfnCmd_Argc) ( void ); // access client 'cmd' strings
|
||||
void (*pfnGetAttachment) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );
|
||||
void (*pfnCRC32_Init) (CRC32_t *pulCRC);
|
||||
void (*pfnCRC32_ProcessBuffer) (CRC32_t *pulCRC, void *p, int len);
|
||||
void (*pfnCRC32_ProcessByte) (CRC32_t *pulCRC, unsigned char ch);
|
||||
CRC32_t (*pfnCRC32_Final) (CRC32_t pulCRC);
|
||||
long (*pfnRandomLong) (long lLow, long lHigh);
|
||||
float (*pfnRandomFloat) (float flLow, float flHigh);
|
||||
void (*pfnSetView) (const edict_t *pClient, const edict_t *pViewent );
|
||||
float (*pfnTime) ( void );
|
||||
void (*pfnCrosshairAngle) (const edict_t *pClient, float pitch, float yaw);
|
||||
byte * (*pfnLoadFileForMe) (char *filename, int *pLength);
|
||||
void (*pfnFreeFile) (void *buffer);
|
||||
void (*pfnEndSection) (const char *pszSectionName); // trigger_endsection
|
||||
int (*pfnCompareFileTime) (char *filename1, char *filename2, int *iCompare);
|
||||
void (*pfnGetGameDir) (char *szGetGameDir);
|
||||
void (*pfnCvar_RegisterVariable) (cvar_t *variable);
|
||||
void (*pfnFadeClientVolume) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
|
||||
void (*pfnSetClientMaxspeed) (const edict_t *pEdict, float fNewMaxspeed);
|
||||
edict_t * (*pfnCreateFakeClient) (const char *netname); // returns NULL if fake client can't be created
|
||||
void (*pfnRunPlayerMove) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );
|
||||
int (*pfnNumberOfEntities) (void);
|
||||
char* (*pfnGetInfoKeyBuffer) (edict_t *e); // passing in NULL gets the serverinfo
|
||||
char* (*pfnInfoKeyValue) (char *infobuffer, char *key);
|
||||
void (*pfnSetKeyValue) (char *infobuffer, char *key, char *value);
|
||||
void (*pfnSetClientKeyValue) (int clientIndex, char *infobuffer, char *key, char *value);
|
||||
int (*pfnIsMapValid) (char *filename);
|
||||
void (*pfnStaticDecal) ( const float *origin, int decalIndex, int entityIndex, int modelIndex );
|
||||
int (*pfnPrecacheGeneric) (char* s);
|
||||
int (*pfnGetPlayerUserId) (edict_t *e ); // returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients
|
||||
void (*pfnBuildSoundMsg) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
|
||||
int (*pfnIsDedicatedServer) (void);// is this a dedicated server?
|
||||
cvar_t *(*pfnCVarGetPointer) (const char *szVarName);
|
||||
unsigned int (*pfnGetPlayerWONId) (edict_t *e); // returns the server assigned WONid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients
|
||||
|
||||
// YWB 8/1/99 TFF Physics additions
|
||||
void (*pfnInfo_RemoveKey) ( char *s, const char *key );
|
||||
const char *(*pfnGetPhysicsKeyValue) ( const edict_t *pClient, const char *key );
|
||||
void (*pfnSetPhysicsKeyValue) ( const edict_t *pClient, const char *key, const char *value );
|
||||
const char *(*pfnGetPhysicsInfoString) ( const edict_t *pClient );
|
||||
unsigned short (*pfnPrecacheEvent) ( int type, const char*psz );
|
||||
void (*pfnPlaybackEvent) ( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
||||
|
||||
unsigned char *(*pfnSetFatPVS) ( float *org );
|
||||
unsigned char *(*pfnSetFatPAS) ( float *org );
|
||||
|
||||
int (*pfnCheckVisibility ) ( const edict_t *entity, unsigned char *pset );
|
||||
|
||||
void (*pfnDeltaSetField) ( struct delta_s *pFields, const char *fieldname );
|
||||
void (*pfnDeltaUnsetField) ( struct delta_s *pFields, const char *fieldname );
|
||||
void (*pfnDeltaAddEncoder) ( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) );
|
||||
int (*pfnGetCurrentPlayer) ( void );
|
||||
int (*pfnCanSkipPlayer) ( const edict_t *player );
|
||||
int (*pfnDeltaFindField) ( struct delta_s *pFields, const char *fieldname );
|
||||
void (*pfnDeltaSetFieldByIndex) ( struct delta_s *pFields, int fieldNumber );
|
||||
void (*pfnDeltaUnsetFieldByIndex)( struct delta_s *pFields, int fieldNumber );
|
||||
|
||||
void (*pfnSetGroupMask) ( int mask, int op );
|
||||
|
||||
int (*pfnCreateInstancedBaseline) ( int classname, struct entity_state_s *baseline );
|
||||
void (*pfnCvar_DirectSet) ( struct cvar_s *var, char *value );
|
||||
|
||||
// Forces the client and server to be running with the same version of the specified file
|
||||
// ( e.g., a player model ).
|
||||
// Calling this has no effect in single player
|
||||
void (*pfnForceUnmodified) ( FORCE_TYPE type, float *mins, float *maxs, const char *filename );
|
||||
|
||||
void (*pfnGetPlayerStats) ( const edict_t *pClient, int *ping, int *packet_loss );
|
||||
|
||||
void (*pfnAddServerCommand) ( char *cmd_name, void (*function) (void) );
|
||||
|
||||
// For voice communications, set which clients hear eachother.
|
||||
// NOTE: these functions take player entity indices (starting at 1).
|
||||
qboolean (*pfnVoice_GetClientListening)(int iReceiver, int iSender);
|
||||
qboolean (*pfnVoice_SetClientListening)(int iReceiver, int iSender, qboolean bListen);
|
||||
|
||||
const char *(*pfnGetPlayerAuthId) ( edict_t *e );
|
||||
|
||||
} enginefuncs_t;
|
||||
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138
|
||||
|
||||
// Passed to pfnKeyValue
|
||||
typedef struct KeyValueData_s
|
||||
{
|
||||
char *szClassName; // in: entity classname
|
||||
char *szKeyName; // in: name of key
|
||||
char *szValue; // in: value of key
|
||||
long fHandled; // out: DLL sets to true if key-value pair was understood
|
||||
} KeyValueData;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char mapName[ 32 ];
|
||||
char landmarkName[ 32 ];
|
||||
edict_t *pentLandmark;
|
||||
vec3_t vecLandmarkOrigin;
|
||||
} LEVELLIST;
|
||||
#define MAX_LEVEL_CONNECTIONS 16 // These are encoded in the lower 16bits of ENTITYTABLE->flags
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id; // Ordinal ID of this entity (used for entity <--> pointer conversions)
|
||||
edict_t *pent; // Pointer to the in-game entity
|
||||
|
||||
int location; // Offset from the base data of this entity
|
||||
int size; // Byte size of this entity's data
|
||||
int flags; // This could be a short -- bit mask of transitions that this entity is in the PVS of
|
||||
string_t classname; // entity class name
|
||||
|
||||
} ENTITYTABLE;
|
||||
|
||||
#define FENTTABLE_PLAYER 0x80000000
|
||||
#define FENTTABLE_REMOVED 0x40000000
|
||||
#define FENTTABLE_MOVEABLE 0x20000000
|
||||
#define FENTTABLE_GLOBAL 0x10000000
|
||||
|
||||
typedef struct saverestore_s SAVERESTOREDATA;
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef
|
||||
#endif
|
||||
struct saverestore_s
|
||||
{
|
||||
char *pBaseData; // Start of all entity save data
|
||||
char *pCurrentData; // Current buffer pointer for sequential access
|
||||
int size; // Current data size
|
||||
int bufferSize; // Total space for data
|
||||
int tokenSize; // Size of the linear list of tokens
|
||||
int tokenCount; // Number of elements in the pTokens table
|
||||
char **pTokens; // Hash table of entity strings (sparse)
|
||||
int currentIndex; // Holds a global entity table ID
|
||||
int tableCount; // Number of elements in the entity table
|
||||
int connectionCount;// Number of elements in the levelList[]
|
||||
ENTITYTABLE *pTable; // Array of ENTITYTABLE elements (1 for each entity)
|
||||
LEVELLIST levelList[ MAX_LEVEL_CONNECTIONS ]; // List of connections from this level
|
||||
|
||||
// smooth transition
|
||||
int fUseLandmark;
|
||||
char szLandmarkName[20];// landmark we'll spawn near in next level
|
||||
vec3_t vecLandmarkOffset;// for landmark transitions
|
||||
float time;
|
||||
char szCurrentMapName[32]; // To check global entities
|
||||
|
||||
}
|
||||
#ifdef _WIN32
|
||||
SAVERESTOREDATA
|
||||
#endif
|
||||
;
|
||||
|
||||
typedef enum _fieldtypes
|
||||
{
|
||||
FIELD_FLOAT = 0, // Any floating point value
|
||||
FIELD_STRING, // A string ID (return from ALLOC_STRING)
|
||||
FIELD_ENTITY, // An entity offset (EOFFSET)
|
||||
FIELD_CLASSPTR, // CBaseEntity *
|
||||
FIELD_EHANDLE, // Entity handle
|
||||
FIELD_EVARS, // EVARS *
|
||||
FIELD_EDICT, // edict_t *, or edict_t * (same thing)
|
||||
FIELD_VECTOR, // Any vector
|
||||
FIELD_POSITION_VECTOR, // A world coordinate (these are fixed up across level transitions automagically)
|
||||
FIELD_POINTER, // Arbitrary data pointer... to be removed, use an array of FIELD_CHARACTER
|
||||
FIELD_INTEGER, // Any integer or enum
|
||||
FIELD_FUNCTION, // A class function pointer (Think, Use, etc)
|
||||
FIELD_BOOLEAN, // boolean, implemented as an int, I may use this as a hint for compression
|
||||
FIELD_SHORT, // 2 byte integer
|
||||
FIELD_CHARACTER, // a byte
|
||||
FIELD_TIME, // a floating point time (these are fixed up automatically too!)
|
||||
FIELD_MODELNAME, // Engine string that is a model name (needs precache)
|
||||
FIELD_SOUNDNAME, // Engine string that is a sound name (needs precache)
|
||||
|
||||
FIELD_TYPECOUNT, // MUST BE LAST
|
||||
} FIELDTYPE;
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(s,m) (size_t)&(((s *)0)->m)
|
||||
#endif
|
||||
|
||||
#define _FIELD(type,name,fieldtype,count,flags) { fieldtype, #name, offsetof(type, name), count, flags }
|
||||
#define DEFINE_FIELD(type,name,fieldtype) _FIELD(type, name, fieldtype, 1, 0)
|
||||
#define DEFINE_ARRAY(type,name,fieldtype,count) _FIELD(type, name, fieldtype, count, 0)
|
||||
#define DEFINE_ENTITY_FIELD(name,fieldtype) _FIELD(entvars_t, name, fieldtype, 1, 0 )
|
||||
#define DEFINE_ENTITY_GLOBAL_FIELD(name,fieldtype) _FIELD(entvars_t, name, fieldtype, 1, FTYPEDESC_GLOBAL )
|
||||
#define DEFINE_GLOBAL_FIELD(type,name,fieldtype) _FIELD(type, name, fieldtype, 1, FTYPEDESC_GLOBAL )
|
||||
|
||||
|
||||
#define FTYPEDESC_GLOBAL 0x0001 // This field is masked for global entity save/restore
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FIELDTYPE fieldType;
|
||||
char *fieldName;
|
||||
int fieldOffset;
|
||||
short fieldSize;
|
||||
short flags;
|
||||
} TYPEDESCRIPTION;
|
||||
|
||||
#define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// Initialize/shutdown the game (one-time call after loading of game .dll )
|
||||
void (*pfnGameInit) ( void );
|
||||
int (*pfnSpawn) ( edict_t *pent );
|
||||
void (*pfnThink) ( edict_t *pent );
|
||||
void (*pfnUse) ( edict_t *pentUsed, edict_t *pentOther );
|
||||
void (*pfnTouch) ( edict_t *pentTouched, edict_t *pentOther );
|
||||
void (*pfnBlocked) ( edict_t *pentBlocked, edict_t *pentOther );
|
||||
void (*pfnKeyValue) ( edict_t *pentKeyvalue, KeyValueData *pkvd );
|
||||
void (*pfnSave) ( edict_t *pent, SAVERESTOREDATA *pSaveData );
|
||||
int (*pfnRestore) ( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity );
|
||||
void (*pfnSetAbsBox) ( edict_t *pent );
|
||||
|
||||
void (*pfnSaveWriteFields) ( SAVERESTOREDATA *, const char *, void *, TYPEDESCRIPTION *, int );
|
||||
void (*pfnSaveReadFields) ( SAVERESTOREDATA *, const char *, void *, TYPEDESCRIPTION *, int );
|
||||
|
||||
void (*pfnSaveGlobalState) ( SAVERESTOREDATA * );
|
||||
void (*pfnRestoreGlobalState) ( SAVERESTOREDATA * );
|
||||
void (*pfnResetGlobalState) ( void );
|
||||
|
||||
qboolean (*pfnClientConnect) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );
|
||||
|
||||
void (*pfnClientDisconnect) ( edict_t *pEntity );
|
||||
void (*pfnClientKill) ( edict_t *pEntity );
|
||||
void (*pfnClientPutInServer) ( edict_t *pEntity );
|
||||
void (*pfnClientCommand) ( edict_t *pEntity );
|
||||
void (*pfnClientUserInfoChanged)( edict_t *pEntity, char *infobuffer );
|
||||
|
||||
void (*pfnServerActivate) ( edict_t *pEdictList, int edictCount, int clientMax );
|
||||
void (*pfnServerDeactivate) ( void );
|
||||
|
||||
void (*pfnPlayerPreThink) ( edict_t *pEntity );
|
||||
void (*pfnPlayerPostThink) ( edict_t *pEntity );
|
||||
|
||||
void (*pfnStartFrame) ( void );
|
||||
void (*pfnParmsNewLevel) ( void );
|
||||
void (*pfnParmsChangeLevel) ( void );
|
||||
|
||||
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
|
||||
const char *(*pfnGetGameDescription)( void );
|
||||
|
||||
// Notify dll about a player customization.
|
||||
void (*pfnPlayerCustomization) ( edict_t *pEntity, customization_t *pCustom );
|
||||
|
||||
// Spectator funcs
|
||||
void (*pfnSpectatorConnect) ( edict_t *pEntity );
|
||||
void (*pfnSpectatorDisconnect) ( edict_t *pEntity );
|
||||
void (*pfnSpectatorThink) ( edict_t *pEntity );
|
||||
|
||||
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
|
||||
void (*pfnSys_Error) ( const char *error_string );
|
||||
|
||||
void (*pfnPM_Move) ( struct playermove_s *ppmove, qboolean server );
|
||||
void (*pfnPM_Init) ( struct playermove_s *ppmove );
|
||||
char (*pfnPM_FindTextureType)( char *name );
|
||||
void (*pfnSetupVisibility)( struct edict_s *pViewEntity, struct edict_s *pClient, unsigned char **pvs, unsigned char **pas );
|
||||
void (*pfnUpdateClientData) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd );
|
||||
int (*pfnAddToFullPack)( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet );
|
||||
void (*pfnCreateBaseline) ( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs );
|
||||
void (*pfnRegisterEncoders) ( void );
|
||||
int (*pfnGetWeaponData) ( struct edict_s *player, struct weapon_data_s *info );
|
||||
|
||||
void (*pfnCmdStart) ( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed );
|
||||
void (*pfnCmdEnd) ( const edict_t *player );
|
||||
|
||||
// Return 1 if the packet is valid. Set response_buffer_size if you want to send a response packet. Incoming, it holds the max
|
||||
// size of the response_buffer, so you must zero it out if you choose not to respond.
|
||||
int (*pfnConnectionlessPacket ) ( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
|
||||
|
||||
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise
|
||||
int (*pfnGetHullBounds) ( int hullnumber, float *mins, float *maxs );
|
||||
|
||||
// Create baselines for certain "unplaced" items.
|
||||
void (*pfnCreateInstancedBaselines) ( void );
|
||||
|
||||
// One of the pfnForceUnmodified files failed the consistency check for the specified player
|
||||
// Return 0 to allow the client to continue, 1 to force immediate disconnection ( with an optional disconnect message of up to 256 characters )
|
||||
int (*pfnInconsistentFile)( const struct edict_s *player, const char *filename, char *disconnect_message );
|
||||
|
||||
// The game .dll should return 1 if lag compensation should be allowed ( could also just set
|
||||
// the sv_unlag cvar.
|
||||
// Most games right now should return 0, until client-side weapon prediction code is written
|
||||
// and tested for them.
|
||||
int (*pfnAllowLagCompensation)( void );
|
||||
} DLL_FUNCTIONS;
|
||||
|
||||
extern DLL_FUNCTIONS gEntityInterface;
|
||||
|
||||
// Current version.
|
||||
#define NEW_DLL_FUNCTIONS_VERSION 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// Called right before the object's memory is freed.
|
||||
// Calls its destructor.
|
||||
void (*pfnOnFreeEntPrivateData)(edict_t *pEnt);
|
||||
void (*pfnGameShutdown)(void);
|
||||
int (*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther );
|
||||
} NEW_DLL_FUNCTIONS;
|
||||
typedef int (*NEW_DLL_FUNCTIONS_FN)( NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
|
||||
|
||||
// Pointers will be null if the game DLL doesn't support this API.
|
||||
extern NEW_DLL_FUNCTIONS gNewDLLFunctions;
|
||||
|
||||
typedef int (*APIFUNCTION)( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
|
||||
typedef int (*APIFUNCTION2)( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
|
||||
|
||||
#endif EIFACE_H
|
||||
224
src/engine/progdefs.h
Normal file
224
src/engine/progdefs.h
Normal file
@@ -0,0 +1,224 @@
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 1999, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#ifndef PROGDEFS_H
|
||||
#define PROGDEFS_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float time;
|
||||
float frametime;
|
||||
float force_retouch;
|
||||
string_t mapname;
|
||||
string_t startspot;
|
||||
float deathmatch;
|
||||
float coop;
|
||||
float teamplay;
|
||||
float serverflags;
|
||||
float found_secrets;
|
||||
vec3_t v_forward;
|
||||
vec3_t v_up;
|
||||
vec3_t v_right;
|
||||
float trace_allsolid;
|
||||
float trace_startsolid;
|
||||
float trace_fraction;
|
||||
vec3_t trace_endpos;
|
||||
vec3_t trace_plane_normal;
|
||||
float trace_plane_dist;
|
||||
edict_t *trace_ent;
|
||||
float trace_inopen;
|
||||
float trace_inwater;
|
||||
int trace_hitgroup;
|
||||
int trace_flags;
|
||||
int msg_entity;
|
||||
int cdAudioTrack;
|
||||
int maxClients;
|
||||
int maxEntities;
|
||||
const char *pStringBase;
|
||||
|
||||
void *pSaveData;
|
||||
vec3_t vecLandmarkOffset;
|
||||
} globalvars_t;
|
||||
|
||||
|
||||
typedef struct entvars_s
|
||||
{
|
||||
string_t classname;
|
||||
string_t globalname;
|
||||
|
||||
vec3_t origin;
|
||||
vec3_t oldorigin;
|
||||
vec3_t velocity;
|
||||
vec3_t basevelocity;
|
||||
vec3_t clbasevelocity; // Base velocity that was passed in to server physics so
|
||||
// client can predict conveyors correctly. Server zeroes it, so we need to store here, too.
|
||||
vec3_t movedir;
|
||||
|
||||
vec3_t angles; // Model angles
|
||||
vec3_t avelocity; // angle velocity (degrees per second)
|
||||
vec3_t punchangle; // auto-decaying view angle adjustment
|
||||
vec3_t v_angle; // Viewing angle (player only)
|
||||
|
||||
// For parametric entities
|
||||
vec3_t endpos;
|
||||
vec3_t startpos;
|
||||
float impacttime;
|
||||
float starttime;
|
||||
|
||||
int fixangle; // 0:nothing, 1:force view angles, 2:add avelocity
|
||||
float idealpitch;
|
||||
float pitch_speed;
|
||||
float ideal_yaw;
|
||||
float yaw_speed;
|
||||
|
||||
int modelindex;
|
||||
string_t model;
|
||||
|
||||
int viewmodel; // player's viewmodel
|
||||
int weaponmodel; // what other players see
|
||||
|
||||
vec3_t absmin; // BB max translated to world coord
|
||||
vec3_t absmax; // BB max translated to world coord
|
||||
vec3_t mins; // local BB min
|
||||
vec3_t maxs; // local BB max
|
||||
vec3_t size; // maxs - mins
|
||||
|
||||
float ltime;
|
||||
float nextthink;
|
||||
|
||||
int movetype;
|
||||
int solid;
|
||||
|
||||
int skin;
|
||||
int body; // sub-model selection for studiomodels
|
||||
int effects;
|
||||
|
||||
float gravity; // % of "normal" gravity
|
||||
float friction; // inverse elasticity of MOVETYPE_BOUNCE
|
||||
|
||||
int light_level;
|
||||
|
||||
int sequence; // animation sequence
|
||||
int gaitsequence; // movement animation sequence for player (0 for none)
|
||||
float frame; // % playback position in animation sequences (0..255)
|
||||
float animtime; // world time when frame was set
|
||||
float framerate; // animation playback rate (-8x to 8x)
|
||||
byte controller[4]; // bone controller setting (0..255)
|
||||
byte blending[2]; // blending amount between sub-sequences (0..255)
|
||||
|
||||
float scale; // sprite rendering scale (0..255)
|
||||
|
||||
int rendermode;
|
||||
float renderamt;
|
||||
vec3_t rendercolor;
|
||||
int renderfx;
|
||||
|
||||
float health;
|
||||
float frags;
|
||||
int weapons; // bit mask for available weapons
|
||||
float takedamage;
|
||||
|
||||
int deadflag;
|
||||
vec3_t view_ofs; // eye position
|
||||
|
||||
int button;
|
||||
int impulse;
|
||||
|
||||
edict_t *chain; // Entity pointer when linked into a linked list
|
||||
edict_t *dmg_inflictor;
|
||||
edict_t *enemy;
|
||||
edict_t *aiment; // entity pointer when MOVETYPE_FOLLOW
|
||||
edict_t *owner;
|
||||
edict_t *groundentity;
|
||||
|
||||
int spawnflags;
|
||||
int flags;
|
||||
|
||||
int colormap; // lowbyte topcolor, highbyte bottomcolor
|
||||
int team;
|
||||
|
||||
float max_health;
|
||||
float teleport_time;
|
||||
float armortype;
|
||||
float armorvalue;
|
||||
int waterlevel;
|
||||
int watertype;
|
||||
|
||||
string_t target;
|
||||
string_t targetname;
|
||||
string_t netname;
|
||||
string_t message;
|
||||
|
||||
float dmg_take;
|
||||
float dmg_save;
|
||||
float dmg;
|
||||
float dmgtime;
|
||||
|
||||
string_t noise;
|
||||
string_t noise1;
|
||||
string_t noise2;
|
||||
string_t noise3;
|
||||
|
||||
float speed;
|
||||
float air_finished;
|
||||
float pain_finished;
|
||||
float radsuit_finished;
|
||||
|
||||
edict_t *pContainingEntity;
|
||||
|
||||
int playerclass;
|
||||
float maxspeed;
|
||||
|
||||
float fov;
|
||||
int weaponanim;
|
||||
|
||||
int pushmsec;
|
||||
|
||||
int bInDuck;
|
||||
int flTimeStepSound;
|
||||
int flSwimTime;
|
||||
int flDuckTime;
|
||||
int iStepLeft;
|
||||
float flFallVelocity;
|
||||
|
||||
int gamestate;
|
||||
|
||||
int oldbuttons;
|
||||
|
||||
int groupinfo;
|
||||
|
||||
// For mods
|
||||
int iuser1;
|
||||
int iuser2;
|
||||
int iuser3;
|
||||
int iuser4;
|
||||
float fuser1;
|
||||
float fuser2;
|
||||
float fuser3;
|
||||
float fuser4;
|
||||
vec3_t vuser1;
|
||||
vec3_t vuser2;
|
||||
vec3_t vuser3;
|
||||
vec3_t vuser4;
|
||||
edict_t *euser1;
|
||||
edict_t *euser2;
|
||||
edict_t *euser3;
|
||||
edict_t *euser4;
|
||||
} entvars_t;
|
||||
|
||||
|
||||
#endif // PROGDEFS_H
|
||||
55
src/engine/shake.h
Normal file
55
src/engine/shake.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 1999, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#ifndef SHAKE_H
|
||||
#define SHAKE_H
|
||||
|
||||
// Screen / View effects
|
||||
|
||||
// screen shake
|
||||
extern int gmsgShake;
|
||||
|
||||
// This structure is sent over the net to describe a screen shake event
|
||||
typedef struct
|
||||
{
|
||||
unsigned short amplitude; // FIXED 4.12 amount of shake
|
||||
unsigned short duration; // FIXED 4.12 seconds duration
|
||||
unsigned short frequency; // FIXED 8.8 noise frequency (low frequency is a jerk,high frequency is a rumble)
|
||||
} ScreenShake;
|
||||
|
||||
extern void V_ApplyShake( float *origin, float *angles, float factor );
|
||||
extern void V_CalcShake( void );
|
||||
extern int V_ScreenShake( const char *pszName, int iSize, void *pbuf );
|
||||
extern int V_ScreenFade( const char *pszName, int iSize, void *pbuf );
|
||||
|
||||
|
||||
// Fade in/out
|
||||
extern int gmsgFade;
|
||||
|
||||
#define FFADE_IN 0x0000 // Just here so we don't pass 0 into the function
|
||||
#define FFADE_OUT 0x0001 // Fade out (not in)
|
||||
#define FFADE_MODULATE 0x0002 // Modulate (don't blend)
|
||||
#define FFADE_STAYOUT 0x0004 // ignores the duration, stays faded out until new ScreenFade message received
|
||||
|
||||
// This structure is sent over the net to describe a screen fade event
|
||||
typedef struct
|
||||
{
|
||||
unsigned short duration; // FIXED 4.12 seconds duration
|
||||
unsigned short holdTime; // FIXED 4.12 seconds duration until reset (fade & hold)
|
||||
short fadeFlags; // flags
|
||||
byte r, g, b, a; // fade to color ( max alpha )
|
||||
} ScreenFade;
|
||||
|
||||
#endif // SHAKE_H
|
||||
|
||||
362
src/engine/studio.h
Normal file
362
src/engine/studio.h
Normal file
@@ -0,0 +1,362 @@
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 1999, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _STUDIO_H_
|
||||
#define _STUDIO_H_
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
STUDIO MODELS
|
||||
|
||||
Studio models are position independent, so the cache manager can move them.
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
|
||||
#define MAXSTUDIOTRIANGLES 20000 // TODO: tune this
|
||||
#define MAXSTUDIOVERTS 2048 // TODO: tune this
|
||||
#define MAXSTUDIOSEQUENCES 256 // total animation sequences
|
||||
#define MAXSTUDIOSKINS 100 // total textures
|
||||
#define MAXSTUDIOSRCBONES 512 // bones allowed at source movement
|
||||
#define MAXSTUDIOBONES 128 // total bones actually used
|
||||
#define MAXSTUDIOMODELS 32 // sub-models per model
|
||||
#define MAXSTUDIOBODYPARTS 32
|
||||
#define MAXSTUDIOGROUPS 16
|
||||
#define MAXSTUDIOANIMATIONS 512 // per sequence
|
||||
#define MAXSTUDIOMESHES 256
|
||||
#define MAXSTUDIOEVENTS 1024
|
||||
#define MAXSTUDIOPIVOTS 256
|
||||
#define MAXSTUDIOCONTROLLERS 8
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id;
|
||||
int version;
|
||||
|
||||
char name[64];
|
||||
int length;
|
||||
|
||||
vec3_t eyeposition; // ideal eye position
|
||||
vec3_t min; // ideal movement hull size
|
||||
vec3_t max;
|
||||
|
||||
vec3_t bbmin; // clipping bounding box
|
||||
vec3_t bbmax;
|
||||
|
||||
int flags;
|
||||
|
||||
int numbones; // bones
|
||||
int boneindex;
|
||||
|
||||
int numbonecontrollers; // bone controllers
|
||||
int bonecontrollerindex;
|
||||
|
||||
int numhitboxes; // complex bounding boxes
|
||||
int hitboxindex;
|
||||
|
||||
int numseq; // animation sequences
|
||||
int seqindex;
|
||||
|
||||
int numseqgroups; // demand loaded sequences
|
||||
int seqgroupindex;
|
||||
|
||||
int numtextures; // raw textures
|
||||
int textureindex;
|
||||
int texturedataindex;
|
||||
|
||||
int numskinref; // replaceable textures
|
||||
int numskinfamilies;
|
||||
int skinindex;
|
||||
|
||||
int numbodyparts;
|
||||
int bodypartindex;
|
||||
|
||||
int numattachments; // queryable attachable points
|
||||
int attachmentindex;
|
||||
|
||||
int soundtable;
|
||||
int soundindex;
|
||||
int soundgroups;
|
||||
int soundgroupindex;
|
||||
|
||||
int numtransitions; // animation node to animation node transition graph
|
||||
int transitionindex;
|
||||
} studiohdr_t;
|
||||
|
||||
// header for demand loaded sequence group data
|
||||
typedef struct
|
||||
{
|
||||
int id;
|
||||
int version;
|
||||
|
||||
char name[64];
|
||||
int length;
|
||||
} studioseqhdr_t;
|
||||
|
||||
// bones
|
||||
typedef struct
|
||||
{
|
||||
char name[32]; // bone name for symbolic links
|
||||
int parent; // parent bone
|
||||
int flags; // ??
|
||||
int bonecontroller[6]; // bone controller index, -1 == none
|
||||
float value[6]; // default DoF values
|
||||
float scale[6]; // scale for delta DoF values
|
||||
} mstudiobone_t;
|
||||
|
||||
|
||||
// bone controllers
|
||||
typedef struct
|
||||
{
|
||||
int bone; // -1 == 0
|
||||
int type; // X, Y, Z, XR, YR, ZR, M
|
||||
float start;
|
||||
float end;
|
||||
int rest; // byte index value at rest
|
||||
int index; // 0-3 user set controller, 4 mouth
|
||||
} mstudiobonecontroller_t;
|
||||
|
||||
// intersection boxes
|
||||
typedef struct
|
||||
{
|
||||
int bone;
|
||||
int group; // intersection group
|
||||
vec3_t bbmin; // bounding box
|
||||
vec3_t bbmax;
|
||||
} mstudiobbox_t;
|
||||
|
||||
#if !defined( CACHE_USER ) && !defined( QUAKEDEF_H )
|
||||
#define CACHE_USER
|
||||
typedef struct cache_user_s
|
||||
{
|
||||
void *data;
|
||||
} cache_user_t;
|
||||
#endif
|
||||
|
||||
// demand loaded sequence groups
|
||||
typedef struct
|
||||
{
|
||||
char label[32]; // textual name
|
||||
char name[64]; // file name
|
||||
cache_user_t cache; // cache index pointer
|
||||
int data; // hack for group 0
|
||||
} mstudioseqgroup_t;
|
||||
|
||||
// sequence descriptions
|
||||
typedef struct
|
||||
{
|
||||
char label[32]; // sequence label
|
||||
|
||||
float fps; // frames per second
|
||||
int flags; // looping/non-looping flags
|
||||
|
||||
int activity;
|
||||
int actweight;
|
||||
|
||||
int numevents;
|
||||
int eventindex;
|
||||
|
||||
int numframes; // number of frames per sequence
|
||||
|
||||
int numpivots; // number of foot pivots
|
||||
int pivotindex;
|
||||
|
||||
int motiontype;
|
||||
int motionbone;
|
||||
vec3_t linearmovement;
|
||||
int automoveposindex;
|
||||
int automoveangleindex;
|
||||
|
||||
vec3_t bbmin; // per sequence bounding box
|
||||
vec3_t bbmax;
|
||||
|
||||
int numblends;
|
||||
int animindex; // mstudioanim_t pointer relative to start of sequence group data
|
||||
// [blend][bone][X, Y, Z, XR, YR, ZR]
|
||||
|
||||
int blendtype[2]; // X, Y, Z, XR, YR, ZR
|
||||
float blendstart[2]; // starting value
|
||||
float blendend[2]; // ending value
|
||||
int blendparent;
|
||||
|
||||
int seqgroup; // sequence group for demand loading
|
||||
|
||||
int entrynode; // transition node at entry
|
||||
int exitnode; // transition node at exit
|
||||
int nodeflags; // transition rules
|
||||
|
||||
int nextseq; // auto advancing sequences
|
||||
} mstudioseqdesc_t;
|
||||
|
||||
// events
|
||||
#include "studio_event.h"
|
||||
/*
|
||||
typedef struct
|
||||
{
|
||||
int frame;
|
||||
int event;
|
||||
int type;
|
||||
char options[64];
|
||||
} mstudioevent_t;
|
||||
*/
|
||||
|
||||
// pivots
|
||||
typedef struct
|
||||
{
|
||||
vec3_t org; // pivot point
|
||||
int start;
|
||||
int end;
|
||||
} mstudiopivot_t;
|
||||
|
||||
// attachment
|
||||
typedef struct
|
||||
{
|
||||
char name[32];
|
||||
int type;
|
||||
int bone;
|
||||
vec3_t org; // attachment point
|
||||
vec3_t vectors[3];
|
||||
} mstudioattachment_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short offset[6];
|
||||
} mstudioanim_t;
|
||||
|
||||
// animation frames
|
||||
typedef union
|
||||
{
|
||||
struct {
|
||||
byte valid;
|
||||
byte total;
|
||||
} num;
|
||||
short value;
|
||||
} mstudioanimvalue_t;
|
||||
|
||||
|
||||
|
||||
// body part index
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
int nummodels;
|
||||
int base;
|
||||
int modelindex; // index into models array
|
||||
} mstudiobodyparts_t;
|
||||
|
||||
|
||||
|
||||
// skin info
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
int flags;
|
||||
int width;
|
||||
int height;
|
||||
int index;
|
||||
} mstudiotexture_t;
|
||||
|
||||
|
||||
// skin families
|
||||
// short index[skinfamilies][skinref]
|
||||
|
||||
// studio models
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
|
||||
int type;
|
||||
|
||||
float boundingradius;
|
||||
|
||||
int nummesh;
|
||||
int meshindex;
|
||||
|
||||
int numverts; // number of unique vertices
|
||||
int vertinfoindex; // vertex bone info
|
||||
int vertindex; // vertex vec3_t
|
||||
int numnorms; // number of unique surface normals
|
||||
int norminfoindex; // normal bone info
|
||||
int normindex; // normal vec3_t
|
||||
|
||||
int numgroups; // deformation groups
|
||||
int groupindex;
|
||||
} mstudiomodel_t;
|
||||
|
||||
|
||||
// vec3_t boundingbox[model][bone][2]; // complex intersection info
|
||||
|
||||
|
||||
// meshes
|
||||
typedef struct
|
||||
{
|
||||
int numtris;
|
||||
int triindex;
|
||||
int skinref;
|
||||
int numnorms; // per mesh normals
|
||||
int normindex; // normal vec3_t
|
||||
} mstudiomesh_t;
|
||||
|
||||
// triangles
|
||||
#if 0
|
||||
typedef struct
|
||||
{
|
||||
short vertindex; // index into vertex array
|
||||
short normindex; // index into normal array
|
||||
short s,t; // s,t position on skin
|
||||
} mstudiotrivert_t;
|
||||
#endif
|
||||
|
||||
// lighting options
|
||||
#define STUDIO_NF_FLATSHADE 0x0001
|
||||
#define STUDIO_NF_CHROME 0x0002
|
||||
#define STUDIO_NF_FULLBRIGHT 0x0004
|
||||
|
||||
// motion flags
|
||||
#define STUDIO_X 0x0001
|
||||
#define STUDIO_Y 0x0002
|
||||
#define STUDIO_Z 0x0004
|
||||
#define STUDIO_XR 0x0008
|
||||
#define STUDIO_YR 0x0010
|
||||
#define STUDIO_ZR 0x0020
|
||||
#define STUDIO_LX 0x0040
|
||||
#define STUDIO_LY 0x0080
|
||||
#define STUDIO_LZ 0x0100
|
||||
#define STUDIO_AX 0x0200
|
||||
#define STUDIO_AY 0x0400
|
||||
#define STUDIO_AZ 0x0800
|
||||
#define STUDIO_AXR 0x1000
|
||||
#define STUDIO_AYR 0x2000
|
||||
#define STUDIO_AZR 0x4000
|
||||
#define STUDIO_TYPES 0x7FFF
|
||||
#define STUDIO_RLOOP 0x8000 // controller that wraps shortest distance
|
||||
|
||||
// sequence flags
|
||||
#define STUDIO_LOOPING 0x0001
|
||||
|
||||
// bone flags
|
||||
#define STUDIO_HAS_NORMALS 0x0001
|
||||
#define STUDIO_HAS_VERTICES 0x0002
|
||||
#define STUDIO_HAS_BBOX 0x0004
|
||||
#define STUDIO_HAS_CHROME 0x0008 // if any of the textures have chrome on them
|
||||
|
||||
#define RAD_TO_STUDIO (32768.0/M_PI)
|
||||
#define STUDIO_TO_RAD (M_PI/32768.0)
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user