#include "cg_local.h"#include "bg_saga.h"#include "../ui/ui_shared.h"#include "../ui/ui_public.h"#include "../namespace_begin.h"#include "../namespace_end.h"#include "../qcommon/qfiles.h"Go to the source code of this file.
Data Structures | |
| struct | lagometer_t |
| struct | veh_damage_t |
Defines | |
| #define | MAX_HUD_TICS 4 |
| #define | MAX_SHOWPOWERS NUM_FORCE_POWERS |
| #define | MAX_VHUD_SHIELD_TICS 12 |
| #define | MAX_VHUD_SPEED_TICS 5 |
| #define | MAX_VHUD_ARMOR_TICS 5 |
| #define | MAX_VHUD_AMMO_TICS 5 |
| #define | FPS_FRAMES 16 |
| #define | MAX_HEALTH_FOR_IFACE 100 |
| #define | RADAR_RADIUS 60 |
| #define | RADAR_X (580 - RADAR_RADIUS) |
| #define | RADAR_CHAT_DURATION 6000 |
| #define | RADAR_MISSILE_RANGE 3000.0f |
| #define | RADAR_ASTEROID_RANGE 10000.0f |
| #define | RADAR_MIN_ASTEROID_SURF_WARN_DIST 1200.0f |
| #define | LAG_SAMPLES 128 |
| #define | MAX_LAGOMETER_PING 900 |
| #define | MAX_LAGOMETER_RANGE 300 |
| #define | HEALTH_WIDTH 50.0f |
| #define | HEALTH_HEIGHT 5.0f |
| #define | CGTIMERBAR_H 50.0f |
| #define | CGTIMERBAR_W 10.0f |
| #define | CGTIMERBAR_X (SCREEN_WIDTH-CGTIMERBAR_W-120.0f) |
| #define | CGTIMERBAR_Y (SCREEN_HEIGHT-CGTIMERBAR_H-20.0f) |
| #define | CRAZY_CROSSHAIR_MAX_ERROR_X (100.0f*640.0f/480.0f) |
| #define | CRAZY_CROSSHAIR_MAX_ERROR_Y (100.0f) |
| #define | MAX_XHAIR_DIST_ACCURACY 20000.0f |
| #define | JPFUELBAR_H 100.0f |
| #define | JPFUELBAR_W 20.0f |
| #define | JPFUELBAR_X (SCREEN_WIDTH-JPFUELBAR_W-8.0f) |
| #define | JPFUELBAR_Y 260.0f |
| #define | EWEBHEALTH_H 100.0f |
| #define | EWEBHEALTH_W 20.0f |
| #define | EWEBHEALTH_X (SCREEN_WIDTH-EWEBHEALTH_W-8.0f) |
| #define | EWEBHEALTH_Y 290.0f |
| #define | CLFUELBAR_H 100.0f |
| #define | CLFUELBAR_W 20.0f |
| #define | CLFUELBAR_X (SCREEN_WIDTH-CLFUELBAR_W-8.0f) |
| #define | CLFUELBAR_Y 260.0f |
| #define | CHATBOX_CUTOFF_LEN 550 |
| #define | CHATBOX_FONT_HEIGHT 20 |
Enumerations | |
| enum | { VEH_DAMAGE_FRONT = 0, VEH_DAMAGE_BACK, VEH_DAMAGE_LEFT, VEH_DAMAGE_RIGHT } |
Functions | |
| float | CG_RadiusForCent (centity_t *cent) |
| qboolean | CG_WorldCoordToScreenCoordFloat (vec3_t worldCoord, float *x, float *y) |
| qboolean | CG_CalcMuzzlePoint (int entityNum, vec3_t muzzle) |
| void | CG_DrawDuelistHealth (float x, float y, float w, float h, int duelist) |
| int | UI_ParseAnimationFile (const char *filename, animation_t *animset, qboolean isHumanoid) |
| int | MenuFontToHandle (int iMenuFont) |
| int | CG_Text_Width (const char *text, float scale, int iMenuFont) |
| int | CG_Text_Height (const char *text, float scale, int iMenuFont) |
| void | CG_Text_Paint (float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style, int iMenuFont) |
| void | CG_Draw3DModel (float x, float y, float w, float h, qhandle_t model, void *ghoul2, int g2radius, qhandle_t skin, vec3_t origin, vec3_t angles) |
| void | CG_DrawHead (float x, float y, float w, float h, int clientNum, vec3_t headAngles) |
| void | CG_DrawFlagModel (float x, float y, float w, float h, int team, qboolean force2D) |
| void | DrawAmmo () |
| void | CG_DrawHealth (menuDef_t *menuHUD) |
| void | CG_DrawArmor (menuDef_t *menuHUD) |
| void | CG_DrawForcePower (menuDef_t *menuHUD) |
| void | CG_DrawHUD (centity_t *cent) |
| qboolean | ForcePower_Valid (int i) |
| void | CG_DrawForceSelect (void) |
| void | CG_DrawInvenSelect (void) |
| qboolean | CG_CheckTargetVehicle (centity_t **pTargetVeh, float *alpha) |
| float | CG_DrawVehicleShields (const menuDef_t *menuHUD, const centity_t *veh) |
| void | CG_DrawVehicleAmmo (const menuDef_t *menuHUD, const centity_t *veh) |
| void | CG_DrawVehicleAmmoUpper (const menuDef_t *menuHUD, const centity_t *veh) |
| void | CG_DrawVehicleAmmoLower (const menuDef_t *menuHUD, const centity_t *veh) |
| void | CG_DrawVehicleTurboRecharge (const menuDef_t *menuHUD, const centity_t *veh) |
| void | CG_DrawVehicleWeaponsLinked (const menuDef_t *menuHUD, const centity_t *veh) |
| void | CG_DrawVehicleSpeed (const menuDef_t *menuHUD, const centity_t *veh) |
| void | CG_DrawVehicleArmor (const menuDef_t *menuHUD, const centity_t *veh) |
| void | CG_DrawVehicleDamage (const centity_t *veh, int brokenLimbs, const menuDef_t *menuHUD, float alpha, int index) |
| void | CG_DrawVehicleDamageHUD (const centity_t *veh, int brokenLimbs, float percShields, char *menuName, float alpha) |
| qboolean | CG_DrawVehicleHud (const centity_t *cent) |
| void | CG_DrawTeamBackground (int x, int y, int w, int h, float alpha, int team) |
| void | CG_DrawHealthBarRough (float x, float y, int width, int height, float ratio, const float *color1, const float *color2) |
| float | CG_DrawRadar (float y) |
| const char * | CG_GetLocationString (const char *loc) |
| void | CG_AddLagometerFrameInfo (void) |
| void | CG_AddLagometerSnapshotInfo (snapshot_t *snap) |
| void | CG_DrawSiegeMessage (const char *str, int objectiveScreen) |
| void | CG_DrawSiegeMessageNonMenu (const char *str) |
| void | CG_CenterPrint (const char *str, int y, int charWidth) |
| void | CG_DrawSiegeInfo (centity_t *cent, float chX, float chY, float chW, float chH) |
| void | CG_DrawHealthBar (centity_t *cent, float chX, float chY, float chW, float chH) |
| void | CG_DrawHaqrBar (float chX, float chY, float chW, float chH) |
| void | CG_DrawGenericTimerBar (void) |
| void | CG_LerpCrosshairPos (float *x, float *y) |
| qboolean | CG_WorldCoordToScreenCoord (vec3_t worldCoord, int *x, int *y) |
| void | CG_SaberClashFlare (void) |
| void | CG_DottedLine (float x1, float y1, float x2, float y2, float dotSize, int numDots, vec4_t color, float alpha) |
| void | CG_BracketEntity (centity_t *cent, float radius) |
| qboolean | CG_InFighter (void) |
| qboolean | CG_InATST (void) |
| void | CG_DrawBracketedEntities (void) |
| void | CG_CalcVehMuzzle (Vehicle_t *pVeh, centity_t *ent, int muzzleNum) |
| qboolean | CG_CalcVehicleMuzzlePoint (int entityNum, vec3_t start, vec3_t d_f, vec3_t d_rt, vec3_t d_up) |
| void | CG_CalcEWebMuzzlePoint (centity_t *cent, vec3_t start, vec3_t d_f, vec3_t d_rt, vec3_t d_up) |
| void | CG_SanitizeString (char *in, char *out) |
| void | CG_DrawTimedMenus () |
| void | CG_DrawFlagStatus () |
| void | CG_DrawJetpackFuel (void) |
| void | CG_DrawEWebHealth (void) |
| void | CG_DrawCloakFuel (void) |
| void | CG_ChatBox_StrInsert (char *buffer, int place, char *str) |
| void | CG_ChatBox_AddString (char *chatStr) |
| void | CG_ChatBox_ArrayInsert (chatBoxItem_t **array, int insPoint, int maxNum, chatBoxItem_t *item) |
| void | CG_DrawActive (stereoFrame_t stereoView) |
Variables | |
| displayContextDef_t | cgDC |
| menuDef_t * | menuScoreboard = NULL |
| vec4_t | bluehudtint = {0.5, 0.5, 1.0, 1.0} |
| vec4_t | redhudtint = {1.0, 0.5, 0.5, 1.0} |
| float * | hudTintColor |
| int | sortedTeamPlayers [TEAM_MAXOVERLAY] |
| int | numSortedTeamPlayers |
| int | lastvalidlockdif |
| float | zoomFov |
| char | systemChat [256] |
| char | teamChat1 [256] |
| char | teamChat2 [256] |
| int | cg_siegeDeathTime = 0 |
| const char * | armorTicName [MAX_HUD_TICS] |
| const char * | healthTicName [MAX_HUD_TICS] |
| const char * | forceTicName [MAX_HUD_TICS] |
| const char * | ammoTicName [MAX_HUD_TICS] |
| char * | showPowersName [] |
| int | cg_targVeh = ENTITYNUM_NONE |
| int | cg_targVehLastTime = 0 |
| int | cg_vehicleAmmoWarning = 0 |
| int | cg_vehicleAmmoWarningTime = 0 |
| qboolean | cg_drawLink = qfalse |
| veh_damage_t | vehDamageData [4] |
| float | cg_radarRange = 2500.0f |
| lagometer_t | lagometer |
| int | cg_genericTimerBar = 0 |
| int | cg_genericTimerDur = 0 |
| vec4_t | cg_genericTimerColor |
| float | cg_crosshairPrevPosX = 0 |
| float | cg_crosshairPrevPosY = 0 |
| vec3_t | cg_crosshairPos = {0,0,0} |
| int | cg_saberFlashTime = 0 |
| vec3_t | cg_saberFlashPos = {0, 0, 0} |
| int | cgRageTime = 0 |
| int | cgRageFadeTime = 0 |
| float | cgRageFadeVal = 0 |
| int | cgRageRecTime = 0 |
| int | cgRageRecFadeTime = 0 |
| float | cgRageRecFadeVal = 0 |
| int | cgAbsorbTime = 0 |
| int | cgAbsorbFadeTime = 0 |
| float | cgAbsorbFadeVal = 0 |
| int | cgProtectTime = 0 |
| int | cgProtectFadeTime = 0 |
| float | cgProtectFadeVal = 0 |
| int | cgYsalTime = 0 |
| int | cgYsalFadeTime = 0 |
| float | cgYsalFadeVal = 0 |
| qboolean | gCGHasFallVector = qfalse |
| vec3_t | gCGFallVector |
| int | cgSiegeRoundState |
| int | cgSiegeRoundTime |
| int | team1Timed |
| int | team2Timed |
| int | cg_beatingSiegeTime = 0 |
| int | cgSiegeRoundBeganTime = 0 |
| int | cgSiegeRoundCountTime = 0 |
| int | cgSiegeEntityRender = 0 |
|
|
Definition at line 4741 of file cg_draw.c. Referenced by CG_DrawGenericTimerBar(). |
|
|
Definition at line 4742 of file cg_draw.c. Referenced by CG_DrawGenericTimerBar(). |
|
|
Definition at line 4743 of file cg_draw.c. Referenced by CG_DrawGenericTimerBar(). |
|
|
Definition at line 4744 of file cg_draw.c. Referenced by CG_DrawGenericTimerBar(). |
|
|
Definition at line 7512 of file cg_draw.c. Referenced by CG_ChatBox_AddString(). |
|
|
|
|
|
Definition at line 7244 of file cg_draw.c. Referenced by CG_DrawCloakFuel(). |
|
|
Definition at line 7245 of file cg_draw.c. Referenced by CG_DrawCloakFuel(). |
|
|
Definition at line 7246 of file cg_draw.c. Referenced by CG_DrawCloakFuel(). |
|
|
Definition at line 7247 of file cg_draw.c. Referenced by CG_DrawCloakFuel(). |
|
|
Definition at line 4804 of file cg_draw.c. Referenced by CG_LerpCrosshairPos(). |
|
|
Definition at line 4805 of file cg_draw.c. Referenced by CG_LerpCrosshairPos(). |
|
|
Definition at line 7181 of file cg_draw.c. Referenced by CG_DrawEWebHealth(). |
|
|
Definition at line 7182 of file cg_draw.c. Referenced by CG_DrawEWebHealth(). |
|
|
Definition at line 7183 of file cg_draw.c. Referenced by CG_DrawEWebHealth(). |
|
|
Definition at line 7184 of file cg_draw.c. Referenced by CG_DrawEWebHealth(). |
|
|
|
|
|
Definition at line 4486 of file cg_draw.c. Referenced by CG_DrawHaqrBar(), CG_DrawHealthBar(), and CG_DrawSiegeInfo(). |
|
|
Definition at line 4485 of file cg_draw.c. Referenced by CG_DrawHaqrBar(), CG_DrawHealthBar(), and CG_DrawSiegeInfo(). |
|
|
Definition at line 7129 of file cg_draw.c. Referenced by CG_DrawJetpackFuel(). |
|
|
Definition at line 7130 of file cg_draw.c. Referenced by CG_DrawCloakFuel(), CG_DrawEWebHealth(), and CG_DrawJetpackFuel(). |
|
|
Definition at line 7131 of file cg_draw.c. Referenced by CG_DrawJetpackFuel(). |
|
|
Definition at line 7132 of file cg_draw.c. Referenced by CG_DrawJetpackFuel(). |
|
|
Definition at line 4141 of file cg_draw.c. Referenced by CG_AddLagometerFrameInfo(), and CG_AddLagometerSnapshotInfo(). |
|
|
Definition at line 3116 of file cg_draw.c. Referenced by CG_DrawDuelistHealth(). |
|
|
Definition at line 42 of file cg_draw.c. Referenced by CG_DrawArmor(), CG_DrawForcePower(), and CG_DrawHealth(). |
|
|
|
|
|
|
|
|
Definition at line 1393 of file cg_draw.c. Referenced by CG_DrawForceSelect(). |
|
|
Definition at line 1871 of file cg_draw.c. Referenced by CG_DrawVehicleAmmo(), CG_DrawVehicleAmmoLower(), and CG_DrawVehicleAmmoUpper(). |
|
|
Definition at line 1870 of file cg_draw.c. Referenced by CG_DrawVehicleShields(). |
|
|
Definition at line 1868 of file cg_draw.c. Referenced by CG_DrawVehicleArmor(). |
|
|
Definition at line 1869 of file cg_draw.c. Referenced by CG_DrawVehicleSpeed(). |
|
|
Definition at line 6054 of file cg_draw.c. Referenced by BG_VehTraceFromCamPos(), and WP_VehCheckTraceFromCamPos(). |
|
|
Definition at line 3176 of file cg_draw.c. Referenced by CG_DrawRadar(). |
|
|
|
|
|
Definition at line 3177 of file cg_draw.c. Referenced by CG_DrawRadar(). |
|
|
Definition at line 3175 of file cg_draw.c. Referenced by CG_DrawRadar(). |
|
|
Definition at line 3169 of file cg_draw.c. Referenced by CG_DrawRadar(). |
|
|
Definition at line 3170 of file cg_draw.c. Referenced by CG_DrawRadar(). |
|
|
Definition at line 2410 of file cg_draw.c.
02411 {
02412 VEH_DAMAGE_FRONT=0,
02413 VEH_DAMAGE_BACK,
02414 VEH_DAMAGE_LEFT,
02415 VEH_DAMAGE_RIGHT,
02416 };
|
|
|
Definition at line 4161 of file cg_draw.c. References cg, lagometer_t::frameCount, lagometer_t::frameSamples, LAG_SAMPLES, lagometer, cg_t::latestSnapshotTime, and cg_t::time. Referenced by CG_DrawActiveFrame().
04161 {
04162 int offset;
04163
04164 offset = cg.time - cg.latestSnapshotTime;
04165 lagometer.frameSamples[ lagometer.frameCount & ( LAG_SAMPLES - 1) ] = offset;
04166 lagometer.frameCount++;
04167 }
|
|
|
Definition at line 4179 of file cg_draw.c. References LAG_SAMPLES, lagometer, snapshot_t::ping, snapshot_t::snapFlags, lagometer_t::snapshotCount, lagometer_t::snapshotFlags, and lagometer_t::snapshotSamples.
04179 {
04180 // dropped packet
04181 if ( !snap ) {
04182 lagometer.snapshotSamples[ lagometer.snapshotCount & ( LAG_SAMPLES - 1) ] = -1;
04183 lagometer.snapshotCount++;
04184 return;
04185 }
04186
04187 // add this snapshot's info
04188 lagometer.snapshotSamples[ lagometer.snapshotCount & ( LAG_SAMPLES - 1) ] = snap->ping;
04189 lagometer.snapshotFlags[ lagometer.snapshotCount & ( LAG_SAMPLES - 1) ] = snap->snapFlags;
04190 lagometer.snapshotCount++;
04191 }
|
|
||||||||||||
|
Definition at line 5405 of file cg_draw.c. References vehWeaponInfo_t::bHasGravity, vehWeaponInfo_t::bIsProjectile, centity_t, cg, CG_DottedLine(), CG_DrawPic(), cg_drawVehLeadIndicator, cg_entities, CG_Trace(), CG_WorldCoordToScreenCoordFloat(), cgs, CLASS_VEHICLE, cgs_t::clientinfo, playerState_s::clientNum, entityState_s::clientNum, COLOR_GREEN, COLOR_RED, ColorIndex, CONTENTS_OPAQUE, cg_t::crosshairClientNum, centity_s::currentState, vehWeaponInfo_t::fHoming, trace_t::fraction, vehWeaponInfo_t::fSpeed, g_color_table, g_vehWeaponInfo, cgs_t::gametype, GT_TEAM, vehWeaponStats_t::ID, vmCvar_t::integer, centity_s::lerpOrigin, playerState_s::m_iVehicleNum, entityState_s::m_iVehicleNum, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, cgs_t::media, entityState_s::NPC_class, NULL, playerState_s::origin, PERS_TEAM, playerState_s::persistant, entityState_s::pos, cg_t::predictedPlayerState, cg_t::predictedVehicleState, snapshot_t::ps, qboolean, qfalse, qtrue, cg_t::refdef, playerState_s::rocketLockIndex, cg_t::snap, clientInfo_t::team, entityState_s::teamowner, trap_R_RegisterShader(), trap_R_SetColor(), trajectory_t::trDelta, vec3_origin, vec3_t, VectorMA, VectorNormalize(), VectorSubtract, VEH_WEAPON_BASE, refdef_t::vieworg, vehicleInfo_t::weapon, and cgMedia_t::whiteShader. Referenced by CG_DrawBracketedEntities().
05406 {
05407 trace_t tr;
05408 vec3_t dif;
05409 float len, size, lineLength, lineWidth;
05410 float x, y;
05411 clientInfo_t *local;
05412 qboolean isEnemy = qfalse;
05413
05414 VectorSubtract( cent->lerpOrigin, cg.refdef.vieworg, dif );
05415 len = VectorNormalize( dif );
05416
05417 if ( cg.crosshairClientNum != cent->currentState.clientNum
05418 && (!cg.snap||cg.snap->ps.rocketLockIndex!= cent->currentState.clientNum) )
05419 {//if they're the entity you're locking onto or under your crosshair, always draw bracket
05420 //Hmm... for now, if they're closer than 2000, don't bracket?
05421 if ( len < 2000.0f )
05422 {
05423 return;
05424 }
05425
05426 CG_Trace( &tr, cg.refdef.vieworg, NULL, NULL, cent->lerpOrigin, -1, CONTENTS_OPAQUE );
05427
05428 //don't bracket if can't see them
05429 if ( tr.fraction < 1.0f )
05430 {
05431 return;
05432 }
05433 }
05434
05435 if ( !CG_WorldCoordToScreenCoordFloat(cent->lerpOrigin, &x, &y) )
05436 {//off-screen, don't draw it
05437 return;
05438 }
05439
05440 //just to see if it's centered
05441 //CG_DrawPic( x-2, y-2, 4, 4, cgs.media.whiteShader );
05442
05443 local = &cgs.clientinfo[cg.snap->ps.clientNum];
05444 if ( cent->currentState.m_iVehicleNum //vehicle has a driver
05445 && cgs.clientinfo[ cent->currentState.m_iVehicleNum-1 ].infoValid )
05446 {
05447 if ( cgs.gametype < GT_TEAM )
05448 {//ffa?
05449 isEnemy = qtrue;
05450 trap_R_SetColor ( g_color_table[ColorIndex(COLOR_RED)] );
05451 }
05452 else if ( cgs.clientinfo[ cent->currentState.m_iVehicleNum-1 ].team == local->team )
05453 {
05454 trap_R_SetColor ( g_color_table[ColorIndex(COLOR_GREEN)] );
05455 }
05456 else
05457 {
05458 isEnemy = qtrue;
05459 trap_R_SetColor ( g_color_table[ColorIndex(COLOR_RED)] );
05460 }
05461 }
05462 else if ( cent->currentState.teamowner )
05463 {
05464 if ( cgs.gametype < GT_TEAM )
05465 {//ffa?
05466 isEnemy = qtrue;
05467 trap_R_SetColor ( g_color_table[ColorIndex(COLOR_RED)] );
05468 }
05469 else if ( cent->currentState.teamowner != cg.predictedPlayerState.persistant[PERS_TEAM] )
05470 {// on enemy team
05471 isEnemy = qtrue;
05472 trap_R_SetColor ( g_color_table[ColorIndex(COLOR_RED)] );
05473 }
05474 else
05475 { //a friend
05476 trap_R_SetColor ( g_color_table[ColorIndex(COLOR_GREEN)] );
05477 }
05478 }
05479 else
05480 {//FIXME: if we want to ever bracket anything besides vehicles (like siege objectives we want to blow up), we should handle the coloring here
05481 trap_R_SetColor ( NULL );
05482 }
05483
05484 if ( len <= 1.0f )
05485 {//super-close, max out at 400 times radius (which is HUGE)
05486 size = radius*400.0f;
05487 }
05488 else
05489 {//scale by dist
05490 size = radius*(400.0f/len);
05491 }
05492
05493 if ( size < 1.0f )
05494 {
05495 size = 1.0f;
05496 }
05497
05498 //length scales with dist
05499 lineLength = (size*0.1f);
05500 if ( lineLength < 0.5f )
05501 {//always visible
05502 lineLength = 0.5f;
05503 }
05504 //always visible width
05505 lineWidth = 1.0f;
05506
05507 x -= (size*0.5f);
05508 y -= (size*0.5f);
05509
05510 /*
05511 if ( x >= 0 && x <= 640
05512 && y >= 0 && y <= 480 )
05513 */
05514 {//brackets would be drawn on the screen, so draw them
05515 //upper left corner
05516 //horz
05517 CG_DrawPic( x, y, lineLength, lineWidth, cgs.media.whiteShader );
05518 //vert
05519 CG_DrawPic( x, y, lineWidth, lineLength, cgs.media.whiteShader );
05520 //upper right corner
05521 //horz
05522 CG_DrawPic( x+size-lineLength, y, lineLength, lineWidth, cgs.media.whiteShader );
05523 //vert
05524 CG_DrawPic( x+size-lineWidth, y, lineWidth, lineLength, cgs.media.whiteShader );
05525 //lower left corner
05526 //horz
05527 CG_DrawPic( x, y+size-lineWidth, lineLength, lineWidth, cgs.media.whiteShader );
05528 //vert
05529 CG_DrawPic( x, y+size-lineLength, lineWidth, lineLength, cgs.media.whiteShader );
05530 //lower right corner
05531 //horz
05532 CG_DrawPic( x+size-lineLength, y+size-lineWidth, lineLength, lineWidth, cgs.media.whiteShader );
05533 //vert
05534 CG_DrawPic( x+size-lineWidth, y+size-lineLength, lineWidth, lineLength, cgs.media.whiteShader );
05535 }
05536 //Lead Indicator...
05537 if ( cg_drawVehLeadIndicator.integer )
05538 {//draw the lead indicator
05539 if ( isEnemy )
05540 {//an enemy object
05541 if ( cent->currentState.NPC_class == CLASS_VEHICLE )
05542 {//enemy vehicle
05543 if ( !VectorCompare( cent->currentState.pos.trDelta, vec3_origin ) )
05544 {//enemy vehicle is moving
05545 if ( cg.predictedPlayerState.m_iVehicleNum )
05546 {//I'm in a vehicle
05547 centity_t *veh = &cg_entities[cg.predictedPlayerState.m_iVehicleNum];
05548 if ( veh //vehicle cent
05549 && veh->m_pVehicle//vehicle
05550 && veh->m_pVehicle->m_pVehicleInfo//vehicle stats
05551 && veh->m_pVehicle->m_pVehicleInfo->weapon[0].ID > VEH_WEAPON_BASE )//valid vehicle weapon
05552 {
05553 vehWeaponInfo_t *vehWeapon = &g_vehWeaponInfo[veh->m_pVehicle->m_pVehicleInfo->weapon[0].ID];
05554 if ( vehWeapon
05555 && vehWeapon->bIsProjectile//primary weapon's shot is a projectile
05556 && !vehWeapon->bHasGravity//primary weapon's shot is not affected by gravity
05557 && !vehWeapon->fHoming//primary weapon's shot is not homing
05558 && vehWeapon->fSpeed )//primary weapon's shot has speed
05559 {//our primary weapon's projectile has a speed
05560 vec3_t vehDiff, vehLeadPos;
05561 float vehDist, eta;
05562 float leadX, leadY;
05563
05564 VectorSubtract( cent->lerpOrigin, cg.predictedVehicleState.origin, vehDiff );
05565 vehDist = VectorNormalize( vehDiff );
05566 eta = (vehDist/vehWeapon->fSpeed);//how many seconds it would take for my primary weapon's projectile to get from my ship to theirs
05567 //now extrapolate their position that number of seconds into the future based on their velocity
05568 VectorMA( cent->lerpOrigin, eta, cent->currentState.pos.trDelta, vehLeadPos );
05569 //now we have where we should be aiming at, project that onto the screen at a 2D co-ord
05570 if ( !CG_WorldCoordToScreenCoordFloat(cent->lerpOrigin, &x, &y) )
05571 {//off-screen, don't draw it
05572 return;
05573 }
05574 if ( !CG_WorldCoordToScreenCoordFloat(vehLeadPos, &leadX, &leadY) )
05575 {//off-screen, don't draw it
05576 //just draw the line
05577 CG_DottedLine( x, y, leadX, leadY, 1, 10, g_color_table[ColorIndex(COLOR_RED)], 0.5f );
05578 return;
05579 }
05580 //draw a line from the ship's cur pos to the lead pos
05581 CG_DottedLine( x, y, leadX, leadY, 1, 10, g_color_table[ColorIndex(COLOR_RED)], 0.5f );
05582 //now draw the lead indicator
05583 trap_R_SetColor ( g_color_table[ColorIndex(COLOR_RED)] );
05584 CG_DrawPic( leadX-8, leadY-8, 16, 16, trap_R_RegisterShader( "gfx/menus/radar/lead" ) );
05585 }
05586 }
05587 }
05588 }
05589 }
05590 }
05591 }
05592 }
|
|
||||||||||||||||||||||||
|
Definition at line 6026 of file cg_draw.c. References centity_t, cg, centity_s::ghoul2, centity_s::lerpAngles, centity_s::lerpOrigin, centity_s::modelScale, NEGATIVE_X, NULL, ORIGIN, cg_t::time, trap_G2API_AddBolt(), trap_G2API_GetBoltMatrix_NoRecNoRot(), vec3_t, VectorClear, and VectorMA.
06027 {
06028 int bolt = trap_G2API_AddBolt(cent->ghoul2, 0, "*cannonflash");
06029
06030 assert(bolt != -1);
06031
06032 if (bolt != -1)
06033 {
06034 mdxaBone_t boltMatrix;
06035
06036 trap_G2API_GetBoltMatrix_NoRecNoRot(cent->ghoul2, 0, bolt, &boltMatrix, cent->lerpAngles, cent->lerpOrigin, cg.time, NULL, cent->modelScale);
06037 BG_GiveMeVectorFromMatrix(&boltMatrix, ORIGIN, start);
06038 BG_GiveMeVectorFromMatrix(&boltMatrix, NEGATIVE_X, d_f);
06039
06040 //these things start the shot a little inside the bbox to assure not starting in something solid
06041 VectorMA(start, -16.0f, d_f, start);
06042
06043 //I guess
06044 VectorClear( d_rt );//don't really need this, do we?
06045 VectorClear( d_up );//don't really need this, do we?
06046 }
06047 }
|
|
||||||||||||
|
Definition at line 2215 of file cg_weapons.c. References AngleVectors(), entityState_s::apos, BOTH_CROUCH1IDLE, BOTH_CROUCH1WALK, centity_t, cg, cg_entities, playerState_s::clientNum, CROUCH_VIEWHEIGHT, centity_s::currentState, centity_s::currentValid, DEFAULT_VIEWHEIGHT, playerState_s::emplacedIndex, entityState_s::legsAnim, centity_s::lerpAngles, centity_s::lerpOrigin, NULL, PITCH, entityState_s::pos, cg_t::predictedPlayerState, snapshot_t::ps, qboolean, qfalse, qtrue, cg_t::refdef, cg_t::renderingThirdPerson, cg_t::snap, trajectory_t::trBase, vec3_t, VectorClear, VectorCopy, VectorMA, refdef_t::viewangles, playerState_s::viewheight, refdef_t::vieworg, playerState_s::weapon, WP_DISRUPTOR, WP_EMPLACED_GUN, WP_MELEE, WP_MuzzlePoint, WP_SABER, and WP_STUN_BATON.
02215 {
02216 vec3_t forward, right;
02217 vec3_t gunpoint;
02218 centity_t *cent;
02219 int anim;
02220
02221 if ( entityNum == cg.snap->ps.clientNum )
02222 { //I'm not exactly sure why we'd be rendering someone else's crosshair, but hey.
02223 int weapontype = cg.snap->ps.weapon;
02224 vec3_t weaponMuzzle;
02225 centity_t *pEnt = &cg_entities[cg.predictedPlayerState.clientNum];
02226
02227 VectorCopy(WP_MuzzlePoint[weapontype], weaponMuzzle);
02228
02229 if (weapontype == WP_DISRUPTOR || weapontype == WP_STUN_BATON || weapontype == WP_MELEE || weapontype == WP_SABER)
02230 {
02231 VectorClear(weaponMuzzle);
02232 }
02233
02234 if (cg.renderingThirdPerson)
02235 {
02236 VectorCopy( pEnt->lerpOrigin, gunpoint );
02237 AngleVectors( pEnt->lerpAngles, forward, right, NULL );
02238 }
02239 else
02240 {
02241 VectorCopy( cg.refdef.vieworg, gunpoint );
02242 AngleVectors( cg.refdef.viewangles, forward, right, NULL );
02243 }
02244
02245 if (weapontype == WP_EMPLACED_GUN && cg.snap->ps.emplacedIndex)
02246 {
02247 centity_t *gunEnt = &cg_entities[cg.snap->ps.emplacedIndex];
02248
02249 if (gunEnt)
02250 {
02251 vec3_t pitchConstraint;
02252
02253 VectorCopy(gunEnt->lerpOrigin, gunpoint);
02254 gunpoint[2] += 46;
02255
02256 if (cg.renderingThirdPerson)
02257 {
02258 VectorCopy(pEnt->lerpAngles, pitchConstraint);
02259 }
02260 else
02261 {
02262 VectorCopy(cg.refdef.viewangles, pitchConstraint);
02263 }
02264
02265 if (pitchConstraint[PITCH] > 40)
02266 {
02267 pitchConstraint[PITCH] = 40;
02268 }
02269 AngleVectors( pitchConstraint, forward, right, NULL );
02270 }
02271 }
02272
02273 VectorCopy(gunpoint, muzzle);
02274
02275 VectorMA(muzzle, weaponMuzzle[0], forward, muzzle);
02276 VectorMA(muzzle, weaponMuzzle[1], right, muzzle);
02277
02278 if (weapontype == WP_EMPLACED_GUN && cg.snap->ps.emplacedIndex)
02279 {
02280 //Do nothing
02281 }
02282 else if (cg.renderingThirdPerson)
02283 {
02284 muzzle[2] += cg.snap->ps.viewheight + weaponMuzzle[2];
02285 }
02286 else
02287 {
02288 muzzle[2] += weaponMuzzle[2];
02289 }
02290
02291 return qtrue;
02292 }
02293
02294 cent = &cg_entities[entityNum];
02295 if ( !cent->currentValid ) {
02296 return qfalse;
02297 }
02298
02299 VectorCopy( cent->currentState.pos.trBase, muzzle );
02300
02301 AngleVectors( cent->currentState.apos.trBase, forward, NULL, NULL );
02302 anim = cent->currentState.legsAnim;
02303 if ( anim == BOTH_CROUCH1WALK || anim == BOTH_CROUCH1IDLE ) {
02304 muzzle[2] += CROUCH_VIEWHEIGHT;
02305 } else {
02306 muzzle[2] += DEFAULT_VIEWHEIGHT;
02307 }
02308
02309 VectorMA( muzzle, 14, forward, muzzle );
02310
02311 return qtrue;
02312
02313 }
|
|
||||||||||||||||||||||||
|
Definition at line 5946 of file cg_draw.c. References AngleVectors(), centity_t, cg, CG_CalcVehMuzzle(), cg_entities, DEFAULT_MINS_2, playerState_s::generic1, vehicleInfo_t::height, turretStats_t::iAmmoMax, turretStats_t::iMuzzle, centity_s::lerpAngles, centity_s::lerpOrigin, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, Vehicle_s::m_vMuzzleDir, Vehicle_s::m_vMuzzlePos, MAX_VEHICLE_TURRET_MUZZLES, MAX_VEHICLE_TURRETS, vehicleInfo_t::maxPassengers, turretStats_t::passengerNum, cg_t::predictedPlayerState, qboolean, qfalse, qtrue, vehicleInfo_t::turret, vehicleInfo_t::type, vec3_t, VectorAdd, VectorClear, VectorCopy, VectorScale, and VH_WALKER.
05947 {
05948 centity_t *vehCent = &cg_entities[entityNum];
05949 if ( vehCent->m_pVehicle && vehCent->m_pVehicle->m_pVehicleInfo->type == VH_WALKER )
05950 {//draw from barrels
05951 VectorCopy( vehCent->lerpOrigin, start );
05952 start[2] += vehCent->m_pVehicle->m_pVehicleInfo->height-DEFAULT_MINS_2-48;
05953 AngleVectors( vehCent->lerpAngles, d_f, d_rt, d_up );
05954 /*
05955 mdxaBone_t boltMatrix;
05956 int bolt;
05957 vec3_t yawOnlyAngles;
05958
05959 VectorSet( yawOnlyAngles, 0, vehCent->lerpAngles[YAW], 0 );
05960
05961 bolt = trap_G2API_AddBolt( vehCent->ghoul2, 0, "*flash1");
05962 trap_G2API_GetBoltMatrix( vehCent->ghoul2, 0, bolt, &boltMatrix,
05963 yawOnlyAngles, vehCent->lerpOrigin, cg.time,
05964 NULL, vehCent->modelScale );
05965
05966 // work the matrix axis stuff into the original axis and origins used.
05967 BG_GiveMeVectorFromMatrix( &boltMatrix, ORIGIN, start );
05968 BG_GiveMeVectorFromMatrix( &boltMatrix, POSITIVE_X, d_f );
05969 VectorClear( d_rt );//don't really need this, do we?
05970 VectorClear( d_up );//don't really need this, do we?
05971 */
05972 }
05973 else
05974 {
05975 //check to see if we're a turret gunner on this vehicle
05976 if ( cg.predictedPlayerState.generic1 )//as a passenger
05977 {//passenger in a vehicle
05978 if ( vehCent->m_pVehicle
05979 && vehCent->m_pVehicle->m_pVehicleInfo
05980 && vehCent->m_pVehicle->m_pVehicleInfo->maxPassengers )
05981 {//a vehicle capable of carrying passengers
05982 int turretNum;
05983 for ( turretNum = 0; turretNum < MAX_VEHICLE_TURRETS; turretNum++ )
05984 {
05985 if ( vehCent->m_pVehicle->m_pVehicleInfo->turret[turretNum].iAmmoMax )
05986 {// valid turret
05987 if ( vehCent->m_pVehicle->m_pVehicleInfo->turret[turretNum].passengerNum == cg.predictedPlayerState.generic1 )
05988 {//I control this turret
05989 //Go through all muzzles, average their positions and directions and use the result for crosshair trace
05990 int vehMuzzle, numMuzzles = 0;
05991 vec3_t muzzlesAvgPos={0},muzzlesAvgDir={0};
05992 int i;
05993
05994 for ( i = 0; i < MAX_VEHICLE_TURRET_MUZZLES; i++ )
05995 {
05996 vehMuzzle = vehCent->m_pVehicle->m_pVehicleInfo->turret[turretNum].iMuzzle[i];
05997 if ( vehMuzzle )
05998 {
05999 vehMuzzle -= 1;
06000 CG_CalcVehMuzzle( vehCent->m_pVehicle, vehCent, vehMuzzle );
06001 VectorAdd( muzzlesAvgPos, vehCent->m_pVehicle->m_vMuzzlePos[vehMuzzle], muzzlesAvgPos );
06002 VectorAdd( muzzlesAvgDir, vehCent->m_pVehicle->m_vMuzzleDir[vehMuzzle], muzzlesAvgDir );
06003 numMuzzles++;
06004 }
06005 if ( numMuzzles )
06006 {
06007 VectorScale( muzzlesAvgPos, 1.0f/(float)numMuzzles, start );
06008 VectorScale( muzzlesAvgDir, 1.0f/(float)numMuzzles, d_f );
06009 VectorClear( d_rt );
06010 VectorClear( d_up );
06011 return qtrue;
06012 }
06013 }
06014 }
06015 }
06016 }
06017 }
06018 }
06019 VectorCopy( vehCent->lerpOrigin, start );
06020 AngleVectors( vehCent->lerpAngles, d_f, d_rt, d_up );
06021 }
06022 return qfalse;
06023 }
|
|
||||||||||||||||
|
Definition at line 1176 of file cg_event.c. References centity_t, cg, centity_s::ghoul2, centity_s::lerpAngles, centity_s::lerpOrigin, Vehicle_s::m_iMuzzleTag, Vehicle_s::m_iMuzzleTime, Vehicle_s::m_pVehicleInfo, Vehicle_s::m_vMuzzleDir, Vehicle_s::m_vMuzzlePos, centity_s::modelScale, NEGATIVE_Y, NULL, ORIGIN, PITCH, ROLL, cg_t::time, trap_G2API_GetBoltMatrix_NoRecNoRot(), vehicleInfo_t::type, vec3_t, VectorCopy, Vehicle_t, VH_ANIMAL, VH_SPEEDER, and VH_WALKER. Referenced by CG_CalcVehicleMuzzlePoint().
01177 {
01178 mdxaBone_t boltMatrix;
01179 vec3_t vehAngles;
01180
01181 assert(pVeh);
01182
01183 if (pVeh->m_iMuzzleTime[muzzleNum] == cg.time)
01184 { //already done for this frame, don't need to do it again
01185 return;
01186 }
01187 //Uh... how about we set this, hunh...? :)
01188 pVeh->m_iMuzzleTime[muzzleNum] = cg.time;
01189
01190 VectorCopy( ent->lerpAngles, vehAngles );
01191 if ( pVeh->m_pVehicleInfo )
01192 {
01193 if (pVeh->m_pVehicleInfo->type == VH_ANIMAL
01194 ||pVeh->m_pVehicleInfo->type == VH_WALKER)
01195 {
01196 vehAngles[PITCH] = vehAngles[ROLL] = 0.0f;
01197 }
01198 else if (pVeh->m_pVehicleInfo->type == VH_SPEEDER)
01199 {
01200 vehAngles[PITCH] = 0.0f;
01201 }
01202 }
01203 trap_G2API_GetBoltMatrix_NoRecNoRot(ent->ghoul2, 0, pVeh->m_iMuzzleTag[muzzleNum], &boltMatrix, vehAngles,
01204 ent->lerpOrigin, cg.time, NULL, ent->modelScale);
01205 BG_GiveMeVectorFromMatrix(&boltMatrix, ORIGIN, pVeh->m_vMuzzlePos[muzzleNum]);
01206 BG_GiveMeVectorFromMatrix(&boltMatrix, NEGATIVE_Y, pVeh->m_vMuzzleDir[muzzleNum]);
01207 }
|
|
||||||||||||||||
|
Definition at line 4398 of file cg_draw.c. References cg_t::centerPrint, cg_t::centerPrintCharWidth, cg_t::centerPrintLines, cg_t::centerPrintTime, cg_t::centerPrintY, cg, Q_strncpyz(), and cg_t::time. Referenced by Board(), CG_DrawSiegeMessageNonMenu(), and CG_EntityEvent().
04398 {
04399 char *s;
04400
04401 Q_strncpyz( cg.centerPrint, str, sizeof(cg.centerPrint) );
04402
04403 cg.centerPrintTime = cg.time;
04404 cg.centerPrintY = y;
04405 cg.centerPrintCharWidth = charWidth;
04406
04407 // count the number of lines for centering
04408 cg.centerPrintLines = 1;
04409 s = cg.centerPrint;
04410 while( *s ) {
04411 if (*s == '\n')
04412 cg.centerPrintLines++;
04413 s++;
04414 }
04415 }
|
|
|
Definition at line 7540 of file cg_draw.c. References cg, cg_chatBox, CG_ChatBox_StrInsert(), CG_Text_Width(), CHATBOX_CUTOFF_LEN, chatBoxItem_t, cg_t::chatItemActive, cg_t::chatItems, FONT_SMALL, vmCvar_t::integer, chatBoxItem_s::lines, MAX_CHATBOX_ITEMS, memset(), strcpy(), chatBoxItem_s::string, strlen(), chatBoxItem_s::time, and cg_t::time. Referenced by CG_EntityEvent().
07541 {
07542 chatBoxItem_t *chat = &cg.chatItems[cg.chatItemActive];
07543 float chatLen;
07544
07545 if (cg_chatBox.integer<=0)
07546 { //don't bother then.
07547 return;
07548 }
07549
07550 memset(chat, 0, sizeof(chatBoxItem_t));
07551
07552 if (strlen(chatStr) > sizeof(chat->string))
07553 { //too long, terminate at proper len.
07554 chatStr[sizeof(chat->string)-1] = 0;
07555 }
07556
07557 strcpy(chat->string, chatStr);
07558 chat->time = cg.time + cg_chatBox.integer;
07559
07560 chat->lines = 1;
07561
07562 chatLen = CG_Text_Width(chat->string, 1.0f, FONT_SMALL);
07563 if (chatLen > CHATBOX_CUTOFF_LEN)
07564 { //we have to break it into segments...
07565 int i = 0;
07566 int lastLinePt = 0;
07567 char s[2];
07568
07569 chatLen = 0;
07570 while (chat->string[i])
07571 {
07572 s[0] = chat->string[i];
07573 s[1] = 0;
07574 chatLen += CG_Text_Width(s, 0.65f, FONT_SMALL);
07575
07576 if (chatLen >= CHATBOX_CUTOFF_LEN)
07577 {
07578 int j = i;
07579 while (j > 0 && j > lastLinePt)
07580 {
07581 if (chat->string[j] == ' ')
07582 {
07583 break;
07584 }
07585 j--;
07586 }
07587 if (chat->string[j] == ' ')
07588 {
07589 i = j;
07590 }
07591
07592 chat->lines++;
07593 CG_ChatBox_StrInsert(chat->string, i, "\n");
07594 i++;
07595 chatLen = 0;
07596 lastLinePt = i+1;
07597 }
07598 i++;
07599 }
07600 }
07601
07602 cg.chatItemActive++;
07603 if (cg.chatItemActive >= MAX_CHATBOX_ITEMS)
07604 {
07605 cg.chatItemActive = 0;
07606 }
07607 }
|
|
||||||||||||||||||||
|
Definition at line 7610 of file cg_draw.c. References CG_Error(), and chatBoxItem_t.
07611 {
07612 if (array[insPoint])
07613 { //recursively call, to move everything up to the top
07614 if (insPoint+1 >= maxNum)
07615 {
07616 CG_Error("CG_ChatBox_ArrayInsert: Exceeded array size");
07617 }
07618 CG_ChatBox_ArrayInsert(array, insPoint+1, maxNum, array[insPoint]);
07619 }
07620
07621 //now that we have moved anything that would be in this slot up, insert what we want into the slot
07622 array[insPoint] = item;
07623 }
|
|
||||||||||||||||
|
Definition at line 7517 of file cg_draw.c. References strlen(). Referenced by CG_ChatBox_AddString().
07518 {
07519 int insLen = strlen(str);
07520 int i = strlen(buffer);
07521 int k = 0;
07522
07523 buffer[i+insLen+1] = 0; //terminate the string at its new length
07524 while (i >= place)
07525 {
07526 buffer[i+insLen] = buffer[i];
07527 i--;
07528 }
07529
07530 i++;
07531 while (k < insLen)
07532 {
07533 buffer[i] = str[k];
07534 i++;
07535 k++;
07536 }
07537 }
|
|
||||||||||||
|
Definition at line 1793 of file cg_draw.c. References centity_t, cg, cg_entities, cg_targVeh, cg_targVehLastTime, CLASS_VEHICLE, cg_t::crosshairClientNum, cg_t::crosshairVehNum, cg_t::crosshairVehTime, centity_s::currentState, ENTITYNUM_NONE, ENTITYNUM_WORLD, entityState_s::m_iVehicleNum, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, MAX_CLIENTS, entityState_s::NPC_class, NULL, cg_t::predictedPlayerState, qboolean, qfalse, qtrue, playerState_s::rocketLockIndex, cg_t::time, vehicleInfo_t::type, and VH_FIGHTER. Referenced by CG_DrawVehicleHud().
01794 {
01795 int targetNum = ENTITYNUM_NONE;
01796 centity_t *targetVeh = NULL;
01797
01798 if ( !pTargetVeh || !alpha )
01799 {//hey, where are my pointers?
01800 return qfalse;
01801 }
01802
01803 *alpha = 1.0f;
01804
01805 //FIXME: need to clear all of these when you die?
01806 if ( cg.predictedPlayerState.rocketLockIndex < ENTITYNUM_WORLD )
01807 {
01808 targetNum = cg.predictedPlayerState.rocketLockIndex;
01809 }
01810 else if ( cg.crosshairVehNum < ENTITYNUM_WORLD
01811 && cg.time - cg.crosshairVehTime < 3000 )
01812 {//crosshair was on a vehicle in the last 3 seconds
01813 targetNum = cg.crosshairVehNum;
01814 }
01815 else if ( cg.crosshairClientNum < ENTITYNUM_WORLD )
01816 {
01817 targetNum = cg.crosshairClientNum;
01818 }
01819
01820 if ( targetNum < MAX_CLIENTS )
01821 {//real client
01822 if ( cg_entities[targetNum].currentState.m_iVehicleNum >= MAX_CLIENTS )
01823 {//in a vehicle
01824 targetNum = cg_entities[targetNum].currentState.m_iVehicleNum;
01825 }
01826 }
01827 if ( targetNum < ENTITYNUM_WORLD
01828 && targetNum >= MAX_CLIENTS )
01829 {
01830 centity_t *targetVeh = &cg_entities[targetNum];
01831 if ( targetVeh->currentState.NPC_class == CLASS_VEHICLE
01832 && targetVeh->m_pVehicle
01833 && targetVeh->m_pVehicle->m_pVehicleInfo
01834 && targetVeh->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER )
01835 {//it's a vehicle
01836 cg_targVeh = targetNum;
01837 cg_targVehLastTime = cg.time;
01838 *alpha = 1.0f;
01839 }
01840 else
01841 {
01842 targetVeh = NULL;
01843 }
01844 }
01845 if ( !targetVeh )
01846 {
01847 if ( cg_targVehLastTime && cg.time - cg_targVehLastTime < 3000 )
01848 {
01849 targetVeh = &cg_entities[cg_targVeh];;
01850 if ( cg.time-cg_targVehLastTime < 1000 )
01851 {//stay at full alpha for 1 sec after lose them from crosshair
01852 *alpha = 1.0f;
01853 }
01854 else
01855 {//fade out over 2 secs
01856 *alpha = 1.0f-((cg.time-cg_targVehLastTime-1000)/2000.0f);
01857 }
01858 }
01859 }
01860 if ( targetVeh )
01861 {
01862 *pTargetVeh = targetVeh;
01863 return qtrue;
01864 }
01865 return qfalse;
01866 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 5380 of file cg_draw.c. References CG_DrawPic(), cgs, cgs_t::media, trap_R_SetColor(), vec4_t, VectorCopy4, and cgMedia_t::whiteShader. Referenced by CG_BracketEntity().
05381 {
05382 float x, y, xDiff, yDiff, xStep, yStep;
05383 vec4_t colorRGBA;
05384 int dotNum = 0;
05385
05386 VectorCopy4( color, colorRGBA );
05387 colorRGBA[3] = alpha;
05388
05389 trap_R_SetColor( colorRGBA );
05390
05391 xDiff = x2-x1;
05392 yDiff = y2-y1;
05393 xStep = xDiff/(float)numDots;
05394 yStep = yDiff/(float)numDots;
05395
05396 for ( dotNum = 0; dotNum < numDots; dotNum++ )
05397 {
05398 x = x1 + (xStep*dotNum) - (dotSize*0.5f);
05399 y = y1 + (yStep*dotNum) - (dotSize*0.5f);
05400
05401 CG_DrawPic( x, y, dotSize, dotSize, cgs.media.whiteShader );
05402 }
05403 }
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
Definition at line 8511 of file cg_draw.c. References cg, CG_DrawInformation(), CG_Error(), cg_stereoSeparation, CG_TileClear(), PERS_TEAM, playerState_s::persistant, playerState_s::pm_flags, PMF_SCOREBOARD, snapshot_t::ps, RDF_DRAWSKYBOX, refdef_t::rdflags, cg_t::refdef, cg_t::snap, STEREO_CENTER, STEREO_LEFT, STEREO_RIGHT, stereoFrame_t, TEAM_SPECTATOR, trap_R_RenderScene(), vmCvar_t::value, vec3_t, VectorCopy, VectorMA, refdef_t::viewaxis, and refdef_t::vieworg. Referenced by CG_DrawActiveFrame().
08511 {
08512 float separation;
08513 vec3_t baseOrg;
08514
08515 // optionally draw the info screen instead
08516 if ( !cg.snap ) {
08517 CG_DrawInformation();
08518 return;
08519 }
08520
08521 // optionally draw the tournement scoreboard instead
08522 if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR &&
08523 ( cg.snap->ps.pm_flags & PMF_SCOREBOARD ) ) {
08524 CG_DrawTourneyScoreboard();
08525 return;
08526 }
08527
08528 switch ( stereoView ) {
08529 case STEREO_CENTER:
08530 separation = 0;
08531 break;
08532 case STEREO_LEFT:
08533 separation = -cg_stereoSeparation.value / 2;
08534 break;
08535 case STEREO_RIGHT:
08536 separation = cg_stereoSeparation.value / 2;
08537 break;
08538 default:
08539 separation = 0;
08540 CG_Error( "CG_DrawActive: Undefined stereoView" );
08541 }
08542
08543
08544 // clear around the rendered view if sized down
08545 CG_TileClear();
08546
08547 // offset vieworg appropriately if we're doing stereo separation
08548 VectorCopy( cg.refdef.vieworg, baseOrg );
08549 if ( separation != 0 ) {
08550 VectorMA( cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg );
08551 }
08552
08553 cg.refdef.rdflags |= RDF_DRAWSKYBOX;
08554
08555 // draw 3D view
08556 trap_R_RenderScene( &cg.refdef );
08557
08558 // restore original viewpoint if running stereo
08559 if ( separation != 0 ) {
08560 VectorCopy( baseOrg, cg.refdef.vieworg );
08561 }
08562
08563 // draw status bar and other floating elements
08564 CG_Draw2D();
08565 }
|
|
|
Definition at line 702 of file cg_draw.c. References armorTicName, windowDef_t::background, cg, CG_DrawNumField(), CG_DrawPic(), windowDef_t::foreColor, rectDef_t::h, cg_t::HUDArmorFlag, cg_t::HUDTickFlashTime, hudTintColor, itemDef_t, MAX_HUD_TICS, memcpy(), Menu_FindItemByName(), NUM_FONT_SMALL, playerState_t, cg_t::predictedPlayerState, qfalse, qtrue, windowDef_t::rect, STAT_ARMOR, STAT_MAX_HEALTH, playerState_s::stats, cg_t::time, trap_R_SetColor(), vec4_t, rectDef_t::w, itemDef_s::window, rectDef_t::x, and rectDef_t::y. Referenced by CG_DrawHUD().
00703 {
00704 vec4_t calcColor;
00705 playerState_t *ps;
00706 int armor, maxArmor;
00707 itemDef_t *focusItem;
00708 float percent,quarterArmor;
00709 int i,currValue,inc;
00710
00711 //ps = &cg.snap->ps;
00712 ps = &cg.predictedPlayerState;
00713
00714 // Can we find the menu?
00715 if (!menuHUD)
00716 {
00717 return;
00718 }
00719
00720 armor = ps->stats[STAT_ARMOR];
00721 maxArmor = ps->stats[STAT_MAX_HEALTH];
00722
00723 if (armor> maxArmor)
00724 {
00725 armor = maxArmor;
00726 }
00727
00728 currValue = armor;
00729 inc = (float) maxArmor / MAX_HUD_TICS;
00730
00731 memcpy(calcColor, hudTintColor, sizeof(vec4_t));
00732 for (i=(MAX_HUD_TICS-1);i>=0;i--)
00733 {
00734 focusItem = Menu_FindItemByName(menuHUD, armorTicName[i]);
00735
00736 if (!focusItem) // This is bad
00737 {
00738 continue;
00739 }
00740
00741 memcpy(calcColor, hudTintColor, sizeof(vec4_t));
00742
00743 if (currValue <= 0) // don't show tic
00744 {
00745 break;
00746 }
00747 else if (currValue < inc) // partial tic (alpha it out)
00748 {
00749 percent = (float) currValue / inc;
00750 calcColor[3] *= percent;
00751 }
00752
00753 trap_R_SetColor( calcColor);
00754
00755 if ((i==(MAX_HUD_TICS-1)) && (currValue < inc))
00756 {
00757 if (cg.HUDArmorFlag)
00758 {
00759 CG_DrawPic(
00760 focusItem->window.rect.x,
00761 focusItem->window.rect.y,
00762 focusItem->window.rect.w,
00763 focusItem->window.rect.h,
00764 focusItem->window.background
00765 );
00766 }
00767 }
00768 else
00769 {
00770 CG_DrawPic(
00771 focusItem->window.rect.x,
00772 focusItem->window.rect.y,
00773 focusItem->window.rect.w,
00774 focusItem->window.rect.h,
00775 focusItem->window.background
00776 );
00777 }
00778
00779 currValue -= inc;
00780 }
00781
00782 focusItem = Menu_FindItemByName(menuHUD, "armoramount");
00783
00784 if (focusItem)
00785 {
00786 // Print armor amount
00787 trap_R_SetColor( focusItem->window.foreColor );
00788
00789 CG_DrawNumField (
00790 focusItem->window.rect.x,
00791 focusItem->window.rect.y,
00792 3,
00793 armor,
00794 focusItem->window.rect.w,
00795 focusItem->window.rect.h,
00796 NUM_FONT_SMALL,
00797 qfalse);
00798 }
00799
00800 // If armor is low, flash a graphic to warn the player
00801 if (armor) // Is there armor? Draw the HUD Armor TIC
00802 {
00803 quarterArmor = (float) (ps->stats[STAT_MAX_HEALTH] / 4.0f);
00804
00805 // Make tic flash if armor is at 25% of full armor
00806 if (ps->stats[STAT_ARMOR] < quarterArmor) // Do whatever the flash timer says
00807 {
00808 if (cg.HUDTickFlashTime < cg.time) // Flip at the same time
00809 {
00810 cg.HUDTickFlashTime = cg.time + 400;
00811 if (cg.HUDArmorFlag)
00812 {
00813 cg.HUDArmorFlag = qfalse;
00814 }
00815 else
00816 {
00817 cg.HUDArmorFlag = qtrue;
00818 }
00819 }
00820 }
00821 else
00822 {
00823 cg.HUDArmorFlag=qtrue;
00824 }
00825 }
00826 else // No armor? Don't show it.
00827 {
00828 cg.HUDArmorFlag=qfalse;
00829 }
00830
00831 }
|
|
|
Definition at line 5626 of file cg_draw.c. References cg_t::bracketedEntities, cg_t::bracketedEntityCount, centity_t, cg, CG_BracketEntity(), cg_entities, and CG_RadiusForCent().
05627 {
05628 int i;
05629 for ( i = 0; i < cg.bracketedEntityCount; i++ )
05630 {
05631 centity_t *cent = &cg_entities[cg.bracketedEntities[i]];
05632 CG_BracketEntity( cent, CG_RadiusForCent( cent ) );
05633 }
05634 }
|
|
|
Definition at line 7248 of file cg_draw.c. References cg, CG_DrawRect(), CG_FillRect(), CLFUELBAR_H, CLFUELBAR_W, CLFUELBAR_X, CLFUELBAR_Y, playerState_s::cloakFuel, colorTable, CT_BLACK, playerState_s::jetpackFuel, JPFUELBAR_W, snapshot_t::ps, cg_t::snap, and vec4_t.
07249 {
07250 vec4_t aColor;
07251 vec4_t bColor;
07252 vec4_t cColor;
07253 float x = CLFUELBAR_X;
07254 float y = CLFUELBAR_Y;
07255 float percent = ((float)cg.snap->ps.cloakFuel/100.0f)*CLFUELBAR_H;
07256
07257 if (percent > CLFUELBAR_H)
07258 {
07259 return;
07260 }
07261
07262 if ( cg.snap->ps.jetpackFuel < 100 )
07263 {//if drawing jetpack fuel bar too, then move this over...?
07264 x -= (JPFUELBAR_W+8.0f);
07265 }
07266
07267 if (percent < 0.1f)
07268 {
07269 percent = 0.1f;
07270 }
07271
07272 //color of the bar
07273 aColor[0] = 0.0f;
07274 aColor[1] = 0.0f;
07275 aColor[2] = 0.6f;
07276 aColor[3] = 0.8f;
07277
07278 //color of the border
07279 bColor[0] = 0.0f;
07280 bColor[1] = 0.0f;
07281 bColor[2] = 0.0f;
07282 bColor[3] = 0.3f;
07283
07284 //color of greyed out "missing fuel"
07285 cColor[0] = 0.1f;
07286 cColor[1] = 0.1f;
07287 cColor[2] = 0.3f;
07288 cColor[3] = 0.1f;
07289
07290 //draw the background (black)
07291 CG_DrawRect(x, y, CLFUELBAR_W, CLFUELBAR_H, 1.0f, colorTable[CT_BLACK]);
07292
07293 //now draw the part to show how much fuel there is in the color specified
07294 CG_FillRect(x+1.0f, y+1.0f+(CLFUELBAR_H-percent), CLFUELBAR_W-1.0f, CLFUELBAR_H-1.0f-(CLFUELBAR_H-percent), aColor);
07295
07296 //then draw the other part greyed out
07297 CG_FillRect(x+1.0f, y+1.0f, CLFUELBAR_W-1.0f, CLFUELBAR_H-percent, cColor);
07298 }
|
|
||||||||||||||||||||||||
|
Definition at line 3132 of file cg_draw.c. References CG_DrawHealthBarRough(), cgs, colorTable, CT_WHITE, cgs_t::duelist1health, cgs_t::duelist2health, and MAX_HEALTH_FOR_IFACE.
03133 {
03134 float duelHealthColor[4] = {1, 0, 0, 0.7f};
03135 float healthSrc = 0.0f;
03136 float ratio;
03137
03138 if ( duelist == 1 )
03139 {
03140 healthSrc = cgs.duelist1health;
03141 }
03142 else if (duelist == 2 )
03143 {
03144 healthSrc = cgs.duelist2health;
03145 }
03146
03147 ratio = healthSrc / MAX_HEALTH_FOR_IFACE;
03148 if ( ratio > 1.0f )
03149 {
03150 ratio = 1.0f;
03151 }
03152 if ( ratio < 0.0f )
03153 {
03154 ratio = 0.0f;
03155 }
03156 duelHealthColor[0] = (ratio * 0.2f) + 0.5f;
03157
03158 CG_DrawHealthBarRough (x, y, w, h, ratio, duelHealthColor, colorTable[CT_WHITE]); // new art for this? I'm not crazy about how this looks.
03159 }
|
|
|
Definition at line 7185 of file cg_draw.c. References centity_t, cg, CG_DrawRect(), cg_entities, CG_FillRect(), playerState_s::cloakFuel, colorTable, CT_BLACK, centity_s::currentState, playerState_s::emplacedIndex, EWEBHEALTH_H, EWEBHEALTH_W, EWEBHEALTH_X, EWEBHEALTH_Y, entityState_s::health, playerState_s::jetpackFuel, JPFUELBAR_W, entityState_s::maxhealth, cg_t::predictedPlayerState, snapshot_t::ps, cg_t::snap, and vec4_t.
07186 {
07187 vec4_t aColor;
07188 vec4_t bColor;
07189 vec4_t cColor;
07190 float x = EWEBHEALTH_X;
07191 float y = EWEBHEALTH_Y;
07192 centity_t *eweb = &cg_entities[cg.predictedPlayerState.emplacedIndex];
07193 float percent = ((float)eweb->currentState.health/eweb->currentState.maxhealth)*EWEBHEALTH_H;
07194
07195 if (percent > EWEBHEALTH_H)
07196 {
07197 return;
07198 }
07199
07200 if (percent < 0.1f)
07201 {
07202 percent = 0.1f;
07203 }
07204
07205 //kind of hacky, need to pass a coordinate in here
07206 if (cg.snap->ps.jetpackFuel < 100)
07207 {
07208 x -= (JPFUELBAR_W+8.0f);
07209 }
07210 if (cg.snap->ps.cloakFuel < 100)
07211 {
07212 x -= (JPFUELBAR_W+8.0f);
07213 }
07214
07215 //color of the bar
07216 aColor[0] = 0.5f;
07217 aColor[1] = 0.0f;
07218 aColor[2] = 0.0f;
07219 aColor[3] = 0.8f;
07220
07221 //color of the border
07222 bColor[0] = 0.0f;
07223 bColor[1] = 0.0f;
07224 bColor[2] = 0.0f;
07225 bColor[3] = 0.3f;
07226
07227 //color of greyed out "missing fuel"
07228 cColor[0] = 0.5f;
07229 cColor[1] = 0.5f;
07230 cColor[2] = 0.5f;
07231 cColor[3] = 0.1f;
07232
07233 //draw the background (black)
07234 CG_DrawRect(x, y, EWEBHEALTH_W, EWEBHEALTH_H, 1.0f, colorTable[CT_BLACK]);
07235
07236 //now draw the part to show how much health there is in the color specified
07237 CG_FillRect(x+1.0f, y+1.0f+(EWEBHEALTH_H-percent), EWEBHEALTH_W-1.0f, EWEBHEALTH_H-1.0f-(EWEBHEALTH_H-percent), aColor);
07238
07239 //then draw the other part greyed out
07240 CG_FillRect(x+1.0f, y+1.0f, EWEBHEALTH_W-1.0f, EWEBHEALTH_H-percent, cColor);
07241 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 539 of file cg_draw.c. References BG_FindItemForPowerup(), cgMedia_t::blueFlagModel, cg, cg_draw3dIcons, CG_Draw3DModel(), cg_drawIcons, CG_DrawPic(), cg_items, cgs, gitem_t, vmCvar_t::integer, ITEM_INDEX, cgs_t::media, NULL, PW_BLUEFLAG, PW_NEUTRALFLAG, PW_REDFLAG, qhandle_t, cgMedia_t::redFlagModel, sin(), TEAM_BLUE, TEAM_FREE, TEAM_RED, cg_t::time, trap_R_ModelBounds(), vec3_t, VectorClear, and YAW.
00539 {
00540 qhandle_t cm;
00541 float len;
00542 vec3_t origin, angles;
00543 vec3_t mins, maxs;
00544 qhandle_t handle;
00545
00546 if ( !force2D && cg_draw3dIcons.integer ) {
00547
00548 VectorClear( angles );
00549
00550 cm = cgs.media.redFlagModel;
00551
00552 // offset the origin y and z to center the flag
00553 trap_R_ModelBounds( cm, mins, maxs );
00554
00555 origin[2] = -0.5 * ( mins[2] + maxs[2] );
00556 origin[1] = 0.5 * ( mins[1] + maxs[1] );
00557
00558 // calculate distance so the flag nearly fills the box
00559 // assume heads are taller than wide
00560 len = 0.5 * ( maxs[2] - mins[2] );
00561 origin[0] = len / 0.268; // len / tan( fov/2 )
00562
00563 angles[YAW] = 60 * sin( cg.time / 2000.0 );;
00564
00565 if( team == TEAM_RED ) {
00566 handle = cgs.media.redFlagModel;
00567 } else if( team == TEAM_BLUE ) {
00568 handle = cgs.media.blueFlagModel;
00569 } else if( team == TEAM_FREE ) {
00570 handle = 0;//cgs.media.neutralFlagModel;
00571 } else {
00572 return;
00573 }
00574 CG_Draw3DModel( x, y, w, h, handle, NULL, 0, 0, origin, angles );
00575 } else if ( cg_drawIcons.integer ) {
00576 gitem_t *item;
00577
00578 if( team == TEAM_RED ) {
00579 item = BG_FindItemForPowerup( PW_REDFLAG );
00580 } else if( team == TEAM_BLUE ) {
00581 item = BG_FindItemForPowerup( PW_BLUEFLAG );
00582 } else if( team == TEAM_FREE ) {
00583 item = BG_FindItemForPowerup( PW_NEUTRALFLAG );
00584 } else {
00585 return;
00586 }
00587 if (item) {
00588 CG_DrawPic( x, y, w, h, cg_items[ ITEM_INDEX(item) ].icon );
00589 }
00590 }
00591 }
|
|
|
Definition at line 7067 of file cg_draw.c. References cg, CG_DrawPic(), CG_OtherTeamHasFlag(), CG_YourTeamHasFlag(), cgs, cgs_t::gametype, GT_CTF, GT_CTY, PERS_TEAM, playerState_s::persistant, snapshot_t::ps, cg_t::snap, TEAM_RED, and trap_R_RegisterShaderNoMip().
07068 {
07069 int myFlagTakenShader = 0;
07070 int theirFlagShader = 0;
07071 int team = 0;
07072 int startDrawPos = 2;
07073 int ico_size = 32;
07074
07075 if (!cg.snap)
07076 {
07077 return;
07078 }
07079
07080 if (cgs.gametype != GT_CTF && cgs.gametype != GT_CTY)
07081 {
07082 return;
07083 }
07084
07085 team = cg.snap->ps.persistant[PERS_TEAM];
07086
07087 if (cgs.gametype == GT_CTY)
07088 {
07089 if (team == TEAM_RED)
07090 {
07091 myFlagTakenShader = trap_R_RegisterShaderNoMip( "gfx/hud/mpi_rflag_x" );
07092 theirFlagShader = trap_R_RegisterShaderNoMip( "gfx/hud/mpi_bflag_ys" );
07093 }
07094 else
07095 {
07096 myFlagTakenShader = trap_R_RegisterShaderNoMip( "gfx/hud/mpi_bflag_x" );
07097 theirFlagShader = trap_R_RegisterShaderNoMip( "gfx/hud/mpi_rflag_ys" );
07098 }
07099 }
07100 else
07101 {
07102 if (team == TEAM_RED)
07103 {
07104 myFlagTakenShader = trap_R_RegisterShaderNoMip( "gfx/hud/mpi_rflag_x" );
07105 theirFlagShader = trap_R_RegisterShaderNoMip( "gfx/hud/mpi_bflag" );
07106 }
07107 else
07108 {
07109 myFlagTakenShader = trap_R_RegisterShaderNoMip( "gfx/hud/mpi_bflag_x" );
07110 theirFlagShader = trap_R_RegisterShaderNoMip( "gfx/hud/mpi_rflag" );
07111 }
07112 }
07113
07114 if (CG_YourTeamHasFlag())
07115 {
07116 //CG_DrawPic( startDrawPos, 330, ico_size, ico_size, theirFlagShader );
07117 CG_DrawPic( 2, 330-startDrawPos, ico_size, ico_size, theirFlagShader );
07118 startDrawPos += ico_size+2;
07119 }
07120
07121 if (CG_OtherTeamHasFlag())
07122 {
07123 //CG_DrawPic( startDrawPos, 330, ico_size, ico_size, myFlagTakenShader );
07124 CG_DrawPic( 2, 330-startDrawPos, ico_size, ico_size, myFlagTakenShader );
07125 }
07126 }
|
|
|
Definition at line 1042 of file cg_draw.c. References windowDef_t::background, cg, CG_DrawNumField(), CG_DrawPic(), cgs, CHAN_LOCAL, colorTable, CT_RED, CT_WHITE, playerState_s::fd, cg_t::forceHUDActive, cg_t::forceHUDNextFlashTime, cg_t::forceHUDTotalFlashTime, forcedata_s::forcePower, forceTicName, windowDef_t::foreColor, rectDef_t::h, itemDef_t, MAX_HUD_TICS, cgs_t::media, memcpy(), Menu_FindItemByName(), cgMedia_t::noforceSound, NULL, NUM_FONT_SMALL, snapshot_t::ps, qboolean, qfalse, qtrue, windowDef_t::rect, cg_t::snap, cg_t::time, trap_R_SetColor(), trap_S_StartSound(), vec4_t, rectDef_t::w, itemDef_s::window, rectDef_t::x, and rectDef_t::y. Referenced by CG_DrawHUD().
01043 {
01044 int i;
01045 vec4_t calcColor;
01046 float value,inc,percent;
01047 itemDef_t *focusItem;
01048 const int maxForcePower = 100;
01049 qboolean flash=qfalse;
01050
01051 // Can we find the menu?
01052 if (!menuHUD)
01053 {
01054 return;
01055 }
01056
01057 // Make the hud flash by setting forceHUDTotalFlashTime above cg.time
01058 if (cg.forceHUDTotalFlashTime > cg.time )
01059 {
01060 flash = qtrue;
01061 if (cg.forceHUDNextFlashTime < cg.time)
01062 {
01063 cg.forceHUDNextFlashTime = cg.time + 400;
01064 trap_S_StartSound (NULL, 0, CHAN_LOCAL, cgs.media.noforceSound );
01065
01066 if (cg.forceHUDActive)
01067 {
01068 cg.forceHUDActive = qfalse;
01069 }
01070 else
01071 {
01072 cg.forceHUDActive = qtrue;
01073 }
01074
01075 }
01076 }
01077 else // turn HUD back on if it had just finished flashing time.
01078 {
01079 cg.forceHUDNextFlashTime = 0;
01080 cg.forceHUDActive = qtrue;
01081 }
01082
01083 // if (!cg.forceHUDActive)
01084 // {
01085 // return;
01086 // }
01087
01088 inc = (float) maxForcePower / MAX_HUD_TICS;
01089 value = cg.snap->ps.fd.forcePower;
01090
01091 for (i=MAX_HUD_TICS-1;i>=0;i--)
01092 {
01093 focusItem = Menu_FindItemByName(menuHUD, forceTicName[i]);
01094
01095 if (!focusItem)
01096 {
01097 continue;
01098 }
01099
01100 // memcpy(calcColor, hudTintColor, sizeof(vec4_t));
01101
01102 if ( value <= 0 ) // done
01103 {
01104 break;
01105 }
01106 else if (value < inc) // partial tic
01107 {
01108 if (flash)
01109 {
01110 memcpy(calcColor, colorTable[CT_RED], sizeof(vec4_t));
01111 }
01112 else
01113 {
01114 memcpy(calcColor, colorTable[CT_WHITE], sizeof(vec4_t));
01115 }
01116
01117 percent = value / inc;
01118 calcColor[3] = percent;
01119 }
01120 else
01121 {
01122 if (flash)
01123 {
01124 memcpy(calcColor, colorTable[CT_RED], sizeof(vec4_t));
01125 }
01126 else
01127 {
01128 memcpy(calcColor, colorTable[CT_WHITE], sizeof(vec4_t));
01129 }
01130 }
01131
01132 trap_R_SetColor( calcColor);
01133
01134 CG_DrawPic(
01135 focusItem->window.rect.x,
01136 focusItem->window.rect.y,
01137 focusItem->window.rect.w,
01138 focusItem->window.rect.h,
01139 focusItem->window.background
01140 );
01141
01142 value -= inc;
01143 }
01144
01145 focusItem = Menu_FindItemByName(menuHUD, "forceamount");
01146
01147 if (focusItem)
01148 {
01149 // Print force amount
01150 trap_R_SetColor( focusItem->window.foreColor );
01151
01152 CG_DrawNumField (
01153 focusItem->window.rect.x,
01154 focusItem->window.rect.y,
01155 3,
01156 cg.snap->ps.fd.forcePower,
01157 focusItem->window.rect.w,
01158 focusItem->window.rect.h,
01159 NUM_FONT_SMALL,
01160 qfalse);
01161 }
01162 }
|
|
|
Definition at line 1421 of file cg_draw.c. References BG_ProperForceIndex(), cg, CG_DrawPic(), CG_GetStringEdString(), cgs, colorTable, CT_ICON_BLUE, playerState_s::fd, ForcePower_Valid(), cgMedia_t::forcePowerIcons, forcedata_s::forcePowerSelected, forcedata_s::forcePowersKnown, forcePowerSorted, cg_t::forceSelect, cg_t::forceSelectTime, MAX_SHOWPOWERS, cgs_t::media, NULL, NUM_FORCE_POWERS, snapshot_t::ps, showPowersName, cg_t::snap, STAT_HEALTH, playerState_s::stats, cg_t::time, trap_R_SetColor(), UI_CENTER, UI_DrawProportionalString(), UI_SMALLFONT, and WEAPON_SELECT_TIME.
01422 {
01423 int i;
01424 int count;
01425 int smallIconSize,bigIconSize;
01426 int holdX,x,y,x2,y2,pad,length;
01427 int sideLeftIconCnt,sideRightIconCnt;
01428 int sideMax,holdCount,iconCnt;
01429 int yOffset = 0;
01430
01431
01432 x2 = 0;
01433 y2 = 0;
01434
01435 // don't display if dead
01436 if ( cg.snap->ps.stats[STAT_HEALTH] <= 0 )
01437 {
01438 return;
01439 }
01440
01441 if ((cg.forceSelectTime+WEAPON_SELECT_TIME)<cg.time) // Time is up for the HUD to display
01442 {
01443 cg.forceSelect = cg.snap->ps.fd.forcePowerSelected;
01444 return;
01445 }
01446
01447 if (!cg.snap->ps.fd.forcePowersKnown)
01448 {
01449 return;
01450 }
01451
01452 #ifdef _XBOX
01453 if(CL_ExtendSelectTime()) {
01454 cg.forceSelectTime = cg.time;
01455 }
01456 yOffset = -50;
01457 #endif
01458
01459 // count the number of powers owned
01460 count = 0;
01461
01462 for (i=0;i < NUM_FORCE_POWERS;++i)
01463 {
01464 if (ForcePower_Valid(i))
01465 {
01466 count++;
01467 }
01468 }
01469
01470 if (count == 0) // If no force powers, don't display
01471 {
01472 return;
01473 }
01474
01475 sideMax = 3; // Max number of icons on the side
01476
01477 // Calculate how many icons will appear to either side of the center one
01478 holdCount = count - 1; // -1 for the center icon
01479 if (holdCount == 0) // No icons to either side
01480 {
01481 sideLeftIconCnt = 0;
01482 sideRightIconCnt = 0;
01483 }
01484 else if (count > (2*sideMax)) // Go to the max on each side
01485 {
01486 sideLeftIconCnt = sideMax;
01487 sideRightIconCnt = sideMax;
01488 }
01489 else // Less than max, so do the calc
01490 {
01491 sideLeftIconCnt = holdCount/2;
01492 sideRightIconCnt = holdCount - sideLeftIconCnt;
01493 }
01494
01495 smallIconSize = 30;
01496 bigIconSize = 60;
01497 pad = 12;
01498
01499 x = 320;
01500 y = 425;
01501
01502 // Background
01503 length = (sideLeftIconCnt * smallIconSize) + (sideLeftIconCnt*pad) +
01504 bigIconSize + (sideRightIconCnt * smallIconSize) + (sideRightIconCnt*pad) + 12;
01505
01506 i = BG_ProperForceIndex(cg.forceSelect) - 1;
01507 if (i < 0)
01508 {
01509 i = MAX_SHOWPOWERS;
01510 }
01511
01512 trap_R_SetColor(NULL);
01513 // Work backwards from current icon
01514 holdX = x - ((bigIconSize/2) + pad + smallIconSize);
01515 for (iconCnt=1;iconCnt<(sideLeftIconCnt+1);i--)
01516 {
01517 if (i < 0)
01518 {
01519 i = MAX_SHOWPOWERS;
01520 }
01521
01522 if (!ForcePower_Valid(forcePowerSorted[i])) // Does he have this power?
01523 {
01524 continue;
01525 }
01526
01527 ++iconCnt; // Good icon
01528
01529 if (cgs.media.forcePowerIcons[forcePowerSorted[i]])
01530 {
01531 CG_DrawPic( holdX, y + yOffset, smallIconSize, smallIconSize, cgs.media.forcePowerIcons[forcePowerSorted[i]] );
01532 holdX -= (smallIconSize+pad);
01533 }
01534 }
01535
01536 if (ForcePower_Valid(cg.forceSelect))
01537 {
01538 // Current Center Icon
01539 if (cgs.media.forcePowerIcons[cg.forceSelect])
01540 {
01541 CG_DrawPic( x-(bigIconSize/2), (y-((bigIconSize-smallIconSize)/2)) + yOffset, bigIconSize, bigIconSize, cgs.media.forcePowerIcons[cg.forceSelect] ); //only cache the icon for display
01542 }
01543 }
01544
01545 i = BG_ProperForceIndex(cg.forceSelect) + 1;
01546 if (i>MAX_SHOWPOWERS)
01547 {
01548 i = 0;
01549 }
01550
01551 // Work forwards from current icon
01552 holdX = x + (bigIconSize/2) + pad;
01553 for (iconCnt=1;iconCnt<(sideRightIconCnt+1);i++)
01554 {
01555 if (i>MAX_SHOWPOWERS)
01556 {
01557 i = 0;
01558 }
01559
01560 if (!ForcePower_Valid(forcePowerSorted[i])) // Does he have this power?
01561 {
01562 continue;
01563 }
01564
01565 ++iconCnt; // Good icon
01566
01567 if (cgs.media.forcePowerIcons[forcePowerSorted[i]])
01568 {
01569 CG_DrawPic( holdX, y + yOffset, smallIconSize, smallIconSize, cgs.media.forcePowerIcons[forcePowerSorted[i]] ); //only cache the icon for display
01570 holdX += (smallIconSize+pad);
01571 }
01572 }
01573
01574 if ( showPowersName[cg.forceSelect] )
01575 {
01576 UI_DrawProportionalString(320, y + 30 + yOffset, CG_GetStringEdString("SP_INGAME", showPowersName[cg.forceSelect]), UI_CENTER | UI_SMALLFONT, colorTable[CT_ICON_BLUE]);
01577 }
01578 }
|
|
|
Definition at line 4745 of file cg_draw.c. References cg, CG_DrawRect(), CG_FillRect(), cg_genericTimerBar, cg_genericTimerColor, cg_genericTimerDur, CGTIMERBAR_H, CGTIMERBAR_W, CGTIMERBAR_X, CGTIMERBAR_Y, colorTable, CT_BLACK, cg_t::time, and vec4_t.
04746 {
04747 vec4_t aColor;
04748 vec4_t bColor;
04749 vec4_t cColor;
04750 float x = CGTIMERBAR_X;
04751 float y = CGTIMERBAR_Y;
04752 float percent = ((float)(cg_genericTimerBar-cg.time)/(float)cg_genericTimerDur)*CGTIMERBAR_H;
04753
04754 if (percent > CGTIMERBAR_H)
04755 {
04756 return;
04757 }
04758
04759 if (percent < 0.1f)
04760 {
04761 percent = 0.1f;
04762 }
04763
04764 //color of the bar
04765 aColor[0] = cg_genericTimerColor[0];
04766 aColor[1] = cg_genericTimerColor[1];
04767 aColor[2] = cg_genericTimerColor[2];
04768 aColor[3] = cg_genericTimerColor[3];
04769
04770 //color of the border
04771 bColor[0] = 0.0f;
04772 bColor[1] = 0.0f;
04773 bColor[2] = 0.0f;
04774 bColor[3] = 0.3f;
04775
04776 //color of greyed out "missing fuel"
04777 cColor[0] = 0.5f;
04778 cColor[1] = 0.5f;
04779 cColor[2] = 0.5f;
04780 cColor[3] = 0.1f;
04781
04782 //draw the background (black)
04783 CG_DrawRect(x, y, CGTIMERBAR_W, CGTIMERBAR_H, 1.0f, colorTable[CT_BLACK]);
04784
04785 //now draw the part to show how much health there is in the color specified
04786 CG_FillRect(x+1.0f, y+1.0f+(CGTIMERBAR_H-percent), CGTIMERBAR_W-2.0f, CGTIMERBAR_H-1.0f-(CGTIMERBAR_H-percent), aColor);
04787
04788 //then draw the other part greyed out
04789 CG_FillRect(x+1.0f, y+1.0f, CGTIMERBAR_W-2.0f, CGTIMERBAR_H-percent, cColor);
04790 }
|
|
||||||||||||||||||||
|
Definition at line 4691 of file cg_draw.c. References cg, CG_DrawPic(), CG_DrawRect(), CG_FillRect(), cgs, colorTable, CT_BLACK, cgMedia_t::hackerIconShader, playerState_s::hackingBaseTime, playerState_s::hackingTime, HEALTH_HEIGHT, HEALTH_WIDTH, cgs_t::media, cg_t::predictedPlayerState, cg_t::time, and vec4_t.
04692 {
04693 vec4_t aColor;
04694 vec4_t bColor;
04695 vec4_t cColor;
04696 float x = chX+((chW/2)-(HEALTH_WIDTH/2));
04697 float y = (chY+chH) + 8.0f;
04698 float percent = (((float)cg.predictedPlayerState.hackingTime-(float)cg.time)/(float)cg.predictedPlayerState.hackingBaseTime)*HEALTH_WIDTH;
04699
04700 if (percent > HEALTH_WIDTH ||
04701 percent < 1.0f)
04702 {
04703 return;
04704 }
04705
04706 //color of the bar
04707 aColor[0] = 1.0f;
04708 aColor[1] = 1.0f;
04709 aColor[2] = 0.0f;
04710 aColor[3] = 0.4f;
04711
04712 //color of the border
04713 bColor[0] = 0.0f;
04714 bColor[1] = 0.0f;
04715 bColor[2] = 0.0f;
04716 bColor[3] = 0.3f;
04717
04718 //color of greyed out done area
04719 cColor[0] = 0.5f;
04720 cColor[1] = 0.5f;
04721 cColor[2] = 0.5f;
04722 cColor[3] = 0.1f;
04723
04724 //draw the background (black)
04725 CG_DrawRect(x, y, HEALTH_WIDTH, HEALTH_HEIGHT, 1.0f, colorTable[CT_BLACK]);
04726
04727 //now draw the part to show how much health there is in the color specified
04728 CG_FillRect(x+1.0f, y+1.0f, percent-1.0f, HEALTH_HEIGHT-1.0f, aColor);
04729
04730 //then draw the other part greyed out
04731 CG_FillRect(x+percent, y+1.0f, HEALTH_WIDTH-percent-1.0f, HEALTH_HEIGHT-1.0f, cColor);
04732
04733 //draw the hacker icon
04734 CG_DrawPic(x, y-HEALTH_WIDTH, HEALTH_WIDTH, HEALTH_WIDTH, cgs.media.hackerIconShader);
04735 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 512 of file cg_draw.c. References CG_DrawPic(), cgs, cgs_t::clientinfo, clientInfo_t::deferred, cgMedia_t::deferShader, MAX_CLIENTS, cgs_t::media, clientInfo_t::modelIcon, and vec3_t.
00513 {
00514 clientInfo_t *ci;
00515
00516 if (clientNum >= MAX_CLIENTS)
00517 { //npc?
00518 return;
00519 }
00520
00521 ci = &cgs.clientinfo[ clientNum ];
00522
00523 CG_DrawPic( x, y, w, h, ci->modelIcon );
00524
00525 // if they are deferred, draw a cross out
00526 if ( ci->deferred )
00527 {
00528 CG_DrawPic( x, y, w, h, cgs.media.deferShader );
00529 }
00530 }
|
|
|
Definition at line 614 of file cg_draw.c. References windowDef_t::background, cg, CG_DrawNumField(), CG_DrawPic(), windowDef_t::foreColor, rectDef_t::h, healthTicName, hudTintColor, itemDef_t, MAX_HUD_TICS, memcpy(), Menu_FindItemByName(), NUM_FONT_SMALL, playerState_t, snapshot_t::ps, qfalse, windowDef_t::rect, cg_t::snap, STAT_HEALTH, STAT_MAX_HEALTH, playerState_s::stats, trap_R_SetColor(), vec4_t, rectDef_t::w, itemDef_s::window, rectDef_t::x, and rectDef_t::y. Referenced by CG_DrawHUD().
00615 {
00616 vec4_t calcColor;
00617 playerState_t *ps;
00618 int healthAmt;
00619 int i,currValue,inc;
00620 itemDef_t *focusItem;
00621 float percent;
00622
00623 // Can we find the menu?
00624 if (!menuHUD)
00625 {
00626 return;
00627 }
00628
00629 ps = &cg.snap->ps;
00630
00631 // What's the health?
00632 healthAmt = ps->stats[STAT_HEALTH];
00633 if (healthAmt > ps->stats[STAT_MAX_HEALTH])
00634 {
00635 healthAmt = ps->stats[STAT_MAX_HEALTH];
00636 }
00637
00638
00639 inc = (float) ps->stats[STAT_MAX_HEALTH] / MAX_HUD_TICS;
00640 currValue = healthAmt;
00641
00642 // Print the health tics, fading out the one which is partial health
00643 for (i=(MAX_HUD_TICS-1);i>=0;i--)
00644 {
00645 focusItem = Menu_FindItemByName(menuHUD, healthTicName[i]);
00646
00647 if (!focusItem) // This is bad
00648 {
00649 continue;
00650 }
00651
00652 memcpy(calcColor, hudTintColor, sizeof(vec4_t));
00653
00654 if (currValue <= 0) // don't show tic
00655 {
00656 break;
00657 }
00658 else if (currValue < inc) // partial tic (alpha it out)
00659 {
00660 percent = (float) currValue / inc;
00661 calcColor[3] *= percent; // Fade it out
00662 }
00663
00664 trap_R_SetColor( calcColor);
00665
00666 CG_DrawPic(
00667 focusItem->window.rect.x,
00668 focusItem->window.rect.y,
00669 focusItem->window.rect.w,
00670 focusItem->window.rect.h,
00671 focusItem->window.background
00672 );
00673
00674 currValue -= inc;
00675 }
00676
00677 // Print the mueric amount
00678 focusItem = Menu_FindItemByName(menuHUD, "healthamount");
00679 if (focusItem)
00680 {
00681 // Print health amount
00682 trap_R_SetColor( focusItem->window.foreColor );
00683
00684 CG_DrawNumField (
00685 focusItem->window.rect.x,
00686 focusItem->window.rect.y,
00687 3,
00688 ps->stats[STAT_HEALTH],
00689 focusItem->window.rect.w,
00690 focusItem->window.rect.h,
00691 NUM_FONT_SMALL,
00692 qfalse);
00693 }
00694
00695 }
|
|
||||||||||||||||||||||||
|
Definition at line 4632 of file cg_draw.c. References centity_t, cg, CG_DrawRect(), CG_FillRect(), cgs, colorTable, CT_BLACK, centity_s::currentState, cgs_t::gametype, GT_TEAM, entityState_s::health, HEALTH_HEIGHT, HEALTH_WIDTH, entityState_s::maxhealth, PERS_TEAM, playerState_s::persistant, cg_t::predictedPlayerState, entityState_s::teamowner, and vec4_t.
04633 {
04634 vec4_t aColor;
04635 vec4_t bColor;
04636 vec4_t cColor;
04637 float x = chX+((chW/2)-(HEALTH_WIDTH/2));
04638 float y = (chY+chH) + 8.0f;
04639 float percent = ((float)cent->currentState.health/(float)cent->currentState.maxhealth)*HEALTH_WIDTH;
04640 if (percent <= 0)
04641 {
04642 return;
04643 }
04644
04645 //color of the bar
04646 if (!cent->currentState.teamowner || cgs.gametype < GT_TEAM)
04647 { //not owned by a team or teamplay
04648 aColor[0] = 1.0f;
04649 aColor[1] = 1.0f;
04650 aColor[2] = 0.0f;
04651 aColor[3] = 0.4f;
04652 }
04653 else if (cent->currentState.teamowner == cg.predictedPlayerState.persistant[PERS_TEAM])
04654 { //owned by my team
04655 aColor[0] = 0.0f;
04656 aColor[1] = 1.0f;
04657 aColor[2] = 0.0f;
04658 aColor[3] = 0.4f;
04659 }
04660 else
04661 { //hostile
04662 aColor[0] = 1.0f;
04663 aColor[1] = 0.0f;
04664 aColor[2] = 0.0f;
04665 aColor[3] = 0.4f;
04666 }
04667
04668 //color of the border
04669 bColor[0] = 0.0f;
04670 bColor[1] = 0.0f;
04671 bColor[2] = 0.0f;
04672 bColor[3] = 0.3f;
04673
04674 //color of greyed out "missing health"
04675 cColor[0] = 0.5f;
04676 cColor[1] = 0.5f;
04677 cColor[2] = 0.5f;
04678 cColor[3] = 0.4f;
04679
04680 //draw the background (black)
04681 CG_DrawRect(x, y, HEALTH_WIDTH, HEALTH_HEIGHT, 1.0f, colorTable[CT_BLACK]);
04682
04683 //now draw the part to show how much health there is in the color specified
04684 CG_FillRect(x+1.0f, y+1.0f, percent-1.0f, HEALTH_HEIGHT-1.0f, aColor);
04685
04686 //then draw the other part greyed out
04687 CG_FillRect(x+percent, y+1.0f, HEALTH_WIDTH-percent-1.0f, HEALTH_HEIGHT-1.0f, cColor);
04688 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 3117 of file cg_draw.c. References CG_DrawRect(). Referenced by CG_DrawDuelistHealth().
03118 {
03119 float midpoint, remainder;
03120 float color3[4] = {1, 0, 0, .7f};
03121
03122 midpoint = width * ratio - 1;
03123 remainder = width - midpoint;
03124 color3[0] = color1[0] * 0.5f;
03125
03126 assert(!(height%4));//this won't line up otherwise.
03127 CG_DrawRect(x + 1, y + height/2-1, midpoint, 1, height/4+1, color1); // creme-y filling.
03128 CG_DrawRect(x + midpoint, y + height/2-1, remainder, 1, height/4+1, color3); // used-up-ness.
03129 CG_DrawRect(x, y, width, height, 1, color2); // hard crispy shell
03130 }
|
|
|
Definition at line 1169 of file cg_draw.c. References playerState_s::ammo, windowDef_t::background, bluehudtint, centity_t, cg, CG_DrawArmor(), CG_DrawForcePower(), CG_DrawHealth(), CG_DrawPic(), CG_GetStringEdString(), cg_hudFiles, cgs, colorTable, Com_sprintf(), CT_HUD_GREEN, CT_HUD_ORANGE, CT_HUD_RED, CT_ICON_BLUE, CT_WHITE, centity_s::currentState, playerState_s::fd, FORCE_LEVEL_2, FORCE_LEVEL_3, forcedata_s::forcePower, windowDef_t::foreColor, cgs_t::fraglimit, cgs_t::gametype, GT_DUEL, GT_POWERDUEL, GT_SIEGE, GT_TEAM, rectDef_t::h, hudTintColor, vmCvar_t::integer, itemDef_t, Menu_FindItemByName(), Menus_FindByName(), NULL, PERS_SCORE, PERS_TEAM, playerState_s::persistant, PM_SPECTATOR, playerState_s::pm_type, cg_t::predictedPlayerState, snapshot_t::ps, windowDef_t::rect, redhudtint, forcedata_s::saberDrawAnimLevel, cgs_t::scores1, cgs_t::scores2, SCREEN_HEIGHT, SCREEN_WIDTH, cg_t::snap, SS_DUAL, SS_STAFF, STAT_ARMOR, STAT_HEALTH, playerState_s::stats, TEAM_BLUE, TEAM_RED, trap_R_SetColor(), UI_DrawProportionalString(), UI_DrawScaledProportionalString(), UI_DROPSHADOW, UI_RIGHT, UI_SMALLFONT, va(), rectDef_t::w, entityState_s::weapon, playerState_s::weapon, weaponData, itemDef_s::window, WP_SABER, rectDef_t::x, and rectDef_t::y.
01170 {
01171 menuDef_t *menuHUD = NULL;
01172 itemDef_t *focusItem = NULL;
01173 const char *scoreStr = NULL;
01174 int scoreBias;
01175 char scoreBiasStr[16];
01176
01177 if (cg_hudFiles.integer)
01178 {
01179 int x = 0;
01180 int y = SCREEN_HEIGHT-80;
01181 char ammoString[64];
01182 int weapX = x;
01183
01184 UI_DrawProportionalString( x+16, y+40, va( "%i", cg.snap->ps.stats[STAT_HEALTH] ),
01185 UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_HUD_RED] );
01186
01187 UI_DrawProportionalString( x+18+14, y+40+14, va( "%i", cg.snap->ps.stats[STAT_ARMOR] ),
01188 UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_HUD_GREEN] );
01189
01190 if (cg.snap->ps.weapon == WP_SABER)
01191 {
01192 if (cg.snap->ps.fd.saberDrawAnimLevel == SS_DUAL)
01193 {
01194 Com_sprintf(ammoString, sizeof(ammoString), "AKIMBO");
01195 weapX += 16;
01196 }
01197 else if (cg.snap->ps.fd.saberDrawAnimLevel == SS_STAFF)
01198 {
01199 Com_sprintf(ammoString, sizeof(ammoString), "STAFF");
01200 weapX += 16;
01201 }
01202 else if (cg.snap->ps.fd.saberDrawAnimLevel == FORCE_LEVEL_3)
01203 {
01204 Com_sprintf(ammoString, sizeof(ammoString), "STRONG");
01205 weapX += 16;
01206 }
01207 else if (cg.snap->ps.fd.saberDrawAnimLevel == FORCE_LEVEL_2)
01208 {
01209 Com_sprintf(ammoString, sizeof(ammoString), "MEDIUM");
01210 weapX += 16;
01211 }
01212 else
01213 {
01214 Com_sprintf(ammoString, sizeof(ammoString), "FAST");
01215 }
01216 }
01217 else
01218 {
01219 Com_sprintf(ammoString, sizeof(ammoString), "%i", cg.snap->ps.ammo[weaponData[cent->currentState.weapon].ammoIndex]);
01220 }
01221
01222 UI_DrawProportionalString( SCREEN_WIDTH-(weapX+16+32), y+40, va( "%s", ammoString ),
01223 UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_HUD_ORANGE] );
01224
01225 UI_DrawProportionalString( SCREEN_WIDTH-(x+18+14+32), y+40+14, va( "%i", cg.snap->ps.fd.forcePower),
01226 UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_ICON_BLUE] );
01227
01228 return;
01229 }
01230
01231 if (cgs.gametype >= GT_TEAM && cgs.gametype != GT_SIEGE)
01232 { // tint the hud items based on team
01233 if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED )
01234 hudTintColor = redhudtint;
01235 else if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE )
01236 hudTintColor = bluehudtint;
01237 else // If we're not on a team for whatever reason, leave things as they are.
01238 hudTintColor = colorTable[CT_WHITE];
01239 }
01240 else
01241 { // tint the hud items white (dont' tint)
01242 hudTintColor = colorTable[CT_WHITE];
01243 }
01244
01245 // Draw the left HUD
01246 menuHUD = Menus_FindByName("lefthud");
01247 if (menuHUD)
01248 {
01249 itemDef_t *focusItem;
01250
01251 // Print scanline
01252 focusItem = Menu_FindItemByName(menuHUD, "scanline");
01253 if (focusItem)
01254 {
01255 trap_R_SetColor( hudTintColor );
01256 CG_DrawPic(
01257 focusItem->window.rect.x,
01258 focusItem->window.rect.y,
01259 focusItem->window.rect.w,
01260 focusItem->window.rect.h,
01261 focusItem->window.background
01262 );
01263 }
01264
01265 // Print frame
01266 focusItem = Menu_FindItemByName(menuHUD, "frame");
01267 if (focusItem)
01268 {
01269 trap_R_SetColor( hudTintColor );
01270 CG_DrawPic(
01271 focusItem->window.rect.x,
01272 focusItem->window.rect.y,
01273 focusItem->window.rect.w,
01274 focusItem->window.rect.h,
01275 focusItem->window.background
01276 );
01277 }
01278
01279 if (cg.predictedPlayerState.pm_type != PM_SPECTATOR)
01280 {
01281 CG_DrawArmor(menuHUD);
01282 CG_DrawHealth(menuHUD);
01283 }
01284 }
01285 else
01286 {
01287 //CG_Error("CG_ChatBox_ArrayInsert: unable to locate HUD menu file ");
01288 }
01289
01290 //scoreStr = va("Score: %i", cgs.clientinfo[cg.snap->ps.clientNum].score);
01291 if ( cgs.gametype == GT_DUEL )
01292 {//A duel that requires more than one kill to knock the current enemy back to the queue
01293 //show current kills out of how many needed
01294 scoreStr = va("%s: %i/%i", CG_GetStringEdString("MP_INGAME", "SCORE"), cg.snap->ps.persistant[PERS_SCORE], cgs.fraglimit);
01295 }
01296 else if (0 && cgs.gametype < GT_TEAM )
01297 { // This is a teamless mode, draw the score bias.
01298 scoreBias = cg.snap->ps.persistant[PERS_SCORE] - cgs.scores1;
01299 if (scoreBias == 0)
01300 { // We are the leader!
01301 if (cgs.scores2 <= 0)
01302 { // Nobody to be ahead of yet.
01303 Com_sprintf(scoreBiasStr, sizeof(scoreBiasStr), "");
01304 }
01305 else
01306 {
01307 scoreBias = cg.snap->ps.persistant[PERS_SCORE] - cgs.scores2;
01308 if (scoreBias == 0)
01309 {
01310 Com_sprintf(scoreBiasStr, sizeof(scoreBiasStr), " (Tie)");
01311 }
01312 else
01313 {
01314 Com_sprintf(scoreBiasStr, sizeof(scoreBiasStr), " (+%d)", scoreBias);
01315 }
01316 }
01317 }
01318 else // if (scoreBias < 0)
01319 { // We are behind!
01320 Com_sprintf(scoreBiasStr, sizeof(scoreBiasStr), " (%d)", scoreBias);
01321 }
01322 scoreStr = va("%s: %i%s", CG_GetStringEdString("MP_INGAME", "SCORE"), cg.snap->ps.persistant[PERS_SCORE], scoreBiasStr);
01323 }
01324 else
01325 { // Don't draw a bias.
01326 scoreStr = va("%s: %i", CG_GetStringEdString("MP_INGAME", "SCORE"), cg.snap->ps.persistant[PERS_SCORE]);
01327 }
01328
01329 menuHUD = Menus_FindByName("righthud");
01330
01331 if (menuHUD)
01332 {
01333 if (cgs.gametype != GT_POWERDUEL)
01334 {
01335 focusItem = Menu_FindItemByName(menuHUD, "score_line");
01336 if (focusItem)
01337 {
01338 UI_DrawScaledProportionalString(
01339 focusItem->window.rect.x,
01340 focusItem->window.rect.y,
01341 scoreStr,
01342 UI_RIGHT|UI_DROPSHADOW,
01343 focusItem->window.foreColor,
01344 0.7);
01345 }
01346 }
01347
01348 // Print scanline
01349 focusItem = Menu_FindItemByName(menuHUD, "scanline");
01350 if (focusItem)
01351 {
01352 trap_R_SetColor( hudTintColor );
01353 CG_DrawPic(
01354 focusItem->window.rect.x,
01355 focusItem->window.rect.y,
01356 focusItem->window.rect.w,
01357 focusItem->window.rect.h,
01358 focusItem->window.background
01359 );
01360 }
01361
01362 focusItem = Menu_FindItemByName(menuHUD, "frame");
01363 if (focusItem)
01364 {
01365 trap_R_SetColor( hudTintColor );
01366 CG_DrawPic(
01367 focusItem->window.rect.x,
01368 focusItem->window.rect.y,
01369 focusItem->window.rect.w,
01370 focusItem->window.rect.h,
01371 focusItem->window.background
01372 );
01373 }
01374
01375 CG_DrawForcePower(menuHUD);
01376
01377 // Draw ammo tics or saber style
01378 if ( cent->currentState.weapon == WP_SABER )
01379 {
01380 CG_DrawSaberStyle(cent,menuHUD);
01381 }
01382 else
01383 {
01384 CG_DrawAmmo(cent,menuHUD);
01385 }
01386 }
01387 else
01388 {
01389 //CG_Error("CG_ChatBox_ArrayInsert: unable to locate HUD menu file ");
01390 }
01391 }
|
|
|
Definition at line 1585 of file cg_draw.c. References BG_GetItemIndexByTag(), BG_IsItemSelectable(), bg_itemlist, cg, CG_DrawPic(), cgs, gitem_s::classname, colorTable, CT_ICON_BLUE, HI_NUM_HOLDABLE, cg_t::iconHUDPercent, cgMedia_t::invenIcons, cg_t::invenSelectTime, IT_HOLDABLE, cg_t::itemSelect, cgs_t::media, NULL, cg_t::predictedPlayerState, snapshot_t::ps, Q_strupr(), cg_t::snap, STAT_HEALTH, STAT_HOLDABLE_ITEM, STAT_HOLDABLE_ITEMS, playerState_s::stats, strcpy(), cg_t::time, trap_R_SetColor(), trap_SP_GetStringTextString(), UI_CENTER, UI_DrawProportionalString(), UI_SMALLFONT, va(), vec4_t, and WEAPON_SELECT_TIME.
01586 {
01587 int i;
01588 int sideMax,holdCount,iconCnt;
01589 int smallIconSize,bigIconSize;
01590 int sideLeftIconCnt,sideRightIconCnt;
01591 int count;
01592 int holdX,x,y,y2,pad;
01593 int height;
01594 float addX;
01595
01596 // don't display if dead
01597 if ( cg.snap->ps.stats[STAT_HEALTH] <= 0 )
01598 {
01599 return;
01600 }
01601
01602 if ((cg.invenSelectTime+WEAPON_SELECT_TIME)<cg.time) // Time is up for the HUD to display
01603 {
01604 return;
01605 }
01606
01607 if (!cg.snap->ps.stats[STAT_HOLDABLE_ITEM] || !cg.snap->ps.stats[STAT_HOLDABLE_ITEMS])
01608 {
01609 return;
01610 }
01611
01612 #ifdef _XBOX
01613 if(CL_ExtendSelectTime()) {
01614 cg.invenSelectTime = cg.time;
01615 }
01616 #endif
01617
01618 if (cg.itemSelect == -1)
01619 {
01620 cg.itemSelect = bg_itemlist[cg.snap->ps.stats[STAT_HOLDABLE_ITEM]].giTag;
01621 }
01622
01623 //const int bits = cg.snap->ps.stats[ STAT_ITEMS ];
01624
01625 // count the number of items owned
01626 count = 0;
01627 for ( i = 0 ; i < HI_NUM_HOLDABLE ; i++ )
01628 {
01629 if (/*CG_InventorySelectable(i) && inv_icons[i]*/
01630 (cg.snap->ps.stats[STAT_HOLDABLE_ITEMS] & (1 << i)) )
01631 {
01632 count++;
01633 }
01634 }
01635
01636 if (!count)
01637 {
01638 y2 = 0; //err?
01639 UI_DrawProportionalString(320, y2 + 22, "EMPTY INVENTORY", UI_CENTER | UI_SMALLFONT, colorTable[CT_ICON_BLUE]);
01640 return;
01641 }
01642
01643 sideMax = 3; // Max number of icons on the side
01644
01645 // Calculate how many icons will appear to either side of the center one
01646 holdCount = count - 1; // -1 for the center icon
01647 if (holdCount == 0) // No icons to either side
01648 {
01649 sideLeftIconCnt = 0;
01650 sideRightIconCnt = 0;
01651 }
01652 else if (count > (2*sideMax)) // Go to the max on each side
01653 {
01654 sideLeftIconCnt = sideMax;
01655 sideRightIconCnt = sideMax;
01656 }
01657 else // Less than max, so do the calc
01658 {
01659 sideLeftIconCnt = holdCount/2;
01660 sideRightIconCnt = holdCount - sideLeftIconCnt;
01661 }
01662
01663 i = cg.itemSelect - 1;
01664 if (i<0)
01665 {
01666 i = HI_NUM_HOLDABLE-1;
01667 }
01668
01669 smallIconSize = 40;
01670 bigIconSize = 80;
01671 pad = 16;
01672
01673 x = 320;
01674 y = 410;
01675
01676 // Left side ICONS
01677 // Work backwards from current icon
01678 holdX = x - ((bigIconSize/2) + pad + smallIconSize);
01679 height = smallIconSize * cg.iconHUDPercent;
01680 addX = (float) smallIconSize * .75;
01681
01682 for (iconCnt=0;iconCnt<sideLeftIconCnt;i--)
01683 {
01684 if (i<0)
01685 {
01686 i = HI_NUM_HOLDABLE-1;
01687 }
01688
01689 if ( !(cg.snap->ps.stats[STAT_HOLDABLE_ITEMS] & (1 << i)) || i == cg.itemSelect )
01690 {
01691 continue;
01692 }
01693
01694 ++iconCnt; // Good icon
01695
01696 if (!BG_IsItemSelectable(&cg.predictedPlayerState, i))
01697 {
01698 continue;
01699 }
01700
01701 if (cgs.media.invenIcons[i])
01702 {
01703 trap_R_SetColor(NULL);
01704 CG_DrawPic( holdX, y+10, smallIconSize, smallIconSize, cgs.media.invenIcons[i] );
01705
01706 trap_R_SetColor(colorTable[CT_ICON_BLUE]);
01707 /*CG_DrawNumField (holdX + addX, y + smallIconSize, 2, cg.snap->ps.inventory[i], 6, 12,
01708 NUM_FONT_SMALL,qfalse);
01709 */
01710
01711 holdX -= (smallIconSize+pad);
01712 }
01713 }
01714
01715 // Current Center Icon
01716 height = bigIconSize * cg.iconHUDPercent;
01717 if (cgs.media.invenIcons[cg.itemSelect] && BG_IsItemSelectable(&cg.predictedPlayerState, cg.itemSelect))
01718 {
01719 int itemNdex;
01720 trap_R_SetColor(NULL);
01721 CG_DrawPic( x-(bigIconSize/2), (y-((bigIconSize-smallIconSize)/2))+10, bigIconSize, bigIconSize, cgs.media.invenIcons[cg.itemSelect] );
01722 addX = (float) bigIconSize * .75;
01723 trap_R_SetColor(colorTable[CT_ICON_BLUE]);
01724 /*CG_DrawNumField ((x-(bigIconSize/2)) + addX, y, 2, cg.snap->ps.inventory[cg.inventorySelect], 6, 12,
01725 NUM_FONT_SMALL,qfalse);*/
01726
01727 itemNdex = BG_GetItemIndexByTag(cg.itemSelect, IT_HOLDABLE);
01728 if (bg_itemlist[itemNdex].classname)
01729 {
01730 vec4_t textColor = { .312f, .75f, .621f, 1.0f };
01731 char text[1024];
01732 char upperKey[1024];
01733
01734 strcpy(upperKey, bg_itemlist[itemNdex].classname);
01735
01736 if ( trap_SP_GetStringTextString( va("SP_INGAME_%s",Q_strupr(upperKey)), text, sizeof( text )))
01737 {
01738 UI_DrawProportionalString(320, y+45, text, UI_CENTER | UI_SMALLFONT, textColor);
01739 }
01740 else
01741 {
01742 UI_DrawProportionalString(320, y+45, bg_itemlist[itemNdex].classname, UI_CENTER | UI_SMALLFONT, textColor);
01743 }
01744 }
01745 }
01746
01747 i = cg.itemSelect + 1;
01748 if (i> HI_NUM_HOLDABLE-1)
01749 {
01750 i = 0;
01751 }
01752
01753 // Right side ICONS
01754 // Work forwards from current icon
01755 holdX = x + (bigIconSize/2) + pad;
01756 height = smallIconSize * cg.iconHUDPercent;
01757 addX = (float) smallIconSize * .75;
01758 for (iconCnt=0;iconCnt<sideRightIconCnt;i++)
01759 {
01760 if (i> HI_NUM_HOLDABLE-1)
01761 {
01762 i = 0;
01763 }
01764
01765 if ( !(cg.snap->ps.stats[STAT_HOLDABLE_ITEMS] & (1 << i)) || i == cg.itemSelect )
01766 {
01767 continue;
01768 }
01769
01770 ++iconCnt; // Good icon
01771
01772 if (!BG_IsItemSelectable(&cg.predictedPlayerState, i))
01773 {
01774 continue;
01775 }
01776
01777 if (cgs.media.invenIcons[i])
01778 {
01779 trap_R_SetColor(NULL);
01780 CG_DrawPic( holdX, y+10, smallIconSize, smallIconSize, cgs.media.invenIcons[i] );
01781
01782 trap_R_SetColor(colorTable[CT_ICON_BLUE]);
01783 /*CG_DrawNumField (holdX + addX, y + smallIconSize, 2, cg.snap->ps.inventory[i], 6, 12,
01784 NUM_FONT_SMALL,qfalse);*/
01785
01786 holdX += (smallIconSize+pad);
01787 }
01788 }
01789 }
|
|
|
Definition at line 7133 of file cg_draw.c. References cg, CG_DrawRect(), CG_FillRect(), colorTable, CT_BLACK, playerState_s::jetpackFuel, JPFUELBAR_H, JPFUELBAR_W, JPFUELBAR_X, JPFUELBAR_Y, snapshot_t::ps, cg_t::snap, and vec4_t.
07134 {
07135 vec4_t aColor;
07136 vec4_t bColor;
07137 vec4_t cColor;
07138 float x = JPFUELBAR_X;
07139 float y = JPFUELBAR_Y;
07140 float percent = ((float)cg.snap->ps.jetpackFuel/100.0f)*JPFUELBAR_H;
07141
07142 if (percent > JPFUELBAR_H)
07143 {
07144 return;
07145 }
07146
07147 if (percent < 0.1f)
07148 {
07149 percent = 0.1f;
07150 }
07151
07152 //color of the bar
07153 aColor[0] = 0.5f;
07154 aColor[1] = 0.0f;
07155 aColor[2] = 0.0f;
07156 aColor[3] = 0.8f;
07157
07158 //color of the border
07159 bColor[0] = 0.0f;
07160 bColor[1] = 0.0f;
07161 bColor[2] = 0.0f;
07162 bColor[3] = 0.3f;
07163
07164 //color of greyed out "missing fuel"
07165 cColor[0] = 0.5f;
07166 cColor[1] = 0.5f;
07167 cColor[2] = 0.5f;
07168 cColor[3] = 0.1f;
07169
07170 //draw the background (black)
07171 CG_DrawRect(x, y, JPFUELBAR_W, JPFUELBAR_H, 1.0f, colorTable[CT_BLACK]);
07172
07173 //now draw the part to show how much health there is in the color specified
07174 CG_FillRect(x+1.0f, y+1.0f+(JPFUELBAR_H-percent), JPFUELBAR_W-1.0f, JPFUELBAR_H-1.0f-(JPFUELBAR_H-percent), aColor);
07175
07176 //then draw the other part greyed out
07177 CG_FillRect(x+1.0f, y+1.0f, JPFUELBAR_W-1.0f, JPFUELBAR_H-percent, cColor);
07178 }
|
|
|
Definition at line 3179 of file cg_draw.c. References AngleVectors(), atan2(), atoi(), BG_EvaluateTrajectory(), entityState_s::brokenLimbs, centity_t, cg, CG_DrawPic(), CG_DrawRotatePic2(), cg_entities, cg_radarRange, cgs, CHAN_AUTO, CLASS_VEHICLE, cgs_t::clientinfo, playerState_s::clientNum, COLOR_GREEN, COLOR_RED, ColorIndex, colorWhite, cos(), centity_s::currentState, EF_RADAROBJECT, entityState_s::eFlags, ENTITYNUM_WORLD, ET_MISSILE, ET_MOVER, ET_NPC, ET_PLAYER, entityState_s::eType, entityState_s::frame, g_color_table, cgs_t::gameIcons, entityState_s::genericenemyindex, clientInfo_t::infoValid, centity_s::lerpAngles, centity_s::lerpOrigin, playerState_s::m_iVehicleNum, entityState_s::m_iVehicleNum, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, cgMedia_t::mAutomapPlayerIcon, cgMedia_t::mAutomapRocketIcon, MAX_CLIENTS, cgs_t::media, entityState_s::NPC_class, NULL, entityState_s::number, playerState_s::origin, entityState_s::otherEntityNum, entityState_s::owner, PERS_TEAM, playerState_s::persistant, playerState_s::pm_flags, PMF_FOLLOW, entityState_s::pos, cg_t::predictedPlayerState, cg_t::predictedVehicleState, snapshot_t::ps, qboolean, qfalse, qhandle_t, qtrue, RADAR_ASTEROID_RANGE, RADAR_MIN_ASTEROID_SURF_WARN_DIST, RADAR_MISSILE_RANGE, RADAR_RADIUS, RADAR_X, cg_t::radarEntities, cg_t::radarEntityCount, vehicleInfo_t::radarIconHandle, cgMedia_t::radarShader, cg_t::refdef, cgMedia_t::siegeItemShader, sin(), cg_t::snap, playerState_s::speed, entityState_s::speed, STAT_HEALTH, playerState_s::stats, clientInfo_t::team, TEAM_SPECTATOR, cg_t::time, entityState_s::time2, trap_Cvar_VariableStringBuffer(), trap_R_RegisterShaderNoMip(), trap_R_SetColor(), trap_S_RegisterSound(), trap_S_StartSound(), va(), centity_s::vChatTime, vec3_t, vec4_t, VectorCopy, VectorCopy4, VectorMA, VectorNormalize(), VectorSubtract, playerState_s::viewangles, refdef_t::vieworg, and YAW.
03180 {
03181 vec4_t color;
03182 vec4_t teamColor;
03183 float arrow_w;
03184 float arrow_h;
03185 clientInfo_t *cl;
03186 clientInfo_t *local;
03187 int i;
03188 float arrowBaseScale;
03189 float zScale;
03190 int xOffset = 0;
03191
03192 if (!cg.snap)
03193 {
03194 return y;
03195 }
03196
03197 #ifdef _XBOX
03198 xOffset = -40;
03199 #endif
03200
03201 // Make sure the radar should be showing
03202 if ( cg.snap->ps.stats[STAT_HEALTH] <= 0 )
03203 {
03204 return y;
03205 }
03206
03207 if ( (cg.predictedPlayerState.pm_flags & PMF_FOLLOW) || cg.predictedPlayerState.persistant[PERS_TEAM] == TEAM_SPECTATOR )
03208 {
03209 return y;
03210 }
03211
03212 local = &cgs.clientinfo[ cg.snap->ps.clientNum ];
03213 if ( !local->infoValid )
03214 {
03215 return y;
03216 }
03217
03218 // Draw the radar background image
03219 color[0] = color[1] = color[2] = 1.0f;
03220 color[3] = 0.6f;
03221 trap_R_SetColor ( color );
03222 CG_DrawPic( RADAR_X + xOffset, y, RADAR_RADIUS*2, RADAR_RADIUS*2, cgs.media.radarShader );
03223
03224 //Always green for your own team.
03225 VectorCopy ( g_color_table[ColorIndex(COLOR_GREEN)], teamColor );
03226 teamColor[3] = 1.0f;
03227
03228 // Draw all of the radar entities. Draw them backwards so players are drawn last
03229 for ( i = cg.radarEntityCount -1 ; i >= 0 ; i-- )
03230 {
03231 vec3_t dirLook;
03232 vec3_t dirPlayer;
03233 float angleLook;
03234 float anglePlayer;
03235 float angle;
03236 float distance, actualDist;
03237 centity_t* cent;
03238
03239 cent = &cg_entities[cg.radarEntities[i]];
03240
03241 // Get the distances first
03242 VectorSubtract ( cg.predictedPlayerState.origin, cent->lerpOrigin, dirPlayer );
03243 dirPlayer[2] = 0;
03244 actualDist = distance = VectorNormalize ( dirPlayer );
03245
03246 if ( distance > cg_radarRange * 0.8f)
03247 {
03248 if ( (cent->currentState.eFlags & EF_RADAROBJECT)//still want to draw the direction
03249 || ( cent->currentState.eType==ET_NPC//FIXME: draw last, with players...
03250 && cent->currentState.NPC_class == CLASS_VEHICLE
03251 && cent->currentState.speed > 0 ) )//always draw vehicles
03252 {
03253 distance = cg_radarRange*0.8f;
03254 }
03255 else
03256 {
03257 continue;
03258 }
03259 }
03260
03261 distance = distance / cg_radarRange;
03262 distance *= RADAR_RADIUS;
03263
03264 AngleVectors ( cg.predictedPlayerState.viewangles, dirLook, NULL, NULL );
03265
03266 dirLook[2] = 0;
03267 anglePlayer = atan2(dirPlayer[0],dirPlayer[1]);
03268 VectorNormalize ( dirLook );
03269 angleLook = atan2(dirLook[0],dirLook[1]);
03270 angle = angleLook - anglePlayer;
03271
03272 switch ( cent->currentState.eType )
03273 {
03274 default:
03275 {
03276 float x;
03277 float ly;
03278 qhandle_t shader;
03279 vec4_t color;
03280
03281 x = (float)RADAR_X + (float)RADAR_RADIUS + (float)sin (angle) * distance;
03282 ly = y + (float)RADAR_RADIUS + (float)cos (angle) * distance;
03283
03284 arrowBaseScale = 9.0f;
03285 shader = 0;
03286 zScale = 1.0f;
03287
03288 //we want to scale the thing up/down based on the relative Z (up/down) positioning
03289 if (cent->lerpOrigin[2] > cg.predictedPlayerState.origin[2])
03290 { //higher, scale up (between 16 and 24)
03291 float dif = (cent->lerpOrigin[2] - cg.predictedPlayerState.origin[2]);
03292
03293 //max out to 1.5x scale at 512 units above local player's height
03294 dif /= 1024.0f;
03295 if (dif > 0.5f)
03296 {
03297 dif = 0.5f;
03298 }
03299 zScale += dif;
03300 }
03301 else if (cent->lerpOrigin[2] < cg.predictedPlayerState.origin[2])
03302 { //lower, scale down (between 16 and 8)
03303 float dif = (cg.predictedPlayerState.origin[2] - cent->lerpOrigin[2]);
03304
03305 //half scale at 512 units below local player's height
03306 dif /= 1024.0f;
03307 if (dif > 0.5f)
03308 {
03309 dif = 0.5f;
03310 }
03311 zScale -= dif;
03312 }
03313
03314 arrowBaseScale *= zScale;
03315
03316 if (cent->currentState.brokenLimbs)
03317 { //slightly misleading to use this value, but don't want to add more to entstate.
03318 //any ent with brokenLimbs non-0 and on radar is an objective ent.
03319 //brokenLimbs is literal team value.
03320 char objState[1024];
03321 int complete;
03322
03323 //we only want to draw it if the objective for it is not complete.
03324 //frame represents objective num.
03325 trap_Cvar_VariableStringBuffer(va("team%i_objective%i", cent->currentState.brokenLimbs, cent->currentState.frame), objState, 1024);
03326
03327 complete = atoi(objState);
03328
03329 if (!complete)
03330 {
03331
03332 // generic enemy index specifies a shader to use for the radar entity.
03333 if ( cent->currentState.genericenemyindex )
03334 {
03335 color[0] = color[1] = color[2] = color[3] = 1.0f;
03336 shader = cgs.gameIcons[cent->currentState.genericenemyindex];
03337 }
03338 else
03339 {
03340 if (cg.snap &&
03341 cent->currentState.brokenLimbs == cg.snap->ps.persistant[PERS_TEAM])
03342 {
03343 VectorCopy ( g_color_table[ColorIndex(COLOR_RED)], color );
03344 }
03345 else
03346 {
03347 VectorCopy ( g_color_table[ColorIndex(COLOR_GREEN)], color );
03348 }
03349
03350 shader = cgs.media.siegeItemShader;
03351 }
03352 }
03353 }
03354 else
03355 {
03356 color[0] = color[1] = color[2] = color[3] = 1.0f;
03357
03358 // generic enemy index specifies a shader to use for the radar entity.
03359 if ( cent->currentState.genericenemyindex )
03360 {
03361 shader = cgs.gameIcons[cent->currentState.genericenemyindex];
03362 }
03363 else
03364 {
03365 shader = cgs.media.siegeItemShader;
03366 }
03367
03368 }
03369
03370 if ( shader )
03371 {
03372 // Pulse the alpha if time2 is set. time2 gets set when the entity takes pain
03373 if ( (cent->currentState.time2 && cg.time - cent->currentState.time2 < 5000) ||
03374 (cent->currentState.time2 == 0xFFFFFFFF) )
03375 {
03376 if ( (cg.time / 200) & 1 )
03377 {
03378 color[3] = 0.1f + 0.9f * (float) (cg.time % 200) / 200.0f;
03379 }
03380 else
03381 {
03382 color[3] = 1.0f - 0.9f * (float) (cg.time % 200) / 200.0f;
03383 }
03384 }
03385
03386 trap_R_SetColor ( color );
03387 CG_DrawPic ( x - 4 + xOffset, ly - 4, arrowBaseScale, arrowBaseScale, shader );
03388 }
03389 }
03390 break;
03391
03392 case ET_NPC://FIXME: draw last, with players...
03393 if ( cent->currentState.NPC_class == CLASS_VEHICLE
03394 && cent->currentState.speed > 0 )
03395 {
03396 if ( cent->m_pVehicle && cent->m_pVehicle->m_pVehicleInfo->radarIconHandle )
03397 {
03398 float x;
03399 float ly;
03400
03401 x = (float)RADAR_X + (float)RADAR_RADIUS + (float)sin (angle) * distance;
03402 ly = y + (float)RADAR_RADIUS + (float)cos (angle) * distance;
03403
03404 arrowBaseScale = 9.0f;
03405 zScale = 1.0f;
03406
03407 //we want to scale the thing up/down based on the relative Z (up/down) positioning
03408 if (cent->lerpOrigin[2] > cg.predictedPlayerState.origin[2])
03409 { //higher, scale up (between 16 and 24)
03410 float dif = (cent->lerpOrigin[2] - cg.predictedPlayerState.origin[2]);
03411
03412 //max out to 1.5x scale at 512 units above local player's height
03413 dif /= 4096.0f;
03414 if (dif > 0.5f)
03415 {
03416 dif = 0.5f;
03417 }
03418 zScale += dif;
03419 }
03420 else if (cent->lerpOrigin[2] < cg.predictedPlayerState.origin[2])
03421 { //lower, scale down (between 16 and 8)
03422 float dif = (cg.predictedPlayerState.origin[2] - cent->lerpOrigin[2]);
03423
03424 //half scale at 512 units below local player's height
03425 dif /= 4096.0f;
03426 if (dif > 0.5f)
03427 {
03428 dif = 0.5f;
03429 }
03430 zScale -= dif;
03431 }
03432
03433 arrowBaseScale *= zScale;
03434
03435 if ( cent->currentState.m_iVehicleNum //vehicle has a driver
03436 && cgs.clientinfo[ cent->currentState.m_iVehicleNum-1 ].infoValid )
03437 {
03438 if ( cgs.clientinfo[ cent->currentState.m_iVehicleNum-1 ].team == local->team )
03439 {
03440 trap_R_SetColor ( teamColor );
03441 }
03442 else
03443 {
03444 trap_R_SetColor ( g_color_table[ColorIndex(COLOR_RED)] );
03445 }
03446 }
03447 else
03448 {
03449 trap_R_SetColor ( NULL );
03450 }
03451 CG_DrawPic ( x - 4 + xOffset, ly - 4, arrowBaseScale, arrowBaseScale, cent->m_pVehicle->m_pVehicleInfo->radarIconHandle );
03452 }
03453 }
03454 break; //maybe do something?
03455
03456 case ET_MOVER:
03457 if ( cent->currentState.speed//the mover's size, actually
03458 && actualDist < (cent->currentState.speed+RADAR_ASTEROID_RANGE)
03459 && cg.predictedPlayerState.m_iVehicleNum )
03460 {//a mover that's close to me and I'm in a vehicle
03461 qboolean mayImpact = qfalse;
03462 float surfaceDist = (actualDist-cent->currentState.speed);
03463 if ( surfaceDist < 0.0f )
03464 {
03465 surfaceDist = 0.0f;
03466 }
03467 if ( surfaceDist < RADAR_MIN_ASTEROID_SURF_WARN_DIST )
03468 {//always warn!
03469 mayImpact = qtrue;
03470 }
03471 else
03472 {//not close enough to always warn, yet, so check its direction
03473 vec3_t asteroidPos, myPos, moveDir;
03474 int predictTime, timeStep = 500;
03475 float newDist;
03476 for ( predictTime = timeStep; predictTime < 5000; predictTime+=timeStep )
03477 {
03478 //asteroid dir, speed, size, + my dir & speed...
03479 BG_EvaluateTrajectory( ¢->currentState.pos, cg.time+predictTime, asteroidPos );
03480 //FIXME: I don't think it's calcing "myPos" correctly
03481 AngleVectors( cg.predictedVehicleState.viewangles, moveDir, NULL, NULL );
03482 VectorMA( cg.predictedVehicleState.origin, cg.predictedVehicleState.speed*predictTime/1000.0f, moveDir, myPos );
03483 newDist = Distance( myPos, asteroidPos );
03484 if ( (newDist-cent->currentState.speed) <= RADAR_MIN_ASTEROID_SURF_WARN_DIST )//200.0f )
03485 {//heading for an impact within the next 5 seconds
03486 mayImpact = qtrue;
03487 break;
03488 }
03489 }
03490 }
03491 if ( mayImpact )
03492 {//possible collision
03493 vec4_t asteroidColor = {0.5f,0.5f,0.5f,1.0f};
03494 float x;
03495 float ly;
03496 float asteroidScale = (cent->currentState.speed/2000.0f);//average asteroid radius?
03497 if ( actualDist > RADAR_ASTEROID_RANGE )
03498 {
03499 actualDist = RADAR_ASTEROID_RANGE;
03500 }
03501 distance = (actualDist/RADAR_ASTEROID_RANGE)*RADAR_RADIUS;
03502
03503 x = (float)RADAR_X + (float)RADAR_RADIUS + (float)sin (angle) * distance;
03504 ly = y + (float)RADAR_RADIUS + (float)cos (angle) * distance;
03505
03506 if ( asteroidScale > 3.0f )
03507 {
03508 asteroidScale = 3.0f;
03509 }
03510 else if ( asteroidScale < 0.2f )
03511 {
03512 asteroidScale = 0.2f;
03513 }
03514 arrowBaseScale = (9.0f*asteroidScale);
03515 if ( impactSoundDebounceTime < cg.time )
03516 {
03517 vec3_t soundOrg;
03518 if ( surfaceDist > RADAR_ASTEROID_RANGE*0.66f )
03519 {
03520 impactSoundDebounceTime = cg.time + 1000;
03521 }
03522 else if ( surfaceDist > RADAR_ASTEROID_RANGE/3.0f )
03523 {
03524 impactSoundDebounceTime = cg.time + 400;
03525 }
03526 else
03527 {
03528 impactSoundDebounceTime = cg.time + 100;
03529 }
03530 VectorMA( cg.refdef.vieworg, -500.0f*(surfaceDist/RADAR_ASTEROID_RANGE), dirPlayer, soundOrg );
03531 trap_S_StartSound( soundOrg, ENTITYNUM_WORLD, CHAN_AUTO, trap_S_RegisterSound( "sound/vehicles/common/impactalarm.wav" ) );
03532 }
03533 //brighten it the closer it is
03534 if ( surfaceDist > RADAR_ASTEROID_RANGE*0.66f )
03535 {
03536 asteroidColor[0] = asteroidColor[1] = asteroidColor[2] = 0.7f;
03537 }
03538 else if ( surfaceDist > RADAR_ASTEROID_RANGE/3.0f )
03539 {
03540 asteroidColor[0] = asteroidColor[1] = asteroidColor[2] = 0.85f;
03541 }
03542 else
03543 {
03544 asteroidColor[0] = asteroidColor[1] = asteroidColor[2] = 1.0f;
03545 }
03546 //alpha out the longer it's been since it was considered dangerous
03547 if ( (cg.time-impactSoundDebounceTime) > 100 )
03548 {
03549 asteroidColor[3] = (float)((cg.time-impactSoundDebounceTime)-100)/900.0f;
03550 }
03551
03552 trap_R_SetColor ( asteroidColor );
03553 CG_DrawPic ( x - 4 + xOffset, ly - 4, arrowBaseScale, arrowBaseScale, trap_R_RegisterShaderNoMip( "gfx/menus/radar/asteroid" ) );
03554 }
03555 }
03556 break;
03557
03558 case ET_MISSILE:
03559 if ( //cent->currentState.weapon == WP_ROCKET_LAUNCHER &&//a rocket
03560 cent->currentState.owner > MAX_CLIENTS //belongs to an NPC
03561 && cg_entities[cent->currentState.owner].currentState.NPC_class == CLASS_VEHICLE )
03562 {//a rocket belonging to an NPC, FIXME: only tracking rockets!
03563 float x;
03564 float ly;
03565
03566 x = (float)RADAR_X + (float)RADAR_RADIUS + (float)sin (angle) * distance;
03567 ly = y + (float)RADAR_RADIUS + (float)cos (angle) * distance;
03568
03569 arrowBaseScale = 3.0f;
03570 if ( cg.predictedPlayerState.m_iVehicleNum )
03571 {//I'm in a vehicle
03572 //if it's targetting me, then play an alarm sound if I'm in a vehicle
03573 if ( cent->currentState.otherEntityNum == cg.predictedPlayerState.clientNum || cent->currentState.otherEntityNum == cg.predictedPlayerState.m_iVehicleNum )
03574 {
03575 if ( radarLockSoundDebounceTime < cg.time )
03576 {
03577 vec3_t soundOrg;
03578 int alarmSound;
03579 if ( actualDist > RADAR_MISSILE_RANGE * 0.66f )
03580 {
03581 radarLockSoundDebounceTime = cg.time + 1000;
03582 arrowBaseScale = 3.0f;
03583 alarmSound = trap_S_RegisterSound( "sound/vehicles/common/lockalarm1.wav" );
03584 }
03585 else if ( actualDist > RADAR_MISSILE_RANGE/3.0f )
03586 {
03587 radarLockSoundDebounceTime = cg.time + 500;
03588 arrowBaseScale = 6.0f;
03589 alarmSound = trap_S_RegisterSound( "sound/vehicles/common/lockalarm2.wav" );
03590 }
03591 else
03592 {
03593 radarLockSoundDebounceTime = cg.time + 250;
03594 arrowBaseScale = 9.0f;
03595 alarmSound = trap_S_RegisterSound( "sound/vehicles/common/lockalarm3.wav" );
03596 }
03597 if ( actualDist > RADAR_MISSILE_RANGE )
03598 {
03599 actualDist = RADAR_MISSILE_RANGE;
03600 }
03601 VectorMA( cg.refdef.vieworg, -500.0f*(actualDist/RADAR_MISSILE_RANGE), dirPlayer, soundOrg );
03602 trap_S_StartSound( soundOrg, ENTITYNUM_WORLD, CHAN_AUTO, alarmSound );
03603 }
03604 }
03605 }
03606 zScale = 1.0f;
03607
03608 //we want to scale the thing up/down based on the relative Z (up/down) positioning
03609 if (cent->lerpOrigin[2] > cg.predictedPlayerState.origin[2])
03610 { //higher, scale up (between 16 and 24)
03611 float dif = (cent->lerpOrigin[2] - cg.predictedPlayerState.origin[2]);
03612
03613 //max out to 1.5x scale at 512 units above local player's height
03614 dif /= 1024.0f;
03615 if (dif > 0.5f)
03616 {
03617 dif = 0.5f;
03618 }
03619 zScale += dif;
03620 }
03621 else if (cent->lerpOrigin[2] < cg.predictedPlayerState.origin[2])
03622 { //lower, scale down (between 16 and 8)
03623 float dif = (cg.predictedPlayerState.origin[2] - cent->lerpOrigin[2]);
03624
03625 //half scale at 512 units below local player's height
03626 dif /= 1024.0f;
03627 if (dif > 0.5f)
03628 {
03629 dif = 0.5f;
03630 }
03631 zScale -= dif;
03632 }
03633
03634 arrowBaseScale *= zScale;
03635
03636 if ( cent->currentState.owner >= MAX_CLIENTS//missile owned by an NPC
03637 && cg_entities[cent->currentState.owner].currentState.NPC_class == CLASS_VEHICLE//NPC is a vehicle
03638 && cg_entities[cent->currentState.owner].currentState.m_iVehicleNum <= MAX_CLIENTS//Vehicle has a player driver
03639 && cgs.clientinfo[cg_entities[cent->currentState.owner].currentState.m_iVehicleNum-1].infoValid ) //player driver is valid
03640 {
03641 cl = &cgs.clientinfo[cg_entities[cent->currentState.owner].currentState.m_iVehicleNum-1];
03642 if ( cl->team == local->team )
03643 {
03644 trap_R_SetColor ( teamColor );
03645 }
03646 else
03647 {
03648 trap_R_SetColor ( g_color_table[ColorIndex(COLOR_RED)] );
03649 }
03650 }
03651 else
03652 {
03653 trap_R_SetColor ( NULL );
03654 }
03655 CG_DrawPic ( x - 4 + xOffset, ly - 4, arrowBaseScale, arrowBaseScale, cgs.media.mAutomapRocketIcon );
03656 }
03657 break;
03658
03659 case ET_PLAYER:
03660 {
03661 vec4_t color;
03662
03663 cl = &cgs.clientinfo[ cent->currentState.number ];
03664
03665 // not valid then dont draw it
03666 if ( !cl->infoValid )
03667 {
03668 continue;
03669 }
03670
03671 VectorCopy4 ( teamColor, color );
03672
03673 arrowBaseScale = 16.0f;
03674 zScale = 1.0f;
03675
03676 // Pulse the radar icon after a voice message
03677 if ( cent->vChatTime + 2000 > cg.time )
03678 {
03679 float f = (cent->vChatTime + 2000 - cg.time) / 3000.0f;
03680 arrowBaseScale = 16.0f + 4.0f * f;
03681 color[0] = teamColor[0] + (1.0f - teamColor[0]) * f;
03682 color[1] = teamColor[1] + (1.0f - teamColor[1]) * f;
03683 color[2] = teamColor[2] + (1.0f - teamColor[2]) * f;
03684 }
03685
03686 trap_R_SetColor ( color );
03687
03688 //we want to scale the thing up/down based on the relative Z (up/down) positioning
03689 if (cent->lerpOrigin[2] > cg.predictedPlayerState.origin[2])
03690 { //higher, scale up (between 16 and 32)
03691 float dif = (cent->lerpOrigin[2] - cg.predictedPlayerState.origin[2]);
03692
03693 //max out to 2x scale at 1024 units above local player's height
03694 dif /= 1024.0f;
03695 if (dif > 1.0f)
03696 {
03697 dif = 1.0f;
03698 }
03699 zScale += dif;
03700 }
03701 else if (cent->lerpOrigin[2] < cg.predictedPlayerState.origin[2])
03702 { //lower, scale down (between 16 and 8)
03703 float dif = (cg.predictedPlayerState.origin[2] - cent->lerpOrigin[2]);
03704
03705 //half scale at 512 units below local player's height
03706 dif /= 1024.0f;
03707 if (dif > 0.5f)
03708 {
03709 dif = 0.5f;
03710 }
03711 zScale -= dif;
03712 }
03713
03714 arrowBaseScale *= zScale;
03715
03716 arrow_w = arrowBaseScale * RADAR_RADIUS / 128;
03717 arrow_h = arrowBaseScale * RADAR_RADIUS / 128;
03718
03719 CG_DrawRotatePic2( RADAR_X + RADAR_RADIUS + sin (angle) * distance + xOffset,
03720 y + RADAR_RADIUS + cos (angle) * distance,
03721 arrow_w, arrow_h,
03722 (360 - cent->lerpAngles[YAW]) + cg.predictedPlayerState.viewangles[YAW], cgs.media.mAutomapPlayerIcon );
03723 break;
03724 }
03725 }
03726 }
03727
03728 arrowBaseScale = 16.0f;
03729
03730 arrow_w = arrowBaseScale * RADAR_RADIUS / 128;
03731 arrow_h = arrowBaseScale * RADAR_RADIUS / 128;
03732
03733 trap_R_SetColor ( colorWhite );
03734 CG_DrawRotatePic2( RADAR_X + RADAR_RADIUS + xOffset, y + RADAR_RADIUS, arrow_w, arrow_h,
03735 0, cgs.media.mAutomapPlayerIcon );
03736
03737 return y+(RADAR_RADIUS*2);
03738 }
|
|
||||||||||||||||||||||||
|
Definition at line 4489 of file cg_draw.c. References siegeExtended_s::ammo, ammoData, BG_SiegeFindClassByName(), centity_t, CFL_STATVIEWER, cg, CG_ConfigString(), CG_DrawRect(), CG_FillRect(), cg_siegeExtendedData, cgs, siegeClass_t::classflags, cgs_t::clientinfo, playerState_s::clientNum, colorTable, CS_PLAYERS, CT_BLACK, centity_s::currentState, EF_DEAD, EF_DOUBLE_AMMO, entityState_s::eFlags, siegeExtended_s::health, HEALTH_HEIGHT, HEALTH_WIDTH, Info_ValueForKey(), siegeExtended_s::lastUpdated, MAX_CLIENTS, siegeExtended_s::maxhealth, entityState_s::number, PERS_TEAM, playerState_s::persistant, cg_t::predictedPlayerState, siegeExtended_t, clientInfo_t::team, cg_t::time, vec4_t, siegeExtended_s::weapon, entityState_s::weapon, and weaponData.
04490 {
04491 siegeExtended_t *se = &cg_siegeExtendedData[cent->currentState.number];
04492 clientInfo_t *ci;
04493 const char *configstring, *v;
04494 siegeClass_t *siegeClass;
04495 vec4_t aColor;
04496 vec4_t bColor;
04497 vec4_t cColor;
04498 float x;
04499 float y;
04500 float percent;
04501 int ammoMax;
04502
04503 assert(cent->currentState.number < MAX_CLIENTS);
04504
04505 if (se->lastUpdated > cg.time)
04506 { //strange, shouldn't happen
04507 return;
04508 }
04509
04510 if ((cg.time - se->lastUpdated) > 10000)
04511 { //if you haven't received a status update on this guy in 10 seconds, forget about it
04512 return;
04513 }
04514
04515 if (cent->currentState.eFlags & EF_DEAD)
04516 { //he's dead, don't display info on him
04517 return;
04518 }
04519
04520 if (cent->currentState.weapon != se->weapon)
04521 { //data is invalidated until it syncs back again
04522 return;
04523 }
04524
04525 ci = &cgs.clientinfo[cent->currentState.number];
04526 if (ci->team != cg.predictedPlayerState.persistant[PERS_TEAM])
04527 { //not on the same team
04528 return;
04529 }
04530
04531 configstring = CG_ConfigString( cg.predictedPlayerState.clientNum + CS_PLAYERS );
04532 v = Info_ValueForKey( configstring, "siegeclass" );
04533
04534 if (!v || !v[0])
04535 { //don't have siege class in info?
04536 return;
04537 }
04538
04539 siegeClass = BG_SiegeFindClassByName(v);
04540
04541 if (!siegeClass)
04542 { //invalid
04543 return;
04544 }
04545
04546 if (!(siegeClass->classflags & (1<<CFL_STATVIEWER)))
04547 { //doesn't really have the ability to see others' stats
04548 return;
04549 }
04550
04551 x = chX+((chW/2)-(HEALTH_WIDTH/2));
04552 y = (chY+chH) + 8.0f;
04553 percent = ((float)se->health/(float)se->maxhealth)*HEALTH_WIDTH;
04554
04555 //color of the bar
04556 aColor[0] = 0.0f;
04557 aColor[1] = 1.0f;
04558 aColor[2] = 0.0f;
04559 aColor[3] = 0.4f;
04560
04561 //color of the border
04562 bColor[0] = 0.0f;
04563 bColor[1] = 0.0f;
04564 bColor[2] = 0.0f;
04565 bColor[3] = 0.3f;
04566
04567 //color of greyed out "missing health"
04568 cColor[0] = 0.5f;
04569 cColor[1] = 0.5f;
04570 cColor[2] = 0.5f;
04571 cColor[3] = 0.4f;
04572
04573 //draw the background (black)
04574 CG_DrawRect(x, y, HEALTH_WIDTH, HEALTH_HEIGHT, 1.0f, colorTable[CT_BLACK]);
04575
04576 //now draw the part to show how much health there is in the color specified
04577 CG_FillRect(x+1.0f, y+1.0f, percent-1.0f, HEALTH_HEIGHT-1.0f, aColor);
04578
04579 //then draw the other part greyed out
04580 CG_FillRect(x+percent, y+1.0f, HEALTH_WIDTH-percent-1.0f, HEALTH_HEIGHT-1.0f, cColor);
04581
04582
04583 //now draw his ammo
04584 ammoMax = ammoData[weaponData[cent->currentState.weapon].ammoIndex].max;
04585 if ( (cent->currentState.eFlags & EF_DOUBLE_AMMO) )
04586 {
04587 ammoMax *= 2;
04588 }
04589
04590 x = chX+((chW/2)-(HEALTH_WIDTH/2));
04591 y = (chY+chH) + HEALTH_HEIGHT + 10.0f;
04592
04593 if (!weaponData[cent->currentState.weapon].energyPerShot &&
04594 !weaponData[cent->currentState.weapon].altEnergyPerShot)
04595 { //a weapon that takes no ammo, so show full
04596 percent = HEALTH_WIDTH;
04597 }
04598 else
04599 {
04600 percent = ((float)se->ammo/(float)ammoMax)*HEALTH_WIDTH;
04601 }
04602
04603 //color of the bar
04604 aColor[0] = 1.0f;
04605 aColor[1] = 1.0f;
04606 aColor[2] = 0.0f;
04607 aColor[3] = 0.4f;
04608
04609 //color of the border
04610 bColor[0] = 0.0f;
04611 bColor[1] = 0.0f;
04612 bColor[2] = 0.0f;
04613 bColor[3] = 0.3f;
04614
04615 //color of greyed out "missing health"
04616 cColor[0] = 0.5f;
04617 cColor[1] = 0.5f;
04618 cColor[2] = 0.5f;
04619 cColor[3] = 0.4f;
04620
04621 //draw the background (black)
04622 CG_DrawRect(x, y, HEALTH_WIDTH, HEALTH_HEIGHT, 1.0f, colorTable[CT_BLACK]);
04623
04624 //now draw the part to show how much health there is in the color specified
04625 CG_FillRect(x+1.0f, y+1.0f, percent-1.0f, HEALTH_HEIGHT-1.0f, aColor);
04626
04627 //then draw the other part greyed out
04628 CG_FillRect(x+percent, y+1.0f, HEALTH_WIDTH-percent-1.0f, HEALTH_HEIGHT-1.0f, cColor);
04629 }
|
|
||||||||||||
|
Definition at line 4353 of file cg_draw.c. References trap_Cvar_Set(), trap_OpenUIMenu(), UIMENU_CLOSEALL, UIMENU_SIEGEMESSAGE, and UIMENU_SIEGEOBJECTIVES. Referenced by CG_SiegeBriefingDisplay(), and CG_SiegeRoundOver().
04354 {
04355 // if (!( trap_Key_GetCatcher() & KEYCATCH_UI ))
04356 {
04357 trap_OpenUIMenu(UIMENU_CLOSEALL);
04358 trap_Cvar_Set("cg_siegeMessage", str);
04359 if (objectiveScreen)
04360 {
04361 trap_OpenUIMenu(UIMENU_SIEGEOBJECTIVES);
04362 }
04363 else
04364 {
04365 trap_OpenUIMenu(UIMENU_SIEGEMESSAGE);
04366 }
04367 }
04368 }
|
|
|
Definition at line 4370 of file cg_draw.c. References BIGCHAR_WIDTH, CG_CenterPrint(), SCREEN_HEIGHT, and trap_SP_GetStringTextString(). Referenced by CG_SiegeObjectiveCompleted().
04371 {
04372 char text[1024];
04373 if (str[0]=='@')
04374 {
04375 trap_SP_GetStringTextString(str+1, text, sizeof(text));
04376 str = text;
04377 }
04378 CG_CenterPrint(str, SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH);
04379 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 2776 of file cg_draw.c. References CG_FillRect(), NULL, TEAM_BLUE, TEAM_RED, trap_R_SetColor(), and vec4_t. Referenced by CG_DrawOldScoreboard().
02777 {
02778 vec4_t hcolor;
02779
02780 hcolor[3] = alpha;
02781 if ( team == TEAM_RED ) {
02782 hcolor[0] = 1;
02783 hcolor[1] = .2f;
02784 hcolor[2] = .2f;
02785 } else if ( team == TEAM_BLUE ) {
02786 hcolor[0] = .2f;
02787 hcolor[1] = .2f;
02788 hcolor[2] = 1;
02789 } else {
02790 return;
02791 }
02792 // trap_R_SetColor( hcolor );
02793
02794 CG_FillRect ( x, y, w, h, hcolor );
02795 // CG_DrawPic( x, y, w, h, cgs.media.teamStatusBar );
02796 trap_R_SetColor( NULL );
02797 }
|
|
|
Definition at line 7056 of file cg_draw.c. References cg, Menus_CloseByName(), cg_t::time, trap_Cvar_Set(), and cg_t::voiceTime.
07056 {
07057 if (cg.voiceTime) {
07058 int t = cg.time - cg.voiceTime;
07059 if ( t > 2500 ) {
07060 Menus_CloseByName("voiceMenu");
07061 trap_Cvar_Set("cl_conXOffset", "0");
07062 cg.voiceTime = 0;
07063 }
07064 }
07065 }
|
|
||||||||||||
|
Definition at line 1942 of file cg_draw.c. References playerState_s::ammo, vehWeaponStats_t::ammoMax, windowDef_t::background, centity_t, cg, CG_DrawPic(), cg_vehicleAmmoWarning, cg_vehicleAmmoWarningTime, COLOR_RED, ColorIndex, windowDef_t::foreColor, g_color_table, rectDef_t::h, itemDef_t, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, MAX_VHUD_AMMO_TICS, memcpy(), Menu_FindItemByName(), cg_t::predictedVehicleState, windowDef_t::rect, sin(), cg_t::time, trap_R_SetColor(), vec4_t, rectDef_t::w, vehicleInfo_t::weapon, itemDef_s::window, rectDef_t::x, and rectDef_t::y. Referenced by CG_DrawVehicleHud().
01943 {
01944 int i;
01945 char itemName[64];
01946 float inc, currValue,maxAmmo;
01947 vec4_t calcColor;
01948 itemDef_t *item;
01949
01950 item = Menu_FindItemByName((menuDef_t *) menuHUD, "ammobackground");
01951
01952 if (item)
01953 {
01954 trap_R_SetColor( item->window.foreColor );
01955 CG_DrawPic(
01956 item->window.rect.x,
01957 item->window.rect.y,
01958 item->window.rect.w,
01959 item->window.rect.h,
01960 item->window.background );
01961 }
01962
01963 maxAmmo = veh->m_pVehicle->m_pVehicleInfo->weapon[0].ammoMax;
01964 currValue = cg.predictedVehicleState.ammo[0];
01965
01966 inc = (float) maxAmmo / MAX_VHUD_AMMO_TICS;
01967 for (i=1;i<=MAX_VHUD_AMMO_TICS;i++)
01968 {
01969 sprintf( itemName, "ammo_tic%d", i );
01970
01971 item = Menu_FindItemByName((menuDef_t *)menuHUD, itemName);
01972
01973 if (!item)
01974 {
01975 continue;
01976 }
01977
01978 if ( cg_vehicleAmmoWarningTime > cg.time
01979 && cg_vehicleAmmoWarning == 0 )
01980 {
01981 memcpy(calcColor, g_color_table[ColorIndex(COLOR_RED)], sizeof(vec4_t));
01982 calcColor[3] = sin(cg.time*0.005)*0.5f+0.5f;
01983 }
01984 else
01985 {
01986 memcpy(calcColor, item->window.foreColor, sizeof(vec4_t));
01987
01988 if (currValue <= 0) // don't show tic
01989 {
01990 break;
01991 }
01992 else if (currValue < inc) // partial tic (alpha it out)
01993 {
01994 float percent = currValue / inc;
01995 calcColor[3] *= percent; // Fade it out
01996 }
01997 }
01998
01999 trap_R_SetColor( calcColor);
02000
02001 CG_DrawPic(
02002 item->window.rect.x,
02003 item->window.rect.y,
02004 item->window.rect.w,
02005 item->window.rect.h,
02006 item->window.background );
02007
02008 currValue -= inc;
02009 }
02010 }
|
|
||||||||||||
|
Definition at line 2084 of file cg_draw.c. References playerState_s::ammo, vehWeaponStats_t::ammoMax, windowDef_t::background, centity_t, cg, CG_DrawPic(), cg_vehicleAmmoWarning, cg_vehicleAmmoWarningTime, COLOR_RED, ColorIndex, windowDef_t::foreColor, g_color_table, rectDef_t::h, itemDef_t, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, MAX_VHUD_AMMO_TICS, memcpy(), Menu_FindItemByName(), cg_t::predictedVehicleState, windowDef_t::rect, sin(), cg_t::time, trap_R_SetColor(), vec4_t, rectDef_t::w, vehicleInfo_t::weapon, itemDef_s::window, rectDef_t::x, and rectDef_t::y. Referenced by CG_DrawVehicleHud().
02085 {
02086 int i;
02087 char itemName[64];
02088 float inc, currValue,maxAmmo;
02089 vec4_t calcColor;
02090 itemDef_t *item;
02091
02092
02093 item = Menu_FindItemByName((menuDef_t *)menuHUD, "ammolowerbackground");
02094
02095 if (item)
02096 {
02097 trap_R_SetColor( item->window.foreColor );
02098 CG_DrawPic(
02099 item->window.rect.x,
02100 item->window.rect.y,
02101 item->window.rect.w,
02102 item->window.rect.h,
02103 item->window.background );
02104 }
02105
02106 maxAmmo = veh->m_pVehicle->m_pVehicleInfo->weapon[1].ammoMax;
02107 currValue = cg.predictedVehicleState.ammo[1];
02108
02109 inc = (float) maxAmmo / MAX_VHUD_AMMO_TICS;
02110 for (i=1;i<MAX_VHUD_AMMO_TICS;i++)
02111 {
02112 sprintf( itemName, "ammolower_tic%d", i );
02113
02114 item = Menu_FindItemByName((menuDef_t *)menuHUD, itemName);
02115
02116 if (!item)
02117 {
02118 continue;
02119 }
02120
02121 if ( cg_vehicleAmmoWarningTime > cg.time
02122 && cg_vehicleAmmoWarning == 1 )
02123 {
02124 memcpy(calcColor, g_color_table[ColorIndex(COLOR_RED)], sizeof(vec4_t));
02125 calcColor[3] = sin(cg.time*0.005)*0.5f+0.5f;
02126 }
02127 else
02128 {
02129 memcpy(calcColor, item->window.foreColor, sizeof(vec4_t));
02130
02131 if (currValue <= 0) // don't show tic
02132 {
02133 break;
02134 }
02135 else if (currValue < inc) // partial tic (alpha it out)
02136 {
02137 float percent = currValue / inc;
02138 calcColor[3] *= percent; // Fade it out
02139 }
02140 }
02141
02142 trap_R_SetColor( calcColor);
02143
02144 CG_DrawPic(
02145 item->window.rect.x,
02146 item->window.rect.y,
02147 item->window.rect.w,
02148 item->window.rect.h,
02149 item->window.background );
02150
02151 currValue -= inc;
02152 }
02153 }
|
|
||||||||||||
|
Definition at line 2013 of file cg_draw.c. References playerState_s::ammo, vehWeaponStats_t::ammoMax, windowDef_t::background, centity_t, cg, CG_DrawPic(), cg_vehicleAmmoWarning, cg_vehicleAmmoWarningTime, COLOR_RED, ColorIndex, windowDef_t::foreColor, g_color_table, rectDef_t::h, itemDef_t, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, MAX_VHUD_AMMO_TICS, memcpy(), Menu_FindItemByName(), cg_t::predictedVehicleState, windowDef_t::rect, sin(), cg_t::time, trap_R_SetColor(), vec4_t, rectDef_t::w, vehicleInfo_t::weapon, itemDef_s::window, rectDef_t::x, and rectDef_t::y. Referenced by CG_DrawVehicleHud().
02014 {
02015 int i;
02016 char itemName[64];
02017 float inc, currValue,maxAmmo;
02018 vec4_t calcColor;
02019 itemDef_t *item;
02020
02021 item = Menu_FindItemByName((menuDef_t *)menuHUD, "ammoupperbackground");
02022
02023 if (item)
02024 {
02025 trap_R_SetColor( item->window.foreColor );
02026 CG_DrawPic(
02027 item->window.rect.x,
02028 item->window.rect.y,
02029 item->window.rect.w,
02030 item->window.rect.h,
02031 item->window.background );
02032 }
02033
02034 maxAmmo = veh->m_pVehicle->m_pVehicleInfo->weapon[0].ammoMax;
02035 currValue = cg.predictedVehicleState.ammo[0];
02036
02037 inc = (float) maxAmmo / MAX_VHUD_AMMO_TICS;
02038 for (i=1;i<MAX_VHUD_AMMO_TICS;i++)
02039 {
02040 sprintf( itemName, "ammoupper_tic%d", i );
02041
02042 item = Menu_FindItemByName((menuDef_t *)menuHUD, itemName);
02043
02044 if (!item)
02045 {
02046 continue;
02047 }
02048
02049 if ( cg_vehicleAmmoWarningTime > cg.time
02050 && cg_vehicleAmmoWarning == 0 )
02051 {
02052 memcpy(calcColor, g_color_table[ColorIndex(COLOR_RED)], sizeof(vec4_t));
02053 calcColor[3] = sin(cg.time*0.005)*0.5f+0.5f;
02054 }
02055 else
02056 {
02057 memcpy(calcColor, item->window.foreColor, sizeof(vec4_t));
02058
02059 if (currValue <= 0) // don't show tic
02060 {
02061 break;
02062 }
02063 else if (currValue < inc) // partial tic (alpha it out)
02064 {
02065 float percent = currValue / inc;
02066 calcColor[3] *= percent; // Fade it out
02067 }
02068 }
02069
02070 trap_R_SetColor( calcColor);
02071
02072 CG_DrawPic(
02073 item->window.rect.x,
02074 item->window.rect.y,
02075 item->window.rect.w,
02076 item->window.rect.h,
02077 item->window.background );
02078
02079 currValue -= inc;
02080 }
02081 }
|
|
||||||||||||
|
Definition at line 2344 of file cg_draw.c. References vehicleInfo_t::armor, windowDef_t::background, centity_t, cg, CG_DrawPic(), windowDef_t::foreColor, rectDef_t::h, itemDef_t, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, MAX_VHUD_SHIELD_TICS, memcpy(), Menu_FindItemByName(), cg_t::predictedVehicleState, windowDef_t::rect, STAT_HEALTH, playerState_s::stats, trap_R_SetColor(), vec4_t, rectDef_t::w, itemDef_s::window, rectDef_t::x, and rectDef_t::y. Referenced by CG_DrawVehicleHud().
02345 {
02346 int i;
02347 vec4_t calcColor;
02348 char itemName[64];
02349 float inc, currValue,maxArmor;
02350 itemDef_t *item;
02351
02352 maxArmor = veh->m_pVehicle->m_pVehicleInfo->armor;
02353 currValue = cg.predictedVehicleState.stats[STAT_HEALTH];
02354
02355 item = Menu_FindItemByName( (menuDef_t *) menuHUD, "shieldbackground");
02356
02357 if (item)
02358 {
02359 trap_R_SetColor( item->window.foreColor );
02360 CG_DrawPic(
02361 item->window.rect.x,
02362 item->window.rect.y,
02363 item->window.rect.w,
02364 item->window.rect.h,
02365 item->window.background );
02366 }
02367
02368
02369 // Print all the tics of the shield graphic
02370 // Look at the amount of health left and show only as much of the graphic as there is health.
02371 // Use alpha to fade out partial section of health
02372 inc = (float) maxArmor / MAX_VHUD_SHIELD_TICS;
02373 for (i=1;i <= MAX_VHUD_SHIELD_TICS;i++)
02374 {
02375 sprintf( itemName, "shield_tic%d", i );
02376
02377 item = Menu_FindItemByName((menuDef_t *) menuHUD, itemName);
02378
02379 if (!item)
02380 {
02381 continue;
02382 }
02383
02384
02385 memcpy(calcColor, item->window.foreColor, sizeof(vec4_t));
02386
02387 if (currValue <= 0) // don't show tic
02388 {
02389 break;
02390 }
02391 else if (currValue < inc) // partial tic (alpha it out)
02392 {
02393 float percent = currValue / inc;
02394 calcColor[3] *= percent; // Fade it out
02395 }
02396
02397 trap_R_SetColor( calcColor);
02398
02399 CG_DrawPic(
02400 item->window.rect.x,
02401 item->window.rect.y,
02402 item->window.rect.w,
02403 item->window.rect.h,
02404 item->window.background );
02405
02406 currValue -= inc;
02407 }
02408 }
|
|
||||||||||||||||||||||||
|
Definition at line 2434 of file cg_draw.c. References centity_t, CG_DrawPic(), colorTable, CT_DKGREY, CT_GREEN, CT_RED, CT_YELLOW, rectDef_t::h, veh_damage_t::heavyDamage, vehicleInfo_t::iconBackHandle, vehicleInfo_t::iconFrontHandle, vehicleInfo_t::iconLeftHandle, vehicleInfo_t::iconRightHandle, itemDef_t, veh_damage_t::lightDamage, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, Menu_FindItemByName(), windowDef_t::rect, trap_R_SetColor(), vec4_t, VectorCopy4, VEH_DAMAGE_BACK, VEH_DAMAGE_FRONT, VEH_DAMAGE_LEFT, VEH_DAMAGE_RIGHT, vehDamageData, rectDef_t::w, itemDef_s::window, rectDef_t::x, and rectDef_t::y. Referenced by CG_DrawVehicleDamageHUD().
02435 {
02436 itemDef_t *item;
02437 int colorI;
02438 vec4_t color;
02439 int graphicHandle=0;
02440
02441 item = Menu_FindItemByName((menuDef_t *)menuHUD, vehDamageData[index].itemName);
02442 if (item)
02443 {
02444 if (brokenLimbs & (1<<vehDamageData[index].heavyDamage))
02445 {
02446 colorI = CT_RED;
02447 if (brokenLimbs & (1<<vehDamageData[index].lightDamage))
02448 {
02449 colorI = CT_DKGREY;
02450 }
02451 }
02452 else if (brokenLimbs & (1<<vehDamageData[index].lightDamage))
02453 {
02454 colorI = CT_YELLOW;
02455 }
02456 else
02457 {
02458 colorI = CT_GREEN;
02459 }
02460
02461 VectorCopy4 ( colorTable[colorI], color );
02462 color[3] = alpha;
02463 trap_R_SetColor( color );
02464
02465 switch ( index )
02466 {
02467 case VEH_DAMAGE_FRONT :
02468 graphicHandle = veh->m_pVehicle->m_pVehicleInfo->iconFrontHandle;
02469 break;
02470 case VEH_DAMAGE_BACK :
02471 graphicHandle = veh->m_pVehicle->m_pVehicleInfo->iconBackHandle;
02472 break;
02473 case VEH_DAMAGE_LEFT :
02474 graphicHandle = veh->m_pVehicle->m_pVehicleInfo->iconLeftHandle;
02475 break;
02476 case VEH_DAMAGE_RIGHT :
02477 graphicHandle = veh->m_pVehicle->m_pVehicleInfo->iconRightHandle;
02478 break;
02479 }
02480
02481 if (graphicHandle)
02482 {
02483 CG_DrawPic(
02484 item->window.rect.x,
02485 item->window.rect.y,
02486 item->window.rect.w,
02487 item->window.rect.h,
02488 graphicHandle );
02489 }
02490 }
02491 }
|
|
||||||||||||||||||||||||
|
Definition at line 2495 of file cg_draw.c. References centity_t, cg, CG_DrawPic(), CG_DrawVehicleDamage(), colorTable, CT_HUD_GREEN, |