void OnButtonDown(unsigned value) { if (value & BUTTON_LEFT) { TurnOnLeftLed(); ResetScores(); InitializeGame(); } else if (value & BUTTON_RIGHT) { TurnOnRightLed(); game_data.pause = !game_data.pause; } }
// *ShowMenu void ShowMenu()//MENU { CalcWinsAndLosses(); do { system("cls");//clears command MainHeader(); printf("\n\nOptions: 1, 2, 3, 4, 5 or 6\n"); printf("\n1: Easy"); printf("\n2: Medium"); printf("\n3: Hard"); printf("\n4: Rules"); printf("\n5: Reset Scores"); printf("\n6: Exit"); printf("\n\nChoice: "); fflush(stdin); scanf_s("%d",&iChoice); iCheckForInt = iChoice; //validation to only get numbers switch (iChoice) { case 1: case 2: case 3: { GroupUsefullFunctions(); break; } case 4: { Rules(); break; } case 5: { ResetScores(); break; } case 6: { exit(0); break; } default: { ShowMenu(); } }//Switch } while ((iChoice < 1) || (iChoice > NumMainMenuItems) || (iChoice != iCheckForInt)); }//End ShowMenu();
//----------------------------------------------------------------------------- // Purpose: Used to transition game state //----------------------------------------------------------------------------- void CSpaceWarServer::SetGameState( EServerGameState eState ) { if ( m_eGameState == eState ) return; // If we were in waiting for players and are now going active clear old scores if ( m_eGameState == k_EServerWaitingForPlayers && eState == k_EServerActive ) { ResetScores(); ResetPlayerShips(); } m_ulStateTransitionTime = m_pGameEngine->GetGameTickCount(); m_eGameState = eState; }
void Cmd_ResetScores_f(edict_t * ent) { int i, teamNum, otherCaptain = 0; if (!matchmode->value) { gi.cprintf(ent, PRINT_HIGH, "This command needs matchmode to be enabled\n"); return; } if (ent->client->pers.admin) //Admins can resetscores { ResetScores(true); gi.bprintf(PRINT_HIGH, "Scores and time were reset by match admin %s\n", ent->client->pers.netname); return; } teamNum = ent->client->resp.team; if (teamNum == NOTEAM) { gi.cprintf(ent, PRINT_HIGH, "You need to be on a team for that...\n"); return; } if (teams[teamNum].captain != ent) { gi.cprintf(ent, PRINT_HIGH, "You need to be a captain for that\n"); return; } if (teams[teamNum].wantReset) { teams[teamNum].wantReset = 0; for (i = TEAM1; i<teamCount + 1; i++) { if (i != teamNum && teams[i].captain) { gi.cprintf(teams[i].captain, PRINT_HIGH, "Team %i doesn't want to reset afterall", teamNum); } } gi.cprintf(ent, PRINT_HIGH, "Your score reset request cancelled\n"); return; } teams[teamNum].wantReset = 1; for(i = TEAM1; i<teamCount+1; i++) { if(!teams[i].wantReset) break; } if(i == teamCount+1) { ResetScores(true); gi.bprintf(PRINT_HIGH, "Scores and time were reset by request of captains\n"); return; } for (; i<teamCount + 1; i++) { if (!teams[i].wantReset && teams[i].captain) { gi.cprintf(teams[i].captain, PRINT_HIGH, "Team %i wants to reset scores, type 'resetscores' to accept\n", teamNum); otherCaptain = 1; } } if(otherCaptain) gi.cprintf(ent, PRINT_HIGH, "Your score reset request was sent to the other team captain\n"); else gi.cprintf(ent, PRINT_HIGH, "Other team needs a captain and his acceptance to reset the scores\n"); }