You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(136) |
Dec
(218) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(214) |
Feb
(208) |
Mar
(186) |
Apr
(15) |
May
(3) |
Jun
(35) |
Jul
(6) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(58) |
Aug
(123) |
Sep
(31) |
Oct
(9) |
Nov
|
Dec
(1) |
2006 |
Jan
(25) |
Feb
(10) |
Mar
(25) |
Apr
(61) |
May
|
Jun
(78) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Rob <geo...@us...> - 2004-03-17 23:33:32
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8241 Modified Files: scp.cpp Log Message: no message Index: scp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/scp.cpp,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** scp.cpp 17 Mar 2004 22:27:35 -0000 1.62 --- scp.cpp 17 Mar 2004 23:24:01 -0000 1.63 *************** *** 752,755 **** --- 752,759 ---- // STEP ONE, SETTING / RETRIEVING DATA + // you've to delete a single-player thingy I suppose... if it exists at all. + if (glog) + delete glog; + NetLog *log = new NetLog(); log->init(); *************** *** 997,1001 **** } ! log_test(); log_resetmode(); --- 1001,1005 ---- } ! log_test("a1"); log_resetmode(); *************** *** 1003,1007 **** log->reset(); ! log_test(); // find out, how many hotseat players there are on this computer --- 1007,1011 ---- log->reset(); ! log_test("a2"); // find out, how many hotseat players there are on this computer *************** *** 1078,1082 **** share_string(gname); ! log_test(); message.print(1500,15, "gname [%s]", gname); --- 1082,1086 ---- share_string(gname); ! log_test("b1"); message.print(1500,15, "gname [%s]", gname); *************** *** 1088,1092 **** //message.out("connection established"); ! log_test(); // NOTE --- 1092,1096 ---- //message.out("connection established"); ! log_test("b2"); // NOTE *************** *** 1103,1107 **** log->reset(); ! log_test(); play_game(gname, log); --- 1107,1111 ---- log->reset(); ! log_test("c"); play_game(gname, log); *************** *** 1265,1269 **** if (!_log) { _log = new Log(); ! _log->init(); set_global(_log); } --- 1269,1273 ---- if (!_log) { _log = new Log(); ! _log->init(); // initialization is done further below. set_global(_log); } *************** *** 1298,1302 **** new_game->init(_log); new_game->play(); ! glog->deinit(); game = NULL; new_game->game_done = true; --- 1302,1309 ---- new_game->init(_log); new_game->play(); ! ! if (glog) delete glog; ! glog = 0; ! game = NULL; new_game->game_done = true; |
From: Rob <geo...@us...> - 2004-03-17 22:37:40
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28663 Modified Files: melee.h scp.cpp Log Message: updating some network stuff. Index: scp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/scp.cpp,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** scp.cpp 13 Mar 2004 12:00:18 -0000 1.61 --- scp.cpp 17 Mar 2004 22:27:35 -0000 1.62 *************** *** 520,530 **** int i; ! for ( i = 0; i < num_humans; ++i ) { test1 = 100*rand(); test2 = 100*rand(); ! log_int(test1, channel_player[i]); ! log_int(test2, channel_player[i] + _channel_buffered); // note, that the unbuffered data are not physics, i.e., they can appear later in time. --- 520,530 ---- int i; ! for ( i = 0; i < num_network; ++i ) { test1 = 100*rand(); test2 = 100*rand(); ! log_int(test1, channel_network[i]); ! log_int(test2, channel_network[i] + _channel_buffered); // note, that the unbuffered data are not physics, i.e., they can appear later in time. *************** *** 676,680 **** b_human->set_value(1, Nhumans, 8); b_bot = new ButtonValue(T, "bots_", usefont1); ! b_bot->set_value(0, Nbots, 7); TextButton *game_choice; --- 676,680 ---- b_human->set_value(1, Nhumans, 8); b_bot = new ButtonValue(T, "bots_", usefont1); ! b_bot->set_value(0, Nbots, 99); TextButton *game_choice; *************** *** 708,718 **** - // extra check: - if (b_human->value + b_bot->value > max_player) - { - int k = max_player - b_human->value; - b_bot->set_value(0, k, 7); - } - if (b_cancel->flag.left_mouse_press) CCstatus = -1; --- 708,711 ---- *************** *** 752,763 **** //void play_net ( const char *_address, int _port ) ! void play_net (bool ishost) { STACKTRACE; - // resets the channels to their default values ; that's needed, cause if there are - // bots in the game, channel values can be set to non-human values (-1) - init_channels(); - // STEP ONE, SETTING / RETRIEVING DATA --- 745,752 ---- //void play_net ( const char *_address, int _port ) ! void play_net( bool ishost ) { STACKTRACE; // STEP ONE, SETTING / RETRIEVING DATA *************** *** 767,770 **** --- 756,763 ---- set_global(log); // this sets glog + // resets the channels to their default values ; that's needed, cause if there are + // bots in the game, channel values can be set to non-human values (-1) + init_channels(); + set_config_file("client.ini"); *************** *** 821,831 **** // the remote players are always read-only (local player is always write, of course) int p; ! for ( p = 0; p < max_player; ++p) { if (p != p_local) { ! //log->set_direction(channel_player[p] , Log::direction_read); ! //log->set_direction(channel_player[p] + _channel_buffered, Log::direction_read); ! log->set_r(channel_player[p]); } } --- 814,824 ---- // the remote players are always read-only (local player is always write, of course) int p; ! for ( p = 0; p < max_network; ++p) { if (p != p_local) { ! //log->set_direction(channel_network[p] , Log::direction_read); ! //log->set_direction(channel_network[p] + _channel_buffered, Log::direction_read); ! log->set_r(channel_network[p]); } } *************** *** 914,923 **** for ( i = 0; i <= channel_playback; ++i ) log->set_direction(i, Log::direction_read); - // log->set_r(i); //log->set_r(channel_none); ! for ( p = 0; p < max_player; ++p) { ! log->set_r(channel_player[p]); } --- 907,915 ---- for ( i = 0; i <= channel_playback; ++i ) log->set_direction(i, Log::direction_read); //log->set_r(channel_none); ! for ( p = 0; p < max_network; ++p) { ! log->set_r(channel_network[p]); } *************** *** 926,931 **** // user menu: enter adress and port number ! if (connect_menu(&videosystem.window, &tmp, &port) == -1) ! return; // saving address --- 918,923 ---- // user menu: enter adress and port number ! // if (connect_menu(&videosystem.window, &tmp, &port) == -1) ! // return; // saving address *************** *** 1005,1027 **** } // quick hack for testing. // note that the server has "local" settings which overwrite other players' setting ! num_humans = Nplayers; num_bots = Nbots; ! share(-1, &num_humans); share(-1, &num_bots); share_update(); ! set_numplayers(num_humans + num_bots); share_string(gname); log->optimize4latency(); //message.out("connection established"); log->reset(); play_game(gname, log); --- 997,1108 ---- } + log_test(); + + log_resetmode(); + + log->reset(); + + log_test(); + + // find out, how many hotseat players there are on this computer + // this is done by checking the local player-settings. + // these are stored in scp.ini + // (that's the way it used to be done - ideally you've an interface option for this). + num_hotseats[p_local] = 0; + + set_config_file("scp.ini"); + int i; + for ( i = 0; true; ++i) + { + char buffy[64]; + sprintf(buffy, "Player%d", i + 1); + + const char *type = get_config_string(buffy, "Type", NULL); + if (!type) + break; + + if (strcmp(type, "Human") == 0) // a human player found. + ++num_hotseats[p_local]; + } + if (num_hotseats[p_local] == 0) // there should be at least 1 local player. + ++num_hotseats[p_local]; + + + + + // quick hack for testing. // note that the server has "local" settings which overwrite other players' setting ! num_network = Nplayers; num_bots = Nbots; ! share(-1, &num_network); share(-1, &num_bots); share_update(); + + + message.print(1500, 13, "numnet [%i] numhotseat [%i][%i]", num_network, num_hotseats[0], num_hotseats[1]); + + // next, share how many hotseat-players there are, on each computer. ! int p; ! for ( p = 0; p < num_network; ++p ) ! { ! log_int(num_hotseats[p], channel_network[p]); ! } ! //share_update(); + + for ( p = 0; p < num_network; ++p ) + message.print(1500,15, "Nhotseats [%i]", num_hotseats[p]); + + // no controls (ships) added yet -> should be handled by the game + // but, based on the information provided here, we can already calculate the + // number of players that will enter the game .. + num_players = 0; + for ( p = 0; p < num_network; ++p ) + { + int i; + for ( i = 0; i < num_hotseats[p]; ++i ) + { + // player_connection_num[num_players] = p; THIS is not guaranteed to work .. + ++num_players; + } + } + num_players += num_bots; + // this value can be used for game initialization already... + + + + share_string(gname); + log_test(); + + message.print(1500,15, "gname [%s]", gname); + message.animate(0); + //log_test(); + //readkey(); log->optimize4latency(); //message.out("connection established"); + log_test(); + + // NOTE + // that it's possible that, just before a reset, a remote computer is already + // transmitting data, which've been received by coincidence while you're resetting + // the data. You shouldn't reset those data of course, cause they're needed for + // subsequent actions ... so, + // first you've to log-int a dummy value, to make sure that the two games + // are in synch. After that it's ok to clear them, cause there are NO lingering + // data then ... + // hmm + // however, in >2 player environment, simple sharing of a variable doesn't + // work. Utter chaos I think ... log->reset(); + log_test(); + play_game(gname, log); *************** *** 1039,1046 **** log->set_all_directions(Log::direction_read); int p; ! for ( p = 0; p < max_player; ++p ) // note, 0==server. { ! log->set_direction(channel_player[p] , Log::direction_write | Log::direction_read | NetLog::direction_immediate); ! log->set_direction(channel_player[p] + _channel_buffered, Log::direction_write | Log::direction_read); } --- 1120,1127 ---- log->set_all_directions(Log::direction_read); int p; ! for ( p = 0; p < max_network; ++p ) // note, 0==server. { ! log->set_direction(channel_network[p] , Log::direction_write | Log::direction_read | NetLog::direction_immediate); ! log->set_direction(channel_network[p] + _channel_buffered, Log::direction_write | Log::direction_read); } *************** *** 1087,1094 **** log->set_all_directions(Log::direction_write | Log::direction_read | NetLog::direction_immediate); int p; ! for ( p = 1; p < max_player; ++p ) // note, 0==server. { ! log->set_direction(channel_player[p] , Log::direction_read); ! log->set_direction(channel_player[p] + _channel_buffered, Log::direction_read); } log->set_direction(channel_server + _channel_buffered, Log::direction_write | Log::direction_read); --- 1168,1175 ---- log->set_all_directions(Log::direction_write | Log::direction_read | NetLog::direction_immediate); int p; ! for ( p = 1; p < max_network; ++p ) // note, 0==server. { ! log->set_direction(channel_network[p] , Log::direction_read); ! log->set_direction(channel_network[p] + _channel_buffered, Log::direction_read); } log->set_direction(channel_server + _channel_buffered, Log::direction_write | Log::direction_read); *************** *** 1151,1164 **** // the remote players are always read-only (local player is always write, of course) int p; ! for ( p = 0; p < max_player; ++p) { if (p != p_local) ! glog->set_r(channel_player[p]); } // well, you're in single-player mode. ! num_humans = 1; num_bots = 0; ! num_players = num_humans + num_bots; --- 1232,1245 ---- // the remote players are always read-only (local player is always write, of course) int p; ! for ( p = 0; p < max_network; ++p) { if (p != p_local) ! glog->set_r(channel_network[p]); } // well, you're in single-player mode. ! num_network = 1; num_bots = 0; ! num_players = 1; *************** *** 1250,1254 **** char dialog_string[20][128]; ! int MAX_PLAYERS = 1; int MAX_CONFIGURATIONS = 1; int MAX_TEAMS = 1; --- 1331,1335 ---- char dialog_string[20][128]; ! int max_networkS = 1; int MAX_CONFIGURATIONS = 1; int MAX_TEAMS = 1; *************** *** 1343,1354 **** set_config_file("scp.ini"); if (!player_type) { ! MAX_PLAYERS = get_config_int("Limits", "MaxPlayers", 12); MAX_CONFIGURATIONS = get_config_int("Limits", "MaxConfigurations", 4); MAX_TEAMS = get_config_int("Limits", "MaxTeams", 6); ! player_type = new char*[MAX_PLAYERS]; ! player_config = new int[MAX_PLAYERS]; ! player_team = new int[MAX_PLAYERS]; } ! for (i = 0; i < MAX_PLAYERS; i += 1) { sprintf(tmp, "Player%d", i+1); player_type[i] = strdup(get_config_string(tmp, "Type", "Human")); --- 1424,1435 ---- set_config_file("scp.ini"); if (!player_type) { ! max_networkS = get_config_int("Limits", "MaxPlayers", 12); MAX_CONFIGURATIONS = get_config_int("Limits", "MaxConfigurations", 4); MAX_TEAMS = get_config_int("Limits", "MaxTeams", 6); ! player_type = new char*[max_networkS]; ! player_config = new int[max_networkS]; ! player_team = new int[max_networkS]; } ! for (i = 0; i < max_networkS; i += 1) { sprintf(tmp, "Player%d", i+1); player_type[i] = strdup(get_config_string(tmp, "Type", "Human")); *************** *** 1909,1913 **** set_config_file("scp.ini"); ! for (i = 0; i < MAX_PLAYERS; i += 1) { sprintf(dialog_string[0], "Player%d", i+1); set_config_string (dialog_string[0], "Type", player_type[i]); --- 1990,1994 ---- set_config_file("scp.ini"); ! for (i = 0; i < max_networkS; i += 1) { sprintf(dialog_string[0], "Player%d", i+1); set_config_string (dialog_string[0], "Type", player_type[i]); *************** *** 2899,2903 **** tmp[0] = 0; if(index < 0) { ! *list_size = MAX_PLAYERS; return NULL; } else { --- 2980,2984 ---- tmp[0] = 0; if(index < 0) { ! *list_size = max_networkS; return NULL; } else { Index: melee.h =================================================================== RCS file: /cvsroot/timewarp/source/melee.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** melee.h 20 Feb 2004 08:42:43 -0000 1.14 --- melee.h 17 Mar 2004 22:27:34 -0000 1.15 *************** *** 587,590 **** --- 587,591 ---- void load(); void unload(); + bool islocked(); DATAFILE *data; // int num_panel_bitmaps; |
From: Rob <geo...@us...> - 2004-03-17 22:37:36
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28663/ais Modified Files: c_other.cpp c_wussie.cpp Log Message: updating some network stuff. Index: c_other.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_other.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** c_other.cpp 29 Jan 2004 21:20:27 -0000 1.8 --- c_other.cpp 17 Mar 2004 22:27:35 -0000 1.9 *************** *** 58,64 **** /*! \brief Summon stupid_bot() */ ! int ControlMoron::think() { ! return stupid_bot(ship); ! } ControlMoron::ControlMoron(const char *name, int channel) : Control(name, channel) {} --- 58,68 ---- /*! \brief Summon stupid_bot() */ ! int ControlMoron::think() ! { ! if (ship) ! return stupid_bot(ship); ! else ! return 0; ! } ControlMoron::ControlMoron(const char *name, int channel) : Control(name, channel) {} Index: c_wussie.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_wussie.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** c_wussie.cpp 29 Jan 2004 21:20:27 -0000 1.11 --- c_wussie.cpp 17 Mar 2004 22:27:35 -0000 1.12 *************** *** 50,54 **** double ControlWussie::check_danger () { ! STACKTRACE double d = 0; --- 50,54 ---- double ControlWussie::check_danger () { ! STACKTRACE; double d = 0; *************** *** 89,93 **** double ControlWussie::evasion (Ship * ship) { ! STACKTRACE double closetime = 500; --- 89,93 ---- double ControlWussie::evasion (Ship * ship) { ! STACKTRACE; double closetime = 500; *************** *** 171,175 **** int ControlWussie::think () { ! STACKTRACE int action = 0; --- 171,178 ---- int ControlWussie::think () { ! STACKTRACE; ! ! if (!ship) ! return 0; int action = 0; *************** *** 597,601 **** void ControlWussie::select_ship (Ship * ship_pointer, const char *ship_name) { ! STACKTRACE; char tmp[20]; --- 600,604 ---- void ControlWussie::select_ship (Ship * ship_pointer, const char *ship_name) { ! STACKTRACE;; char tmp[20]; |
From: Rob <geo...@us...> - 2004-03-17 22:37:10
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28663/melee Modified Files: mcbodies.cpp mcontrol.cpp mfleet.cpp mgame.cpp mgame.h mlog.cpp mlog.h mmain.cpp mmain.h mnet1.cpp mnet1.h mship.cpp mshpdata.cpp Log Message: updating some network stuff. Index: mshpdata.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshpdata.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mshpdata.cpp 29 Jan 2004 21:20:29 -0000 1.7 --- mshpdata.cpp 17 Mar 2004 22:27:37 -0000 1.8 *************** *** 178,182 **** void ShipData::lock() { ! if (references == 0) { push_config_state();//can screw up badly if an error occurs while loading... load(); --- 178,182 ---- void ShipData::lock() { ! if (!islocked()) { push_config_state();//can screw up badly if an error occurs while loading... load(); *************** *** 188,196 **** void ShipData::unlock() { references -= 1; ! if ((references == 0) && auto_unload) { unload(); } } void unload_all_ship_data() { } --- 188,201 ---- void ShipData::unlock() { references -= 1; ! if (!islocked() && auto_unload) { unload(); } } + bool ShipData::islocked() + { + return references > 0; + } + void unload_all_ship_data() { } Index: mgame.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** mgame.h 13 Mar 2004 11:45:31 -0000 1.16 --- mgame.h 17 Mar 2004 22:27:37 -0000 1.17 *************** *** 51,55 **** ! const int max_player = 8; extern const int channel_none; //not a valid channel --- 51,55 ---- ! const int max_network = 100; extern const int channel_none; //not a valid channel *************** *** 64,72 **** // each guy who logs in to a game (defined by the server) receives a local-channel number from the server. // (eg. player 1, player 2 .. player 7). ! extern int channel_player[max_player]; //data originating on the client ! extern int p_local, num_players, num_humans, num_bots; int channel_local(); void init_channels(); ! void set_numplayers(int n); --- 64,98 ---- // each guy who logs in to a game (defined by the server) receives a local-channel number from the server. // (eg. player 1, player 2 .. player 7). ! extern int channel_network[max_network]; //data originating on the client ! extern int p_local, num_network, num_hotseats[max_network], num_bots, num_players; ! ! extern int channel_conn_recv[100]; ! // The connection id, where a channel last received data from ! // This can be used to check which channel belongs to which physical connection. ! ! class PlayerInformation ! { ! public: ! int channel; ! // channels used by players in the game. ! // note, that, while channel_network has unique values, the player_channel can have ! // duplicate values, because different (hotseat) players share the same ! // network channel. ! ! char name[64]; ! Control *control; ! TeamCode team; ! int color; ! bool status; // true=alive, false=disconnected/dead ! ! bool haschannel(int ch); // checks for channel and the buffered channel ! void die(); ! }; ! extern PlayerInformation *player[100]; ! ! int channel_local(); void init_channels(); ! *************** *** 275,281 **** --- 301,317 ---- void test_event1(); + void disconnect(); + // "extreme" desynch testing. void heavy_compare(); + + + void item_sum(char *comment); + + void remove_player(int i); + + + virtual PlayerInformation *new_player(); // should return a pointer to a new player-class }; Index: mmain.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mmain.h 12 Mar 2004 20:14:59 -0000 1.12 --- mmain.h 17 Mar 2004 22:27:37 -0000 1.13 *************** *** 5,8 **** --- 5,19 ---- #include "mgame.h" + int log_size_pl(int netnum); + int log_totalsize(); + void log_test(); + + // normal player information. + class NPI : public PlayerInformation + { + public: + Fleet *fleet; + }; + class NormalGame : public Game { public: *************** *** 37,48 **** virtual int add_player (int num, Control *c, int team_index, const char *name, const char *fleet, const char *fleet_file = "fleets.ini") ; //int num_players; should be global, for networking (which should also be global) ! Control **player_control; // ShipPanel **player_panel; ! Fleet **player_fleet; ! char **player_name; char *player_attributes; ! TeamCode *player_team; TeamCode *team_table; int team_table_size; // virtual void player_said(int who, const char *what); --- 48,60 ---- virtual int add_player (int num, Control *c, int team_index, const char *name, const char *fleet, const char *fleet_file = "fleets.ini") ; //int num_players; should be global, for networking (which should also be global) ! // Control **player_control; // ShipPanel **player_panel; ! // Fleet **player_fleet; ! // char **player_name; char *player_attributes; ! // TeamCode *player_team; TeamCode *team_table; int team_table_size; + // int *player_color; // virtual void player_said(int who, const char *what); *************** *** 59,66 **** bool player_isalive(int i); int local_player(); - int log_size_pl(int iplayer); - int log_totalsize(); - void log_test(); }; --- 71,80 ---- bool player_isalive(int i); int local_player(); + + void check_file(const char *id); + void download_file(char *filename); + + virtual PlayerInformation *new_player(); // should return a pointer to a new player-class }; Index: mmain.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** mmain.cpp 12 Mar 2004 20:14:59 -0000 1.30 --- mmain.cpp 17 Mar 2004 22:27:37 -0000 1.31 *************** *** 29,32 **** --- 29,37 ---- + PlayerInformation *NormalGame::new_player() + { + return new NPI(); + } + /*void Game::player_said(int who, const char *what) { if ((who < 0) || (who >= num_players)) tw_error ("Who said that?!?"); [...1059 lines suppressed...] *** 991,993 **** --- 1064,1081 ---- + int log_size_pl(int netnum) + { + int k = channel_network[netnum]; + return log_size_ch(k); + } + + int log_totalsize() + { + int test = 0; + int i; + for ( i = 0; i < num_players; ++i ) + test += log_size_pl(i); + + return test; + } REGISTER_GAME(NormalGame, "Melee") Index: mnet1.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mnet1.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mnet1.cpp 15 Mar 2004 22:20:31 -0000 1.11 --- mnet1.cpp 17 Mar 2004 22:27:37 -0000 1.12 *************** *** 127,130 **** --- 127,132 ---- remote_time[i] = 0; ping[i] = -1; + + net_status[i] = true; } *************** *** 143,148 **** { STACKTRACE; - int i; for ( i = 0; i < max_connections; ++i ) net[i].deinit(); --- 145,156 ---- { STACKTRACE; int i; + + Log::deinit(); + + // set all channelinfo to 0 + for ( i = 0; i < log_num; ++i ) + log_transmitted[i] = 0; + for ( i = 0; i < max_connections; ++i ) net[i].deinit(); *************** *** 235,238 **** --- 243,248 ---- for ( conn = 0; conn < num_connections; ++conn ) { + if (!net_status[conn]) continue; + // maintain some connection-dependent control parameter (namely, // the remote time ? This is the time-value that's sent here, and *************** *** 253,256 **** --- 263,267 ---- { STACKTRACE; + if (!net_status[conn]) return; if (!net[conn].isConnected()) { tw_error("NetLog::send_packet() - no connection!"); } *************** *** 264,267 **** --- 275,279 ---- { STACKTRACE; + if (!net_status[conn]) return; if (!net[conn].isConnected()) { tw_error("NetLog::send_packet() - no connection!"); } *************** *** 300,303 **** --- 312,318 ---- { STACKTRACE; + + if (!net_status[conn]) return; + int pos, len; int i, j, k, l; *************** *** 326,337 **** tw_error("Unexpected: receiving packet with overhead, but zero content!"); ! //if (len != net[conn].recv(len, len, &buffy)) ! if (len != net[conn].recv(len, len, buffy)) tw_error( "NetLog::recv_packet -- net.recv error (2)"); // data've been received, now put them into the log structure. pos = 0; ! while (pos < len) { i = buffy[pos]; if (i < 0) { tw_error("NegLog::recv_packet - data came in on a negative channel %d", i); } --- 341,357 ---- tw_error("Unexpected: receiving packet with overhead, but zero content!"); ! check_bufsize(len); ! int nrecv = net[conn].recv(len, len, buffy); ! ! if (len != nrecv) tw_error( "NetLog::recv_packet -- net.recv error (2)"); // data've been received, now put them into the log structure. + // you just analyze the buffer here. pos = 0; ! while (pos < len) ! { ! // the channel identifier i = buffy[pos]; if (i < 0) { tw_error("NegLog::recv_packet - data came in on a negative channel %d", i); } *************** *** 340,353 **** pos += 1; ! check_bufsize(pos+8); l = read_length_code(len-pos, &j, &k, &buffy[pos]); if (l < 0) { tw_error ("NetLog::recv_packet -- read_length_code failed"); } pos += j; if (i >= log_num) expand_logs(i+1); - if (!(log_dir[i] & direction_read)) { tw_error( "recieved data on wrong channel"); } ! check_bufsize(pos+k); Log::_log(i, &buffy[pos], k); pos += k; } if (pos != len) --- 360,375 ---- pos += 1; ! // the #data for this channel, stored in a temporary buffer l = read_length_code(len-pos, &j, &k, &buffy[pos]); if (l < 0) { tw_error ("NetLog::recv_packet -- read_length_code failed"); } pos += j; if (i >= log_num) expand_logs(i+1); ! // write the buffer into the channel Log::_log(i, &buffy[pos], k); pos += k; + + // record from which connection a channel last received its data + channel_conn_recv[i] = conn; } if (pos != len) *************** *** 517,520 **** --- 539,544 ---- for ( conn = 0; conn < num_connections; ++conn ) { + if (!net_status[conn]) continue; + while (net[conn].ready2recv()) { *************** *** 537,540 **** --- 561,566 ---- for ( conn = 0; conn < num_connections; ++conn ) { + if (!net_status[conn]) continue; + if (net[conn].ready2recv()) recv_packet(conn); } *************** *** 559,562 **** --- 585,590 ---- for ( conn = 0; conn < num_connections; ++conn ) { + if (!net_status[conn]) continue; + if (!net[conn].ready2send()) return false; *************** *** 622,625 **** --- 650,655 ---- for ( conn = 0; conn < num_connections; ++conn ) { + if (!net_status[conn]) continue; + net[conn].optimize4latency(); } *************** *** 665,666 **** --- 695,729 ---- + void NetLog::force_update() + { + need_to_transmit = true; + } + + + + void NetLog::reset() + { + int i; + for ( i = 0; i < log_num; ++i ) + { + if (writeable(i) && log_transmitted[i] != log_len[i]) + tw_error("NetLog::reset - resetting before all data could be sent in channel [%i] , pos[%i] transm[%i] len[%i]", + i, log_pos[i], log_transmitted[i], log_len[i]); + log_transmitted[i] = 0; // no problem, when calling a reset, all data IS sent. + } + + Log::reset(); + + } + + + + + + + + void NetLog::rem_conn(int conn) + { + net_status[conn] = false; + } + Index: mfleet.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mfleet.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** mfleet.cpp 29 Feb 2004 23:22:17 -0000 1.23 --- mfleet.cpp 17 Mar 2004 22:27:37 -0000 1.24 *************** *** 91,95 **** int s = 0; int j; ! j = intel_ordering(getSize()); memcpy(&buffy[s], &j, sizeof(j)); s += sizeof(j); --- 91,96 ---- int s = 0; int j; ! j = getSize(); ! j = intel_ordering(j); memcpy(&buffy[s], &j, sizeof(j)); s += sizeof(j); Index: mcbodies.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcbodies.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mcbodies.cpp 29 Jan 2004 21:20:29 -0000 1.10 --- mcbodies.cpp 17 Mar 2004 22:27:37 -0000 1.11 *************** *** 78,81 **** --- 78,84 ---- mass = 9999999.0; //use remote .ini file + + push_config_state(); + game->log_file ("server.ini"); sprite_index = index; *************** *** 88,91 **** --- 91,95 ---- gravity_whip2 = get_config_float("Planet", "GravityWhip2", 0); + pop_config_state(); } Index: mlog.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mlog.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** mlog.cpp 15 Mar 2004 22:20:31 -0000 1.13 --- mlog.cpp 17 Mar 2004 22:27:37 -0000 1.14 *************** *** 13,20 **** int channel_current = -1; ! int channel_file_names = 0; int channel_file_data = 1; //direction for file channels must be the same //////////////////////////////////////////////////////////////////////// // Logging stuff --- 13,21 ---- int channel_current = -1; ! int channel_file_names = 0; // ISN'T USED ... int channel_file_data = 1; //direction for file channels must be the same + //////////////////////////////////////////////////////////////////////// // Logging stuff *************** *** 198,202 **** } ! void Log::log ( int channel, void *data, int size) {STACKTRACE if (!size) return; if (channel < 0) {tw_error ("Log::log - negative channel!");} --- 199,209 ---- } ! void Log::log ( int channel, void *data, int size) ! { ! STACKTRACE; ! ! if (channel == 0) ! tw_error("attempting to write to a forbidden channel"); ! if (!size) return; if (channel < 0) {tw_error ("Log::log - negative channel!");} *************** *** 205,213 **** } if ((log_dir[channel] & direction_write) && !log_write_disable) _log ( channel, data, size); if ((log_dir[channel] & direction_read ) && !log_read_disable && !log_fake ) _unlog ( channel, data, size); return; } ! void Log::_log(int channel, const void *data, int size) {STACKTRACE log_len[channel] += size; while (log_len[channel] > log_size[channel]) { --- 212,232 ---- } + if (!log_dir[channel]) _null_log(channel, data, size); if ((log_dir[channel] & direction_write) && !log_write_disable) _log ( channel, data, size); if ((log_dir[channel] & direction_read ) && !log_read_disable && !log_fake ) _unlog ( channel, data, size); return; } ! ! ! void Log::_null_log(int channel, void *data, int size) ! { ! memset(data, 0, size); // the channel doesn't matter in this case. ! // just set requested data to a predictable size of 0. ! } ! ! void Log::_log(int channel, const void *data, int size) ! { ! STACKTRACE; ! log_len[channel] += size; while (log_len[channel] > log_size[channel]) { *************** *** 300,304 **** ! void Log::deinit() {STACKTRACE return; } --- 319,335 ---- ! void Log::deinit() ! { ! STACKTRACE; ! ! // set all channelinfo to 0 ! ! int i; ! for ( i = 0; i < log_num; ++i ) ! { ! log_len[i] = 0; ! log_pos[i] = 0; ! } ! return; } *************** *** 362,370 **** } ! void Log::reset() { int i; ! for (i = 0 ; i < this->log_num; i += 1) { ! log_pos[i] = 0; } return; } --- 393,433 ---- } ! /* ! Well, there can be a problem here, if you reset a log, while one of the remote ! computers has already passed the reset() line, and has already sent new data to ! this computer. In that case, there's still data to be read, and the reset should ! not delete those data - those data belong to the program-part that comes AFTER the ! reset call, so it's ok to keep them in store. ! */ ! void Log::reset() ! { int i; ! for (i = 0 ; i < log_num; i += 1) ! { ! // added GEO: ! if (log_len[i] - log_pos[i] > 0) ! { ! // tw_error("Resetting a non-empty log channel[%i] pos[%i] len[%i] !!", ! // i, log_pos[i], log_len[i]); ! // actually, the line above doesn't adress a real error, but it can be ! // caused by a remote computer, who's executing actions slightly earlier than ! // this computer, and who could've already sent some data to this computer, ! // which this computer has happily accepted. Since these data belong to ! // actions *after* the reset point, you've to keep them for later use, ! ! int k = log_len[i] - log_pos[i]; ! ! memcpy(log_data[i], log_data[i] + log_pos[i], k); ! ! log_len[i] = k; // keep the lingering data, since those belong to subsequent actions, ! //originating from too-early actions by remote computers in the game ! log_pos[i] = 0; ! } else { ! ! log_len[i] = 0; ! log_pos[i] = 0; } + } + return; } *************** *** 396,400 **** ! enum share_types {TYPE_CHAR, TYPE_SHORT, TYPE_INT}; static const int max_share = 512; static int Nshare = 0; --- 459,463 ---- ! enum share_types {TYPE_CHAR, TYPE_SHORT, TYPE_INT, TYPE_DOUBLE}; static const int max_share = 512; static int Nshare = 0; *************** *** 428,438 **** ! static int chann(int player) { ! if (player == -1) return channel_init; else ! return channel_player[player]; } --- 491,501 ---- ! static int chann(int iplayer) { ! if (iplayer == -1) return channel_init; else ! return player[iplayer]->channel; } *************** *** 441,444 **** --- 504,509 ---- if (chann(player) == channel_none) return; + if (player > num_players) + tw_error("player [%i] exceeds max allowed value [%i] -- perhaps you use share(channel) instead of share(player)", player, num_players); share_channel[Nshare] = chann(player); *************** *** 492,495 **** --- 557,565 ---- } + void share(int player, double *value, int num) + { + share_buffer(player, value, num, sizeof(double), TYPE_DOUBLE); + } + *************** *** 501,512 **** to the proper memory locations. */ void share_update() { ! // do it here, cause why would you want to wait for each little packet till it ! // can be sent onto the net ? ! ! // glog->need_to_transmit = true; ! glog->flush_block(); // superfluous, cause this is already used inside the unbuffer routine. --- 571,587 ---- to the proper memory locations. */ + #include "mmain.h" void share_update() { ! // test the network, whether the log channels are still ok. ! // by using a call to log_test(); ! // but NOT here, cause at this moment, you can have mixing of data. You've to ! // wait till the (delayed) buffered data (from calls to share()) are received, ! // since those are already on their way on the net.. ! // you've to test at the end of this subroutine. ! glog->force_update(); ! glog->flush_block(); // this only blocks, if need_to_tranmit == true. ! // so, for that I call force_update() // superfluous, cause this is already used inside the unbuffer routine. *************** *** 527,530 **** --- 602,610 ---- Nshare = 0; + + // test the network, whether the log channels are still ok. + // it's safe to do here, cause all lingering requests should've + // been updated by now !! + // log_test(); } *************** *** 643,644 **** --- 723,745 ---- return 0; } + + + + void rand_resync() + { + int k; + k = channel_current; + channel_current = channel_server; + + int i; + + i = rand(); + log_int(i); + rng.seed(i); + + i = rand(); + log_int(i); + rng.seed_more(i); + + channel_current = k; + } Index: mnet1.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mnet1.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mnet1.h 12 Mar 2004 20:14:59 -0000 1.8 --- mnet1.h 17 Mar 2004 22:27:37 -0000 1.9 *************** *** 82,85 **** --- 82,86 ---- int num_connections; NetTCP net[max_connections]; // the TCP network connection to the opponent player + bool net_status[max_connections]; int conn(int channel) { return channel / 4; }; *************** *** 121,124 **** --- 122,132 ---- bool ready2send(); void send_packet_noblock(int conn); + + virtual void force_update(); + + virtual void reset(); + + void rem_conn(int conn); + }; Index: mship.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** mship.cpp 2 Mar 2004 12:33:51 -0000 1.28 --- mship.cpp 17 Mar 2004 22:27:37 -0000 1.29 *************** *** 552,555 **** --- 552,559 ---- if (control) { + + // it makes most sense, to place this in FRONT of these commands here ... + this->nextkeys = control->keys; + this->thrust = 1&&(nextkeys & keyflag::thrust); this->thrust_backwards = 1&&(nextkeys & keyflag::back); *************** *** 581,585 **** } } - this->nextkeys = control->keys; --- 585,588 ---- Index: mlog.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mlog.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mlog.h 12 Mar 2004 20:14:59 -0000 1.7 --- mlog.h 17 Mar 2004 22:27:37 -0000 1.8 *************** *** 104,107 **** --- 104,110 ---- char *Log::create_buffer(int *size, int ch = channel_current); + virtual void force_update() {}; + + void _null_log(int channel, void *data, int size); }; *************** *** 115,123 **** /** \brief Share memory values accross player channels. */ ! void share(int player, int *value, int num = 1); ! void share(int player, short *value, int num = 1); ! void share(int player, char *value, int num = 1); void share_update(); #endif // __MLOG_H__ --- 118,133 ---- /** \brief Share memory values accross player channels. */ ! void share(int netnum, int *value, int num = 1); ! void share(int netnum, short *value, int num = 1); ! void share(int netnum, char *value, int num = 1); ! void share(int player, double *value, int num = 1); void share_update(); + /** \brief Helper to synch random numbers between networked computers - this is + useful in case that the host initialization requires random numbers, which aren't + synched ... although you could also use "rand()" in that case, which doesn't affect + the random numbers but well... + */ + void rand_resync(); #endif // __MLOG_H__ Index: mgame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** mgame.cpp 15 Mar 2004 22:20:31 -0000 1.36 --- mgame.cpp 17 Mar 2004 22:27:37 -0000 1.37 *************** *** 51,54 **** --- 51,64 ---- + bool PlayerInformation::haschannel(int ch) + { + return (channel == ch || channel + _channel_buffered == ch ); + } + + // destroy stuff that belongs to the player. + void PlayerInformation::die() + { + control->die(); + } *************** *** 57,63 **** { int p; ! for ( p = 0; p < num_humans; ++p ) { ! int ch = channel_player[p]; message.print(1500, 15, "[%s] player[%i] (direct) [%i] (buffered) [%i]", txt, p, glog->log_len[ch] - glog->log_pos[ch], --- 67,73 ---- { int p; ! for ( p = 0; p < num_network; ++p ) { ! int ch = channel_network[p]; message.print(1500, 15, "[%s] player[%i] (direct) [%i] (buffered) [%i]", txt, p, glog->log_len[ch] - glog->log_pos[ch], *************** *** 127,131 **** log_set_default(); ! // there must be at least one "next frame" otherwise nothing happens. --- 137,142 ---- log_set_default(); ! ! // there must be at least one "next frame" otherwise nothing happens. *************** *** 290,312 **** ! const int channel_none = -1; ! const int _channel_buffered = 1; ! const int channel_init = 4; // game type, version, length, etc.. things that need to read by a reader independant of a particular game type ! const int channel_playback = 8; // used for demo playbacks only ! const int channel_server = 12; //data originating on the server ! int channel_player[max_player]; //data originating on the client int p_local; // this defines the local player. ! int num_players = 0; // the number of players in the game. ! int num_humans = 0; ! int num_bots = 0; ! void set_numplayers(int n) ! { ! num_players = n; ! } int channel_local() { ! return channel_player[p_local]; } --- 301,330 ---- ! static const int channel_none = -1; ! static const int _channel_buffered = 1; ! static const int channel_init = 4; // game type, version, length, etc.. things that need to read by a reader independant of a particular game type ! static const int channel_playback = 8; // used for demo playbacks only ! static const int channel_server = 12; //data originating on the server ! int channel_network[max_network]; //data originating on the client ! int num_hotseats[max_network]; // number of hotseat-players per connected computer ! int channel_conn_recv[100]; ! int p_local; // this defines the local player. ! //int num_players = 0; // the number of players in the game. ! int num_network = 0; ! int num_bots = 0, num_players = 0; ! ! ! PlayerInformation *player[100]; ! ! //void set_numplayers(int n) ! //{ ! // num_players = n; ! //} int channel_local() { ! return channel_network[p_local]; } *************** *** 316,326 **** // default values for the available channels ! channel_player[0] = channel_server; //data originating on the server (=player 0) int i; ! for ( i = 1; i < max_player; ++i ) ! channel_player[i] = channel_player[i-1] + 4; //data originating on the client ! // actual number of players that use these channels... ! num_players = 0; }; --- 334,355 ---- // default values for the available channels ! channel_network[0] = channel_server; //data originating on the server (=player 0) int i; ! for ( i = 1; i < max_network; ++i ) ! { ! channel_network[i] = channel_network[i-1] + 4; //data originating on the client ! channel_conn_recv[i] = -1; ! } ! ! // actual number of connected computers that use these channels... ! num_network = 0; ! ! // initialize the log also, if possible ! if (glog) ! { ! glog->expand_logs(channel_network[max_network-1] + 4); ! } /* else ! tw_error("Warning:it's best to initialize log channels here !!"); */ }; *************** *** 433,449 **** ! void Game::log_fleet(int channel, Fleet *fleet) {STACKTRACE int fl; - void *tmpdata = fleet->serialize(&fl); char buffer[16384]; channel_current = channel; ! if (fl > 16000) {tw_error("blah");} ! memcpy(buffer, tmpdata, fl); ! free(tmpdata); log_int(fl); if (fl > 16000) {tw_error("blah");} log_data(buffer, fl); fleet->deserialize(buffer, fl); } --- 462,487 ---- ! void Game::log_fleet(int channel, Fleet *fleet) ! { ! STACKTRACE; ! int fl; char buffer[16384]; channel_current = channel; ! if (log_writable()) // if channel_current is open for writing. ! { ! void *tmpdata = fleet->serialize(&fl); ! ! if (fl > 16000) {tw_error("blah");} ! memcpy(buffer, tmpdata, fl); ! free(tmpdata); ! } ! log_int(fl); if (fl > 16000) {tw_error("blah");} log_data(buffer, fl); + fleet->deserialize(buffer, fl); } *************** *** 513,518 **** int i; bool result = true; ! for ( i = 0; i < num_humans; ++i ) ! if (!glog->ready(channel_player[i] + _channel_buffered)) result = false; //if (!log->ready(channel_server + Game::_channel_buffered)) return false; --- 551,556 ---- int i; bool result = true; ! for ( i = 0; i < num_network; ++i ) ! if (!glog->ready(channel_network[i] + _channel_buffered)) result = false; //if (!log->ready(channel_server + Game::_channel_buffered)) return false; *************** *** 641,645 **** unsigned char local_checksum = checksum() & 255; ! unsigned char client_checksum[max_player]; unsigned char server_checksum = local_checksum; bool desync = false; --- 679,683 ---- unsigned char local_checksum = checksum() & 255; ! unsigned char client_checksum[max_network]; unsigned char server_checksum = local_checksum; bool desync = false; *************** *** 649,656 **** { int i; ! for ( i = 1; i < num_humans; ++i ) // note, 0==server. { client_checksum[i] = local_checksum; ! log_char(client_checksum[i], channel_player[i] + CHECKSUM_CHANNEL); if (server_checksum != client_checksum[i]) --- 687,694 ---- { int i; ! for ( i = 1; i < num_network; ++i ) // note, 0==server. { client_checksum[i] = local_checksum; ! log_char(client_checksum[i], channel_network[i] + CHECKSUM_CHANNEL); if (server_checksum != client_checksum[i]) *************** *** 697,712 **** int i, p; ! for ( p = 0; p < num_humans; ++p ) // note, 0==server. { ! if ((glog->get_direction(channel_player[p]) & Log::direction_write) != 0) { COMPILE_TIME_ASSERT(sizeof(events_waiting) == sizeof(char)); // you _always_ transmit the # of events (can be null) ! glog->buffer( channel_player[p] + _channel_buffered, &events_waiting, sizeof(events_waiting) ); for (i = 0; i < events_waiting; i += 1) { ! glog->buffer ( channel_player[p] + _channel_buffered, waiting_events[i], waiting_events[i]->size ); } //deallocate transmitted events --- 735,750 ---- int i, p; ! for ( p = 0; p < num_network; ++p ) // note, 0==server. { ! if ((glog->get_direction(channel_network[p] + _channel_buffered) & Log::direction_write) != 0) { COMPILE_TIME_ASSERT(sizeof(events_waiting) == sizeof(char)); // you _always_ transmit the # of events (can be null) ! glog->buffer( channel_network[p] + _channel_buffered, &events_waiting, sizeof(events_waiting) ); for (i = 0; i < events_waiting; i += 1) { ! glog->buffer ( channel_network[p] + _channel_buffered, waiting_events[i], waiting_events[i]->size ); } //deallocate transmitted events *************** *** 730,742 **** char buffy[1024]; ! for ( p = 0; p < num_humans; ++p ) // note, 0==server. { // you _always_ read the # of events. ! glog->unbuffer(channel_player[p] + _channel_buffered, &ne, sizeof(ne)); for (i = 0; i < ne; i += 1) { char *tmp = buffy; ! //glog->unbuffer(channel_player[p] + _channel_buffered, &buffy, sizeof(GameEvent)); ! glog->unbuffer(channel_player[p] + _channel_buffered, buffy, sizeof(GameEvent)); int s = ((GameEvent*)tmp)->size; if (s > 1024) { --- 768,780 ---- char buffy[1024]; ! for ( p = 0; p < num_network; ++p ) // note, 0==server. { // you _always_ read the # of events. ! glog->unbuffer(channel_network[p] + _channel_buffered, &ne, sizeof(ne)); for (i = 0; i < ne; i += 1) { char *tmp = buffy; ! //glog->unbuffer(channel_network[p] + _channel_buffered, &buffy, sizeof(GameEvent)); ! glog->unbuffer(channel_network[p] + _channel_buffered, buffy, sizeof(GameEvent)); int s = ((GameEvent*)tmp)->size; if (s > 1024) { *************** *** 744,749 **** memcpy(tmp, buffy, sizeof(GameEvent)); } ! glog->unbuffer(channel_player[p] + _channel_buffered, tmp + sizeof(GameEvent), s - sizeof(GameEvent)); ! handle_game_event ( channel_player[p], ((GameEvent*)tmp)); if (tmp != buffy) free(tmp); } --- 782,787 ---- memcpy(tmp, buffy, sizeof(GameEvent)); } ! glog->unbuffer(channel_network[p] + _channel_buffered, tmp + sizeof(GameEvent), s - sizeof(GameEvent)); ! handle_game_event ( channel_network[p], ((GameEvent*)tmp)); if (tmp != buffy) free(tmp); } *************** *** 787,795 **** int p; bool result = true; ! for ( p = 0; p < num_humans; ++p ) { k= val; ! log_int(k, channel_player[p] + _channel_buffered); if (k != val) --- 825,833 ---- int p; bool result = true; ! for ( p = 0; p < num_network; ++p ) { k= val; ! log_int(k, channel_network[p] + _channel_buffered); if (k != val) *************** *** 798,802 **** --- 836,844 ---- if (!result) + { + message.print(1500, 14, "frame[%i] time[%i]", frame_number, game_time); + message.animate(0); tw_error("error in buffered data"); + } } *************** *** 1053,1058 **** ! void Game::init(Log *_log) {_STACKTRACE("Game::init"); ! int i; //display_channel_info("game::init"); --- 1095,1101 ---- ! void Game::init(Log *_log) ! { ! _STACKTRACE("Game::init"); //display_channel_info("game::init"); *************** *** 1135,1138 **** --- 1178,1183 ---- //display_channel_info("game - log_int"); + rand_resync(); + /* channel_current = channel_server; *************** *** 1147,1150 **** --- 1192,1196 ---- random_seed[1] = i; rng.seed_more(i); + */ if (!is_paused()) pause(); *************** *** 1223,1230 **** { int p; ! for ( p = 0; p < num_humans; ++p ) { // server-side lag-test ? ! log_int(blah, channel_player[p]); } --- 1269,1276 ---- { int p; ! for ( p = 0; p < num_network; ++p ) { // server-side lag-test ? ! log_int(blah, channel_network[p]); } *************** *** 1422,1427 **** //(*((int*)NULL)) = 0; pause(); ! if (tw_alert("Game is paused", "&Abort game", "&Resume playing") == 1) { ! game->quit("quit - Game aborted from keyboard"); } unpause(); --- 1468,1475 ---- //(*((int*)NULL)) = 0; pause(); ! if (tw_alert("Game is paused", "&Abort game", "&Resume playing") == 1) ! { ! //game->quit("quit - Game aborted from keyboard"); ! CALL(disconnect); } unpause(); *************** *** 1589,1592 **** --- 1637,1644 ---- strncpy(event[N].name, id, 64); + // check if there's a ( or ) character in there (indicates a mistake in the naming) + if (strchr(id, '(') || strchr(id, ')') ) + tw_error("An event name with ( or ) is probably a typo"); + ++N; *************** *** 1629,1635 **** int p; ! int Ne[max_player]; // the number of events per player. ! for ( p = 0; p < num_humans; ++p ) Ne[p] = 0; --- 1681,1687 ---- int p; ! int Ne[max_network]; // the number of events per computer(-channel) ! for ( p = 0; p < num_network; ++p ) Ne[p] = 0; *************** *** 1638,1647 **** ! for ( p = 0; p < num_humans; ++p ) { // note, you can send+receive on your own channel, cause it's already buffered; the // receive reads from the start, and the send adds to the end of the log buffer. ! channel_current = channel_player[p] + _channel_buffered; log_resetmode(); --- 1690,1699 ---- ! for ( p = 0; p < num_network; ++p ) { // note, you can send+receive on your own channel, cause it's already buffered; the // receive reads from the start, and the send adds to the end of the log buffer. ! channel_current = channel_network[p] + _channel_buffered; log_resetmode(); *************** *** 1682,1688 **** void Game::register_events() { ! EVENT(Game, &Game::chat); ! EVENT(Game, &Game::change_lag); ! EVENT(Game, &Game::test_event1); } --- 1734,1741 ---- void Game::register_events() { ! EVENT(Game, chat); ! EVENT(Game, change_lag); ! EVENT(Game, test_event1); ! EVENT(Game, disconnect); } *************** *** 1759,1762 **** --- 1812,1833 ---- + void Game::item_sum(char *comment) + { + int i, sumpos, sumvel; + + sumpos = 0; + sumvel = 0; + + for ( i = 0; i < num_items; ++i ) + { + SpaceLocation *o = item[i]; + sumpos += o->pos.x + o->pos.y; + sumvel += o->vel.x + o->vel.y; + } + + message.print(1500, 15, "[%s] num[%i] pos[%i] vel[%i]", comment, num_items, sumpos, sumvel); + message.animate(0); + } + void Game::heavy_compare() *************** *** 1765,1768 **** --- 1836,1842 ---- return; + //message.print(1500, 13, "num_items = %i", num_items); + //message.animate(0); + int p; *************** *** 1770,1777 **** int val[max_comp]; ! int N, Nprev = -1; ! for ( p = 0; p < num_humans; ++p ) { ! channel_current = channel_player[p] + _channel_buffered; log_resetmode(); --- 1844,1851 ---- int val[max_comp]; ! int N, Nprev; ! for ( p = 0; p < num_network; ++p ) { ! channel_current = channel_network[p] + _channel_buffered; log_resetmode(); *************** *** 1812,1817 **** // only generate in true-time // otherwise, N may differ from the true number of items in the game. ! test = iround(item[i]->pos.x + item[i]->pos.y + ! item[i]->vel.x + item[i]->vel.y); id = item[i]->debug_id; } --- 1886,1891 ---- // only generate in true-time // otherwise, N may differ from the true number of items in the game. ! test = item[i]->pos.x + item[i]->pos.y + ! item[i]->vel.x + item[i]->vel.y; id = item[i]->debug_id; } *************** *** 1847,1848 **** --- 1921,2012 ---- } + + + // THIS NEEDS WORK, + // cause it desynchronizes or freezes the game !! + void Game::disconnect() + { + // THIS IS (more or less) THE OLD STUFF + // it'll stop all connected games as well... + if (log_synched) + { + game->quit("none"); + tw_alert("Stopped", "&Ok"); + } + // that's because the stuff below isn't good enough yet, it desynches the game + // I need to remove a net connection, but how ? + + + // you are in channel_current, so the channel_current player disconnects... + + if (log_synched) // in receiving mode. + { + // check which players are to be removed + int i; + for ( i = 0; i < num_players; ++i ) + { + if (player[i]->haschannel(channel_current)) + { + remove_player(i); + --i; // repeat player i + } + } + } + } + + + PlayerInformation *Game::new_player() + { + PlayerInformation *p; + p = new PlayerInformation(); + + p->status = true; + p->control = 0; + p->color = 1; + strcpy(p->name, "default"); + p->team = 0; + + return p; + } + + + + void Game::remove_player(int i) + { + // THIS DESYNCHES THE GAME !! + + message.print(1500, 15, "removing player[%i]", i); + message.animate(0); + // if you're the local player, simply quit the game + if (is_local(player[i]->channel)) + { + //game->quit("quit - Game aborted from keyboard"); + // player[i]->control->select_ship(0, "none"); + } + + player[i]->status = 0; // tell the game, that this player is gone ?! + // not really used. + + // player[i]->die(); + message.print(1500, 14, "frame[%i] time[%i]", frame_number, game_time); + + // Disable that players buffered channel ... (but keep the direct channel) + int ch = player[i]->channel + _channel_buffered; + glog->log_dir[ch] = 0; + + // remove the players network-connection from the network... which network conn. + // goes to that player... ? + int k; + k = channel_conn_recv[ player[i]->channel + _channel_buffered ]; + ((NetLog*)glog)->rem_conn(k); + //-- num_network; + //channel_network[k] = channel_network[num_network]; + + // remove the player from the player-list, so that its data won't be used anymore... + -- num_players; + player[i] = player[num_players]; + + } + + + Index: mcontrol.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcontrol.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** mcontrol.cpp 15 Mar 2004 22:20:15 -0000 1.18 --- mcontrol.cpp 17 Mar 2004 22:27:37 -0000 1.19 *************** *** 42,46 **** void animate_target(Frame *frame, SpaceLocation *t, int dx, int dy, int r, int c) { ! STACKTRACE /* double x, y; r = int( r * space_zoom/2); --- 42,46 ---- void animate_target(Frame *frame, SpaceLocation *t, int dx, int dy, int r, int c) { ! STACKTRACE; /* double x, y; r = int( r * space_zoom/2); *************** *** 71,75 **** ! int control2number(const char *name) {STACKTRACE if (!name) return 0; for (int i = 0; i < num_controls+1; i += 1) { --- 71,75 ---- ! int control2number(const char *name) {STACKTRACE; if (!name) return 0; for (int i = 0; i < num_controls+1; i += 1) { *************** *** 79,83 **** } ! Control *getController(const char *type, const char *name, int channel) {STACKTRACE if ((channel != -1) && (channel & _channel_buffered)) { error("getController - invalid channel # %d", channel); --- 79,83 ---- } ! Control *getController(const char *type, const char *name, int channel) {STACKTRACE; if ((channel != -1) && (channel & _channel_buffered)) { error("getController - invalid channel # %d", channel); *************** *** 98,102 **** } void Control::setup() {} ! void Control::select_ship(Ship* ship_pointer, const char* ship_name) {STACKTRACE ship = ship_pointer; if (ship) { --- 98,102 ---- } void Control::setup() {} ! void Control::select_ship(Ship* ship_pointer, const char* ship_name) {STACKTRACE; ship = ship_pointer; if (ship) { *************** *** 114,118 **** return; } ! SpaceLocation *Control::get_focus() {STACKTRACE if (ship) return ship->get_focus(); else return NULL; --- 114,118 ---- return; } ! SpaceLocation *Control::get_focus() {STACKTRACE; if (ship) return ship->get_focus(); else return NULL; *************** *** 198,202 **** } int Control::choose_ship(VideoWindow *window, char * prompt, Fleet *fleet) { ! STACKTRACE; int ret = -1, slot = 0; if (fleet->getSize() == 0) {tw_error ("Empty fleet! (prompt:%s)", prompt);} --- 198,202 ---- } int Control::choose_ship(VideoWindow *window, char * prompt, Fleet *fleet) { ! STACKTRACE;; int ret = -1, slot = 0; if (fleet->getSize() == 0) {tw_error ("Empty fleet! (prompt:%s)", prompt);} *************** *** 227,231 **** } void Control::set_target(int i) { ! STACKTRACE; if (i >= targets->N) {tw_error("oscar hamburger!!!!!!!!!");} if (i == -1) { --- 227,231 ---- } void Control::set_target(int i) { ! STACKTRACE;; if (i >= targets->N) {tw_error("oscar hamburger!!!!!!!!!");} if (i == -1) { *************** *** 239,243 **** return; } ! void Control::target_stuff() {STACKTRACE if (index == -1) { if (targets->N) { --- 239,243 ---- return; } ! void Control::target_stuff() {STACKTRACE; if (index == -1) { if (targets->N) { *************** *** 310,317 **** void Control::gen_buffered_data() { ! if (ship && ship->exists()) keys = think(); ! else ! keys = 0; if (channel != channel_none) --- 310,317 ---- void Control::gen_buffered_data() { ! //if (ship && ship->exists()) // well ... you also need it for watch-mode. keys = think(); ! //else ! // keys = 0; if (channel != channel_none) *************** *** 324,328 **** ! void Control::calculate() {STACKTRACE if (!exists()) return; --- 324,328 ---- ! void Control::calculate() {STACKTRACE; if (!exists()) return; *************** *** 398,408 **** return; } ! int Control::think() {STACKTRACE return 0; } ! char *Control::getDescription() {STACKTRACE return iname; } ! void Control::_event(Event *e) {STACKTRACE //add code for lag increase / decrease here return; --- 398,410 ---- return; } ! int Control::think() ! { ! STACKTRACE; return 0; } ! char *Control::getDescription() {STACKTRACE; return iname; } ! void Control::_event(Event *e) {STACKTRACE; //add code for lag increase / decrease here return; *************** *** 411,415 **** already(0), channel(_channel), ship(NULL), target(NULL), index(-1), always_random(0), keys(0), _prediction_keys(NULL) ! {STACKTRACE id |= ID_CONTROL; attributes |= ATTRIB_SYNCHED; --- 413,417 ---- already(0), channel(_channel), ship(NULL), target(NULL), index(-1), always_random(0), keys(0), _prediction_keys(NULL) ! {STACKTRACE; id |= ID_CONTROL; attributes |= ATTRIB_SYNCHED; *************** *** 424,431 **** iname = strdup(name); } ! Control::~Control() { STACKTRACE if (_prediction_keys) delete[] _prediction_keys; } ! bool Control::die() { if (channel == channel_none) return Presence::die(); // controls CANNOT arbitrarily be killed off, because the deal with networking directly --- 426,437 ---- iname = strdup(name); } ! Control::~Control() { STACKTRACE; if (_prediction_keys) delete[] _prediction_keys; } ! bool Control::die() ! { ! return Presence::die(); ! ! /* if (channel == channel_none) return Presence::die(); // controls CANNOT arbitrarily be killed off, because the deal with networking directly *************** *** 435,438 **** --- 441,445 ---- //because before this function was added, that would have resulted in a desynch return false; + */ } bool Control::valid_target(SpaceObject *t) { *************** *** 447,451 **** return true; } ! void Control::animate(Frame *space) {STACKTRACE if (!ship) return; if (!target || target->isInvisible()) return; --- 454,458 ---- return true; } ! void Control::animate(Frame *space) {STACKTRACE; if (!ship) return; if (!target || target->isInvisible()) return; |
From: Rob <geo...@us...> - 2004-03-17 22:37:09
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28663/newships Modified Files: shpcrore.cpp Log Message: updating some network stuff. Index: shpcrore.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpcrore.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** shpcrore.cpp 15 Mar 2004 22:20:32 -0000 1.3 --- shpcrore.cpp 17 Mar 2004 22:27:37 -0000 1.4 *************** *** 276,279 **** ! //REGISTER_SHIP(Crome) --- 276,279 ---- ! REGISTER_SHIP(Crome) |
From: Rob <geo...@us...> - 2004-03-17 22:37:09
|
Update of /cvsroot/timewarp/source/twgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28663/twgui Modified Files: gametest2.cpp Log Message: updating some network stuff. Index: gametest2.cpp =================================================================== RCS file: /cvsroot/timewarp/source/twgui/gametest2.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gametest2.cpp 12 Mar 2004 20:15:01 -0000 1.8 --- gametest2.cpp 17 Mar 2004 22:27:38 -0000 1.9 *************** *** 1,2 **** --- 1,4 ---- + /* + Geo: I DISABLED THIS CAUSE it's served its use - it can be removed I think. #include <allegro.h> *************** *** 41,73 **** - /* - class ShipPanelToggeable : public ShipPanel - { - protected: - int *toggle; - public: - ShipPanelToggeable(Ship *s, int *t, Game *g); - virtual void animate(Frame *space); - }; - ShipPanelToggeable::ShipPanelToggeable(Ship *s, int *t, Game *g) - : - ShipPanel(s) - { - toggle = t; - - // a bit weird ... now you got a buffer writing to a buffer before it's finally - // written to the screen... I think ;) - this->window->surface = g->view->frame->surface; - } - - void ShipPanelToggeable::animate(Frame *space) - { - if (*toggle) - ShipPanel::animate(space); - } - */ - class WedgeIndicatorToggable : public WedgeIndicator --- 43,48 ---- *************** *** 112,120 **** // create the cache/ directory (if needed ?) ! /*#ifdef LINUX ! mkdir("cache", 0755); ! #else ! mkdir("cache"); ! #endif*/ makedir("cache"); --- 87,91 ---- // create the cache/ directory (if needed ?) ! makedir("cache"); *************** *** 488,500 **** meleemenu->tree_calculate(); ! /* ! if (zoomin->flag.left_mouse_hold) ! { ! // copied this from view_hero : ! //if (key_pressed(key_zoom_in)) n.z /= 1 + 0.002 * frame_time; ! //if (key_pressed(key_zoom_out)) n.z *= 1 + 0.002 * frame_time; ! view->camera.z /= 1 + 0.002 * frame_time; ! } ! */ if (zoomout->flag.left_mouse_hold) --- 459,463 ---- meleemenu->tree_calculate(); ! if (zoomout->flag.left_mouse_hold) *************** *** 526,539 **** - /* - if (abort->flag.left_mouse_press) - { - //meleemenu->focus2other(alertmenu); - // meleemenu->disable(); - // alertmenu->show(); - // alertmenu->focus(); - alert_text->set_text("Quit game?", makecol(50,50,50)); - } - */ option.healthbar = healthbarswitch->state; --- 489,492 ---- *************** *** 582,593 **** void TWgui::animate(Frame *frame) { ! /* ! BITMAP *tmp; ! tmp = create_bitmap_ex(bitmap_color_depth(screen), screen->w, screen->h); ! //clear_to_color(tmp, makecol(50,100,150)); // this takes about 2 ms. ! //blit(tmp, screen, 0, 0, 0, 0, tmp->w, tmp->h); // this takes a long time !! ! memcpy(screen->dat, tmp->dat, tmp->w * tmp->h); ! destroy_bitmap(tmp); ! */ // clear_to_color(screen, makecol(50,100,150)); // this takes 1 to 2 ms. --- 535,539 ---- void TWgui::animate(Frame *frame) { ! // clear_to_color(screen, makecol(50,100,150)); // this takes 1 to 2 ms. *************** *** 864,979 **** - - - /* - - - //char cliptext[128]; - - void TWgui2::init(Log *_log) - { - NormalGame::init(_log); - - view->window->locate( // 1=in pixels, a fixed amount; 2=in screen width - 0, 0, //double x1, double x2 - 0, 0, //double y1, double y2 - 0, 1, //double w1, double w2 - 0, 1 //double h1, double h2 - ); - - // ------- add the menu items --------- - - unscare_mouse(); - show_mouse(window->surface); - - - // which font to use ... that depends on the screen resolution: - int i = 2; - if (screen->w == 640) - i = 2; - if (screen->w == 800) - i = 3; - if (screen->w == 1024) - i = 4; // more pixels available for the same "real-life" size. - - FONT *usefont = videosystem.get_font(i); - - this->view->frame->prepare(); - - - char menu_filename[512]; - set_config_file("client.ini"); - strcpy(menu_filename, get_config_string("Menu", "skin", "none")); - - - meleemenu = new TWindow("interfaces/twgui2/melee", 50, 450, this->view->frame->surface); - - - - - zoomin = new Button(meleemenu, "zoomin_", KEY_EQUALS, 1); - - zoomout = new Button(meleemenu, "zoomout_", KEY_MINUS, 1); - - abort = new Button(meleemenu, "abort_", mapkey(KEY_A, KEY_LCONTROL)); - - - - Test: this can show contents of the clipboard ... - - HWND w; - w = win_get_window(); - - OpenClipboard(w); - - char *txt = (char*) ::GetClipboardData(CF_TEXT); - strncpy(cliptext, txt, 128); - - CloseClipboard(); - - - - - } - - - - - void TWgui2::calculate() - { - - NormalGame::calculate(); - - - - // ------------ INTERPRET RESULTS FROM THE MELEE WINDOW --------------- - - - FULL_REDRAW = true; - // only a full_redraw draws the whole frame-surface onto the physical screen. - // (otherwise only the small sprites are drawn there ... I think) - // I guess this can be a bit slow, but, I don't know why it's slow... perhaps simply - // because it's a big screen, or is it because of conversion between color depths? - // or something else? - - meleemenu->tree_calculate(); - } - - - void TWgui2::animate(Frame *frame) - { - - NormalGame::animate(frame); - - show_mouse(window->surface); - meleemenu->tree_setscreen(view->frame->surface); - meleemenu->tree_animate(); - - //message.out(cliptext); - - } - */ - - REGISTER_GAME(TWgui, "TWgui") --- 810,814 ---- REGISTER_GAME(TWgui, "TWgui") + */ \ No newline at end of file |
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28663/games Modified Files: gflmelee.cpp ggob.cpp gleague.cpp gplanets.cpp gsample.cpp gsarena.cpp gtrug.cpp vanguard.cpp Log Message: updating some network stuff. Index: gflmelee.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gflmelee.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** gflmelee.cpp 12 Mar 2004 20:14:55 -0000 1.22 --- gflmelee.cpp 17 Mar 2004 22:27:36 -0000 1.23 *************** *** 57,61 **** void copy_sprite2bmp(SpaceSprite* src, BITMAP *bmp) { ! STACKTRACE src->lock(); --- 57,61 ---- void copy_sprite2bmp(SpaceSprite* src, BITMAP *bmp) { ! STACKTRACE; [...1248 lines suppressed...] ! STACKTRACE; ///* --- 2067,2082 ---- + void ImIndicator::calculate() + { + Presence::calculate(); + + if ( !(showme && showme->exists()) ) + showme = 0; + } + + void FlMelee::start_menu(int *select) { ! STACKTRACE;; ///* Index: gsample.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gsample.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gsample.cpp 12 Mar 2004 21:57:54 -0000 1.11 --- gsample.cpp 17 Mar 2004 22:27:36 -0000 1.12 *************** *** 138,142 **** The differences from sample game 1: ! 1. 2 players are allowed in network games. 2. Players are permitted to pick their own ships. 3. The ship panels for human players are displayed. --- 138,142 ---- The differences from sample game 1: ! 1. players are allowed in network games. 2. Players are permitted to pick their own ships. 3. The ship panels for human players are displayed. *************** *** 146,185 **** ! class SampleGame2 : public Game { //declaring our game type virtual void init(Log *_log) ; //happens when our game is first started ! }; ! ! void SampleGame2::init(Log *_log) ! { ! Game::init(_log); ! ! size *= 1.2; ! //size is the size of the game map ! //it is a Vector2, so you can say size.x or size.y to refer to its components ! //size should be modified before prepare() is called ! //If for some reason you modify size later, call prepare() again ! //but you probably shouldn't be modifying it later. ! //The normal size is 3840 by 3840 ! //(that's written as Vector2(3840,3840)) ! prepare(); ! ! add(new Stars()); ! ! int i; ! for (i = 0; i < 7; i += 1) add(new Asteroid()); ! //This time, in addition to the asteroids, we'll add a planet ! SpaceObject *planet = new Planet(Vector2(size.x/4,0), meleedata.planetSprite, random(3)); ! //the "random(3)" indicates that it uses one of the 3 normal planet pictures at random ! add(planet); ! //now we add an indicator to point towards the planet ! add(new WedgeIndicator(planet, 150, 4)); ! //the second paremeter is the size of the indicator, the third parameter is a color (as a palette index) ! //alternatively we could use a blinky indicator, like "addPresence(new BlinkyIndicator(planet));" ! TeamCode humans, enemies; ! humans = new_team(); ! enemies = new_team(); // re-use the same fleet for all players. //this is where we deviate from SampleGame1 --- 146,160 ---- ! class SampleGame2 : public Game ! { //declaring our game type ! public: virtual void init(Log *_log) ; //happens when our game is first started ! virtual void init_players(); TeamCode humans, enemies; ! }; + void SampleGame2::init_players() + { // re-use the same fleet for all players. //this is where we deviate from SampleGame1 *************** *** 190,203 **** int p; ! // check all the (human) players. ! int slot[max_player]; ! Control *c[max_player]; ! for ( p = 0; p < num_humans; ++p ) { if (p == p_local) { ! c[p] = create_control(channel_player[p], "Human"); //to load a fleet from disk you say fleet.load(filename, fleetname); (fleetname is usually "Fleet", because that is the standard name used in .scf files) --- 165,181 ---- int p; ! // check all the (human) players, allowing one per connected computer (not checking ! // for hotseat players). ! Control *c; ! int slot[100]; ! for ( p = 0; p < num_network; ++p ) { + player[p] = new_player(); + player[p]->channel = channel_network[p]; if (p == p_local) { ! c = create_control(channel_network[p], "Human"); //to load a fleet from disk you say fleet.load(filename, fleetname); (fleetname is usually "Fleet", because that is the standard name used in .scf files) *************** *** 205,216 **** //BTW, the cost of the fleet is fleet.cost and the size is fleet.size //(if fleet is a pointer, then fleet->cost, fleet->size, and fleet->load instead) ! slot[p] = c[p]->choose_ship(window, "Hey You!\nPick a ship!", &fleet); //note that we said &fleet instead of fleet because choose_ship expects a pointer at a fleet instead of just a fleet } else { ! c[p] = create_control(channel_player[p], "VegetableBot"); ! // controlled by the remote player } //now i is the number of the ship that the user selected from that list // (or if it's a remote player, it's chosen remotely, and isn't know here yet - it --- 183,196 ---- //BTW, the cost of the fleet is fleet.cost and the size is fleet.size //(if fleet is a pointer, then fleet->cost, fleet->size, and fleet->load instead) ! slot[p] = c->choose_ship(window, "Hey You!\nPick a ship!", &fleet); //note that we said &fleet instead of fleet because choose_ship expects a pointer at a fleet instead of just a fleet } else { ! c = create_control(channel_network[p], "VegetableBot"); } + player[p]->control = c; + player[p]->color = p + 1; + //now i is the number of the ship that the user selected from that list // (or if it's a remote player, it's chosen remotely, and isn't know here yet - it *************** *** 218,227 **** share(p, &slot[p]);//log_int(channel_server, i); } // send/receive all choices. share_update(); ! for ( p = 0; p < num_humans; ++p ) { i = slot[p]; --- 198,209 ---- share(p, &slot[p]);//log_int(channel_server, i); } + num_players = num_network; // send/receive all choices. share_update(); ! for ( p = 0; p < num_network; ++p ) { + int i; i = slot[p]; *************** *** 232,239 **** //now we're back to the way we were in SampleGame1 for a little bit ! Ship *s = create_ship(fleet.getShipType(i)->id, c[p], Vector2(size.x/2 + 100, size.y), 0, humans); add(s->get_ship_phaser()); ! add_focus(s, channel_player[p]); //in SampleGame1, we just said "add_focus(s);" to make it a focus for the camera //but here it's different, because we don't want it to be a focus for all computers, only the server computer --- 214,221 ---- //now we're back to the way we were in SampleGame1 for a little bit ! Ship *s = create_ship(fleet.getShipType(i)->id, player[p]->control, Vector2(size.x/2 + 100, size.y), 0, humans); add(s->get_ship_phaser()); ! add_focus(s, player[p]->channel); //in SampleGame1, we just said "add_focus(s);" to make it a focus for the camera //but here it's different, because we don't want it to be a focus for all computers, only the server computer *************** *** 270,273 **** --- 252,291 ---- add(sp); //now we make the panel appear in the game } + } + + void SampleGame2::init(Log *_log) + { + Game::init(_log); + + size *= 1.2; + //size is the size of the game map + //it is a Vector2, so you can say size.x or size.y to refer to its components + //size should be modified before prepare() is called + //If for some reason you modify size later, call prepare() again + //but you probably shouldn't be modifying it later. + //The normal size is 3840 by 3840 + //(that's written as Vector2(3840,3840)) + prepare(); + + add(new Stars()); + + int i; + for (i = 0; i < 7; i += 1) add(new Asteroid()); + //This time, in addition to the asteroids, we'll add a planet + SpaceObject *planet = new Planet(Vector2(size.x/4,0), meleedata.planetSprite, random(3)); + //the "random(3)" indicates that it uses one of the 3 normal planet pictures at random + add(planet); + //now we add an indicator to point towards the planet + add(new WedgeIndicator(planet, 150, 4)); + //the second paremeter is the size of the indicator, the third parameter is a color (as a palette index) + //alternatively we could use a blinky indicator, like "addPresence(new BlinkyIndicator(planet));" + + humans = new_team(); + enemies = new_team(); + + + + init_players(); + /* *************** *** 342,362 **** ! class SampleGame3 : public Game { //declaring our game type virtual void init(Log *_log) ; //happens when our game is first started Control *human_control[2]; virtual void calculate() ; ! TeamCode human_team, enemy_team; //the two teams int respawn_time; //the time left until the game is restarted void pick_new_ships(); //restarts the game Fleet fleet; ! }; ! void SampleGame3::calculate() { Game::calculate(); if (respawn_time == -1) { int i, humans = 0, enemies = 0; for (i = 0; i < gametargets.N; i += 1) { ! if (gametargets.item[i]->get_team() == human_team) humans += 1; ! if (gametargets.item[i]->get_team() == enemy_team) enemies += 1; } //if either team has no targetable items remaining (generally ships), pick new ships --- 360,382 ---- ! class SampleGame3 : public SampleGame2 ! { //declaring our game type virtual void init(Log *_log) ; //happens when our game is first started Control *human_control[2]; virtual void calculate() ; ! //TeamCode human_team, enemy_team; //the two teams int respawn_time; //the time left until the game is restarted void pick_new_ships(); //restarts the game Fleet fleet; ! }; ! void SampleGame3::calculate() ! { Game::calculate(); if (respawn_time == -1) { int i, humans = 0, enemies = 0; for (i = 0; i < gametargets.N; i += 1) { ! if (gametargets.item[i]->get_team() == humans) humans += 1; ! if (gametargets.item[i]->get_team() == enemies) enemies += 1; } //if either team has no targetable items remaining (generally ships), pick new ships *************** *** 365,369 **** else if (respawn_time <= game_time) pick_new_ships(); return; ! } void SampleGame3::pick_new_ships() { --- 385,389 ---- else if (respawn_time <= game_time) pick_new_ships(); return; ! } void SampleGame3::pick_new_ships() { *************** *** 381,385 **** log_int(i, channel_server); if (i == -1) i = random() % reference_fleet->getSize(); ! Ship *s = create_ship(reference_fleet->getShipType(i)->id, human_control[0], size/2 + Vector2(100, 0), 0, human_team); add(s->get_ship_phaser()); //notice that we DON'T call add_focus on the ship here? --- 401,405 ---- log_int(i, channel_server); if (i == -1) i = random() % reference_fleet->getSize(); ! Ship *s = create_ship(reference_fleet->getShipType(i)->id, human_control[0], size/2 + Vector2(100, 0), 0, humans); add(s->get_ship_phaser()); //notice that we DON'T call add_focus on the ship here? *************** *** 399,405 **** log_file("fleets/all.scf"); i = human_control[1]->choose_ship(window, "Hey You!\nPick a ship!", reference_fleet); ! log_int(i, channel_player[1]); if (i == -1) i = random() % reference_fleet->getSize(); ! Ship *s = create_ship(reference_fleet->getShipType(i)->id, human_control[1], size/2 + Vector2(100, 0), 180, human_team); add(s->get_ship_phaser()); ShipPanel *sp = new ShipPanel(s); --- 419,425 ---- log_file("fleets/all.scf"); i = human_control[1]->choose_ship(window, "Hey You!\nPick a ship!", reference_fleet); ! log_int(i, channel_network[1]); if (i == -1) i = random() % reference_fleet->getSize(); ! Ship *s = create_ship(reference_fleet->getShipType(i)->id, human_control[1], size/2 + Vector2(100, 0), 180, humans); add(s->get_ship_phaser()); ShipPanel *sp = new ShipPanel(s); *************** *** 416,426 **** Ship *e; ! e = create_ship(channel_none, "kzedr", "WussieBot", size/4, random(PI2), enemy_team); add(e->get_ship_phaser()); ! e = create_ship(channel_none, "kohma", "WussieBot", Vector2(size.x*3/4, size.y/4), random(PI2), enemy_team); add(e->get_ship_phaser()); ! e = create_ship(channel_none, "druma", "WussieBot", size*3/4, random(PI2), enemy_team); add(e->get_ship_phaser()); ! e = create_ship(channel_none, "yehte", "WussieBot", Vector2(size.x/4, size.y*3/4), random(PI2), enemy_team); add(e->get_ship_phaser()); --- 436,446 ---- Ship *e; ! e = create_ship(channel_none, "kzedr", "WussieBot", size/4, random(PI2), enemies); add(e->get_ship_phaser()); ! e = create_ship(channel_none, "kohma", "WussieBot", Vector2(size.x*3/4, size.y/4), random(PI2), enemies); add(e->get_ship_phaser()); ! e = create_ship(channel_none, "druma", "WussieBot", size*3/4, random(PI2), enemies); add(e->get_ship_phaser()); ! e = create_ship(channel_none, "yehte", "WussieBot", Vector2(size.x/4, size.y*3/4), random(PI2), enemies); add(e->get_ship_phaser()); *************** *** 452,475 **** add(new Stars()); ! human_team = new_team(); ! enemy_team = new_team(); ! human_control[0] = create_control(channel_server, "Human"); ! human_control[0]->target_sign_color = 4; ! //This makes that controller draw a target sign in red ! //the number is a pallete index ! //to hide the target sign again, set target_sign_color to -1 ! add_focus(human_control[0], channel_server); ! //Here we make the keyboard controller a screen focus ! //this means that the camera will track whatever ship is controlled by this controller ! //so that we don't have to call add_focus again every time the controller gets a new ship ! //BTW, if you have multiple focuses, the camera will track one of them, and the player can switch which one by pressing F3 ! ! if ((glog->type == Log::log_net1server) || (glog->type == Log::log_net1client)) { ! human_control[1] = create_control(channel_player[1], "Human"); ! human_control[1]->target_sign_color = 2; ! add_focus(human_control[1], channel_player[1]); ! } ! else human_control[1] = NULL; respawn_time = 500; --- 472,479 ---- add(new Stars()); ! humans = new_team(); ! enemies = new_team(); ! init_players(); respawn_time = 500; Index: ggob.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** ggob.cpp 15 Mar 2004 22:20:15 -0000 1.33 --- ggob.cpp 17 Mar 2004 22:27:36 -0000 1.34 *************** *** 332,339 **** int p; int k = 0; ! for ( p = 0; p < num_humans; ++p ) { ! //log_int(channel_player[p], server_players); ! log_int(console_players, channel_player[p]); // several console players, who share a "human" channel --- 332,339 ---- int p; int k = 0; ! for ( p = 0; p < num_network; ++p ) { ! //log_int(channel_network[p], server_players); ! log_int(console_players, channel_network[p]); // several console players, who share a "human" channel *************** *** 344,348 **** sprintf(buffy, "Config%d", i); ! add_gobplayer(create_control(channel_player[p], "Human", buffy)); ++k; } --- 344,348 ---- sprintf(buffy, "Config%d", i); ! add_gobplayer(create_control(channel_network[p], "Human", buffy)); ++k; } Index: gtrug.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gtrug.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gtrug.cpp 12 Mar 2004 20:14:56 -0000 1.11 --- gtrug.cpp 17 Mar 2004 22:27:36 -0000 1.12 *************** *** 35,39 **** } ! int TrugControl::think() { int k = ControlWussie::think(); switch (order.type) { --- 35,43 ---- } ! int TrugControl::think() ! { ! if (!ship) ! return 0; ! int k = ControlWussie::think(); switch (order.type) { *************** *** 223,227 **** TrugPlayer *sp = add_player ( channel_server ); ! TrugPlayer *cp = add_player ( channel_player[1] ); add(create_ship("kzedr", sp, random(size), random(PI2))); --- 227,231 ---- TrugPlayer *sp = add_player ( channel_server ); ! TrugPlayer *cp = add_player ( channel_network[1] ); add(create_ship("kzedr", sp, random(size), random(PI2))); Index: gsarena.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gsarena.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gsarena.cpp 12 Mar 2004 20:14:56 -0000 1.11 --- gsarena.cpp 17 Mar 2004 22:27:36 -0000 1.12 *************** *** 5,8 **** --- 5,9 ---- REGISTER_FILE //done immediately after #including melee.h, just because I said so #include "../melee/mgame.h" //Game stuff + #include "../melee/mmain.h" //Game stuff #include "../melee/mcbodies.h" //asteroids & planets #include "../melee/mship.h" //ships *************** *** 16,28 **** #include "../scp.h" ! class SuperArena : public Game { //declaring our game type virtual void init(Log *_log) ; //happens when our game is first started ! ShipPanel *human_panel[2]; //we need to keep track of the ship panels, in case we have to move them around because the player changes screen resolutions ! Control *human_control[2]; virtual void calculate() ; //to do the screen layouts, we need to know if those panels still exist, so we need to check every frame for them going away //calculate is good for things that need to be done every frame ! TeamCode team[9]; //the teams (array) TeamCode station_team; int respawn_time; //the time left until the game is restarted --- 17,29 ---- #include "../scp.h" ! class SuperArena : public NormalGame { //declaring our game type virtual void init(Log *_log) ; //happens when our game is first started ! // ShipPanel *human_panel[2]; //we need to keep track of the ship panels, in case we have to move them around because the player changes screen resolutions ! // Control *human_control[2]; virtual void calculate() ; //to do the screen layouts, we need to know if those panels still exist, so we need to check every frame for them going away //calculate is good for things that need to be done every frame ! // TeamCode team[9]; //the teams (array) TeamCode station_team; int respawn_time; //the time left until the game is restarted *************** *** 39,63 **** void SuperArena::calculate() { ! STACKTRACE Game::calculate(); ! if (human_panel[0] && !human_panel[0]->exists()) human_panel[0] = NULL; ! if (human_panel[1] && !human_panel[1]->exists()) human_panel[1] = NULL; ! if (respawn_time == -1) { // int i, humans = 0, enemies = 0; ! int i, t1=0, t2=0, t3=0, t4=0, t5=0, t6=0, t7=0, t8=0; for (i = 0; i < gametargets.N; i += 1) { SpaceObject *o = gametargets.item[i]; ! if (o->get_team() == team[1]) t1 += 1; ! if (o->get_team() == team[2]) t2 += 1; ! if (o->get_team() == team[3]) t3 += 1; ! if (o->get_team() == team[4]) t4 += 1; ! if (o->get_team() == team[5]) t5 += 1; ! if (o->get_team() == team[6]) t6 += 1; ! if (o->get_team() == team[7]) t7 += 1; ! if (o->get_team() == team[8]) t8 += 1; } //if either team has no targetable items remaining (generally ships), pick new ships // if (humans = 0) respawn_time = game_time + 5000; //5000 milliseconds is 10 seconds --- 40,70 ---- void SuperArena::calculate() { ! STACKTRACE; Game::calculate(); ! // if (human_panel[0] && !human_panel[0]->exists()) human_panel[0] = NULL; ! // if (human_panel[1] && !human_panel[1]->exists()) human_panel[1] = NULL; ! ! if (respawn_time == -1) ! { // int i, humans = 0, enemies = 0; ! int i, t[100]; ! int n; ! for ( n = 0; n < num_players; ++n ) ! t[n] = 0; ! for (i = 0; i < gametargets.N; i += 1) { + SpaceObject *o = gametargets.item[i]; ! for ( n = 0; n < num_players; ++n ) ! { ! // don't count your starbase... ! if (o != s[n] && o->get_team() == player[n]->team) ! t[n] += 1; ! } } + //if either team has no targetable items remaining (generally ships), pick new ships // if (humans = 0) respawn_time = game_time + 5000; //5000 milliseconds is 10 seconds *************** *** 65,85 **** // iMessage("Team1 have %d ships",t1); // iMessage("Team2 have %d ships",t2); ! if ((t2==0) && (t3==0) && (t4==0) && (t5==0) && (t6==0) && (t7==0) && (t8==0)) respawn_time = game_time + 5000; ! if ((t1==0) && (t3==0) && (t4==0) && (t5==0) && (t6==0) && (t7==0) && (t8==0)) respawn_time = game_time + 5000; ! if ((t1==0) && (t2==0) && (t4==0) && (t5==0) && (t6==0) && (t7==0) && (t8==0)) respawn_time = game_time + 5000; ! if ((t1==0) && (t2==0) && (t3==0) && (t5==0) && (t6==0) && (t7==0) && (t8==0)) respawn_time = game_time + 5000; ! if ((t1==0) && (t2==0) && (t3==0) && (t4==0) && (t6==0) && (t7==0) && (t8==0)) respawn_time = game_time + 5000; ! if ((t1==0) && (t2==0) && (t3==0) && (t4==0) && (t5==0) && (t7==0) && (t8==0)) respawn_time = game_time + 5000; ! if ((t1==0) && (t2==0) && (t3==0) && (t4==0) && (t5==0) && (t6==0) && (t8==0)) respawn_time = game_time + 5000; ! if ((t1==0) && (t2==0) && (t3==0) && (t4==0) && (t5==0) && (t6==0) && (t7==0)) respawn_time = game_time + 5000; ! if ((t1==0) && (t2==0) && (t3==0) && (t4==0) && (t5==0) && (t6==0) && (t7==0) && (t8==0)) respawn_time = game_time + 5000; if ((started == 1) && (KTS == 1)) { ! for (int num=1; num<=num_teams; num+=1) { ! if ( (died[num]!=1) && (!s[num]->exists()) ) { message.print( 4000, 4000, "Team %d starbase was destroyed", num+1 ); //("Player's 1 Starbase was destroyed", 3000); ! for (i = 0; i < gametargets.N; i += 1) { ! if (gametargets.item[i]->get_team() == team[num]) { gametargets.item[i]->handle_damage(NULL, 0, 999); //target[i]->handle_damage(target[i]); --- 72,96 ---- // iMessage("Team1 have %d ships",t1); // iMessage("Team2 have %d ships",t2); ! int nalive = 0; ! for ( n = 0; n < num_players; ++n ) ! { ! if (t[n] > 0) ! ++nalive; ! } + if (nalive <= 1) + respawn_time = game_time + 5000; if ((started == 1) && (KTS == 1)) { ! for (int num=1; num < num_players; num+=1) { ! ! // CRASH s is invalid ! if ( (died[num]!=1) && (!s[num]->exists()) ) ! { ! message.print( 4000, 4000, "Team %d starbase was destroyed", num+1 ); //("Player's 1 Starbase was destroyed", 3000); ! for (i = 0; i < gametargets.N; i += 1) ! { ! if (gametargets.item[i]->get_team() == player[num]->team) { gametargets.item[i]->handle_damage(NULL, 0, 999); //target[i]->handle_damage(target[i]); *************** *** 96,115 **** } ! void SuperArena::pick_new_ships() { ! STACKTRACE int i,t,p[9],j; - log_file("sarena.ini"); num_teams = t = get_config_int(NULL, "Teams", 2); ! p[1] = get_config_int(NULL, "Team1", 2); ! p[2] = get_config_int(NULL, "Team2", 2); ! p[3] = get_config_int(NULL, "Team3", 2); ! p[4] = get_config_int(NULL, "Team4", 2); ! p[5] = get_config_int(NULL, "Team5", 2); ! p[6] = get_config_int(NULL, "Team6", 2); ! p[7] = get_config_int(NULL, "Team7", 2); ! p[8] = get_config_int(NULL, "Team8", 2); // is KTS on? KTS = get_config_int(NULL, "KTS", 0); --- 107,128 ---- } ! void SuperArena::pick_new_ships() ! { ! STACKTRACE; + /* int i,t,p[9],j; num_teams = t = get_config_int(NULL, "Teams", 2); ! int n; ! for ( n = 0; n < num_teams; ++n ) ! { ! char name[512]; ! sprintf(name, "Team%i", n); ! p[n] = get_config_int(NULL, name, 2); ! } ! */ // is KTS on? + log_file("sarena.ini"); KTS = get_config_int(NULL, "KTS", 0); *************** *** 117,370 **** clear_to_color(screen, pallete_color[4]); release_screen(); ! for (i = 0; i < num_items; i += 1) { if (item[i]->exists()) item[i]->die(); - } - if (human_panel[0]) human_panel[0]->window->hide(); - if (human_panel[1]) human_panel[1]->window->hide(); - - - Fleet _fleet; - Fleet *fleet = &_fleet; - - //player 1 selects a new ship - log_file("fleets.ini"); - fleet->load(NULL, "Player1"); - if (fleet->getSize()>0) { - i = human_control[0]->choose_ship(window, "player 1 \nship 1", fleet); - log_int(i, channel_server); - if (i == -1) i = random() % fleet->getSize(); - Ship *s = create_ship(fleet->getShipType(i)->id, human_control[0], Vector2(map_size.x/4 , map_size.y*3.0/4), 0, team[1]); - add(s->get_ship_phaser()); - human_panel[0] = new ShipPanel(s); - human_panel[0]->window->init(window); - human_panel[0]->window->locate(0,0.9, 0,0, 0,0.1, 0,.25); - - add(human_panel[0]); - add_focus(s, channel_server); } ! if ((glog->type == Log::log_net1server) || (glog->type == Log::log_net1client)) { ! fleet->load("fleets.ini", "Player2"); ! log_fleet(channel_player[1], fleet); ! if (fleet->getSize()>0) { ! i = human_control[1]->choose_ship(window, "player 2 \nship 1", fleet); ! log_int(i, channel_player[1]); ! if (i == -1) i = random() % fleet->getSize(); ! Ship *s = create_ship(fleet->getShipType(i)->id, human_control[1], Vector2(size.x/4 , size.y/4), PI, team[2]); ! add(s->get_ship_phaser()); ! add_focus(s, channel_player[1]); ! human_panel[1] = new ShipPanel(s); ! human_panel[0]->window->init(window); ! human_panel[0]->window->locate(0,0.9, 0,0.25, 0,0.1, 0,.25); ! add(human_panel[1]); ! } ! } ! else human_panel[1] = NULL; ! Ship *e; Planet *Pl; OrbitHandler *handler; ! char buf[256]; ! ! for ( j = 1; j < p[1]; j += 1) { ! log_file("fleets.ini"); ! fleet->load(NULL, "Player1"); ! if (fleet->getSize()>0) { ! sprintf( buf, "Player 1 \nShip %d", j+1 ); ! i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(i, channel_server); ! if (i == -1) i = random() % fleet->getSize(); ! e = create_ship(channel_none, fleet->getShipType(i)->id, "WussieBot", Vector2(size.x/4, size.y*3/4), random(PI2), team[1]); ! add(e->get_ship_phaser()); ! } ! } ! if (KTS==1) { ! Pl = new Planet(Vector2(size.x/4+500, size.y*3/4+500), meleedata.planetSprite, random()%meleedata.planetSprite->frames()); ! add(Pl); ! s[1] = create_ship(channel_none, "staba", "WussieBot", Vector2(size.x/4, size.y*3/4), 1, team[1]); ! add ( new BlinkyIndicator(s[1], 2) ); ! handler = new OrbitHandler(Pl,Vector2(size.x/2,size.y/2),random(PI2), (SpaceLocation *)Pl, ! (SpaceLocation *)s[1], 400, 10.0*ANGLE_RATIO,0); ! add(s[1]); ! game->add(handler); ! } ! ! if (t>1) { ! for ( j = 0; j < p[2]; j += 1) { ! log_file("fleets.ini"); ! fleet->load(NULL, "Player2"); ! if (fleet->getSize()>0) { ! sprintf( buf, "Player 2 \nShip %d", j+1 ); ! i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(i, channel_server); ! if (i == -1) i = random() % fleet->getSize(); ! e = create_ship(channel_none, fleet->getShipType(i)->id, "WussieBot", Vector2(size.x/4, size.y/4), random(PI2), team[2]); ! add(e->get_ship_phaser()); ! } ! } ! if (KTS==1) { ! Pl = new Planet(Vector2(size.x/4+500, size.y/4+500), meleedata.planetSprite, random()%meleedata.planetSprite->frames()); ! add(Pl); ! s[2] = create_ship(channel_none, "staba", "WussieBot", Vector2(size.x/4, size.y*3/4), 1, team[2]); ! add ( new BlinkyIndicator(s[2], 4) ); ! handler = new OrbitHandler(Pl,Vector2(size.x/2,size.y/2),random(PI2), (SpaceLocation *)Pl, ! (SpaceLocation *)s[2], 400, 10.0*ANGLE_RATIO,0); ! add(s[2]); ! game->add(handler); ! } ! } ! ! ! if (t>2) { ! for ( j = 0; j < p[3]; j += 1) { ! log_file("fleets.ini"); ! fleet->load(NULL, "Player3"); ! if (fleet->getSize()>0) { ! sprintf( buf, "Player 3 \nShip %d", j+1 ); ! i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(i, channel_server); ! if (i == -1) i = random() % fleet->getSize(); ! e = create_ship(channel_none, fleet->getShipType(i)->id, "WussieBot", Vector2(size.x*3/4, size.y/4), random(PI2), team[3]); ! add(e->get_ship_phaser()); ! } ! } ! if (KTS==1) { ! Pl = new Planet(Vector2(size.x*3/4+500, size.y/4+500), meleedata.planetSprite, random()%meleedata.planetSprite->frames()); ! add(Pl); ! s[3] = create_ship(channel_none, "staba", "WussieBot", Vector2(size.x/4, size.y*3/4), 1, team[3]); ! add ( new BlinkyIndicator(s[3], 4) ); ! handler = new OrbitHandler(Pl,Vector2(size.x/2,size.y/2),random(PI2), (SpaceLocation *)Pl, ! (SpaceLocation *)s[3], 400, 10.0*ANGLE_RATIO,0); ! add(s[3]); ! game->add(handler); ! } ! } ! ! if (t>3) { ! for ( j = 0; j < p[4]; j += 1) { ! log_file("fleets.ini"); ! fleet->load(NULL, "Player4"); ! if (fleet->getSize()>0) { ! sprintf( buf, "Player 4 \nShip %d", j+1 ); ! i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(i, channel_server); ! if (i == -1) i = random() % fleet->getSize(); ! e = create_ship(channel_none, fleet->getShipType(i)->id, "WussieBot", Vector2(size.x*3/4, size.y*3/4), random(PI2), team[4]); ! add(e->get_ship_phaser()); ! } ! } ! if (KTS==1) { ! Pl = new Planet(Vector2(size.x*3/4+500, size.y*3/4+500), meleedata.planetSprite, random()%meleedata.planetSprite->frames()); ! add(Pl); ! s[4] = create_ship(channel_none, "staba", "WussieBot", Vector2(size.x/4, size.y*3/4), 1, team[4]); ! add ( new BlinkyIndicator(s[4], 4) ); ! handler = new OrbitHandler(Pl,Vector2(size.x/2,size.y/2),random(PI2), (SpaceLocation *)Pl, ! (SpaceLocation *)s[4], 400, 10.0*ANGLE_RATIO,0); ! add(s[4]); ! game->add(handler); ! } ! } ! ! if (t>4) { ! for ( j = 0; j < p[5]; j += 1) { ! log_file("fleets.ini"); ! fleet->load(NULL, "Player5"); ! if (fleet->getSize()>0) { ! sprintf( buf, "Player 5 \nShip %d", j+1 ); ! i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(i, channel_server); ! if (i == -1) i = random() % fleet->getSize(); ! e = create_ship(channel_none, fleet->getShipType(i)->id, "WussieBot", Vector2(size.x/2, size.y*3/4), random(PI2), team[5]); ! add(e->get_ship_phaser()); ! } ! } ! if (KTS==1) { ! Pl = new Planet(Vector2(size.x/2+500, size.y*3/4+500), meleedata.planetSprite, random()%meleedata.planetSprite->frames()); add(Pl); ! s[5] = create_ship(channel_none, "staba", "WussieBot", Vector2(size.x/4, size.y*3/4), 1, team[5]); ! add ( new BlinkyIndicator(s[5], 4) ); handler = new OrbitHandler(Pl,Vector2(size.x/2,size.y/2),random(PI2), (SpaceLocation *)Pl, ! (SpaceLocation *)s[5], 400, 10.0*ANGLE_RATIO,0); ! add(s[5]); game->add(handler); } - } ! if (t>5) { ! for ( j = 0; j < p[6]; j += 1) { ! log_file("fleets.ini"); ! fleet->load(NULL, "Player6"); ! if (fleet->getSize()>0) { ! sprintf( buf, "Player 6 \nShip %d", j+1 ); ! i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(i, channel_server); ! if (i == -1) i = random() % fleet->getSize(); ! e = create_ship(channel_none, fleet->getShipType(i)->id, "WussieBot", Vector2(size.x/4, size.y/2), random(PI2), team[6]); ! add(e->get_ship_phaser()); ! } ! } ! if (KTS==1) { ! Pl = new Planet(Vector2(size.x/4+500, size.y/2+500), meleedata.planetSprite, random()%meleedata.planetSprite->frames()); ! add(Pl); ! s[6] = create_ship(channel_none, "staba", "WussieBot", Vector2(size.x/4, size.y*3/4), 1, team[6]); ! add ( new BlinkyIndicator(s[6], 4) ); ! handler = new OrbitHandler(Pl,Vector2(size.x/2,size.y/2),random(PI2), (SpaceLocation *)Pl, ! (SpaceLocation *)s[6], 400, 10.0*ANGLE_RATIO,0); ! add(s[6]); ! game->add(handler); ! } } - if (t>6) { - for ( j = 0; j < p[7]; j += 1) { - log_file("fleets.ini"); - fleet->load(NULL, "Player7"); - if (fleet->getSize()>0) { - sprintf( buf, "Player 7 \nShip %d", j+1 ); - i = human_control[0]->choose_ship(window, buf, fleet); - log_int(i, channel_server); - if (i == -1) i = random() % fleet->getSize(); - e = create_ship(channel_none, fleet->getShipType(i)->id, "WussieBot", Vector2(size.x/2, size.y/4), random(PI2), team[7]); - add(e->get_ship_phaser()); - } - } - if (KTS==1) { - Pl = new Planet(Vector2(size.x/2+500, size.y/4+500), meleedata.planetSprite, random()%meleedata.planetSprite->frames()); - add(Pl); - s[7] = create_ship(channel_none, "staba", "WussieBot", Vector2(size.x/4, size.y*3/4), 1, team[7]); - add ( new BlinkyIndicator(s[7], 4) ); - handler = new OrbitHandler(Pl,Vector2(size.x/2,size.y/2),random(PI2), (SpaceLocation *)Pl, - (SpaceLocation *)s[7], 400, 10.0*ANGLE_RATIO,0); - add(s[7]); - game->add(handler); - } - } - if (t>7) { - for ( j = 0; j < p[8]; j += 1) { - log_file("fleets.ini"); - fleet->load(NULL, "Player8"); - if (fleet->getSize()>0) { - sprintf( buf, "Player 8 \nShip %d", j+1 ); - i = human_control[0]->choose_ship(window, buf, fleet); - log_int(i, channel_server); - if (i == -1) i = random() % fleet->getSize(); - e = create_ship(channel_none, fleet->getShipType(i)->id, "WussieBot", Vector2(size.x*3/4, size.y/2), random(PI2), team[8]); - add(e->get_ship_phaser()); - } - } - if (KTS==1) { - Pl = new Planet(Vector2(size.x*3/4+500, size.y/2+500), meleedata.planetSprite, random()%meleedata.planetSprite->frames()); - add(Pl); - s[8] = create_ship(channel_none, "staba", "WussieBot", Vector2(size.x/4, size.y*3/4), 1, team[8]); - add ( new BlinkyIndicator(s[8], 4) ); - handler = new OrbitHandler(Pl,Vector2(size.x/2,size.y/2),random(PI2), (SpaceLocation *)Pl, - (SpaceLocation *)s[8], 400, 10.0*ANGLE_RATIO,0); - add(s[8]); - game->add(handler); - } - } // planets & stations code --- 130,169 ---- clear_to_color(screen, pallete_color[4]); release_screen(); ! int i; ! for (i = 0; i < num_items; i += 1) ! { if (item[i]->exists()) item[i]->die(); } ! // if (human_panel[0]) human_panel[0]->window->hide(); ! // if (human_panel[1]) human_panel[1]->window->hide(); + NormalGame::choose_new_ships(); ! ! // Ship *e; Planet *Pl; OrbitHandler *handler; ! // char buf[256]; ! if (KTS==1) ! { ! int i; ! for ( i = 0; i < num_players; ++i ) ! { ! Pl = new Planet(random(size), meleedata.planetSprite, random()%meleedata.planetSprite->frames()); add(Pl); ! s[i] = create_ship(channel_none, "staba", "WussieBot", random(size), 1, player[i]->team); ! add ( new BlinkyIndicator(s[i], player[i]->color) ); handler = new OrbitHandler(Pl,Vector2(size.x/2,size.y/2),random(PI2), (SpaceLocation *)Pl, ! (SpaceLocation *)s[i], 400, 10.0*ANGLE_RATIO,0); ! add(s[i]); game->add(handler); } ! died[i] = 0; } // planets & stations code *************** *** 427,435 **** ! void SuperArena::init(Log *_log) { ! STACKTRACE ! Game::init(_log); ! int j,i; log_file("sarena.ini"); j = get_config_int(NULL, "Size", 3840); --- 226,263 ---- ! void SuperArena::init(Log *_log) ! { ! STACKTRACE; ! // there should be exactly <num_teams> players/bots ! log_file("sarena.ini"); ! num_teams = get_config_int(NULL, "Teams", 2); ! ! if (num_players < num_teams) ! { ! num_bots += (num_teams - num_players); ! } ! ! if (num_players > num_teams) ! num_bots = 0; ! ! num_players = num_teams; // this may mean, people can be ignored this way?? ! ! ! ! NormalGame::init(_log); ! ! // override normal player settings... ! int i, j; ! int n; ! for ( n = 0; n < num_players; ++n ) ! { ! char name[512]; ! sprintf(name, "Team%i", n); ! player[n]->team = new_team();// get_config_int(NULL, name, 2); ! } ! station_team = new_team(); ! ! // int j,i; log_file("sarena.ini"); j = get_config_int(NULL, "Size", 3840); *************** *** 443,463 **** //The normal size is 3840x3840 prepare(); ! ! log_file("sarena.ini"); ! i = get_config_int(NULL, "Teams", 2); add(new Stars()); ! for (j = 1; j < i+1; j += 1) { ! team[j] = new_team(); ! iMessage("Team%d created",j); ! } ! station_team = new_team(); ! human_control[0] = create_control(channel_server, "Human"); ! if ((glog->type == Log::log_net1server) || (glog->type == Log::log_net1client)) { ! human_control[1] = create_control(channel_player[1], "Human"); ! } else human_control[1] = NULL; ! // asteroids code log_file("sarena.ini"); --- 271,287 ---- //The normal size is 3840x3840 prepare(); ! ! //log_file("sarena.ini"); add(new Stars()); ! ! /* human_control[0] = create_control(channel_server, "Human"); ! if ((glog->type == Log::log_net1server) || (glog->type == Log::log_net1client)) { ! human_control[1] = create_control(channel_network[1], "Human"); ! } else human_control[1] = NULL; ! */ ! // asteroids code log_file("sarena.ini"); *************** *** 465,483 **** if (j > 0) for (i = 1; i < j; i += 1) add(new Asteroid()); else { ! j = get_config_int(NULL, "Size", 2); ! for (i = 0; i < j/900; i += 1) add(new Asteroid()); } ! human_panel[0] = NULL; ! human_panel[1] = NULL; ! change_view("Hero"); //sets it to Hero view mode view_locked = false; //prevents the view mode from being changed through the menu ! respawn_time = 500; ! message.out("Welcome to Teams Arena!", 3000, 15); ! } REGISTER_GAME(SuperArena, "Super Arena (.INI)") --- 289,307 ---- if (j > 0) for (i = 1; i < j; i += 1) add(new Asteroid()); else { ! j = get_config_int(NULL, "Size", 2); ! for (i = 0; i < j/900; i += 1) add(new Asteroid()); } ! // human_panel[0] = NULL; ! // human_panel[1] = NULL; ! change_view("Hero"); //sets it to Hero view mode view_locked = false; //prevents the view mode from being changed through the menu ! respawn_time = 500; ! message.out("Welcome to Teams Arena!", 3000, 15); ! } REGISTER_GAME(SuperArena, "Super Arena (.INI)") Index: gleague.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gleague.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gleague.cpp 29 Jan 2004 21:20:28 -0000 1.9 --- gleague.cpp 17 Mar 2004 22:27:36 -0000 1.10 *************** *** 93,97 **** public: ! int score[2]; virtual void calculate(); virtual void init(Log *_log); --- 93,97 ---- public: ! int score[100]; virtual void calculate(); virtual void init(Log *_log); *************** *** 103,107 **** void LeagueGame::init_objects() { ! STACKTRACE add( new Stars() ); --- 103,107 ---- void LeagueGame::init_objects() { ! STACKTRACE; add( new Stars() ); *************** *** 139,145 **** void LeagueGame::init( Log *_log ){ ! STACKTRACE - score[0] = score[1] = 0; // changed GEO. The data-file of this game is outdated. It works with // the default melee data file. --- 139,144 ---- void LeagueGame::init( Log *_log ){ ! STACKTRACE; // changed GEO. The data-file of this game is outdated. It works with // the default melee data file. *************** *** 149,153 **** NormalGame::init( _log ); turbo *= 1.414; ! player_team[2] = player_team[0]; } --- 148,161 ---- NormalGame::init( _log ); turbo *= 1.414; ! ! int i; ! int team = player[0]->team; ! for ( i = 0; i < num_players; ++i ) ! { ! player[i]->team = team; ! } ! ! score[0] = 0; ! score[1] = 0; } *************** *** 163,172 **** } void LeagueGame::calculate(){ NormalGame::calculate(); } void LeagueGame::animate( Frame* frame ){ ! STACKTRACE NormalGame::animate( frame ); --- 171,199 ---- } + + static void bound(double xmin, double *x, double xmax) + { + if (*x < xmin) *x = xmin; + if (*x > xmax) *x = xmax; + } + void LeagueGame::calculate(){ NormalGame::calculate(); + + // check if all objects are within the borders + int i; + for ( i = 0; i < num_items; ++i ) + { + SpaceLocation *o = item[i]; + if (!o->detectable()) continue; + + o->pos = o->normal_pos(); + bound(LEAGUE_BORDER, &(o->pos.x), map_size.x/2 - LEAGUE_BORDER); + bound(LEAGUE_BORDER, &(o->pos.y), map_size.y/2 - LEAGUE_BORDER); + } } void LeagueGame::animate( Frame* frame ){ ! STACKTRACE; NormalGame::animate( frame ); *************** *** 190,197 **** mass = LEAGUE_BALL_MASS; id = ID_BALL; } void Ball::inflict_damage( SpaceObject* other ){ ! STACKTRACE if( !other->isShip() || apamuti ) return; --- 217,225 ---- mass = LEAGUE_BALL_MASS; id = ID_BALL; + layer = LAYER_SHIPS; } void Ball::inflict_damage( SpaceObject* other ){ ! STACKTRACE; if( !other->isShip() || apamuti ) return; *************** *** 206,210 **** void Ball::calculate(){ ! STACKTRACE if( apamuti ){ --- 234,238 ---- void Ball::calculate(){ ! STACKTRACE; if( apamuti ){ *************** *** 240,244 **** disassembling = false; assembling = true; ! pos = map_size / 2; } } --- 268,272 ---- disassembling = false; assembling = true; ! pos = map_size / 4; // the width/height of the game-area is half the map-size } } *************** *** 270,277 **** accelerate( this, alpha, -v * LEAGUE_BALL_SLOWDOWN * frame_time, v ); } } void Ball::kick(){ ! STACKTRACE if( latched ){ --- 298,308 ---- accelerate( this, alpha, -v * LEAGUE_BALL_SLOWDOWN * frame_time, v ); } + + + } void Ball::kick(){ ! STACKTRACE; if( latched ){ *************** *** 285,289 **** void Ball::reassemble(){ ! STACKTRACE if( latched ){ --- 316,320 ---- void Ball::reassemble(){ ! STACKTRACE; if( latched ){ *************** *** 315,319 **** void GoalLine::calculate(){ ! STACKTRACE length += _length * frame_time * LEAGUE_GOAL_LINE_REGEN; --- 346,350 ---- void GoalLine::calculate(){ ! STACKTRACE; length += _length * frame_time * LEAGUE_GOAL_LINE_REGEN; *************** *** 328,332 **** void GoalLine::inflict_damage( SpaceObject* other ){ ! STACKTRACE Laser::inflict_damage( other ); --- 359,363 ---- void GoalLine::inflict_damage( SpaceObject* other ){ ! STACKTRACE; Laser::inflict_damage( other ); *************** *** 374,378 **** void DisableFire::calculate(){ ! STACKTRACE if( !ship ){ --- 405,409 ---- void DisableFire::calculate(){ ! STACKTRACE; if( !ship ){ *************** *** 392,396 **** void Boundary::collide( SpaceObject* other ){ ! STACKTRACE --- 423,427 ---- void Boundary::collide( SpaceObject* other ){ ! STACKTRACE; Index: vanguard.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/vanguard.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** vanguard.cpp 12 Mar 2004 20:14:56 -0000 1.13 --- vanguard.cpp 17 Mar 2004 22:27:36 -0000 1.14 *************** *** 5,8 **** --- 5,9 ---- REGISTER_FILE //done immediately after #including melee.h, just because I said so #include "../melee/mgame.h" //Game stuff + #include "../melee/mmain.h" //Game stuff #include "../melee/mcbodies.h" //asteroids & planets #include "../melee/mship.h" //ships *************** *** 108,112 **** void HyperJammer::calculate() { ! STACKTRACE if(Target==NULL) return; --- 109,113 ---- void HyperJammer::calculate() { ! STACKTRACE; if(Target==NULL) return; *************** *** 170,174 **** void VanRadar::addTeam(TeamCode team, int color) { ! STACKTRACE if(Coded_Teams<(MAX_TEAMS-1)) --- 171,175 ---- void VanRadar::addTeam(TeamCode team, int color) { ! STACKTRACE; if(Coded_Teams<(MAX_TEAMS-1)) *************** *** 189,193 **** void VanRadar::Paint(BITMAP *Slate, double Tx, double Ty) { ! STACKTRACE for(int num=0; num<physics->num_items; num++) --- 190,194 ---- void VanRadar::Paint(BITMAP *Slate, double Tx, double Ty) { ! STACKTRACE; for(int num=0; num<physics->num_items; num++) *************** *** 257,261 **** /********************************Game code!*****************************************************/ ! class Vanguard : public Game { //declaring our game type public: BITMAP *blankRadar; //Image of the blank RADAR screen --- 258,262 ---- /********************************Game code!*****************************************************/ ! class Vanguard : public NormalGame { //declaring our game type public: BITMAP *blankRadar; //Image of the blank RADAR screen *************** *** 263,267 **** double RadarZoom; //Size of the area seen by VanRadar ! HyperJammer *jammer; SpaceSprite *PlanetPics[Num_Planet_Pics]; //Sprites for Solar System Melee --- 264,268 ---- double RadarZoom; //Size of the area seen by VanRadar ! HyperJammer *jammer[100]; SpaceSprite *PlanetPics[Num_Planet_Pics]; //Sprites for Solar System Melee *************** *** 272,281 **** BITMAP *background; //Titlescreen picture ! ShipPanel *human_panel[2]; //we need to keep track of the ship panels, in case //we have to move them around because the player //changes screen resolutions ! Control *human_control[2]; TeamCode human_team, enemy_team; //the two teams ! Ship *HumanPlayer1, *HumanPlayer2; --- 273,282 ---- BITMAP *background; //Titlescreen picture ! // ShipPanel *human_panel[2]; //we need to keep track of the ship panels, in case //we have to move them around because the player //changes screen resolutions ! // Control *human_control[2]; TeamCode human_team, enemy_team; //the two teams ! // Ship *HumanPlayer1, *HumanPlayer2; *************** *** 303,312 **** int search_key(int key); //Searches through keylist ! ~Vanguard(); //Destructor: Deletes all sprites and bitmaps }; int Vanguard::search_key(int key) { ! STACKTRACE for(int num=0; num<Num_Van_Keys; num++) --- 304,313 ---- int search_key(int key); //Searches through keylist ! virtual ~Vanguard(); //Destructor: Deletes all sprites and bitmaps }; int Vanguard::search_key(int key) { ! STACKTRACE; for(int num=0; num<Num_Van_Keys; num++) *************** *** 329,333 **** DATAFILE *Vanguard::FindDat(DATAFILE *datarray, char *name) { ! STACKTRACE for(int num=0; num<NUM_ENTRIES; num++) --- 330,334 ---- DATAFILE *Vanguard::FindDat(DATAFILE *datarray, char *name) { ! STACKTRACE; for(int num=0; num<NUM_ENTRIES; num++) *************** *** 339,361 **** bool Vanguard::handle_key(int k) { ! STACKTRACE ! char buffy[256]; ! message.print(1000,12,"Key: %s",key_to_name(k>>8, buffy)); switch(search_key(k>>8)) { - case KEY_HYPERSPACE: - if(jammer->is_in_hyperspace()) - { - jammer->set_target(NULL); - message.out("Exiting hyperspace."); - } - else if(HumanPlayer1->batt==HumanPlayer1->batt_max) - { - jammer->set_target(HumanPlayer1); - message.out("Entering hyperspace."); - } - - break; case KEY_HIDE_RADAR: //Toggle on/off radar --- 340,348 ---- bool Vanguard::handle_key(int k) { ! STACKTRACE; ! //message.print(1000,12,"Key: %s",key_to_name(k>>8, buffy)); switch(search_key(k>>8)) { case KEY_HIDE_RADAR: //Toggle on/off radar *************** *** 364,367 **** --- 351,355 ---- break; + /* case KEY_SWITCH_RADAR: //Switch between "everything" view and "hero" view if(vradar->t==NULL) *************** *** 372,375 **** --- 360,364 ---- else vradar->t=NULL; //Notice that there is no break here. I want it to fall thru to the KEY_SLASH_PAD code. + */ case KEY_ZOOM_ALL: //Zoom out full *************** *** 403,407 **** BITMAP *Vanguard::GetBitmap(DATAFILE *datArray, char *bitmapName) { ! STACKTRACE DATAFILE *tmpdata; //The object that the data gets tossed into --- 392,396 ---- BITMAP *Vanguard::GetBitmap(DATAFILE *datArray, char *bitmapName) { ! STACKTRACE; DATAFILE *tmpdata; //The object that the data gets tossed into *************** *** 435,439 **** SpaceSprite *Vanguard::GetSprite(DATAFILE *datArray, char *spriteName) { ! STACKTRACE DATAFILE *tmpdata; //Temporary holder for data --- 424,428 ---- SpaceSprite *Vanguard::GetSprite(DATAFILE *datArray, char *spriteName) { ! STACKTRACE; DATAFILE *tmpdata; //Temporary holder for data *************** *** 451,455 **** bool Vanguard::GetSprites(SpaceSprite *Pics[], DATAFILE *datArray, char *cmdStr, int numSprites) { ! STACKTRACE --- 440,444 ---- bool Vanguard::GetSprites(SpaceSprite *Pics[], DATAFILE *datArray, char *cmdStr, int numSprites) { ! STACKTRACE; *************** *** 476,484 **** void Vanguard::calculate() { ! STACKTRACE ! Game::calculate(); ! if (human_panel[0] && !human_panel[0]->exists()) human_panel[0] = NULL; ! if (human_panel[1] && !human_panel[1]->exists()) human_panel[1] = NULL; if (respawn_time == -1) { int i, humans = 0, enemies = 0; --- 465,473 ---- void Vanguard::calculate() { ! STACKTRACE; ! Game::calculate(); // NOTE: skip normalgame calculate, is that ok ? ! // if (human_panel[0] && !human_panel[0]->exists()) human_panel[0] = NULL; ! // if (human_panel[1] && !human_panel[1]->exists()) human_panel[1] = NULL; if (respawn_time == -1) { int i, humans = 0, enemies = 0; *************** *** 490,497 **** if (!humans || !enemies) respawn_time = game_time + 5000; //5000 milliseconds is 10 seconds } ! else if (respawn_time <= game_time) pick_new_ships(); // vradar->setTarget(HumanPlayer1); return; } --- 479,530 ---- if (!humans || !enemies) respawn_time = game_time + 5000; //5000 milliseconds is 10 seconds } ! else if (respawn_time <= game_time) ! pick_new_ships(); // vradar->setTarget(HumanPlayer1); + + + // player commands. + int i; + for ( i = 0; i < num_players; ++i ) + { + Ship *s; + s = player[i]->control->ship; + if (s && s->fire_altweapon) + { + if (jammer[i]->is_in_hyperspace()) + { + jammer[i]->set_target(0); + message.out("Exiting hyperspace."); + } + else if(s->batt == s->batt_max) + { + jammer[i]->set_target(s); + message.out("Entering hyperspace."); + } + } + + // WATCH MODE ?? + if (!s) + { + int key; + key = player[i]->control->keys; + + double v; + v = 10 / space_zoom; + if (key & keyflag::thrust) view->camera.pos += Vector2(0, -v); + if (key & keyflag::back) view->camera.pos += Vector2(0, v); + if (key & keyflag::left) view->camera.pos += Vector2(-v, 0); + if (key & keyflag::right) view->camera.pos += Vector2( v, 0); + /* + space_center = normalize2(view->camera.pos, map_size); + ::space_center = normalize2(view->camera.pos, map_size); + ::space_vel = view->camera.vel; + ::space_center_nowrap = view->camera.pos; + */ + } + } + return; } *************** *** 507,512 **** } ! void Vanguard::pick_new_ships() { ! STACKTRACE int i; --- 540,546 ---- } ! void Vanguard::pick_new_ships() ! { ! STACKTRACE; int i; *************** *** 514,527 **** clear_to_color(screen, pallete_color[4]); release_screen(); ! for (i = 0; i < num_items; i += 1) if (item[i]->exists()) item[i]->die(); ! ! // if (human_panel[0]) human_panel[0]->hide(); ! // if (human_panel[1]) human_panel[1]->hide(); //Probably a good idea to get all your variables immediately after //opening your .ini file. log_file("vanguard.ini"); int GasGrav = get_config_int(NULL, "Gasgravity",0); double MoonGrav = get_config_float(NULL, "Moongravity", 0); --- 548,570 ---- clear_to_color(screen, pallete_color[4]); release_screen(); ! item_sum("1"); + for (i = 0; i < num_items; i += 1) + { + if (item[i]->exists()) + item[i]->die(); + } + // also tell all player-controls that all ships have gone, otherwise not all + // choose a new ship here, which would give a problem + for ( i = 0; i < num_players; ++i ) + { + player[i]->control->ship = 0; + } //Probably a good idea to get all your variables immediately after //opening your .ini file. log_file("vanguard.ini"); + int GasGrav = get_config_int(NULL, "Gasgravity",0); double MoonGrav = get_config_float(NULL, "Moongravity", 0); *************** *** 543,551 **** double MoonVel = get_config_float(NULL,"MoonVel",0) * ANGLE_RATIO; - // width = Size1*Size2; //Set the size BEFORE putting in the ships - // height = Size1*Size2; size = Vector2(SizeX, SizeY); //player 1 selects a new ship Fleet fleet; --- 586,603 ---- double MoonVel = get_config_float(NULL,"MoonVel",0) * ANGLE_RATIO; size = Vector2(SizeX, SizeY); + // reset your fleets first ... + log_file("fleets/all.scf"); + for ( i = 0; i < num_players; ++i ) + ((NPI*)player[i])->fleet->load(NULL, "Fleet"); + + // use the default mechanism for choosing ships. + NormalGame::choose_new_ships(); + + + item_sum("2"); + /* //player 1 selects a new ship Fleet fleet; *************** *** 570,579 **** LOAD_FLEET i = human_control[1]->choose_ship(window, "Hey You Player!\nPick a ship!", &fleet); ! log_int(i, channel_player[1]); if (i == -1) i = random() % fleet.getSize(); // Ship *s = create_ship(fleet.getShipType(i)->id, human_control[1], width/2 + 100, height/2, PI, human_team); Ship *s = create_ship(fleet.getShipType(i)->id, human_control[1], size/2 + Vector2(100,0), PI, human_team); add(s->get_ship_phaser()); ! add_focus(s, channel_player[1]); human_panel[1] = new ShipPanel(s); human_panel[1]->window->init(window); --- 622,631 ---- LOAD_FLEET i = human_control[1]->choose_ship(window, "Hey You Player!\nPick a ship!", &fleet); ! log_int(i, channel_network[1]); if (i == -1) i = random() % fleet.getSize(); // Ship *s = create_ship(fleet.getShipType(i)->id, human_control[1], width/2 + 100, height/2, PI, human_team); Ship *s = create_ship(fleet.getShipType(i)->id, human_control[1], size/2 + Vector2(100,0), PI, human_team); add(s->get_ship_phaser()); ! add_focus(s, channel_network[1]); human_panel[1] = new ShipPanel(s); human_panel[1]->window->init(window); *************** *** 640,643 **** --- 692,696 ---- e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", tw_random(size), random(PI2), enemy_team); add(e->get_ship_phaser()); + */ //Solar system object code *************** *** 660,664 **** ok = 0; int n=0; ! int Dir = ((rand()%2)*2)-1; while (ok!=1) --- 713,717 ---- ok = 0; int n=0; ! int Dir = ((random()%2)*2)-1; while (ok!=1) *************** *** 687,705 **** ! add(Centre[iSuns] = new Sun(Vector2(w, h), StarPics[rand()%Num_Star_Pics],0)); Centre[iSuns]->id=SUN_ID; // planets creating loop ! NumPlanets=MinPlanets+rand()%(MaxPlanets-MinPlanets); for(int num=0; num<NumPlanets; num++) { ! kind = rand()%3; ! moons = rand()%(NumMoons+1); if ((kind == 0) && (((num+1)*Radius)> 1600)) { // gas giant // Satellite = new Planet(width/2,height/2,GiantPics[rand()%Num_Giant_Pics],0); ! Satellite = new Planet(size/2, GiantPics[rand()%Num_Giant_Pics],0); Satellite->gravity_force *= GasGrav; --- 740,758 ---- ! add(Centre[iSuns] = new Sun(Vector2(w, h), StarPics[random()%Num_Star_Pics],0)); Centre[iSuns]->id=SUN_ID; // planets creating loop ! NumPlanets=MinPlanets+random()%(MaxPlanets-MinPlanets); for(int num=0; num<NumPlanets; num++) { ! kind = random()%3; ! moons = random()%(NumMoons+1); if ((kind == 0) && (((num+1)*Radius)> 1600)) { // gas giant // Satellite = new Planet(width/2,height/2,GiantPics[rand()%Num_Giant_Pics],0); ! Satellite = new Planet(size/2, GiantPics[random()%Num_Giant_Pics],0); Satellite->gravity_force *= GasGrav; *************** *** 712,716 **** { // normal planet // Satellite = new Planet(width/2,height/2,PlanetPics[rand()%Num_Planet_Pics],0); ! Satellite = new Planet(size/2,PlanetPics[rand()%Num_Planet_Pics],0); // handler = new OrbitHandler(Centre[j],width/2,height/2,random(PI2), (SpaceLocation *)Centre[j], --- 765,769 ---- { // normal planet // Satellite = new Planet(width/2,height/2,PlanetPics[rand()%Num_Planet_Pics],0); ! Satellite = new Planet(size/2,PlanetPics[random()%Num_Planet_Pics],0); // handler = new OrbitHandler(Centre[j],width/2,height/2,random(PI2), (SpaceLocation *)Centre[j], *************** *** 726,730 **** { // Moon = new Planet(width/2,height/2,MoonPics[rand()%Num_Moon_Pics],0); ! Moon = new Planet(size/2,MoonPics[rand()%Num_Moon_Pics],0); Moon->gravity_force *= MoonGrav; Moon->gravity_range = 8; --- 779,783 ---- { // Moon = new Planet(width/2,height/2,MoonPics[rand()%Num_Moon_Pics],0); ! Moon = new Planet(size/2,MoonPics[random()%Num_Moon_Pics],0); Moon->gravity_force *= MoonGrav; Moon->gravity_range = 8; *************** *** 746,749 **** --- 799,804 ---- } done: + + item_sum("3"); //comet code for (int num = 0; num < Comets; num++) *************** *** 760,763 **** --- 815,820 ---- } + item_sum("4"); + //End solar system object code *************** *** 773,779 **** void Vanguard::init(Log *_log) { ! STACKTRACE ! Game::init(_log); prepare(); --- 830,857 ---- void Vanguard::init(Log *_log) { ! STACKTRACE; ! int minbots = 1; ! if (num_bots < minbots) // require a minimum number of bots ! { ! int k; ! k = minbots - num_bots; ! num_bots = minbots; ! ! int i; ! for ( i = 0; i < 5; ++i ) ! { ! message.print(1500, 14, "Adding bots to your game !! You need at least 4 bots."); ! message.animate(0); ! } ! idle(500); // wait half a second. ! ! ! // you've to adjust the num_players as well if this is the case ... ! // otherwise the extra bots will be skipped (=safeguard). ! num_players += k; ! } ! ! NormalGame::init(_log); prepare(); *************** *** 801,806 **** if(!blankRadar) error("Can't load scope image."); ! jammer = new HyperJammer(NULL,150); ! game->add(jammer); //Solar System Melee code --- 879,889 ---- if(!blankRadar) error("Can't load scope image."); ! // create a jammer for each player (to enter hyperspace) ! int i; ! for ( i = 0; i < num_players; ++i ) ! { ! jammer[i] = new HyperJammer(NULL,150); ! game->add(jammer[i]); ! } //Solar System Melee code *************** *** 837,840 **** --- 920,932 ---- enemy_team = new_team(); + // reset default team settings for all players + for ( i = 0; i < num_players; ++i ) + { + if (player[i]->channel == channel_none) + player[i]->team = enemy_team; + else + player[i]->team = human_team; + } + // vradar = new VanRadar(blankRadar,NULL,RadarZoom = width); vradar = new VanRadar(blankRadar,NULL,RadarZoom = size.x); *************** *** 844,863 **** add(vradar); - human_control[0] = create_control(channel_server, "Human"); - - if ((glog->type == Log::log_net1server) || (glog->type == Log::log_net1client)) - human_control[1] = create_control(channel_player[1], "Human"); ! else human_control[1] = NULL; ! ! log_file("vanguard.ini"); // int Size1 = get_config_int(NULL, "Size1", 0); // int Size2 = get_config_int(NULL, "Size2", 0); int Asteroids = get_config_int(NULL,"Asteroids",0); ! int i; ! for(i=0; i<Asteroids; i++) add(new Asteroid()); ! human_panel[0] = human_panel[1] = NULL; change_view("Hero"); //sets it to Hero view mode --- 936,950 ---- add(vradar); ! // log_file("vanguard.ini"); // int Size1 = get_config_int(NULL, "Size1", 0); // int Size2 = get_config_int(NULL, "Size2", 0); int Asteroids = get_config_int(NULL,"Asteroids",0); ! ! for(i=0; i<Asteroids; i++) ! add(new Asteroid()); ! // human_panel[0] = human_panel[1] = NULL; change_view("Hero"); //sets... [truncated message content] |
From: Yura S. <yu...@us...> - 2004-03-15 22:30:14
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20416/source/melee Modified Files: mcontrol.cpp mgame.cpp mlog.cpp mnet1.cpp Log Message: Fixing compilation problems, removing from game ship with certan error (smbdy look at it), I don't have Windows at home so please check if everything compilling with MSVC Index: mlog.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mlog.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mlog.cpp 12 Mar 2004 20:14:59 -0000 1.12 --- mlog.cpp 15 Mar 2004 22:20:31 -0000 1.13 *************** *** 593,597 **** PACKFILE *f; ! int i, j = 0; f = pack_fopen(fname, F_READ); if (!f) { tw_error("tw_log_file - bad file name %s", fname); } --- 593,597 ---- PACKFILE *f; ! int i; f = pack_fopen(fname, F_READ); if (!f) { tw_error("tw_log_file - bad file name %s", fname); } Index: mgame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** mgame.cpp 13 Mar 2004 11:45:31 -0000 1.35 --- mgame.cpp 15 Mar 2004 22:20:31 -0000 1.36 *************** *** 290,298 **** ! static const int channel_none = -1; ! static const int _channel_buffered = 1; ! static const int channel_init = 4; // game type, version, length, etc.. things that need to read by a reader independant of a particular game type ! static const int channel_playback = 8; // used for demo playbacks only ! static const int channel_server = 12; //data originating on the server int channel_player[max_player]; //data originating on the client int p_local; // this defines the local player. --- 290,298 ---- ! const int channel_none = -1; ! const int _channel_buffered = 1; ! const int channel_init = 4; // game type, version, length, etc.. things that need to read by a reader independant of a particular game type ! const int channel_playback = 8; // used for demo playbacks only ! const int channel_server = 12; //data originating on the server int channel_player[max_player]; //data originating on the client int p_local; // this defines the local player. *************** *** 1679,1688 **** ! static bool has_registered = false; void Game::register_events() { ! EVENT(Game, chat); ! EVENT(Game, change_lag); ! EVENT(Game, test_event1); } --- 1679,1688 ---- ! //static bool has_registered = false; void Game::register_events() { ! EVENT(Game, &Game::chat); ! EVENT(Game, &Game::change_lag); ! EVENT(Game, &Game::test_event1); } *************** *** 1770,1774 **** int val[max_comp]; ! int N, Nprev; for ( p = 0; p < num_humans; ++p ) { --- 1770,1774 ---- int val[max_comp]; ! int N, Nprev = -1; for ( p = 0; p < num_humans; ++p ) { *************** *** 1812,1817 **** // only generate in true-time // otherwise, N may differ from the true number of items in the game. ! test = item[i]->pos.x + item[i]->pos.y + ! item[i]->vel.x + item[i]->vel.y; id = item[i]->debug_id; } --- 1812,1817 ---- // only generate in true-time // otherwise, N may differ from the true number of items in the game. ! test = iround(item[i]->pos.x + item[i]->pos.y + ! item[i]->vel.x + item[i]->vel.y); id = item[i]->debug_id; } Index: mcontrol.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcontrol.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** mcontrol.cpp 12 Mar 2004 20:14:58 -0000 1.17 --- mcontrol.cpp 15 Mar 2004 22:20:15 -0000 1.18 *************** *** 352,356 **** //network traffic ! int lf = game->lag_frames; // Geo: this is not that relevant, the game is already lagging cause it has to wait for the data //if (0) ; //else --- 352,356 ---- //network traffic ! //int lf = game->lag_frames; // Geo: this is not that relevant, the game is already lagging cause it has to wait for the data //if (0) ; //else Index: mnet1.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mnet1.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mnet1.cpp 12 Mar 2004 20:14:59 -0000 1.10 --- mnet1.cpp 15 Mar 2004 22:20:31 -0000 1.11 *************** *** 629,633 **** ! static int netlog_idletime = 0; void NetLog::use_idle(int time) --- 629,633 ---- ! //static int netlog_idletime = 0; void NetLog::use_idle(int time) |
From: Yura S. <yu...@us...> - 2004-03-15 22:30:05
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20416/source/games Modified Files: ggob.cpp Log Message: Fixing compilation problems, removing from game ship with certan error (smbdy look at it), I don't have Windows at home so please check if everything compilling with MSVC Index: ggob.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ggob.cpp 12 Mar 2004 20:14:55 -0000 1.32 --- ggob.cpp 15 Mar 2004 22:20:15 -0000 1.33 *************** *** 303,307 **** luaopen_debug(ls); ! int a = lua_dofile (ls, "gamedata/gob/config.lua"); lua_close(ls); --- 303,307 ---- luaopen_debug(ls); ! lua_dofile (ls, "gamedata/gob/config.lua"); lua_close(ls); |
From: Yura S. <yu...@us...> - 2004-03-15 22:30:05
|
Update of /cvsroot/timewarp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20416 Modified Files: client.ini makefile Log Message: Fixing compilation problems, removing from game ship with certan error (smbdy look at it), I don't have Windows at home so please check if everything compilling with MSVC Index: client.ini =================================================================== RCS file: /cvsroot/timewarp/client.ini,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** client.ini 1 Mar 2004 23:21:44 -0000 1.29 --- client.ini 15 Mar 2004 22:20:14 -0000 1.30 *************** *** 5,8 **** --- 5,11 ---- Address = 192.168.0.1 NetworkMeleeUseTeams = 0 + Nhumans = 1 + Nbots = 6 + GameName = Planet Explorer [System] Index: makefile =================================================================== RCS file: /cvsroot/timewarp/makefile,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** makefile 1 Mar 2004 23:21:44 -0000 1.12 --- makefile 15 Mar 2004 22:20:14 -0000 1.13 *************** *** 5,8 **** --- 5,9 ---- # Define debug=1 when you want to build debug version of TimeWarp # # Define NO_JGMOD=1 when you have not jgmod optional library # + # Define NO_NET=1 when you does not need network # # # # Running just make builds the release version of TimeWarp for *nix # *************** *** 18,22 **** CFLAGS = -fsigned-char -Wall OBJDIR = obj ! NAME = timewarp VPATH = source source/ais source/games source/games/triggers source/melee \ --- 19,23 ---- CFLAGS = -fsigned-char -Wall OBJDIR = obj ! NAME = TimeWarp VPATH = source source/ais source/games source/games/triggers source/melee \ *************** *** 53,56 **** --- 54,61 ---- endif + ifdef NO_NET + CFLAGS += -DNETWORK_NONE + endif + ifdef win32 OBJDIR := ${addsuffix -win32,$(OBJDIR)} |
From: Yura S. <yu...@us...> - 2004-03-15 22:30:05
|
Update of /cvsroot/timewarp/source/gamex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20416/source/gamex Modified Files: gameplanetscan.cpp Log Message: Fixing compilation problems, removing from game ship with certan error (smbdy look at it), I don't have Windows at home so please check if everything compilling with MSVC Index: gameplanetscan.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gameplanetscan.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** gameplanetscan.cpp 12 Mar 2004 20:14:58 -0000 1.13 --- gameplanetscan.cpp 15 Mar 2004 22:20:15 -0000 1.14 *************** *** 1344,1348 **** char txt[512]; ! N = random(iround(nmin), iround(nmax)); for ( i = 0; i < N; ++i ) --- 1344,1348 ---- char txt[512]; ! N = iround(random(iround(nmin), iround(nmax))); for ( i = 0; i < N; ++i ) |
From: Yura S. <yu...@us...> - 2004-03-15 22:30:05
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20416/source/ais Modified Files: ext_ai.cpp Log Message: Fixing compilation problems, removing from game ship with certan error (smbdy look at it), I don't have Windows at home so please check if everything compilling with MSVC Index: ext_ai.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/ext_ai.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ext_ai.cpp 14 Mar 2004 23:26:22 -0000 1.3 --- ext_ai.cpp 15 Mar 2004 22:20:14 -0000 1.4 *************** *** 50,52 **** return 0; ! } \ No newline at end of file --- 50,52 ---- return 0; ! } |
From: Yura S. <yu...@us...> - 2004-03-15 22:29:50
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20416/source/newships Modified Files: shpcrore.cpp shpdragr.cpp shpjnkla.cpp shpplala.cpp shptaubo.cpp shpwassu.cpp Log Message: Fixing compilation problems, removing from game ship with certan error (smbdy look at it), I don't have Windows at home so please check if everything compilling with MSVC Index: shptaubo.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaubo.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shptaubo.cpp 29 Feb 2004 23:22:19 -0000 1.11 --- shptaubo.cpp 15 Mar 2004 22:20:32 -0000 1.12 *************** *** 1,2 **** --- 1,3 ---- + #include <assert.h> #include "../ship.h" #include "../melee/mview.h" *************** *** 187,191 **** tgt = NULL; ! double r0 = 1e40, r; Query q; for (q.begin(this, OBJECT_LAYERS, proximity_range); q.currento; q.next()) --- 188,192 ---- tgt = NULL; ! double r0 = 1e40, r = -1; Query q; for (q.begin(this, OBJECT_LAYERS, proximity_range); q.currento; q.next()) *************** *** 198,201 **** --- 199,203 ---- } q.end(); + assert(r>0&&"Using uninitialized variable"); if ((old_tgt?old_tgt->exists():false) && (tgt?(r>old_range):true) && active) { damage(this, 9999); return; } Index: shpplala.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpplala.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** shpplala.cpp 29 Jan 2004 21:20:30 -0000 1.3 --- shpplala.cpp 15 Mar 2004 22:20:32 -0000 1.4 *************** *** 17,21 **** ! /* Disclaimer: I can't code. At all. I'm basically taking stuff from other ships and using it here. This means, theres probably a lot of usless garbage in here. And a lot of other people get credit. Some ships I've --- 17,21 ---- ! Disclaimer: I can't code. At all. I'm basically taking stuff from other ships and using it here. This means, theres probably a lot of usless garbage in here. And a lot of other people get credit. Some ships I've Index: shpcrore.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpcrore.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** shpcrore.cpp 1 Mar 2004 22:46:13 -0000 1.2 --- shpcrore.cpp 15 Mar 2004 22:20:32 -0000 1.3 *************** *** 252,255 **** --- 252,257 ---- for (q.begin(this, OBJECT_LAYERS, blast_range); q.currento; q.next()) { if (q.currento != direct_hit) { + tw_error("Using uninitialized variable r"); + r = -1000; if (q.currento->sameShip(this)) r *= 2; if (r > blast_range) continue; *************** *** 274,277 **** ! REGISTER_SHIP(Crome) --- 276,279 ---- ! //REGISTER_SHIP(Crome) Index: shpjnkla.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpjnkla.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shpjnkla.cpp 29 Feb 2004 23:22:19 -0000 1.13 --- shpjnkla.cpp 15 Mar 2004 22:20:32 -0000 1.14 *************** *** 343,347 **** d_a = normalize(trajectory_angle(tgt) - angle, PI2); else { //d_a = pos->get_angle(); ! base_length = lng * (frame_count - frame) / frame_count; } length = base_length; // state = 0; return; --- 343,350 ---- d_a = normalize(trajectory_angle(tgt) - angle, PI2); else { //d_a = pos->get_angle(); ! base_length = lng * (frame_count - frame) / frame_count; ! tw_error("Using uninitialized variable d_a bellow few line"); ! d_a = -12345; ! } length = base_length; // state = 0; return; Index: shpwassu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpwassu.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpwassu.cpp 29 Feb 2004 23:22:20 -0000 1.15 --- shpwassu.cpp 15 Mar 2004 22:20:32 -0000 1.16 *************** *** 575,578 **** --- 575,583 ---- case 4: // lower right RelAngle = 135 * ANGLE_RATIO; + break; + default: + tw_error("This is not supposed to happend"); + RelAngle = -1; + break; } RelAngle += trajectory_angle(MotherShip); Index: shpdragr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpdragr.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shpdragr.cpp 29 Jan 2004 21:20:29 -0000 1.7 --- shpdragr.cpp 15 Mar 2004 22:20:32 -0000 1.8 *************** *** 1,2 **** --- 1,3 ---- + #include <assert.h> #include "../ship.h" REGISTER_FILE *************** *** 163,167 **** } Query a; ! Shot *o,*f = NULL; double r=99999; int Seek=FALSE; --- 164,168 ---- } Query a; ! Shot *o = NULL,*f = NULL; double r=99999; int Seek=FALSE; *************** *** 176,179 **** --- 177,181 ---- } } + assert(o!=NULL); for (a.begin(this, bit(LAYER_SHOTS),MineSeek); a.current; a.next()) { |
From: Yura S. <yu...@us...> - 2004-03-15 22:29:49
|
Update of /cvsroot/timewarp/source/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20416/source/util Modified Files: net_tcp.cpp pmask.c Log Message: Fixing compilation problems, removing from game ship with certan error (smbdy look at it), I don't have Windows at home so please check if everything compilling with MSVC Index: pmask.c =================================================================== RCS file: /cvsroot/timewarp/source/util/pmask.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pmask.c 21 Nov 2003 10:24:29 -0000 1.6 --- pmask.c 15 Mar 2004 22:20:33 -0000 1.7 *************** *** 165,169 **** int base = j * sizeof(MASK_WORD_TYPE); for (k = 0; k < pmask->h; k += 1) { ! MASK_WORD_TYPE tmp; base += bytes; for (i = sizeof(MASK_WORD_TYPE)-1; i >= 0; i -= 1) { --- 165,169 ---- int base = j * sizeof(MASK_WORD_TYPE); for (k = 0; k < pmask->h; k += 1) { ! MASK_WORD_TYPE tmp = 0; base += bytes; for (i = sizeof(MASK_WORD_TYPE)-1; i >= 0; i -= 1) { *************** *** 207,211 **** int base = j * sizeof(MASK_WORD_TYPE); for (k = 0; k < pmask->h; k += 1) { ! MASK_WORD_TYPE tmp; base += bytes; for (i = sizeof(MASK_WORD_TYPE)-1; i >= 0; i -= 1) { --- 207,211 ---- int base = j * sizeof(MASK_WORD_TYPE); for (k = 0; k < pmask->h; k += 1) { ! MASK_WORD_TYPE tmp = 0; base += bytes; for (i = sizeof(MASK_WORD_TYPE)-1; i >= 0; i -= 1) { Index: net_tcp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/util/net_tcp.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** net_tcp.cpp 12 Mar 2004 20:15:01 -0000 1.8 --- net_tcp.cpp 15 Mar 2004 22:20:33 -0000 1.9 *************** *** 37,40 **** --- 37,42 ---- #include "net_tcp.h" #if defined(NETWORK_BSD) && !defined(NETWORK_NO_INCLUDE) + # include <stdlib.h> + # include <sys/ioctl.h> # include <unistd.h> # include <sys/time.h> *************** *** 100,104 **** --- 102,110 ---- { u_long no_block = 1; + # ifdef NETWORK_WINSOCK ioctlsocket(sd, FIONBIO, &no_block); + # else + ioctl(sd, FIONBIO, &no_block); + # endif } *************** *** 522,528 **** return 0; } ! int NetTCP::send(int size, const void *data) { ! return 0; ! } int NetTCP::recv(int min, int max, void *data) { return 0; --- 528,534 ---- return 0; } ! //int NetTCP::send(int size, const void *data) { ! // return 0; ! // } int NetTCP::recv(int min, int max, void *data) { return 0; |
From: Yura S. <yu...@us...> - 2004-03-15 22:29:49
|
Update of /cvsroot/timewarp/source/twgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20416/source/twgui Modified Files: twguilist.cpp Log Message: Fixing compilation problems, removing from game ship with certan error (smbdy look at it), I don't have Windows at home so please check if everything compilling with MSVC Index: twguilist.cpp =================================================================== RCS file: /cvsroot/timewarp/source/twgui/twguilist.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** twguilist.cpp 29 Feb 2004 23:22:21 -0000 1.2 --- twguilist.cpp 15 Mar 2004 22:20:33 -0000 1.3 *************** *** 941,945 **** // create the most "optimal" square map (minimum x,y positions means least search trouble (I think)). ! Nx = iround( sqrt((double)maxitems) ); Ny = maxitems/Nx + 1; --- 941,945 ---- // create the most "optimal" square map (minimum x,y positions means least search trouble (I think)). ! Nx = iround( sqrt((fix)maxitems) ); Ny = maxitems/Nx + 1; |
From: Yura S. <yu...@us...> - 2004-03-15 22:29:49
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20416/source/other Modified Files: configrw.cpp gconfig.cpp Log Message: Fixing compilation problems, removing from game ship with certan error (smbdy look at it), I don't have Windows at home so please check if everything compilling with MSVC Index: configrw.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/configrw.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** configrw.cpp 29 Feb 2004 23:22:16 -0000 1.5 --- configrw.cpp 15 Mar 2004 22:20:33 -0000 1.6 *************** *** 6,10 **** #include "configrw.h" ! bool config_read = true; --- 6,13 ---- #include "configrw.h" ! #ifdef __APPLE__ ! #include <sys/types.h> ! #include <sys/stat.h> ! #endif bool config_read = true; Index: gconfig.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gconfig.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gconfig.cpp 12 Mar 2004 21:57:54 -0000 1.2 --- gconfig.cpp 15 Mar 2004 22:20:33 -0000 1.3 *************** *** 119,128 **** int nx, ny; if ( !strcmp(x, "?") ) ! nx = random (game->size.x); else nx = atoi(x); if ( !strcmp(y, "?") ) ! ny = random (game->size.y); else ny = atoi(y); --- 119,128 ---- int nx, ny; if ( !strcmp(x, "?") ) ! nx = iround(random (game->size.x)); else nx = atoi(x); if ( !strcmp(y, "?") ) ! ny = iround(random (game->size.y)); else ny = atoi(y); *************** *** 170,175 **** const char* name = lua_tostring(ls, 1); ! const char* x = lua_tostring(ls, 2); ! const char* y = lua_tostring(ls, 3); const char* buildtype = lua_tostring(ls, 4); const char* commander = lua_tostring(ls, 5); --- 170,175 ---- const char* name = lua_tostring(ls, 1); ! //const char* x = lua_tostring(ls, 2); ! //const char* y = lua_tostring(ls, 3); const char* buildtype = lua_tostring(ls, 4); const char* commander = lua_tostring(ls, 5); *************** *** 184,188 **** bool c = true; std::string file, pic; ! for (int i = 0; i< strlen(sprite);i++) { if (sprite[i] == '#') --- 184,188 ---- bool c = true; std::string file, pic; ! for (unsigned int i = 0; i< strlen(sprite);i++) { if (sprite[i] == '#') *************** *** 213,215 **** return 0; ! } \ No newline at end of file --- 213,215 ---- return 0; ! } |
From: <yu...@us...> - 2004-03-14 23:35:23
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16761/source/newships Modified Files: shpsefn2.cpp Log Message: Appling Nic patches Index: shpsefn2.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpsefn2.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** shpsefn2.cpp 29 Feb 2004 23:22:19 -0000 1.3 --- shpsefn2.cpp 14 Mar 2004 23:26:22 -0000 1.4 *************** *** 1128,1132 **** // simulate visibility of a glittering line in the sun ... double a, colscale; ! a = atan2f(dy,dx); colscale = fabs(sin(a)); // flat lying = less visible. --- 1128,1132 ---- // simulate visibility of a glittering line in the sun ... double a, colscale; ! a = atan2(dy,dx); colscale = fabs(sin(a)); // flat lying = less visible. |
From: <yu...@us...> - 2004-03-14 23:35:23
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16761/source/ais Modified Files: ext_ai.cpp Log Message: Appling Nic patches Index: ext_ai.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/ext_ai.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ext_ai.cpp 2 Mar 2004 12:33:51 -0000 1.2 --- ext_ai.cpp 14 Mar 2004 23:26:22 -0000 1.3 *************** *** 22,26 **** ExternalAI::ExternalAI(SpaceObject * so, std::string script) { ! ASSERT(shp!=NULL); space_object = so; L = lua_open(); --- 22,26 ---- ExternalAI::ExternalAI(SpaceObject * so, std::string script) { ! ASSERT(so!=NULL); space_object = so; L = lua_open(); |
From: <yu...@us...> - 2004-03-14 23:35:22
|
Update of /cvsroot/timewarp/gamedata In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16761/gamedata Modified Files: arilou.lua Log Message: Appling Nic patches Index: arilou.lua =================================================================== RCS file: /cvsroot/timewarp/gamedata/arilou.lua,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** arilou.lua 2 Mar 2004 12:35:10 -0000 1.1 --- arilou.lua 14 Mar 2004 23:26:21 -0000 1.2 *************** *** 5,10 **** DialogStart "gamedata/dialogs/arilou.jpg" DialogSetMusic "gamedata/dialogs/arilou.mod" ! DialogWrite "Hi!" ! answer = DialogAnswer ( "Bye" ) DialogEnd() --- 5,12 ---- DialogStart "gamedata/dialogs/arilou.jpg" DialogSetMusic "gamedata/dialogs/arilou.mod" ! DialogWrite "Hello my little one. I am so pleased to see you! You have done well for yourself. It is gratifying." ! answer = DialogAnswer ( "You sound as if you know me. Have we met?", ! "I know who you are! You're Arilou!! We've wondered what happened to your people for a long time.", ! "I'll be. It's the Arilou. Why the hell did you run out on the Alliance of Free Stars? What happened?" ) DialogEnd() |
From: <geo...@us...> - 2004-03-13 12:09:05
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv942 Modified Files: scp.cpp Log Message: no message Index: scp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/scp.cpp,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** scp.cpp 13 Mar 2004 11:45:30 -0000 1.60 --- scp.cpp 13 Mar 2004 12:00:18 -0000 1.61 *************** *** 926,931 **** // user menu: enter adress and port number ! // if (connect_menu(&videosystem.window, &tmp, &port) == -1) ! // return; // saving address --- 926,931 ---- // user menu: enter adress and port number ! if (connect_menu(&videosystem.window, &tmp, &port) == -1) ! return; // saving address |
From: <geo...@us...> - 2004-03-13 11:54:19
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30266/newships Modified Files: _howto_1.cpp _howto_2.cpp shpaktgu.cpp shpalabc.cpp shpalckr.cpp shpalhdr.cpp shpalhha.cpp shparitr.cpp shparkpi.cpp shpartem.cpp shpphepa.cpp Log Message: net update + hypermelee fix Index: _howto_1.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/_howto_1.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _howto_1.cpp 26 Feb 2004 22:23:21 -0000 1.1 --- _howto_1.cpp 13 Mar 2004 11:45:31 -0000 1.2 *************** *** 26,29 **** --- 26,30 ---- Ship(opos, shipAngle, shipData, shipCollideFlag) { + debug_id = 3; // for debugging purpose }; Index: _howto_2.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/_howto_2.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** _howto_2.cpp 28 Feb 2004 01:05:48 -0000 1.2 --- _howto_2.cpp 13 Mar 2004 11:45:31 -0000 1.3 *************** *** 33,36 **** --- 33,39 ---- // armour = how many hit points it absorbs, before it dies. weaponArmour = get_config_int("Weapon", "Armour", 0); + + // for debugging purpose + debug_id = 4; }; Index: shpaktgu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpaktgu.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** shpaktgu.cpp 7 Feb 2004 07:43:38 -0000 1.4 --- shpaktgu.cpp 13 Mar 2004 11:45:31 -0000 1.5 *************** *** 98,102 **** ComSat[i] = NULL; } ! } --- 98,103 ---- ComSat[i] = NULL; } ! // for debugging purpose ! debug_id = 5; } *************** *** 158,161 **** --- 159,164 ---- owner(lowner) { + // for debugging purpose + debug_id = 6; } *************** *** 186,189 **** --- 189,194 ---- pos = ship->normal_pos(); if(!(ship && ship->exists())) state = 0; + // for debugging purpose + debug_id = 7; } Index: shpalabc.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpalabc.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpalabc.cpp 29 Feb 2004 23:22:18 -0000 1.15 --- shpalabc.cpp 13 Mar 2004 11:45:31 -0000 1.16 *************** *** 194,197 **** --- 194,199 ---- sprite_index &= 127; + // for debugging purpose + debug_id = 40; } *************** *** 576,579 **** --- 578,583 ---- isblockingweapons = false; + // for debugging purpose + debug_id = 41; } *************** *** 678,681 **** --- 682,687 ---- smoke_frame = 0; play_sound(data->sampleWeapon[1], 64); + // for debugging purpose + debug_id = 42; } *************** *** 741,744 **** --- 747,752 ---- alive = true; + // for debugging purpose + debug_id = 43; } *************** *** 969,972 **** --- 977,982 ---- // y = opos->normal_y() + oy*ty + ox*tx; pos = normalize(opos->normal_pos() + rotate(Vector2(-ox, oy), -PI/2+angle)); + // for debugging purpose + debug_id = 44; } Index: shpalckr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpalckr.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpalckr.cpp 29 Jan 2004 21:20:29 -0000 1.11 --- shpalckr.cpp 13 Mar 2004 11:45:31 -0000 1.12 *************** *** 158,161 **** --- 158,164 ---- dial_angle = 0; dial_index = get_index(angle + dial_angle); + + // for debugging purpose + debug_id = 50; } *************** *** 355,358 **** --- 358,364 ---- step = 0; sparkNfactor = osparkNfactor; + + // for debugging purpose + debug_id = 51; } *************** *** 432,435 **** --- 438,444 ---- collide_flag_anyone = collide_flag_sameship = collide_flag_sameteam = 0; vel = 0;//vx = vy = 0; + + // for debugging purpose + debug_id = 52; } Index: shpalhdr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpalhdr.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpalhdr.cpp 29 Jan 2004 21:20:29 -0000 1.11 --- shpalhdr.cpp 13 Mar 2004 11:45:31 -0000 1.12 *************** *** 53,57 **** public: AlhordianDreadnought(Vector2 opos, double angle, ShipData *data, unsigned int code); ! ~AlhordianDreadnought(void); protected: virtual int activate_weapon(); --- 53,57 ---- public: AlhordianDreadnought(Vector2 opos, double angle, ShipData *data, unsigned int code); ! virtual ~AlhordianDreadnought(void); protected: virtual int activate_weapon(); *************** *** 159,162 **** --- 159,165 ---- // rP1 = Vector2(-5, -17); // rP2 = Vector2(-5, 17); + + // for debugging purpose + debug_id = 60; } *************** *** 334,337 **** --- 337,343 ---- sprite_index = 0; this->lifetimeCounter = 0; + + // for debugging purpose + debug_id = 61; } Index: shpalhha.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpalhha.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** shpalhha.cpp 28 Feb 2004 01:05:48 -0000 1.2 --- shpalhha.cpp 13 Mar 2004 11:45:31 -0000 1.3 *************** *** 162,165 **** --- 162,168 ---- // rP1 = Vector2(-5, -17); // rP2 = Vector2(-5, 17); + + // for debugging purpose + debug_id = 70; } *************** *** 355,358 **** --- 358,364 ---- sprite_index = 0; this->lifetimeCounter = 0; + + // for debugging purpose + debug_id = 71; } Index: shparitr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shparitr.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shparitr.cpp 29 Jan 2004 21:20:29 -0000 1.12 --- shparitr.cpp 13 Mar 2004 11:45:31 -0000 1.13 *************** *** 67,70 **** --- 67,73 ---- } } + + // for debugging purpose + debug_id = 80; } *************** *** 133,136 **** --- 136,142 ---- drainAmount = drainAmountof; accel = trapAccel; + + // for debugging purpose + debug_id = 81; } *************** *** 183,186 **** --- 189,195 ---- { sprite_index = get_index((follow->get_angle())+offset); + + // for debugging purpose + debug_id = 82; } /************************************* *************** *** 259,262 **** --- 268,274 ---- cloak = FALSE; cloak_frame = 0; + + // for debugging purpose + debug_id = 83; } Index: shparkpi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shparkpi.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shparkpi.cpp 29 Jan 2004 21:20:29 -0000 1.11 --- shparkpi.cpp 13 Mar 2004 11:45:31 -0000 1.12 *************** *** 23,27 **** ArkanoidPincer(ArkanoidPincerShip* ocreator, Vector2 opos, double oangle, SpaceSprite *osprite); ! ~ArkanoidPincer(void); virtual void calculate(); virtual void collide(SpaceObject *other); --- 23,27 ---- ArkanoidPincer(ArkanoidPincerShip* ocreator, Vector2 opos, double oangle, SpaceSprite *osprite); ! virtual ~ArkanoidPincer(void); virtual void calculate(); virtual void collide(SpaceObject *other); *************** *** 92,96 **** public: ArkanoidPincerShip(Vector2 opos, double angle, ShipData *data, unsigned int code); ! ~ArkanoidPincerShip(void); ArkanoidPincer* pincerL; ArkanoidPincer* pincerR; --- 92,96 ---- public: ArkanoidPincerShip(Vector2 opos, double angle, ShipData *data, unsigned int code); ! virtual ~ArkanoidPincerShip(void); ArkanoidPincer* pincerL; ArkanoidPincer* pincerR; *************** *** 195,198 **** --- 195,201 ---- regrowthCount=0; //message.print(1500,2,"ArkanoidPincerShipCreator2"); + + // for debugging purpose + debug_id = 90; } *************** *** 518,521 **** --- 521,527 ---- isAlive = TRUE; //message.print(1500,13,"ArkanoidPincerCreate2"); + + // for debugging purpose + debug_id = 91; } Index: shpartem.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpartem.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpartem.cpp 29 Jan 2004 21:20:29 -0000 1.10 --- shpartem.cpp 13 Mar 2004 11:45:32 -0000 1.11 *************** *** 66,69 **** --- 66,72 ---- specialArmour = get_config_int("Special", "Armour", 0); specialTurnRate = scale_turning(get_config_float("Special", "TurnRate", 0)); + + // for debugging purpose + debug_id = 100; } *************** *** 279,282 **** --- 282,288 ---- wave_range = false; + + // for debugging purpose + debug_id = 101; } Index: shpphepa.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpphepa.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpphepa.cpp 12 Mar 2004 20:15:00 -0000 1.16 --- shpphepa.cpp 13 Mar 2004 11:45:32 -0000 1.17 *************** *** 86,89 **** --- 86,91 ---- for ( i = 0; i < maxcrew; ++i ) crewinspace[i] = 0; + + debug_id = 1; // for debugging purpose } *************** *** 226,229 **** --- 228,233 ---- isblockingweapons = false; + + debug_id = 2; // for debugging purpose } |
From: <geo...@us...> - 2004-03-13 11:54:19
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30266/melee Modified Files: mframe.cpp mframe.h mgame.cpp mgame.h mshot.cpp mshot.h Log Message: net update + hypermelee fix Index: mframe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** mframe.cpp 4 Mar 2004 15:31:18 -0000 1.27 --- mframe.cpp 13 Mar 2004 11:45:31 -0000 1.28 *************** *** 451,454 **** --- 451,459 ---- } + void SpaceLocation::scale_vel(double scale) + { + vel *= scale; + } + /*** Change a location by translation */ Index: mframe.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** mframe.h 4 Mar 2004 15:31:18 -0000 1.18 --- mframe.h 13 Mar 2004 11:45:31 -0000 1.19 *************** *** 246,249 **** --- 246,250 ---- virtual void change_vel(Vector2 dvel); + virtual void scale_vel(double scale); virtual void change_pos(Vector2 dpos); virtual void change_pos(double scale); *************** *** 292,295 **** --- 293,298 ---- void play_sound (SAMPLE *sample, int vol = 256, int freq = 1000); //plays a sound void play_sound2 (SAMPLE *sample, int vol = 256, int freq = 1000);//like play_sound, only stops the previous sound + + int debug_id; // for debugging purpose }; Index: mgame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** mgame.cpp 12 Mar 2004 20:14:58 -0000 1.34 --- mgame.cpp 13 Mar 2004 11:45:31 -0000 1.35 *************** *** 44,48 **** ! --- 44,52 ---- ! /** \brief this causes lots of extra checks to be performed on object-by-object ! synch comparison. This is ok for testing on lan, but is best set to false ! for internet play, and non-testing compilations. ! */ ! bool detailed_network_check = false; *************** *** 635,639 **** heavy_compare(); // compare all "live" items - return; // the minor compare is irrelevant, and hardly useful unsigned char local_checksum = checksum() & 255; --- 639,642 ---- *************** *** 778,782 **** void Game::net_expect(int val) { ! // return; int k; --- 781,786 ---- void Game::net_expect(int val) { ! if (!detailed_network_check) ! return; int k; *************** *** 1758,1766 **** void Game::heavy_compare() { int p; const int max_comp = 512; ! int posval[max_comp]; ! int velval[max_comp]; int N, Nprev; --- 1762,1772 ---- void Game::heavy_compare() { + if (!detailed_network_check) + return; + int p; const int max_comp = 512; ! int val[max_comp]; int N, Nprev; *************** *** 1786,1797 **** if (log_synched) { - // only update, in synched mode - in true-time, comparisons like this - // are impossible in a buffered channel. - Nprev = N; - // only compare for player > 0, otherwise you've nothing to compare to if (p > 0 && N != Nprev) tw_error("different number of items between games"); } --- 1792,1802 ---- if (log_synched) { // only compare for player > 0, otherwise you've nothing to compare to if (p > 0 && N != Nprev) tw_error("different number of items between games"); + // only update, in synched mode - in true-time, comparisons like this + // are impossible in a buffered channel. + Nprev = N; } *************** *** 1801,1805 **** { ! int testpos, testvel; if (!log_synched) --- 1806,1810 ---- { ! int test, id; if (!log_synched) *************** *** 1807,1837 **** // only generate in true-time // otherwise, N may differ from the true number of items in the game. ! testpos = item[i]->pos.x + item[i]->pos.y; ! testvel = item[i]->vel.x + item[i]->vel.y; } // exchange ! log_int(testpos); ! ! log_int(testvel); // use the data in game-time if (log_synched) { - // also needs to be done for player 0 - // only update/compare while you're in synched mode. - posval[i] = testpos; - velval[i] = testvel; - if (p > 0) { ! // compare previous player to current player ! if (testpos != posval[i]) ! tw_error("Differing position values between game items"); ! ! if (testvel != velval[i]) ! tw_error("Differing position values between game items"); } } --- 1812,1839 ---- // only generate in true-time // otherwise, N may differ from the true number of items in the game. ! test = item[i]->pos.x + item[i]->pos.y + ! item[i]->vel.x + item[i]->vel.y; ! id = item[i]->debug_id; } // exchange ! log_int(test); ! log_int(id); // use the data in game-time if (log_synched) { if (p > 0) { ! // compare previous player to current player ! if (test != val[i]) ! tw_error("Differing position/velocity values between game items, debug_id = %i", id); } + + // also needs to be done for player 0 + // only update/compare while you're in synched mode. + val[i] = test; + } Index: mgame.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** mgame.h 12 Mar 2004 20:14:59 -0000 1.15 --- mgame.h 13 Mar 2004 11:45:31 -0000 1.16 *************** *** 8,11 **** --- 8,13 ---- extern int interpolate_frames; + extern bool detailed_network_check; + void idle_extra(int time = 5); // adding extra network-share to avoid total standstill which may happen, very occasionally... Index: mshot.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshot.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** mshot.cpp 29 Jan 2004 21:20:29 -0000 1.14 --- mshot.cpp 13 Mar 2004 11:45:31 -0000 1.15 *************** *** 142,145 **** --- 142,154 ---- } + void Shot::scale_vel(double scale) + { + SpaceLocation::scale_vel(scale); + v *= scale; + range = d + (range - d) * scale; + // the remaining distance should also be scaled, otherwise it could live forever. + } + + AnimatedShot::AnimatedShot(SpaceLocation *creator, Vector2 rpos, double oangle, double ov, double odamage, double orange, double oarmour, SpaceLocation *opos, Index: mshot.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshot.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mshot.h 10 Jan 2004 22:27:59 -0000 1.4 --- mshot.h 13 Mar 2004 11:45:31 -0000 1.5 *************** *** 35,38 **** --- 35,40 ---- virtual void changeDirection(double oangle); int isHomingMissile(); + + virtual void scale_vel(double scale); }; |
From: <geo...@us...> - 2004-03-13 11:54:18
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30266/games Modified Files: ghyper.cpp Log Message: net update + hypermelee fix Index: ghyper.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ghyper.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ghyper.cpp 29 Jan 2004 21:20:28 -0000 1.9 --- ghyper.cpp 13 Mar 2004 11:45:31 -0000 1.10 *************** *** 23,27 **** public: double friction; ! virtual void calculate(int time); virtual void init(Log *_log); virtual void set_resolution (int screen_x, int screen_y); --- 23,27 ---- public: double friction; ! virtual void calculate(); virtual void init(Log *_log); virtual void set_resolution (int screen_x, int screen_y); *************** *** 82,101 **** } ! void HyperMelee::calculate(int time) { ! STACKTRACE int i; ! for (i = 0; i < num_items; i += 1) { ! if (item[i]->exists() && !item[i]->isPlanet()) { ! item[i]->vel *= 1 - friction * time; ! if (item[i]->isShot()) { ! Shot *s = (Shot*)item[i]; ! s->v *= 1 - friction * time; ! s->range = s->d + (s->range - s->d) * (1 - friction * time); ! } ! } ! } ! NormalGame::calculate(); } REGISTER_GAME ( HyperMelee, "Melee in Hyperspace"); --- 82,100 ---- } ! void HyperMelee::calculate() ! { ! STACKTRACE; ! ! int time = frame_time; int i; ! for (i = 0; i < num_items; i += 1) ! { ! if (item[i]->exists() && !item[i]->isPlanet()) ! item[i]->scale_vel(1 - friction * time); } + NormalGame::calculate(); + } + REGISTER_GAME ( HyperMelee, "Melee in Hyperspace"); |
From: <geo...@us...> - 2004-03-13 11:54:17
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30266 Modified Files: scp.cpp Log Message: net update + hypermelee fix Index: scp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/scp.cpp,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** scp.cpp 12 Mar 2004 20:18:13 -0000 1.59 --- scp.cpp 13 Mar 2004 11:45:30 -0000 1.60 *************** *** 802,805 **** --- 802,806 ---- set_config_int("Network", "Nhumans", Nplayers); set_config_int("Network", "Nbots", Nbots); + set_config_string("Network", "GameName", temp_gamename); p_local = 0; // IMPORTANT TO SET THIS !! *************** *** 925,930 **** // user menu: enter adress and port number ! if (connect_menu(&videosystem.window, &tmp, &port) == -1) ! return; // saving address --- 926,931 ---- // user menu: enter adress and port number ! // if (connect_menu(&videosystem.window, &tmp, &port) == -1) ! // return; // saving address |
From: <geo...@us...> - 2004-03-12 22:17:42
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31400/games Modified Files: ggob.h gsample.cpp Log Message: disabled warnings Index: ggob.h =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ggob.h 5 Mar 2004 17:51:28 -0000 1.17 --- ggob.h 12 Mar 2004 21:57:54 -0000 1.18 *************** *** 2,5 **** --- 2,9 ---- #define __GGOB_H__ + #ifdef ALLEGRO_MSVC + #pragma warning (disable:4786) // identifier was truncated to '255' characters in the browser information + #endif + #include <list> #include <string> Index: gsample.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gsample.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gsample.cpp 12 Mar 2004 20:14:56 -0000 1.10 --- gsample.cpp 12 Mar 2004 21:57:54 -0000 1.11 *************** *** 490,491 **** --- 490,492 ---- REGISTER_GAME(SampleGame3, "Sample 3: Eternal Arena") + |