static void CG_ScoresDown_f( void ) { if( !cg.showScores ) { Menu_SetFeederSelection( menuScoreboard, FEEDER_ALIENTEAM_LIST, 0, NULL ); Menu_SetFeederSelection( menuScoreboard, FEEDER_HUMANTEAM_LIST, 0, NULL ); } if( CG_RequestScores( ) ) { // leave the current scores up if they were already // displayed, but if this is the first hit, clear them out if( !cg.showScores ) { if( cg_debugRandom.integer ) CG_Printf( "CG_ScoresDown_f: scores out of date\n" ); cg.showScores = qtrue; cg.numScores = 0; } } else { // show the cached contents even if they just pressed if it // is within two seconds cg.showScores = qtrue; } }
static void CG_ScoresDown_f( void ) { if ( !cg.showScores ) { Menu_SetFeederSelection( menuScoreboard, FEEDER_ALIENTEAM_LIST, 0, NULL ); Menu_SetFeederSelection( menuScoreboard, FEEDER_HUMANTEAM_LIST, 0, NULL ); trap_PrepareKeyUp(); cg.showScores = qtrue; } else { cg.showScores = qfalse; cg.numScores = 0; } }
qboolean UI_ForceSide_HandleKey(int flags, float *special, int key, int num, int min, int max, int type) { char info[MAX_INFO_VALUE]; info[0] = '\0'; trap->GetConfigString(CS_SERVERINFO, info, sizeof(info)); if (atoi( Info_ValueForKey( info, "g_forceBasedTeams" ) )) { switch((int)(trap->Cvar_VariableValue("ui_myteam"))) { case TEAM_RED: return qfalse; case TEAM_BLUE: return qfalse; default: break; } } if (key == A_MOUSE1 || key == A_MOUSE2 || key == A_ENTER || key == A_KP_ENTER) { int i = num; int x = 0; //update the feeder item selection, it might be different depending on side Menu_SetFeederSelection(NULL, FEEDER_FORCECFG, 0, NULL); if (key == A_MOUSE2) { i--; } else { i++; } if (i < min) { i = max; } else if (i > max) { i = min; } num = i; uiForceSide = num; // Resetting power ranks based on if light or dark side is chosen while (x < NUM_FORCE_POWERS) { if (uiForcePowerDarkLight[x] && uiForceSide != uiForcePowerDarkLight[x]) { uiForcePowersRank[x] = 0; } x++; } UpdateForceUsed(); gTouchedForce = qtrue; return qtrue; } return qfalse; }
void UI_SaveForceTemplate() { char *selectedName = UI_Cvar_VariableString("ui_SaveFCF"); char fcfString[512]; char forceStringValue[4]; fileHandle_t f; int strPlace = 0; int forcePlace = 0; int i = 0; qboolean foundFeederItem = qfalse; if (!selectedName || !selectedName[0]) { Com_Printf("You did not provide a name for the template.\n"); return; } if (uiForceSide == FORCE_LIGHTSIDE) { //write it into the light side folder trap->FS_Open(va("forcecfg/light/%s.fcf", selectedName), &f, FS_WRITE); } else { //if it isn't light it must be dark trap->FS_Open(va("forcecfg/dark/%s.fcf", selectedName), &f, FS_WRITE); } if (!f) { Com_Printf("There was an error writing the template file (read-only?).\n"); return; } Com_sprintf(fcfString, sizeof(fcfString), "%i-%i-", uiForceRank, uiForceSide); strPlace = strlen(fcfString); while (forcePlace < NUM_FORCE_POWERS) { Com_sprintf(forceStringValue, sizeof(forceStringValue), "%i", uiForcePowersRank[forcePlace]); //Just use the force digit even if multiple digits. Shouldn't be longer than 1. fcfString[strPlace] = forceStringValue[0]; strPlace++; forcePlace++; } fcfString[strPlace] = '\n'; fcfString[strPlace+1] = 0; trap->FS_Write(fcfString, strlen(fcfString), f); trap->FS_Close(f); Com_Printf("Template saved as \"%s\".\n", selectedName); //Now, update the FCF list UI_LoadForceConfig_List(); //Then, scroll through and select the template for the file we just saved while (i < uiInfo.forceConfigCount) { if (!Q_stricmp(uiInfo.forceConfigNames[i], selectedName)) { if ((uiForceSide == FORCE_LIGHTSIDE && uiInfo.forceConfigSide[i]) || (uiForceSide == FORCE_DARKSIDE && !uiInfo.forceConfigSide[i])) { Menu_SetFeederSelection(NULL, FEEDER_FORCECFG, UI_TranslateFCFIndex(i), NULL); foundFeederItem = qtrue; } } i++; } //Else, go back to 0 if (!foundFeederItem) { Menu_SetFeederSelection(NULL, FEEDER_FORCECFG, 0, NULL); } }