#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, |