Elder: Worked on hammering out some of the long-time bugs

plus started development on the new hud.
It also needs a few additional assets in the coming alpha pak
This commit is contained in:
Victor Chow 2001-06-08 04:35:50 +00:00
parent 59c64315e3
commit 18668685ab
12 changed files with 652 additions and 105 deletions

View file

@ -24,7 +24,81 @@ void CG_TargetCommand_f( void ) {
trap_SendConsoleCommand( va( "gc %i %i", targetNum, atoi( test ) ) );
}
/*
=================
CG_DropWeapon_f
Elder: reset local zoom, then proceed with server action
=================
*/
static void CG_DropWeapon_f (void) {
if ( !cg.snap ) {
return;
}
///Elder: spectator?
if ( cg.snap->ps.pm_flags & PMF_FOLLOW ) {
return;
}
cg.zoomed = 0;
cg.zoomLevel = 0;
trap_SendClientCommand("dropweapon");
}
/*
=================
CG_Bandage_f
Elder: reset local zoom, then proceed with server action
=================
*/
static void CG_Bandage_f (void) {
if ( !cg.snap ) {
return;
}
///Elder: spectator?
if ( cg.snap->ps.pm_flags & PMF_FOLLOW ) {
return;
}
if (cg.snap->ps.stats[STAT_BANDAGE]) {
cg.zoomed = 0;
cg.zoomLevel = 0;
}
trap_SendClientCommand("bandage");
}
/*
=================
CG_Reload_f
Elder: reset local zoom, then proceed with server action
=================
*/
static void CG_Reload_f (void) {
centity_t *cent;
cent = &cg_entities[cg.snap->ps.clientNum];
if ( !cg.snap ) {
return;
}
///Elder: spectator?
if ( cg.snap->ps.pm_flags & PMF_FOLLOW ) {
return;
}
//Elder: no clips, or full chamber means no reload
//CG_Printf("currentState.weapon: %d, clipamount: %d\n", cent->currentState.weapon, ClipAmountForAmmo(cent->currentState.weapon));
if (cg.snap->ps.stats[STAT_CLIPS] &&
cg.snap->ps.ammo[cent->currentState.weapon] < ClipAmountForAmmo(cent->currentState.weapon) ) {
cg.zoomed = 0;
cg.zoomLevel = 0;
}
trap_SendClientCommand("reload");
}
/*
=================
@ -427,7 +501,10 @@ static consoleCommand_t commands[] = {
{ "sizedown", CG_SizeDown_f },
{ "weapnext", CG_NextWeapon_f },
{ "weapprev", CG_PrevWeapon_f },
{ "weapon", CG_Weapon_f },
{ "weapon", CG_Weapon_f }, // Elder: it's for AQ2 and Q3!?
{ "dropweapon", CG_DropWeapon_f }, // Elder: added to reset zoom then goto server
{ "bandage", CG_Bandage_f }, // Elder: added to reset zoom then goto server
{ "reload", CG_Reload_f }, // Elder: added to reset zoom then goto server
{ "tell_target", CG_TellTarget_f },
{ "tell_attacker", CG_TellAttacker_f },
{ "vtell_target", CG_VoiceTellTarget_f },
@ -460,10 +537,9 @@ static consoleCommand_t commands[] = {
{ "scoresUp", CG_scrollScoresUp_f },
#endif
{ "startOrbit", CG_StartOrbit_f },
{ "loaddeferred", CG_LoadDeferredPlayers }
{ "loaddeferred", CG_LoadDeferredPlayers },
};
/*
=================
CG_ConsoleCommand
@ -539,4 +615,8 @@ void CG_InitConsoleCommands( void ) {
trap_AddCommand ("opendoor");
trap_AddCommand ("bandage");
trap_AddCommand ("drop"); // XRAY FMJ weap drop cmd
//Elder: added to give drop weapon auto-complete
trap_AddCommand ("dropweapon");
//Elder: try this
trap_AddCommand ("weapon");
}

View file

@ -495,19 +495,86 @@ CG_DrawStatusBar
================
*/
#ifndef MISSIONPACK
//#ifndef MISSIONPACK
static void CG_DrawStatusBar( void ) {
int color;
int style;
centity_t *cent;
playerState_t *ps;
int value;
int value, value2;
vec4_t hcolor;
vec3_t angles;
vec3_t origin;
qhandle_t hicon;
qhandle_t icon;
#ifdef MISSIONPACK
qhandle_t handle;
#endif
//#ifdef MISSIONPACK
// qhandle_t handle;
//#endif
static float colors [4][4] = {
{ 0.0f, 1.0f, 0.0f, 1.0f } , //full green
{ 0.8f, 0.0f, 0.0f, 0.7f } , //
{ 0.6f, 0.0f, 0.0f, 0.7f } , //
{ 0.4f, 0.0f, 0.0f, 0.7f } }; //
cent = &cg_entities[cg.snap->ps.clientNum];
ps = &cg.snap->ps;
//Draw health
value = ps->stats[STAT_HEALTH];
style = UI_LEFT|UI_DROPSHADOW;
if (value <= 25)
style |= UI_PULSE;
//Elder: Need bandaging?
if (ps->stats[STAT_BANDAGE])
hicon = cgs.media.rq3_healthicon2;
else
hicon = cgs.media.rq3_healthicon;
//Elder: dynamic health color ramps
//Blends from green to yellow to red algebraically
//100 - Green, 50 - Yellow, 25 - Red, 0 - Faded Red
//Note: These formulas are clamped from 0.0 to 1.0 algebraically
hcolor[0] = (value > 50) * (-0.02 * value + 2.0) + (value <= 50) * 1 ;
hcolor[1] = (value > 25 && value <= 50) * (0.04 * value - 1.0) + (value > 50) * 1;
hcolor[2] = 0;
hcolor[3] = (value <= 25) * (0.01 * value + 0.75) + (value > 25) * 1;
/* Elder: Old clamp routine for reference
for (i = 0; i < 4; i++) {
if (hcolor[i] > 1.0) {
CG_Printf ("Over one on %i\n",i);
hcolor[i] = 1.0;
}
else if (hcolor[i] < 0.0) {
CG_Printf ("Below zero on %i\n",i);
hcolor[i] = 0.0;
}
}*/
CG_DrawPic(8, 440, 32, 32, hicon);
UI_DrawProportionalString(44, 444, va("%d", value), style, hcolor);
//Elder: Draw weapon ammo and clips
style = UI_LEFT|UI_DROPSHADOW;
icon = cg_weapons[ cg.predictedPlayerState.weapon ].ammoIcon;
if (icon)
CG_DrawPic(152, 440, 32, 32, icon);
if ( cent->currentState.weapon ) {
value = ps->ammo[cent->currentState.weapon];
value2 = ps->stats[STAT_CLIPS];
if ( value > -1 ) {
UI_DrawProportionalString(188, 444, va("%d / %d", value, value2), style, colors[0]);
}
}
}
/* Elder: old stuff
static float colors[4][4] = {
// { 0.2, 1.0, 0.2, 1.0 } , { 1.0, 0.2, 0.2, 1.0 }, {0.5, 0.5, 0.5, 1} };
{ 1.0f, 0.69f, 0.0f, 1.0f } , // normal
@ -685,7 +752,9 @@ static void CG_DrawStatusBar( void ) {
}
#endif
}
#endif
*/
//#endif
/*
===========================================================================================
@ -1915,6 +1984,7 @@ static void CG_DrawCrosshair(void) {
float f;
float x, y;
int ca;
char *ssg_crosshair;
if ( !cg_drawCrosshair.integer ) {
return;
@ -1948,16 +2018,28 @@ static void CG_DrawCrosshair(void) {
h *= ( 1 + f );
}
x = cg_crosshairX.integer;
y = cg_crosshairY.integer;
CG_AdjustFrom640( &x, &y, &w, &h );
ca = cg_drawCrosshair.integer;
if (ca < 0) {
ca = 0;
//Elder: Sniper crosshairs - lots of hardcoded values :/
if ( cg.snap->ps.weapon==WP_SSG3000 && cg.zoomLevel > 0 && cg.zoomLevel < 4) {
x = 640 / 2;
y = 480 / 2;
//I can probably scale the zoom with the screen width -/+ keys
//But I'll do it later.
CG_DrawPic( x - 128, y - 128, 256, 256, cgs.media.ssgCrosshair[cg.zoomLevel - 1]);
return;
}
hShader = cgs.media.crosshairShader[ ca % NUM_CROSSHAIRS ];
else {
x = cg_crosshairX.integer;
y = cg_crosshairY.integer;
CG_AdjustFrom640( &x, &y, &w, &h );
ca = cg_drawCrosshair.integer;
if (ca < 0) {
ca = 0;
}
hShader = cgs.media.crosshairShader[ ca % NUM_CROSSHAIRS ];
}
trap_R_DrawStretchPic( x + cg.refdef.x + 0.5 * (cg.refdef.width - w),
y + cg.refdef.y + 0.5 * (cg.refdef.height - h),
w, h, 0, 0, 1, 1, hShader );
@ -2277,7 +2359,8 @@ static void CG_DrawAmmoWarning( void ) {
s = "LOW AMMO WARNING";
}
w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
CG_DrawBigString(320 - w / 2, 64, s, 1.0F);
//Elder: commented out for now
//CG_DrawBigString(320 - w / 2, 64, s, 1.0F);
}

View file

@ -425,6 +425,115 @@ static int propMap[128][3] = {
{0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1},
{0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1},
//Elder: new map
{0, 0, PROP_SPACE_WIDTH}, // SPACE
{3, 120, 8}, // !
{145, 168, 9}, // "
{38, 120, 15}, // #
{54, 120, 26}, // $
{81, 120, 21}, // %
{138, 120, 26}, // &
{128, 168, 5}, // '
{207, 120, 9}, // (
{228, 120, 9}, // )
{182, 120, 12}, // *
{30, 144, 15}, // +
{74, 168, 7}, // ,
{37, 96, 10}, // -
{98, 168, 8}, // .
{118, 144, 19}, // /
{230, 72, 25}, // 0
{1, 72, 21}, // 1
{26, 72, 25}, // 2
{52, 72, 25}, // 3
{78, 72, 24}, // 4
{102, 72, 26}, // 5
{128, 72, 25}, // 6
{153, 72, 25}, // 7
{178, 72, 26}, // 8
{204, 72, 25}, // 9
{55, 168, 8}, // :
{29,168, 9}, // ;
{195, 168, 14}, // <
{59, 96, 19}, // =
{219, 168, 14}, // >
{165, 168, 24}, // ?
{14, 120, 20}, // @
{1, 0, 24}, // A
{26, 0, 24}, // B
{51, 0, 24}, // C
{77, 0, 24}, // D
{103, 0, 24}, // E
{127, 0, 24}, // F
{152, 0, 24}, // G
{178, 0, 24}, // H
{203, 0, 25}, // I
{229, 0, 24}, // J
{1, 24, 25}, // K
{27, 24, 20}, // L
{52, 24, 24}, // M
{78, 24, 24}, // N
{103, 24, 24}, // O
{128, 24, 24}, // P
{153, 24, 24}, // Q
{179, 24, 24}, // R
{205, 24, 24}, // S
{233, 24, 20}, // T
{1, 48, 25}, // U
{29, 48, 22}, // V
{54, 48, 22}, // W
{77, 48, 25}, // X
{103, 48, 24}, // Y
{128, 48, 25}, // Z
{55, 144, 13}, // [
{102, 144, 10}, // '\'
{75, 144, 13}, // ]
{115, 128, 13}, // ^ Elder: fix me in tga!!
{2, 144, 15}, // _
{134, 181, 5}, // '
//Elder: note - lowercase
{1, 0, 24}, // A
{26, 0, 24}, // B
{51, 0, 24}, // C
{77, 0, 24}, // D
{103, 0, 24}, // E
{127, 0, 24}, // F
{152, 0, 24}, // G
{178, 0, 24}, // H
{203, 0, 25}, // I
{229, 0, 24}, // J
{1, 24, 25}, // K
{27, 24, 20}, // L
{52, 24, 24}, // M
{78, 24, 24}, // N
{103, 24, 24}, // O
{128, 24, 24}, // P
{153, 24, 24}, // Q
{179, 24, 24}, // R
{205, 24, 24}, // S
{233, 24, 20}, // T
{1, 48, 25}, // U
{29, 48, 22}, // V
{54, 48, 22}, // W
{77, 48, 25}, // X
{103, 48, 24}, // Y
{128, 48, 25}, // Z
{148, 144, 11}, // {
{5, 168, 10}, // |
{169, 144, 11}, // }
{85, 96, 14}, // ~
{0, 0, -1} // DEL
};
/*Elder: old one
{0, 0, PROP_SPACE_WIDTH}, // SPACE
{11, 122, 7}, // !
{154, 181, 14}, // "
@ -526,7 +635,8 @@ static int propMap[128][3] = {
{180, 152, 13}, // }
{79, 93, 17}, // ~
{0, 0, -1} // DEL
};
};*/
static int propMapB[26][3] = {
{11, 12, 33},

View file

@ -697,6 +697,7 @@ void CG_BigExplode( vec3_t playerOrigin ) {
CG_LaunchGlass
==================
*/
//Elder: might want to rotate the model randomly or do it in break glass
void CG_LaunchGlass( vec3_t origin, vec3_t velocity, qhandle_t hModel ) {
localEntity_t *le;
refEntity_t *re;
@ -734,38 +735,87 @@ void CG_BigExplode( vec3_t playerOrigin ) {
*/
#define GLASS_VELOCITY 175
#define GLASS_JUMP 125
void CG_BreakGlass( vec3_t playerOrigin ) {
void CG_BreakGlass( vec3_t playerOrigin, int glassParm ) {
vec3_t origin, velocity;
int value;
// How many shards to generate
int count = 50;
// The array of possible numbers
int states[] = {1,2,3};
int value;
int count = 40; // How many shards to generate
int states[] = {1,2,3}; // The array of possible numbers
// Get the size of the array
int numstates = sizeof(states)/sizeof(states[0]);
int numstates = sizeof(states)/sizeof(states[0]);
// Elder: The handles to our debris models
qhandle_t debris1, debris2, debris3;
// Countdown "count" so this will subtract 1 from the "count"
// X many times. X being the "count" value
while ( count-- ) {
// Generate the random number every count so every shard is a
// of the three. If this is placed above it only gets a random
// number every time a piece of glass is broken.
value = states[rand()%numstates];
VectorCopy( playerOrigin, origin );
velocity[0] = crandom()*GLASS_VELOCITY;
velocity[1] = crandom()*GLASS_VELOCITY;
velocity[2] = GLASS_JUMP + crandom()*GLASS_VELOCITY;
switch (value) {
case 1:
// If our random number was 1, generate the 1st shard piece
CG_LaunchGlass( origin, velocity, cgs.media.glass01 );
break;
case 2:
CG_LaunchGlass( origin, velocity, cgs.media.glass02 );
break;
case 3:
CG_LaunchGlass( origin, velocity, cgs.media.glass03 );
break;
//Elder: check bit amount
if ( (glassParm & RQ3_DEBRIS_SMALL) == RQ3_DEBRIS_SMALL) {
count = 8 + rand() % 5;
}
//else if ( (glassParm & RQ3_DEBRIS_MEDIUM) == RQ3_DEBRIS_MEDIUM) {
else if ( (glassParm & RQ3_DEBRIS_LARGE) == RQ3_DEBRIS_LARGE) {
count = 40 + rand() % 15;
}
else if ( (glassParm & RQ3_DEBRIS_TONS) == RQ3_DEBRIS_TONS) {
count = 65 + rand() % 25;
}
else {
//medium is default
count = 22 + rand() % 7;
}
//Elder: check debris type and assign debris models
//Using bit-op check b/c I will be stuffing the amount in there too
if ( (glassParm & RQ3_DEBRIS_WOOD) == RQ3_DEBRIS_WOOD) {
CG_Printf("Launching wood\n");
debris1 = cgs.media.wood01;
debris2 = cgs.media.wood02;
debris3 = cgs.media.wood03;
}
else if ( (glassParm & RQ3_DEBRIS_METAL) == RQ3_DEBRIS_METAL) {
CG_Printf("Launching metal\n");
debris1 = cgs.media.metal01;
debris2 = cgs.media.metal02;
debris3 = cgs.media.metal03;
}
else if ( (glassParm & RQ3_DEBRIS_CERAMIC) == RQ3_DEBRIS_CERAMIC) {
CG_Printf("Launching ceramic\n");
debris1 = cgs.media.ceramic01;
debris2 = cgs.media.ceramic02;
debris3 = cgs.media.ceramic03;
}
else if ( (glassParm & RQ3_DEBRIS_PAPER) == RQ3_DEBRIS_PAPER) {
CG_Printf("Launching paper\n");
debris1 = cgs.media.paper01;
debris2 = cgs.media.paper02;
debris3 = cgs.media.paper03;
}
else {
//glass is default
CG_Printf("Launching glass\n");
debris1 = cgs.media.glass01;
debris2 = cgs.media.glass02;
debris3 = cgs.media.glass03;
}
while ( count-- ) {
// Generate the random number every count so every shard is a
// of the three. If this is placed above it only gets a random
// number every time a piece of glass is broken.
value = states[rand()%numstates];
VectorCopy( playerOrigin, origin );
velocity[0] = crandom()*GLASS_VELOCITY;
velocity[1] = crandom()*GLASS_VELOCITY;
velocity[2] = GLASS_JUMP + crandom()*GLASS_VELOCITY;
switch (value) {
case 1:
// If our random number was 1, generate the 1st shard piece
CG_LaunchGlass( origin, velocity, debris1 );
break;
case 2:
CG_LaunchGlass( origin, velocity, debris2 );
break;
case 3:
CG_LaunchGlass( origin, velocity, debris3 );
break;
}
}
}

View file

@ -274,7 +274,8 @@ static void CG_Item( centity_t *cent ) {
wi->weaponMidpoint[1] * ent.axis[1][2] +
wi->weaponMidpoint[2] * ent.axis[2][2];
//Blaze: Dont raise the weapon, but lower it
cent->lerpOrigin[2] -= 8;
//Elder: increased value
cent->lerpOrigin[2] -= 14;
// cent->lerpOrigin[2] += 8; // an extra height boost
// Blaze: rotate the gun by 90 degrees to place it on the ground
VectorCopy(ent.axis[1], myvec);

View file

@ -757,7 +757,8 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
//
case EV_NOAMMO:
DEBUGNAME("EV_NOAMMO");
// trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.noAmmoSound );
//Elder: uncommented
trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.noAmmoSound );
if ( es->number == cg.snap->ps.clientNum ) {
CG_OutOfAmmoChange();
}
@ -765,7 +766,8 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
case EV_CHANGE_WEAPON:
DEBUGNAME("EV_CHANGE_WEAPON");
trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.selectSound );
CG_rxn_zoom(0);
//Elder: removed
//CG_rxn_zoom(0);
break;
case EV_FIRE_WEAPON:
DEBUGNAME("EV_FIRE_WEAPON");
@ -773,11 +775,12 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
break;
// Reaction Zoom
/*
case EV_ZOOM:
DEBUGNAME("EV_ZOOM");
CG_rxn_zoom(es->eventParm);
break;
*/
case EV_USE_ITEM0:
DEBUGNAME("EV_USE_ITEM0");
CG_UseItem( cent );
@ -996,6 +999,16 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
}
break;
case EV_RQ3_SOUND:
DEBUGNAME("EV_RQ3_SOUND");
//CG_Printf("EV_RQ3_SOUND\n");
if (es->eventParm == 0) {
//CG_Printf("EV_RQ3_SOUND: Kick\n");
trap_S_StartSound( NULL, es->number, CHAN_VOICE, cgs.media.kickSound);
}
break;
case EV_GLOBAL_TEAM_SOUND: // play from the player's head so it never diminishes
{
DEBUGNAME("EV_GLOBAL_TEAM_SOUND");
@ -1177,8 +1190,10 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
DEBUGNAME("EV_BREAK_GLASS");
// Change cgs.media.gibSound to whatever sound you want it to use
// I think the gib sound sounds pretty good
//Elder: gonna move this into the function
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glassSound );
CG_BreakGlass( cent->lerpOrigin );
//Elder: modified
CG_BreakGlass( cent->lerpOrigin, es->eventParm );
break;
case EV_STOPLOOPINGSOUND:
DEBUGNAME("EV_STOPLOOPINGSOUND");

View file

@ -75,6 +75,9 @@
#define DEFAULT_REDTEAM_NAME "Stroggs"
#define DEFAULT_BLUETEAM_NAME "Pagans"
//Elder: Some ssg stuff
#define ZOOM_LEVELS 3
typedef enum {
FOOTSTEP_NORMAL,
FOOTSTEP_BOOT,
@ -363,6 +366,9 @@ typedef struct weaponInfo_s {
qhandle_t weaponModel;
qhandle_t barrelModel;
qhandle_t flashModel;
//Elder: added third person model to weaponInfo structure
qhandle_t thirdModel;
vec3_t weaponMidpoint; // so it will rotate centered instead of by tag
@ -505,7 +511,6 @@ typedef struct {
int zoomTime;
float zoomSensitivity;
// information screen text during loading
char infoScreenText[MAX_STRING_CHARS];
@ -683,7 +688,25 @@ typedef struct {
qhandle_t glass01; //Blaze: Breakable glass
qhandle_t glass02; //Blaze: Breakable glass
qhandle_t glass03; //Blaze: Breakable glass
//Elder: additional debris
qhandle_t metal01;
qhandle_t metal02;
qhandle_t metal03;
qhandle_t wood01;
qhandle_t wood02;
qhandle_t wood03;
qhandle_t ceramic01;
qhandle_t ceramic02;
qhandle_t ceramic03;
qhandle_t paper01;
qhandle_t paper02;
qhandle_t paper03;
//Elder: akimbo stuff - since it's valid every game
qhandle_t akimboModel;
qhandle_t akimboFlashModel;
qhandle_t akimbo3rdModel;
qhandle_t akimboHandModel;
qhandle_t smoke2;
@ -708,6 +731,13 @@ typedef struct {
qhandle_t backTileShader;
qhandle_t noammoShader;
//Elder: sniper crosshairs
qhandle_t ssgCrosshair[ZOOM_LEVELS];
//Elder: RQ3 hud-related stuff
qhandle_t rq3_healthicon;
qhandle_t rq3_healthicon2;
qhandle_t smokePuffShader;
qhandle_t smokePuffRageProShader;
qhandle_t shotgunSmokePuffShader;
@ -795,6 +825,7 @@ typedef struct {
qhandle_t medalCapture;
// sounds
sfxHandle_t kickSound; //Elder: kick sound
sfxHandle_t quadSound;
sfxHandle_t tracerSound;
sfxHandle_t selectSound;
@ -1125,6 +1156,8 @@ extern vmCvar_t cg_deferPlayers;
extern vmCvar_t rxn_drawWeapon;
//Blaze: how long the glass stays around for
extern vmCvar_t rxn_glasstime;
//Elder: muzzle flash toggle
extern vmCvar_t rxn_flash;
extern vmCvar_t cg_drawFriend;
extern vmCvar_t cg_teamChatsOnly;
extern vmCvar_t cg_noVoiceChats;
@ -1319,8 +1352,9 @@ void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *pare
// cg_weapons.c
//
void CG_NextWeapon_f( void );
void CG_PrevWeapon_f( void );
//Elder: added?
void CG_Weapon_f( void );
void CG_PrevWeapon_f( void );
void CG_RegisterWeapon( int weaponNum );
void CG_RegisterItemVisuals( int itemNum );
@ -1336,6 +1370,7 @@ void CG_GrappleTrail( centity_t *ent, const weaponInfo_t *wi );
void CG_AddViewWeapon (playerState_t *ps);
void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent, int team );
void CG_DrawWeaponSelect( void );
void CG_RXN_Zoom( void ); //Elder: just threw it in
void CG_OutOfAmmoChange( void ); // should this be in pmove?
@ -1384,7 +1419,7 @@ void CG_ScorePlum( int client, vec3_t org, int score );
void CG_GibPlayer( vec3_t playerOrigin );
void CG_BigExplode( vec3_t playerOrigin );
void CG_BreakGlass( vec3_t playerOrigin );// Blaze: Breakable glass
void CG_BreakGlass( vec3_t playerOrigin, int glassParm );// Blaze: Breakable glass Elder: modified
void CG_Bleed( vec3_t origin, int entityNum );
localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir,

View file

@ -140,6 +140,8 @@ vmCvar_t cg_teamOverlayUserinfo;
//Blaze: reaction weapon positioning
vmCvar_t rxn_drawWeapon;
vmCvar_t rxn_glasstime;
//Elder: muzzle flash toggle
vmCvar_t rxn_flash;
vmCvar_t cg_drawFriend;
vmCvar_t cg_teamChatsOnly;
vmCvar_t cg_noVoiceChats;
@ -292,6 +294,8 @@ cvarTable_t cvarTable[] = {
//Blaze: Reaction hand type command
{ &rxn_drawWeapon, "rxn_drawWeapon", "2", CVAR_ARCHIVE },
{ &rxn_glasstime, "rxn_glasstime", "0", CVAR_ARCHIVE },
//Elder: added
{ &rxn_flash, "rxn_flash", "1", CVAR_ARCHIVE }
// { &cg_pmove_fixed, "cg_pmove_fixed", "0", CVAR_USERINFO | CVAR_ARCHIVE }
};
@ -603,11 +607,14 @@ static void CG_RegisterSounds( void ) {
cgs.media.useNothingSound = trap_S_RegisterSound( "sound/items/use_nothing.wav", qfalse );
cgs.media.gibSound = trap_S_RegisterSound( "sound/player/gibsplt1.wav", qfalse );
//Blaze: Reaction breakable glass
cgs.media.glassSound = trap_S_RegisterSound( "sound/world/glasbk.wav", qfalse );
cgs.media.glassSound = trap_S_RegisterSound( "sound/world/glassbk.wav", qfalse );
cgs.media.gibBounce1Sound = trap_S_RegisterSound( "sound/player/gibimp1.wav", qfalse );
cgs.media.gibBounce2Sound = trap_S_RegisterSound( "sound/player/gibimp2.wav", qfalse );
cgs.media.gibBounce3Sound = trap_S_RegisterSound( "sound/player/gibimp3.wav", qfalse );
//Elder: kick sound
cgs.media.kickSound = trap_S_RegisterSound( "sound/misc/kick.wav", qfalse);
#ifdef MISSIONPACK
cgs.media.useInvulnerabilitySound = trap_S_RegisterSound( "sound/items/invul_activate.wav", qfalse );
cgs.media.invulnerabilityImpactSound1 = trap_S_RegisterSound( "sound/items/invul_impact_01.wav", qfalse );
@ -935,7 +942,29 @@ static void CG_RegisterGraphics( void ) {
cgs.media.glass01 = trap_R_RegisterModel( "models/breakables/glass01.md3" );
cgs.media.glass02 = trap_R_RegisterModel( "models/breakables/glass02.md3" );
cgs.media.glass03 = trap_R_RegisterModel( "models/breakables/glass03.md3" );
//Elder: additional debris
cgs.media.wood01 = trap_R_RegisterModel( "models/breakables/wood01.md3" );
cgs.media.wood02 = trap_R_RegisterModel( "models/breakables/wood02.md3" );
cgs.media.wood03 = trap_R_RegisterModel( "models/breakables/wood03.md3" );
cgs.media.metal01 = trap_R_RegisterModel( "models/breakables/metal01.md3" );
cgs.media.metal02 = trap_R_RegisterModel( "models/breakables/metal02.md3" );
cgs.media.metal03 = trap_R_RegisterModel( "models/breakables/metal03.md3" );
cgs.media.ceramic01 = trap_R_RegisterModel( "models/breakables/ceramic01.md3" );
cgs.media.ceramic02 = trap_R_RegisterModel( "models/breakables/ceramic02.md3" );
cgs.media.ceramic03 = trap_R_RegisterModel( "models/breakables/ceramic03.md3" );
cgs.media.paper01 = trap_R_RegisterModel( "models/breakables/paper01.md3" );
cgs.media.paper02 = trap_R_RegisterModel( "models/breakables/paper02.md3" );
cgs.media.paper03 = trap_R_RegisterModel( "models/breakables/paper03.md3" );
//Elder: akimbos - some of the stuff isn't in yet :p
cgs.media.akimboModel = trap_R_RegisterModel( "models/weapons2/akimbo/akimbo.md3" );
cgs.media.akimboFlashModel = trap_R_RegisterModel( "models/weapons2/akimbo/akimbo_flash.md3" );
cgs.media.akimbo3rdModel = trap_R_RegisterModel( "models/weapons2/akimbo_3rd.md3" );
cgs.media.akimboHandModel = trap_R_RegisterModel( "models/weapons2/akimbo/akimbo_hand.md3" );
cgs.media.smoke2 = trap_R_RegisterModel( "models/weapons2/shells/s_shell.md3" );
@ -976,6 +1005,15 @@ static void CG_RegisterGraphics( void ) {
cgs.media.medalAssist = trap_R_RegisterShaderNoMip( "medal_assist" );
cgs.media.medalCapture = trap_R_RegisterShaderNoMip( "medal_capture" );
//Elder: added for sniper crosshairs
cgs.media.ssgCrosshair[0] = trap_R_RegisterShaderNoMip( "gfx/rq3_hud/ssg2x" );
cgs.media.ssgCrosshair[1] = trap_R_RegisterShaderNoMip( "gfx/rq3_hud/ssg4x" );
cgs.media.ssgCrosshair[2] = trap_R_RegisterShaderNoMip( "gfx/rq3_hud/ssg6x" );
//Elder: other hud-related elements
cgs.media.rq3_healthicon = trap_R_RegisterShaderNoMip( "gfx/rq3_hud/hud_health" );
cgs.media.rq3_healthicon2 = trap_R_RegisterShaderNoMip( "gfx/rq3_hud/hud_healthwarning" );
memset( cg_items, 0, sizeof( cg_items ) );
memset( cg_weapons, 0, sizeof( cg_weapons ) );

View file

@ -182,6 +182,10 @@ void CG_Respawn( void ) {
// select the weapon the server says we are using
cg.weaponSelect = cg.snap->ps.weapon;
//Elder: added to reset zoom stuff LOCALLY
cg.zoomed = qfalse;
cg.zoomLevel = 0;
}
extern char *eventnames[];

View file

@ -527,6 +527,10 @@ static int CG_CalcFov( void ) {
}
}
}
else {
//Elder: safety check
cg.zoomLevel = 0;
}
x = cg.refdef.width / tan( fov_x / 360 * M_PI );
fov_y = atan2( cg.refdef.height, x );

View file

@ -511,8 +511,20 @@ void CG_RegisterWeapon( int weaponNum ) {
strcat( path, "_hand.md3" );
weaponInfo->handsModel = trap_R_RegisterModel( path );
//Elder: added to cache 3rd-person models (hopefully)
strcpy( path, item->world_model[0] );
COM_StripExtension( path, path );
strcat( path, "_3rd.md3" );
weaponInfo->thirdModel = trap_R_RegisterModel( path );
if ( !weaponInfo->handsModel ) {
weaponInfo->handsModel = trap_R_RegisterModel( "models/weapons2/shotgun/shotgun_hand.md3" );
//Elder: WTF!?
weaponInfo->handsModel = trap_R_RegisterModel( "models/weapons2/m3/m3_hand.md3" );
}
//Elder: if no _3rd model, point to the weaponModel... this may get funky :)
if ( !weaponInfo->thirdModel ) {
weaponInfo->thirdModel = weaponInfo->weaponModel;
}
weaponInfo->loopFireSound = qfalse;
@ -662,8 +674,8 @@ void CG_RegisterWeapon( int weaponNum ) {
weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass;
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
break;
case WP_KNIFE:
case WP_KNIFE:
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/knife/slash.wav", qfalse );
weaponInfo->missileModel = trap_R_RegisterModel("models/weapons2/knife/knife.md3");
//weaponInfo->missileTrailFunc = CG_GrenadeTrail;
@ -672,40 +684,57 @@ void CG_RegisterWeapon( int weaponNum ) {
weaponInfo->wiTrailTime = 700;
weaponInfo->trailRadius = 32;
break;
case WP_M4:
//Elder: added
MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/m4/m4fire.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass;
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
break;
case WP_SSG3000:
//Elder: added
MAKERGB( weaponInfo->flashDlightColor, 1, 0.5f, 0 );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/ssg3000/ssgfire.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass;
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
break;
case WP_MP5:
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/mp5/mp5fire1.wav", qfalse );
//Elder: added
MAKERGB( weaponInfo->flashDlightColor, 1, 0.75f, 0 );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/mp5/mp5fire.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass;
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
break;
case WP_HANDCANNON:
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/handcannon/cannon_fire.wav", qfalse );
//Elder: added
MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 );
//Elder: changed to hcfire from cannon_fire
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/handcannon/hcfire.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_ShotgunEjectBrass;
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
break;
case WP_M3:
MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/shotgun/sshotf1b.wav", qfalse );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/m3/m3fire.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_ShotgunEjectBrass;
break;
case WP_AKIMBO:
//Elder: added
MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0.5f );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/mk23/mk23fire.wav", qfalse );
weaponInfo->flashSound[1] = trap_S_RegisterSound( "sound/weapons/mk23/mk23fire.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass;
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
break;
case WP_GRENADE:
weaponInfo->missileModel = trap_R_RegisterModel( "models/weapons2/grenade/3rd_grenade.md3" );
weaponInfo->missileModel = trap_R_RegisterModel( "models/weapons2/grenade/grenade_3rd.md3" );
weaponInfo->missileTrailFunc = CG_GrenadeTrail;
weaponInfo->wiTrailTime = 700;
weaponInfo->trailRadius = 32;
@ -1067,8 +1096,12 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
//}
if (ps == NULL)
{
switch (weaponNum)//Blaze: Used to make the third person weapon models different then 1st person
{
//Elder: We are in third person, use the third-person model
gun.hModel = weapon->thirdModel;
/* Elder: use the cached model above
switch (weaponNum)//Blaze: Used to make the third person weapon models different then 1st person
{
case 0:
//gun.hModel = trap_R_RegisterModel( "models/weapons2/mk23/3rd_mk23.md3" );
//No Case zero
@ -1100,11 +1133,11 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
case 9:
gun.hModel = trap_R_RegisterModel("models/weapons2/grenade/3rd_grenade.md3");
break;
}
}
*/
}
else
{
else {
//Elder: we are in first-person, use the first-person (default) model
gun.hModel = weapon->weaponModel;
}
@ -1137,6 +1170,8 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
frac = 1.0;
}
*/
//Elder: shouldn't have to do this anymore
/*
if (weaponNum == 4)//Blaze: Scale the Sniper Rifle down a bit
{
frac = 0.8f;
@ -1144,6 +1179,7 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
//VectorScale(parent->axis[1], frac, parent->axis[1]);
//VectorScale(parent->axis[2], frac, parent->axis[2]);
}
*/
}
CG_PositionEntityOnTag( &gun, parent, parent->hModel, "tag_weapon");
@ -1195,15 +1231,37 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
}
*/
//Elder: added to supress burst mode flashes + sounds when 'predicting'
// M4
if ( ps->weapon == WP_M4 && ps->stats[STAT_BURST] > 2 ) {
return;
}
// MP5
if ( ps->weapon == WP_MP5 && ps->stats[STAT_BURST] > 2 ) {
return;
}
// MK23
if ( ps->weapon == WP_PISTOL && ps->stats[STAT_BURST] > 0 ) {
return;
}
//Elder: re-added to fix loss of muzzle flashes!
// impulse flash
if ( cg.time - cent->muzzleFlashTime > MUZZLE_FLASH_TIME && !cent->pe.railgunFlash ) {
return;
}
memset( &flash, 0, sizeof( flash ) );
VectorCopy( parent->lightingOrigin, flash.lightingOrigin );
flash.shadowPlane = parent->shadowPlane;
flash.renderfx = parent->renderfx;
flash.hModel = weapon->flashModel;
if (!flash.hModel) {
return;
}
angles[YAW] = 0;
angles[PITCH] = 0;
angles[ROLL] = crandom() * 10;
@ -1222,9 +1280,33 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
}
*/
//Blaze: No flash
//CG_PositionRotatedEntityOnTag( &flash, &gun, weapon->weaponModel, "tag_flash");
//trap_R_AddRefEntityToScene( &flash );
//Elder: Yes flash - try this
//Elder: add conditional here so the dlight is still drawn when rxn_flash is 0
if ( rxn_flash.integer ) {
if (ps) {
//Elder: draw flash based on first-person view
CG_PositionRotatedEntityOnTag( &flash, &gun, weapon->weaponModel, "tag_flash");
}
else {
//Elder: draw flash based on 3rd-person view
CG_PositionRotatedEntityOnTag( &flash, &gun, weapon->thirdModel, "tag_flash");
}
trap_R_AddRefEntityToScene( &flash );
}
else {
//Elder: crappy way to get the dlight working w/o the flash model
if ( ps || cg.renderingThirdPerson ||
cent->currentState.number != cg.predictedPlayerState.clientNum ) {
if ( weapon->flashDlightColor[0] || weapon->flashDlightColor[1] || weapon->flashDlightColor[2] ) {
trap_R_AddLightToScene( gun.origin, 300 + (rand()&31), weapon->flashDlightColor[0],
weapon->flashDlightColor[1], weapon->flashDlightColor[2] );
}
}
return;
}
if ( ps || cg.renderingThirdPerson ||
cent->currentState.number != cg.predictedPlayerState.clientNum ) {
// add lightning bolt
@ -1355,15 +1437,16 @@ void CG_AddViewWeapon( playerState_t *ps ) {
// set up gun position
CG_CalculateWeaponPosition( hand.origin, angles );
//Blaze start: reaction gun positioning
VectorMA( hand.origin, rxn_gunx, cg.refdef.viewaxis[0], hand.origin );
VectorMA( hand.origin, rxn_guny, cg.refdef.viewaxis[1], hand.origin );
VectorMA( hand.origin, (rxn_gunz + fovOffset), cg.refdef.viewaxis[2], hand.origin );
// VectorMA( hand.origin, rxn_gunx, cg.refdef.viewaxis[0], hand.origin );
// VectorMA( hand.origin, rxn_guny, cg.refdef.viewaxis[1], hand.origin );
// VectorMA( hand.origin, (rxn_gunz + fovOffset), cg.refdef.viewaxis[2], hand.origin );
//Blaze end:
//Blaze: Use above code instead
// VectorMA( hand.origin, cg_gun_x.value, cg.refdef.viewaxis[0], hand.origin );
// VectorMA( hand.origin, cg_gun_y.value, cg.refdef.viewaxis[1], hand.origin );
// VectorMA( hand.origin, (cg_gun_z.value+fovOffset), cg.refdef.viewaxis[2], hand.origin );
//Elder: reused so Cloud can adjust the models manually
VectorMA( hand.origin, cg_gun_x.value, cg.refdef.viewaxis[0], hand.origin );
VectorMA( hand.origin, cg_gun_y.value, cg.refdef.viewaxis[1], hand.origin );
VectorMA( hand.origin, (cg_gun_z.value+fovOffset), cg.refdef.viewaxis[2], hand.origin );
AnglesToAxis( angles, hand.axis );
@ -1504,6 +1587,10 @@ void CG_NextWeapon_f( void ) {
return;
}
//Elder: added
cg.zoomed = qfalse;
cg.zoomLevel = 0;
cg.weaponSelectTime = cg.time;
original = cg.weaponSelect;
@ -1541,6 +1628,10 @@ void CG_PrevWeapon_f( void ) {
return;
}
//Elder: added
cg.zoomed = qfalse;
cg.zoomLevel = 0;
cg.weaponSelectTime = cg.time;
original = cg.weaponSelect;
@ -1563,9 +1654,24 @@ void CG_PrevWeapon_f( void ) {
}
// Hawkins (weapon command)
void CG_rxn_zoom(int n){
// Elder: Don't call it the weapon command heh :)
//void CG_RXN_Zoom(int n){
void CG_RXN_Zoom( void ) {
//Elder: reworked SSG zoom
if(cg.snap->ps.weapon==WP_SSG3000) {
cg.zoomLevel=n;
cg.zoomLevel++;
if (cg.zoomLevel == 4) {
cg.zoomed = qfalse;
cg.zoomLevel = 0;
CG_Printf("Zoomed out\n");
}
else {
cg.zoomed = qtrue;
CG_Printf("Zoomed to %dx\n", cg.zoomLevel * 2);
}
cg.zoomTime = cg.time;
}
/*
if ( n == 0 ) {
cg.zoomLevel=0;
cg.zoomed=qfalse;
@ -1577,67 +1683,81 @@ void CG_rxn_zoom(int n){
cg.zoomTime = cg.time;
CG_Printf("Zoomed to %dx\n",2*n);
}
cg.zoomTime = cg.time;
}
*/
// trap_SendClientCommand ("weapon");
}
//Elder: unused function
/*
void rxn_zoom1x(void) {
cg.zoomLevel=0;
cg.zoomed=qfalse;
cg.zoomTime = cg.time;
}
*/
/*
===============
CG_Weapon_f
Elder: does local stuff, then proceeds to server
Used with Q3's internal weapon switching "e.g. weapon 10"
===============
*/
void CG_Weapon_f( void ) {
int num;
// Hawkins (give 'weapon' dual meaning.)
if(trap_Argc()==1){
trap_SendClientCommand("weapon"); // hawkins use events
/* rxn_weapon();
return;
*/
}
int num;
if ( !cg.snap ) {
return;
}
///Elder: spectator?
if ( cg.snap->ps.pm_flags & PMF_FOLLOW ) {
return;
}
// Hawkins (give 'weapon' dual meaning)
if ( trap_Argc() == 1 ) {
//Elder: if SSG, use local zooming THEN forward to server for stats
if (cg.snap->ps.weapon == WP_SSG3000) {
CG_RXN_Zoom();
}
trap_SendClientCommand("weapon");
}
num = atoi( CG_Argv( 1 ) );
if ( num < 1 || num > 15 ) {
return;
}
//Elder: this point on is the regular Q3 weapon function - weird
cg.weaponSelectTime = cg.time;
if ( ! ( cg.snap->ps.stats[STAT_WEAPONS] & ( 1 << num ) ) ) {
return; // don't have the weapon
}
/*
// unzoom when switching weapon
rxn_zoom1x();
//Elder: If re-selecting SSG - leave function
if ( (1 << num) == (1 << WP_SSG3000) && cg.snap->ps.weapon == WP_SSG3000) {
//CG_Printf("Selecting SSG\n");
return;
}
cg.zoomed = qfalse;
cg.zoomLevel = 0;
trap_SendClientCommand("unzoom");
*/
cg.weaponSelect = num;
}
/*
===================
CG_OutOfAmmoChange
@ -1648,14 +1768,20 @@ The current weapon has just run out of ammo
void CG_OutOfAmmoChange( void ) {
int i;
/* Elder: disable auto-switch
cg.weaponSelectTime = cg.time;
//Elder: we'll have to change this to
//a) show the empty gun animation if gun's ammo = 0
//b) NOT auto-switch to another weapon
for ( i = 15 ; i > 0 ; i-- ) {
if ( CG_WeaponSelectable( i ) ) {
cg.weaponSelect = i;
break;
}
}
*/
}
@ -1688,12 +1814,13 @@ void CG_FireWeapon( centity_t *cent ) {
CG_Error( "CG_FireWeapon: ent->weapon >= WP_NUM_WEAPONS" );
return;
}
weap = &cg_weapons[ ent->weapon ];
// mark the entity as muzzle flashing, so when it is added it will
// append the flash to the weapon model
cent->muzzleFlashTime = cg.time;
// lightning gun only does this this on initial press
//Blaze: no more Lighting gun
/*
@ -1993,7 +2120,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im
light = 300;
isSprite = qtrue;
break;
*/
*/
mod = cgs.media.bulletFlashModel;
shader = cgs.media.bulletExplosionShader;
mark = cgs.media.bulletMarkShader;

View file

@ -1,6 +1,6 @@
mkdir vm
cd vm
set cc=lcc -DQ3_VM -DCGAME -S -Wf-target=bytecode -Wf-g -I..\..\cgame -I..\..\game -I..\..\ui %1
set cc=call..\compile.bat
%cc% ../../game/bg_misc.c
@if errorlevel 1 goto quit