Skip to content

Commit

Permalink
misc: removed unused variables in UI code, refs #50
Browse files Browse the repository at this point in the history
  • Loading branch information
JanSimek committed Oct 2, 2012
1 parent 634ef2d commit d825871
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 156 deletions.
10 changes: 0 additions & 10 deletions src/ui/ui_loadpanel.c
Expand Up @@ -435,25 +435,15 @@ void UI_LoadPanel_RenderLoadingText(panel_button_t *button)
uiClientState_t cstate;
char downloadName[MAX_INFO_VALUE];
char buff[2560];
static connstate_t lastConnState;
static char lastLoadingText[MAX_INFO_VALUE];
char *p, *s = "";
float y;

trap_GetClientState(&cstate);

Com_sprintf(buff, sizeof(buff), "Connecting to:\n %s^*\n\n%s", cstate.servername, Info_ValueForKey(cstate.updateInfoString, "motd"));

//Com_sprintf( buff, sizeof(buff), "%s^*", cstate.servername, Info_ValueForKey( cstate.updateInfoString, "motd" ) );

trap_Cvar_VariableStringBuffer("cl_downloadName", downloadName, sizeof(downloadName));

if (lastConnState > cstate.connState)
{
lastLoadingText[0] = '\0';
}
lastConnState = cstate.connState;

