jedioutcast/CODE-mp/game/bg_public.h
2013-04-04 13:24:26 -05:00

1051 lines
27 KiB
C

// Copyright (C) 1999-2000 Id Software, Inc.
//
// bg_public.h -- definitions shared by both the server game and client game modules
// because games can change separately from the main system version, we need a
// second version that must match between game and cgame
#ifndef __BG_PUBLIC_H__
#define __BG_PUBLIC_H__
#include "bg_weapons.h"
#include "anims.h"
#define GAME_VERSION "basejk-1"
#define DEFAULT_GRAVITY 800
#define GIB_HEALTH -40
#define ARMOR_PROTECTION 0.50 // Shields only stop 50% of armor-piercing dmg
#define ARMOR_REDUCTION_FACTOR 0.50 // Certain damage doesn't take off armor as efficiently
#define JUMP_VELOCITY 225//270
#define MAX_ITEMS 256
#define RANK_TIED_FLAG 0x4000
#define ITEM_RADIUS 15 // item sizes are needed for client side pickup detection
#define SCORE_NOT_PRESENT -9999 // for the CS_SCORES[12] when only one player is present
#define VOTE_TIME 30000 // 30 seconds before vote times out
#define DEFAULT_MINS_2 -24
#define DEFAULT_MAXS_2 40
#define CROUCH_MAXS_2 16
#define STANDARD_VIEWHEIGHT_OFFSET -4
#define MINS_Z -24
#define DEFAULT_VIEWHEIGHT (DEFAULT_MAXS_2+STANDARD_VIEWHEIGHT_OFFSET)//26
#define CROUCH_VIEWHEIGHT (CROUCH_MAXS_2+STANDARD_VIEWHEIGHT_OFFSET)//12
#define DEAD_VIEWHEIGHT -16
#define MAX_CLIENT_SCORE_SEND 20
//
// config strings are a general means of communicating variable length strings
// from the server to all connected clients.
//
// CS_SERVERINFO and CS_SYSTEMINFO are defined in q_shared.h
#define CS_MUSIC 2
#define CS_MESSAGE 3 // from the map worldspawn's message field
#define CS_MOTD 4 // g_motd string for server message of the day
#define CS_WARMUP 5 // server time when the match will be restarted
#define CS_SCORES1 6
#define CS_SCORES2 7
#define CS_VOTE_TIME 8
#define CS_VOTE_STRING 9
#define CS_VOTE_YES 10
#define CS_VOTE_NO 11
#define CS_TEAMVOTE_TIME 12
#define CS_TEAMVOTE_STRING 14
#define CS_TEAMVOTE_YES 16
#define CS_TEAMVOTE_NO 18
#define CS_GAME_VERSION 20
#define CS_LEVEL_START_TIME 21 // so the timer only shows the current level
#define CS_INTERMISSION 22 // when 1, fraglimit/timelimit has been hit and intermission will start in a second or two
#define CS_FLAGSTATUS 23 // string indicating flag status in CTF
#define CS_SHADERSTATE 24
#define CS_BOTINFO 25
#define CS_ITEMS 27 // string of 0's and 1's that tell which items are present
#define CS_CLIENT_JEDIMASTER 28 // current jedi master
#define CS_CLIENT_DUELWINNER 29 // current duel round winner - needed for printing at top of scoreboard
#define CS_CLIENT_DUELISTS 30 // client numbers for both current duelists. Needed for a number of client-side things.
// these are also in be_aas_def.h - argh (rjr)
#define CS_MODELS 32
#define CS_SOUNDS (CS_MODELS+MAX_MODELS)
#define CS_PLAYERS (CS_SOUNDS+MAX_SOUNDS)
/*
Ghoul2 Insert Start
*/
#define CS_CHARSKINS (CS_PLAYERS+MAX_CLIENTS)
/*
Ghoul2 Insert End
*/
#define CS_LOCATIONS (CS_CHARSKINS+MAX_CHARSKINS)
#define CS_PARTICLES (CS_LOCATIONS+MAX_LOCATIONS)
#define CS_EFFECTS (CS_PARTICLES+MAX_LOCATIONS)
#define CS_LIGHT_STYLES (CS_EFFECTS + MAX_FX)
#define CS_STRING_PACKAGES (CS_LIGHT_STYLES + (MAX_LIGHT_STYLES*3))
#define CS_MAX (CS_STRING_PACKAGES+MAX_STRING_PACKAGES)
#if (CS_MAX) > MAX_CONFIGSTRINGS
#error overflow: (CS_MAX) > MAX_CONFIGSTRINGS
#endif
typedef enum {
G2_MODELPART_HEAD = 10,
G2_MODELPART_WAIST,
G2_MODELPART_LARM,
G2_MODELPART_RARM,
G2_MODELPART_LLEG,
G2_MODELPART_RLEG
} g2ModelParts_t;
#define G2_MODEL_PART 50
typedef enum {
HANDEXTEND_NONE = 0,
HANDEXTEND_FORCEPUSH,
HANDEXTEND_FORCEPULL,
HANDEXTEND_FORCEGRIP,
HANDEXTEND_SABERPULL,
HANDEXTEND_CHOKE, //use handextend priorities to choke someone being gripped
HANDEXTEND_WEAPONREADY,
HANDEXTEND_DODGE,
HANDEXTEND_KNOCKDOWN,
HANDEXTEND_DUELCHALLENGE,
HANDEXTEND_TAUNT
} forceHandAnims_t;
typedef enum {
GT_FFA, // free for all
GT_HOLOCRON, // holocron ffa
GT_JEDIMASTER, // jedi master
GT_TOURNAMENT, // one on one tournament
GT_SINGLE_PLAYER, // single player ffa
//-- team games go after this --
GT_TEAM, // team deathmatch
GT_SAGA, // saga
GT_CTF, // capture the flag
GT_CTY,
GT_MAX_GAME_TYPE
} gametype_t;
typedef enum { GENDER_MALE, GENDER_FEMALE, GENDER_NEUTER } gender_t;
extern vec3_t WP_MuzzlePoint[WP_NUM_WEAPONS];
extern int forcePowerSorted[NUM_FORCE_POWERS];
/*
===================================================================================
PMOVE MODULE
The pmove code takes a player_state_t and a usercmd_t and generates a new player_state_t
and some other output data. Used for local prediction on the client game and true
movement on the server game.
===================================================================================
*/
typedef struct animation_s {
int firstFrame;
int numFrames;
int loopFrames; // 0 to numFrames
int frameLerp; // msec between frames
int initialLerp; // msec to get to first frame
int reversed; // true if animation is reversed
int flipflop; // true if animation should flipflop back to base
} animation_t;
extern qboolean BGPAFtextLoaded;
extern animation_t bgGlobalAnimations[MAX_TOTALANIMATIONS];
// flip the togglebit every time an animation
// changes so a restart of the same anim can be detected
#define ANIM_TOGGLEBIT 2048 // Maximum number of animation sequences is 2048 (0-2047). 12th bit is the toggle
typedef enum {
PM_NORMAL, // can accelerate and turn
PM_FLOAT, // float with no gravity in general direction of velocity (intended for gripping)
PM_NOCLIP, // noclip movement
PM_SPECTATOR, // still run into walls
PM_DEAD, // no acceleration or turning, but free falling
PM_FREEZE, // stuck in place with no control
PM_INTERMISSION, // no movement or status bar
PM_SPINTERMISSION // no movement or status bar
} pmtype_t;
typedef enum {
WEAPON_READY,
WEAPON_RAISING,
WEAPON_DROPPING,
WEAPON_FIRING,
WEAPON_CHARGING,
WEAPON_CHARGING_ALT,
WEAPON_IDLE, //lowered // NOTENOTE Added with saber
} weaponstate_t;
typedef enum {
FORCE_MASTERY_UNINITIATED,
FORCE_MASTERY_INITIATE,
FORCE_MASTERY_PADAWAN,
FORCE_MASTERY_JEDI,
FORCE_MASTERY_JEDI_GUARDIAN,
FORCE_MASTERY_JEDI_ADEPT,
FORCE_MASTERY_JEDI_KNIGHT,
FORCE_MASTERY_JEDI_MASTER,
NUM_FORCE_MASTERY_LEVELS
};
extern char *forceMasteryLevels[NUM_FORCE_MASTERY_LEVELS];
extern int forceMasteryPoints[NUM_FORCE_MASTERY_LEVELS];
extern int bgForcePowerCost[NUM_FORCE_POWERS][NUM_FORCE_POWER_LEVELS];
// pmove->pm_flags
#define PMF_DUCKED 1
#define PMF_JUMP_HELD 2
#define PMF_ROLLING 4
#define PMF_BACKWARDS_JUMP 8 // go into backwards land
#define PMF_BACKWARDS_RUN 16 // coast down to backwards run
#define PMF_TIME_LAND 32 // pm_time is time before rejump
#define PMF_TIME_KNOCKBACK 64 // pm_time is an air-accelerate only time
#define PMF_TIME_WATERJUMP 256 // pm_time is waterjump
#define PMF_RESPAWNED 512 // clear after attack and jump buttons come up
#define PMF_USE_ITEM_HELD 1024
#define PMF_UPDATE_ANIM 2048 // The server updated the animation, the pmove should set the ghoul2 anim to match.
#define PMF_FOLLOW 4096 // spectate following another player
#define PMF_SCOREBOARD 8192 // spectate as a scoreboard
#define PMF_ALL_TIMES (PMF_TIME_WATERJUMP|PMF_TIME_LAND|PMF_TIME_KNOCKBACK)
#define MAXTOUCH 32
typedef struct {
// state (in / out)
playerState_t *ps;
// command (in)
usercmd_t cmd;
int tracemask; // collide against these types of surfaces
int debugLevel; // if set, diagnostic output will be printed
qboolean noFootsteps; // if the game is setup for no footsteps by the server
qboolean gauntletHit; // true if a gauntlet attack would actually hit something
int framecount;
// results (out)
int numtouch;
int touchents[MAXTOUCH];
int useEvent;
vec3_t mins, maxs; // bounding box size
int watertype;
int waterlevel;
int gametype;
animation_t *animations;
float xyspeed;
// for fixed msec Pmove
int pmove_fixed;
int pmove_msec;
// callbacks to test the world
// these will be different functions during game and cgame
void (*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask );
int (*pointcontents)( const vec3_t point, int passEntityNum );
playerState_t *bgClients[MAX_CLIENTS];
} pmove_t;
extern pmove_t *pm;
#define SETANIM_TORSO 1
#define SETANIM_LEGS 2
#define SETANIM_BOTH SETANIM_TORSO|SETANIM_LEGS//3
#define SETANIM_FLAG_NORMAL 0//Only set if timer is 0
#define SETANIM_FLAG_OVERRIDE 1//Override previous
#define SETANIM_FLAG_HOLD 2//Set the new timer
#define SETANIM_FLAG_RESTART 4//Allow restarting the anim if playing the same one (weapon fires)
#define SETANIM_FLAG_HOLDLESS 8//Set the new timer
// if a full pmove isn't done on the client, you can just update the angles
void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd );
void Pmove (pmove_t *pmove);
//===================================================================================
// player_state->stats[] indexes
// NOTE: may not have more than 16
typedef enum {
STAT_HEALTH,
STAT_HOLDABLE_ITEM,
STAT_HOLDABLE_ITEMS,
STAT_PERSISTANT_POWERUP,
STAT_WEAPONS, // 16 bit fields
STAT_ARMOR,
STAT_DEAD_YAW, // look this direction when dead (FIXME: get rid of?)
STAT_CLIENTS_READY, // bit mask of clients wishing to exit the intermission (FIXME: configstring?)
STAT_MAX_HEALTH // health / armor limit, changable by handicap
} statIndex_t;
// player_state->persistant[] indexes
// these fields are the only part of player_state that isn't
// cleared on respawn
// NOTE: may not have more than 16
typedef enum {
PERS_SCORE, // !!! MUST NOT CHANGE, SERVER AND GAME BOTH REFERENCE !!!
PERS_HITS, // total points damage inflicted so damage beeps can sound on change
PERS_RANK, // player rank or team rank
PERS_TEAM, // player team
PERS_SPAWN_COUNT, // incremented every respawn
PERS_PLAYEREVENTS, // 16 bits that can be flipped for events
PERS_ATTACKER, // clientnum of last damage inflicter
PERS_ATTACKEE_ARMOR, // health/armor of last person we attacked
PERS_KILLED, // count of the number of times you died
// player awards tracking
PERS_IMPRESSIVE_COUNT, // two railgun hits in a row
PERS_EXCELLENT_COUNT, // two successive kills in a short amount of time
PERS_DEFEND_COUNT, // defend awards
PERS_ASSIST_COUNT, // assist awards
PERS_GAUNTLET_FRAG_COUNT, // kills with the guantlet
PERS_CAPTURES // captures
} persEnum_t;
// entityState_t->eFlags
#define EF_DEAD 0x00000001 // don't draw a foe marker over players with EF_DEAD
#define EF_BOUNCE_SHRAPNEL 0x00000002 // special shrapnel flag
#define EF_TELEPORT_BIT 0x00000004 // toggled every time the origin abruptly changes
#define EF_AWARD_EXCELLENT 0x00000008 // draw an excellent sprite
#define EF_PLAYER_EVENT 0x00000010
#define EF_BOUNCE 0x00000010 // for missiles
#define EF_BOUNCE_HALF 0x00000020 // for missiles
#define EF_AWARD_GAUNTLET 0x00000040 // draw a gauntlet sprite
#define EF_NODRAW 0x00000080 // may have an event, but no model (unspawned items)
#define EF_FIRING 0x00000100 // for lightning gun
#define EF_ALT_FIRING 0x00000200 // for alt-fires, mostly for lightning guns though
#define EF_MOVER_STOP 0x00000400 // will push otherwise
#define EF_AWARD_CAP 0x00000800 // draw the capture sprite
#define EF_TALK 0x00001000 // draw a talk balloon
#define EF_CONNECTION 0x00002000 // draw a connection trouble sprite
#define EF_VOTED 0x00004000 // already cast a vote
#define EF_AWARD_IMPRESSIVE 0x00008000 // draw an impressive sprite
#define EF_AWARD_DEFEND 0x00010000 // draw a defend sprite
#define EF_AWARD_ASSIST 0x00020000 // draw a assist sprite
#define EF_AWARD_DENIED 0x00040000 // denied
#define EF_TEAMVOTED 0x00080000 // already cast a team vote
#define EF_SEEKERDRONE 0x00100000 // show seeker drone floating around head
#define EF_MISSILE_STICK 0x00200000 // missiles that stick to the wall.
#define EF_ITEMPLACEHOLDER 0x00400000 // item effect
#define EF_SOUNDTRACKER 0x00800000 // sound position needs to be updated in relation to another entity
#define EF_DROPPEDWEAPON 0x01000000 // it's a dropped weapon
#define EF_DISINTEGRATION 0x02000000 // being disintegrated by the disruptor
#define EF_INVULNERABLE 0x04000000 // just spawned in or whatever, so is protected
typedef enum {
EFFECT_NONE = 0,
EFFECT_SMOKE,
EFFECT_EXPLOSION,
EFFECT_EXPLOSION_PAS,
EFFECT_SPARK_EXPLOSION,
EFFECT_EXPLOSION_TRIPMINE,
EFFECT_EXPLOSION_DETPACK,
EFFECT_EXPLOSION_FLECHETTE,
EFFECT_STUNHIT,
EFFECT_EXPLOSION_DEMP2ALT,
EFFECT_MAX
} effectTypes_t;
// NOTE: may not have more than 16
typedef enum {
PW_NONE,
PW_QUAD,
PW_BATTLESUIT,
PW_HASTE,
//PW_INVIS, //rww - removed
//PW_REGEN, //rww - removed
//PW_FLIGHT, //rww - removed
PW_REDFLAG,
PW_BLUEFLAG,
PW_NEUTRALFLAG,
PW_SHIELDHIT,
//PW_SCOUT, //rww - removed
//PW_GUARD, //rww - removed
//PW_DOUBLER, //rww - removed
//PW_AMMOREGEN, //rww - removed
PW_SPEEDBURST,
PW_DISINT_4,
PW_SPEED,
PW_FORCE_LIGHTNING,
PW_FORCE_ENLIGHTENED_LIGHT,
PW_FORCE_ENLIGHTENED_DARK,
PW_FORCE_BOON,
PW_YSALAMIRI,
PW_NUM_POWERUPS
} powerup_t;
typedef enum {
HI_NONE,
HI_SEEKER,
HI_SHIELD,
HI_MEDPAC,
HI_DATAPAD,
HI_BINOCULARS,
HI_SENTRY_GUN,
HI_NUM_HOLDABLE
} holdable_t;
typedef enum {
CTFMESSAGE_FRAGGED_FLAG_CARRIER,
CTFMESSAGE_FLAG_RETURNED,
CTFMESSAGE_PLAYER_RETURNED_FLAG,
CTFMESSAGE_PLAYER_CAPTURED_FLAG,
CTFMESSAGE_PLAYER_GOT_FLAG
} ctfMsg_t;
// reward sounds (stored in ps->persistant[PERS_PLAYEREVENTS])
#define PLAYEREVENT_DENIEDREWARD 0x0001
#define PLAYEREVENT_GAUNTLETREWARD 0x0002
// entityState_t->event values
// entity events are for effects that take place reletive
// to an existing entities origin. Very network efficient.
// two bits at the top of the entityState->event field
// will be incremented with each change in the event so
// that an identical event started twice in a row can
// be distinguished. And off the value with ~EV_EVENT_BITS
// to retrieve the actual event number
#define EV_EVENT_BIT1 0x00000100
#define EV_EVENT_BIT2 0x00000200
#define EV_EVENT_BITS (EV_EVENT_BIT1|EV_EVENT_BIT2)
#define EVENT_VALID_MSEC 300
typedef enum
{
PDSOUND_NONE,
PDSOUND_PROTECTHIT,
PDSOUND_PROTECT,
PDSOUND_ABSORBHIT,
PDSOUND_ABSORB,
PDSOUND_FORCEJUMP,
PDSOUND_FORCEGRIP
} pdSounds_t;
typedef enum {
EV_NONE,
EV_CLIENTJOIN,
EV_FOOTSTEP,
EV_FOOTSTEP_METAL,
EV_FOOTSPLASH,
EV_FOOTWADE,
EV_SWIM,
EV_STEP_4,
EV_STEP_8,
EV_STEP_12,
EV_STEP_16,
EV_FALL,
EV_JUMP_PAD, // boing sound at origin, jump sound on player
EV_PRIVATE_DUEL,
EV_JUMP,
EV_ROLL,
EV_WATER_TOUCH, // foot touches
EV_WATER_LEAVE, // foot leaves
EV_WATER_UNDER, // head touches
EV_WATER_CLEAR, // head leaves
EV_ITEM_PICKUP, // normal item pickups are predictable
EV_GLOBAL_ITEM_PICKUP, // powerup / team sounds are broadcast to everyone
EV_NOAMMO,
EV_CHANGE_WEAPON,
EV_FIRE_WEAPON,
EV_ALT_FIRE,
EV_SABER_ATTACK,
EV_SABER_HIT,
EV_SABER_BLOCK,
EV_SABER_UNHOLSTER,
EV_BECOME_JEDIMASTER,
EV_DISRUPTOR_MAIN_SHOT,
EV_DISRUPTOR_SNIPER_SHOT,
EV_DISRUPTOR_SNIPER_MISS,
EV_DISRUPTOR_HIT,
EV_DISRUPTOR_ZOOMSOUND,
EV_PREDEFSOUND,
EV_TEAM_POWER,
EV_SCREENSHAKE,
EV_USE, // +Use key
EV_USE_ITEM0,
EV_USE_ITEM1,
EV_USE_ITEM2,
EV_USE_ITEM3,
EV_USE_ITEM4,
EV_USE_ITEM5,
EV_USE_ITEM6,
EV_USE_ITEM7,
EV_USE_ITEM8,
EV_USE_ITEM9,
EV_USE_ITEM10,
EV_USE_ITEM11,
EV_USE_ITEM12,
EV_USE_ITEM13,
EV_USE_ITEM14,
EV_USE_ITEM15,
EV_ITEMUSEFAIL,
EV_ITEM_RESPAWN,
EV_ITEM_POP,
EV_PLAYER_TELEPORT_IN,
EV_PLAYER_TELEPORT_OUT,
EV_GRENADE_BOUNCE, // eventParm will be the soundindex
EV_MISSILE_STICK, // eventParm will be the soundindex
EV_PLAY_EFFECT,
EV_PLAY_EFFECT_ID,
EV_MUTE_SOUND,
EV_GENERAL_SOUND,
EV_GLOBAL_SOUND, // no attenuation
EV_GLOBAL_TEAM_SOUND,
EV_ENTITY_SOUND,
EV_PLAY_ROFF,
EV_GLASS_SHATTER,
EV_DEBRIS,
EV_MISSILE_HIT,
EV_MISSILE_MISS,
EV_MISSILE_MISS_METAL,
EV_BULLET, // otherEntity is the shooter
EV_PAIN,
EV_DEATH1,
EV_DEATH2,
EV_DEATH3,
EV_OBITUARY,
EV_POWERUP_QUAD,
EV_POWERUP_BATTLESUIT,
//EV_POWERUP_REGEN,
EV_FORCE_DRAINED,
EV_GIB_PLAYER, // gib a previously living player
EV_SCOREPLUM, // score plum
EV_CTFMESSAGE,
EV_SAGA_ROUNDOVER,
EV_SAGA_OBJECTIVECOMPLETE,
EV_DESTROY_GHOUL2_INSTANCE,
EV_DESTROY_WEAPON_MODEL,
EV_GIVE_NEW_RANK,
EV_SET_FREE_SABER,
EV_SET_FORCE_DISABLE,
EV_WEAPON_CHARGE,
EV_WEAPON_CHARGE_ALT,
EV_SHIELD_HIT,
EV_DEBUG_LINE,
EV_TESTLINE,
EV_STOPLOOPINGSOUND,
EV_STARTLOOPINGSOUND,
EV_TAUNT,
EV_TAUNT_YES,
EV_TAUNT_NO,
EV_TAUNT_FOLLOWME,
EV_TAUNT_GETFLAG,
EV_TAUNT_GUARDBASE,
EV_TAUNT_PATROL,
EV_BODY_QUEUE_COPY,
} entity_event_t; // There is a maximum of 256 events (8 bits transmission, 2 high bits for uniqueness)
typedef enum {
GTS_RED_CAPTURE,
GTS_BLUE_CAPTURE,
GTS_RED_RETURN,
GTS_BLUE_RETURN,
GTS_RED_TAKEN,
GTS_BLUE_TAKEN,
GTS_REDTEAM_SCORED,
GTS_BLUETEAM_SCORED,
GTS_REDTEAM_TOOK_LEAD,
GTS_BLUETEAM_TOOK_LEAD,
GTS_TEAMS_ARE_TIED
} global_team_sound_t;
typedef enum {
TEAM_FREE,
TEAM_RED,
TEAM_BLUE,
TEAM_SPECTATOR,
TEAM_NUM_TEAMS
} team_t;
// Time between location updates
#define TEAM_LOCATION_UPDATE_TIME 1000
// How many players on the overlay
#define TEAM_MAXOVERLAY 32
//team task
typedef enum {
TEAMTASK_NONE,
TEAMTASK_OFFENSE,
TEAMTASK_DEFENSE,
TEAMTASK_PATROL,
TEAMTASK_FOLLOW,
TEAMTASK_RETRIEVE,
TEAMTASK_ESCORT,
TEAMTASK_CAMP
} teamtask_t;
// means of death
typedef enum {
MOD_UNKNOWN,
MOD_STUN_BATON,
MOD_MELEE,
MOD_SABER,
MOD_BRYAR_PISTOL,
MOD_BRYAR_PISTOL_ALT,
MOD_BLASTER,
MOD_DISRUPTOR,
MOD_DISRUPTOR_SPLASH,
MOD_DISRUPTOR_SNIPER,
MOD_BOWCASTER,
MOD_REPEATER,
MOD_REPEATER_ALT,
MOD_REPEATER_ALT_SPLASH,
MOD_DEMP2,
MOD_DEMP2_ALT,
MOD_FLECHETTE,
MOD_FLECHETTE_ALT_SPLASH,
MOD_ROCKET,
MOD_ROCKET_SPLASH,
MOD_ROCKET_HOMING,
MOD_ROCKET_HOMING_SPLASH,
MOD_THERMAL,
MOD_THERMAL_SPLASH,
MOD_TRIP_MINE_SPLASH,
MOD_TIMED_MINE_SPLASH,
MOD_DET_PACK_SPLASH,
MOD_FORCE_DARK,
MOD_SENTRY,
MOD_WATER,
MOD_SLIME,
MOD_LAVA,
MOD_CRUSH,
MOD_TELEFRAG,
MOD_FALLING,
MOD_SUICIDE,
MOD_TARGET_LASER,
MOD_TRIGGER_HURT,
MOD_MAX
} meansOfDeath_t;
//---------------------------------------------------------
// gitem_t->type
typedef enum {
IT_BAD,
IT_WEAPON, // EFX: rotate + upscale + minlight
IT_AMMO, // EFX: rotate
IT_ARMOR, // EFX: rotate + minlight
IT_HEALTH, // EFX: static external sphere + rotating internal
IT_POWERUP, // instant on, timer based
// EFX: rotate + external ring that rotates
IT_HOLDABLE, // single use, holdable item
// EFX: rotate + bob
IT_PERSISTANT_POWERUP,
IT_TEAM
} itemType_t;
#define MAX_ITEM_MODELS 4
typedef struct gitem_s {
char *classname; // spawning name
char *pickup_sound;
char *world_model[MAX_ITEM_MODELS];
char *view_model;
char *icon;
// char *pickup_name; // for printing on pickup
int quantity; // for ammo how much, or duration of powerup
itemType_t giType; // IT_* flags
int giTag;
char *precaches; // string of all models and images this item will use
char *sounds; // string of all sounds this item will use
} gitem_t;
// included in both the game dll and the client
extern gitem_t bg_itemlist[];
extern int bg_numItems;
float vectoyaw( const vec3_t vec );
gitem_t *BG_FindItem( const char *classname );
gitem_t *BG_FindItemForWeapon( weapon_t weapon );
gitem_t *BG_FindItemForPowerup( powerup_t pw );
gitem_t *BG_FindItemForHoldable( holdable_t pw );
#define ITEM_INDEX(x) ((x)-bg_itemlist)
qboolean BG_CanItemBeGrabbed( int gametype, const entityState_t *ent, const playerState_t *ps );
#define SABER_BLOCK_DUR 150 // number of milliseconds a block animation should take.
// g_dmflags->integer flags
#define DF_NO_FALLING 8
#define DF_FIXED_FOV 16
#define DF_NO_FOOTSTEPS 32
// content masks
#define MASK_ALL (-1)
#define MASK_SOLID (CONTENTS_SOLID)
#define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_BODY)
#define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP)
#define MASK_WATER (CONTENTS_WATER|CONTENTS_LAVA|CONTENTS_SLIME)
#define MASK_OPAQUE (CONTENTS_SOLID|CONTENTS_SLIME|CONTENTS_LAVA)
#define MASK_SHOT (CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_CORPSE)
//
// entityState_t->eType
//
typedef enum {
ET_GENERAL,
ET_PLAYER,
ET_ITEM,
ET_MISSILE,
ET_SPECIAL, // rww - force fields
ET_HOLOCRON, // rww - holocron icon displays
ET_MOVER,
ET_BEAM,
ET_PORTAL,
ET_SPEAKER,
ET_PUSH_TRIGGER,
ET_TELEPORT_TRIGGER,
ET_INVISIBLE,
ET_GRAPPLE, // grapple hooked on wall
ET_TEAM,
ET_BODY,
ET_EVENTS // any of the EV_* events can be added freestanding
// by setting eType to ET_EVENTS + eventNum
// this avoids having to set eFlags and eventNum
} entityType_t;
// Okay, here lies the much-dreaded Pat-created FSM movement chart... Heretic II strikes again!
// Why am I inflicting this on you? Well, it's better than hardcoded states.
// Ideally this will be replaced with an external file or more sophisticated move-picker
// once the game gets out of prototype stage.
// rww - Moved all this to bg_public so that we can access the saberMoveData stuff on the cgame
// which is currently used for determining if a saber trail should be rendered in a given frame
typedef enum {
// Invalid, or saber not armed
LS_NONE = 0,
// General movements with saber
LS_READY,
LS_DRAW,
LS_PUTAWAY,
// Attacks
LS_A_TL2BR,//4
LS_A_L2R,
LS_A_BL2TR,
LS_A_BR2TL,
LS_A_R2L,
LS_A_TR2BL,
LS_A_T2B,
LS_A_BACKSTAB,
LS_A_BACK,
LS_A_BACK_CR,
LS_A_LUNGE,
LS_A_JUMP_T__B_,
LS_A_FLIP_STAB,
LS_A_FLIP_SLASH,
//starts
LS_S_TL2BR,//26
LS_S_L2R,
LS_S_BL2TR,//# Start of attack chaining to SLASH LR2UL
LS_S_BR2TL,//# Start of attack chaining to SLASH LR2UL
LS_S_R2L,
LS_S_TR2BL,
LS_S_T2B,
//returns
LS_R_TL2BR,//33
LS_R_L2R,
LS_R_BL2TR,
LS_R_BR2TL,
LS_R_R2L,
LS_R_TR2BL,
LS_R_T2B,
//transitions
LS_T1_BR__R,//40
LS_T1_BR_TR,
LS_T1_BR_T_,
LS_T1_BR_TL,
LS_T1_BR__L,
LS_T1_BR_BL,
LS_T1__R_BR,//46
LS_T1__R_TR,
LS_T1__R_T_,
LS_T1__R_TL,
LS_T1__R__L,
LS_T1__R_BL,
LS_T1_TR_BR,//52
LS_T1_TR__R,
LS_T1_TR_T_,
LS_T1_TR_TL,
LS_T1_TR__L,
LS_T1_TR_BL,
LS_T1_T__BR,//58
LS_T1_T___R,
LS_T1_T__TR,
LS_T1_T__TL,
LS_T1_T___L,
LS_T1_T__BL,
LS_T1_TL_BR,//64
LS_T1_TL__R,
LS_T1_TL_TR,
LS_T1_TL_T_,
LS_T1_TL__L,
LS_T1_TL_BL,
LS_T1__L_BR,//70
LS_T1__L__R,
LS_T1__L_TR,
LS_T1__L_T_,
LS_T1__L_TL,
LS_T1__L_BL,
LS_T1_BL_BR,//76
LS_T1_BL__R,
LS_T1_BL_TR,
LS_T1_BL_T_,
LS_T1_BL_TL,
LS_T1_BL__L,
//Bounces
LS_B1_BR,
LS_B1__R,
LS_B1_TR,
LS_B1_T_,
LS_B1_TL,
LS_B1__L,
LS_B1_BL,
//Deflected attacks
LS_D1_BR,
LS_D1__R,
LS_D1_TR,
LS_D1_T_,
LS_D1_TL,
LS_D1__L,
LS_D1_BL,
LS_D1_B_,
//Reflected attacks
LS_V1_BR,
LS_V1__R,
LS_V1_TR,
LS_V1_T_,
LS_V1_TL,
LS_V1__L,
LS_V1_BL,
LS_V1_B_,
// Broken parries
LS_H1_T_,//
LS_H1_TR,
LS_H1_TL,
LS_H1_BR,
LS_H1_B_,
LS_H1_BL,
// Knockaways
LS_K1_T_,//
LS_K1_TR,
LS_K1_TL,
LS_K1_BR,
LS_K1_BL,
// Parries
LS_PARRY_UP,//
LS_PARRY_UR,
LS_PARRY_UL,
LS_PARRY_LR,
LS_PARRY_LL,
// Projectile Reflections
LS_REFLECT_UP,//
LS_REFLECT_UR,
LS_REFLECT_UL,
LS_REFLECT_LR,
LS_REFLECT_LL,
LS_MOVE_MAX//
} saberMoveName_t;
typedef enum {
Q_BR,
Q_R,
Q_TR,
Q_T,
Q_TL,
Q_L,
Q_BL,
Q_B,
Q_NUM_QUADS
} saberQuadrant_t;
typedef struct
{
char *name;
int animToUse;
int startQuad;
int endQuad;
unsigned animSetFlags;
int blendTime;
int blocking;
saberMoveName_t chain_idle; // What move to call if the attack button is not pressed at the end of this anim
saberMoveName_t chain_attack; // What move to call if the attack button (and nothing else) is pressed
qboolean trailLength;
} saberMoveData_t;
extern saberMoveData_t saberMoveData[LS_MOVE_MAX];
qboolean BG_LegalizedForcePowers(char *powerOut, int maxRank, qboolean freeSaber, int teamForce, int gametype, int fpDisabled);
//BG anim utility functions:
qboolean BG_InSpecialJump( int anim );
qboolean BG_InSaberStandAnim( int anim );
qboolean BG_DirectFlippingAnim( int anim );
qboolean BG_SaberInAttack( int move );
qboolean BG_SaberInSpecial( int move );
qboolean BG_SaberInIdle( int move );
qboolean BG_FlippingAnim( int anim );
qboolean BG_SpinningSaberAnim( int anim );
qboolean BG_SaberInSpecialAttack( int anim );
qboolean BG_InRoll( playerState_t *ps, int anim );
qboolean BG_InDeathAnim( int anim );
void BG_SaberStartTransAnim( int saberAnimLevel, int anim, float *animSpeed );
void BG_ForcePowerDrain( playerState_t *ps, forcePowers_t forcePower, int overrideAmt );
void BG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result );
void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result );
void BG_AddPredictableEventToPlayerstate( int newEvent, int eventParm, playerState_t *ps );
void BG_TouchJumpPad( playerState_t *ps, entityState_t *jumppad );
void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean snap );
void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s, int time, qboolean snap );
void BG_G2PlayerAngles( vec3_t startAngles, vec3_t legs[3], vec3_t legsAngles, int painTime, int painDirection, int currentTime,
qboolean *torso_yawing, float *torso_yawAngle, qboolean *torso_pitching, float *torso_pitchAngle, qboolean *legs_yawing, float *legs_yawAngle,
int frameTime, vec3_t velocity, int legsAnim, int torsoAnim, qboolean dead, float movementDir, void *ghoul2, qhandle_t *modelList, int weapon);
qboolean BG_PlayerTouchesItem( playerState_t *ps, entityState_t *item, int atTime );
qboolean BG_ParseAnimationFile(const char *filename);
int BG_GetItemIndexByTag(int tag, int type);
qboolean BG_HasYsalamiri(int gametype, playerState_t *ps);
qboolean BG_CanUseFPNow(int gametype, playerState_t *ps, int time, forcePowers_t power);
void *BG_Alloc ( int size );
void *BG_AllocUnaligned ( int size );
void *BG_TempAlloc( int size );
void BG_TempFree( int size );
char *BG_StringAlloc ( const char *source );
qboolean BG_OutOfMemory ( void );
extern int WeaponReadyAnim[WP_NUM_WEAPONS];
extern int WeaponAttackAnim[WP_NUM_WEAPONS];
extern int forcePowerDarkLight[NUM_FORCE_POWERS];
#define ARENAS_PER_TIER 4
#define MAX_ARENAS 1024
#define MAX_ARENAS_TEXT 8192
#define MAX_BOTS 1024
#define MAX_BOTS_TEXT 8192
#endif //__BG_PUBLIC_H__