📄 q_shared.h
字号:
#define CROUCH_EYE_HEIGHT 30
#define STAND_HEIGHT 72
#define STAND_EYE_HEIGHT 66
// 2015 code
#define HOVERBIKE_HEIGHT 32
#define HOVERBIKE_EYE_HEIGHT 24
#endif
// this structure needs to be communicated bit-accurate
// from the server to the client to guarantee that
// prediction stays in sync, so no floats are used.
// if any part of the game code modifies this struct, it
// will result in a prediction error of some degree.
typedef struct
{
pmtype_t pm_type;
short origin[3]; // 12.3
short velocity[3]; // 12.3
short pm_flags; // ducked, jump_held, etc
#ifdef _H2INC
unsigned char pm_time; // each unit = 8 ms
short AMD_gravity;
#else
byte pm_time; // each unit = 8 ms
#ifdef SIN
short gravity : 13;
unsigned gravity_axis : 3; // direction of gravity
#else
short gravity;
#endif
#endif
short delta_angles[3]; // add to command angles to get view direction
// changed by spawns, rotating objects, and teleporters
} pmove_state_t;
#ifdef SIN
#define GRAVITY_AXIS_SHIFT 13
#define GRAVITY_AXIS_MASK 0xe000
#define GRAVITY_MASK ( ~GRAVITY_AXIS_MASK )
#define GRAVITY_NUM_AXIS 6
typedef struct
{
int x;
int y;
int z;
int sign;
} gravityaxis_t;
extern const gravityaxis_t gravity_axis[ GRAVITY_NUM_AXIS ];
#endif
//
// button bits
//
#define BUTTON_ATTACK 1
#define BUTTON_USE 2
#ifdef SIN
// 2015 code
#define BUTTON_JUMP 4 // for detecting when the player is jumping
#endif
#define BUTTON_ANY 128 // any key whatsoever
// usercmd_t is sent to the server each client frame
#ifdef _H2INC
typedef struct usercmd_s
{
unsigned char msec;
unsigned char buttons;
short angles[3];
short forwardmove, sidemove, upmove;
unsigned char impulse; // remove?
unsigned char lightlevel; // light level the player is standing on
unsigned char debris; // have we been hit by debris?
} usercmd_t;
#else
typedef struct usercmd_s
{
byte msec;
byte buttons;
short angles[3];
short forwardmove, sidemove, upmove;
byte impulse; // remove?
byte lightlevel; // light level the player is standing on
#ifdef SIN
byte debris; // have we been hit by debris?
#endif
} usercmd_t;
#endif
#define MAXTOUCH 32
typedef struct
{
// state (in / out)
pmove_state_t s;
// command (in)
usercmd_t cmd;
qboolean snapinitial; // if s has been changed outside pmove
// results (out)
int numtouch;
struct edict_s *touchents[MAXTOUCH];
vec3_t viewangles; // clamped
float viewheight;
vec3_t mins, maxs; // bounding box size
struct edict_s *groundentity;
#ifdef SIN
csurface_t *groundsurface;
cplane_t groundplane;
int groundcontents;
#endif
int watertype;
int waterlevel;
qboolean onladder; // is he on a ladder
// callbacks to test the world
trace_t (*trace) (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end);
int (*pointcontents) (vec3_t point);
} pmove_t;
// entity_state_t->effects
// Effects are things handled on the client side (lights, particles, frame animations)
// that happen constantly on the given entity.
// An entity that has effects will be sent to the client
// even if it has a zero index model.
#ifdef SIN
#define EF_ROTATE (1<<0) // rotate (bonus items)
#define EF_ROCKET (1<<1) // redlight + trail
#define EF_GIB (1<<2) // leave a trail
#define EF_PULSE (1<<3) // pulsecannon projectile effect
#define EF_SMOOTHANGLES (1<<4) // 16-bit angles over net
#define EF_EVERYFRAME (1<<5) // def commands will be run every client frame
#define EF_CROUCH (1<<6) // character is crouching
#define EF_EFFECTS_16 (1<<7) // reserved for net transmission
#define EF_GRAVITY_AXIS_0 (1<<8) // bit 0 of gravity axis
#define EF_GRAVITY_AXIS_1 (1<<9) // bit 1 of gravity axis
#define EF_GRAVITY_AXIS_2 (1<<10) // bit 2 of gravity axis
#define EF_BEAMEFFECT (1<<11) // Beams effect
#define EF_AUTO_ANIMATE (1<<12) // auto animate
#define EF_NOFOOTSTEPS (1<<13) // don't play footsteps on model
#define EF_EFFECTS_32 (1<<15) // reserved for net transmission
#define EF_WARM (1<<14) // used to signify something that should be
// light up by therm-optic goggles
#define EF_HOVER (1<<16) // hovering effect for the hoverbike
#define EF_HOVERTHRUST (1<<17) // engine thrust hoverbike effect
#define EF_HOVERTURBO (1<<18) // turbo thrust hoverbike effect
#define EF_VIEWMODEL (1<<19) // entity is a secondary view model
#define EF_ANIMEROCKET (1<<20) // added effect for anime rockets
#define EF_FLAMES (1<<21) // added flame trail effect
#define EF_DEATHFLAMES (1<<22) // added flame trail effect
#define EF_PLASMATRAIL1 (1<<23) // trail effect for plasma bow
#define EF_PLASMATRAIL2 (1<<24) // secondary trail effect for plasma bow
#define EF_NUKETRAIL (1<<25) // particle effect for a flying nuke ball
#define EF_FORCEBASELINE EF_CROUCH // used to make sure we create a baseline for entities that wouldn't be processed
// ordinarily.
#define EFFECTS_TO_GRAVITYAXIS( effect ) \
( ( ( effect ) & ( EF_GRAVITY_AXIS_0 | EF_GRAVITY_AXIS_1 | EF_GRAVITY_AXIS_2 ) ) >> 8 )
#define GRAVITYAXIS_TO_EFFECTS( gravaxis ) \
( ( ( gravaxis ) << 8 ) & ( EF_GRAVITY_AXIS_0 | EF_GRAVITY_AXIS_1 | EF_GRAVITY_AXIS_2 ) )
#else
#define EF_ROTATE 0x00000001 // rotate (bonus items)
#define EF_GIB 0x00000002 // leave a trail
#define EF_BLASTER 0x00000008 // redlight + trail
#define EF_ROCKET 0x00000010 // redlight + trail
#define EF_GRENADE 0x00000020
#define EF_HYPERBLASTER 0x00000040
#define EF_BFG 0x00000080
#define EF_COLOR_SHELL 0x00000100
#define EF_POWERSCREEN 0x00000200
#define EF_ANIM01 0x00000400 // automatically cycle between frames 0 and 1 at 2 hz
#define EF_ANIM23 0x00000800 // automatically cycle between frames 2 and 3 at 2 hz
#define EF_ANIM_ALL 0x00001000 // automatically cycle through all frames at 2hz
#define EF_ANIM_ALLFAST 0x00002000 // automatically cycle through all frames at 10hz
#define EF_FLIES 0x00004000
#define EF_QUAD 0x00008000
#define EF_PENT 0x00010000
#endif
#ifdef SIN
// model commands
#define MDL_GROUP_SKINOFFSET_BIT0 0x0001
#define MDL_GROUP_SKINOFFSET_BIT1 0x0002
#define MDL_GROUP_FULLBRIGHT 0x0004
#define MDL_GROUP_ENVMAPPED_GOLD 0x0008
#define MDL_GROUP_ENVMAPPED_SILVER 0x0010
#define MDL_GROUP_TRANSLUCENT_33 0x0020
#define MDL_GROUP_TRANSLUCENT_66 0x0040
#define MDL_GROUP_NODRAW 0x0080
//
// STATIC flags NEVER sent over the net
//
#define MDL_GROUP_SURFACETYPE_BIT0 0x0100
#define MDL_GROUP_SURFACETYPE_BIT1 0x0200
#define MDL_GROUP_SURFACETYPE_BIT2 0x0400
#define MDL_GROUP_SURFACETYPE_BIT3 0x0800
#define MDL_GROUP_RICOCHET 0x1000
#define MDL_GROUP_SKIN_NO_DAMAGE 0x2000
#define MDL_GROUP_MASKED 0x4000
#define MDL_GROUP_TWOSIDED 0x8000
// 2015 code
#define BONE_ORIGIN 0xfff
#define BONE_2015ATTACH 0x800
#endif
#ifdef SIN
// Particle flags
#define PARTICLE_RANDOM (1<<0)
#define PARTICLE_OVERBRIGHT (1<<1)
// 2015 code
#define PARTICLE_ADDITIVE (1<<2) // draws the particle additively
#define PARTICLE_FIRE (1<<3) // draws it as a fire particle
#define PARTICLE_HITSOLID (1<<4) // collision detect solid objects
#define PARTICLE_HITENTS (1<<5) // collision detect entities
#define PARTICLE_HITREMOVE (1<<6) // remove the particle when it hits something
#endif
// entity_state_t->renderfx flags
#ifdef SIN
#define RF_MINLIGHT (1<<0) // allways have some light (viewmodel)
#define RF_VIEWERMODEL (1<<1) // don't draw through eyes, only mirrors
#define RF_WEAPONMODEL (1<<2) // only draw through eyes
#define RF_FULLBRIGHT (1<<3) // allways draw full intensity
#define RF_ENVMAPPED (1<<4) // model is environment mapped completely
#define RF_TRANSLUCENT (1<<5)
#define RF_FRAMELERP (1<<6)
#define RF_BEAM (1<<7)
#define RF_CUSTOMSKIN (1<<8) // skin is an index in image_precache
#define RF_GLOW (1<<9) // pulse lighting for bonus items
#define RF_DONTDRAW (1<<10)
#define RF_LENSFLARE (1<<11)
#define RF_DLIGHT (1<<12)
#define RF_DETAIL (1<<13) // Culls a model based on the distance away from you
#define RF_LIGHTOFFSET (1<<14)
#define RF_XFLIP (1<<15) // flip the model in x space (used for weapon models)
#else
#define RF_MINLIGHT 1 // allways have some light (viewmodel)
#define RF_VIEWERMODEL 2 // don't draw through eyes, only mirrors
#define RF_WEAPONMODEL 4 // only draw through eyes
#define RF_FULLBRIGHT 8 // allways draw full intensity
#define RF_DEPTHHACK 16 // for view weapon Z crunching
#define RF_TRANSLUCENT 32
#define RF_FRAMELERP 64
#define RF_BEAM 128
#define RF_CUSTOMSKIN 256 // skin is an index in image_precache
#define RF_GLOW 512 // pulse lighting for bonus items
#define RF_SHELL_RED 1024
#define RF_SHELL_GREEN 2048
#define RF_SHELL_BLUE 4096
#endif
// player_state_t->refdef flags
#define RDF_UNDERWATER 1 // warp the screen as apropriate
#define RDF_NOWORLDMODEL 2 // used for player configuration screen
#ifdef SIN
#define RDF_NOCLEAR 4 // used for player configuration screen, don't clear behind the screen
#define RDF_NOENTITIES 8 // used for menu, so entites don't get drawn
#endif
#ifndef SIN
//
// muzzle flashes / player effects
//
#define MZ_BLASTER 0
#define MZ_MACHINEGUN 1
#define MZ_SHOTGUN 2
#define MZ_CHAINGUN1 3
#define MZ_CHAINGUN2 4
#define MZ_CHAINGUN3 5
#define MZ_RAILGUN 6
#define MZ_ROCKET 7
#define MZ_GRENADE 8
#define MZ_LOGIN 9
#define MZ_LOGOUT 10
#define MZ_RESPAWN 11
#define MZ_BFG 12
#define MZ_SSHOTGUN 13
#define MZ_HYPERBLASTER 14
#define MZ_ITEMRESPAWN 15
#define MZ_SILENCED 128 // bit flag ORed with one of the above numbers
//
// monster muzzle flashes
//
#define MZ2_TANK_BLASTER_1 1
#define MZ2_TANK_BLASTER_2 2
#define MZ2_TANK_BLASTER_3 3
#define MZ2_TANK_MACHINEGUN_1 4
#define MZ2_TANK_MACHINEGUN_2 5
#define MZ2_TANK_MACHINEGUN_3 6
#define MZ2_TANK_MACHINEGUN_4 7
#define MZ2_TANK_MACHINEGUN_5 8
#define MZ2_TANK_MACHINEGUN_6 9
#define MZ2_TANK_MACHINEGUN_7 10
#define MZ2_TANK_MACHINEGUN_8 11
#define MZ2_TANK_MACHINEGUN_9 12
#define MZ2_TANK_MACHINEGUN_10 13
#define MZ2_TANK_MACHINEGUN_11 14
#define MZ2_TANK_MACHINEGUN_12 15
#define MZ2_TANK_MACHINEGUN_13 16
#define MZ2_TANK_MACHINEGUN_14 17
#define MZ2_TANK_MACHINEGUN_15 18
#define MZ2_TANK_MACHINEGUN_16 19
#define MZ2_TANK_MACHINEGUN_17 20
#define MZ2_TANK_MACHINEGUN_18 21
#define MZ2_TANK_MACHINEGUN_19 22
#define MZ2_TANK_ROCKET_1 23
#define MZ2_TANK_ROCKET_2 24
#define MZ2_TANK_ROCKET_3 25
#define MZ2_INFANTRY_MACHINEGUN_1 26
#define MZ2_INFANTRY_MACHINEGUN_2 27
#define MZ2_INFANTRY_MACHINEGUN_3 28
#define MZ2_INFANTRY_MACHINEGUN_4 29
#define MZ2_INFANTRY_MACHINEGUN_5 30
#define MZ2_INFANTRY_MACHINEGUN_6 31
#define MZ2_INFANTRY_MACHINEGUN_7 32
#define MZ2_INFANTRY_MACHINEGUN_8 33
#define MZ2_INFANTRY_MACHINEGUN_9 34
#define MZ2_INFANTRY_MACHINEGUN_10 35
#define MZ2_INFANTRY_MACHINEGUN_11 36
#define MZ2_INFANTRY_MACHINEGUN_12 37
#define MZ2_INFANTRY_MACHINEGUN_13 38
#define MZ2_SOLDIER_BLASTER_1 39
#define MZ2_SOLDIER_BLASTER_2 40
#define MZ2_SOLDIER_SHOTGUN_1 41
#define MZ2_SOLDIER_SHOTGUN_2 42
#define MZ2_SOLDIER_MACHINEGUN_1 43
#define MZ2_SOLDIER_MACHINEGUN_2 44
#define MZ2_GUNNER_MACHINEGUN_1 45
#define MZ2_GUNNER_MACHINEGUN_2 46
#define MZ2_GUNNER_MACHINEGUN_3 47
#define MZ2_GUNNER_MACHINEGUN_4 48
#define MZ2_GUNNER_MACHINEGUN_5 49
#define MZ2_GUNNER_MACHINEGUN_6 50
#define MZ2_GUNNER_MACHINEGUN_7 51
#define MZ2_GUNNER_MACHINEGUN_8 52
#define MZ2_GUNNER_GRENADE_1 53
#define MZ2_GUNNER_GRENADE_2 54
#define MZ2_GUNNER_GRENADE_3 55
#define MZ2_GUNNER_GRENADE_4 56
#define MZ2_CHICK_ROCKET_1 57
#define MZ2_FLYER_BLASTER_1 58
#define MZ2_FLYER_BLASTER_2 59
#define MZ2_MEDIC_BLASTER_1 60
#define MZ2_GLADIATOR_RAILGUN_1 61
#define MZ2_HOVER_BLASTER_1 62
#define MZ2_ACTOR_MACHINEGUN_1 63
#define MZ2_SUPERTANK_MACHINEGUN_1 64
#define MZ2_SUPERTANK_MACHINEGUN_2 65
#define MZ2_SUPERTANK_MACHINEGUN_3 66
#define MZ2_SUPERTANK_MACHINEGUN_4 67
#define MZ2_SUPERTANK_MACHINEGUN_5 68
#define MZ2_SUPERTANK_MACHINEGUN_6 69
#define MZ2_SUPERTANK_ROCKET_1 70
#define MZ2_SUPERTANK_ROCKET_2 71
#define MZ2_SUPERTANK_ROCKET_3 72
#define MZ2_BOSS2_MACHINEGUN_L1 73
#define MZ2_BOSS2_MACHINEGUN_L2 74
#define MZ2_BOSS2_MACHINEGUN_L3 75
#define MZ2_BOSS2_MACHINEGUN_L4 76
#define MZ2_BOSS2_MACHINEGUN_L5 77
#define MZ2_BOSS2_ROCKET_1 78
#define MZ2_BOSS2_ROCKET_2 79
#define MZ2_BOSS2_ROCKET_3 80
#define MZ2_BOSS2_ROCKET_4 81
#define MZ2_FLOAT_BLASTER_1 82
#define MZ2_SOLDIER_BLASTER_3 83
#define MZ2_SOLDIER_SHOTGUN_3 84
#define MZ2_SOLDIER_MACHINEGUN_3 85
#define MZ2_SOLDIER_BLASTER_4 86
#define MZ2_SOLDIER_SHOTGUN_4 87
#define MZ2_SOLDIER_MACHINEGUN_4 88
#define MZ2_SOLDIER_BLASTER_5 89
#define MZ2_SOLDIER_SHOTGUN_5 90
#define MZ2_SOLDIER_MACHINEGUN_5 91
#define MZ2_SOLDIER_BLASTER_6 92
#define MZ2_SOLDIER_SHOTGUN_6 93
#define MZ2_SOLDIER_MACHINEGUN_6 94
#define MZ2_SOLDIER_BLASTER_7 95
#define MZ2_SOLDIER_SHOTGUN_7 96
#define MZ2_SOLDIER_MACHINEGUN_7 97
#define MZ2_SOLDIER_BLASTER_8 98
#define MZ2_SOLDIER_SHOTGUN_8 99
#define MZ2_SOLDIER_MACHINEGUN_8 100
// --- Xian shit below ---
#define MZ2_MAKRON_BFG 101
#define MZ2_MAKRON_BLASTER_1 102
#define MZ2_MAKRON_BLASTER_2 103
#define MZ2_MAKRON_BLASTER_3 104
#define MZ2_MAKRON_BLASTER_4 105
#define MZ2_MAKRON_BLASTER_5 106
#define MZ2_MAKRON_BLASTER_6 107
#define MZ2_MAKRON_BLASTER_7 108
#define MZ2_MAKRON_BLASTER_8 109
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -