#include <gGame.h>
Public Member Functions | |
gGameSettings (int a_scoreWin, int a_limitTime, int a_limitRounds, int a_limitScore, int a_numAIs, int a_minPlayers, int a_AI_IQ, bool a_autoNum, bool a_autoIQ, int a_speedFactor, int a_sizeFactor, gGameType a_gameType, gFinishType a_finishType, int a_minTeams, int a_winZoneMinRoundTime, int a_winZoneMinLastDeath) | |
void | AutoAI (bool success) |
void | Menu () |
Public Attributes | |
int | scoreWin |
int | limitTime |
int | limitRounds |
int | limitScore |
int | numAIs |
int | minPlayers |
int | AI_IQ |
bool | autoNum |
bool | autoIQ |
int | speedFactor |
int | sizeFactor |
int | autoAIFraction |
int | winZoneMinRoundTime |
int | winZoneMinLastDeath |
gGameType | gameType |
gFinishType | finishType |
int | minTeams |
int | maxTeams |
int | minPlayersPerTeam |
int | maxPlayersPerTeam |
int | maxTeamImbalance |
bool | balanceTeamsWithAIs |
bool | enforceTeamRulesOnQuit |
REAL | wallsStayUpDelay |
REAL | wallsLength |
REAL | explosionRadius |
Definition at line 153 of file gGame.h.
gGameSettings::gGameSettings | ( | int | a_scoreWin, | |
int | a_limitTime, | |||
int | a_limitRounds, | |||
int | a_limitScore, | |||
int | a_numAIs, | |||
int | a_minPlayers, | |||
int | a_AI_IQ, | |||
bool | a_autoNum, | |||
bool | a_autoIQ, | |||
int | a_speedFactor, | |||
int | a_sizeFactor, | |||
gGameType | a_gameType, | |||
gFinishType | a_finishType, | |||
int | a_minTeams, | |||
int | a_winZoneMinRoundTime, | |||
int | a_winZoneMinLastDeath | |||
) |
Definition at line 302 of file gGame.cpp.
References AUTO_AI_MAXFRAC, autoAIFraction, balanceTeamsWithAIs, enforceTeamRulesOnQuit, explosionRadius, maxPlayersPerTeam, maxTeamImbalance, maxTeams, minPlayersPerTeam, wallsLength, and wallsStayUpDelay.
00311 :scoreWin(a_scoreWin), 00312 limitTime(a_limitTime), limitRounds(a_limitRounds), limitScore(a_limitScore), 00313 numAIs(a_numAIs), minPlayers(a_minPlayers), AI_IQ(a_AI_IQ), 00314 autoNum(a_autoNum), autoIQ(a_autoIQ), 00315 speedFactor(a_speedFactor), sizeFactor(a_sizeFactor), 00316 winZoneMinRoundTime( a_winZoneMinRoundTime ),winZoneMinLastDeath( a_winZoneMinLastDeath ), 00317 gameType(a_gameType), finishType(a_finishType), 00318 minTeams(a_minTeams) 00319 { 00320 autoAIFraction = AUTO_AI_MAXFRAC >> 1; 00321 00322 maxTeams = 16; 00323 minPlayersPerTeam = 1; 00324 maxPlayersPerTeam = 10; 00325 maxTeamImbalance = 1; 00326 balanceTeamsWithAIs = true; 00327 enforceTeamRulesOnQuit = false; 00328 00329 wallsStayUpDelay = 2.0f; 00330 wallsLength = -1.0f; 00331 explosionRadius = 4.0f; 00332 }
void gGameSettings::AutoAI | ( | bool | success | ) |
Definition at line 334 of file gGame.cpp.
References AI_IQ, AUTO_AI_LOSE, AUTO_AI_MAXFRAC, AUTO_AI_WIN, autoAIFraction, autoIQ, autoNum, MAXAI, and numAIs.
Referenced by gGame::Analysis().
00334 { 00335 if (!autoNum && !autoIQ) 00336 return; 00337 00338 if (autoNum) 00339 { 00340 if (success) 00341 { 00342 autoAIFraction += AUTO_AI_WIN; 00343 while (autoAIFraction > AUTO_AI_MAXFRAC) 00344 { 00345 autoAIFraction -= AUTO_AI_MAXFRAC; 00346 if (numAIs < MAXAI) numAIs++; 00347 } 00348 } 00349 else 00350 { 00351 autoAIFraction -= AUTO_AI_LOSE; 00352 while (autoAIFraction < 0) 00353 { 00354 autoAIFraction += AUTO_AI_MAXFRAC; 00355 if (numAIs >= 2) numAIs--; 00356 } 00357 } 00358 } 00359 00360 00361 if (autoIQ) 00362 { 00363 if (!autoNum) 00364 AI_IQ += 4 * (success ? AUTO_AI_WIN : -AUTO_AI_LOSE); 00365 else 00366 { 00367 int total = numAIs * numAIs * AI_IQ; 00368 // try to keep total around 100: that is either 10 dumb AIs or 00369 // one smart AI. 00370 00371 if (success) 00372 if (total > 100) 00373 AI_IQ += AUTO_AI_WIN * 4; 00374 else 00375 AI_IQ += AUTO_AI_WIN; 00376 else 00377 if (total < 100) 00378 AI_IQ -= AUTO_AI_LOSE * 4; 00379 else 00380 AI_IQ -= AUTO_AI_LOSE; 00381 } 00382 } 00383 00384 if (AI_IQ > 100) 00385 AI_IQ = 100; 00386 if (AI_IQ < 0) 00387 AI_IQ = 0; 00388 }
void gGameSettings::Menu | ( | ) |
Definition at line 391 of file gGame.cpp.
References AI_IQ, autoIQ, autoNum, balanceTeamsWithAIs, enforceTeamRulesOnQuit, uMenu::Enter(), explosionRadius, finishType, gameType, gDUEL, gFINISH_EXPRESS, gFINISH_IMMEDIATELY, gFINISH_NORMAL, gFINISH_SPEEDUP, gFREESTYLE, MAXAI, maxPlayersPerTeam, maxTeamImbalance, maxTeams, minPlayers, minPlayersPerTeam, minTeams, uMenuItemSelection< T >::NewChoice(), numAIs, sizeFactor, speedFactor, wallsLength, wallsStayUpDelay, winZoneMinLastDeath, and winZoneMinRoundTime.
Referenced by GameSettingsCurrent(), GameSettingsMP(), and GameSettingsSP().
00392 { 00393 uMenu GameSettings("$game_settings_menu_text"); 00394 00395 uMenuItemInt wzmr 00396 (&GameSettings, 00397 "$game_menu_wz_mr_text", 00398 "$game_menu_wz_mr_help", 00399 winZoneMinRoundTime,0,1000,10); 00400 00401 uMenuItemInt wzmld 00402 (&GameSettings, 00403 "$game_menu_wz_ld_text", 00404 "$game_menu_wz_ld_help", 00405 winZoneMinLastDeath,0,1000,10); 00406 00407 uMenuItemToggle team_et 00408 (&GameSettings, 00409 "$game_menu_balance_quit_text", 00410 "$game_menu_balance_quit_help", 00411 enforceTeamRulesOnQuit); 00412 00413 uMenuItemToggle team_bt 00414 (&GameSettings, 00415 "$game_menu_balance_ais_text", 00416 "$game_menu_balance_ais_help", 00417 balanceTeamsWithAIs); 00418 00419 uMenuItemInt team_mi 00420 (&GameSettings, 00421 "$game_menu_imb_text", 00422 "$game_menu_imb_help", 00423 maxTeamImbalance,2,10); 00424 00425 uMenuItemInt team_maxp 00426 (&GameSettings, 00427 "$game_menu_max_players_text", 00428 "$game_menu_max_players_help", 00429 maxPlayersPerTeam,1,16); 00430 00431 uMenuItemInt team_minp 00432 (&GameSettings, 00433 "$game_menu_min_players_text", 00434 "$game_menu_min_players_help", 00435 minPlayersPerTeam,1,16); 00436 00437 uMenuItemInt team_max 00438 (&GameSettings, 00439 "$game_menu_max_teams_text", 00440 "$game_menu_max_teams_help", 00441 maxTeams,1,16); 00442 00443 uMenuItemInt team_min 00444 (&GameSettings, 00445 "$game_menu_min_teams_text", 00446 "$game_menu_min_teams_help", 00447 minTeams,1,16); 00448 00449 uMenuItemSelection<gFinishType> finisht 00450 (&GameSettings,"$game_menu_finish_text", 00451 "$game_menu_finish_help",finishType); 00452 finisht.NewChoice("$game_menu_finish_expr_text", 00453 "$game_menu_finish_expr_help", 00454 gFINISH_EXPRESS); 00455 finisht.NewChoice("$game_menu_finish_stop_text", 00456 "$game_menu_finish_stop_help", 00457 gFINISH_IMMEDIATELY); 00458 finisht.NewChoice("$game_menu_finish_fast_text", 00459 "$game_menu_finish_fast_help", 00460 gFINISH_SPEEDUP); 00461 finisht.NewChoice("$game_menu_finish_normal_text", 00462 "$game_menu_finish_normal_help", 00463 gFINISH_NORMAL); 00464 00465 uMenuItemSelection<gGameType> gamet 00466 (&GameSettings,"$game_menu_mode_text", 00467 "$game_menu_mode_help",gameType); 00468 gamet.NewChoice("$game_menu_mode_free_text", 00469 "$game_menu_mode_free_help", 00470 gFREESTYLE); 00471 gamet.NewChoice("$game_menu_mode_lms_text", 00472 "$game_menu_mode_lms_help", 00473 gDUEL); 00474 /* 00475 gamet.NewChoice("$game_menu_mode_team_text", 00476 "$game_menu_mode_team_help", 00477 gHUMAN_VS_AI); 00478 */ 00479 00480 uMenuItemInt speedconf 00481 (&GameSettings, 00482 "$game_menu_speed_text", 00483 "$game_menu_speed_help", 00484 speedFactor,-10,10); 00485 00486 uMenuItemInt sizeconf 00487 (&GameSettings, 00488 "$game_menu_size_text", 00489 "$game_menu_size_help", 00490 sizeFactor,-10,10); 00491 00492 uMenuItemSelection<REAL> wsuconf 00493 (&GameSettings, 00494 "$game_menu_wallstayup_text", 00495 "$game_menu_wallstayup_help", 00496 wallsStayUpDelay); 00497 wsuconf.NewChoice( "$game_menu_wallstayup_infinite_text", 00498 "$game_menu_wallstayup_infinite_help", 00499 -1.0f ); 00500 wsuconf.NewChoice( "$game_menu_wallstayup_immediate_text", 00501 "$game_menu_wallstayup_immediate_help", 00502 0.0f ); 00503 wsuconf.NewChoice( "$game_menu_wallstayup_halfsecond_text", 00504 "$game_menu_wallstayup_halfsecond_help", 00505 0.5f ); 00506 wsuconf.NewChoice( "$game_menu_wallstayup_second_text", 00507 "$game_menu_wallstayup_second_help", 00508 1.0f ); 00509 wsuconf.NewChoice( "$game_menu_wallstayup_2second_text", 00510 "$game_menu_wallstayup_2second_help", 00511 2.0f ); 00512 wsuconf.NewChoice( "$game_menu_wallstayup_4second_text", 00513 "$game_menu_wallstayup_4second_help", 00514 4.0f ); 00515 wsuconf.NewChoice( "$game_menu_wallstayup_8second_text", 00516 "$game_menu_wallstayup_8second_help", 00517 8.0f ); 00518 wsuconf.NewChoice( "$game_menu_wallstayup_16second_text", 00519 "$game_menu_wallstayup_16second_help", 00520 16.0f ); 00521 wsuconf.NewChoice( "$game_menu_wallstayup_32second_text", 00522 "$game_menu_wallstayup_32second_help", 00523 32.0f ); 00524 00525 uMenuItemSelection<REAL> wlconf 00526 (&GameSettings, 00527 "$game_menu_wallslength_text", 00528 "$game_menu_wallslength_help", 00529 wallsLength); 00530 wlconf.NewChoice( "$game_menu_wallslength_infinite_text", 00531 "$game_menu_wallslength_infinite_help", 00532 -1.0f ); 00533 wlconf.NewChoice( "$game_menu_wallslength_25meter_text", 00534 "$game_menu_wallslength_25meter_help", 00535 25.0f ); 00536 wlconf.NewChoice( "$game_menu_wallslength_50meter_text", 00537 "$game_menu_wallslength_50meter_help", 00538 50.0f ); 00539 wlconf.NewChoice( "$game_menu_wallslength_100meter_text", 00540 "$game_menu_wallslength_100meter_help", 00541 100.0f ); 00542 wlconf.NewChoice( "$game_menu_wallslength_200meter_text", 00543 "$game_menu_wallslength_200meter_help", 00544 200.0f ); 00545 wlconf.NewChoice( "$game_menu_wallslength_300meter_text", 00546 "$game_menu_wallslength_300meter_help", 00547 300.0f ); 00548 wlconf.NewChoice( "$game_menu_wallslength_400meter_text", 00549 "$game_menu_wallslength_400meter_help", 00550 400.0f ); 00551 wlconf.NewChoice( "$game_menu_wallslength_600meter_text", 00552 "$game_menu_wallslength_600meter_help", 00553 600.0f ); 00554 wlconf.NewChoice( "$game_menu_wallslength_800meter_text", 00555 "$game_menu_wallslength_800meter_help", 00556 800.0f ); 00557 wlconf.NewChoice( "$game_menu_wallslength_1200meter_text", 00558 "$game_menu_wallslength_1200meter_help", 00559 1200.0f ); 00560 wlconf.NewChoice( "$game_menu_wallslength_1600meter_text", 00561 "$game_menu_wallslength_1600meter_help", 00562 1600.0f ); 00563 00564 uMenuItemSelection<REAL> erconf 00565 (&GameSettings, 00566 "$game_menu_exrad_text", 00567 "$game_menu_exrad_help", 00568 explosionRadius); 00569 erconf.NewChoice( "$game_menu_exrad_0_text", 00570 "$game_menu_exrad_0_help", 00571 0.0f ); 00572 erconf.NewChoice( "$game_menu_exrad_2meters_text", 00573 "$game_menu_exrad_2meters_help", 00574 2.0f ); 00575 erconf.NewChoice( "$game_menu_exrad_4meters_text", 00576 "$game_menu_exrad_4meters_help", 00577 4.0f ); 00578 erconf.NewChoice( "$game_menu_exrad_8meters_text", 00579 "$game_menu_exrad_8meters_help", 00580 8.0f ); 00581 erconf.NewChoice( "$game_menu_exrad_16meters_text", 00582 "$game_menu_exrad_16meters_help", 00583 16.0f ); 00584 erconf.NewChoice( "$game_menu_exrad_32meters_text", 00585 "$game_menu_exrad_32meters_help", 00586 32.0f ); 00587 erconf.NewChoice( "$game_menu_exrad_64meters_text", 00588 "$game_menu_exrad_64meters_help", 00589 64.0f ); 00590 erconf.NewChoice( "$game_menu_exrad_128meters_text", 00591 "$game_menu_exrad_128meters_help", 00592 128.0f ); 00593 00594 uMenuItemToggle autoiqconf 00595 (&GameSettings, 00596 "$game_menu_autoiq_text", 00597 "$game_menu_autoiq_help", 00598 autoIQ); 00599 00600 uMenuItemToggle autoaiconf 00601 (&GameSettings, 00602 "$game_menu_autoai_text", 00603 "$game_menu_autoai_help", 00604 autoNum); 00605 00606 00607 uMenuItemInt iqconf 00608 (&GameSettings, 00609 "$game_menu_iq_text", 00610 "$game_menu_iq_help", 00611 AI_IQ, 20, 100, 10); 00612 00613 uMenuItemInt mpconf 00614 (&GameSettings, 00615 "$game_menu_minplayers_text", 00616 "$game_menu_minplayers_help", 00617 minPlayers,0,MAXAI); 00618 00619 uMenuItemInt aiconf 00620 (&GameSettings, 00621 "$game_menu_ais_text", 00622 "$game_menu_ais_help", 00623 numAIs,0,MAXAI); 00624 00625 00626 GameSettings.Enter(); 00627 }
Definition at line 178 of file gGame.h.
Referenced by gGame::Analysis(), init_game_camera(), Menu(), and gCamera::MyInit().
Definition at line 181 of file gGame.h.
Referenced by gGameSettings(), Menu(), and sg_copySettings().
Definition at line 182 of file gGame.h.
Referenced by gGameSettings(), Menu(), and sg_copySettings().
Definition at line 182 of file gGame.h.
Referenced by gGameSettings(), Menu(), and sg_copySettings().
Definition at line 183 of file gGame.h.
Referenced by gGameSettings(), Menu(), and sg_copySettings().
Definition at line 184 of file gGame.h.
Referenced by gGameSettings(), Menu(), and sg_copySettings().
Definition at line 184 of file gGame.h.
Referenced by gGameSettings(), Menu(), and sg_copySettings().
Definition at line 187 of file gGame.h.
Referenced by gGameSettings(), Menu(), and sg_copySettings().
Definition at line 188 of file gGame.h.
Referenced by gGameSettings(), Menu(), and sg_copySettings().
Definition at line 189 of file gGame.h.
Referenced by gGameSettings(), Menu(), and sg_copySettings().