Skip to content

Commit

Permalink
Some etmain cgame code cleanup and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ensiform committed Nov 22, 2023
1 parent 8384e99 commit 4ca697b
Show file tree
Hide file tree
Showing 26 changed files with 228 additions and 479 deletions.
51 changes: 2 additions & 49 deletions src/cgame/cg_character.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,53 +34,6 @@ If you have questions concerning this license or the applicable additional terms

char bigTextBuffer[100000];

// TTimo - defined but not used
#if 0
/*
======================
CG_ParseGibModels
Read a configuration file containing gib models for use with this character
======================
*/
static qboolean CG_ParseGibModels( bg_playerclass_t* classInfo ) {
char *text_p;
int len;
int i;
char *token;
fileHandle_t f;

memset( classInfo->gibModels, 0, sizeof( classInfo->gibModels ) );

// load the file
len = trap_FS_FOpenFile( va( "models/players/%s/gibs.cfg", classInfo->modelPath ), &f, FS_READ );
if ( len <= 0 ) {
return qfalse;
}
if ( len >= sizeof( bigTextBuffer ) - 1 ) {
CG_Printf( "File %s too long\n", va( "models/players/%s/gibs.cfg", classInfo->modelPath ) );
return qfalse;
}
trap_FS_Read( bigTextBuffer, len, f );
bigTextBuffer[len] = 0;
trap_FS_FCloseFile( f );

// parse the text
text_p = bigTextBuffer;

for ( i = 0; i < MAX_GIB_MODELS; i++ ) {
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
// cache this model
classInfo->gibModels[i] = trap_R_RegisterModel( token );
}

return qtrue;
}
#endif

/*
======================
CG_ParseHudHeadConfig
Expand All @@ -107,7 +60,7 @@ static qboolean CG_ParseHudHeadConfig( const char *filename, animation_t* hha )
}

trap_FS_Read( bigTextBuffer, len, f );
bigTextBuffer[len] = 0;
bigTextBuffer[len] = '\0';
trap_FS_FCloseFile( f );

// parse the text
Expand Down Expand Up @@ -268,7 +221,7 @@ static qboolean CG_ParseAnimationFiles( bg_character_t *character, const char *a
return qfalse;
}
trap_FS_Read( bigTextBuffer, len, f );
bigTextBuffer[len] = 0;
bigTextBuffer[len] = '\0';
trap_FS_FCloseFile( f );

// parse the text
Expand Down
16 changes: 7 additions & 9 deletions src/cgame/cg_commandmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ If you have questions concerning this license or the applicable additional terms

static mapEntityData_t mapEntities[MAX_GENTITIES];
static int mapEntityCount = 0;
static int mapEntityTime = 0;
static qboolean expanded = qfalse;

extern playerInfo_t pi;
Expand Down Expand Up @@ -145,8 +144,8 @@ void CG_AdjustAutomapZoom( int zoomIn ) {
}
// END xkan, 9/19/2002

void CG_ParseMapEntity( int* mapEntityCount, int* offset, team_t team ) {
mapEntityData_t* mEnt = &mapEntities[( *mapEntityCount )];
void CG_ParseMapEntity( int* _mapEntityCount, int* offset, team_t team ) {
mapEntityData_t* mEnt = &mapEntities[( *_mapEntityCount )];
char buffer[16];

trap_Argv( ( *offset )++, buffer, 16 );
Expand Down Expand Up @@ -198,7 +197,7 @@ void CG_ParseMapEntity( int* mapEntityCount, int* offset, team_t team ) {

mEnt->team = team;

( *mapEntityCount )++;
( *_mapEntityCount )++;
}

/*
Expand All @@ -210,7 +209,6 @@ void CG_ParseMapEntityInfo( int axis_number, int allied_number ) {
int i, offset;

mapEntityCount = 0;
mapEntityTime = cg.time;

offset = 3;

Expand Down Expand Up @@ -468,7 +466,7 @@ void CG_DrawMapEntity( mapEntityData_t *mEnt, float x, float y, float w, float h
mEnt->automapTransformed[1] = ( ( cg.predictedPlayerEntity.lerpOrigin[1] - cg.mapcoordsMins[1] ) * cg.mapcoordsScale[1] ) * h * scissor->zoomFactor;
}

mEnt->yaw = cg.predictedPlayerState.viewangles[YAW];
mEnt->yaw = (int)cg.predictedPlayerState.viewangles[YAW];
} else if ( ci->team == snap->ps.persistant[PERS_TEAM] && cent->currentValid ) {
if ( !scissor ) {
mEnt->transformed[0] = ( ( cent->lerpOrigin[0] - cg.mapcoordsMins[0] ) * cg.mapcoordsScale[0] ) * w;
Expand All @@ -478,7 +476,7 @@ void CG_DrawMapEntity( mapEntityData_t *mEnt, float x, float y, float w, float h
mEnt->automapTransformed[1] = ( ( cent->lerpOrigin[1] - cg.mapcoordsMins[1] ) * cg.mapcoordsScale[1] ) * h * scissor->zoomFactor;
}

mEnt->yaw = cent->lerpAngles[YAW];
mEnt->yaw = (int)cent->lerpAngles[YAW];
} else {
// Gordon: only see revivables for own team, duh :)
if ( mEnt->type == ME_PLAYER_REVIVE ) {
Expand Down Expand Up @@ -885,7 +883,7 @@ void CG_DrawMap( float x, float y, float w, float h, int mEntFilter, mapScissor_
} else {
trap_R_DrawStretchPic( sc_x, sc_y, sc_w, sc_h, s0, t0, s1, t1, cgs.media.commandCentreAutomapShader[0] );
}
trap_R_DrawStretchPic( 0, 0, 0, 0, 0, 0, 0, 0, cgs.media.whiteShader ); // HACK : the code above seems to do weird things to
//trap_R_DrawStretchPic( 0, 0, 0, 0, 0, 0, 0, 0, cgs.media.whiteShader ); // HACK : the code above seems to do weird things to
// the next trap_R_DrawStretchPic issued. This works
// around this.
}
Expand Down Expand Up @@ -1478,7 +1476,7 @@ mapEntityData_t* CG_ScanForCommandCentreEntity( void ) {
}

typedef enum {
MT_CONSTRUCT,
MT_CONSTRUCT = 0,
MT_CONSTRUCT_BARE,
MT_DESTRUCT,
MT_DESTRUCT_BARE,
Expand Down
Loading

0 comments on commit 4ca697b

Please sign in to comment.