1.29h source port files
cgame module
This commit is contained in:
Victor Chow 2001-08-01 20:03:09 +00:00
parent 3f461d7e4d
commit ac95113242
5 changed files with 108 additions and 62 deletions

View file

@ -603,6 +603,12 @@ CG_StartOrbit_f
*/ */
static void CG_StartOrbit_f( void ) { static void CG_StartOrbit_f( void ) {
char var[MAX_TOKEN_CHARS];
trap_Cvar_VariableStringBuffer( "developer", var, sizeof( var ) );
if ( !atoi(var) ) {
return;
}
if (cg_cameraOrbit.value != 0) { if (cg_cameraOrbit.value != 0) {
trap_Cvar_Set ("cg_cameraOrbit", "0"); trap_Cvar_Set ("cg_cameraOrbit", "0");
trap_Cvar_Set("cg_thirdPerson", "0"); trap_Cvar_Set("cg_thirdPerson", "0");
@ -614,6 +620,18 @@ static void CG_StartOrbit_f( void ) {
} }
} }
/*
static void CG_Camera_f( void ) {
char name[1024];
trap_Argv( 1, name, sizeof(name));
if (trap_loadCamera(name)) {
cg.cameraMode = qtrue;
trap_startCamera(cg.time);
} else {
CG_Printf ("Unable to load camera %s\n",name);
}
}
*/
/* /*
================== ==================
@ -741,9 +759,11 @@ static consoleCommand_t commands[] = {
{ "scoresUp", CG_scrollScoresUp_f }, { "scoresUp", CG_scrollScoresUp_f },
#endif #endif
{ "startOrbit", CG_StartOrbit_f }, { "startOrbit", CG_StartOrbit_f },
{ "loaddeferred", CG_LoadDeferredPlayers }, //{ "camera", CG_Camera_f },
{ "loaddeferred", CG_LoadDeferredPlayers }
}; };
/* /*
================= =================
CG_ConsoleCommand CG_ConsoleCommand

View file

@ -29,6 +29,8 @@ int CG_Text_Width(const char *text, float scale, int limit) {
float out; float out;
glyphInfo_t *glyph; glyphInfo_t *glyph;
float useScale; float useScale;
// FIXME: see ui_main.c, same problem
// const unsigned char *s = text;
const char *s = text; const char *s = text;
fontInfo_t *font = &cgDC.Assets.textFont; fontInfo_t *font = &cgDC.Assets.textFont;
if (scale <= cg_smallFont.value) { if (scale <= cg_smallFont.value) {
@ -49,7 +51,7 @@ int CG_Text_Width(const char *text, float scale, int limit) {
s += 2; s += 2;
continue; continue;
} else { } else {
glyph = &font->glyphs[*s]; glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
out += glyph->xSkip; out += glyph->xSkip;
s++; s++;
count++; count++;
@ -64,6 +66,8 @@ int CG_Text_Height(const char *text, float scale, int limit) {
float max; float max;
glyphInfo_t *glyph; glyphInfo_t *glyph;
float useScale; float useScale;
// TTimo: FIXME
// const unsigned char *s = text;
const char *s = text; const char *s = text;
fontInfo_t *font = &cgDC.Assets.textFont; fontInfo_t *font = &cgDC.Assets.textFont;
if (scale <= cg_smallFont.value) { if (scale <= cg_smallFont.value) {
@ -84,7 +88,7 @@ int CG_Text_Height(const char *text, float scale, int limit) {
s += 2; s += 2;
continue; continue;
} else { } else {
glyph = &font->glyphs[*s]; glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
if (max < glyph->height) { if (max < glyph->height) {
max = glyph->height; max = glyph->height;
} }
@ -117,6 +121,8 @@ void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text
} }
useScale = scale * font->glyphScale; useScale = scale * font->glyphScale;
if (text) { if (text) {
// TTimo: FIXME
// const unsigned char *s = text;
const char *s = text; const char *s = text;
trap_R_SetColor( color ); trap_R_SetColor( color );
memcpy(&newColor[0], &color[0], sizeof(vec4_t)); memcpy(&newColor[0], &color[0], sizeof(vec4_t));
@ -126,7 +132,7 @@ void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text
} }
count = 0; count = 0;
while (s && *s && count < len) { while (s && *s && count < len) {
glyph = &font->glyphs[*s]; glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
//int yadj = Assets.textFont.glyphs[text[i]].bottom + Assets.textFont.glyphs[text[i]].top; //int yadj = Assets.textFont.glyphs[text[i]].bottom + Assets.textFont.glyphs[text[i]].top;
//float yadj = scale * (Assets.textFont.glyphs[text[i]].imageHeight - Assets.textFont.glyphs[text[i]].height); //float yadj = scale * (Assets.textFont.glyphs[text[i]].imageHeight - Assets.textFont.glyphs[text[i]].height);
if ( Q_IsColorString( s ) ) { if ( Q_IsColorString( s ) ) {
@ -236,7 +242,7 @@ static void CG_DrawField (int x, int y, int width, int value) {
l--; l--;
} }
} }
#endif #endif // MISSIONPACK
/* /*
================ ================
@ -448,7 +454,7 @@ static void CG_DrawStatusBarHead( float x ) {
CG_DrawHead( x, 480 - size, size, size, CG_DrawHead( x, 480 - size, size, size,
cg.snap->ps.clientNum, angles ); cg.snap->ps.clientNum, angles );
} }
#endif #endif // MISSIONPACK
/* /*
================ ================
@ -460,7 +466,7 @@ CG_DrawStatusBarFlag
static void CG_DrawStatusBarFlag( float x, int team ) { static void CG_DrawStatusBarFlag( float x, int team ) {
CG_DrawFlagModel( x, 480 - ICON_SIZE, ICON_SIZE, ICON_SIZE, team, qfalse ); CG_DrawFlagModel( x, 480 - ICON_SIZE, ICON_SIZE, ICON_SIZE, team, qfalse );
} }
#endif #endif // MISSIONPACK
/* /*
================ ================
@ -1030,14 +1036,14 @@ static float CG_DrawTeamOverlay( float y, qboolean right, qboolean upper ) {
} }
if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED ) { if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED ) {
hcolor[0] = 1; hcolor[0] = 1.0f;
hcolor[1] = 0; hcolor[1] = 0.0f;
hcolor[2] = 0; hcolor[2] = 0.0f;
hcolor[3] = 0.33f; hcolor[3] = 0.33f;
} else { // if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE ) } else { // if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE )
hcolor[0] = 0; hcolor[0] = 0.0f;
hcolor[1] = 0; hcolor[1] = 0.0f;
hcolor[2] = 1; hcolor[2] = 1.0f;
hcolor[3] = 0.33f; hcolor[3] = 0.33f;
} }
trap_R_SetColor( hcolor ); trap_R_SetColor( hcolor );
@ -1190,10 +1196,9 @@ static float CG_DrawScores( float y ) {
// draw from the right side to left // draw from the right side to left
if ( cgs.gametype >= GT_TEAM ) { if ( cgs.gametype >= GT_TEAM ) {
x = 640; x = 640;
color[0] = 0.0f;
color[0] = 0; color[1] = 0.0f;
color[1] = 0; color[2] = 1.0f;
color[2] = 1;
color[3] = 0.33f; color[3] = 0.33f;
s = va( "%2i", s2 ); s = va( "%2i", s2 );
w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH + 8; w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH + 8;
@ -1215,10 +1220,9 @@ static float CG_DrawScores( float y ) {
} }
} }
} }
color[0] = 1.0f;
color[0] = 1; color[1] = 0.0f;
color[1] = 0; color[2] = 0.0f;
color[2] = 0;
color[3] = 0.33f; color[3] = 0.33f;
s = va( "%2i", s1 ); s = va( "%2i", s1 );
w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH + 8; w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH + 8;
@ -1282,9 +1286,9 @@ static float CG_DrawScores( float y ) {
w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH + 8; w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH + 8;
x -= w; x -= w;
if ( !spectator && score == s2 && score != s1 ) { if ( !spectator && score == s2 && score != s1 ) {
color[0] = 1; color[0] = 1.0f;
color[1] = 0; color[1] = 0.0f;
color[2] = 0; color[2] = 0.0f;
color[3] = 0.33f; color[3] = 0.33f;
CG_FillRect( x, y-4, w, BIGCHAR_HEIGHT+8, color ); CG_FillRect( x, y-4, w, BIGCHAR_HEIGHT+8, color );
CG_DrawPic( x, y-4, w, BIGCHAR_HEIGHT+8, cgs.media.selectShader ); CG_DrawPic( x, y-4, w, BIGCHAR_HEIGHT+8, cgs.media.selectShader );
@ -1304,9 +1308,9 @@ static float CG_DrawScores( float y ) {
w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH + 8; w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH + 8;
x -= w; x -= w;
if ( !spectator && score == s1 ) { if ( !spectator && score == s1 ) {
color[0] = 0; color[0] = 0.0f;
color[1] = 0; color[1] = 0.0f;
color[2] = 1; color[2] = 1.0f;
color[3] = 0.33f; color[3] = 0.33f;
CG_FillRect( x, y-4, w, BIGCHAR_HEIGHT+8, color ); CG_FillRect( x, y-4, w, BIGCHAR_HEIGHT+8, color );
CG_DrawPic( x, y-4, w, BIGCHAR_HEIGHT+8, cgs.media.selectShader ); CG_DrawPic( x, y-4, w, BIGCHAR_HEIGHT+8, cgs.media.selectShader );
@ -1331,7 +1335,7 @@ static float CG_DrawScores( float y ) {
return y1 - 8; return y1 - 8;
} }
#endif #endif // MISSIONPACK
/* /*
================ ================
@ -1352,7 +1356,9 @@ static float CG_DrawPowerups( float y ) {
float size; float size;
float f; float f;
static float colors[2][4] = { static float colors[2][4] = {
{ 0.2f, 1.0f, 0.2f, 1.0f } , { 1.0f, 0.2f, 0.2f, 1.0f } }; { 0.2f, 1.0f, 0.2f, 1.0f } ,
{ 1.0f, 0.2f, 0.2f, 1.0f }
};
ps = &cg.snap->ps; ps = &cg.snap->ps;
@ -1430,7 +1436,7 @@ static float CG_DrawPowerups( float y ) {
return y; return y;
} }
#endif #endif // MISSIONPACK
/* /*
===================== =====================
@ -1452,7 +1458,7 @@ static void CG_DrawLowerRight( void ) {
y = CG_DrawScores( y ); y = CG_DrawScores( y );
y = CG_DrawPowerups( y ); y = CG_DrawPowerups( y );
} }
#endif #endif // MISSIONPACK
/* /*
=================== ===================
@ -1484,7 +1490,7 @@ static int CG_DrawPickupItem( int y ) {
return y; return y;
} }
#endif #endif // MISSIONPACK
/* /*
===================== =====================
@ -1505,7 +1511,7 @@ static void CG_DrawLowerLeft( void ) {
y = CG_DrawPickupItem( y ); y = CG_DrawPickupItem( y );
} }
#endif #endif // MISSIONPACK
//=========================================================================================== //===========================================================================================
@ -1550,19 +1556,19 @@ static void CG_DrawTeamInfo( void ) {
w += TINYCHAR_WIDTH * 2; w += TINYCHAR_WIDTH * 2;
if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED ) { if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED ) {
hcolor[0] = 1; hcolor[0] = 1.0f;
hcolor[1] = 0; hcolor[1] = 0.0f;
hcolor[2] = 0; hcolor[2] = 0.0f;
hcolor[3] = 0.33f; hcolor[3] = 0.33f;
} else if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE ) { } else if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE ) {
hcolor[0] = 0; hcolor[0] = 0.0f;
hcolor[1] = 0; hcolor[1] = 0.0f;
hcolor[2] = 1; hcolor[2] = 1.0f;
hcolor[3] = 0.33f; hcolor[3] = 0.33f;
} else { } else {
hcolor[0] = 0; hcolor[0] = 0.0f;
hcolor[1] = 1; hcolor[1] = 1.0f;
hcolor[2] = 0; hcolor[2] = 0.0f;
hcolor[3] = 0.33f; hcolor[3] = 0.33f;
} }
@ -1570,8 +1576,8 @@ static void CG_DrawTeamInfo( void ) {
CG_DrawPic( CHATLOC_X, CHATLOC_Y - h, 640, h, cgs.media.teamStatusBar ); CG_DrawPic( CHATLOC_X, CHATLOC_Y - h, 640, h, cgs.media.teamStatusBar );
trap_R_SetColor( NULL ); trap_R_SetColor( NULL );
hcolor[0] = hcolor[1] = hcolor[2] = 1.0; hcolor[0] = hcolor[1] = hcolor[2] = 1.0f;
hcolor[3] = 1.0; hcolor[3] = 1.0f;
for (i = cgs.teamChatPos - 1; i >= cgs.teamLastChatPos; i--) { for (i = cgs.teamChatPos - 1; i >= cgs.teamLastChatPos; i--) {
CG_DrawStringExt( CHATLOC_X + TINYCHAR_WIDTH, CG_DrawStringExt( CHATLOC_X + TINYCHAR_WIDTH,
@ -1581,7 +1587,7 @@ static void CG_DrawTeamInfo( void ) {
} }
} }
} }
#endif #endif // MISSIONPACK
/* /*
=================== ===================
@ -1600,7 +1606,7 @@ static void CG_DrawHoldableItem( void ) {
} }
} }
#endif #endif // MISSIONPACK
#ifdef MISSIONPACK #ifdef MISSIONPACK
/* /*
@ -1608,7 +1614,7 @@ static void CG_DrawHoldableItem( void ) {
CG_DrawPersistantPowerup CG_DrawPersistantPowerup
=================== ===================
*/ */
/* #if 0 // sos001208 - DEAD
static void CG_DrawPersistantPowerup( void ) { static void CG_DrawPersistantPowerup( void ) {
int value; int value;
@ -1618,9 +1624,8 @@ static void CG_DrawPersistantPowerup( void ) {
CG_DrawPic( 640-ICON_SIZE, (SCREEN_HEIGHT-ICON_SIZE)/2 - ICON_SIZE, ICON_SIZE, ICON_SIZE, cg_items[ value ].icon ); CG_DrawPic( 640-ICON_SIZE, (SCREEN_HEIGHT-ICON_SIZE)/2 - ICON_SIZE, ICON_SIZE, ICON_SIZE, cg_items[ value ].icon );
} }
} }
*/
#endif #endif
#endif // MISSIONPACK
/* /*
@ -1768,18 +1773,18 @@ static void CG_DrawDisconnect( void ) {
int cmdNum; int cmdNum;
usercmd_t cmd; usercmd_t cmd;
const char *s; const char *s;
int w; int w; // bk010215 - FIXME char message[1024];
// draw the phone jack if we are completely past our buffers // draw the phone jack if we are completely past our buffers
cmdNum = trap_GetCurrentCmdNumber() - CMD_BACKUP + 1; cmdNum = trap_GetCurrentCmdNumber() - CMD_BACKUP + 1;
trap_GetUserCmd( cmdNum, &cmd ); trap_GetUserCmd( cmdNum, &cmd );
if ( cmd.serverTime <= cg.snap->ps.commandTime if ( cmd.serverTime <= cg.snap->ps.commandTime
|| cmd.serverTime > cg.time ) { // special check for map_restart || cmd.serverTime > cg.time ) { // special check for map_restart // bk 0102165 - FIXME
return; return;
} }
// also add text in center of screen // also add text in center of screen
s = "Connection Interrupted"; s = "Connection Interrupted"; // bk 010215 - FIXME
w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
CG_DrawBigString( 320 - w/2, 100, s, 1.0F); CG_DrawBigString( 320 - w/2, 100, s, 1.0F);
@ -1957,7 +1962,10 @@ CG_DrawCenterString
static void CG_DrawCenterString( void ) { static void CG_DrawCenterString( void ) {
char *start; char *start;
int l; int l;
int x, y, w;//Blaze: removed a ,h here int x, y, w;
#ifdef MISSIONPACK // bk010221 - unused else
int h;
#endif
float *color; float *color;
if ( !cg.centerPrintTime ) { if ( !cg.centerPrintTime ) {
@ -2207,7 +2215,7 @@ static void CG_DrawCrosshairNames( void ) {
name = cgs.clientinfo[ cg.crosshairClientNum ].name; name = cgs.clientinfo[ cg.crosshairClientNum ].name;
#ifdef MISSIONPACK #ifdef MISSIONPACK
color[3] *= 0.5; color[3] *= 0.5f;
w = CG_Text_Width(name, 0.3f, 0); w = CG_Text_Width(name, 0.3f, 0);
CG_Text_Paint( 320 - w / 2, 190, 0.3f, color, name, 0, 0, ITEM_TEXTSTYLE_SHADOWED); CG_Text_Paint( 320 - w / 2, 190, 0.3f, color, name, 0, 0, ITEM_TEXTSTYLE_SHADOWED);
#else #else
@ -2583,7 +2591,7 @@ static void CG_DrawWarmup( void ) {
cw = GIANT_WIDTH; cw = GIANT_WIDTH;
} }
CG_DrawStringExt( 320 - w * cw/2, 25,s, colorWhite, CG_DrawStringExt( 320 - w * cw/2, 25,s, colorWhite,
qfalse, qtrue, cw, (int)(cw * 1.1), 0 ); qfalse, qtrue, cw, (int)(cw * 1.1f), 0 );
#endif #endif
} }
@ -2682,6 +2690,11 @@ static void CG_Draw2D( void ) {
return; return;
} }
/*
if (cg.cameraMode) {
return;
}
*/
if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ) { if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ) {
CG_DrawSpectator(); CG_DrawSpectator();
CG_DrawCrosshair(); CG_DrawCrosshair();

View file

@ -413,6 +413,10 @@ void CG_ColorForHealth( vec4_t hcolor ) {
// bk001205 - code below duplicated in q3_ui/ui-atoms.c
// bk001205 - FIXME: does this belong in ui_shared.c?
// bk001205 - FIXME: HARD_LINKED flags not visible here
#ifndef Q3_STATIC // bk001205 - q_shared defines not visible here
/* /*
================= =================
UI_DrawProportionalString2 UI_DrawProportionalString2
@ -682,7 +686,7 @@ UI_DrawBannerString
static void UI_DrawBannerString2( int x, int y, const char* str, vec4_t color ) static void UI_DrawBannerString2( int x, int y, const char* str, vec4_t color )
{ {
const char* s; const char* s;
char ch; unsigned char ch; // bk001204 : array subscript
float ax; float ax;
float ay; float ay;
float aw; float aw;
@ -792,7 +796,7 @@ int UI_ProportionalStringWidth( const char* str ) {
static void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t color, float sizeScale, qhandle_t charset ) static void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t color, float sizeScale, qhandle_t charset )
{ {
const char* s; const char* s;
char ch; unsigned char ch; // bk001204 - unsigned
float ax; float ax;
float ay; float ay;
float aw; float aw;
@ -907,4 +911,4 @@ void UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t
UI_DrawProportionalString2( x, y, str, color, sizeScale, cgs.media.charsetProp ); UI_DrawProportionalString2( x, y, str, color, sizeScale, cgs.media.charsetProp );
} }
#endif // Q3STATIC

View file

@ -19,6 +19,10 @@ void CG_BubbleTrail( vec3_t start, vec3_t end, float spacing ) {
float len; float len;
int i; int i;
if ( cg_noProjectileTrail.integer ) {
return;
}
VectorCopy (start, move); VectorCopy (start, move);
VectorSubtract (end, start, vec); VectorSubtract (end, start, vec);
len = VectorNormalize (vec); len = VectorNormalize (vec);

View file

@ -5,8 +5,9 @@
#include "cg_local.h" #include "cg_local.h"
// for the voice chats // for the voice chats
#include "../ui/menudef.h" #ifdef MISSIONPACK // bk001205
#include "../../ui/menudef.h"
#endif
//========================================================================== //==========================================================================
/* /*
@ -1882,12 +1883,11 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
//Blaze: No Railgun //Blaze: No Railgun
//cent->currentState.weapon = WP_RAILGUN; //cent->currentState.weapon = WP_RAILGUN;
// if the end was on a nomark surface, don't make an explosion // if the end was on a nomark surface, don't make an explosion
//CG_RailTrail( ci, es->origin2, es->pos.trBase );
if ( es->eventParm != 255 ) { if ( es->eventParm != 255 ) {
ByteToDir( es->eventParm, dir ); ByteToDir( es->eventParm, dir );
CG_MissileHitWall( es->weapon, es->clientNum, position, dir, IMPACTSOUND_DEFAULT ); CG_MissileHitWall( es->weapon, es->clientNum, position, dir, IMPACTSOUND_DEFAULT );
} }
//Blaze: Dont need this
//CG_RailTrail( ci, es->origin2, es->pos.trBase );
break; break;
case EV_BULLET_HIT_WALL: case EV_BULLET_HIT_WALL:
@ -2232,6 +2232,11 @@ void CG_CheckEvents( centity_t *cent ) {
if ( cent->previousEvent ) { if ( cent->previousEvent ) {
return; // already fired return; // already fired
} }
// if this is a player event set the entity number of the client entity number
if ( cent->currentState.eFlags & EF_PLAYER_EVENT ) {
cent->currentState.number = cent->currentState.otherEntityNum;
}
cent->previousEvent = 1; cent->previousEvent = 1;
cent->currentState.event = cent->currentState.eType - ET_EVENTS; cent->currentState.event = cent->currentState.eType - ET_EVENTS;