[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer ./ChangeLog ./TODO src/Jamfile src/Li...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer ./ChangeLog ./TODO src/Jamfile src/Li... |
Date: |
Sat, 04 Oct 2003 10:44:42 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/10/04 10:44:41
Modified files:
. : ChangeLog TODO
src : Jamfile
src/Lib : LibView.cpp
src/Lib/Particles: ChunkTrajectoryParticle2D.cpp
CloudParticle2D.cpp PuffParticle2D.cpp
src/NetPanzer/Classes: PlayerUnitConfig.cpp
SelectionBoxSprite.cpp
WorldInputCmdProcessor.cpp
src/NetPanzer/Classes/Network: ClientConnectDaemon.cpp
ConnectNetMessage.hpp
src/NetPanzer/Classes/Units: Vehicle.cpp
src/NetPanzer/Classes/Weapons: MissleWeapon.cpp ShellWeapon.cpp
src/NetPanzer/Interfaces: ConsoleInterface.cpp GameConfig.cpp
GameConfig.hpp
GameControlRulesDaemon.cpp
GameManager.cpp GameManager.hpp
MiniMapInterface.cpp
PowerUpInterface.cpp Stats.cpp
src/NetPanzer/Views/Game: AreYouSureResignView.cpp
GameInfoView.cpp GameToolbarView.cpp
MiniMapView.cpp
VehicleSelectionView.cpp
WinnerMesgView.cpp
src/NetPanzer/Views/MainMenu: MenuTemplateView.cpp
src/NetPanzer/Views/MainMenu/Multi: GetSessionView.cpp
HostJoinTemplateView.cpp
HostOptionsView.cpp
HostView.cpp
MapSelectionView.cpp
src/NetPanzer/Views/MainMenu/Options: InterfaceView.cpp
VisualsView.cpp
Removed files:
src/NetPanzer/Views/Game: MiniMapOptionsView.cpp
MiniMapOptionsView.hpp
Log message:
-rewrote the config system and completed config saving and loading
-fixed bug where minimap could be moved outside screen
Patches:
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.6 netpanzer/ChangeLog:1.7
--- netpanzer/ChangeLog:1.6 Fri Oct 3 10:44:55 2003
+++ netpanzer/ChangeLog Sat Oct 4 10:44:35 2003
@@ -1,3 +1,7 @@
+04-Oct-2003 by Matthias Braun
+-rewrote the config system and completed config saving and loading
+-fixed bug where minimap could be moved outside screen
+
02-Oct-2003 by Matthias Braun
-did refactoring work on the surface/DDHardSurface interfaces. DDHardSurface is
now called ScreenSurface, and is used in 99% of all cases where we need to
Index: netpanzer/TODO
diff -u netpanzer/TODO:1.3 netpanzer/TODO:1.4
--- netpanzer/TODO:1.3 Wed Sep 24 13:43:20 2003
+++ netpanzer/TODO Sat Oct 4 10:44:36 2003
@@ -10,7 +10,7 @@
-Fix all warnings in the sourcecode - OK
-Add configure script (autoconf) which checks for all prerequesits - OK
-Create "make install" target (also a "make uninstall"?) - OK (jam system now)
--Write a README
+-Write a README - OK
-Test it, esp. with more than 2 players and test a complete
getsource/configure/build/install/play cycle. We should be able to find
betatesters in irc channels like #netpanzer, #sdl, #*game* I assume ;-)
Index: netpanzer/src/Jamfile
diff -u netpanzer/src/Jamfile:1.1 netpanzer/src/Jamfile:1.2
--- netpanzer/src/Jamfile:1.1 Tue Sep 23 21:26:18 2003
+++ netpanzer/src/Jamfile Sat Oct 4 10:44:36 2003
@@ -47,3 +47,4 @@
CFlags netpanzer : -DDATADIR=\\\"$(datadir)\\\" ;
ExternalLibs netpanzer : XML SDL SDLNET SDLMIXER SDLIMAGE PHYSFS ;
Help netpanzer : "Build the main netpanzer executable" ;
+
Index: netpanzer/src/Lib/LibView.cpp
diff -u netpanzer/src/Lib/LibView.cpp:1.5 netpanzer/src/Lib/LibView.cpp:1.6
--- netpanzer/src/Lib/LibView.cpp:1.5 Tue Sep 16 16:16:09 2003
+++ netpanzer/src/Lib/LibView.cpp Sat Oct 4 10:44:36 2003
@@ -294,12 +294,12 @@
dest.bltString(iXY(pos.x, pos.y), "-- Environment Info --", Color::green);
pos.y += yOffset;
- float windSpeed = GameConfig::getWindSpeed();
- sprintf(strBuf, "Wind: %s (%3.1f pix/sec)", (const char *)
HostOptionsView::windSpeedString, windSpeed);
+ int windSpeed = gameconfig->windspeed;
+ sprintf(strBuf, "Wind: %s (%d pix/sec)", (const char *)
HostOptionsView::windSpeedString, windSpeed);
dest.bltString(iXY(pos.x, pos.y), strBuf, Color::yellow);
pos.y += yOffset;
- int cloudCount = GameConfig::getCloudCoverage();
+ int cloudCount = gameconfig->cloudcoverage;
sprintf(strBuf, "Clouds: %s (%d allocated)", (const char *)
HostOptionsView::cloudCoverageString, cloudCount);
dest.bltString(iXY(pos.x, pos.y), strBuf, Color::yellow);
pos.y += yOffset;
Index: netpanzer/src/Lib/Particles/ChunkTrajectoryParticle2D.cpp
diff -u netpanzer/src/Lib/Particles/ChunkTrajectoryParticle2D.cpp:1.9
netpanzer/src/Lib/Particles/ChunkTrajectoryParticle2D.cpp:1.10
--- netpanzer/src/Lib/Particles/ChunkTrajectoryParticle2D.cpp:1.9 Tue Sep
16 16:16:09 2003
+++ netpanzer/src/Lib/Particles/ChunkTrajectoryParticle2D.cpp Sat Oct 4
10:44:36 2003
@@ -118,7 +118,7 @@
packedSurface.setAttrib(iXY((int) pos.x, (int) (pos.z - arcYPix)), layer);
sorter.addSprite(&packedSurface);
- if (GameConfig::getDisplayShadowsFlag()) {
+ if (gameconfig->displayshadows) {
packedSurfaceShadow.setAttrib(iXY((int) (pos.x - arcYPix), (int)
pos.z), shadowLayer);
sorter.addSprite(&packedSurfaceShadow);
}
Index: netpanzer/src/Lib/Particles/CloudParticle2D.cpp
diff -u netpanzer/src/Lib/Particles/CloudParticle2D.cpp:1.9
netpanzer/src/Lib/Particles/CloudParticle2D.cpp:1.10
--- netpanzer/src/Lib/Particles/CloudParticle2D.cpp:1.9 Tue Sep 16 16:16:09 2003
+++ netpanzer/src/Lib/Particles/CloudParticle2D.cpp Sat Oct 4 10:44:36 2003
@@ -170,7 +170,7 @@
packedSurface.setAttrib(iXY(int(pos.x), int(pos.z)), layer);
sorter.addSprite(&packedSurface);
- if (GameConfig::getDisplayShadowsFlag()) {
+ if (gameconfig->displayshadows) {
packedSurfaceShadow.setAttrib(iXY(int(pos.x - 300), int(pos.z)),
shadowLayer);
sorter.addSprite(&packedSurfaceShadow);
}
Index: netpanzer/src/Lib/Particles/PuffParticle2D.cpp
diff -u netpanzer/src/Lib/Particles/PuffParticle2D.cpp:1.8
netpanzer/src/Lib/Particles/PuffParticle2D.cpp:1.9
--- netpanzer/src/Lib/Particles/PuffParticle2D.cpp:1.8 Tue Sep 16 16:16:09 2003
+++ netpanzer/src/Lib/Particles/PuffParticle2D.cpp Sat Oct 4 10:44:36 2003
@@ -97,7 +97,7 @@
packedSurfaceShadow.setDrawModeBlend(&Palette::colorTableDarkenALittle);
- if (GameConfig::getBlendSmoke()) {
+ if (gameconfig->blendsmoke) {
int randColorTable = rand() % 4;
if (randColorTable == 0) {
@@ -147,7 +147,7 @@
packedSurface.setAttrib(iXY((int) pos.x, (int) pos.z), layer);
sorter.addSprite(&packedSurface);
- if (GameConfig::getDisplayShadowsFlag()) {
+ if (gameconfig->displayshadows) {
if (!userDefinedShadowPos) {
shadowPos.x = pos.x - ((float(index) /
float(staticPackedSmokeLightPuff.getCount())) *
packedSurfaceShadow.getCurFrame() * 10);
}
Index: netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp
diff -u netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp:1.7
netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp:1.8
--- netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp:1.7 Mon Sep
22 09:53:50 2003
+++ netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp Sat Oct
4 10:44:37 2003
@@ -283,9 +283,11 @@
} else {
ConnectClientSettings client_setting;
- client_setting.set( GameConfig::GetPlayerName(),
- (unsigned char)
GameConfig::GetUnitColor(),
- GameConfig::GetPlayerFlag() );
+ client_setting.set(
+ ((const std::string&)
+ (gameconfig->playername)).c_str(),
+ gameconfig->getUnitColor(),
+ gameconfig->playerflag );
CLIENT->sendMessage( &client_setting,
sizeof(ConnectClientSettings), 0 );
Index: netpanzer/src/NetPanzer/Classes/Network/ConnectNetMessage.hpp
diff -u netpanzer/src/NetPanzer/Classes/Network/ConnectNetMessage.hpp:1.4
netpanzer/src/NetPanzer/Classes/Network/ConnectNetMessage.hpp:1.5
--- netpanzer/src/NetPanzer/Classes/Network/ConnectNetMessage.hpp:1.4 Mon Sep
22 09:53:51 2003
+++ netpanzer/src/NetPanzer/Classes/Network/ConnectNetMessage.hpp Sat Oct
4 10:44:37 2003
@@ -179,7 +179,7 @@
message_id = _net_message_id_connect_client_settings;
}
- void set( char *player_name, unsigned char unit_color, short player_flag )
+ void set(const char *player_name, unsigned char unit_color, short
player_flag )
{
strcpy( ConnectClientSettings::player_name, player_name );
ConnectClientSettings::unit_color = unit_color;
Index: netpanzer/src/NetPanzer/Classes/PlayerUnitConfig.cpp
diff -u netpanzer/src/NetPanzer/Classes/PlayerUnitConfig.cpp:1.4
netpanzer/src/NetPanzer/Classes/PlayerUnitConfig.cpp:1.5
--- netpanzer/src/NetPanzer/Classes/PlayerUnitConfig.cpp:1.4 Tue Sep 16
16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/PlayerUnitConfig.cpp Sat Oct 4
10:44:37 2003
@@ -37,7 +37,7 @@
};
PlayerUnitConfig::PlayerUnitConfig()
{
- initialize( _GAME_CONFIG_INITIAL_UNIT_LIMIT_UPPER );
+ initialize(10000);
}
PlayerUnitConfig::PlayerUnitConfig( unsigned char max_allowed_units )
Index: netpanzer/src/NetPanzer/Classes/SelectionBoxSprite.cpp
diff -u netpanzer/src/NetPanzer/Classes/SelectionBoxSprite.cpp:1.8
netpanzer/src/NetPanzer/Classes/SelectionBoxSprite.cpp:1.9
--- netpanzer/src/NetPanzer/Classes/SelectionBoxSprite.cpp:1.8 Tue Sep 16
16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/SelectionBoxSprite.cpp Sat Oct 4
10:44:37 2003
@@ -83,15 +83,15 @@
// Modified the vehicle selection box and moved the hitpoints outside,
// the box status check, because I may want the hitpoints drawn all
the time.
- BYTE selectionBoxColor = GameConfig::getVehicleSelectionBoxColor();
+ PIX selectionBoxColor = gameconfig->getVehicleSelectionBoxColor();
assert(max_hit_points > 0);
// Draw the selection box.
- if (GameConfig::getUnitSelectionBoxDrawMode() ==
_unit_selection_box_draw_mode_rect) {
+ if (gameconfig->unitselectionmode ==
_unit_selection_box_draw_mode_rect) {
// Draw the rectangle selection box.
surface->drawRect(min_abs.x, min_abs.y, max_abs.x, max_abs.y,
selectionBoxColor);
- } else if (GameConfig::getUnitSelectionBoxDrawMode() ==
_unit_selection_box_draw_mode_rect_edges) {
+ } else if (gameconfig->unitselectionmode ==
_unit_selection_box_draw_mode_rect_edges) {
surface->drawBoxCorners(min_abs.x, min_abs.y, max_abs.x,
max_abs.y, 7, selectionBoxColor);
} else {
@@ -101,7 +101,7 @@
} // ** box_state == true
// Draw the unit hitpoints.
- if ( GameConfig::getDrawUnitDamage() || (box_state == true) ) {
+ if ( gameconfig->drawunitdamage || (box_state == true) ) {
// Draw a color coded hit bar.
BYTE hitBarColor;
@@ -131,7 +131,7 @@
//surface->drawHLine(min_abs.x, max_abs.y-3, max_abs.x+1, box_color);
}
- if ( GameConfig::getDisplayUnitFlags() == true ) {
+ if ( gameconfig->drawunitflags == true ) {
//unit_flag.blt( *surface, iXY( min_abs.x, min_abs.y -
unit_flag.getPix().y ) );
//surface->bltString5x5(min_abs.x + 2, min_abs.y - 6, "Panther1",
Color::white);
unit_flag.blt( *surface, iXY(min_abs.x, min_abs.y -
unit_flag.getPixY() - 1) );
Index: netpanzer/src/NetPanzer/Classes/Units/Vehicle.cpp
diff -u netpanzer/src/NetPanzer/Classes/Units/Vehicle.cpp:1.10
netpanzer/src/NetPanzer/Classes/Units/Vehicle.cpp:1.11
--- netpanzer/src/NetPanzer/Classes/Units/Vehicle.cpp:1.10 Fri Oct 3
10:45:05 2003
+++ netpanzer/src/NetPanzer/Classes/Units/Vehicle.cpp Sat Oct 4 10:44:37 2003
@@ -1587,7 +1587,8 @@
unit_state.hit_points -= weapon_hit->damage_factor;
unit_state.threat_level = _threat_level_under_attack;
- threat_level_under_attack_timer.changePeriod(
GameConfig::getAttackNotificationTime() );
+ threat_level_under_attack_timer.changePeriod(
+ gameconfig->attacknotificationtime );
UpdateStateUnitOpcode update_state_opcode;
@@ -1951,7 +1952,8 @@
select_info_box.setBoxState( unit_state.select );
//Added layer selection to the selection box info.
- select_info_box.setAttrib( unit_state.location,
GameConfig::getUnitInfoDrawLayer() );
+ select_info_box.setAttrib( unit_state.location,
+ gameconfig->unitinfodrawlayer );
select_info_box.setHitPoints( unit_state.hit_points );
sorter.forceAddSprite( &body_anim_shadow );
Index: netpanzer/src/NetPanzer/Classes/Weapons/MissleWeapon.cpp
diff -u netpanzer/src/NetPanzer/Classes/Weapons/MissleWeapon.cpp:1.10
netpanzer/src/NetPanzer/Classes/Weapons/MissleWeapon.cpp:1.11
--- netpanzer/src/NetPanzer/Classes/Weapons/MissleWeapon.cpp:1.10 Fri Oct
3 10:45:05 2003
+++ netpanzer/src/NetPanzer/Classes/Weapons/MissleWeapon.cpp Sat Oct 4
10:44:38 2003
@@ -152,7 +152,7 @@
groundLight.setWorldPos(location.x + thrustOffset.x, location.y +
thrustOffset.y + heightFromGround);
- if (GameConfig::getDisplayShadowsFlag()) {
+ if (gameconfig->displayshadows) {
shellShadow.setWorldPos(location.x - 20, location.y);
}
}
@@ -163,7 +163,8 @@
sorter.addSprite(&thrust);
//sorter.addSprite(&groundLight);
- if (GameConfig::getDisplayShadowsFlag()) {
+ if (gameconfig->displayshadows) {
sorter.addSprite(&shellShadow);
}
}
+
Index: netpanzer/src/NetPanzer/Classes/Weapons/ShellWeapon.cpp
diff -u netpanzer/src/NetPanzer/Classes/Weapons/ShellWeapon.cpp:1.10
netpanzer/src/NetPanzer/Classes/Weapons/ShellWeapon.cpp:1.11
--- netpanzer/src/NetPanzer/Classes/Weapons/ShellWeapon.cpp:1.10 Fri Oct
3 10:45:06 2003
+++ netpanzer/src/NetPanzer/Classes/Weapons/ShellWeapon.cpp Sat Oct 4
10:44:38 2003
@@ -120,7 +120,7 @@
shell.setWorldPos(location);
- if (GameConfig::getDisplayShadowsFlag()) {
+ if (gameconfig->displayshadows) {
shellShadow.setWorldPos(location);
}
}
@@ -129,13 +129,13 @@
{
shell.setWorldPos(location);
- if (GameConfig::getDisplayShadowsFlag()) {
+ if (gameconfig->displayshadows) {
shellShadow.setWorldPos(location.x - 10, location.y);
}
sorter.addSprite(&shell);
- if (GameConfig::getDisplayShadowsFlag()) {
+ if (gameconfig->displayshadows) {
sorter.addSprite(&shellShadow);
}
}
Index: netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp
diff -u netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp:1.19
netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp:1.20
--- netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp:1.19 Fri Oct
3 10:45:04 2003
+++ netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp Sat Oct 4
10:44:37 2003
@@ -126,7 +126,7 @@
screen_size = screen->getPix();
time_slice = TimerInterface::getTimeSlice();
- scroll_rate = GameConfig::getScrollRate();
+ scroll_rate = gameconfig->scrollrate;
scroll_increment = (long) ( scroll_rate * time_slice );
@@ -252,10 +252,10 @@
}
if ( (KeyboardInterface::getKeyPressed( SDLK_f ) == true) ) {
- GameConfig::toggleDisplayUnitFlags();
+ gameconfig->drawunitflags.toggle();
}
if ( (KeyboardInterface::getKeyPressed( SDLK_d ) == true) ) {
- GameConfig::toggleDrawUnitDamage();
+ gameconfig->drawunitdamage.toggle();
}
if ( (KeyboardInterface::getKeyPressed( SDLK_RETURN ) == true)
Index: netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp:1.13
netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp:1.14
--- netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp:1.13 Fri Oct
3 10:45:09 2003
+++ netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp Sat Oct 4
10:44:38 2003
@@ -19,7 +19,7 @@
#include "ConsoleInterface.hpp"
#include "GameConfig.hpp"
-//GameConfig::getConsoleTextColor()
+//gameconfig->getConsoleTextColor()
bool ConsoleInterface::stdout_pipe;
long ConsoleInterface::console_size;
@@ -65,7 +65,7 @@
long line_loop;
for ( line_loop = 0; line_loop < console_size; line_loop++ ) {
- line_list[ line_loop ].color = GameConfig::getConsoleTextColor();
+ line_list[ line_loop ].color = gameconfig->getConsoleTextColor();
line_list[ line_loop ].string[0] = 0;
line_list[ line_loop ].life_timer.changePeriod( 8 );
}
@@ -187,7 +187,7 @@
strncpy( line_list[ line_index ].string, temp_str_ptr,
max_char_per_line);
line_list[ line_index ].string[ max_char_per_line ] = 0;
- line_list[ line_index ].color = GameConfig::getConsoleTextColor();
+ line_list[ line_index ].color = gameconfig->getConsoleTextColor();
line_list[ line_index ].visible = true;
line_list[ line_index ].life_timer.reset();
@@ -203,7 +203,7 @@
strcpy( line_list[ line_index ].string, temp_str_ptr );
- line_list[ line_index ].color = GameConfig::getConsoleTextColor();
+ line_list[ line_index ].color = gameconfig->getConsoleTextColor();
line_list[ line_index ].visible = true;
line_list[ line_index ].life_timer.reset();
@@ -261,7 +261,7 @@
current_line.y = current_line.y - line_offset.y;
- surface.bltStringShadowed(current_line, inputPrompt,
GameConfig::getConsoleTextColor(), Color::black );
+ surface.bltStringShadowed(current_line, inputPrompt,
gameconfig->getConsoleTextColor(), Color::black );
int CHAR_XPIX = 8; // XXX hardcoded
input_offset.x = current_line.x + ( (long) strlen( inputPrompt ) ) *
CHAR_XPIX;
@@ -276,9 +276,9 @@
string_ptr = inputString;
}
- surface.bltStringShadowed(input_offset, string_ptr ,
GameConfig::getConsoleTextColor(), Color::black );
+ surface.bltStringShadowed(input_offset, string_ptr ,
gameconfig->getConsoleTextColor(), Color::black );
- surface.bltStringShadowed(input_offset.x + cursorPos * CHAR_XPIX,
input_offset.y, "_", GameConfig::getConsoleTextColor(), Color::black );
+ surface.bltStringShadowed(input_offset.x + cursorPos * CHAR_XPIX,
input_offset.y, "_", gameconfig->getConsoleTextColor(), Color::black );
}
}
Index: netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp:1.11
netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp:1.12
--- netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp:1.11 Fri Oct 3
10:45:09 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp Sat Oct 4 10:44:38 2003
@@ -24,121 +24,109 @@
#include "XmlConfig.hpp"
#include "XmlStore.hpp"
-std::string GameConfig::configfile;
-char GameConfig::UnitColor;
-char GameConfig::GameMode; //Skirmish or Multiplayer
-char GameConfig::GameType; //Objectives, FragLimit, TimeLimit
-char GameConfig::HostOrJoin; // 1=host, 2=join
-char GameConfig::VehicleGeneration;
-short GameConfig::NumberPlayers = 8; //max = 25;
-short GameConfig::NumberUnits = 500; //max = 50;
-short GameConfig::NumberInitialUnits = 5;
-
-char GameConfig::PlayerName[64];
-
-short GameConfig::PlayerFlag;
-
-int GameConfig::NetworkConnectionType = _connection_tcpip;
-int GameConfig::TimeLimit = 50; //in minutes
-int GameConfig::FragLimit = 1000; //in frags;
-
-bool GameConfig::map_cycling_on_off = false;
-bool GameConfig::powerups_on_off = false;
-
-float GameConfig::objective_occupation_percentage = 100.0;
-bool GameConfig::allow_allies_on_off = true;
-int GameConfig::cloud_coverage;
-float GameConfig::wind_speed;
-unsigned int GameConfig::respawn_type = _game_config_respawn_type_round_robin;
-
-std::string GameConfig::game_map_name;
-
-// ** Visuals Configuration **
-unsigned int GameConfig::screen_resolution = 0;
-bool GameConfig::screen_fullscreen = true;
-
-bool GameConfig::display_shadows_flag = true;
-bool GameConfig::display_unit_flags = false;
-
-bool GameConfig::radar_display_clouds_flag = false;
-
-int GameConfig::radar_player_unit_color = _color_aqua;
-int GameConfig::radar_allied_unit_color = _color_orange;
-int GameConfig::radar_player_outpost_color = _color_blue;
-int GameConfig::radar_allied_outpost_color = _color_orange;
-int GameConfig::radar_enemy_outpost_color = _color_red;
-int GameConfig::vehicle_selection_box_color = _color_blue;
-int GameConfig::console_text_color = _color_white;
-
-int GameConfig::mini_map_unit_size = _mini_map_unit_size_small;
-int GameConfig::unit_selection_box_draw_mode =
_unit_selection_box_draw_mode_rect_edges;
-bool GameConfig::draw_unit_damage = false;
-bool GameConfig::draw_unit_reload = true;
-int GameConfig::mini_map_objective_draw_mode =
_mini_map_objective_draw_mode_outline_rect;
-int GameConfig::unitInfoDrawLayer = 0;
-
-float GameConfig::console_test_delay = 10.0; // in seconds
-int GameConfig::console_text_usage = 25; // in lines
-
-int GameConfig::screen_gamma = 50; // 0..100
-float GameConfig::screen_brightness = 1.0f; // 0..100
-
-float GameConfig::scroll_rate = 1000; // in pixels/s
-int GameConfig::mini_map_resize_rate = 400; // in pixels/s
-
-PlayerUnitConfig GameConfig::unit_spawn_config;
-
-int GameConfig::attackNotificationTime = 5;
-bool GameConfig::blendSmoke = true;
-
-
-void GameConfig::initialize(const char* newconfigfile)
+GameConfig::GameConfig(const std::string& newconfigfile)
+ // VariableName("Name", value [, minimum, maximum])
+ : gametype("gametype", _gametype_objective, 0, _gametype_last-1),
+ hostorjoin("hostorjoin", _game_session_join, 0, _game_session_last-1),
+ playername("name", "Player"),
+ vehicelgeneration("vehiclegeneration", true),
+ maxplayers("maxplayers", 8, 1, 25),
+ maxunits("maxunits", 500, 25, 10000),
+ initialunits("initialunits", 5, 0, 100),
+ timelimit("timelimit", 50, 1),
+ fraglimit("fraglimit", 500, 50),
+ mapcycling("mapcycling", false),
+ powerups("powerups", true),
+ objectiveoccupationpercentage("objectivepercentage", 100, 1, 100),
+ allowallies("allowallies", true),
+ cloudcoverage("cloudcoverage", 0),
+ respawntype("respawntype", _game_config_respawn_type_random, 0,
+ _game_config_respawn_type_last-1),
+ windspeed("windspeed", 0),
+ map("map"),
+
+ screenresolution("resolution", 0, 0, 2),
+ fullscreen("fullscreen", true),
+ displayshadows("displayshadows", true),
+ blendsmoke("blendsmoke", true),
+ screengamma("gamma", 50, 0, 100),
+
+ unitcolor("unitcolor", 0, 0, _color_last-1),
+ playerflag("playerflag", 0, 0, 100),
+ attacknotificationtime("attacknotificationtime", 5, 0, 100),
+ vehicleselectioncolor("vehicleselectioncolor", _color_blue, 0,
_color_last-1),
+ consoletextcolor("consoletextcolor", _color_white, 0, _color_last-1),
+ unitselectionmode("unitselectionmode",
_unit_selection_box_draw_mode_rect_edges, 0,
_unit_selection_box_draw_mode_last-1),
+ unitinfodrawlayer("unitinfodrawlayer", 0, 0, 1),
+ drawunitdamage("drawunitdamage", true),
+ drawunitreload("drawunitreload", false),
+ drawunitflags("drawunitflags", true),
+ consoletextdelay("consoletextdelay", 3, 1, 20),
+ consoletextusage("consoletextusage", 25, 1, 100),
+ scrollrate("scrollrate", 1000, 100, 10000),
+
+ radar_displayclouds("displayclouds", false),
+ radar_playerunitcolor("playerunitcolor", _color_aqua, 0, _color_last-1),
+ radar_alliedunitcolor("alliedunitcolor", _color_orange, 0,
_color_last-1),
+ radar_playeroutpostcolor("playeroutpostcolor", _color_blue, 0,
_color_last-1),
+ radar_alliedoutpostcolor("alliedoutpostcolor", _color_orange, 0,
_color_last),
+ radar_enemyoutpostcolor("enemyoutpostcolor", _color_red, 0,
_color_last-1),
+ radar_unitsize("unitsize", _mini_map_unit_size_small, 0,
_mini_map_unit_size_last-1),
+ radar_objectivedrawmode("objectivedrawmode",
_mini_map_objective_draw_mode_outline_rect, 0,
_mini_map_objective_draw_mode_last-1),
+ radar_resizerate("resizerate", 400, 10, 1000)
{
configfile = newconfigfile;
- //UnitColor;
- GameMode = _gamemode_multiplayer; //Skirmish or Multiplayer
- GameType = _gametype_objective; //Objectives, FragLimit, TimeLimit
- HostOrJoin = _game_session_join; // 1=host, 2=join
- VehicleGeneration = true;
- NumberPlayers = 8; //max = 25;
- NumberUnits = 500; //max = 50;
- NumberInitialUnits = 5;
-
- strcpy( PlayerName, "Player" );
-
- PlayerFlag = 0;
-
- NetworkConnectionType = _connection_tcpip;
- TimeLimit = 50; //current limit = 120
- FragLimit = 1000; //current limit = 1000;
-
- objective_occupation_percentage = 100.0f;
- allow_allies_on_off = true;
- /* XXX fix warnings...
- cloud_coverage;
- wind_speed;
- */
- respawn_type = _game_config_respawn_type_round_robin;
-
- display_shadows_flag = true;
-
- radar_display_clouds_flag = false;
-
- radar_player_unit_color = _color_aqua;
- radar_allied_unit_color = _color_orange;
- radar_player_outpost_color = _color_blue;
- radar_allied_outpost_color = _color_orange;
- radar_enemy_outpost_color = _color_red;
-
- console_test_delay = 3.0; // in seconds
- console_text_usage = 25; // in lines
- screen_gamma = 50; // 0..100
- screen_brightness = 1.0f; // 0..100
+ gamesettings.push_back(&gametype);
+ //gamesettings.push_back(&hostorjoin);
- scroll_rate = 1000; // in pixels/s
- mini_map_resize_rate = 400; // in pixels/s
+ playersettings.push_back(&playername);
+ serversettings.push_back(&vehicelgeneration);
+ serversettings.push_back(&maxplayers);
+ serversettings.push_back(&maxunits);
+ serversettings.push_back(&initialunits);
+ serversettings.push_back(&timelimit);
+ serversettings.push_back(&fraglimit);
+ serversettings.push_back(&mapcycling);
+ serversettings.push_back(&powerups);
+ serversettings.push_back(&objectiveoccupationpercentage);
+ serversettings.push_back(&allowallies);
+ serversettings.push_back(&cloudcoverage);
+ serversettings.push_back(&respawntype);
+ serversettings.push_back(&windspeed);
+ serversettings.push_back(&map);
+
+ visualssettings.push_back(&screenresolution);
+ visualssettings.push_back(&fullscreen);
+ visualssettings.push_back(&displayshadows);
+ visualssettings.push_back(&blendsmoke);
+ visualssettings.push_back(&screengamma);
+
+ interfacesettings.push_back(&unitcolor);
+ interfacesettings.push_back(&playerflag);
+ interfacesettings.push_back(&attacknotificationtime);
+ interfacesettings.push_back(&vehicleselectioncolor);
+ interfacesettings.push_back(&consoletextcolor);
+ interfacesettings.push_back(&unitselectionmode);
+ interfacesettings.push_back(&unitinfodrawlayer);
+ interfacesettings.push_back(&drawunitdamage);
+ interfacesettings.push_back(&drawunitreload);
+ interfacesettings.push_back(&drawunitflags);
+ interfacesettings.push_back(&consoletextdelay);
+ interfacesettings.push_back(&consoletextusage);
+ interfacesettings.push_back(&scrollrate);
+
+ radarsettings.push_back(&radar_displayclouds);
+ radarsettings.push_back(&radar_playerunitcolor);
+ radarsettings.push_back(&radar_alliedunitcolor);
+ radarsettings.push_back(&radar_playeroutpostcolor);
+ radarsettings.push_back(&radar_alliedoutpostcolor);
+ radarsettings.push_back(&radar_enemyoutpostcolor);
+ radarsettings.push_back(&radar_unitsize);
+ radarsettings.push_back(&radar_objectivedrawmode);
+ radarsettings.push_back(&radar_resizerate);
+
try {
loadConfig();
} catch(Exception e) {
@@ -146,7 +134,7 @@
}
}
-void GameConfig::shutdown()
+GameConfig::~GameConfig()
{
try {
saveConfig();
@@ -160,48 +148,91 @@
const char *xmlfile = FileSystem::getRealName(configfile.c_str()).c_str();
XmlConfig config(xmlfile);
- int configversion = config.readInt("version");
- if (configversion != CONFIG_VERSION) {
- throw Exception("wrong config file version, %d!=%d",
- configversion, CONFIG_VERSION);
- }
+ loadSettings(config, "game", gamesettings);
+ loadSettings(config, "player", playersettings);
+ loadSettings(config, "visuals", visualssettings);
+ loadSettings(config, "interface", interfacesettings);
+ loadSettings(config, "server", serversettings);
+}
- XmlConfig game = config.getChild("game");
- GameMode = game.readInt("mode", GameMode);
- GameType = game.readInt("type", GameType);
- NumberPlayers = game.readInt("players", NumberPlayers);
- NumberUnits = game.readInt("units", NumberUnits);
- NumberInitialUnits = game.readInt("init_units", NumberInitialUnits);
-
- XmlConfig visuals = config.getChild("visuals");
- screen_resolution = visuals.readInt("resolution", screen_resolution);
- screen_fullscreen = visuals.readInt("fullscreen", screen_fullscreen);
- display_shadows_flag = visuals.readInt("shadows_flag",
- display_shadows_flag);
- display_unit_flags = visuals.readInt("unit_flags", display_unit_flags);
- mini_map_unit_size = visuals.readInt("mini_map_unit_size",
- mini_map_unit_size);
+void GameConfig::loadSettings(XmlConfig& config, const char* name,
+ std::vector<ConfigVariable*>& settings)
+{
+ try {
+ XmlConfig section = config.getChild(name);
+
+ std::vector<ConfigVariable*>::iterator i;
+ for(i = settings.begin(); i != settings.end(); i++) {
+ ConfigVariable* var = *i;
+
+ try {
+ ConfigInt* confint = dynamic_cast<ConfigInt*> (var);
+ if(confint)
+ *confint = section.readInt(confint->getName().c_str());
+ ConfigBool* confbool = dynamic_cast<ConfigBool*> (var);
+ if(confbool) {
+ std::string str =
+ section.readString(confbool->getName().c_str());
+ if(str == "yes" || str == "1" || str == "on")
+ *confbool = true;
+ else if(str == "no" || str == "0" || str == "off")
+ *confbool = false;
+ else
+ throw Exception("No boolean value for setting '%s'.",
+ confbool->getName().c_str());
+ }
+ ConfigString* confstring = dynamic_cast<ConfigString*> (var);
+ if(confstring)
+ *confstring =
+ section.readString(confstring->getName().c_str());
+ } catch(Exception& e) {
+ LOG(("Skipping config '%s': %s", var->getName().c_str(),
+ e.getMessage()));
+ }
+ }
+ } catch(Exception& e) {
+ LOG(("Couldn't find config section '%s', skipping...", name));
+ }
}
void GameConfig::saveConfig()
{
XmlStore xmlStore("netpanzer");
- xmlStore.writeInt("version", CONFIG_VERSION);
- XmlStore game = xmlStore.createChild("game");
- game.writeInt("mode", GameMode);
- game.writeInt("type", GameType);
- game.writeInt("players", NumberPlayers);
- game.writeInt("units", NumberUnits);
- game.writeInt("init_units", NumberInitialUnits);
-
- XmlStore visuals = xmlStore.createChild("visuals");
- visuals.writeInt("resolution", screen_resolution);
- visuals.writeInt("fullscreen", screen_fullscreen);
- visuals.writeInt("shadows_flag", display_shadows_flag);
- visuals.writeInt("unit_flags", display_unit_flags);
- visuals.writeInt("mini_map_unit_size", mini_map_unit_size);
+ saveSettings(xmlStore, "game", gamesettings);
+ saveSettings(xmlStore, "player", playersettings);
+ saveSettings(xmlStore, "visuals", visualssettings);
+ saveSettings(xmlStore, "interface", interfacesettings);
+ saveSettings(xmlStore, "server", serversettings);
xmlStore.save(configfile.c_str());
}
+void GameConfig::saveSettings(XmlStore& xmlstore, const char* name,
+ std::vector<ConfigVariable*>& settings)
+{
+ XmlStore store = xmlstore.createChild(name);
+
+ std::vector<ConfigVariable*>::iterator i;
+ for(i = settings.begin(); i != settings.end(); i++) {
+ ConfigVariable* var = *i;
+
+ ConfigInt* confint = dynamic_cast<ConfigInt*> (var);
+ if(confint)
+ store.writeInt(confint->getName().c_str(), *confint);
+
+ ConfigBool* confbool = dynamic_cast<ConfigBool*> (var);
+ if(confbool)
+ store.writeString(confbool->getName().c_str(),
+ *confbool ? "yes" : "no");
+
+ ConfigString* confstring = dynamic_cast<ConfigString*> (var);
+ if(confstring) {
+ const char* string =
+ ((const std::string&)(*confstring)).c_str();
+ store.writeString(confstring->getName().c_str(), string);
+ }
+ }
+}
+
+GameConfig* gameconfig = 0;
Index: netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp:1.10
netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp:1.11
--- netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp:1.10 Fri Oct 3
10:45:09 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp Sat Oct 4 10:44:38 2003
@@ -20,26 +20,29 @@
#include <assert.h>
#include <string.h>
+#include <stdint.h>
+#include <vector>
#include <string>
#include "Surface.hpp"
#include "Color.hpp"
+#include "NoCopy.hpp"
+#include "ConfigVariable.hpp"
#include "PlayerUnitConfig.hpp"
enum { _mini_map_objective_draw_mode_solid_rect,
_mini_map_objective_draw_mode_outline_rect,
- _mini_map_objective_draw_mode_count
- //_mini_map_objective_draw_mode_player_flag,
+ _mini_map_objective_draw_mode_last
};
enum { _mini_map_unit_size_small,
_mini_map_unit_size_large,
- _mini_map_unit_size_count
+ _mini_map_unit_size_last
};
enum { _unit_selection_box_draw_mode_rect,
_unit_selection_box_draw_mode_rect_edges,
- _unit_selection_box_draw_mode_count
+ _unit_selection_box_draw_mode_last
};
enum { _gamemode_skirmish,
@@ -47,12 +50,14 @@
};
enum { _game_session_host,
- _game_session_join
+ _game_session_join,
+ _game_session_last
};
enum { _gametype_objective,
_gametype_fraglimit,
- _gametype_timelimit
+ _gametype_timelimit,
+ _gametype_last
};
enum { _connection_tcpip,
@@ -62,7 +67,8 @@
enum { _game_config_respawn_type_round_robin,
_game_config_respawn_type_random,
- _game_config_respawn_type_max
+ _game_config_respawn_type_max,
+ _game_config_respawn_type_last
};
enum { _game_config_standard_res_640x480,
@@ -87,192 +93,80 @@
_color_white,
_color_gray,
_color_dark_gray,
+ _color_last
};
+class XmlConfig;
+class XmlStore;
-#define _GAME_CONFIG_PLAYER_LIMIT_UPPER 25
-#define _GAME_CONFIG_PLAYER_LIMIT_LOWER 1
-
-#define _GAME_CONFIG_UNIT_LIMIT_UPPER 2000
-#define _GAME_CONFIG_UNIT_LIMIT_LOWER 1
-
-#define _GAME_CONFIG_INITIAL_UNIT_LIMIT_UPPER 10
-#define _GAME_CONFIG_INITIAL_UNIT_LIMIT_LOWER 1
-
-#define _GAME_CONFIG_FRAGLIMIT_UPPER 10000
-#define _GAME_CONFIG_FRAGLIMIT_LOWER 3
-
-#define _GAME_CONFIG_TIMELIMIT_UPPER 1440
-#define _GAME_CONFIG_TIMELIMIT_LOWER 5
-
-#define _GAME_CONFIG_SCROLL_RATE_LIMIT_UPPER 2000
-#define _GAME_CONFIG_SCROLL_RATE_LIMIT_LOWER 100
-
-#define _GAME_CONFIG_MINI_MAP_SCROLL_LIMIT_UPPER 1000
-#define _GAME_CONFIG_MINI_MAP_SCROLL_LIMIT_LOWER 100
-
-// XXX: CHanged the CONFIG_CONSOLE values from doubles to ints (removed .0)
-#define _GAME_CONFIG_CONSOLE_TEXT_DELAY_LIMIT_UPPER 30
-#define _GAME_CONFIG_CONSOLE_TEXT_DELAY_LIMIT_LOWER 1
-
-#define _GAME_CONFIG_CONSOLE_TEXT_USEAGE_LIMIT_UPPER 25
-#define _GAME_CONFIG_CONSOLE_TEXT_USEAGE_LIMIT_LOWER 5
-
-#define _GAME_CONFIG_SCREEN_GAMMA_LIMIT_UPPER 100
-#define _GAME_CONFIG_SCREEN_GAMMA_LIMIT_LOWER 0
-
-const float _GAME_CONFIG_SCREEN_BRIGHTNESS_LIMIT_UPPER = +3.0f;
-const float _GAME_CONFIG_SCREEN_BRIGHTNESS_LIMIT_LOWER = 0.0f;
-
-#define _GAME_CONFIG_SOUND_VOLUME_LIMIT_UPPER 100
-#define _GAME_CONFIG_SOUND_VOLUME_LIMIT_LOWER 0
-
-#define _GAME_CONFIG_ATTACK_NOTIFICATION_TIME_LIMIT_UPPER 30
-#define _GAME_CONFIG_ATTACK_NOTIFICATION_TIME_LIMIT_LOWER 2
-
-// Remember to change this, when the config changes!
-#define CONFIG_VERSION 1
-
-class GameConfig
+class GameConfig : public NoCopy
{
-protected:
- static std::string configfile;
- static char UnitColor;
- static char GameMode; //Skirmish or Multiplayer
- static char GameType; //Objectives, FragLimit, TimeLimit
- static char HostOrJoin; //1=host, 2=join
- static char VehicleGeneration;
- static short NumberPlayers; //max = 25;
- static short NumberUnits; //max = 50;
- static short NumberInitialUnits; //max = 50;
-
- static char PlayerName[64];
-
- static short PlayerFlag;
-
- static int NetworkConnectionType;
- static int TimeLimit; //current limit = 120
- static int FragLimit; //current limit = 1000;
-
- static bool map_cycling_on_off;
- static bool powerups_on_off;
- static float objective_occupation_percentage;
- static bool allow_allies_on_off;
- static int cloud_coverage;
- static unsigned int respawn_type;
- static float wind_speed;
- static int attackNotificationTime;
- static bool blendSmoke;
-
- static std::string game_map_name;
-
- // ** Visuals Configuration **
- static unsigned int screen_resolution;
- static bool screen_fullscreen;
-
- static bool display_shadows_flag;
- static bool display_unit_flags;
-
- static bool radar_display_clouds_flag;
- static int radar_player_unit_color;
- static int radar_allied_unit_color;
- static int radar_player_outpost_color;
- static int radar_allied_outpost_color;
-
- static int radar_enemy_outpost_color;
- static int vehicle_selection_box_color;
- static int console_text_color;
-
- static int mini_map_unit_size;
- static int unit_selection_box_draw_mode;
- static bool draw_unit_damage;
- static bool draw_unit_reload;
- static int mini_map_objective_draw_mode;
- static int unitInfoDrawLayer;
-
- static float console_test_delay; // in seconds
- static int console_text_usage; // in lines
-
- static int screen_gamma;
-
- static float scroll_rate; // in pixels/s
- static int mini_map_resize_rate; // in pixels/s
-
- static float screen_brightness; // [-1.0 ... 1.0]
-
-protected:
- static inline PIX colorEnumToPix( int color_enum )
- {
- switch( color_enum ) {
- case _color_aqua : return( Color::unitAqua );
- case _color_yellow : return( Color::unitYellow );
- case _color_red : return( Color::unitRed );
- case _color_blue : return( Color::unitBlue );
- case _color_dark_blue : return( Color::unitDarkBlue );
- case _color_light_green : return( Color::unitLightGreen );
- case _color_green : return( Color::unitGreen );
- case _color_blue_gray : return( Color::unitBlueGray );
- case _color_dark_red : return( Color::unitDarkRed );
- case _color_black : return( Color::unitBlack );
- case _color_dark_green : return( Color::unitDarkGreen );
- case _color_white : return( Color::unitWhite );
- case _color_light_orange : return( Color::unitLightOrange );
- case _color_orange : return( Color::unitOrange );
- case _color_gray : return( Color::unitGray );
- case _color_dark_gray : return( Color::unitDarkGray );
- } // ** switch
-
- assert(false);
- return( Color::white );
- }
-
- static void loadConfig();
- static void saveConfig();
-
public:
- static PlayerUnitConfig unit_spawn_config;
-
- static void initialize(const char* configfile);
- static void shutdown();
-
- static inline void SetUnitColor(char unit_color)
- {
- UnitColor = unit_color;
- }
-
- static inline char GetUnitColor()
- {
- return(UnitColor);
- }
- //////////////////////////////
-
-
- static inline void SetGameMode(char game_mode)
- {
- GameMode = game_mode;
- }
-
- static inline char GetGameMode()
- {
- return(GameMode);
- }
- //////////////////////////////
+ GameConfig(const std::string& configfile);
+ ~GameConfig();
+ // game Settings
+ ConfigInt gametype; //Objectives, FragLimit, TimeLimit
+ ConfigInt hostorjoin; //1=host, 2=join
+
+ // player settings
+ ConfigString playername;
+
+ // server settings
+ ConfigBool vehicelgeneration;
+ ConfigInt maxplayers;
+ ConfigInt maxunits;
+ ConfigInt initialunits;
+ ConfigInt timelimit;
+ ConfigInt fraglimit;
+ ConfigBool mapcycling;
+ ConfigBool powerups;
+ ConfigInt objectiveoccupationpercentage;
+ ConfigBool allowallies;
+ ConfigInt cloudcoverage;
+ ConfigInt respawntype;
+ ConfigInt windspeed;
+ ConfigString map;
+
+ // Visuals Settings
+ ConfigInt screenresolution;
+ ConfigBool fullscreen;
+ ConfigBool displayshadows;
+ ConfigBool blendsmoke;
+ ConfigInt screengamma;
+
+ // interface settings
+ ConfigInt unitcolor;
+ ConfigInt playerflag;
+ ConfigInt attacknotificationtime;
+ ConfigInt vehicleselectioncolor;
+ ConfigInt consoletextcolor;
+ ConfigInt unitselectionmode;
+ ConfigInt unitinfodrawlayer;
+ ConfigBool drawunitdamage;
+ ConfigBool drawunitreload;
+ ConfigBool drawunitflags;
+ ConfigInt consoletextdelay;
+ ConfigInt consoletextusage;
+ ConfigInt scrollrate;
+
+ // radar settings
+ ConfigBool radar_displayclouds;
+ ConfigInt radar_playerunitcolor;
+ ConfigInt radar_alliedunitcolor;
+ ConfigInt radar_playeroutpostcolor;
+ ConfigInt radar_alliedoutpostcolor;
+ ConfigInt radar_enemyoutpostcolor;
+ ConfigInt radar_unitsize;
+ ConfigInt radar_objectivedrawmode;
+ ConfigInt radar_resizerate;
- static inline void SetGameType(char game_type)
- {
- GameType = game_type;
- }
-
- static inline char GetGameType()
- {
- return(GameType);
- }
- //////////////////////////////
-
- static char * getGameTypeString()
+ PlayerUnitConfig unit_spawn_config;
+
+public:
+ const char* getGameTypeString() const
{
- switch(GameType) {
+ switch(gametype) {
case _gametype_objective :
return( "Objective" );
case _gametype_fraglimit :
@@ -283,331 +177,19 @@
return( "Unknown" );
}
- static inline void SetHostOrJoin(char host_or_join)
- {
- HostOrJoin = host_or_join;
- }
-
- static inline char GetHostOrJoin()
- {
- return(HostOrJoin);
- }
- //////////////////////////////
-
-
- static inline void SetGeneration(char generation)
- {
- VehicleGeneration = generation;
- }
-
- static inline char GetGeneration()
- {
- return(VehicleGeneration);
- }
- //////////////////////////////
-
-
- //this will be more complex later--
- static inline void SetNumberPlayers(short num_players)
- {
- if(num_players < _GAME_CONFIG_PLAYER_LIMIT_LOWER)
- NumberPlayers = _GAME_CONFIG_PLAYER_LIMIT_LOWER;
- else
- if(num_players > _GAME_CONFIG_PLAYER_LIMIT_UPPER )
- NumberPlayers = _GAME_CONFIG_PLAYER_LIMIT_UPPER;
- else NumberPlayers = num_players;
- }
-
- static inline short GetNumberPlayers()
- {
- return(NumberPlayers);
- }
-
- static inline int GetNumberPlayersBoundsLower( void )
- {
- return( _GAME_CONFIG_PLAYER_LIMIT_LOWER );
- }
-
- static inline int GetNumberPlayersBoundsUpper( void )
- {
- return( _GAME_CONFIG_PLAYER_LIMIT_UPPER );
- }
-
- //this will be more complex later--
- static inline void SetNumberUnits(short num_units)
- {
- if(num_units < _GAME_CONFIG_UNIT_LIMIT_LOWER )
- NumberUnits = _GAME_CONFIG_UNIT_LIMIT_LOWER;
- else
- if(num_units > _GAME_CONFIG_UNIT_LIMIT_UPPER )
- NumberUnits = _GAME_CONFIG_UNIT_LIMIT_UPPER ;
- else
- NumberUnits = num_units;
- }
-
- static inline short GetNumberUnits()
- {
- return( NumberUnits );
- }
-
- static inline int getNumberUnitsBoundsUpper( void )
- {
- return( _GAME_CONFIG_UNIT_LIMIT_UPPER);
- }
-
- static inline int getNumberUnitsBoundsLower( void )
- {
- return(_GAME_CONFIG_UNIT_LIMIT_LOWER);
- }
-
- static inline short GetUnitsPerPlayer()
- {
- return( NumberUnits / ((short) NumberPlayers) );
- }
-
- //////////////////////////////
-
- static inline void SetNumberInitialUnits( short num_units )
- {
- if ( num_units < _GAME_CONFIG_INITIAL_UNIT_LIMIT_LOWER ) {
- NumberInitialUnits = _GAME_CONFIG_INITIAL_UNIT_LIMIT_LOWER;
- } else
- if ( num_units > NumberUnits ) {
- num_units = NumberUnits;
- if ( num_units > _GAME_CONFIG_INITIAL_UNIT_LIMIT_UPPER ) {
- NumberInitialUnits = _GAME_CONFIG_INITIAL_UNIT_LIMIT_UPPER
;
- } else {
- NumberInitialUnits = num_units;
- }
- } else
- if ( num_units > _GAME_CONFIG_INITIAL_UNIT_LIMIT_UPPER ) {
- NumberInitialUnits = _GAME_CONFIG_INITIAL_UNIT_LIMIT_UPPER
;
- } else {
- NumberInitialUnits = num_units;
- }
- }
-
- static inline short GetNumberInitialUnits( void )
- {
- return( NumberInitialUnits );
- }
-
- static inline int getNumberInitialUnitsBoundUpper( void )
- {
- return (_GAME_CONFIG_INITIAL_UNIT_LIMIT_UPPER );
- }
-
- static inline int getNumberInitialUnitsBoundLower( void )
- {
- return (_GAME_CONFIG_INITIAL_UNIT_LIMIT_LOWER );
- }
-
- static inline void SetPlayerName(const char *player_name)
- {
- strncpy(PlayerName, player_name, 64);
- PlayerName[63] = '\0';
- }
-
- static inline char *GetPlayerName()
- {
- return(PlayerName);
- }
- //////////////////////////////
-
-
- static inline void SetPlayerFlag(short player_flag)
- {
- PlayerFlag = player_flag;
- }
-
- static inline short GetPlayerFlag()
- {
- return(PlayerFlag);
- }
- //////////////////////////////
-
-
- static inline void SetNetworkConnectType(int network_connect)
- {
- NetworkConnectionType = network_connect;
- }
-
- static inline int GetNetworkConnectType()
- {
- return(NetworkConnectionType);
- }
- //////////////////////////////
-
-
- static inline void SetTimeLimit(int time_limit)
- {
- if(time_limit < _GAME_CONFIG_TIMELIMIT_LOWER)
- TimeLimit = _GAME_CONFIG_TIMELIMIT_LOWER;
- else
- if(time_limit > _GAME_CONFIG_TIMELIMIT_UPPER )
- TimeLimit = _GAME_CONFIG_TIMELIMIT_UPPER;
- else
- TimeLimit = time_limit;
- }
-
- static inline int GetTimeLimit()
- {
- return( TimeLimit );
- }
- //////////////////////////////
-
- static inline int GetTimeLimitSeconds()
- {
- return( TimeLimit * 60 );
- }
-
- static inline int GetTimeLimitBoundsUpper( void )
- {
- return( _GAME_CONFIG_TIMELIMIT_UPPER );
- }
-
- static inline int GetTimeLimitBoundsLower( void )
- {
- return( _GAME_CONFIG_TIMELIMIT_LOWER );
- }
-
- static inline void SetFragLimit(int frag_limit)
- {
- if(frag_limit < _GAME_CONFIG_TIMELIMIT_LOWER)
- FragLimit = _GAME_CONFIG_TIMELIMIT_LOWER;
- else
- if(frag_limit > _GAME_CONFIG_FRAGLIMIT_UPPER)
- FragLimit = _GAME_CONFIG_FRAGLIMIT_UPPER;
- else
- FragLimit = frag_limit;
- }
-
- static inline int GetFragLimit()
- {
- return(FragLimit);
- }
- //////////////////////////////
-
- static inline int GetFragLimitBoundsUpper( void )
- {
- return( _GAME_CONFIG_FRAGLIMIT_UPPER );
- }
-
- static inline int GetFragLimitBoundsLower( void )
- {
- return( _GAME_CONFIG_FRAGLIMIT_LOWER );
- }
-
- static inline void increaseObjectiveOccuapationPercentage( void )
- {
- if ( (objective_occupation_percentage + 10) > 100 ) {
- objective_occupation_percentage = 100;
- } else {
- objective_occupation_percentage =
(objective_occupation_percentage + 10);
- }
- }
-
- static inline void decreaseObjectiveOccuapationPercentage( void )
- {
- if ( (objective_occupation_percentage - 10) < 20 ) {
- objective_occupation_percentage = 20;
- } else {
- objective_occupation_percentage =
(objective_occupation_percentage - 10);
- }
- }
-
- static inline float getObjectiveOccuapationPercentage()
- {
- return( objective_occupation_percentage );
- }
-
- static inline float getObjectiveOccuapationPercentageDecimal()
- {
- return( objective_occupation_percentage / 100 );
- }
-
- static inline void setObjectiveOccuapationPercentage( float percent )
- {
- if( percent < 20 ) {
- objective_occupation_percentage = 20;
- } else
- if( percent > 100 ) {
- objective_occupation_percentage = 100;
- } else {
- objective_occupation_percentage = percent;
- }
- }
-
- static inline void setMapCycleState( bool on_off )
- {
- map_cycling_on_off = on_off;
- }
-
- static inline bool getMapCycleState( void )
- {
- return( map_cycling_on_off );
- }
-
- static inline char * getMapCycleString( void )
- {
- if ( map_cycling_on_off == true ) {
- return( "Yes" );
- } else {
- return( "No" );
- }
- }
-
- static inline void setPowerUpState( bool on_off )
+ int GetUnitsPerPlayer() const
{
- powerups_on_off= on_off;
+ return maxunits / maxplayers;
}
- static inline bool getPowerUpState( void )
+ int GetTimeLimitSeconds() const
{
- return( powerups_on_off );
+ return timelimit * 60;
}
- static inline char * getPowerUpString( void )
+ const char * getRespawnTypeString() const
{
- if ( powerups_on_off == true ) {
- return( "Yes" );
- } else {
- return( "No" );
- }
- }
-
- static inline void setAllieState( bool on_off )
- {
- allow_allies_on_off = on_off;
- }
-
- static inline bool getAllieState( void )
- {
- return( allow_allies_on_off );
- }
-
- static inline char * getAllieStateString( void )
- {
- if ( allow_allies_on_off == true ) {
- return( "Yes" );
- } else {
- return( "No" );
- }
- }
-
- static inline void setNextRespawnType( void )
- {
- respawn_type = (respawn_type + 1) % _game_config_respawn_type_max;
- }
-
- static inline void setPreviousRespawnType( void )
- {
- respawn_type = (respawn_type - 1) % _game_config_respawn_type_max;
- }
-
- static inline char * getRespawnTypeString( void )
- {
- switch( respawn_type ) {
+ switch( respawntype ) {
case _game_config_respawn_type_round_robin :
return( "Round Robin" );
break;
@@ -625,625 +207,100 @@
return( "Unknown" );
}
- static inline void setCloudCoverage( int cloud_coverage )
- {
- GameConfig::cloud_coverage = cloud_coverage;
- }
-
- static inline int getCloudCoverage( void )
- {
- return( cloud_coverage );
- }
-
- static inline void setWindSpeed( float
FUCK_FUCK_FUCK_FUCK_FUCK_FUCK_FUCK_FUCK_FUCK )
- {
- GameConfig::wind_speed = FUCK_FUCK_FUCK_FUCK_FUCK_FUCK_FUCK_FUCK_FUCK;
- }
-
- static inline float getWindSpeed( void )
+ PIX getUnitColor() const
{
- return( wind_speed );
+ return colorEnumToPix(unitcolor);
}
- static void setGameMapName(const std::string& mapname)
- { game_map_name = mapname; }
- static const std::string& getGameMapName()
- { return game_map_name; }
-
- // ** Visuals Configuration Methods **
- static inline float getScrollRate( void )
+ PIX getPlayerRadarUnitColor() const
{
- return( scroll_rate );
+ return( colorEnumToPix( radar_playerunitcolor ) );
}
-
- static inline void setScrollRate( float rate )
+
+ PIX getAlliedRadarUnitColor() const
{
- if ( rate < _GAME_CONFIG_SCROLL_RATE_LIMIT_LOWER ) {
- scroll_rate = _GAME_CONFIG_SCROLL_RATE_LIMIT_LOWER;
- } else
- if ( rate > _GAME_CONFIG_SCROLL_RATE_LIMIT_UPPER ) {
- scroll_rate = _GAME_CONFIG_SCROLL_RATE_LIMIT_UPPER;
- } else {
- scroll_rate = rate;
- }
+ return( colorEnumToPix( radar_alliedunitcolor ) );
}
- static inline int getScrollRateBoundsUpper( void )
+ PIX getPlayerOutpostRadarColor() const
{
- return( _GAME_CONFIG_SCROLL_RATE_LIMIT_UPPER);
+ return( colorEnumToPix( radar_playeroutpostcolor ) );
}
- static inline int getScrollRateBoundsLower( void )
+ PIX getAlliedOutpostRadarColor() const
{
- return(_GAME_CONFIG_SCROLL_RATE_LIMIT_LOWER);
+ return( colorEnumToPix( radar_alliedoutpostcolor ) );
}
-
- //***********************************************************
- static inline float getMiniMapResizeRate( void )
+
+ PIX getEnemyOutpostRadarColor() const
{
- return( mini_map_resize_rate );
+ return( colorEnumToPix( radar_enemyoutpostcolor ) );
}
-
- static inline void setMiniMapResizeRate( float rate )
+
+ PIX getVehicleSelectionBoxColor() const
{
- if ( rate < _GAME_CONFIG_SCROLL_RATE_LIMIT_LOWER ) {
- mini_map_resize_rate = _GAME_CONFIG_MINI_MAP_SCROLL_LIMIT_LOWER;
- } else
- if ( rate > _GAME_CONFIG_MINI_MAP_SCROLL_LIMIT_UPPER ) {
- mini_map_resize_rate =
_GAME_CONFIG_MINI_MAP_SCROLL_LIMIT_UPPER;
- } else {
- mini_map_resize_rate = (int) rate;
- }
+ return( colorEnumToPix( vehicleselectioncolor ) );
}
- static inline int getMiniMapResizeRateBoundsUpper( void )
+ PIX getConsoleTextColor() const
{
- return( _GAME_CONFIG_MINI_MAP_SCROLL_LIMIT_UPPER);
+ return( colorEnumToPix( consoletextcolor ) );
}
- static inline int getMiniMapResizeRateBoundsLower( void )
+ const char *getMiniMapUnitSizeString() const
{
- return(_GAME_CONFIG_MINI_MAP_SCROLL_LIMIT_LOWER);
+ if (radar_unitsize == _mini_map_unit_size_small) {
+ return( "Small" );
+ } else if (radar_unitsize == _mini_map_unit_size_large) {
+ return( "Large" );
+ } else assert(false);
+ return( "Undefined value" );
}
- //***********************************************************
- static inline int getScreenGamma( void )
- {
- return( screen_gamma );
- }
+private:
+ std::string configfile;
- static inline void setScreenGamma( int gamma )
+ PIX colorEnumToPix(int color_enum) const
{
- if ( gamma < _GAME_CONFIG_SCREEN_GAMMA_LIMIT_LOWER ) {
- screen_gamma = _GAME_CONFIG_SCREEN_GAMMA_LIMIT_LOWER;
- } else
- if ( gamma > _GAME_CONFIG_SCREEN_GAMMA_LIMIT_UPPER ) {
- screen_gamma = _GAME_CONFIG_SCREEN_GAMMA_LIMIT_UPPER;
- } else {
- screen_gamma = gamma;
- }
- }
+ switch( color_enum ) {
+ case _color_aqua : return( Color::unitAqua );
+ case _color_yellow : return( Color::unitYellow );
+ case _color_red : return( Color::unitRed );
+ case _color_blue : return( Color::unitBlue );
+ case _color_dark_blue : return( Color::unitDarkBlue );
+ case _color_light_green : return( Color::unitLightGreen );
+ case _color_green : return( Color::unitGreen );
+ case _color_blue_gray : return( Color::unitBlueGray );
+ case _color_dark_red : return( Color::unitDarkRed );
+ case _color_black : return( Color::unitBlack );
+ case _color_dark_green : return( Color::unitDarkGreen );
+ case _color_white : return( Color::unitWhite );
+ case _color_light_orange : return( Color::unitLightOrange );
+ case _color_orange : return( Color::unitOrange );
+ case _color_gray : return( Color::unitGray );
+ case _color_dark_gray : return( Color::unitDarkGray );
+ } // ** switch
- static inline float getScreenGammaBoundsUpper( void )
- {
- return( _GAME_CONFIG_SCREEN_GAMMA_LIMIT_UPPER);
+ assert(false);
+ return( Color::white );
}
- static inline float getScreenGammaBoundsLower( void )
- {
- return(_GAME_CONFIG_SCREEN_GAMMA_LIMIT_LOWER);
- }
+ void loadConfig();
+ void saveConfig();
+
+ void loadSettings(XmlConfig& config, const char* name,
+ std::vector<ConfigVariable*>& settings);
+ void saveSettings(XmlStore& config, const char* name,
+ std::vector<ConfigVariable*>& settings);
+
+ std::vector<ConfigVariable*> gamesettings;
+ std::vector<ConfigVariable*> playersettings;
+ std::vector<ConfigVariable*> serversettings;
+ std::vector<ConfigVariable*> visualssettings;
+ std::vector<ConfigVariable*> interfacesettings;
+ std::vector<ConfigVariable*> radarsettings;
+};
- //***********************************************************
- static inline float getScreenBrightness( void )
- {
- return( screen_brightness );
- }
-
- static inline void setScreenBrightness( float brightness )
- {
- if ( brightness < _GAME_CONFIG_SCREEN_BRIGHTNESS_LIMIT_LOWER ) {
- screen_brightness = _GAME_CONFIG_SCREEN_BRIGHTNESS_LIMIT_LOWER;
- } else
- if ( brightness > _GAME_CONFIG_SCREEN_BRIGHTNESS_LIMIT_UPPER ) {
- screen_brightness = _GAME_CONFIG_SCREEN_BRIGHTNESS_LIMIT_UPPER;
- } else {
- screen_brightness = brightness;
- }
- }
-
- static inline float getScreenBrightnessBoundsUpper( void )
- {
- return( _GAME_CONFIG_SCREEN_BRIGHTNESS_LIMIT_UPPER);
- }
-
- static inline float getScreenBrightnessBoundsLower( void )
- {
- return(_GAME_CONFIG_SCREEN_BRIGHTNESS_LIMIT_LOWER);
- }
-
- //***********************************************************
- static inline int getConsoleTextUsage( void )
- {
- return( console_text_usage );
- }
-
- static inline void setConsoleTextUsage( int lines )
- {
- if ( lines < _GAME_CONFIG_CONSOLE_TEXT_USEAGE_LIMIT_LOWER ) {
- console_text_usage = _GAME_CONFIG_CONSOLE_TEXT_USEAGE_LIMIT_LOWER;
- } else
- if ( lines > _GAME_CONFIG_CONSOLE_TEXT_USEAGE_LIMIT_UPPER ) {
- console_text_usage =
_GAME_CONFIG_CONSOLE_TEXT_USEAGE_LIMIT_UPPER;
- } else {
- console_text_usage = lines;
- }
- }
-
- static inline int getConsoleTextUsageBoundsUpper( void )
- {
- return( _GAME_CONFIG_CONSOLE_TEXT_USEAGE_LIMIT_UPPER);
- }
-
- static inline int getConsoleTextUsageBoundsLower( void )
- {
- return(_GAME_CONFIG_CONSOLE_TEXT_USEAGE_LIMIT_LOWER);
- }
-
-
- //***********************************************************
- static inline float getConsoleTextDelay( void )
- {
- return( console_test_delay );
- }
-
- static inline void setConsoleTextDelay( float delay )
- {
- if ( delay < _GAME_CONFIG_CONSOLE_TEXT_DELAY_LIMIT_LOWER ) {
- console_test_delay = _GAME_CONFIG_CONSOLE_TEXT_DELAY_LIMIT_LOWER;
- } else
- if ( delay > _GAME_CONFIG_CONSOLE_TEXT_DELAY_LIMIT_UPPER ) {
- console_test_delay =
_GAME_CONFIG_CONSOLE_TEXT_DELAY_LIMIT_UPPER;
- } else {
- console_test_delay = delay;
- }
- }
-
- static inline int getConsoleTextDelayBoundsUpper( void )
- {
- return( _GAME_CONFIG_CONSOLE_TEXT_DELAY_LIMIT_UPPER);
- }
-
- static inline int getConsoleTextDelayBoundsLower( void )
- {
- return(_GAME_CONFIG_CONSOLE_TEXT_DELAY_LIMIT_LOWER);
- }
-
- //***********************************************************
-
- static inline void setPlayerRadarUnitColor( int color )
- {
- radar_player_unit_color = color;
- }
-
- static inline PIX getPlayerRadarUnitColor( void )
- {
- return( colorEnumToPix( radar_player_unit_color ) );
- }
-
- static inline PIX getPlayerRadarUnitColorEnum( void )
- {
- return( radar_player_unit_color );
- }
-
- //***********************************************************
-
- static inline void setAlliedRadarUnitColor( int color )
- {
- radar_allied_unit_color = color;
- }
-
- static inline PIX getAlliedRadarUnitColor( void )
- {
- return( colorEnumToPix( radar_allied_unit_color ) );
- }
-
- static inline PIX getAlliedRadarUnitColorEnum( void )
- {
- return( radar_allied_unit_color );
- }
-
- //***********************************************************
-
- static inline void setPlayerOutpostRadarColor( int color )
- {
- radar_player_outpost_color = color;
- }
-
- static inline PIX getPlayerOutpostRadarColor( void )
- {
- return( colorEnumToPix( radar_player_outpost_color ) );
- }
-
- static inline PIX getPlayerOutpostRadarColorEnum( void )
- {
- return( radar_player_outpost_color );
- }
-
- //***********************************************************
-
- static inline void setAlliedOutpostRadarColor( int color )
- {
- radar_allied_outpost_color = color;
- }
-
- static inline PIX getAlliedOutpostRadarColor( void )
- {
- return( colorEnumToPix( radar_allied_outpost_color ) );
- }
-
- static inline PIX getAlliedOutpostRadarColorEnum( void )
- {
- return( radar_allied_outpost_color );
- }
-
- //***********************************************************
-
- static inline void setEnemyOutpostRadarColor( int color )
- {
- radar_enemy_outpost_color = color;
- }
-
- static inline PIX getEnemyOutpostRadarColor( void )
- {
- return( colorEnumToPix( radar_enemy_outpost_color ) );
- }
-
- static inline PIX getEnemyOutpostRadarColorEnum( void )
- {
- return( radar_enemy_outpost_color );
- }
-
- //***********************************************************
-
- static inline void setVehicleSelectionBoxColor( int color )
- {
- vehicle_selection_box_color = color;
- }
-
- static inline PIX getVehicleSelectionBoxColor( void )
- {
- return( colorEnumToPix( vehicle_selection_box_color ) );
- }
-
- static inline PIX getVehicleSelectionBoxColorEnum( void )
- {
- return( vehicle_selection_box_color );
- }
-
- //***********************************************************
-
- static inline void setConsoleTextColor( int color )
- {
- console_text_color = color;
- }
-
- static inline PIX getConsoleTextColor( void )
- {
- return( colorEnumToPix( console_text_color ) );
- }
-
- static inline PIX getConsoleTextColorEnum( void )
- {
- return( console_text_color );
- }
-
- //***********************************************************
-
- static inline void setDisplayCloudsOnRadarFlag( bool on_off )
- {
- radar_display_clouds_flag = on_off;
- }
-
- static inline bool getDisplayCloudsOnRadarFlag( void )
- {
- return( radar_display_clouds_flag );
- }
-
- static inline char * getDisplayCloudsOnRadarFlagString( void )
- {
- if ( radar_display_clouds_flag == true ) {
- return( "On" );
- } else {
- return( "Off" );
- }
- }
-
- //***********************************************************
-
- static inline void setDisplayShadowsFlag( bool on_off )
- {
- display_shadows_flag = on_off;
- }
-
- static inline bool getDisplayShadowsFlag( void )
- {
- return( display_shadows_flag );
- }
-
- static inline char * getDisplayShadowsFlagString( void )
- {
- if ( display_shadows_flag == true ) {
- return( "On" );
- } else {
- return( "Off" );
- }
- }
-
- //***********************************************************
-
- static inline void setDisplayUnitFlags( bool on_off )
- {
- display_unit_flags = on_off;
- }
-
- static inline void toggleDisplayUnitFlags( void )
- {
- display_unit_flags = !display_unit_flags;
- }
-
- static inline bool getDisplayUnitFlags( void )
- {
- return( display_unit_flags );
- }
-
- static void setScreenResolution(int newres)
- {
- screen_resolution = newres;
- }
-
- static int getScreenResolution()
- {
- return screen_resolution;
- }
-
- static void setFullscreen(bool fullscreen)
- {
- screen_fullscreen = fullscreen;
- }
-
- static bool getFullscreen()
- {
- return screen_fullscreen;
- }
-
- //***********************************************************
- static inline void increaseAttackNotificationTime()
- {
- if (++attackNotificationTime >
_GAME_CONFIG_ATTACK_NOTIFICATION_TIME_LIMIT_UPPER) {
- attackNotificationTime =
_GAME_CONFIG_ATTACK_NOTIFICATION_TIME_LIMIT_UPPER;
- }
-
- }
- static inline void decreaseAttackNotificationTime()
- {
- if (--attackNotificationTime <
_GAME_CONFIG_ATTACK_NOTIFICATION_TIME_LIMIT_LOWER) {
- attackNotificationTime =
_GAME_CONFIG_ATTACK_NOTIFICATION_TIME_LIMIT_LOWER;
- }
-
- }
-
- static inline int getAttackNotificationTime()
- {
- return attackNotificationTime;
- }
-
- //***********************************************************
-
- static inline void setBlendSmokeTrue()
- {
- blendSmoke = true;
- }
-
- static inline void setBlendSmokeFalse()
- {
- blendSmoke = false;
- }
-
- static inline bool getBlendSmoke()
- {
- return( blendSmoke );
- }
-
- static inline const char *getBlendSmokeString()
- {
- if (blendSmoke == true) {
- return "On";
- }
-
- return "Off";
- }
-
- //***********************************************************
-
- static inline void setNextMiniMapUnitSize( void )
- {
- if (++mini_map_unit_size >= _mini_map_unit_size_count) {
- mini_map_unit_size = 0;
- }
- }
-
- static inline void setPreviousMiniMapUnitSize( void )
- {
- if (--mini_map_unit_size < 0) {
- mini_map_unit_size = _mini_map_unit_size_count - 1;
- }
- }
-
- static inline void setMiniMapUnitSize( int enumValue )
- {
- assert(enumValue < _mini_map_unit_size_count);
-
- mini_map_unit_size = enumValue;
- }
-
- static inline int getMiniMapUnitSize( void )
- {
- return( mini_map_unit_size );
- }
-
- static inline const char *getMiniMapUnitSizeString( void )
- {
- if (mini_map_unit_size == _mini_map_unit_size_small) {
- return( "Small" );
- } else if (mini_map_unit_size == _mini_map_unit_size_large) {
- return( "Large" );
- } else assert(false);
- return( "Undefined value" );
- }
-
- //***********************************************************
-
- static inline void setNextUnitSelectionBoxDrawMode( void )
- {
- if (++unit_selection_box_draw_mode >=
_unit_selection_box_draw_mode_count) {
- unit_selection_box_draw_mode = 0;
- }
- }
-
- static inline void setPreviousUnitSelectionBoxDrawMode( void )
- {
- if (--unit_selection_box_draw_mode < 0) {
- unit_selection_box_draw_mode = _unit_selection_box_draw_mode_count
- 1;
- }
- }
-
- static inline void setUnitSelectionBoxDrawMode( int enumValue )
- {
- assert(enumValue < _unit_selection_box_draw_mode_count);
-
- unit_selection_box_draw_mode = enumValue;
- }
-
- static inline int getUnitSelectionBoxDrawMode( void )
- {
- return( unit_selection_box_draw_mode );
- }
-
- static inline const char *getUnitSelectionBoxDrawModeString( void )
- {
- if (unit_selection_box_draw_mode ==
_unit_selection_box_draw_mode_rect) {
- return( "Rectangle" );
- } else if (unit_selection_box_draw_mode ==
_unit_selection_box_draw_mode_rect_edges) {
- return( "Rectangle Edges" );
- } else assert(false);
- return( "Undefined value" );
- }
-
- //***********************************************************
-
- static inline void setDrawUnitDamage( int value )
- {
- draw_unit_damage = value;
- }
-
- static inline void toggleDrawUnitDamage( void )
- {
- draw_unit_damage = !draw_unit_damage;
- }
-
- static inline bool getDrawUnitDamage( void )
- {
- return( draw_unit_damage );
- }
-
- //***********************************************************
-
- static inline void setDrawUnitReload( int value )
- {
- draw_unit_reload = value;
- }
-
- static inline void toggleDrawUnitReload( void )
- {
- draw_unit_reload = !draw_unit_reload;
- }
-
- static inline bool getDrawUnitReload( void )
- {
- return( draw_unit_reload );
- }
-
- //***********************************************************
-
- static inline void setNextMiniMapObjectiveDrawMode( void )
- {
- if (++mini_map_objective_draw_mode >=
_mini_map_objective_draw_mode_count) {
- mini_map_objective_draw_mode = 0;
- }
- }
-
- static inline void setMiniMapObjectiveDrawMode( int enumValue )
- {
- assert(enumValue < _mini_map_objective_draw_mode_count);
-
- mini_map_objective_draw_mode = enumValue;
- }
-
- static inline void setPreviousMiniMapObjectiveDrawMode( void )
- {
- if (--mini_map_objective_draw_mode < 0) {
- mini_map_objective_draw_mode = _mini_map_objective_draw_mode_count
- 1;
- }
- }
-
- static inline int getMiniMapObjectiveDrawMode( void )
- {
- return( mini_map_objective_draw_mode );
- }
-
- static inline const char *getMiniMapObjectiveDrawModeString( void )
- {
- if (mini_map_objective_draw_mode ==
_mini_map_objective_draw_mode_solid_rect) {
- return( "Solid Rectangle" );
- } else if (mini_map_objective_draw_mode ==
_mini_map_objective_draw_mode_outline_rect) {
- return( "Outlined Rectangle" );
- }
- //else if (mini_map_objective_draw_mode ==
_mini_map_objective_draw_mode_player_flag) { return( "Player Flag" );}
- else assert(false);
- return( "Undefined value" );
- }
-
- //***********************************************************
- static inline void setUnitInfoDrawLayerTop()
- {
- unitInfoDrawLayer = 7;
- }
-
- static inline void setUnitInfoDrawLayerBottom()
- {
- unitInfoDrawLayer = 0;
- }
-
- static inline void toggleUnitInfoDrawLayer()
- {
- unitInfoDrawLayer = (( unitInfoDrawLayer == 7 ) ? 0 : 7);
- }
-
- static inline int getUnitInfoDrawLayer()
- {
- return( unitInfoDrawLayer );
- }
-
- static inline const char *getUnitInfoDrawLayerString()
- {
- if ( unitInfoDrawLayer == 0 ) {
- return( "Bottom" );
- } else if ( unitInfoDrawLayer == 7 ) {
- return( "Top" );
- }
- return "Undefined value";
- }
-};
+extern GameConfig* gameconfig;
#endif // ** __GAMECONFIG_HPP
Index: netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.cpp:1.4
netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.cpp:1.5
--- netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.cpp:1.4 Tue Sep
16 16:16:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.cpp Sat Oct
4 10:44:38 2003
@@ -175,7 +175,7 @@
GameManager::shutdownParticleSystems();
MapsManager::cycleNextMapName( map_name );
- GameConfig::setGameMapName( map_name );
+ gameconfig->map = map_name;
GameControlCycleMap cycle_map_mesg;
cycle_map_mesg.set( map_name );
@@ -276,7 +276,7 @@
{
PlayerInterface::lockPlayerStats();
- if( GameConfig::getMapCycleState() == true ) {
+ if( gameconfig->mapcycling == true ) {
map_cycle_fsm_server_state =
_map_cycle_server_state_display_endgame_views;
GameManager::game_state = _game_state_completed;
} else {
@@ -298,7 +298,7 @@
{
PlayerInterface::lockPlayerStats();
- if( GameConfig::getMapCycleState() == true ) {
+ if( gameconfig->mapcycling == true ) {
map_cycle_fsm_server_state =
_map_cycle_server_state_display_endgame_views;
GameManager::game_state = _game_state_completed;
} else {
@@ -321,7 +321,7 @@
{
PlayerInterface::lockPlayerStats();
- if( GameConfig::getMapCycleState() == true ) {
+ if( gameconfig->mapcycling == true ) {
map_cycle_fsm_server_state =
_map_cycle_server_state_display_endgame_views;
GameManager::game_state = _game_state_completed;
} else {
@@ -341,7 +341,7 @@
void GameControlRulesDaemon::forceMapCycle( void )
{
- if( GameConfig::getMapCycleState() == true ) {
+ if( gameconfig->mapcycling == true ) {
map_cycle_fsm_server_state =
_map_cycle_server_state_display_endgame_views;
GameManager::game_state = _game_state_completed;
}
@@ -355,25 +355,26 @@
(NetworkState::status == _network_state_server)
) {
unsigned char game_type;
- game_type = GameConfig::GetGameType();
+ game_type = gameconfig->gametype;
switch( game_type ) {
case _gametype_timelimit : {
int game_minutes = GameManager::getGameTime() / 60;
- if( game_minutes >= GameConfig::GetTimeLimit() ) {
+ if( game_minutes >= gameconfig->timelimit ) {
onTimelimitGameCompleted();
}
}
case _gametype_fraglimit : {
- if ( PlayerInterface::testRuleScoreLimit(
GameConfig::GetFragLimit(), &player_state ) == true ) {
+ if ( PlayerInterface::testRuleScoreLimit(
gameconfig->fraglimit, &player_state ) == true ) {
onFraglimitGameCompleted();
}
}
break;
case _gametype_objective : {
- if ( PlayerInterface::testRuleObjectiveRatio(
GameConfig::getObjectiveOccuapationPercentageDecimal(), &player_state ) == true
) {
+ if ( PlayerInterface::testRuleObjectiveRatio(
+ gameconfig->objectiveoccupationpercentage,
&player_state ) == true ) {
onObjectiveGameCompleted( );
}
}
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.57
netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.58
--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.57 Fri Oct 3
10:53:37 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.cpp Sat Oct 4 10:44:38 2003
@@ -105,7 +105,6 @@
#include "AreYouSureExitView.hpp"
#include "UnitSelectionView.hpp"
#include "FlagSelectionView.hpp"
-#include "MiniMapOptionsView.hpp"
#include "UnitColorView.hpp"
#include "HostOptionsView.hpp"
#include "MapSelectionView.hpp"
@@ -211,7 +210,6 @@
//Desktop::add(new DesktopView());
//Desktop::add(new UnitColorView());
Desktop::add(new HelpScrollView());
- Desktop::add(new MiniMapOptionsView());
Desktop::add(new GameToolbarView());
Desktop::add(new GameInfoView());
@@ -260,10 +258,10 @@
{
iXY mode_res;
iXY old_res = screen ? screen->getPix() : iXY(0,0) ;
- bool fullscreen = GameConfig::getFullscreen();
+ bool fullscreen = gameconfig->fullscreen;
int mode;
- for(mode=GameConfig::getScreenResolution(); mode>=0; mode--) {
+ for(mode=gameconfig->screenresolution; mode>=0; mode--) {
switch(mode) {
case 0: mode_res = iXY(640,480); break;
case 1: mode_res = iXY(800,600); break;
@@ -272,7 +270,7 @@
}
if(Screen->isDisplayModeAvailable(mode_res.x, mode_res.y, 8,
fullscreen)) {
- GameConfig::setScreenResolution(mode);
+ gameconfig->screenresolution = mode;
break;
}
}
@@ -316,28 +314,6 @@
}
// ******************************************************************
-void increaseBrightness(const char *filename)
-{
- GameConfig::setScreenBrightness(GameConfig::getScreenBrightness() + 0.1f);
-
- Palette::setBrightnessAbsolute(GameConfig::getScreenBrightness());
-
- Screen->setPalette(Palette::color);
- ConsoleInterface::postMessage( "Increasing Brightness");
-} // end increaseBrightness
-
-// ******************************************************************
-void decreaseBrightness(const char *filename)
-{
- GameConfig::setScreenBrightness(GameConfig::getScreenBrightness() - 0.1f);
-
- Palette::setBrightnessAbsolute(GameConfig::getScreenBrightness());
-
- Screen->setPalette(Palette::color);
- ConsoleInterface::postMessage( "Decreasing Brightness");
-} // end increaseBrightness
-
-// ******************************************************************
void GameManager::initializeInputDevices()
{
MouseInterface::initialize();
@@ -383,7 +359,7 @@
ServerMessageRouter::initialize();
ClientMessageRouter::initialize();
- ServerConnectDaemon::initialize( GameConfig::GetNumberPlayers() );
+ ServerConnectDaemon::initialize( gameconfig->maxplayers );
NetworkState::setNetworkStatus( _network_state_server );
NetworkState::resetNetworkStats();
@@ -409,10 +385,10 @@
// ******************************************************************
void GameManager::initializeGameLogic()
{
- PlayerInterface::initialize( GameConfig::GetNumberPlayers(),
- GameConfig::GetNumberInitialUnits() );
+ PlayerInterface::initialize( gameconfig->maxplayers,
+ gameconfig->initialunits );
UnitBlackBoard::initializeBlackBoard();
- UnitInterface::initialize( GameConfig::GetUnitsPerPlayer() );
+ UnitInterface::initialize( gameconfig->GetUnitsPerPlayer() );
PathScheduler::initialize();
PowerUpInterface::resetLogic();
}
@@ -486,26 +462,10 @@
if (KeyboardInterface::getKeyState( SDLK_LALT ) ||
KeyboardInterface::getKeyState( SDLK_RALT )) {
if (KeyboardInterface::getKeyPressed(SDLK_RETURN)) {
- GameConfig::setFullscreen(!Screen->isFullScreen());
+ gameconfig->fullscreen.toggle();
GameManager::setVideoMode();
}
- if ( KeyboardInterface::getKeyPressed( SDLK_MINUS) ) {
- if (!Desktop::getVisible("GameView")) {
- decreaseBrightness("wads/netpmenu.act");
- } else {
- decreaseBrightness("wads/netp.act");
- }
- }
-
- if (KeyboardInterface::getKeyPressed(SDLK_EQUALS)) {
- if (!Desktop::getVisible("GameView")) {
- increaseBrightness("wads/netpmenu.act");
- } else {
- increaseBrightness("wads/netp.act");
- }
- }
-
if( (KeyboardInterface::getKeyState( SDLK_LCTRL) ||
KeyboardInterface::getKeyState( SDLK_RCTRL) ) ) {
@@ -677,8 +637,8 @@
miniMapView.init();
ParticleInterface::initParticleSystems();
- ParticleInterface::addCloudParticle(GameConfig::getCloudCoverage());
- Physics::wind.setVelocity(GameConfig::getWindSpeed(), 107);
+ ParticleInterface::addCloudParticle(gameconfig->cloudcoverage);
+ Physics::wind.setVelocity(gameconfig->windspeed, 107);
}
// ******************************************************************
@@ -696,8 +656,8 @@
ParticleInterface::initParticleSystems();
Particle2D::setCreateParticles(false);
- ParticleInterface::addCloudParticle(GameConfig::getCloudCoverage());
- Physics::wind.setVelocity(GameConfig::getWindSpeed(), 107);
+ ParticleInterface::addCloudParticle(gameconfig->cloudcoverage);
+ Physics::wind.setVelocity(gameconfig->windspeed, 107);
}
// ******************************************************************
@@ -719,7 +679,7 @@
try {
if(!FileSystem::exists("config"))
FileSystem::mkdir("config");
- GameConfig::initialize("config/netpanzer.xml");
+ gameconfig = new GameConfig("config/netpanzer.xml");
initializeSoundSubSystem();
initializeVideoSubSystem();
loadGameData();
@@ -741,7 +701,7 @@
try {
if(!FileSystem::exists("config"))
FileSystem::mkdir("config");
- GameConfig::initialize("config/netpanzer-dedicated.cfg");
+ gameconfig = new GameConfig("config/netpanzer-dedicated.cfg");
initializeSoundSubSystem(); // we load a dummy sound driver
loadGameData();
initializeGameObjects();
@@ -772,7 +732,8 @@
shutdownSoundSubSystem();
shutdownVideoSubSystem();
shutdownInputDevices();
- GameConfig::shutdown();
+ delete gameconfig;
+ gameconfig = 0;
}
void GameManager::dedicatedShutdown()
@@ -781,7 +742,7 @@
shutdownNetworkSubSystem();
shutdownInputDevices();
shutdownDedicatedConsole();
- GameManager::shutdown();
+ shutdown();
}
// ******************************************************************
@@ -873,19 +834,20 @@
if ( game_state == _game_state_in_progress ) {
if ( NetworkState::status == _network_state_server ) {
unsigned char game_type;
- game_type = GameConfig::GetGameType();
+ game_type = gameconfig->gametype;
switch( game_type ) {
case _gametype_fraglimit : {
- if ( PlayerInterface::testRuleScoreLimit(
GameConfig::GetFragLimit(), &player_state ) == true ) {
+ if (
PlayerInterface::testRuleScoreLimit(gameconfig->fraglimit, &player_state ) ==
true ) {
fraglimitGameCompleted( player_state );
}
}
break;
case _gametype_objective : {
- if ( PlayerInterface::testRuleObjectiveRatio(
GameConfig::getObjectiveOccuapationPercentageDecimal(), &player_state ) == true
) {
+ if ( PlayerInterface::testRuleObjectiveRatio(
+ gameconfig->objectiveoccupationpercentage,
&player_state ) == true ) {
objectiveGameCompleted( player_state );
}
}
@@ -911,29 +873,6 @@
// ******************************************************************
-bool GameManager::initializeConnectionType()
-{
- //bug#15
- int connection_type;
-
- connection_type = GameConfig::GetNetworkConnectType();
-
- switch( connection_type ) {
- case _connection_tcpip : {
- //bug#15
- //winsock hack
- //ServProvReturn = SetServProv( gapp.hwndApp, TCPIP );
- //if(ServProvReturn == 0) return 0;
- }
- break;
-
- } // ** switch
-
- return 1;
-}
-
-// ******************************************************************
-
void GameManager::netMessageSetView( NetMessage *message )
{
SystemSetPlayerView *set_view;
@@ -1011,16 +950,16 @@
game_setup = (ConnectMesgServerGameSettings *) message;
- game_setup->max_players = GameConfig::GetNumberPlayers();
- game_setup->max_units = GameConfig::GetNumberUnits();
+ game_setup->max_players = gameconfig->maxplayers;
+ game_setup->max_units = gameconfig->maxunits;
MapsManager::getCurrentMap( game_setup->map_name );
- game_setup->cloud_coverage = GameConfig::getCloudCoverage();
- game_setup->wind_speed = GameConfig::getWindSpeed();
- game_setup->game_type = GameConfig::GetGameType();
- game_setup->map_cycle_state = GameConfig::getMapCycleState();
- game_setup->powerup_state = GameConfig::getPowerUpState();
- game_setup->frag_limit = GameConfig::GetFragLimit();
- game_setup->time_limit = GameConfig::GetTimeLimit();
+ game_setup->cloud_coverage = gameconfig->cloudcoverage;
+ game_setup->wind_speed = gameconfig->windspeed;
+ game_setup->game_type = gameconfig->gametype;
+ game_setup->map_cycle_state = gameconfig->mapcycling;
+ game_setup->powerup_state = gameconfig->powerups;
+ game_setup->frag_limit = gameconfig->fraglimit;
+ game_setup->time_limit = gameconfig->timelimit;
game_setup->elapsed_time = getGameTime();
}
@@ -1059,15 +998,15 @@
game_setup = (ConnectMesgServerGameSettings *) message;
- GameConfig::SetNumberPlayers( game_setup->max_players );
- GameConfig::SetNumberUnits( game_setup->max_units );
- GameConfig::setCloudCoverage( game_setup->cloud_coverage );
- GameConfig::setWindSpeed( game_setup->wind_speed );
- GameConfig::setMapCycleState( game_setup->map_cycle_state );
- GameConfig::setPowerUpState( game_setup->powerup_state );
- GameConfig::SetGameType( game_setup->game_type );
- GameConfig::SetFragLimit( game_setup->frag_limit );
- GameConfig::SetTimeLimit( game_setup->time_limit );
+ gameconfig->maxplayers = game_setup->max_players;
+ gameconfig->maxunits = game_setup->max_units;
+ gameconfig->cloudcoverage = game_setup->cloud_coverage;
+ gameconfig->windspeed = (int) game_setup->wind_speed;
+ gameconfig->mapcycling = game_setup->map_cycle_state;
+ gameconfig->powerups = game_setup->powerup_state;
+ gameconfig->gametype = game_setup->game_type;
+ gameconfig->fraglimit = game_setup->frag_limit;
+ gameconfig->timelimit = game_setup->time_limit;
startGameTimer();
game_elapsed_time_offset = game_setup->elapsed_time;
@@ -1136,11 +1075,11 @@
void GameManager::setNetPanzerGameOptions()
{
- MiniMapInterface::setProperties( GameConfig::getPlayerRadarUnitColor(),
- GameConfig::getAlliedRadarUnitColor(),
- GameConfig::getPlayerOutpostRadarColor(),
- GameConfig::getAlliedOutpostRadarColor(),
- GameConfig::getEnemyOutpostRadarColor() );
+ MiniMapInterface::setProperties( gameconfig->getPlayerRadarUnitColor(),
+ gameconfig->getAlliedRadarUnitColor(),
+ gameconfig->getPlayerOutpostRadarColor(),
+ gameconfig->getAlliedOutpostRadarColor(),
+ gameconfig->getEnemyOutpostRadarColor() );
}
//--------------------------------------------------------------------------
@@ -1197,11 +1136,6 @@
progressView.open();
- /*
- initializeConnectionType();
- HostSession( gapp.hwndApp );
- */
-
//InitStreamServer(gapp.hwndApp);
progressView.scrollAndUpdateDirect( "Launching Server ..." );
@@ -1224,10 +1158,11 @@
progressView.scrollAndUpdateDirect( "Loading Game Data ..." );
- MapsManager::setCycleStartMap( GameConfig::getGameMapName().c_str() );
+ const char* mapname = ((const std::string&)(gameconfig->map)).c_str();
+ MapsManager::setCycleStartMap(mapname);
int result_code;
- startGameMapLoad(GameConfig::getGameMapName().c_str(), 20, &result_code);
+ startGameMapLoad(mapname, 20, &result_code);
if( result_code == _mapload_result_no_wad_file ) {
progressView.scrollAndUpdateDirect( "MAP TILE SET NOT FOUND!" );
@@ -1261,8 +1196,10 @@
progressView.scrollAndUpdateDirect( "Spawning Player ..." );
player_state = PlayerInterface::allocateLoopBackPlayer();
- player_state->setName( GameConfig::GetPlayerName() );
- player_state->setFlag( (unsigned char ) GameConfig::GetPlayerFlag() );
+ const char* playername = ((const
+ std::string&)(gameconfig->playername)).c_str();
+ player_state->setName(playername);
+ player_state->setFlag( (unsigned char) gameconfig->playerflag );
player = PlayerInterface::getLocalPlayerID();
spawnPlayer( player );
progressView.updateDirect( "Spawning Player ... (100%)" );
@@ -1306,19 +1243,17 @@
void GameManager::launchMultiPlayerGame()
{
- if( GameConfig::GetHostOrJoin() == _game_session_host ) {
+ if( gameconfig->hostorjoin == _game_session_host ) {
hostMultiPlayerGame();
} else
- if( GameConfig::GetHostOrJoin() == _game_session_join ) {
+ if( gameconfig->hostorjoin == _game_session_join ) {
joinMultiPlayerGame();
}
}
// ******************************************************************
void GameManager::launchNetPanzerGame()
{
- if ( GameConfig::GetGameMode() == _gamemode_multiplayer ) {
- launchMultiPlayerGame();
- }
+ launchMultiPlayerGame();
}
// ******************************************************************
@@ -1337,31 +1272,32 @@
char input_str[256];
MapsManager::getCurrentMap( input_str );
- GameConfig::setGameMapName( input_str );
+ gameconfig->map = input_str;
- printf( "Map Name <%s> : ", GameConfig::getGameMapName().c_str() );
+ const char* mapname = ((const std::string&)(gameconfig->map)).c_str();
+ printf( "Map Name <%s> : ", mapname);
fflush(stdout);
readString(input_str, 256, stdin);
if ( strlen(input_str) > 0 ) {
- GameConfig::setGameMapName( input_str );
+ gameconfig->map = input_str;
}
- printf( "Players <%d> : ", GameConfig::GetNumberPlayers() );
+ printf( "Players <%d> : ", (int) gameconfig->maxplayers );
fflush(stdout);
readString(input_str, 256, stdin);
if ( strlen(input_str) > 0 ) {
int players;
sscanf( input_str, "%d", &players );
- GameConfig::SetNumberPlayers( players );
+ gameconfig->maxplayers = players;
}
- printf( "Units <%d> : ", GameConfig::GetNumberUnits() );
+ printf( "Units <%d> : ", (int) gameconfig->maxunits );
fflush(stdout);
readString(input_str, 256, stdin);
if ( strlen(input_str) > 0 ) {
int units;
sscanf( input_str, "%d", &units );
- GameConfig::SetNumberUnits( units );
+ gameconfig->maxunits = units;
}
int game_type = 1;
@@ -1379,40 +1315,41 @@
switch( game_type ) {
case 1 : {
- GameConfig::SetGameType(_gametype_objective);
- printf( "Outpost Occupation <%.0f %%> : ",
GameConfig::getObjectiveOccuapationPercentage() );
+ gameconfig->gametype = _gametype_objective;
+ printf( "Outpost Occupation <%d %%> : ",
+ (int) gameconfig->objectiveoccupationpercentage );
fflush(stdout);
readString(input_str, 256, stdin);
if ( strlen(input_str) > 0 ) {
- float percent;
- sscanf( input_str, "%f", &percent );
- GameConfig::setObjectiveOccuapationPercentage( percent );
+ int percent;
+ sscanf( input_str, "%d", &percent );
+ gameconfig->objectiveoccupationpercentage = percent;
}
}
break;
case 2 : {
- GameConfig::SetGameType(_gametype_fraglimit);
- printf( "Frag Limit <%d> frags : ", GameConfig::GetFragLimit() );
+ gameconfig->gametype = _gametype_fraglimit;
+ printf( "Frag Limit <%d> frags : ", (int) gameconfig->fraglimit );
fflush(stdout);
readString(input_str, 256, stdin);
if ( strlen(input_str) > 0 ) {
int frags;
sscanf( input_str, "%d", &frags);
- GameConfig::SetFragLimit( frags );
+ gameconfig->fraglimit = frags;
}
}
break;
case 3 : {
- GameConfig::SetGameType(_gametype_timelimit);
- printf( "Time Limit <%d> minutes: ", GameConfig::GetTimeLimit() );
+ gameconfig->gametype = _gametype_timelimit;
+ printf( "Time Limit <%d> minutes: ", (int) gameconfig->timelimit );
fflush(stdout);
readString(input_str, 256, stdin);
if ( strlen(input_str) > 0 ) {
int time_limit;
sscanf( input_str, "%d", &time_limit );
- GameConfig::SetTimeLimit( time_limit );
+ gameconfig->timelimit = time_limit;
}
}
break;
@@ -1423,21 +1360,23 @@
fflush(stdout);
readString(input_str, 256, stdin);
if ( strcasecmp( "y", input_str ) == 0 ) {
- GameConfig::setPowerUpState(true);
+ gameconfig->powerups = true;
+ } else {
+ gameconfig->powerups = false;
}
printf( "Server Name <Dedicated Server> :" );
fflush(stdout);
readString(input_str, 256, stdin);
if ( strlen(input_str) > 0 ) {
- GameConfig::SetPlayerName( input_str );
+ gameconfig->playername = input_str;
} else {
- GameConfig::SetPlayerName( "Dedicated Server" );
+ gameconfig->playername = "Dedicated Server";
}
-
- MapsManager::setCycleStartMap( GameConfig::getGameMapName().c_str() );
- dedicatedLoadGameMap( GameConfig::getGameMapName().c_str() );
+ mapname = ((const std::string&)(gameconfig->map)).c_str();
+ MapsManager::setCycleStartMap(mapname);
+ dedicatedLoadGameMap(mapname);
reinitializeGameLogic();
@@ -1491,13 +1430,6 @@
// ******************************************************************
void GameManager::gameLoop()
{
- static bool once = true;
-
- if (once) {
- once = false;
- Desktop::setVisibility("MainView", true);
- }
-
TimerInterface::start();
inputLoop();
@@ -1647,12 +1579,12 @@
case 'I' :
case 'i' : {
- ConsoleInterface::postMessage( "Map: %s",
GameConfig::getGameMapName() );
+ ConsoleInterface::postMessage( "Map: %s",
gameconfig->getGameMapName() );
ConsoleInterface::postMessage( "Players: %d/%d",
PlayerInterface::getActivePlayerCount(),
-
GameConfig::GetNumberPlayers() );
+ gameconfig->maxplayers );
ConsoleInterface::postMessage( "Units: %d/%d",
UnitInterface::getTotalUnitCount(),
-
GameConfig::GetNumberUnits() );
+ gameconfig->maxunits);
}
break;
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.hpp:1.14
netpanzer/src/NetPanzer/Interfaces/GameManager.hpp:1.15
--- netpanzer/src/NetPanzer/Interfaces/GameManager.hpp:1.14 Fri Oct 3
10:53:38 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.hpp Sat Oct 4 10:44:38 2003
@@ -164,8 +164,6 @@
static void setNetPanzerGameOptions();
- static bool initializeConnectionType();
-
static void spawnPlayer( const PlayerID &player );
static void requestNetworkPing();
Index: netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp:1.6
netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp:1.7
--- netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp:1.6 Mon Sep 22
09:53:52 2003
+++ netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp Sat Oct 4
10:44:38 2003
@@ -90,7 +90,7 @@
map_loc.x = int(float(world_loc.x) / scale_factor.x);
map_loc.y = int(float(world_loc.y) / scale_factor.y);
- if (GameConfig::getMiniMapUnitSize() == _mini_map_unit_size_large) {
+ if (gameconfig->radar_unitsize == _mini_map_unit_size_large) {
unitRect = iRect(map_loc, map_loc + 1);
}
@@ -100,9 +100,9 @@
drawLargeUnitDot( map_surface, map_loc, Color::yellow );
}
} else {
- if (GameConfig::getMiniMapUnitSize() ==
_mini_map_unit_size_small) {
+ if (gameconfig->radar_unitsize == _mini_map_unit_size_small) {
drawSmallUnitDot( map_surface, map_loc, player_unit_color
);
- } else if (GameConfig::getMiniMapUnitSize() ==
_mini_map_unit_size_large) {
+ } else if (gameconfig->radar_unitsize ==
_mini_map_unit_size_large) {
drawLargeUnitDot( map_surface, map_loc, player_unit_color
);
} else {
@@ -111,9 +111,9 @@
}
} else
if ( unit_dispostion == _unit_allied ) {
- if (GameConfig::getMiniMapUnitSize() ==
_mini_map_unit_size_small) {
+ if (gameconfig->radar_unitsize == _mini_map_unit_size_small) {
drawSmallUnitDot( map_surface, map_loc, allie_unit_color );
- } else if (GameConfig::getMiniMapUnitSize() ==
_mini_map_unit_size_large) {
+ } else if (gameconfig->radar_unitsize ==
_mini_map_unit_size_large) {
drawLargeUnitDot( map_surface, map_loc, allie_unit_color );
} else {
@@ -122,9 +122,9 @@
} else
if( ( unit_dispostion == _unit_enemy ) &&
(show_enemy_radar_flag == true) ) {
- if (GameConfig::getMiniMapUnitSize() ==
_mini_map_unit_size_small) {
+ if (gameconfig->radar_unitsize ==
_mini_map_unit_size_small) {
drawSmallUnitDot( map_surface, map_loc,
enemy_objective_color );
- } else if (GameConfig::getMiniMapUnitSize() ==
_mini_map_unit_size_large) {
+ } else if (gameconfig->radar_unitsize ==
_mini_map_unit_size_large) {
drawLargeUnitDot( map_surface, map_loc,
enemy_objective_color );
} else {
@@ -169,13 +169,13 @@
map_rect.max.y = int(float(world_rect.max.y) / scale_factor.y);
// Removed black borders to the text.
- if (GameConfig::getMiniMapObjectiveDrawMode() ==
_mini_map_objective_draw_mode_solid_rect) {
+ if (gameconfig->radar_objectivedrawmode ==
_mini_map_objective_draw_mode_solid_rect) {
map_surface.fillRect( map_rect, color);
- } else if (GameConfig::getMiniMapObjectiveDrawMode() ==
_mini_map_objective_draw_mode_outline_rect) {
+ } else if (gameconfig->radar_objectivedrawmode ==
_mini_map_objective_draw_mode_outline_rect) {
map_surface.drawRect( map_rect, color);
map_surface.drawRect( iRect(map_rect.min.x + 1, map_rect.min.y +
1, map_rect.max.x - 1, map_rect.max.y - 1), color );
//}
- //else if (GameConfig::getMiniMapObjectiveDrawMode() ==
_mini_map_objective_draw_mode_player_flag)
+ //else if (gameconfig->radar_objectivedrawmode ==
_mini_map_objective_draw_mode_player_flag)
//{
//map_surface.fillRect( map_rect, color );
} else {
Index: netpanzer/src/NetPanzer/Interfaces/PowerUpInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/PowerUpInterface.cpp:1.9
netpanzer/src/NetPanzer/Interfaces/PowerUpInterface.cpp:1.10
--- netpanzer/src/NetPanzer/Interfaces/PowerUpInterface.cpp:1.9 Mon Sep 22
09:53:52 2003
+++ netpanzer/src/NetPanzer/Interfaces/PowerUpInterface.cpp Sat Oct 4
10:44:38 2003
@@ -248,7 +248,7 @@
{
unsigned long map_size_x, map_size_y;
- if( GameConfig::getPowerUpState() == false ) {
+ if( gameconfig->powerups == false ) {
return;
}
@@ -272,7 +272,7 @@
{
PowerUp *powerup_ptr = 0;
- if( GameConfig::getPowerUpState() == false ) {
+ if( gameconfig->powerups == false ) {
return;
}
@@ -312,7 +312,7 @@
{
PowerUp *powerup_ptr;
- if( GameConfig::getPowerUpState() == false ) {
+ if( gameconfig->powerups == false ) {
return;
}
Index: netpanzer/src/NetPanzer/Interfaces/Stats.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/Stats.cpp:1.5
netpanzer/src/NetPanzer/Interfaces/Stats.cpp:1.6
--- netpanzer/src/NetPanzer/Interfaces/Stats.cpp:1.5 Tue Sep 16 16:16:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/Stats.cpp Sat Oct 4 10:44:38 2003
@@ -166,7 +166,7 @@
break;
case _stats_sort_order_game_type : {
- switch( GameConfig::GetGameType() ) {
+ switch( gameconfig->gametype ) {
case _gametype_objective :
ObjectiveInterface::updatePlayerObjectiveCounts();
PlayerArray.sort( PlayerArray.getSize(),
StatsObjectivesSortKey );
@@ -184,7 +184,7 @@
break;
case _stats_sort_order_winner : {
- switch( GameConfig::GetGameType() ) {
+ switch( gameconfig->gametype ) {
case _gametype_objective :
ObjectiveInterface::updatePlayerObjectiveCounts();
PlayerArray.sort( PlayerArray.getSize(),
StatsObjectivesSortKey );
Index: netpanzer/src/NetPanzer/Views/Game/AreYouSureResignView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/AreYouSureResignView.cpp:1.13
netpanzer/src/NetPanzer/Views/Game/AreYouSureResignView.cpp:1.14
--- netpanzer/src/NetPanzer/Views/Game/AreYouSureResignView.cpp:1.13 Fri Oct
3 10:45:12 2003
+++ netpanzer/src/NetPanzer/Views/Game/AreYouSureResignView.cpp Sat Oct 4
10:44:38 2003
@@ -161,7 +161,6 @@
//---------------------------------------------------------------------------
void AreYouSureResignView::doActivate()
{
- printf("DoActivate\n");
init();
Desktop::setActiveView(this);
} // end AreYouSureResignView::doActivate
Index: netpanzer/src/NetPanzer/Views/Game/GameInfoView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/GameInfoView.cpp:1.10
netpanzer/src/NetPanzer/Views/Game/GameInfoView.cpp:1.11
--- netpanzer/src/NetPanzer/Views/Game/GameInfoView.cpp:1.10 Fri Oct 3
10:45:14 2003
+++ netpanzer/src/NetPanzer/Views/Game/GameInfoView.cpp Sat Oct 4 10:44:39 2003
@@ -53,8 +53,8 @@
{
char time_string[256];
- int hrs = (GameConfig::GetTimeLimit() / 60);
- int min = (GameConfig::GetTimeLimit() % 60);
+ int hrs = (gameconfig->timelimit / 60);
+ int min = (gameconfig->timelimit % 60);
sprintf(time_string, "%d:%d", hrs, min);
@@ -104,16 +104,16 @@
gameInfoRect = getClientRect();
//gameInfoRect.max.x = 0;
- sprintf(gameBuf, "game %s", GameConfig::getGameTypeString() );
+ sprintf(gameBuf, "game %s", gameconfig->getGameTypeString() );
checkGameInfoRect(gameBuf);
- int unitPerPlayer = GameConfig::GetNumberUnits() /
GameConfig::GetNumberPlayers();
+ int unitPerPlayer = gameconfig->maxunits / gameconfig->maxplayers;
sprintf(unitsBuf, "units %d/%d",
int(UnitInterface::getUnitCount(PlayerInterface::getLocalPlayerIndex())),
unitPerPlayer);
checkGameInfoRect(unitsBuf);
- if( GameConfig::GetGameType() == _gametype_fraglimit ) {
- sprintf(fragsBuf, "frags %d/%d", getPlayerFrags(),
GameConfig::GetFragLimit() );
+ if( gameconfig->gametype == _gametype_fraglimit ) {
+ sprintf(fragsBuf, "frags %d/%d", getPlayerFrags(), (int)
gameconfig->fraglimit);
checkGameInfoRect(fragsBuf);
} else {
sprintf(fragsBuf, "frags NA" );
@@ -128,7 +128,7 @@
checkGameInfoRect(lossesBuf);
*/
- if( GameConfig::GetGameType() == _gametype_timelimit ) {
+ if( gameconfig->gametype == _gametype_timelimit ) {
sprintf(timeBuf, "time %s/%s", (const char*) getPlayerTime(),
(const char*) getTimeLimit() );
checkGameInfoRect(timeBuf);
Index: netpanzer/src/NetPanzer/Views/Game/GameToolbarView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/GameToolbarView.cpp:1.6
netpanzer/src/NetPanzer/Views/Game/GameToolbarView.cpp:1.7
--- netpanzer/src/NetPanzer/Views/Game/GameToolbarView.cpp:1.6 Fri Oct 3
10:45:14 2003
+++ netpanzer/src/NetPanzer/Views/Game/GameToolbarView.cpp Sat Oct 4
10:44:39 2003
@@ -61,17 +61,9 @@
static void bToggleDrawUnitDamage()
{
- GameConfig::toggleDrawUnitDamage();
+ gameconfig->drawunitdamage.toggle();
}
-// XXX not used
-#if 0
-static void bToggleDrawUnitReload()
-{
- GameConfig::toggleDrawUnitReload();
-}
-#endif
-
static void bSetGroup1()
{
COMMAND_PROCESSOR.createGroup(1);
@@ -136,7 +128,7 @@
static void bToggleDrawUnitFlags()
{
- GameConfig::toggleDisplayUnitFlags();
+ gameconfig->drawunitflags.toggle();
}
Index: netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.12
netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.13
--- netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.12 Fri Oct 3
10:45:15 2003
+++ netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp Sat Oct 4 10:44:39 2003
@@ -23,6 +23,7 @@
#include "MiniMapInterface.hpp"
#include "KeyboardInterface.hpp"
#include "cMouse.hpp"
+#include "ScreenSurface.hpp"
#include "WorldInputCmdProcessor.hpp"
@@ -281,6 +282,7 @@
maxMapSize = std::min(640, 480);
moveTo(min + newPos - prevPos);
+ checkArea(screen->getPix());
// Check for map blending mode change.
if (KeyboardInterface::getKeyPressed(SDLK_1)) {
@@ -327,11 +329,9 @@
destSize = maxMapSize;
}
- // XXX
-#if 0
// Check the validity of the X dimension.
- if ((min.x + destSize.x) >= SCREEN_XPIX) {
- int xOffset = min.x + destSize.x - SCREEN_XPIX;
+ if ((min.x + destSize.x) >= screen->getPixX()) {
+ int xOffset = min.x + destSize.x - screen->getPixX();
int destXPos = min.x - xOffset;
@@ -344,8 +344,8 @@
}
// Check the validity of the Y dimension.
- if ((min.y + destSize.y) >= SCREEN_YPIX) {
- int yOffset = min.y + destSize.y - SCREEN_YPIX;
+ if ((min.y + destSize.y) >= screen->getPixY()) {
+ int yOffset = min.y + destSize.y - screen->getPixY();
int destYPos = min.y - yOffset;
@@ -356,7 +356,6 @@
moveTo(min.x, destYPos);
}
}
-#endif
// Resize the x dimension.
if (destSize.x > getViewRect().getSize().x) {
Index: netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.13
netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.14
--- netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.13 Fri Oct
3 10:45:15 2003
+++ netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp Sat Oct 4
10:44:39 2003
@@ -553,7 +553,7 @@
clientArea.bltString(timeRequiredPos, strBuf, color);
}
- int unitPerPlayer = GameConfig::GetNumberUnits() /
GameConfig::GetNumberPlayers();
+ int unitPerPlayer = gameconfig->maxunits / gameconfig->maxplayers;
sprintf(strBuf, "%d/%d",
int(UnitInterface::getUnitCount(PlayerInterface::getLocalPlayerIndex())),
unitPerPlayer);
clientArea.bltString(unitsBuiltPos, strBuf, color);
Index: netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp:1.12
netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp:1.13
--- netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp:1.12 Fri Oct 3
10:45:16 2003
+++ netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp Sat Oct 4
10:44:39 2003
@@ -37,7 +37,7 @@
static void bReturnToMainMenu()
{
- if ( GameConfig::getMapCycleState() == true ) {
+ if ( gameconfig->mapcycling == true ) {
progressView.open();
progressView.scrollAndUpdate( "Waiting for next game map ..." );
} else {
Index: netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp:1.17
netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp:1.18
--- netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp:1.17 Fri Oct
3 10:45:16 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp Sat Oct 4
10:44:39 2003
@@ -51,8 +51,6 @@
static void bMulti()
{
- GameConfig::SetGameMode(_gamemode_multiplayer);
-
if (strcmp(MenuTemplateView::currentMultiView, "GetSessionView") == 0) {
Desktop::setVisibilityAllWindows(false);
Desktop::setVisibility("GetSessionView", true);
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/GetSessionView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/GetSessionView.cpp:1.12
netpanzer/src/NetPanzer/Views/MainMenu/Multi/GetSessionView.cpp:1.13
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/GetSessionView.cpp:1.12
Tue Sep 23 10:23:03 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/GetSessionView.cpp Sat Oct
4 10:44:40 2003
@@ -56,7 +56,7 @@
//winsock hack
//Desktop::setVisibilityAllWindows(false);
- if (GameConfig::GetHostOrJoin() == _game_session_host) {
+ if (gameconfig->hostorjoin == _game_session_host) {
//winsock hack
Desktop::setVisibilityAllWindows(false);
@@ -67,17 +67,8 @@
Desktop::setVisibility("MapSelectionView", true);
Desktop::setVisibility("PlayerNameView", true);
- //winsock hack
- //initialize dplay, fix Bug#15--
- //if the DPlayReturnValue is 0 dplay ain't working.
- //we need to put up a message box that says so, then pop the
- //user back to the SetConnectionTypeView--
- //ShutDownConnection();
- //DPlayReturnValue = InitializeDirectPlay( gapp.hwndApp);
- //ConnectTypeReturnValue = GameManager::initializeConnectionType();
-
SERVER->openSession();
- } else if (GameConfig::GetHostOrJoin() == _game_session_join) {
+ } else if (gameconfig->hostorjoin == _game_session_join) {
CLIENT->openSession();
// XXX no server enumertation/info yet
@@ -163,16 +154,16 @@
static void bHost()
{
- previousSessionType = GameConfig::GetHostOrJoin();
+ previousSessionType = gameconfig->hostorjoin;
- GameConfig::SetHostOrJoin(_game_session_host);
+ gameconfig->hostorjoin = _game_session_host;
}
static void bJoin()
{
- previousSessionType = GameConfig::GetHostOrJoin();
+ previousSessionType = gameconfig->hostorjoin;
- GameConfig::SetHostOrJoin(_game_session_join);
+ gameconfig->hostorjoin = _game_session_join;
}
@@ -220,7 +211,7 @@
// assert(tempSurface.getFrameCount() == 3);
// addButtonSurface(iXY(505, 440), tempSurface, "Move back menu.",
bBack);
//
- // GameConfig::SetHostOrJoin(_game_session_host);
+ // gameconfig->SetHostOrJoin(_game_session_host);
} // end GetSessionView::GetSessionView
@@ -228,7 +219,7 @@
//---------------------------------------------------------------------------
void GetSessionView::doDraw(const Surface &viewArea, const Surface &clientArea)
{
- if (previousSessionType != GameConfig::GetHostOrJoin()) {
+ if (previousSessionType != gameconfig->hostorjoin) {
loadTitleSurface();
}
@@ -241,7 +232,7 @@
//---------------------------------------------------------------------------
void GetSessionView::drawInfo(const Surface &dest)
{
- int connectionType = GameConfig::GetHostOrJoin();
+ int connectionType = gameconfig->hostorjoin;
if (connectionType == _game_session_host) {
drawHostInfo(dest, bodyTextRect);
@@ -329,9 +320,9 @@
//---------------------------------------------------------------------------
void GetSessionView::loadTitleSurface()
{
- if (GameConfig::GetHostOrJoin() == _game_session_host) {
+ if (gameconfig->hostorjoin == _game_session_host) {
doLoadTitleSurface("pics/backgrounds/menus/menu/til/hostTitle.til");
- } else if (GameConfig::GetHostOrJoin() == _game_session_join) {
+ } else if (gameconfig->hostorjoin == _game_session_join) {
doLoadTitleSurface("pics/backgrounds/menus/menu/til/joinTitle.til");
}
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp
diff -u
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.13
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.14
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.13
Fri Oct 3 10:45:18 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp
Sat Oct 4 10:44:40 2003
@@ -49,13 +49,10 @@
static void bBack()
{
- //fix bug#15--
- //winsock hack
- //ShutDownConnection();
- if (GameConfig::GetHostOrJoin() == _game_session_join) {
+ if (gameconfig->hostorjoin == _game_session_join) {
CLIENT->closeSession();
} else
- if (GameConfig::GetHostOrJoin() == _game_session_host) {
+ if (gameconfig->hostorjoin == _game_session_host) {
SERVER->closeSession();
}
@@ -90,12 +87,12 @@
}
// Set the player name.
- GameConfig::SetPlayerName(PlayerNameView::playerName.getString());
+ gameconfig->playername = PlayerNameView::playerName.getString();
// Set the player flag.
- GameConfig::SetPlayerFlag( (short) playerFlagSelected );
+ gameconfig->playerflag = ( (short) playerFlagSelected );
- if (GameConfig::GetHostOrJoin() == _game_session_join) {
+ if (gameconfig->hostorjoin == _game_session_join) {
//winsock hack
// if (!IsSelectedGameValid())
// {
@@ -131,88 +128,90 @@
_unit_type_humvee,
*/
+#if 0
// Increase unit count.
static void bIncreaseHumvee()
{
- GameConfig::unit_spawn_config.incrementSpawnUnitCount(_unit_type_humvee);
+ gameconfig->unit_spawn_config.incrementSpawnUnitCount(_unit_type_humvee);
}
static void bIncreaseLightTank()
{
-
GameConfig::unit_spawn_config.incrementSpawnUnitCount(_unit_type_valentine);
+
gameconfig->unit_spawn_config.incrementSpawnUnitCount(_unit_type_valentine);
}
static void bIncreaseMediumTank()
{
- GameConfig::unit_spawn_config.incrementSpawnUnitCount(_unit_type_leopard);
+ gameconfig->unit_spawn_config.incrementSpawnUnitCount(_unit_type_leopard);
}
static void bIncreaseHeavyTank()
{
- GameConfig::unit_spawn_config.incrementSpawnUnitCount(_unit_type_abrams);
+ gameconfig->unit_spawn_config.incrementSpawnUnitCount(_unit_type_abrams);
}
static void bIncreaseMissleLauncher()
{
-
GameConfig::unit_spawn_config.incrementSpawnUnitCount(_unit_type_hammerhead);
+
gameconfig->unit_spawn_config.incrementSpawnUnitCount(_unit_type_hammerhead);
}
// Decrease unit count.
static void bDecreaseHumvee()
{
- GameConfig::unit_spawn_config.decrementSpawnUnitCount(_unit_type_humvee);
+ gameconfig->unit_spawn_config.decrementSpawnUnitCount(_unit_type_humvee);
}
static void bDecreaseLightTank()
{
-
GameConfig::unit_spawn_config.decrementSpawnUnitCount(_unit_type_valentine);
+
gameconfig->unit_spawn_config.decrementSpawnUnitCount(_unit_type_valentine);
}
static void bDecreaseMediumTank()
{
- GameConfig::unit_spawn_config.decrementSpawnUnitCount(_unit_type_leopard);
+ gameconfig->unit_spawn_config.decrementSpawnUnitCount(_unit_type_leopard);
}
static void bDecreaseHeavyTank()
{
- GameConfig::unit_spawn_config.decrementSpawnUnitCount(_unit_type_abrams);
+ gameconfig->unit_spawn_config.decrementSpawnUnitCount(_unit_type_abrams);
}
static void bDecreaseMissleLauncher()
{
-
GameConfig::unit_spawn_config.decrementSpawnUnitCount(_unit_type_hammerhead);
+
gameconfig->unit_spawn_config.decrementSpawnUnitCount(_unit_type_hammerhead);
}
// Get unit count.
static int getHumveeCount()
{
- return GameConfig::unit_spawn_config.getSpawnUnitCount(_unit_type_humvee);
+ return gameconfig->unit_spawn_config.getSpawnUnitCount(_unit_type_humvee);
}
static int getLightTankCount()
{
- return
GameConfig::unit_spawn_config.getSpawnUnitCount(_unit_type_valentine);
+ return
gameconfig->unit_spawn_config.getSpawnUnitCount(_unit_type_valentine);
}
static int getMediumTankCount()
{
- return GameConfig::unit_spawn_config.getSpawnUnitCount(_unit_type_leopard);
+ return gameconfig->unit_spawn_config.getSpawnUnitCount(_unit_type_leopard);
}
static int getHeavyTankCount()
{
- return GameConfig::unit_spawn_config.getSpawnUnitCount(_unit_type_abrams);
+ return gameconfig->unit_spawn_config.getSpawnUnitCount(_unit_type_abrams);
}
static int getMissleLauncherCount()
{
- return
GameConfig::unit_spawn_config.getSpawnUnitCount(_unit_type_hammerhead);
+ return
gameconfig->unit_spawn_config.getSpawnUnitCount(_unit_type_hammerhead);
}
static int getSelectionsRemaining()
{
- return GameConfig::unit_spawn_config.getMaxAllowedUnits() -
GameConfig::unit_spawn_config.unitTotal();
+ return gameconfig->unit_spawn_config.getMaxAllowedUnits() -
gameconfig->unit_spawn_config.unitTotal();
}
+#endif
// HostJoinTemplateView
@@ -293,6 +292,7 @@
} // end HostJoinTemplateView constructor
+#if 0
// addVehicleButtons
//---------------------------------------------------------------------------
void HostJoinTemplateView::addVehicleButtons(const iXY &pos)
@@ -405,6 +405,7 @@
y += yOffset;
} // end HostView::drawVehicleInfo
+#endif
// doDraw
//---------------------------------------------------------------------------
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostOptionsView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostOptionsView.cpp:1.7
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostOptionsView.cpp:1.8
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostOptionsView.cpp:1.7
Fri Oct 3 10:45:18 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostOptionsView.cpp Sat Oct
4 10:44:40 2003
@@ -23,7 +23,6 @@
#include "MapSelectionView.hpp"
#include "GameViewGlobals.hpp"
-
int HostOptionsView::cloudCoverageCount = 1;
int HostOptionsView::windSpeed = 1;
int HostOptionsView::gameType = 0;
@@ -31,35 +30,38 @@
String HostOptionsView::cloudCoverageString;
String HostOptionsView::windSpeedString;
-
static int getCurMaxPlayersCount()
{
- return GameConfig::GetNumberPlayers();
+ return gameconfig->maxplayers;
}
static int getCurMaxUnitCount()
{
- return GameConfig::GetNumberUnits();
+ return gameconfig->maxunits;
}
static void bDecreasePlayerCount()
{
- GameConfig::SetNumberPlayers(GameConfig::GetNumberPlayers() - 1);
+ if(gameconfig->maxplayers - 1 >= gameconfig->maxplayers.getMin())
+ gameconfig->maxplayers = gameconfig->maxplayers - 1;
}
static void bIncreasePlayerCount()
{
- GameConfig::SetNumberPlayers(GameConfig::GetNumberPlayers() + 1);
+ if(gameconfig->maxplayers + 1 <= gameconfig->maxplayers.getMax())
+ gameconfig->maxplayers = gameconfig->maxplayers + 1;
}
static void bDecreaseMaxUnitCount()
{
- GameConfig::SetNumberUnits(GameConfig::GetNumberUnits() - 5);
+ if(gameconfig->maxunits - 5 >= gameconfig->maxunits.getMin())
+ gameconfig->maxunits = gameconfig->maxunits - 5;
}
static void bIncreaseMaxUnitCount()
{
- GameConfig::SetNumberUnits(GameConfig::GetNumberUnits() + 5);
+ if(gameconfig->maxunits + 5 <= gameconfig->maxunits.getMax())
+ gameconfig->maxunits = gameconfig->maxunits + 5;
}
void HostOptionsView::updateGameConfigCloudCoverage()
@@ -82,27 +84,27 @@
switch (cloudCoverageCount) {
case 0: {
cloudCoverageString = "Clear";
- GameConfig::setCloudCoverage(int(clearCloudCount));
+ gameconfig->cloudcoverage = (int(clearCloudCount));
}
break;
case 1: {
cloudCoverageString = "Broken";
- GameConfig::setCloudCoverage(int(brokenCloudCount));
+ gameconfig->cloudcoverage = (int(brokenCloudCount));
}
break;
case 2: {
cloudCoverageString = "Partly Cloudy";
- GameConfig::setCloudCoverage(int(partlyCloudyCloudCount));
+ gameconfig->cloudcoverage = (int(partlyCloudyCloudCount));
}
break;
case 3: {
cloudCoverageString = "Overcast";
- GameConfig::setCloudCoverage(int(overcastCloudCount));
+ gameconfig->cloudcoverage = (int(overcastCloudCount));
}
break;
case 4: {
cloudCoverageString = "Extremely Cloudy";
- GameConfig::setCloudCoverage(int(fuckingCloudyCloudCount));
+ gameconfig->cloudcoverage = (int(fuckingCloudyCloudCount));
}
break;
}
@@ -112,17 +114,17 @@
{
switch (gameType) {
case 0: {
- GameConfig::SetGameType( _gametype_objective );
+ gameconfig->gametype = _gametype_objective;
}
break;
case 1: {
- GameConfig::SetGameType( _gametype_fraglimit );
+ gameconfig->gametype = _gametype_fraglimit;
}
break;
case 2: {
- GameConfig::SetGameType( _gametype_timelimit );
+ gameconfig->gametype = _gametype_timelimit;
}
break;
@@ -132,7 +134,7 @@
static char * getGameTypeString()
{
- switch ( GameConfig::GetGameType() ) {
+ switch ( gameconfig->gametype ) {
case _gametype_objective: {
return( "Objective" );
}
@@ -154,37 +156,41 @@
static void bIncreaseTimeLimit()
{
- GameConfig::SetTimeLimit( GameConfig::GetTimeLimit() + 5 );
+ if(gameconfig->timelimit + 5 <= gameconfig->timelimit.getMax())
+ gameconfig->timelimit = gameconfig->timelimit + 5;
}
static void bDecreaseTimeLimit()
{
- GameConfig::SetTimeLimit( GameConfig::GetTimeLimit() - 5 );
+ if(gameconfig->timelimit - 5 >= gameconfig->timelimit.getMin())
+ gameconfig->timelimit = gameconfig->timelimit - 5;
}
static int getTimeLimitHours()
{
- return( GameConfig::GetTimeLimit() / 60 );
+ return gameconfig->timelimit / 60;
}
static int getTimeLimitMinutes()
{
- return( GameConfig::GetTimeLimit() % 60 );
+ return gameconfig->timelimit % 60;
}
static void bIncreaseFragLimit()
{
- GameConfig::SetFragLimit( GameConfig::GetFragLimit() + 5 );
+ if(gameconfig->fraglimit + 5 <= gameconfig->fraglimit.getMax())
+ gameconfig->fraglimit = gameconfig->fraglimit + 5;
}
static void bDecreaseFragLimit()
{
- GameConfig::SetFragLimit( GameConfig::GetFragLimit() - 5 );
+ if(gameconfig->fraglimit - 5 >= gameconfig->fraglimit.getMin())
+ gameconfig->fraglimit = gameconfig->fraglimit - 5;
}
static int getFragLimit()
{
- return( GameConfig::GetFragLimit() );
+ return gameconfig->fraglimit;
}
void HostOptionsView::updateWindSpeedString()
@@ -198,27 +204,27 @@
switch (windSpeed) {
case 0: {
windSpeedString = "Calm";
- GameConfig::setWindSpeed(calmWindSpeed);
+ gameconfig->windspeed = int(calmWindSpeed);
}
break;
case 1: {
windSpeedString = "Breezy";
- GameConfig::setWindSpeed(breezyWindSpeed);
+ gameconfig->windspeed = int(breezyWindSpeed);
}
break;
case 2: {
windSpeedString = "Brisk Winds";
- GameConfig::setWindSpeed(briskWindSpeed);
+ gameconfig->windspeed = int(briskWindSpeed);
}
break;
case 3: {
windSpeedString = "Heavy Winds";
- GameConfig::setWindSpeed(heavyWindSpeed);
+ gameconfig->windspeed = int(heavyWindSpeed);
}
break;
case 4: {
windSpeedString = "Typhoon";
- GameConfig::setWindSpeed(typhoonWindSpeed);
+ gameconfig->windspeed = int(typhoonWindSpeed);
}
break;
}
@@ -226,17 +232,23 @@
static int getObjectiveCapturePercent()
{
- return int(GameConfig::getObjectiveOccuapationPercentage());
+ return gameconfig->objectiveoccupationpercentage;
}
static void bIncreaseObjectiveCapturePercent()
{
- GameConfig::increaseObjectiveOccuapationPercentage();
+ if(gameconfig->objectiveoccupationpercentage + 5 <=
+ gameconfig->objectiveoccupationpercentage.getMax())
+ gameconfig->objectiveoccupationpercentage =
+ gameconfig->objectiveoccupationpercentage + 5;
}
static void bDecreaseObjectiveCapturePercent()
{
- GameConfig::decreaseObjectiveOccuapationPercentage();
+ if(gameconfig->objectiveoccupationpercentage - 5 >=
+ gameconfig->objectiveoccupationpercentage.getMin())
+ gameconfig->objectiveoccupationpercentage =
+ gameconfig->objectiveoccupationpercentage - 5;
}
@@ -392,12 +404,12 @@
xChoiceOffset += minWidth + 10;
checkMapCycle.setLabel("Cycle Maps");
- checkMapCycle.setState( (bool) (GameConfig::getMapCycleState()) );
+ checkMapCycle.setState(gameconfig->mapcycling);
checkMapCycle.setLocation(2, 125);
add(&checkMapCycle);
checkPowerUp.setLabel("PowerUps");
- checkPowerUp.setState( (bool) (GameConfig::getPowerUpState()) );
+ checkPowerUp.setState(gameconfig->powerups);
checkPowerUp.setLocation(120, 125);
add(&checkPowerUp);
@@ -511,19 +523,11 @@
{
if (me.getSource(checkMapCycle)) {
if ( getVisible() ) {
- if (checkMapCycle.getState()) {
- GameConfig::setMapCycleState( true );
- } else {
- GameConfig::setMapCycleState( false );
- }
+ gameconfig->mapcycling = checkMapCycle.getState();
}
} else if (me.getSource(checkPowerUp)) {
if ( getVisible() ) {
- if (checkPowerUp.getState()) {
- GameConfig::setPowerUpState( true );
- } else {
- GameConfig::setPowerUpState( false );
- }
+ gameconfig->powerups = checkPowerUp.getState();
}
} else if (me.getSource(choiceWindSpeed)) {
windSpeed = choiceWindSpeed.getSelectedIndex();
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostView.cpp:1.7
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostView.cpp:1.8
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostView.cpp:1.7 Tue Sep
16 16:16:13 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostView.cpp Sat Oct 4
10:44:40 2003
@@ -97,18 +97,18 @@
y += yOffset;
y += yOffset;
- sprintf(strBuf, "%d frags", GameConfig::GetFragLimit());
+ sprintf(strBuf, "%d frags", gameconfig->GetFragLimit());
clientArea.bltString( x + 220, y, strBuf, Color::white);
y += yOffset;
- if ((GameConfig::GetTimeLimit() / 60) > 0)
+ if ((gameconfig->GetTimeLimit() / 60) > 0)
{
- sprintf(strBuf, "%d hours %2d minutes",
GameConfig::GetTimeLimit() / 60, GameConfig::GetTimeLimit() % 60);
+ sprintf(strBuf, "%d hours %2d minutes",
gameconfig->GetTimeLimit() / 60, gameconfig->GetTimeLimit() % 60);
clientArea.bltString( x + 220, y, strBuf, Color::white);
y += yOffset;
} else
{
- sprintf(strBuf, "%d minutes", GameConfig::GetTimeLimit());
+ sprintf(strBuf, "%d minutes", gameconfig->GetTimeLimit());
clientArea.bltString( x + 220, y, strBuf, Color::white);
y += yOffset;
}
@@ -116,7 +116,7 @@
sprintf(strBuf, "Player #:");
clientArea.bltString(x + 2, y, strBuf, Color::white);
- sprintf(strBuf, "%3d", GameConfig::GetNumberPlayers());
+ sprintf(strBuf, "%3d", gameconfig->GetNumberPlayers());
clientArea.bltString(x + 125, y, strBuf, Color::white);
*/
View::doDraw(viewArea, clientArea);
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp:1.14
netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp:1.15
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp:1.14
Wed Sep 24 13:43:23 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp Sat Oct
4 10:44:40 2003
@@ -44,7 +44,7 @@
MapSelectionView::curMap = 0;
}
-
GameConfig::setGameMapName(MapSelectionView::mapList[MapSelectionView::curMap].name);
+ gameconfig->map = MapSelectionView::mapList[MapSelectionView::curMap].name;
HostOptionsView::updateGameConfigCloudCoverage();
}
@@ -59,7 +59,7 @@
MapSelectionView::curMap = MapSelectionView::mapList.getCount() - 1;
}
-
GameConfig::setGameMapName(MapSelectionView::mapList[MapSelectionView::curMap].name);
+ gameconfig->map = MapSelectionView::mapList[MapSelectionView::curMap].name;
HostOptionsView::updateGameConfigCloudCoverage();
}
@@ -234,7 +234,7 @@
char buffer[128];
readLine(buffer, sizeof(buffer), &(*file));
if(!sscanf(buffer, "ObjectiveCount: %d", &objectiveCount)) {
- GameConfig::setGameMapName("");
+ gameconfig->map = "";
return 1;
}
@@ -249,7 +249,7 @@
throw Exception("ERROR: No maps in map directory");
}
- GameConfig::setGameMapName(MapSelectionView::mapList[curMap].name);
+ gameconfig->map = MapSelectionView::mapList[curMap].name;
curMap = 0;
// Success
Index: netpanzer/src/NetPanzer/Views/MainMenu/Options/InterfaceView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Options/InterfaceView.cpp:1.6
netpanzer/src/NetPanzer/Views/MainMenu/Options/InterfaceView.cpp:1.7
--- netpanzer/src/NetPanzer/Views/MainMenu/Options/InterfaceView.cpp:1.6
Mon Sep 22 09:53:54 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Options/InterfaceView.cpp Sat Oct
4 10:44:40 2003
@@ -15,9 +15,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-
#include <config.h>
+
#include "InterfaceView.hpp"
#include "GameConfig.hpp"
#include "GameViewGlobals.hpp"
@@ -26,80 +25,21 @@
static void bIncreaseScrollRate()
{
- GameConfig::setScrollRate(GameConfig::getScrollRate() + 100);
+ if(gameconfig->scrollrate + 100 <= gameconfig->scrollrate.getMax())
+ gameconfig->scrollrate = gameconfig->scrollrate + 100;
}
static void bDecreaseScrollRate()
{
- GameConfig::setScrollRate(GameConfig::getScrollRate() - 100);
-}
-
-static void bIncreaseMiniMapResizeRate()
-{
- GameConfig::setMiniMapResizeRate(GameConfig::getMiniMapResizeRate() + 100);
-}
-
-static void bDecreaseMiniMapResizeRate()
-{
- GameConfig::setMiniMapResizeRate(GameConfig::getMiniMapResizeRate() - 100);
+ if(gameconfig->scrollrate - 100 >= gameconfig->scrollrate.getMin())
+ gameconfig->scrollrate = gameconfig->scrollrate - 100;
}
static int getScrollRate()
{
- return (int) GameConfig::getScrollRate();
-}
-
-static int getMiniMapResizeRate()
-{
- return int(GameConfig::getMiniMapResizeRate());
-}
-
-static int getConsoleTextDelay()
-{
- return int(GameConfig::getConsoleTextDelay());
+ return (int) gameconfig->scrollrate;
}
-static int getConsoleTextScreenPercent()
-{
- return GameConfig::getConsoleTextUsage();
-}
-
-static void bIncreaseConsoleTextDelay()
-{
- GameConfig::setConsoleTextDelay(GameConfig::getConsoleTextDelay() + 1);
-}
-
-static void bDecreaseConsoleTextDelay()
-{
- GameConfig::setConsoleTextDelay(GameConfig::getConsoleTextDelay() - 1);
-}
-
-static void bIncreaseConsoleTextScreenPercent()
-{
- GameConfig::setConsoleTextUsage(GameConfig::getConsoleTextUsage() + 1);
-}
-
-static void bDecreaseConsoleTextScreenPercent()
-{
- GameConfig::setConsoleTextUsage(GameConfig::getConsoleTextUsage() - 1);
-}
-
-static void bIncreaseUnitAttackNotificationTime()
-{
- GameConfig::increaseAttackNotificationTime();
-}
-
-static void bDecreaseUnitAttackNotificationTime()
-{
- GameConfig::decreaseAttackNotificationTime();
-}
-
-static int getUnitAttackNotificationTime()
-{
- return GameConfig::getAttackNotificationTime();
-}
-
-
// InterfaceView
//---------------------------------------------------------------------------
InterfaceView::InterfaceView() : OptionsTemplateView()
@@ -137,41 +77,6 @@
x += optionsMeterWidth + arrowButtonWidth;
addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "",
bIncreaseScrollRate);
y += yOffset;
-
- x = xTextStart;
- addLabel(iXY(x, y), "MiniMap Resize Rate", Color::white);
- x = optionsMeterStartX;
- addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "",
bDecreaseMiniMapResizeRate);
- x += optionsMeterWidth + arrowButtonWidth;
- addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "",
bIncreaseMiniMapResizeRate);
- y += yOffset;
-
- x = xTextStart;
- addLabel(iXY(x, y), "Console Text Delay", Color::white);
- x = optionsMeterStartX;
- addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "",
bDecreaseConsoleTextDelay);
- x += optionsMeterWidth + arrowButtonWidth;
- addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "",
bIncreaseConsoleTextDelay);
- y += yOffset;
-
- x = xTextStart;
- addLabel(iXY(x, y), "Console Text Max Lines", Color::white);
- x = optionsMeterStartX;
- addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "",
bDecreaseConsoleTextScreenPercent);
- x += optionsMeterWidth + arrowButtonWidth;
- addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "",
bIncreaseConsoleTextScreenPercent);
- y += yOffset;
-
- x = xTextStart;
- addLabel(iXY(x, y), "MiniMap Attack Notify Duration", Color::white);
- x = optionsMeterStartX;
- addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "",
bDecreaseUnitAttackNotificationTime);
- x += optionsMeterWidth + arrowButtonWidth;
- addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "",
bIncreaseUnitAttackNotificationTime);
- y += yOffset;
-
- // Interface Options to add.
- // Scroll Method - Accelerate over time / constant rate.
}
// doDraw
@@ -185,49 +90,16 @@
const int arrowButtonWidth = 16;
int x = optionsMeterStartX + arrowButtonWidth;
int y = bodyTextRect.min.y + 15;
- int yOffset = 15;
Surface tempSurface(optionsMeterWidth, 14, optionsMeterWidth, 1);
// Scroll Rate
tempSurface.fill(meterColor);
tempSurface.drawButtonBorder(meterTopLeftBorderColor,
meterBottomRightBorderColor);
- sprintf(strBuf, "%d %%", int((float(getScrollRate()) /
float(GameConfig::getScrollRateBoundsUpper())) * 100.0f));
+ sprintf(strBuf, "%d %%", int((float(getScrollRate()) /
+ float(gameconfig->scrollrate.getMax())) * 100.0f));
tempSurface.bltStringCenter(strBuf, meterTextColor);
tempSurface.blt(clientArea, x, y);
-
- // MiniMap Resize Rate
- y += yOffset;
- tempSurface.fill(meterColor);
- tempSurface.drawButtonBorder(meterTopLeftBorderColor,
meterBottomRightBorderColor);
- sprintf(strBuf, "%d %%", int((float(getMiniMapResizeRate()) /
float(GameConfig::getMiniMapResizeRateBoundsUpper())) * 100.0f));
- tempSurface.bltStringCenter(strBuf, meterTextColor);
- tempSurface.blt(clientArea, x, y);
-
- // Console Text Delay
- y += yOffset;
- tempSurface.fill(meterColor);
- tempSurface.drawButtonBorder(meterTopLeftBorderColor,
meterBottomRightBorderColor);
- sprintf(strBuf, "%d seconds", getConsoleTextDelay());
- tempSurface.bltStringCenter(strBuf, meterTextColor);
- tempSurface.blt(clientArea, x, y);
-
- // Console Text Max Lines
- y += yOffset;
- tempSurface.fill(meterColor);
- tempSurface.drawButtonBorder(meterTopLeftBorderColor,
meterBottomRightBorderColor);
- sprintf(strBuf, "%d lines", getConsoleTextScreenPercent());
- tempSurface.bltStringCenter(strBuf, meterTextColor);
- tempSurface.blt(clientArea, x, y);
-
- // Unit Attack Notification Time
- y += yOffset;
- tempSurface.fill(meterColor);
- tempSurface.drawButtonBorder(meterTopLeftBorderColor,
meterBottomRightBorderColor);
- sprintf(strBuf, "%d seconds", getUnitAttackNotificationTime());
- tempSurface.bltStringCenter(strBuf, meterTextColor);
- tempSurface.blt(clientArea, x, y);
-
} // end InterfaceView::doDraw
// loadTitleSurface
Index: netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.cpp:1.10
netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.cpp:1.11
--- netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.cpp:1.10 Fri Oct
3 10:45:19 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.cpp Sat Oct
4 10:44:41 2003
@@ -54,7 +54,7 @@
choiceResolution.addItem("800x600");
choiceResolution.addItem("1024x768");
choiceResolution.setLocation(x, y);
- choiceResolution.select(GameConfig::getScreenResolution());
+ choiceResolution.select(gameconfig->screenresolution);
choiceResolution.setMinWidth(minWidth);
checkBoxFullscreen.setLabel("Fullscreen");
@@ -69,166 +69,25 @@
choiceMiniMapUnitSize.addItem("Small");
choiceMiniMapUnitSize.addItem("Large");
choiceMiniMapUnitSize.setLocation(x, y);
- choiceMiniMapUnitSize.select(GameConfig::getMiniMapUnitSize());
+ choiceMiniMapUnitSize.select(gameconfig->radar_unitsize);
choiceMiniMapUnitSize.setMinWidth(minWidth);
y += yOffset;
y += yOffset;
-#if 0
- choiceGameViewBackgroundColor.setName("Game View Background Color");
- choiceGameViewBackgroundColor.setStateChangedCallback(this);
- choiceGameViewBackgroundColor.addItemDefault("Dark Gray Blend");
- choiceGameViewBackgroundColor.addItem("Light Gray Blend");
- choiceGameViewBackgroundColor.addItem("Solid Black");
- choiceGameViewBackgroundColor.addItem("Transparent");
- choiceGameViewBackgroundColor.setLocation(x, y);
- choiceGameViewBackgroundColor.setMinWidth(minWidth);
- y += yOffset;
- y += yOffset;
-
- choiceMiniMapObjectiveDrawMode.setName("Mini Map Objective Draw Mode");
- choiceMiniMapObjectiveDrawMode.setStateChangedCallback(this);
- choiceMiniMapObjectiveDrawMode.addItemDefault("Outlined");
- choiceMiniMapObjectiveDrawMode.addItem("Solid");
- choiceMiniMapObjectiveDrawMode.setLocation(x, y);
- choiceMiniMapObjectiveDrawMode.setMinWidth(minWidth);
- y += yOffset;
- y += yOffset;
-
- x = 300;
- y = 100;
- choiceUnitSelectionDrawMode.setName("Unit Selection Draw Mode");
- choiceUnitSelectionDrawMode.setStateChangedCallback(this);
- choiceUnitSelectionDrawMode.addItemDefault("Rectangle Edges");
- choiceUnitSelectionDrawMode.addItem("Rectangle Outline");
- choiceUnitSelectionDrawMode.setLocation(x, y);
- choiceUnitSelectionDrawMode.setMinWidth(minWidth);
- y += yOffset;
- y += yOffset;
-
- //choiceUnitInfoDrawLayer.setName("Unit Information Draw Layer");
- //choiceUnitInfoDrawLayer.setStateChangedCallback(this);
- //choiceUnitInfoDrawLayer.addItemDefault("Bottom");
- //choiceUnitInfoDrawLayer.addItem("Top");
- //choiceUnitInfoDrawLayer.setLocation(x, y);
- //choiceUnitInfoDrawLayer.setMinWidth(minWidth);
- //y += yOffset;
- //y += yOffset;
-
- //x = xTextStart;
- //addLabel(iXY(x, y), "Brightness", Color::white);
- //x = optionsMeterStartX;
- //addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "",
bDecreaseBrightness);
- //x += optionsMeterWidth + arrowButtonWidth;
- //addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "",
bIncreaseBrightness);
- //y += yOffset;
-#endif
-
// Other visual options to add.
// Gamma
// Blend Mouse.
- // Color Settings
- //----------------------------------------------------------------------
-#if 0
- minWidth = 13 * CHAR_XPIX;
-
- x = xTextStart + 10;
- y = 100 + 110;
- choiceYourRadarUnit.setName("Your Radar Unit");
- choiceYourRadarUnit.setStateChangedCallback(this);
- choiceYourRadarUnit.addItem("Aqua");
- choiceYourRadarUnit.addItem("Blue");
- choiceYourRadarUnit.addItem("Dark Blue");
- choiceYourRadarUnit.addItem("Blue Gray");
- choiceYourRadarUnit.addItem("Red");
- choiceYourRadarUnit.addItem("Dark Red");
- choiceYourRadarUnit.addItem("Light Green");
- choiceYourRadarUnit.addItem("Green");
- choiceYourRadarUnit.addItem("Dark Green");
- choiceYourRadarUnit.addItem("Yellow");
- choiceYourRadarUnit.addItem("Light Orange");
- choiceYourRadarUnit.addItem("Orange");
- choiceYourRadarUnit.addItem("Black");
- choiceYourRadarUnit.addItem("White");
- choiceYourRadarUnit.addItem("Gray");
- choiceYourRadarUnit.addItem("Dark Gray");
- choiceYourRadarUnit.setLocation(x, y);
- choiceYourRadarUnit.setMinWidth(minWidth);
- choiceYourRadarUnit.select(GameConfig::getPlayerRadarUnitColorEnum());
- y += yOffset;
- y += yOffset;
-
- choiceAlliedRadarUnit.setName("Allied Radar Unit");
- choiceAlliedRadarUnit.setStateChangedCallback(this);
- choiceAlliedRadarUnit.copyItems(choiceYourRadarUnit);
- choiceAlliedRadarUnit.setLocation(x, y);
- choiceAlliedRadarUnit.setMinWidth(minWidth);
- choiceAlliedRadarUnit.select(GameConfig::getAlliedRadarUnitColorEnum());
- y += yOffset;
- y += yOffset;
-
- choiceYourRadarObjective.setName("Your Radar Objective");
- choiceYourRadarObjective.setStateChangedCallback(this);
- choiceYourRadarObjective.copyItems(choiceYourRadarUnit);
- choiceYourRadarObjective.setLocation(x, y);
- choiceYourRadarObjective.setMinWidth(minWidth);
-
choiceYourRadarObjective.select(GameConfig::getPlayerOutpostRadarColorEnum());
- y += yOffset;
- y += yOffset;
-
- choiceAlliedRadarObjective.setName("Allied Radar Objective");
- choiceAlliedRadarObjective.setStateChangedCallback(this);
- choiceAlliedRadarObjective.copyItems(choiceYourRadarUnit);
- choiceAlliedRadarObjective.setLocation(x, y);
- choiceAlliedRadarObjective.setMinWidth(minWidth);
-
choiceAlliedRadarObjective.select(GameConfig::getAlliedOutpostRadarColorEnum());
- y += yOffset;
- y += yOffset;
-
- x = 300;
- y = 100 + 110;
- choiceEnemyRadarObjective.setName("Enemy Radar Objective");
- choiceEnemyRadarObjective.setStateChangedCallback(this);
- choiceEnemyRadarObjective.copyItems(choiceYourRadarUnit);
- choiceEnemyRadarObjective.setLocation(x, y);
- choiceEnemyRadarObjective.setMinWidth(minWidth);
-
choiceEnemyRadarObjective.select(GameConfig::getEnemyOutpostRadarColorEnum());
- y += yOffset;
- y += yOffset;
-
- choiceVehicleSelectionBox.setName("Vehicle Selection Box");
- choiceVehicleSelectionBox.setStateChangedCallback(this);
- choiceVehicleSelectionBox.copyItems(choiceYourRadarUnit);
- choiceVehicleSelectionBox.setLocation(x, y);
- choiceVehicleSelectionBox.setMinWidth(minWidth);
-
choiceVehicleSelectionBox.select(GameConfig::getVehicleSelectionBoxColorEnum());
- y += yOffset;
- y += yOffset;
-
- choiceConsoleText.setName("Console Text");
- choiceConsoleText.setStateChangedCallback(this);
- choiceConsoleText.copyItems(choiceYourRadarUnit);
- choiceConsoleText.setLocation(x, y);
- choiceConsoleText.setMinWidth(minWidth);
- choiceConsoleText.select(GameConfig::getConsoleTextColorEnum());
- y += yOffset;
- y += yOffset;
-
- x = 300;
- y = 344;
-#endif
-
checkBoxDrawAllShadows.setLabel("Draw All Shadows");
checkBoxDrawAllShadows.setStateChangedCallback(this);
- checkBoxDrawAllShadows.setState(GameConfig::getDisplayShadowsFlag());
+ checkBoxDrawAllShadows.setState(gameconfig->displayshadows);
checkBoxDrawAllShadows.setLocation(x, y);
y += yOffset;
checkBoxBlendSmoke.setLabel("Blend Smoke");
checkBoxBlendSmoke.setStateChangedCallback(this);
- checkBoxBlendSmoke.setState(GameConfig::getBlendSmoke());
+ checkBoxBlendSmoke.setState(gameconfig->blendsmoke);
checkBoxBlendSmoke.setLocation(x, y);
y += yOffset;
} // end VisualsView::VisualsView
@@ -272,18 +131,6 @@
void VisualsView::processEvents()
{
OptionsTemplateView::processEvents();
-#if 0
-
GameConfig::setPlayerRadarUnitColor(choiceYourRadarUnit.getSelectedIndex());
-
GameConfig::setAlliedRadarUnitColor(choiceAlliedRadarUnit.getSelectedIndex());
-
GameConfig::setPlayerOutpostRadarColor(choiceYourRadarObjective.getSelectedIndex());
-
GameConfig::setAlliedOutpostRadarColor(choiceAlliedRadarObjective.getSelectedIndex());
-
GameConfig::setEnemyOutpostRadarColor(choiceEnemyRadarObjective.getSelectedIndex());
-
GameConfig::setVehicleSelectionBoxColor(choiceVehicleSelectionBox.getSelectedIndex());
- GameConfig::setConsoleTextColor(choiceConsoleText.getSelectedIndex());
-
- GameManager::setNetPanzerGameOptions();
-#endif
-
} // end VisualsView::processEvents
// loadTitleSurface
@@ -299,71 +146,27 @@
{
// Check Box Draw All Shadows
if (source == &checkBoxDrawAllShadows) {
- GameConfig::setDisplayShadowsFlag(checkBoxDrawAllShadows.getState());
+ gameconfig->displayshadows = checkBoxDrawAllShadows.getState();
}
// Check Box Blend Smoke
else if (source == &checkBoxBlendSmoke) {
- if (checkBoxBlendSmoke.getState()) {
- GameConfig::setBlendSmokeTrue();
- } else {
- GameConfig::setBlendSmokeFalse();
- }
+ gameconfig->blendsmoke = checkBoxBlendSmoke.getState();
} else if (source == &checkBoxFullscreen) {
- GameConfig::setFullscreen(checkBoxFullscreen.getState());
+ gameconfig->fullscreen = checkBoxFullscreen.getState();
GameManager::setVideoMode();
}
// Choice Resolution
else if (source == &choiceResolution) {
- GameConfig::setScreenResolution(choiceResolution.getSelectedIndex());
+ gameconfig->screenresolution = choiceResolution.getSelectedIndex();
GameManager::setVideoMode();
}
- // Choice Game View Background Color
- else if (source == &choiceGameViewBackgroundColor) {
- if (choiceGameViewBackgroundColor.getSelectedIndex() == 0) {
- viewDrawBackgroundMode = VIEW_BACKGROUND_DARK_GRAY_BLEND;
- } else if (choiceGameViewBackgroundColor.getSelectedIndex() == 1) {
- viewDrawBackgroundMode = VIEW_BACKGROUND_LIGHT_GRAY_BLEND;
- } else if (choiceGameViewBackgroundColor.getSelectedIndex() == 2) {
- viewDrawBackgroundMode = VIEW_BACKGROUND_SOLID_BLACK;
- } else if (choiceGameViewBackgroundColor.getSelectedIndex() == 3) {
- viewDrawBackgroundMode = VIEW_BACKGROUND_TRANSPARENT;
- }
- }
- // Choice MiniMap Objective Draw Mode
- else if (source == &choiceMiniMapObjectiveDrawMode) {
- if (choiceMiniMapObjectiveDrawMode.getSelectedIndex() == 0) {
-
GameConfig::setMiniMapObjectiveDrawMode(_mini_map_objective_draw_mode_outline_rect);
- } else if (choiceMiniMapObjectiveDrawMode.getSelectedIndex() == 1) {
-
GameConfig::setMiniMapObjectiveDrawMode(_mini_map_objective_draw_mode_solid_rect);
- }
- }
// Choice Mini Map Unit Size
else if (source == &choiceMiniMapUnitSize) {
if (choiceMiniMapUnitSize.getSelectedIndex() == 0) {
- GameConfig::setMiniMapUnitSize(_mini_map_unit_size_small);
+ gameconfig->radar_unitsize = _mini_map_unit_size_small;
} else if (choiceMiniMapUnitSize.getSelectedIndex() == 1) {
- GameConfig::setMiniMapUnitSize(_mini_map_unit_size_large);
- }
- }
- // Choice Unit Selection Draw Mode
- else if (source == &choiceUnitSelectionDrawMode) {
- if (choiceUnitSelectionDrawMode.getSelectedIndex() == 0) {
-
GameConfig::setUnitSelectionBoxDrawMode(_unit_selection_box_draw_mode_rect_edges);
- } else if (choiceUnitSelectionDrawMode.getSelectedIndex() == 1) {
-
GameConfig::setUnitSelectionBoxDrawMode(_unit_selection_box_draw_mode_rect);
+ gameconfig->radar_unitsize = _mini_map_unit_size_large;
}
}
- // Choice Unit Info Draw Layer
- //else if (source == &choiceUnitInfoDrawLayer)
- //{
- // if (choiceUnitInfoDrawLayer.getSelectedIndex() == 0)
- // {
- // GameConfig::setUnitInfoDrawLayerBottom();
- // }
- // else if (choiceUnitInfoDrawLayer.getSelectedIndex() == 1)
- // {
- // GameConfig::setUnitInfoDrawLayerTop();
- // }
- //}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer ./ChangeLog ./TODO src/Jamfile src/Li...,
Matthias Braun <=