if (!connect_ownerdraw)
{
if (!trap_Cvar_VariableValue("ui_connecting"))
Expand Down
31 changes: 4 additions & 27 deletions src/ui/ui_main.c
Expand Up @@ -4490,7 +4490,6 @@ void UI_RunMenuScript(char **args)

if (Q_stricmp(name, "StartServer") == 0)
{
float skill;
int pb_sv, pb_cl;

// DHM - Nerve
Expand Down Expand Up @@ -4524,8 +4523,6 @@ void UI_RunMenuScript(char **args)
trap_Cmd_ExecuteText(EXEC_APPEND, va("wait ; wait ; map %s\n", uiInfo.mapList[ui_currentNetMap.integer].mapLoadName));
}

skill = trap_Cvar_VariableValue("g_spSkill");

// NERVE - SMF - set user cvars here
// set timelimit
val = trap_Cvar_VariableValue("ui_userTimelimit");
Expand Down Expand Up @@ -4645,8 +4642,6 @@ void UI_RunMenuScript(char **args)
else if (Q_stricmp(name, "LoadMovies") == 0)
{
UI_LoadMovies();

//----(SA) added
}
else if (Q_stricmp(name, "LoadSaveGames") == 0) // get the list
{
Expand All @@ -4663,8 +4658,6 @@ void UI_RunMenuScript(char **args)
else if (Q_stricmp(name, "DelSavegame") == 0)
{
UI_DelSavegame();
//----(SA) end

}
else if (Q_stricmp(name, "LoadMods") == 0)
{
Expand Down Expand Up @@ -6148,7 +6141,7 @@ UI_BuildServerDisplayList
*/
static void UI_BuildServerDisplayList(qboolean force)
{
int i, count, clients, maxClients, ping, game, len, visible, friendlyFire, maxlives, punkbuster, antilag, password, weaponrestricted, balancedteams;
int i, count, clients, maxClients, ping, game, len, friendlyFire, maxlives, punkbuster, antilag, password, weaponrestricted, balancedteams;
char info[MAX_STRING_CHARS];
//qboolean startRefresh = qtrue; // TTimo: unused
static int numinvisible;
Expand Down Expand Up @@ -6209,15 +6202,13 @@ static void UI_BuildServerDisplayList(qboolean force)
uiInfo.serverStatus.currentServerPreview = 0;
}

visible = qfalse;
for (i = 0; i < count; i++)
{
// if we already got info for this server
if (!trap_LAN_ServerIsVisible(ui_netSource.integer, i))
{
continue;
}
visible = qtrue;
// get the ping for this server
ping = trap_LAN_GetServerPing(ui_netSource.integer, i);
if (ping > /*=*/ 0 || ui_netSource.integer == AS_FAVORITES)
Expand Down Expand Up @@ -6989,8 +6980,7 @@ static const char *UI_SelectedMap(qboolean singlePlayer, int index, int *actual)

static const char *UI_SelectedCampaign(int index, int *actual)
{
int i, c;
c = 0;
int i;
*actual = 0;
for (i = 0; i < uiInfo.campaignCount; i++)
{
Expand Down Expand Up @@ -7498,21 +7488,10 @@ void UI_FeederSelection(float feederID, int index)
}
else if (feederID == FEEDER_MAPS || feederID == FEEDER_ALLMAPS)
{
int actual, map;
int actual;
int game;

map = (feederID == FEEDER_ALLMAPS) ? ui_currentNetMap.integer : ui_currentMap.integer;
game = feederID == FEEDER_MAPS ? uiInfo.gameTypes[ui_gameType.integer].gtEnum : ui_netGameType.integer;
/*if( game == GT_WOLF_CAMPAIGN ) {
if (uiInfo.campaignList[map].campaignCinematic >= 0) {
trap_CIN_StopCinematic(uiInfo.campaignList[map].campaignCinematic);
uiInfo.campaignList[map].campaignCinematic = -1;
}
} else
if (uiInfo.mapList[map].cinematic >= 0) {
trap_CIN_StopCinematic(uiInfo.mapList[map].cinematic);
uiInfo.mapList[map].cinematic = -1;
}*/

UI_SelectedMap(feederID == FEEDER_MAPS ? qtrue : qfalse, index, &actual);
trap_Cvar_Set("ui_mapIndex", va("%d", index));
Expand Down Expand Up @@ -8029,7 +8008,7 @@ UI_Init
*/
void _UI_Init(qboolean inGameLoad)
{
int start, x;
int x;

//uiInfo.inGameLoad = inGameLoad;

Expand Down Expand Up @@ -8151,8 +8130,6 @@ void _UI_Init(qboolean inGameLoad)

uiInfo.campaignMap = trap_R_RegisterShaderNoMip("gfx/loading/camp_map.tga");

start = trap_Milliseconds();

uiInfo.teamCount = 0;
uiInfo.characterCount = 0;
uiInfo.aliasCount = 0;
Expand Down
102 changes: 0 additions & 102 deletions src/ui/ui_players.c
Expand Up @@ -1417,20 +1417,10 @@ UI_ParseAnimationFile
*/
static qboolean UI_ParseAnimationFile(const char *filename, playerInfo_t *pi)
{
char *text_p, *prev;
int len;
int i;
char *token;
float fps;
int skip;
char text[20000];
fileHandle_t f;

token = NULL;
i = 0;
fps = 0;
prev = 0;

memset(pi->animations, 0, sizeof(animation_t) * MAX_ANIMATIONS);

// load the file
Expand All @@ -1450,100 +1440,8 @@ static qboolean UI_ParseAnimationFile(const char *filename, playerInfo_t *pi)
trap_FS_FCloseFile(f);

// parse the text
text_p = text;
skip = 0; // quite the compiler warning

// NERVE - SMF - new!!!!
AnimParseAnimConfig(pi, filename, text);
return qtrue;

// -NERVE - SMF - This does not work with wolf's new animation system
/*
// read optional parameters
while ( 1 ) {
prev = text_p; // so we can unget
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
if ( !Q_stricmp( token, "footsteps" ) ) {
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
continue;
} else if ( !Q_stricmp( token, "headoffset" ) ) {
for ( i = 0 ; i < 3 ; i++ ) {
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
}
continue;
} else if ( !Q_stricmp( token, "sex" ) ) {
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
continue;
}
// if it is a number, start parsing animations
if ( token[0] >= '0' && token[0] <= '9' ) {
text_p = prev; // unget the token
break;
}
Com_Printf( "unknown token '%s' is %s\n", token, filename );
}
// read information for each frame
for ( i = 0 ; i < MAX_ANIMATIONS ; i++ ) {
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
animations[i].firstFrame = atoi( token );
// leg only frames are adjusted to not count the upper body only frames
if ( i == LEGS_WALKCR ) {
skip = animations[LEGS_WALKCR].firstFrame - animations[TORSO_GESTURE].firstFrame;
}
if ( i >= LEGS_WALKCR ) {
animations[i].firstFrame -= skip;
}
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
animations[i].numFrames = atoi( token );
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
animations[i].loopFrames = atoi( token );
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
fps = atof( token );
if ( fps == 0 ) {
fps = 1;
}
animations[i].frameLerp = 1000 / fps;
animations[i].initialLerp = 1000 / fps;
}
if ( i != MAX_ANIMATIONS ) {
Com_Printf( "Error parsing animation file: %s", filename );
return qfalse;
}
return qtrue;
*/
}


Expand Down
18 changes: 1 addition & 17 deletions src/ui/ui_shared.c
Expand Up @@ -2657,12 +2657,8 @@ int Item_Slider_OverSlider(itemDef_t *item, float x, float y)
int Item_ListBox_OverLB(itemDef_t *item, float x, float y)
{
rectDef_t r;
listBoxDef_t *listPtr;
int thumbstart;
int count;

count = DC->feederCount(item->special);
listPtr = (listBoxDef_t *)item->typeData;
if (item->window.flags & WINDOW_HORIZONTAL)
{
// check if on left arrow
Expand Down Expand Up @@ -5414,11 +5410,9 @@ char *BindingFromName(const char *cvar)
void Item_Slider_Paint(itemDef_t *item)
{
vec4_t newColor, lowLight;
float x, y, value;
float x, y;
menuDef_t *parent = (menuDef_t *)item->parent;

value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0;

if (item->window.flags & WINDOW_HASFOCUS && item->window.flags & WINDOW_FOCUSPULSE)
{
lowLight[0] = 0.8 * parent->focusColor[0];
Expand Down Expand Up @@ -5996,15 +5990,11 @@ void Item_ListBox_Paint(itemDef_t *item)

void Item_OwnerDraw_Paint(itemDef_t *item)
{
menuDef_t *parent;

if (item == NULL)
{
return;
}

parent = (menuDef_t *)item->parent;

if (DC->ownerDrawItem)
{
vec4_t color, lowLight;
Expand Down Expand Up @@ -6850,8 +6840,6 @@ qboolean ItemParse_text(itemDef_t *item, int handle)
return qtrue;
}

//----(SA) added

// textfile <string>
// read an external textfile into item->text
qboolean ItemParse_textfile(itemDef_t *item, int handle)
Expand All @@ -6869,7 +6857,6 @@ qboolean ItemParse_textfile(itemDef_t *item, int handle)

return qtrue;
}
//----(SA)

// group <string>
qboolean ItemParse_group(itemDef_t *item, int handle)
Expand All @@ -6886,9 +6873,7 @@ qboolean ItemParse_group(itemDef_t *item, int handle)
qboolean ItemParse_asset_model(itemDef_t *item, int handle)
{
const char *temp = NULL;
modelDef_t *modelPtr;
Item_ValidateTypeData(item);
modelPtr = (modelDef_t *)item->typeData;

if (!PC_String_Parse(handle, &temp))
{
Expand All @@ -6897,7 +6882,6 @@ qboolean ItemParse_asset_model(itemDef_t *item, int handle)
if (!(item->asset))
{
item->asset = DC->registerModel(temp);
// modelPtr->angle = rand() % 360;
}
return qtrue;
}
Expand Down

0 comments on commit d825871

Please sign in to comment.