[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer ./BUGS ./ChangeLog src/Bot/Bot.cpp sr...
From: |
Ivo Danihelka |
Subject: |
[netPanzer-CVS] netpanzer ./BUGS ./ChangeLog src/Bot/Bot.cpp sr... |
Date: |
Wed, 22 Oct 2003 09:19:33 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Ivo Danihelka <address@hidden> 03/10/22 09:19:32
Modified files:
. : BUGS ChangeLog
src/Bot : Bot.cpp Bot.hpp
src/NetPanzer/Classes: TileSet.cpp
src/NetPanzer/Classes/Network: ClientConnectDaemon.cpp
src/NetPanzer/Core: main.cpp
src/NetPanzer/Interfaces: GameControlRulesDaemon.cpp
GameControlRulesDaemon.hpp
GameManager.cpp GameManager.hpp
ObjectiveInterface.cpp
ObjectiveInterface.hpp
src/NetPanzer/Interfaces/unix: NetworkClientUnix.cpp
src/NetPanzer/Views/Game: LobbyView.cpp LobbyView.hpp
ProgressView.cpp ProgressView.hpp
WinnerMesgView.cpp
src/NetPanzer/Views/MainMenu/Multi: HostJoinTemplateView.cpp
Added files:
src/NetPanzer/Interfaces: BaseGameManager.cpp
BaseGameManager.hpp BotGameManager.cpp
BotGameManager.hpp
DedicatedGameManager.cpp
DedicatedGameManager.hpp
PlayerGameManager.cpp
PlayerGameManager.hpp
src/NetPanzer/Views/Game: ConsoleLoadingView.cpp
ConsoleLoadingView.hpp LoadingView.hpp
Log message:
-split GameManager to BotGameManager, DedicatedGameManager and
PlayerGameManager
-bot can be started from command line (-b option)
Patches:
Index: netpanzer/BUGS
diff -u netpanzer/BUGS:1.2 netpanzer/BUGS:1.3
--- netpanzer/BUGS:1.2 Mon Oct 13 10:30:04 2003
+++ netpanzer/BUGS Wed Oct 22 09:19:27 2003
@@ -26,3 +26,7 @@
<kov> #4 0x08086c5b in main (argc=327, argv=0x147) at
src/NetPanzer/Core/main.cpp:215
<kov> No locals.
<kov> (gdb)
+//-----------------------------------------------------------------
+- still SIGSEGV when client disconnect
+- does not display unit pictures in factory - fixed
+- objective game cannot finish - fixed
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.15 netpanzer/ChangeLog:1.16
--- netpanzer/ChangeLog:1.15 Mon Oct 20 18:34:10 2003
+++ netpanzer/ChangeLog Wed Oct 22 09:19:27 2003
@@ -1,3 +1,8 @@
+22-Oct-2003 by Ivo Danihelka
+-split GameManager to BotGameManager, DedicatedGameManager
+ and PlayerGameManager
+-bot can be started from command line (-b option)
+
21-Oct-2003 by Matthias Braun
-fixed the missing unit pictures in build menu
Index: netpanzer/src/Bot/Bot.cpp
diff -u netpanzer/src/Bot/Bot.cpp:1.1 netpanzer/src/Bot/Bot.cpp:1.2
--- netpanzer/src/Bot/Bot.cpp:1.1 Tue Sep 23 08:14:03 2003
+++ netpanzer/src/Bot/Bot.cpp Wed Oct 22 09:19:27 2003
@@ -18,7 +18,6 @@
#include <config.h>
#include "Bot.hpp"
-#include "BotPlayer.hpp"
#include "PlacementMatrix.hpp"
#include "TerminalNetMesg.hpp"
@@ -29,15 +28,21 @@
#include "Objective.hpp"
#include "Log.hpp"
-Bot *Bot::s_bot = new BotPlayer();
+Bot *Bot::s_bot = 0;
//-----------------------------------------------------------------
void
-Bot::switchBot(Bot *bot)
+Bot::initialize(Bot *bot)
+{
+ s_bot = bot;
+}
+//-----------------------------------------------------------------
+void
+Bot::shutdown()
{
if (s_bot) {
delete s_bot;
+ s_bot = 0;
}
- s_bot = bot;
}
//-----------------------------------------------------------------
void
Index: netpanzer/src/Bot/Bot.hpp
diff -u netpanzer/src/Bot/Bot.hpp:1.1 netpanzer/src/Bot/Bot.hpp:1.2
--- netpanzer/src/Bot/Bot.hpp:1.1 Tue Sep 23 08:14:03 2003
+++ netpanzer/src/Bot/Bot.hpp Wed Oct 22 09:19:27 2003
@@ -27,7 +27,8 @@
class Bot {
static class Bot *s_bot;
public:
- static void switchBot(Bot *bot);
+ static void initialize(Bot *bot);
+ static void shutdown();
static Bot *bot() { return s_bot; }
virtual ~Bot() {}
Index: netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp
diff -u netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp:1.8
netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp:1.9
--- netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp:1.8 Sat Oct
4 10:44:37 2003
+++ netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp Wed Oct
22 09:19:28 2003
@@ -84,28 +84,28 @@
switch( join_request_ack_mesg->result_code ) {
case _join_request_result_success :
- lobbyView.scrollAndUpdate( "Link to Server Established" );
+ lobbyView->scrollAndUpdate( "Link to Server Established" );
sprintf( buf, "Protocol Version: %u",
join_request_ack_mesg->server_protocol_version);
- lobbyView.scrollAndUpdate( buf );
+ lobbyView->scrollAndUpdate( buf );
break;
case _join_request_result_invalid_protocol :
- lobbyView.scrollAndUpdate( "Link to Server FAILED!" );
- lobbyView.scrollAndUpdate( "Incorrect Network Protocol Revision" );
- lobbyView.scrollAndUpdate( "Please update your netPanzer executable
at" );
- lobbyView.scrollAndUpdate( "www.nongnu.org/netpanzer" );
+ lobbyView->scrollAndUpdate( "Link to Server FAILED!" );
+ lobbyView->scrollAndUpdate( "Incorrect Network Protocol Revision" );
+ lobbyView->scrollAndUpdate( "Please update your netPanzer executable
at" );
+ lobbyView->scrollAndUpdate( "www.nongnu.org/netpanzer" );
sprintf( buf, "Server Protocol Version: %u",
join_request_ack_mesg->server_protocol_version);
- lobbyView.scrollAndUpdate( buf );
+ lobbyView->scrollAndUpdate( buf );
connection_state = _connect_state_connect_failure;
failure_display_timer.reset();
break;
case _join_request_result_server_busy :
- lobbyView.scrollAndUpdate( "Link to Server FAILED!" );
- lobbyView.scrollAndUpdate( "Server is VERY busy" );
- lobbyView.scrollAndUpdate( "Please try in a few minutes" );
+ lobbyView->scrollAndUpdate( "Link to Server FAILED!" );
+ lobbyView->scrollAndUpdate( "Server is VERY busy" );
+ lobbyView->scrollAndUpdate( "Please try in a few minutes" );
connection_state = _connect_state_connect_failure;
failure_display_timer.reset();
break;
@@ -127,7 +127,7 @@
sprintf( buf, "Your Position In Queue is %d ",
process_update->queue_position );
- lobbyView.scrollAndUpdate( buf );
+ lobbyView->scrollAndUpdate( buf );
}
void ClientConnectDaemon::netMessageConnectProcessMessage( NetMessage
*message )
@@ -140,35 +140,35 @@
switch ( state_mesg->message_enum ) {
case _connect_state_message_load_game_data : {
- lobbyView.scrollAndUpdate( "Loading Game Data ..." );
+ lobbyView->scrollAndUpdate( "Loading Game Data ..." );
}
break;
case _connect_state_message_sync_player_info : {
- lobbyView.scrollAndUpdate( "Sychronizing Player Info ..." );
+ lobbyView->scrollAndUpdate( "Sychronizing Player Info ..." );
}
break;
case _connect_state_message_sync_player_info_percent : {
sprintf( str_buf, "Sychronizing Player Info ... (%d%%)",
state_mesg->percent_complete);
- lobbyView.update( str_buf );
+ lobbyView->update( str_buf );
}
break;
case _connect_state_message_sync_units : {
- lobbyView.scrollAndUpdate( "Sychronizing Game Elements ..." );
+ lobbyView->scrollAndUpdate( "Sychronizing Game Elements ..." );
}
break;
case _connect_state_message_sync_units_percent : {
sprintf( str_buf, "Sychronizing Game Elements ... (%d%%)",
state_mesg->percent_complete);
- lobbyView.update( str_buf );
+ lobbyView->update( str_buf );
}
break;
case _connect_state_sync_complete : {
- lobbyView.scrollAndUpdate( "Game Synchronized" );
- lobbyView.toggleGameView();
+ lobbyView->scrollAndUpdate( "Game Synchronized" );
+ lobbyView->toggleGameView();
}
break;
@@ -220,12 +220,12 @@
{
switch( result_code ) {
case _connect_result_server_busy : {
- lobbyView.scrollAndUpdate( "Connect Failure: Server Too Busy" );
+ lobbyView->scrollAndUpdate( "Connect Failure: Server Too Busy" );
}
break;
case _connect_result_server_full : {
- lobbyView.scrollAndUpdate( "Connect Failure: Server Full" );
+ lobbyView->scrollAndUpdate( "Connect Failure: Server Full" );
}
break;
} // ** switch
@@ -244,7 +244,7 @@
case _connect_state_wait_for_connect_start : {
if ( message != 0 ) {
if ( message->message_id ==
_net_message_id_client_start_connect ) {
- lobbyView.scrollAndUpdate( "Connecting ..." );
+ lobbyView->scrollAndUpdate( "Connecting ..." );
connection_state = _connect_state_send_connect_request;
} else {
end_cycle = true;
@@ -301,7 +301,7 @@
CLIENT->sendMessage( &connect_request,
sizeof(ClientConnectRequest), 0 );
time_out_counter++;
} else {
- lobbyView.scrollAndUpdate( "Connection To
Server Failed" );
+ lobbyView->scrollAndUpdate( "Connection To
Server Failed" );
connection_state =
_connect_state_connect_failure;
failure_display_timer.reset();
}
@@ -317,7 +317,7 @@
CLIENT->sendMessage( &connect_request,
sizeof(ClientConnectRequest), 0 );
time_out_counter++;
} else {
- lobbyView.scrollAndUpdate( "Connection To Server
Failed" );
+ lobbyView->scrollAndUpdate( "Connection To Server
Failed" );
connection_state = _connect_state_connect_failure;
}
}
@@ -343,20 +343,20 @@
if( result_code == _mapload_result_no_map_file ) {
sprintf( str_buf, "MAP %s NOT FOUND!",
game_setup->map_name );
- lobbyView.scrollAndUpdate( str_buf);
- lobbyView.scrollAndUpdate( "please download this
map from" );
- lobbyView.scrollAndUpdate( "www.pyrosoftgames.com"
);
+ lobbyView->scrollAndUpdate( str_buf);
+ lobbyView->scrollAndUpdate( "please download this
map from" );
+ lobbyView->scrollAndUpdate(
"www.pyrosoftgames.com" );
connection_state = _connect_state_connect_failure;
failure_display_timer.reset();
} else
if( result_code == _mapload_result_no_wad_file ) {
- lobbyView.scrollAndUpdate( "MAP TILE SET NOT
FOUND!" );
- lobbyView.scrollAndUpdate( "please download
the appropriate tileset" );
- lobbyView.scrollAndUpdate( "from
www.pyrosoftgames.com" );
+ lobbyView->scrollAndUpdate( "MAP TILE SET NOT
FOUND!" );
+ lobbyView->scrollAndUpdate( "please download
the appropriate tileset" );
+ lobbyView->scrollAndUpdate( "from
www.pyrosoftgames.com" );
connection_state =
_connect_state_connect_failure;
failure_display_timer.reset();
} else {
- lobbyView.scrollAndUpdate( "Loading Game Data
..." );
+ lobbyView->scrollAndUpdate( "Loading Game Data
..." );
CLIENT->sendMessage( &client_game_setup_ping,
sizeof(ConnectMesgClientGameSetupPing), 0 );
@@ -377,7 +377,7 @@
ConnectMesgClientGameSetupAck client_game_setup_ack;
sprintf( str_buf, "Loading Game Data ... (%d%%)",
percent_complete);
- lobbyView.update( str_buf );
+ lobbyView->update( str_buf );
CLIENT->sendMessage( &client_game_setup_ack,
sizeof(ConnectMesgClientGameSetupAck), 0 );
connection_state = _connect_state_idle;
@@ -385,7 +385,7 @@
ConnectMesgClientGameSetupPing client_game_setup_ping;
sprintf( str_buf, "Loading Game Data ... (%d%%)",
percent_complete);
- lobbyView.update( str_buf );
+ lobbyView->update( str_buf );
CLIENT->sendMessage( &client_game_setup_ping,
sizeof(ConnectMesgClientGameSetupPing), 0 );
}
@@ -396,7 +396,7 @@
case _connect_state_connect_failure : {
if ( failure_display_timer.count() == true ) {
- lobbyView.toggleMainMenu();
+ lobbyView->toggleMainMenu();
connection_state = _connect_state_idle;
}
}
Index: netpanzer/src/NetPanzer/Classes/TileSet.cpp
diff -u netpanzer/src/NetPanzer/Classes/TileSet.cpp:1.9
netpanzer/src/NetPanzer/Classes/TileSet.cpp:1.10
--- netpanzer/src/NetPanzer/Classes/TileSet.cpp:1.9 Sun Oct 5 09:50:12 2003
+++ netpanzer/src/NetPanzer/Classes/TileSet.cpp Wed Oct 22 09:19:27 2003
@@ -358,34 +358,6 @@
*percent_complete = 100;
-#if 0
- // XXX hack for now, this should not be commited to cvs :), so if you
- // see this remove it :)
- Palette::init("wads/netp.act");
- for(unsigned int i=0; i<tile_count; i++) {
- SDL_Surface* surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
- getTileXsize(), getTileYsize(), 8, 0, 0, 0, 0);
-
- memcpy(surface->pixels, getTile(i), getTileXsize() *
getTileYsize());
-
- SDL_Color colors[256];
- for(int a=0;a<256;a++) {
- colors[a].r = Palette::color[a].red;
- colors[a].g = Palette::color[a].green;
- colors[a].b = Palette::color[a].blue;
- }
- SDL_SetColors(surface, colors, 0, 256);
-
- std::string filename = "tileset/";
- char buf[20];
- sprintf(buf, "%04d", i);
- filename += buf;
- filename += ".bmp";
- SDL_SaveBMP(surface, filename.c_str());
- SDL_FreeSurface(surface);
- }
-#endif
-
return false;
} else {
float percent;
Index: netpanzer/src/NetPanzer/Core/main.cpp
diff -u netpanzer/src/NetPanzer/Core/main.cpp:1.14
netpanzer/src/NetPanzer/Core/main.cpp:1.15
--- netpanzer/src/NetPanzer/Core/main.cpp:1.14 Mon Oct 13 10:30:14 2003
+++ netpanzer/src/NetPanzer/Core/main.cpp Wed Oct 22 09:19:29 2003
@@ -29,11 +29,15 @@
#include "Log.hpp"
#include "Exception.hpp"
#include "FileSystem.hpp"
-#include "GameManager.hpp"
#include "MouseInterface.hpp"
#include "KeyboardInterface.hpp"
#include "cMouse.hpp"
+#include "BaseGameManager.hpp"
+#include "DedicatedGameManager.hpp"
+#include "BotGameManager.hpp"
+#include "PlayerGameManager.hpp"
+
/** This functions iterates throgh the SDL event queue.
* It returns true if a quit message has been received, otherwise false.
*/
@@ -135,7 +139,8 @@
shutdown();
}
-void initialise(int argc, char** argv)
+//-----------------------------------------------------------------
+BaseGameManager *initialise(int argc, char** argv)
{
// Install signal handler
signal(SIGILL, signalhandler);
@@ -154,12 +159,15 @@
command_line commandline(PACKAGE_NAME, PACKAGE_VERSION,
"Copyright(c) 1998 Pyrosoft Inc. and others", "", argc, argv);
- option<bool, false, false> dedicated_option('d', "dedicated",
+ bool_option dedicated_option('d', "dedicated",
"run as dedicated server", false);
commandline.add(&dedicated_option);
+ option<std::string, true, false> bot_option('b', "bot",
+ "connect as bot to specific server", "");
+ commandline.add(&bot_option);
option<int> port_option('p', "port", "run server on specific port", 0);
commandline.add(&port_option);
- option<bool, false, false> debug_option('g', "debug",
+ bool_option debug_option('g', "debug",
"enable debug output", false);
commandline.add(&debug_option);
@@ -203,43 +211,60 @@
srand48(time(0));
#endif
+ BaseGameManager *manager;
// finally initialize the game objects
try {
- GameManager::initialize(dedicated_option.value());
+ if (dedicated_option.value()) {
+ manager = new DedicatedGameManager();
+ }
+ else {
+ if (bot_option.value().size() > 0) {
+ manager = new BotGameManager(bot_option.value());
+ }
+ else {
+ manager = new PlayerGameManager();
+ }
+ }
+
+ manager->initialize();
+ return manager;
} catch(Exception e) {
- fprintf(stderr, "Couldn't initialize the game: %s\n", e.getMessage());
+ LOGGER.warning("Couldn't initialize the game: %s", e.getMessage());
shutdown();
exit(1);
}
}
+//-----------------------------------------------------------------
int netpanzer_main(int argc, char** argv)
{
- initialise(argc, argv);
+ BaseGameManager *manager = initialise(argc, argv);
// we'll catch every exception here, just to be sure the user gets at least
// a usefull error message and SDL has a chance to shutdown...
try {
- while(1) {
- SDL_PumpEvents();
- if(HandleSDLEvents() == true) {
- LOG( ("quitting main loop.") );
- break;
- }
+ if (manager->launchNetPanzerGame()) {;
+ while(1) {
+ SDL_PumpEvents();
+ if(HandleSDLEvents() == true) {
+ LOG( ("quitting main loop.") );
+ break;
+ }
- GameManager::mainLoop();
+ manager->mainLoop();
+ }
}
- GameManager::shutdown();
+ delete manager;
LOG ( ("successfull shutdown.") );
shutdown();
} catch(Exception e) {
- fprintf(stderr, "An unexpected exception occured: %s\nShutdown
needed.",
+ LOGGER.warning("An unexpected exception occured: %s\nShutdown needed.",
e.getMessage());
shutdown();
throw;
} catch(...) {
- fprintf(stderr, "An unexpected exception occured.\nShutdown needed.");
+ LOGGER.warning("An unexpected exception occured.\nShutdown needed.");
shutdown();
throw;
}
Index: netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.cpp:1.6
netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.cpp:1.7
--- netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.cpp:1.6 Mon Oct
20 19:55:04 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.cpp Wed Oct
22 09:19:30 2003
@@ -48,6 +48,16 @@
_map_cycle_client_wait_for_respawn_ack
};
+enum { _execution_mode_loop_back_server,
+ _execution_mode_dedicated_server
+ };
+enum { _game_state_idle,
+ _game_state_in_progress,
+ _game_state_completed
+ };
+
+int GameControlRulesDaemon::execution_mode = _execution_mode_loop_back_server;
+unsigned char GameControlRulesDaemon::game_state = _game_state_idle;
#define _MAP_CYCLE_ENDGAME_WAIT_PERIOD (30) // seconds
#define _MAP_CYCLE_MAP_LOAD_WAIT_PERIOD (20) // seconds
@@ -60,6 +70,13 @@
bool GameControlRulesDaemon::map_cycle_fsm_client_respawn_ack_flag = false;
char GameControlRulesDaemon::map_cycle_fsm_client_map_name[256];
+//-----------------------------------------------------------------
+void GameControlRulesDaemon::setStateServerInProgress()
+{
+ GameControlRulesDaemon::execution_mode = _execution_mode_dedicated_server;
+ GameControlRulesDaemon::game_state = _game_state_in_progress;
+}
+//-----------------------------------------------------------------
void GameControlRulesDaemon::mapCycleFsmClient( void )
{
bool end_cycle = false;
@@ -72,12 +89,12 @@
break;
case _map_cycle_client_start_map_load : {
- progressView.open();
+ progressView->open();
GameManager::shutdownParticleSystems();
ObjectiveInterface::resetLogic();
- progressView.scrollAndUpdate( "Loading Game Map ..." );
+ progressView->scrollAndUpdate( "Loading Game Map ..." );
int result_code;
GameManager::startGameMapLoad( map_cycle_fsm_client_map_name,
16, &result_code );
@@ -102,12 +119,12 @@
map_cycle_fsm_client_state =
_map_cycle_client_wait_for_respawn_ack;
sprintf( str_buf, "Loading Game Map ... (%d%%)",
percent_complete);
- progressView.update( str_buf );
+ progressView->update( str_buf );
- progressView.scrollAndUpdate( "Waiting to respawn ..." );
+ progressView->scrollAndUpdate( "Waiting to respawn ..." );
} else {
sprintf( str_buf, "Loading Game Map ... (%d%%)",
percent_complete);
- progressView.update( str_buf );
+ progressView->update( str_buf );
}
end_cycle = true;
@@ -116,7 +133,7 @@
case _map_cycle_client_wait_for_respawn_ack : {
if( map_cycle_fsm_client_respawn_ack_flag == true ) {
- progressView.toggleGameView();
+ progressView->toggleGameView();
map_cycle_fsm_client_respawn_ack_flag = false;
map_cycle_fsm_client_state = _map_cycle_client_idle;
}
@@ -150,7 +167,7 @@
view_control.set( "WinnerMesgView",
_view_control_flag_visible_on | _view_control_flag_close_all );
- if ( GameManager::execution_mode ==
_execution_mode_loop_back_server ) {
+ if ( GameControlRulesDaemon::execution_mode ==
_execution_mode_loop_back_server ) {
Desktop::setVisibilityAllWindows(false);
Desktop::setVisibility("GameView", true);
Desktop::setVisibility("WinnerMesgView", true );
@@ -182,7 +199,7 @@
SERVER->sendMessage( &cycle_map_mesg, sizeof(
GameControlCycleMap ), 0 );
- if ( GameManager::execution_mode ==
_execution_mode_dedicated_server ) {
+ if ( GameControlRulesDaemon::execution_mode ==
_execution_mode_dedicated_server ) {
ObjectiveInterface::resetLogic();
GameManager::dedicatedLoadGameMap( map_name );
@@ -193,9 +210,9 @@
map_cycle_fsm_server_map_load_timer.reset();
map_cycle_fsm_server_state =
_map_cycle_server_state_wait_for_client_map_load;
} else {
- progressView.open();
+ progressView->open();
- progressView.scrollAndUpdate( "Loading Game Map ..." );
+ progressView->scrollAndUpdate( "Loading Game Map ..."
);
ObjectiveInterface::resetLogic();
int result_code;
@@ -227,7 +244,7 @@
}
sprintf( str_buf, "Loading Game Map ... (%d%%)",
percent_complete);
- progressView.update( str_buf );
+ progressView->update( str_buf );
end_cycle = true;
}
@@ -251,11 +268,9 @@
GameManager::respawnAllPlayers();
PlayerInterface::unlockPlayerStats();
- GameManager::game_state = _game_state_in_progress;
+ GameControlRulesDaemon::game_state = _game_state_in_progress;
- if ( GameManager::execution_mode ==
_execution_mode_loop_back_server ) {
- progressView.toggleGameView();
- }
+ progressView->toggleGameView();
GameControlCycleRespawnAck respawn_ack_mesg;
SERVER->sendMessage( &respawn_ack_mesg,
sizeof(GameControlCycleRespawnAck), 0 );
@@ -278,7 +293,7 @@
if( gameconfig->mapcycling == true ) {
map_cycle_fsm_server_state =
_map_cycle_server_state_display_endgame_views;
- GameManager::game_state = _game_state_completed;
+ GameControlRulesDaemon::game_state = _game_state_completed;
} else {
SystemViewControl view_control;
@@ -290,7 +305,7 @@
SERVER->sendMessage( &view_control, sizeof( SystemViewControl ), 0 );
- GameManager::game_state = _game_state_completed;
+ GameControlRulesDaemon::game_state = _game_state_completed;
}
}
@@ -300,7 +315,7 @@
if( gameconfig->mapcycling == true ) {
map_cycle_fsm_server_state =
_map_cycle_server_state_display_endgame_views;
- GameManager::game_state = _game_state_completed;
+ GameControlRulesDaemon::game_state = _game_state_completed;
} else {
SystemViewControl view_control;
@@ -312,7 +327,7 @@
SERVER->sendMessage( &view_control, sizeof( SystemViewControl ), 0 );
- GameManager::game_state = _game_state_completed;
+ GameControlRulesDaemon::game_state = _game_state_completed;
}
}
@@ -323,7 +338,7 @@
if( gameconfig->mapcycling == true ) {
map_cycle_fsm_server_state =
_map_cycle_server_state_display_endgame_views;
- GameManager::game_state = _game_state_completed;
+ GameControlRulesDaemon::game_state = _game_state_completed;
} else {
SystemViewControl view_control;
@@ -335,7 +350,7 @@
SERVER->sendMessage( &view_control, sizeof( SystemViewControl ), 0 );
- GameManager::game_state = _game_state_completed;
+ GameControlRulesDaemon::game_state = _game_state_completed;
}
}
@@ -343,7 +358,7 @@
{
if( gameconfig->mapcycling == true ) {
map_cycle_fsm_server_state =
_map_cycle_server_state_display_endgame_views;
- GameManager::game_state = _game_state_completed;
+ GameControlRulesDaemon::game_state = _game_state_completed;
}
}
@@ -351,7 +366,7 @@
{
PlayerState *player_state;
- if ( (GameManager::game_state == _game_state_in_progress) &&
+ if ( (GameControlRulesDaemon::game_state == _game_state_in_progress) &&
(NetworkState::status == _network_state_server)
) {
unsigned char game_type;
@@ -440,13 +455,13 @@
if( result_code == _mapload_result_no_map_file ) {
sprintf( str_buf, "MAP %s NOT FOUND!", map_name );
- progressView.scrollAndUpdate( str_buf);
- progressView.scrollAndUpdate( "please download this map from" );
- progressView.scrollAndUpdate( "www.pyrosoftgames.com" );
+ progressView->scrollAndUpdate( str_buf);
+ progressView->scrollAndUpdate( "please download this map from" );
+ progressView->scrollAndUpdate( "www.pyrosoftgames.com" );
} else
if( result_code == _mapload_result_no_wad_file ) {
- progressView.scrollAndUpdate( "MAP TILE SET NOT FOUND!" );
- progressView.scrollAndUpdate( "please download the appropriate
tileset" );
- progressView.scrollAndUpdate( "from www.pyrosoftgames.com" );
+ progressView->scrollAndUpdate( "MAP TILE SET NOT FOUND!" );
+ progressView->scrollAndUpdate( "please download the appropriate
tileset" );
+ progressView->scrollAndUpdate( "from www.pyrosoftgames.com" );
}
}
Index: netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.hpp:1.4
netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.hpp:1.5
--- netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.hpp:1.4 Tue Sep
16 16:16:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.hpp Wed Oct
22 09:19:30 2003
@@ -23,6 +23,9 @@
class GameControlRulesDaemon
{
+ static int execution_mode;
+ static unsigned char game_state;
+
protected:
static int map_cycle_fsm_server_state;
static Timer map_cycle_fsm_server_endgame_timer;
@@ -46,6 +49,7 @@
static void netMessageCycleRespawnAck(NetMessage *message);
public:
+ static void setStateServerInProgress();
static void processNetMessage(NetMessage *message);
static void forceMapCycle();
static void updateGameControlFlow();
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.63
netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.64
--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.63 Mon Oct 20
19:55:05 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.cpp Wed Oct 22 09:19:30 2003
@@ -128,128 +128,39 @@
#define _MAX_DEDICATED_INITIALIZE_PROCS (8)
-char GameManager::map_path[256];
-
time_t GameManager::game_start_time = 0;
time_t GameManager::game_elapsed_time_offset = 0;
bool GameManager::display_frame_rate_flag = false;
bool GameManager::display_network_info_flag;
-int GameManager::execution_mode;
-
-unsigned char GameManager::game_state = _game_state_idle;
+std::string GameManager::map_path;
static Surface hostLoadSurface;
// ******************************************************************
-void GameManager::initializeVideoSubSystem()
-{
- LOG( ( "Initializing video mode" ) );
- Screen = new SDLDraw();
- setVideoMode();
-}
-
-void GameManager::shutdownVideoSubSystem()
-{
- delete Screen;
- Screen = 0;
-}
-
-// ******************************************************************
-
-void GameManager::initializeSoundSubSystem()
+void GameManager::drawTextCenteredOnScreen(const char *string, PIX color)
{
- if(execution_mode == _execution_mode_dedicated_server) {
- sound = new DummySound();
- return;
- }
- LOG( ("Initialize sound system.") );
- try {
- sound = new SDLSound();
- } catch(Exception e) {
- LOG( ("Couldn't initialize sound: %s", e.getMessage()) );
- sound = new DummySound();
- }
-
- // start some music
- sound->playMusic("sound/music/");
+ screen->lock();
+
+ screen->fill(0);
+ screen->bltStringCenter(string, color);
+
+ screen->unlock();
+ screen->copyToVideoFlip();
}
// ******************************************************************
-void GameManager::shutdownSoundSubSystem()
+void GameManager::loadPalette(char *palette_path)
{
- if(sound) {
- delete sound;
- sound = 0;
- }
+ Palette::init(palette_path);
+ Screen->setPalette(Palette::color);
}
// ******************************************************************
-void GameManager::initializeWindowSubSystem()
-{
- loadPalette("wads/netp.act");
-
- initFont();
-
- gameView.init();
- Desktop::add( &gameView );
- Desktop::add(new RankView());
- Desktop::add(new VehicleSelectionView());
- Desktop::add(new WinnerMesgView());
- Desktop::add( &miniMapView );
- Desktop::add(new CodeStatsView());
- Desktop::add(new LibView());
- //Desktop::add(new DesktopView());
- //Desktop::add(new UnitColorView());
- Desktop::add(new HelpScrollView());
- Desktop::add(new GameToolbarView());
- Desktop::add(new GameInfoView());
-
- lobbyView.init();
- Desktop::add(&lobbyView);
- progressView.init();
- Desktop::add(&progressView);
-
- loadPalette("wads/netpmenu.act");
-
- //chatView.init();
- //Desktop::add(&chatView);
-
- Desktop::add(new MapSelectionView());
- Desktop::add(new MainMenuView());
- Desktop::add(new JoinView());
- Desktop::add(new HostView());
- Desktop::add(new GetSessionView());
- Desktop::add(new GetSessionHostView());
- Desktop::add(new OptionsTemplateView());
- Desktop::add(new OrderingView());
- Desktop::add(new HelpView());
- Desktop::add(new SoundView());
- Desktop::add(new ControlsView());
- Desktop::add(new VisualsView());
- Desktop::add(new InterfaceView());
- Desktop::add(new FlagSelectionView());
- Desktop::add(new HostOptionsView());
- Desktop::add(new PlayerNameView());
- Desktop::add(new ResignView());
- Desktop::add(new AreYouSureResignView());
- Desktop::add(new AreYouSureExitView());
-
- //winsock hack
- Desktop::add(new IPAddressView());
-
- Desktop::setVisibilityAllWindows(false);
- Desktop::setVisibility("MainView", true);
-
- Desktop::checkResolution(iXY(640,480), iXY(screen->getPix()));
- Desktop::checkViewPositions(screen->getPix());
-}
-
-// ******************************************************************
void GameManager::setVideoMode()
{
iXY mode_res;
@@ -289,96 +200,6 @@
}
// ******************************************************************
-
-void GameManager::drawTextCenteredOnScreen(const char *string, PIX color)
-{
- screen->lock();
-
- screen->fill(0);
- screen->bltStringCenter(string, color);
-
- screen->unlock();
- screen->copyToVideoFlip();
-}
-
-// ******************************************************************
-
-void GameManager::loadPalette(char *palette_path)
-{
- Palette::init(palette_path);
- Screen->setPalette(Palette::color);
-}
-
-// ******************************************************************
-void GameManager::initializeInputDevices()
-{
- MouseInterface::initialize();
-}
-
-void GameManager::shutdownInputDevices()
-{}
-
-// ******************************************************************
-void GameManager::initializeGameObjects()
-{
- MapsManager::initialize();
- MapsManager::scanMaps();
-
- Physics::init();
- Weapon::init();
-
- ConsoleInterface::initialize(25);
- PowerUpInterface::initialize();
-}
-
-// ******************************************************************
-
-void GameManager::shutdownGameObjects()
-{}
-
-// ******************************************************************
-void GameManager::initializeDedicatedConsole()
-{
- ConsoleInterface::setStdoutPipe(true);
-}
-
-// ******************************************************************
-void GameManager::shutdownDedicatedConsole()
-{}
-
-// ******************************************************************
-void GameManager::initializeNetworkSubSystem()
-{
- SERVER = new NetworkServerUnix();
- CLIENT = new NetworkClientUnix();
-
- ServerMessageRouter::initialize();
- ClientMessageRouter::initialize();
-
- ServerConnectDaemon::initialize( gameconfig->maxplayers );
-
- NetworkState::setNetworkStatus( _network_state_server );
- NetworkState::resetNetworkStats();
-}
-
-// ******************************************************************
-void GameManager::shutdownNetworkSubSystem()
-{
- if(SERVER) {
- SERVER->closeSession();
- ServerMessageRouter::cleanUp();
- delete SERVER;
- SERVER = 0;
- }
- if(CLIENT) {
- CLIENT->closeSession();
- ClientMessageRouter::cleanUp();
- delete CLIENT;
- CLIENT = 0;
- }
-}
-
-// ******************************************************************
void GameManager::initializeGameLogic()
{
PlayerInterface::initialize( gameconfig->maxplayers,
@@ -424,166 +245,6 @@
}
// ******************************************************************
-
-void GameManager::processSystemKeys()
-{
- static bool toggleBot = false;
-
- if (Desktop::getVisible("GameView")) {
-
- if (KeyboardInterface::getKeyPressed(SDLK_b)) {
- toggleBot = !toggleBot;
- LOGGER.info("Bot enable=%d", toggleBot ? 1 : 0);
- ConsoleInterface::postMessage( "bot has been %s.", toggleBot ?
- "enabled" : "disabled" );
- }
- if (toggleBot) {
- Bot::bot()->processEvents();
- }
-
- if (KeyboardInterface::getKeyPressed( SDLK_F5 )) {
- // DEBUG VIEW
- Desktop::toggleVisibility( "LibView" );
- }
-
- if (KeyboardInterface::getKeyPressed( SDLK_F3 )) {
- Desktop::toggleVisibility( "UnitColorView" );
- }
-
- // Remove all selection.
- if (KeyboardInterface::getKeyPressed(SDLK_ESCAPE)) {
- COMMAND_PROCESSOR.closeSelectionBox();
- MiniMapInterface::deselectUnits();
- }
-
- }
-
- if (KeyboardInterface::getKeyState( SDLK_LALT ) ||
- KeyboardInterface::getKeyState( SDLK_RALT )) {
- if (KeyboardInterface::getKeyPressed(SDLK_RETURN)) {
- gameconfig->fullscreen.toggle();
- GameManager::setVideoMode();
- }
-
- if( (KeyboardInterface::getKeyState( SDLK_LCTRL) ||
- KeyboardInterface::getKeyState( SDLK_RCTRL) ) ) {
-
- // DEBUG VIEW
- if ( KeyboardInterface::getKeyPressed( SDLK_f ) ) {
- display_frame_rate_flag = !display_frame_rate_flag;
- }
-
- // DEBUG VIEW
- if ( KeyboardInterface::getKeyPressed( SDLK_n ) ) {
- display_network_info_flag = !display_network_info_flag;
- }
-
- }
-
- } // ** LFT_ALT or RGT_ALT pressed
-
- if (Desktop::getView("GameView")->getVisible()) {
- if (KeyboardInterface::getKeyPressed(SDLK_F8)) {
- Desktop::toggleVisibility( "MiniMapView" );
- }
- if (KeyboardInterface::getKeyPressed(SDLK_F7)) {
- Desktop::toggleVisibility( "ChatView" );
- }
- if (KeyboardInterface::getKeyPressed(SDLK_F6)) {
- Desktop::toggleVisibility( "RankView" );
- }
- if (KeyboardInterface::getKeyPressed(SDLK_F3)) {
- Desktop::toggleVisibility( "DesktopView" );
- }
- if (KeyboardInterface::getKeyPressed(SDLK_TAB)) {
- Desktop::toggleVisibility( "GameToolbarView" );
- }
- if (KeyboardInterface::getKeyPressed(SDLK_F4)) {
- Desktop::toggleVisibility( "CodeStatsView" );
- }
- if (KeyboardInterface::getKeyPressed(SDLK_F1)) {
- Desktop::toggleVisibility( "HelpScrollView" );
- }
-
- if (KeyboardInterface::getKeyPressed(SDLK_F2)) {
- if (Desktop::getView("GameView")->getVisible()) {
- if (!Desktop::getView("OptionsView")->getVisible() &&
- !Desktop::getView("SoundView")->getVisible() &&
- !Desktop::getView("ControlsView")->getVisible() &&
- !Desktop::getView("InterfaceView")->getVisible() &&
- !Desktop::getView("VisualsView")->getVisible()) {
- View *v = Desktop::getView("OptionsView");
- assert(v != 0);
- ((OptionsTemplateView *)v)->initButtons();
- ((OptionsTemplateView *)v)->setAlwaysOnBottom(false);
-
- v = Desktop::getView("SoundView");
- assert(v != 0);
- ((SoundView *)v)->initButtons();
- ((OptionsTemplateView *)v)->setAlwaysOnBottom(false);
-
- v = Desktop::getView("ControlsView");
- assert(v != 0);
- ((ControlsView *)v)->initButtons();
- ((OptionsTemplateView *)v)->setAlwaysOnBottom(false);
-
- v = Desktop::getView("VisualsView");
- assert(v != 0);
- ((VisualsView *)v)->initButtons();
- ((OptionsTemplateView *)v)->setAlwaysOnBottom(false);
-
- v = Desktop::getView("InterfaceView");
- assert(v != 0);
- ((InterfaceView *)v)->initButtons();
- ((OptionsTemplateView *)v)->setAlwaysOnBottom(false);
-
- Desktop::setVisibility("OptionsView", true);
- Desktop::setActiveView("OptionsView");
- } else {
- View *v = Desktop::getView("OptionsView");
- assert(v != 0);
- ((OptionsTemplateView *)v)->setAlwaysOnBottom(true);
- ((OptionsTemplateView *)v)->setVisible(false);
-
- v = Desktop::getView("InterfaceView");
- assert(v != 0);
- ((OptionsTemplateView *)v)->setAlwaysOnBottom(true);
- ((OptionsTemplateView *)v)->setVisible(false);
-
- v = Desktop::getView("VisualsView");
- assert(v != 0);
- ((OptionsTemplateView *)v)->setAlwaysOnBottom(true);
- ((OptionsTemplateView *)v)->setVisible(false);
-
- v = Desktop::getView("SoundView");
- assert(v != 0);
- ((OptionsTemplateView *)v)->setAlwaysOnBottom(true);
- ((OptionsTemplateView *)v)->setVisible(false);
-
- v = Desktop::getView("ControlsView");
- assert(v != 0);
- ((OptionsTemplateView *)v)->setAlwaysOnBottom(true);
- ((OptionsTemplateView *)v)->setVisible(false);
- }
- }
- }
- }
-}
-
-
-// ******************************************************************
-bool GameManager::loadGameData()
-{
- UnitProfileInterface::loadUnitProfiles();
- LoadUnitSurfaces();
- UNIT_FLAGS_SURFACE.loadAllBMPInDirectory("pics/flags/");
- if(UNIT_FLAGS_SURFACE.getFrameCount() == 0)
- throw Exception("Couldn't find any flag in pics/flags/.");
-
- return true;
-}
-
-// ******************************************************************
bool GameManager::startGameMapLoad(const char *map_file_path, unsigned long
partitions, int *result_code )
{
int check_return_code;
@@ -600,10 +261,10 @@
*result_code = _mapload_result_success;
}
- strcpy( map_path, "maps/" );
- strcat( map_path, map_file_path );
+ map_path = "maps/";
+ map_path.append(map_file_path);
- if ( MapInterface::startMapLoad( map_path, true, partitions ) == false ) {
+ if ( MapInterface::startMapLoad( map_path.c_str(), true, partitions ) ==
false ) {
finishGameMapLoad();
return false;
}
@@ -627,11 +288,9 @@
void GameManager::finishGameMapLoad()
{
- char temp_path[256];
-
- strcpy( temp_path, map_path );
- strcat( temp_path, ".opt" );
- ObjectiveInterface::loadObjectiveList( temp_path );
+ std::string temp_path = map_path;
+ temp_path.append(".opt");
+ ObjectiveInterface::loadObjectiveList( temp_path.c_str() );
miniMapView.init();
ParticleInterface::initParticleSystems();
@@ -644,13 +303,13 @@
void GameManager::dedicatedLoadGameMap(const char *map_name )
{
- strcpy( map_path, "maps/" );
- strcat( map_path, map_name );
+ map_path = "maps/";
+ map_path.append(map_name);
- MapInterface::startMapLoad( map_path, false, 0 );
+ MapInterface::startMapLoad( map_path.c_str(), false, 0 );
- strcat( map_path, ".opt" );
- ObjectiveInterface::loadObjectiveList( map_path );
+ map_path.append(".opt");
+ ObjectiveInterface::loadObjectiveList( map_path.c_str() );
ParticleInterface::initParticleSystems();
Particle2D::setCreateParticles(false);
@@ -659,90 +318,6 @@
Physics::wind.setVelocity(gameconfig->windspeed, 107);
}
-// ******************************************************************
-void GameManager::initialize(bool dedicated)
-{
- if(dedicated) {
- execution_mode = _execution_mode_dedicated_server;
- dedicatedBootStrap();
- return;
- }
-
- execution_mode = _execution_mode_loop_back_server;
- bootStrap();
-}
-
-// ******************************************************************
-void GameManager::bootStrap()
-{
- try {
- if(!FileSystem::exists("config"))
- FileSystem::mkdir("config");
- gameconfig = new GameConfig("config/netpanzer.xml");
- initializeSoundSubSystem();
- initializeVideoSubSystem();
- loadGameData();
- initializeWindowSubSystem();
- initializeGameObjects();
- initializeGameLogic();
- initializeNetworkSubSystem();
- initializeInputDevices();
- } catch(Exception e) {
- fprintf(stderr, "Initialisation failed:\n%s\n", e.getMessage());
- shutdown();
- throw Exception("bootstrap failed.");
- }
-}
-
-// ******************************************************************
-void GameManager::dedicatedBootStrap()
-{
- try {
- if(!FileSystem::exists("config"))
- FileSystem::mkdir("config");
- gameconfig = new GameConfig("config/netpanzer-dedicated.cfg");
- initializeSoundSubSystem(); // we load a dummy sound driver
- loadGameData();
- initializeGameObjects();
- initializeGameLogic();
- initializeNetworkSubSystem();
- initializeInputDevices();
- initializeDedicatedConsole();
-
- launchDedicatedServer();
- } catch(Exception e) {
- fprintf(stderr, "Initialisation failed:\n%s\n", e.getMessage());
- dedicatedShutdown();
- throw Exception("bootstrap failed.");
- }
-}
-
-// ******************************************************************
-
-void GameManager::shutdown()
-{
- shutdownSubSystems();
-}
-
-void GameManager::shutdownSubSystems()
-{
- shutdownGameLogic();
- shutdownNetworkSubSystem();
- shutdownSoundSubSystem();
- shutdownVideoSubSystem();
- shutdownInputDevices();
- delete gameconfig;
- gameconfig = 0;
-}
-
-void GameManager::dedicatedShutdown()
-{
- shutdownGameLogic();
- shutdownNetworkSubSystem();
- shutdownInputDevices();
- shutdownDedicatedConsole();
- shutdown();
-}
// ******************************************************************
@@ -949,7 +524,6 @@
return true;
}
-
// ******************************************************************
void GameManager::processSystemMessage( NetMessage *message )
{
@@ -1004,319 +578,6 @@
gameconfig->getEnemyOutpostRadarColor() );
}
-//--------------------------------------------------------------------------
-void displayHostMultiPlayerGameProgress(const int &curNum)
-{
- const int yOffset = 20;
- iXY pos(0, 140);
-
- {
- screen->lock();
-
- hostLoadSurface.blt(*screen);
- char strBuf[256];
-
- sprintf(strBuf, "SPAWNING HOST");
- pos.x = 179;
- pos.y = 153;
- screen->bltString(pos, strBuf, Color::white);
-
- pos.y += yOffset;
- pos.y += yOffset;
-
- sprintf(strBuf, "Load Game Map...................%s", (curNum > 1) ?
"DONE" : "");
- pos.y += yOffset;
- screen->bltString(pos, strBuf, Color::white);
-
- sprintf(strBuf, "Initialize Game Logic...........%s", (curNum > 2) ?
"DONE" : "");
- pos.y += yOffset;
- screen->bltString(pos, strBuf, Color::white);
-
- sprintf(strBuf, "Initializing Connection Type....%s", (curNum > 3) ?
"DONE" : "");
- pos.y += yOffset;
- screen->bltString(pos, strBuf, Color::white);
-
- sprintf(strBuf, "Allocating Server...............%s", (curNum > 4) ?
"DONE" : "");
- pos.y += yOffset;
- screen->bltString(pos, strBuf, Color::white);
-
- sprintf(strBuf, "Spawning Player.................%s", (curNum > 5) ?
"DONE" : "");
- pos.y += yOffset;
- screen->bltString(pos, strBuf, Color::white);
-
- screen->unlock();
- screen->copyToVideoFlip();
- }
-}
-
-// ******************************************************************
-void GameManager::hostMultiPlayerGame()
-{
- PlayerID player;
- PlayerState *player_state;
- Timer wait;
-
- progressView.open();
-
- //InitStreamServer(gapp.hwndApp);
-
- progressView.scrollAndUpdateDirect( "Launching Server ..." );
- try {
- SERVER->hostSession();
- } catch(Exception e) {
- progressView.scrollAndUpdateDirect( "SERVER LAUNCH FAILED" );
- wait.changePeriod( 4 );
- while( !wait.count() );
-
- progressView.toggleMainMenu();
- return;
- }
-
- progressView.updateDirect( "Launching Server ... (100%) " );
-
- game_state = _game_state_in_progress;
- NetworkState::setNetworkStatus( _network_state_server );
- CLIENT->openSession();
-
- progressView.scrollAndUpdateDirect( "Loading Game Data ..." );
-
- const char* mapname = ((const std::string&)(gameconfig->map)).c_str();
- MapsManager::setCycleStartMap(mapname);
-
- int result_code;
- startGameMapLoad(mapname, 20, &result_code);
-
- if( result_code == _mapload_result_no_wad_file ) {
- progressView.scrollAndUpdateDirect( "MAP TILE SET NOT FOUND!" );
- progressView.scrollAndUpdateDirect( "please download the appropriate
tileset" );
- progressView.scrollAndUpdateDirect( "from www.pyrosoftgames.com" );
- wait.changePeriod( 12 );
- while( !wait.count() );
-
- progressView.toggleMainMenu();
- return;
- }
-
- int percent_complete;
- char strbuf[256];
-
- ObjectiveInterface::resetLogic();
-
- while( gameMapLoad( &percent_complete ) == true ) {
- sprintf( strbuf, "Loading Game Data ... (%d%%)", percent_complete);
- progressView.updateDirect( strbuf );
- }
-
- sprintf( strbuf, "Loading Game Data ... (%d%%)", percent_complete);
- progressView.updateDirect( strbuf );
-
-
- progressView.scrollAndUpdateDirect( "Initializing Game Logic ..." );
- reinitializeGameLogic();
- progressView.updateDirect( "Initializing Game Logic ... (100%) " );
-
-
- progressView.scrollAndUpdateDirect( "Spawning Player ..." );
- player_state = PlayerInterface::allocateLoopBackPlayer();
- 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%)" );
-
- wait.changePeriod( 3 );
- while( !wait.count() );
-
- startGameTimer();
-
- progressView.close();
-
- // Set the palette to the game palette.
- loadPalette( "wads/netp.act" );
-
- setNetPanzerGameOptions();
-
- // Need to open at beginning of game until we are saving status of things.
- // when last played.
- Desktop::setVisibility("GameToolbarView", true);
- Desktop::setVisibility("GameInfoView", true);
- Desktop::setVisibility("MiniMapView", true);
- Desktop::setVisibility("GameView", true);
- Desktop::setActiveView("GameView");
-}
-
-// ******************************************************************
-
-void GameManager::joinMultiPlayerGame()
-{
- setNetPanzerGameOptions();
- //reinitializeGameLogic();
- NetworkState::setNetworkStatus( _network_state_client );
-
- CLIENT->joinSession(IPAddressView::szServer.getString());
-
- ClientConnectDaemon::startConnectionProcess();
- sound->playTankIdle();
-}
-
-// ******************************************************************
-
-void GameManager::launchMultiPlayerGame()
-{
- if( gameconfig->hostorjoin == _game_session_host ) {
- hostMultiPlayerGame();
- } else
- if( gameconfig->hostorjoin == _game_session_join ) {
- joinMultiPlayerGame();
- }
-}
-// ******************************************************************
-void GameManager::launchNetPanzerGame()
-{
- launchMultiPlayerGame();
-}
-
-// ******************************************************************
-
-// custom version of readString that doesn't return the trailing \n
-static inline void readString(char* buffer, size_t buffersize, FILE* file)
-{
- fgets(buffer, buffersize, file);
- buffer[strlen(buffer)-1] = '\0';
-}
-
-void GameManager::launchDedicatedServer()
-{
- ConsoleInterface::postMessage( "netPanzer Dedicated Server");
-
- char input_str[256];
-
- MapsManager::getCurrentMap( input_str );
- gameconfig->map = input_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->map = input_str;
- }
-
- 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->maxplayers = players;
- }
-
- 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->maxunits = units;
- }
-
- int game_type = 1;
-
- do {
- printf( "Game Type\n" );
- printf( "(1) Objective \n");
- printf( "(2) Frag Limit \n" );
- printf( "(3) Time Limit \n" );
- printf( "Choose <1>: " );
- fflush(stdout);
- readString(input_str, 256, stdin);
- sscanf( input_str, "%d", &game_type );
- } while( (game_type < 1) || (game_type > 3) );
-
- switch( game_type ) {
- case 1 : {
- gameconfig->gametype = _gametype_objective;
- printf( "Outpost Occupation <%d %%> : ",
- (int) gameconfig->objectiveoccupationpercentage );
- fflush(stdout);
- readString(input_str, 256, stdin);
- if ( strlen(input_str) > 0 ) {
- int percent;
- sscanf( input_str, "%d", &percent );
- gameconfig->objectiveoccupationpercentage = percent;
- }
- }
- break;
-
- case 2 : {
- 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->fraglimit = frags;
- }
- }
- break;
-
- case 3 : {
- 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->timelimit = time_limit;
- }
- }
- break;
-
- } // ** switch
-
- printf( "PowerUps <NO> (Y/N) : " );
- fflush(stdout);
- readString(input_str, 256, stdin);
- if ( strcasecmp( "y", input_str ) == 0 ) {
- 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->playername = input_str;
- } else {
- gameconfig->playername = "Dedicated Server";
- }
-
- mapname = ((const std::string&)(gameconfig->map)).c_str();
- MapsManager::setCycleStartMap(mapname);
- dedicatedLoadGameMap(mapname);
-
- reinitializeGameLogic();
-
- SERVER->openSession();
- SERVER->hostSession();
-
- game_state = _game_state_in_progress;
-
- NetworkState::setNetworkStatus( _network_state_server );
-
- setNetPanzerGameOptions();
-
- Particle2D::setCreateParticles(false);
-
- ConsoleInterface::postMessage( "Game Launched, Server Ready...");
-
- startGameTimer();
-}
// ******************************************************************
void GameManager::exitNetPanzer()
{
@@ -1337,199 +598,6 @@
ServerConnectDaemon::shutdownConnectDaemon();
SERVER->closeSession();
}
-}
-
-// ******************************************************************
-void GameManager::mainLoop()
-{
- if ( execution_mode == _execution_mode_loop_back_server ) {
- gameLoop();
- } else {
- dedicatedGameLoop();
- }
-}
-
-// ******************************************************************
-void GameManager::gameLoop()
-{
- TimerInterface::start();
-
- inputLoop();
- graphicsLoop();
- simLoop();
-
- TimerInterface::update();
-}
-
-// ******************************************************************
-void GameManager::simLoop()
-{
- CLIENT->checkIncoming();
- SERVER->checkIncoming();
- if ( NetworkState::status == _network_state_server ) {
- ServerMessageRouter::routeMessages();
- } else {
- ClientMessageRouter::routeMessages();
- }
-
- NetworkState::updateNetworkStats();
-
- UnitInterface::updateUnitStatus();
- ProjectileInterface::updateStatus();
- ObjectiveInterface::updateObjectiveStatus();
- PowerUpInterface::updateState();
- PathScheduler::run();
-
- Physics::sim();
-
- ParticleSystem2D::simAll();
- Particle2D::simAll();
-
- GameControlRulesDaemon::updateGameControlFlow();
-}
-
-// ******************************************************************
-void GameManager::inputLoop()
-{
- processSystemKeys();
-
- Desktop::manage(mouse.getScreenPos().x, mouse.getScreenPos().y,
mouse.getButtonMask() );
-
- COMMAND_PROCESSOR.updateScrollStatus( mouse.getScreenPos() );
-}
-
-// ******************************************************************
-void GameManager::graphicsLoop()
-{
- screen->lock();
-
- Desktop::draw(*screen);
-
- char strBuf[256];
-
- if (display_frame_rate_flag == true) {
- sprintf(strBuf, "%3.1f : %3.1f" , TimerInterface::getFPS(),
TimerInterface::getFPSAvg());
- screen->bltString5x5(iXY(2, 2), strBuf, Color::white);
- }
-
- if (display_network_info_flag == true) {
- sprintf(strBuf, "|| %.4f : %.4f || %.4f : %.4f ||" ,
NetworkState::packets_sent_per_sec, NetworkState::bytes_sent_per_sec,
- NetworkState::packets_received_per_sec,
NetworkState::bytes_received_per_sec );
- screen->bltString5x5(iXY(60, 2), strBuf, Color::white);
- }
-
- if (Desktop::getVisible("GameView")) {
- ConsoleInterface::update(*screen);
- }
-
- mouse.draw(*screen);
- MouseInterface::updateCursor();
-
- screen->unlock();
- screen->copyToVideoFlip();
-}
-
-// ******************************************************************
-void GameManager::dedicatedGameLoop()
-{
- TimerInterface::start();
-
- dedicatedInputLoop();
- dedicatedSimLoop();
- // wait a bit to make the cpu happy
- SDL_Delay(20);
-
- TimerInterface::update();
-}
-
-// ******************************************************************
-void GameManager::dedicatedSimLoop()
-{
- CLIENT->checkIncoming();
- SERVER->checkIncoming();
- if ( NetworkState::status == _network_state_server ) {
- ServerMessageRouter::routeMessages();
- } else {
- ClientMessageRouter::routeMessages();
- }
-
- NetworkState::updateNetworkStats();
-
- UnitInterface::updateUnitStatus();
- ProjectileInterface::updateStatus();
- ObjectiveInterface::updateObjectiveStatus();
- PowerUpInterface::updateState();
- PathScheduler::run();
-
- Physics::sim();
-
- GameControlRulesDaemon::updateGameControlFlow();
-}
-
-// ******************************************************************
-void GameManager::dedicatedInputLoop()
-{
- // XXX we need new code here (someone wanna write a readline version of
this
- // stuff?
-#ifdef WIN32
- if( kbhit() )
- {
- int key;
- key = getch();
- if ( key == 0 ) {
- key = getch();
- } else {
- switch( key ) {
- case 27 : {
- exitNetPanzer();
- }
- break;
-
- case 'Q' :
- case 'q' : {
- exitNetPanzer();
- }
- break;
-
- case 'M' :
- case 'm' : {
- GameControlRulesDaemon::forceMapCycle();
- }
- break;
-
- case 'I' :
- case 'i' : {
- ConsoleInterface::postMessage( "Map: %s",
gameconfig->getGameMapName() );
- ConsoleInterface::postMessage( "Players: %d/%d",
PlayerInterface::getActivePlayerCount(),
- gameconfig->maxplayers );
-
- ConsoleInterface::postMessage( "Units: %d/%d",
UnitInterface::getTotalUnitCount(),
- gameconfig->maxunits);
- }
- break;
-
- case '1' : {
- ChatInterface::setMessageScopeServer();
- ChatInterface::sendCurrentMessage( "Server will restart in
5 minutes" );
- }
- break;
-
- case '2' : {
- ChatInterface::setMessageScopeServer();
- ChatInterface::sendCurrentMessage( "Server is restarting"
);
- }
- break;
-
- case '3' : {
- ChatInterface::setMessageScopeServer();
- ChatInterface::sendCurrentMessage( "Server is rotating
map" );
- }
- break;
-
- } // ** switch
- }
- }
-#endif
}
void GameManager::startGameTimer()
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.hpp:1.16
netpanzer/src/NetPanzer/Interfaces/GameManager.hpp:1.17
--- netpanzer/src/NetPanzer/Interfaces/GameManager.hpp:1.16 Mon Oct 20
19:55:05 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.hpp Wed Oct 22 09:19:30 2003
@@ -20,6 +20,8 @@
#include <time.h>
#include <stdint.h>
+#include <string>
+
#include "PlayerState.hpp"
#include "NetPacket.hpp"
#include "ClientConnectDaemon.hpp"
@@ -27,15 +29,6 @@
#include "GameControlRulesDaemon.hpp"
#include "iXY.hpp"
-enum { _execution_mode_loop_back_server,
- _execution_mode_dedicated_server
- };
-
-enum { _game_state_idle,
- _game_state_in_progress,
- _game_state_completed
- };
-
enum { _mapload_result_success,
_mapload_result_no_map_file,
_mapload_result_no_wad_file
@@ -44,12 +37,7 @@
class GameManager
{
private:
- static char map_path[256];
-
-protected:
- friend class ClientConnectDaemon;
- friend class ServerConnectDaemon;
- friend class GameControlRulesDaemon;
+ static std::string map_path;
protected:
static time_t game_start_time;
@@ -58,59 +46,27 @@
static bool display_frame_rate_flag;
static bool display_network_info_flag;
- static int execution_mode;
-
protected:
- static unsigned char game_state;
-
- static void initializeNetworkSubSystem();
- static void shutdownNetworkSubSystem();
-
- static void initializeInputDevices();
- static void shutdownInputDevices();
-
- static void initializeVideoSubSystem();
- static void shutdownVideoSubSystem();
-
- static void initializeSoundSubSystem();
- static void shutdownSoundSubSystem();
-
- static void initializeWindowSubSystem();
-
- // initialize all static objects / interfaces;
- static void initializeGameObjects();
- static void shutdownGameObjects();
-
- static void initializeDedicatedConsole();
- static void shutdownDedicatedConsole();
-
- // boots up netPanzer; initializes all subsystems, game objects etc.
- static void bootStrap();
- static void dedicatedBootStrap();
-
- static void shutdownSubSystems();
- static void dedicatedShutdown();
-
- // cyclic executive for loop back server / client
- static void gameLoop();
-
- static void simLoop();
- static void inputLoop();
- static void graphicsLoop();
-
- // cyclic executive for dedicated server
- static void dedicatedGameLoop();
+ static void finishGameMapLoad();
- static void dedicatedSimLoop();
- static void dedicatedInputLoop();
+ // ** Network Message Handlers
+ static void netMessageSetView( NetMessage *message );
+ static void netMessageViewControl( NetMessage *message );
+ static void netMessageClientGameSetup( NetMessage *message );
+ static void netMessagePingRequest( NetMessage *message );
+ static void netMessagePingAcknowledge( NetMessage *message );
+ static void netMessageConnectAlert( NetMessage *message );
+ static void netMessageResetGameLogic( NetMessage *message );
+public:
+ static void dedicatedLoadGameMap(const char *map_file_path );
static bool startGameMapLoad(const char *map_file_path, unsigned long
partitions, int *result_code );
static bool gameMapLoad( int *percent_complete );
- static void finishGameMapLoad();
- static void dedicatedLoadGameMap(const char *map_file_path );
+ // ** Game Rules Methods
+ static void spawnPlayer( PlayerState *player_state );
- static bool loadGameData();
+ static void respawnAllPlayers();
static void initializeGameLogic();
static void reinitializeGameLogic();
@@ -119,41 +75,13 @@
static void shutdownParticleSystems();
- static void processSystemKeys();
-
- // ** Game Rules Methods
- static void spawnPlayer( PlayerState *player_state );
- static void respawnAllPlayers();
-
- // ** Network Message Handlers
- static void netMessageSetView( NetMessage *message );
- static void netMessageViewControl( NetMessage *message );
- static void netMessageClientGameSetup( NetMessage *message );
- static void netMessagePingRequest( NetMessage *message );
- static void netMessagePingAcknowledge( NetMessage *message );
- static void netMessageConnectAlert( NetMessage *message );
- static void netMessageResetGameLogic( NetMessage *message );
- static void getServerGameSetup( NetMessage *message );
-
static bool startClientGameSetup( NetMessage *message, int *result_code );
static bool clientGameSetup( int *percent_complete );
+ static void getServerGameSetup( NetMessage *message );
- // ** Game Launching Methods
- static void hostMultiPlayerGame();
- static void joinMultiPlayerGame();
- static void launchMultiPlayerGame();
- static void launchDedicatedServer();
public:
static void shutdown();
- /** Initialises the GameManager, only initialize the core parts needed for
a
- * dedicated server if dedicated = true
- */
- static void initialize(bool dedicated = false);
-
- static void mainLoop();
-
- static void launchNetPanzerGame();
static void exitNetPanzer();
Index: netpanzer/src/NetPanzer/Interfaces/ObjectiveInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/ObjectiveInterface.cpp:1.9
netpanzer/src/NetPanzer/Interfaces/ObjectiveInterface.cpp:1.10
--- netpanzer/src/NetPanzer/Interfaces/ObjectiveInterface.cpp:1.9 Wed Sep
24 13:43:22 2003
+++ netpanzer/src/NetPanzer/Interfaces/ObjectiveInterface.cpp Wed Oct 22
09:19:30 2003
@@ -59,7 +59,7 @@
cleanUpObjectiveList();
}
-void ObjectiveInterface::loadObjectiveList( char *file_path )
+void ObjectiveInterface::loadObjectiveList( const char *file_path )
{
unsigned long objective_count;
unsigned long objective_index;
Index: netpanzer/src/NetPanzer/Interfaces/ObjectiveInterface.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/ObjectiveInterface.hpp:1.6
netpanzer/src/NetPanzer/Interfaces/ObjectiveInterface.hpp:1.7
--- netpanzer/src/NetPanzer/Interfaces/ObjectiveInterface.hpp:1.6 Sun Oct
12 15:22:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/ObjectiveInterface.hpp Wed Oct 22
09:19:31 2003
@@ -49,7 +49,7 @@
static void resetLogic( void );
- static void loadObjectiveList( char *file_path );
+ static void loadObjectiveList( const char *file_path );
static unsigned char quearyObjectiveLocationStatus( iXY &loc,
PlayerID &player,
Index: netpanzer/src/NetPanzer/Interfaces/unix/NetworkClientUnix.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/unix/NetworkClientUnix.cpp:1.9
netpanzer/src/NetPanzer/Interfaces/unix/NetworkClientUnix.cpp:1.10
--- netpanzer/src/NetPanzer/Interfaces/unix/NetworkClientUnix.cpp:1.9 Tue Sep
16 16:16:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/unix/NetworkClientUnix.cpp Wed Oct
22 09:19:31 2003
@@ -22,8 +22,8 @@
#include "Desktop.hpp"
#include "NetworkGlobals.hpp"
#include "NetworkState.hpp"
-#include "LobbyView.hpp"
#include "NetworkClientUnix.hpp"
+#include "LobbyView.hpp"
// #define NETWORKDEBUG
@@ -89,7 +89,7 @@
LOG( ( "Couldn't connect to server:\n%s.", e.getMessage()) );
char text[128];
snprintf(text, 128, "connection error: %s", e.getMessage());
- lobbyView.scrollAndUpdate(text);
+ lobbyView->scrollAndUpdate(text);
return false;
}
Index: netpanzer/src/NetPanzer/Views/Game/LobbyView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/LobbyView.cpp:1.14
netpanzer/src/NetPanzer/Views/Game/LobbyView.cpp:1.15
--- netpanzer/src/NetPanzer/Views/Game/LobbyView.cpp:1.14 Mon Oct 13
10:30:18 2003
+++ netpanzer/src/NetPanzer/Views/Game/LobbyView.cpp Wed Oct 22 09:19:31 2003
@@ -22,7 +22,7 @@
#include "Desktop.hpp"
#include "GameManager.hpp"
-LobbyView lobbyView;
+LoadingView *lobbyView = 0;
static void bAbort()
{
@@ -33,7 +33,7 @@
// LobbyView
//---------------------------------------------------------------------------
-LobbyView::LobbyView() : View(), currentline(0)
+LobbyView::LobbyView() : LoadingView(), currentline(0)
{} // end LobbyView::LobbyView
// init
Index: netpanzer/src/NetPanzer/Views/Game/LobbyView.hpp
diff -u netpanzer/src/NetPanzer/Views/Game/LobbyView.hpp:1.4
netpanzer/src/NetPanzer/Views/Game/LobbyView.hpp:1.5
--- netpanzer/src/NetPanzer/Views/Game/LobbyView.hpp:1.4 Mon Oct 13
10:30:19 2003
+++ netpanzer/src/NetPanzer/Views/Game/LobbyView.hpp Wed Oct 22 09:19:31 2003
@@ -20,13 +20,16 @@
#include "View.hpp"
#include "Surface.hpp"
+#include "LoadingView.hpp"
//---------------------------------------------------------------------------
-class LobbyView : public View
+class LobbyView : public LoadingView
{
private:
int currentline;
+ Surface background;
+ Surface backgroundSurface;
protected:
virtual void loadBackgroundSurface();
@@ -38,28 +41,25 @@
//virtual void lMouseDown(const iXY &p);
virtual void doActivate();
- Surface background;
- Surface backgroundSurface;
-
- void init();
- void update(const char *text);
- void scroll();
+ virtual void init();
+ virtual void update(const char *text);
+ virtual void scroll();
void scrollAndUpdate(const char *text)
{
scroll();
update(text);
}
- void reset();
+ virtual void reset();
- void open();
- void close();
- void toggleGameView();
- void toggleMainMenu();
+ virtual void open();
+ virtual void close();
+ virtual void toggleGameView();
+ virtual void toggleMainMenu();
}
; // end LobbyView
-extern LobbyView lobbyView;
+extern LoadingView *lobbyView;
#endif // end __LobbyView_hpp__
Index: netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp:1.16
netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp:1.17
--- netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp:1.16 Wed Oct 22
05:01:14 2003
+++ netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp Wed Oct 22 09:19:31 2003
@@ -23,11 +23,11 @@
#include "ScreenSurface.hpp"
#include "GameManager.hpp"
-ProgressView progressView;
+LoadingView *progressView = 0;
// ProgressView
//---------------------------------------------------------------------------
-ProgressView::ProgressView() : View()
+ProgressView::ProgressView() : LoadingView()
{} // end ProgressView::ProgressView
// init
@@ -79,12 +79,6 @@
background.bltString(0, background.getPix().y - CHAR_YPIX - 1, text,
Color::white);
} // end ProgressView::update
-void ProgressView::updateDirect(const char *text)
-{
- update(text);
- blitToScreen();
-}
-
// scroll
//---------------------------------------------------------------------------
// Purpose: Moves all the current text up one line and creates a new
@@ -98,19 +92,6 @@
// Move the current text up by the height of the app font.
tempSurface.blt(background, 0, - Surface::getFontHeight() - 1);
} // end ProgressView::scroll
-
-void ProgressView::scrollDirect()
-{
- scroll();
- blitToScreen();
-} // end ProgressView::scrollDirect
-
-void ProgressView::scrollAndUpdateDirect(const char *text)
-{
- scroll();
- update(text);
- blitToScreen();
-} // end ProgressView::scrollDirect
void ProgressView::blitToScreen()
{
Index: netpanzer/src/NetPanzer/Views/Game/ProgressView.hpp
diff -u netpanzer/src/NetPanzer/Views/Game/ProgressView.hpp:1.4
netpanzer/src/NetPanzer/Views/Game/ProgressView.hpp:1.5
--- netpanzer/src/NetPanzer/Views/Game/ProgressView.hpp:1.4 Wed Oct 22
05:01:21 2003
+++ netpanzer/src/NetPanzer/Views/Game/ProgressView.hpp Wed Oct 22 09:19:31 2003
@@ -20,9 +20,10 @@
#include "View.hpp"
#include "Surface.hpp"
+#include "LoadingView.hpp"
//---------------------------------------------------------------------------
-class ProgressView : public View
+class ProgressView : public LoadingView
{
protected:
virtual void loadBackgroundSurface();
@@ -38,12 +39,10 @@
Surface background;
Surface backgroundSurface;
- void init();
- void update(const char *text);
- void updateDirect(const char *text);
+ virtual void init();
+ virtual void update(const char *text);
- void scroll();
- void scrollDirect();
+ virtual void scroll();
void scrollAndUpdate(const char *text)
{
@@ -51,19 +50,18 @@
update(text);
}
- void scrollAndUpdateDirect(const char *text);
- void reset();
+ virtual void reset();
- void open();
- void close();
- void toggleGameView();
- void toggleMainMenu();
+ virtual void open();
+ virtual void close();
+ virtual void toggleGameView();
+ virtual void toggleMainMenu();
private:
- void blitToScreen();
+ virtual void blitToScreen();
}; // end ProgressView
-extern ProgressView progressView;
+extern LoadingView *progressView;
#endif // end __ProgressView_hpp__
Index: netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp:1.14
netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp:1.15
--- netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp:1.14 Mon Oct 13
10:30:20 2003
+++ netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp Wed Oct 22
09:19:31 2003
@@ -38,8 +38,8 @@
static void bReturnToMainMenu()
{
if ( gameconfig->mapcycling == true ) {
- progressView.open();
- progressView.scrollAndUpdate( "Waiting for next game map ..." );
+ progressView->open();
+ progressView->scrollAndUpdate( "Waiting for next game map ..." );
} else {
sound->stopTankIdle();
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp
diff -u
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.16
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.17
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.16
Mon Oct 13 10:30:22 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp
Wed Oct 22 09:19:32 2003
@@ -22,7 +22,7 @@
#include "Desktop.hpp"
#include "HostJoinTemplateView.hpp"
#include "GameConfig.hpp"
-#include "GameManager.hpp"
+#include "PlayerGameManager.hpp"
#include "HostView.hpp"
#include "Exception.hpp"
#include "MapSelectionView.hpp"
@@ -118,7 +118,8 @@
MenuTemplateView::backgroundSurface.free();
//MenuTemplateView::titleSurface.free();
- GameManager::launchNetPanzerGame();
+ //TODO: I don't like static methods
+ PlayerGameManager::launchMultiPlayerGame();
}
/*
enum { _unit_type_valentine,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer ./BUGS ./ChangeLog src/Bot/Bot.cpp sr...,
Ivo Danihelka <=