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: <geo...@us...> - 2004-03-12 22:17:42
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31400/other Modified Files: gconfig.cpp gevent.cpp gevent.h Log Message: disabled warnings Index: gconfig.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gconfig.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gconfig.cpp 5 Mar 2004 17:53:10 -0000 1.1 --- gconfig.cpp 12 Mar 2004 21:57:54 -0000 1.2 *************** *** 15,18 **** --- 15,22 ---- */ + #ifdef ALLEGRO_MSVC + #pragma warning (disable:4786) // identifier was truncated to '255' characters in the browser information + #endif + extern "C" { # include "lua.h" *************** *** 37,43 **** ! #ifdef ALLEGRO_MSVC ! #pragma warning (disable:4786) ! #endif ////////////////////////////////////////////////////////////////////////////////////////////// --- 41,46 ---- ! ! ////////////////////////////////////////////////////////////////////////////////////////////// Index: gevent.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gevent.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gevent.cpp 2 Mar 2004 12:33:51 -0000 1.7 --- gevent.cpp 12 Mar 2004 21:57:54 -0000 1.8 *************** *** 1,2 **** --- 1,3 ---- + #include <allegro.h> *************** *** 5,9 **** #endif - #include "../melee.h" REGISTER_FILE --- 6,9 ---- Index: gevent.h =================================================================== RCS file: /cvsroot/timewarp/source/other/gevent.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gevent.h 2 Mar 2004 12:33:51 -0000 1.7 --- gevent.h 12 Mar 2004 21:57:54 -0000 1.8 *************** *** 2,5 **** --- 2,9 ---- #define __GEVENT_H__ + #ifdef ALLEGRO_MSVC + #pragma warning (disable:4786) + #endif + #include <utility> #include <functional> *************** *** 101,105 **** class EventHandler; ! typedef std::set<EventHandler*> EventHandlerList; class EventListner --- 105,109 ---- class EventHandler; ! typedef std::set<class EventHandler*> EventHandlerList; class EventListner *************** *** 115,119 **** }; ! typedef std::map<EventListner*, std::set<int> > EventListnersList; /*! \brief Gather event from various sources, and pass them to event listrens */ --- 119,123 ---- }; ! typedef std::map<class EventListner*, std::set<int> > EventListnersList; /*! \brief Gather event from various sources, and pass them to event listrens */ *************** *** 130,133 **** - #endif // __GEVENT_H__ --- 134,136 ---- |
From: <geo...@us...> - 2004-03-12 20:41:33
|
Update of /cvsroot/timewarp/interfaces/multiplayer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9942 Added Files: accept_default.bmp backgr.bmp bots_backgr.bmp bots_dec_default.bmp bots_inc_default.bmp cancel_default.bmp humans_backgr.bmp humans_dec_default.bmp humans_inc_default.bmp info.txt type_backgr.bmp Log Message: adding host-network interface --- NEW FILE: accept_default.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: backgr.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: bots_backgr.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: bots_dec_default.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: bots_inc_default.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: cancel_default.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: humans_backgr.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: humans_dec_default.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: humans_inc_default.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: info.txt --- interfaces/multiplayer/type_backgr_y = 159 interfaces/multiplayer/type_backgr_x = 94 interfaces/multiplayer/bots_inc_default_y = 282 interfaces/multiplayer/bots_inc_default_x = 590 interfaces/multiplayer/bots_dec_default_y = 282 interfaces/multiplayer/bots_dec_default_x = 61 interfaces/multiplayer/bots_backgr_y = 288 interfaces/multiplayer/bots_backgr_x = 220 interfaces/multiplayer/humans_inc_default_y = 60 interfaces/multiplayer/humans_inc_default_x = 583 interfaces/multiplayer/humans_dec_default_y = 56 interfaces/multiplayer/humans_dec_default_x = 81 interfaces/multiplayer/humans_backgr_y = 46 interfaces/multiplayer/humans_backgr_x = 219 interfaces/multiplayer/cancel_default_y = 150 interfaces/multiplayer/cancel_default_x = 1 interfaces/multiplayer/accept_default_y = 153 interfaces/multiplayer/accept_default_x = 707 autoplace = 1 res = 800 --- NEW FILE: type_backgr.bmp --- (This appears to be a binary file; contents omitted.) |
From: <geo...@us...> - 2004-03-12 20:41:33
|
Update of /cvsroot/timewarp/interfaces/multiplayer/gamelist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9942/gamelist Added Files: backgr.bmp info.txt list_backgr.bmp Log Message: adding host-network interface --- NEW FILE: backgr.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: info.txt --- interfaces/multiplayer/gamelist/list_backgr_y = 6 interfaces/multiplayer/gamelist/list_backgr_x = 6 res = 800 autoplace = 1 [Network] Nhumans = 2 Nbots = 0 --- NEW FILE: list_backgr.bmp --- (This appears to be a binary file; contents omitted.) |
From: <geo...@us...> - 2004-03-12 20:39:04
|
Update of /cvsroot/timewarp/interfaces/multiplayer/gamelist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9639/gamelist Log Message: Directory /cvsroot/timewarp/interfaces/multiplayer/gamelist added to the repository |
From: <geo...@us...> - 2004-03-12 20:38:48
|
Update of /cvsroot/timewarp/interfaces/multiplayer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9551/multiplayer Log Message: Directory /cvsroot/timewarp/interfaces/multiplayer added to the repository |
From: <geo...@us...> - 2004-03-12 20:37:58
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9448 Modified Files: scp.cpp Log Message: no message Index: scp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/scp.cpp,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** scp.cpp 12 Mar 2004 20:14:52 -0000 1.58 --- scp.cpp 12 Mar 2004 20:18:13 -0000 1.59 *************** *** 925,933 **** // user menu: enter adress and port number ! // if (connect_menu(&videosystem.window, &tmp, &port) == -1) ! // return; // saving address ! // set_config_string("Network", "Address", tmp); message.out("Connecting to server..."); --- 925,933 ---- // user menu: enter adress and port number ! if (connect_menu(&videosystem.window, &tmp, &port) == -1) ! return; // saving address ! set_config_string("Network", "Address", tmp); message.out("Connecting to server..."); |
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8642/games Modified Files: gamehierarchy.cpp gflmelee.cpp ggob.cpp gmissions.cpp gsample.cpp gsarena.cpp gtrug.cpp vanguard.cpp vgGenSys.cpp Log Message: network update Index: gamehierarchy.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gamehierarchy.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gamehierarchy.cpp 29 Jan 2004 21:20:27 -0000 1.9 --- gamehierarchy.cpp 12 Mar 2004 20:14:55 -0000 1.10 *************** *** 32,40 **** // play_music(); ! if ((next_tic_time <= time) && (next_render_time > game_time) && game_ready()) { calculate(); if (auto_unload) unload_unused_ship_data();//expiremental ! log->flush(); ! log->listen(); if (key[KEY_F4]) turbo = f4_turbo; --- 32,48 ---- // play_music(); ! if ((next_tic_time <= time) && (next_render_time > game_time) && ! (game_ready() || game_time == 0)) // note that game_time==0 is also needed, cause otherwise it'll wait for data, while no data've been generated yet. ! { ! _STACKTRACE("Game::play - Game physics"); ! ! gen_buffered_data(); ! glog->flush_noblock(); ! glog->listen(); ! calculate(); + if (auto_unload) unload_unused_ship_data();//expiremental ! if (key[KEY_F4]) turbo = f4_turbo; *************** *** 53,57 **** next_render_time = game_time + msecs_per_render; } ! else idle(); while (keypressed()) handle_key(readkey()); --- 61,65 ---- next_render_time = game_time + msecs_per_render; } ! else idle(1); while (keypressed()) handle_key(readkey()); *************** *** 82,86 **** asubgame->window->locate(0,0,0,0,0,1,0,1); ! asubgame->init(log); // all subgames share the same log (is this ok?) // this init should reference the already-initialized melee-data of the maingame --- 90,94 ---- asubgame->window->locate(0,0,0,0,0,1,0,1); ! asubgame->init(glog); // all subgames share the same log (is this ok?) // this init should reference the already-initialized melee-data of the maingame *************** *** 94,98 **** STACKTRACE ! subgame[k]->log->deinit(); // this is empty, dunno why // DATAFILE *d = melee; // remember this important pointer. --- 102,106 ---- STACKTRACE ! glog->deinit(); // this is empty, dunno why // DATAFILE *d = melee; // remember this important pointer. *************** *** 218,225 **** game_done = false; ! log = _log; ! if (!log) { ! log = new Log(); ! log->init(); } --- 226,233 ---- game_done = false; ! //log = _log; ! if (!glog) { ! glog = new Log(); ! glog->init(); } Index: gflmelee.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gflmelee.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** gflmelee.cpp 29 Feb 2004 23:22:17 -0000 1.21 --- gflmelee.cpp 12 Mar 2004 20:14:55 -0000 1.22 *************** *** 423,427 **** */ ! if (log->type == Log::log_net1server || log->type == Log::log_normal) { start_menu(allyfleet); --- 423,427 ---- */ ! if (glog->type == Log::log_net1server || glog->type == Log::log_normal) { start_menu(allyfleet); *************** *** 429,434 **** // send (or receive) ... channel_server is locally either the server, or the client. // fleet numbers are fixed: fleet 0 vs fleet 1 ! log_int(channel_server, allyfleet[0]); ! log_int(channel_server, allyfleet[1]); // team-numbers are fixed : fleet 0 vs fleet 1. --- 429,435 ---- // send (or receive) ... channel_server is locally either the server, or the client. // fleet numbers are fixed: fleet 0 vs fleet 1 ! channel_current = channel_server; ! log_int(allyfleet[0]); ! log_int(allyfleet[1]); // team-numbers are fixed : fleet 0 vs fleet 1. *************** *** 441,445 **** // note that channel_server/ channel_client are always local vs. remote, // log->type is host vs client. ! if (log->type == Log::log_net1server || log->type == Log::log_normal) { localplayer = 0; --- 442,446 ---- // note that channel_server/ channel_client are always local vs. remote, // log->type is host vs client. ! if (glog->type == Log::log_net1server || glog->type == Log::log_normal) { localplayer = 0; *************** *** 460,467 **** // create the remote player ! if (log->type == Log::log_net1server || log->type == Log::log_net1client) { // it's "client" from local perspective ??? ! c = create_control(channel_client, "Human"); playercontrols[remoteplayer] = c; add_focus(c, c->channel); --- 461,468 ---- // create the remote player ! if (glog->type == Log::log_net1server || glog->type == Log::log_net1client) { // it's "client" from local perspective ??? ! c = create_control(channel_player[1], "Human"); playercontrols[remoteplayer] = c; add_focus(c, c->channel); *************** *** 636,640 **** sprintf(txt, "gflmelee%02i.dat", radarlayout+1); ! if (log->type == Log::log_net1client) iplayer = remoteplayer; else --- 637,641 ---- sprintf(txt, "gflmelee%02i.dat", radarlayout+1); ! if (glog->type == Log::log_net1client) iplayer = remoteplayer; else Index: ggob.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ggob.cpp 5 Mar 2004 17:51:28 -0000 1.31 --- ggob.cpp 12 Mar 2004 20:14:55 -0000 1.32 *************** *** 315,354 **** int ichoice = 2; // default, "no" 'don't load a game ! //if (!lag_frames) ! //{ ! // // check a menu to see what the player wants ... how ?? ! // ichoice = tw_alert("Continue saved game?", "&YES", "&NO"); ! //} if (ichoice == 2) { ! int server_players, client_players; set_config_file("client.ini"); ! server_players = client_players = get_config_int("Gob", "NumPlayers", 1); ! if (!lag_frames) client_players = 0; ! log_int(channel_server, server_players); ! log_int(channel_client, client_players); ! for (i = 0; i < server_players; i += 1) { ! char buffy[256]; ! sprintf(buffy, "Config%d", i); ! add_gobplayer(create_control(channel_server, "Human", buffy)); ! gobplayer[i]->new_ship(shiptype("supbl")); ! Ship *s = gobplayer[i]->ship; ! s->translate(size/2-s->normal_pos()); ! double angle = PI2 * i / (client_players + server_players); ! s->translate(rotate(Vector2(260, 120), angle)); ! s->accelerate(s, PI2/3 + angle, 0.17, MAX_SPEED); } ! for (i = server_players; i < client_players + server_players; i += 1) { ! char buffy[256]; ! sprintf(buffy, "Config%d", i - server_players); ! add_gobplayer(create_control(channel_client, "Human", buffy)); gobplayer[i]->new_ship(shiptype("supbl")); Ship *s = gobplayer[i]->ship; ! s->translate(size/2-s->normal_pos()); ! double angle = PI2 * i / (client_players + server_players); s->translate(rotate(Vector2(260, 120), angle)); ! s->accelerate(s, PI2/3 + angle, 0.17, MAX_SPEED); } --- 315,363 ---- int ichoice = 2; // default, "no" 'don't load a game ! ! if (!lag_frames) ! { ! // check a menu to see what the player wants ... ! // (but only if it's not a networked game) ! ichoice = tw_alert("Continue saved game?", "&YES", "&NO"); ! } if (ichoice == 2) { ! int console_players; set_config_file("client.ini"); ! console_players = get_config_int("Gob", "NumPlayers", 1); ! ! 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 ! for (i = 0; i < console_players; i += 1) ! { ! ! char buffy[256]; ! sprintf(buffy, "Config%d", i); ! ! add_gobplayer(create_control(channel_player[p], "Human", buffy)); ! ++k; ! } } ! ! for ( i = 0; i < k; ++i ) ! { gobplayer[i]->new_ship(shiptype("supbl")); + Ship *s = gobplayer[i]->ship; ! s->translate( size/2 - s->normal_pos() ); ! ! double angle = (PI2 * i) / k; s->translate(rotate(Vector2(260, 120), angle)); ! ! s->accelerate(s, PI2/3 + angle, 0.17, MAX_SPEED); } *************** *** 357,370 **** // just supports ONE player. - int server_players = 1; - int client_players = 0; set_config_file("client.ini"); ! if (!lag_frames) client_players = 0; ! ! log_int(channel_server, server_players); ! log_int(channel_client, client_players); ! ! for (i = 0; i < server_players; i += 1) { char buffy[256]; sprintf(buffy, "Config%d", i); --- 366,372 ---- // just supports ONE player. set_config_file("client.ini"); ! for (i = 0; i < 1; i += 1) { char buffy[256]; sprintf(buffy, "Config%d", i); *************** *** 720,731 **** sprintf(buffy1, "Price: %d starbucks plus %d buckazoids", price_starbucks, price_buckazoids); if ((starbucks < price_starbucks) || (buckazoids < price_buckazoids)) { ! if (game->is_local(channel)) alert("You don't have enough.", name, buffy1, "Cancel", NULL, 0, 0); return 0; } int r = 0; ! if (game->is_local(channel)) r = alert ("Do you wish to make this purchase?", name, buffy1, "&No", "&Yes", 'n', 'y'); ! game->log_int(channel, r); if (r == 2) { starbucks -= price_starbucks; --- 722,733 ---- sprintf(buffy1, "Price: %d starbucks plus %d buckazoids", price_starbucks, price_buckazoids); if ((starbucks < price_starbucks) || (buckazoids < price_buckazoids)) { ! if (is_local(channel)) alert("You don't have enough.", name, buffy1, "Cancel", NULL, 0, 0); return 0; } int r = 0; ! if (is_local(channel)) r = alert ("Do you wish to make this purchase?", name, buffy1, "&No", "&Yes", 'n', 'y'); ! log_int(r, channel); if (r == 2) { starbucks -= price_starbucks; *************** *** 758,762 **** panel->always_redraw = true; panel->window->init(game->window); ! if (game->is_local(control->channel)) { panel->window->locate( 0,0.9, --- 760,764 ---- panel->always_redraw = true; panel->window->init(game->window); ! if (is_local(control->channel)) { panel->window->locate( 0,0.9, *************** *** 799,803 **** if (otype == ntype) { sprintf (buffy1, "You already have a %s", ntype->name); ! if (game->is_local(s->channel)) alert(buffy1, NULL, NULL, "&Cancel", NULL, 'c', 0); return; --- 801,805 ---- if (otype == ntype) { sprintf (buffy1, "You already have a %s", ntype->name); ! if (is_local(s->channel)) alert(buffy1, NULL, NULL, "&Cancel", NULL, 'c', 0); return; *************** *** 811,817 **** if ((nssb <= (ossb + s->starbucks)) && (nsbz <= (osbz + s->buckazoids))) { int i = 0; ! if (game->is_local(s->channel)) i = alert(buffy1, buffy2, "Do you wish to buy it?", "Yeah!", "No", 'y', 'n'); ! game->log_int(s->channel, i); if (i == 1) { s->starbucks -= nssb - ossb; --- 813,819 ---- if ((nssb <= (ossb + s->starbucks)) && (nsbz <= (osbz + s->buckazoids))) { int i = 0; ! if (is_local(s->channel)) i = alert(buffy1, buffy2, "Do you wish to buy it?", "Yeah!", "No", 'y', 'n'); ! log_int(i, s->channel); if (i == 1) { s->starbucks -= nssb - ossb; *************** *** 821,825 **** } else { ! if (game->is_local(s->channel)) alert (buffy1, buffy2, "You don't have enough to buy it", "Cancel", NULL, 0, 0); } --- 823,827 ---- } else { ! if (is_local(s->channel)) alert (buffy1, buffy2, "You don't have enough to buy it", "Cancel", NULL, 0, 0); } *************** *** 893,899 **** sprintf(dialog_string[0], "%03d Starbucks %03d Buckazoids", s->starbucks, s->buckazoids); int r = 0; ! if (game->is_local(s->channel)) r = tw_do_dialog(game->window, station_dialog, STATION_DIALOG_DEPART); ! game->log_int(s->channel, r); switch (r) { case STATION_DIALOG_UPGRADE: { --- 895,901 ---- sprintf(dialog_string[0], "%03d Starbucks %03d Buckazoids", s->starbucks, s->buckazoids); int r = 0; ! if (is_local(s->channel)) r = tw_do_dialog(game->window, station_dialog, STATION_DIALOG_DEPART); ! log_int(r, s->channel); switch (r) { case STATION_DIALOG_UPGRADE: { *************** *** 912,916 **** case STATION_DIALOG_REPAIR: { if (s->ship->crew == s->ship->crew_max) { ! if (game->is_local(s->channel)) alert("You don't need repairs", "", "", "Oh, okay", "I knew that", 0, 0); --- 914,918 ---- case STATION_DIALOG_REPAIR: { if (s->ship->crew == s->ship->crew_max) { ! if (is_local(s->channel)) alert("You don't need repairs", "", "", "Oh, okay", "I knew that", 0, 0); *************** *** 918,924 **** } int p = 0; ! if (game->is_local(s->channel)) p = alert3("Which would you prefer", "to pay for your repairs", "", "1 &Starbuck", "1 &Buckazoid", "&Nothing!", 's', 'b', 'n'); ! game->log_int(s->channel, p); switch (p) { --- 920,926 ---- } int p = 0; ! if (is_local(s->channel)) p = alert3("Which would you prefer", "to pay for your repairs", "", "1 &Starbuck", "1 &Buckazoid", "&Nothing!", 's', 'b', 'n'); ! log_int(p, s->channel); switch (p) { *************** *** 931,935 **** else { ! if (game->is_local(s->channel)) alert("You don't have enough!", NULL, NULL, "&Shit", NULL, 's', 0); } --- 933,937 ---- else { ! if (is_local(s->channel)) alert("You don't have enough!", NULL, NULL, "&Shit", NULL, 's', 0); } *************** *** 943,947 **** else { ! if (game->is_local(s->channel)) alert("You don't have enough!", NULL, NULL, "&Shit", NULL, 's', 0); } --- 945,949 ---- else { ! if (is_local(s->channel)) alert("You don't have enough!", NULL, NULL, "&Shit", NULL, 's', 0); } *************** *** 1052,1064 **** num_upgrade_indexes = j; int m = 0; ! if (game->is_local(gs->channel)) m = tw_do_dialog(game->window, upgrade_dialog, UPGRADE_DIALOG_EXIT); ! game->log_int(gs->channel, m); if (m == UPGRADE_DIALOG_EXIT) return; if (m == UPGRADE_DIALOG_LIST) { int i = 0; ! if (game->is_local(gs->channel)) i = upgrade_dialog[UPGRADE_DIALOG_LIST].d1; ! game->log_int(gs->channel, i); i = upgrade_index[i]; Upgrade *u = gs->upgrade_list[i]; --- 1054,1066 ---- num_upgrade_indexes = j; int m = 0; ! if (is_local(gs->channel)) m = tw_do_dialog(game->window, upgrade_dialog, UPGRADE_DIALOG_EXIT); ! log_int(m, gs->channel); if (m == UPGRADE_DIALOG_EXIT) return; if (m == UPGRADE_DIALOG_LIST) { int i = 0; ! if (is_local(gs->channel)) i = upgrade_dialog[UPGRADE_DIALOG_LIST].d1; ! log_int(i, gs->channel); i = upgrade_index[i]; Upgrade *u = gs->upgrade_list[i]; *************** *** 1206,1210 **** int i = 0; i = p->control->choose_ship(game->window, "You found the Rainbow Rift!", reference_fleet); ! game->log_int(p->channel, i); if (i == -1) i = random(reference_fleet->getSize()); game->redraw(); --- 1208,1212 ---- int i = 0; i = p->control->choose_ship(game->window, "You found the Rainbow Rift!", reference_fleet); ! log_int(i, p->channel); if (i == -1) i = random(reference_fleet->getSize()); game->redraw(); Index: gmissions.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gmissions.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** gmissions.cpp 29 Feb 2004 23:22:17 -0000 1.25 --- gmissions.cpp 12 Mar 2004 20:14:55 -0000 1.26 *************** *** 187,191 **** Ship *s; ! s = game->create_ship(game->channel_none, "zfpst", "WussieBot", P, A, get_team()); game->add(s); --- 187,191 ---- Ship *s; ! s = game->create_ship(channel_none, "zfpst", "WussieBot", P, A, get_team()); game->add(s); Index: gsample.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gsample.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gsample.cpp 29 Jan 2004 21:20:28 -0000 1.9 --- gsample.cpp 12 Mar 2004 20:14:56 -0000 1.10 *************** *** 31,34 **** --- 31,35 ---- #include "../melee/mitems.h" //indicators... #include "../melee/mfleet.h" //fleets... + #include "../scp.h" *************** *** 149,153 **** }; ! void SampleGame2::init(Log *_log) { Game::init(_log); --- 150,155 ---- }; ! void SampleGame2::init(Log *_log) ! { Game::init(_log); *************** *** 179,241 **** enemies = new_team(); - Control *c = create_control(channel_server, "Human"); //this is where we deviate from SampleGame1 Fleet fleet;//first we declare a fleet log_file("fleets/all.scf"); //this is a fleet file containing every ship (more or less) fleet.load(NULL, "Fleet"); - //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) - //but that's not network enabled, so we manually load the file using the network-enabled log_file(), and pass NULL for the file name - //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) - i = 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 - //now i is the number of the ship that the user selected from that list - log_int(channel_server, i); - //necessary for networking... because i would otherwise be different on the 2 computers... - //channel_server is used instead of channel_client becaues we want the servers value to override the clients - if (i == -1) i = random(fleet.getSize()); - //handles the case where random or always random was used ! //now we're back to the way we were in SampleGame1 for a little bit ! Ship *s = create_ship(fleet.getShipType(i)->id, c, Vector2(size.x/2 + 100, size.y), 0, humans); ! add(s->get_ship_phaser()); ! add_focus(s, channel_server); ! //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 ! ShipPanel *sp = new ShipPanel(s); //here we create a ship panel for our ship ! sp->window->init(window); //here we tell the ship panel to display itself on our games window ! //this next bit of code tells the ship panel where on our display it should show up ! //it's little complicated, so I'll try to explain: ! //the location is made up of 4 pairs ! //the first 2 pairs describe the X & Y coordinates of the upper left corner ! //the next 2 pairs describe the width & height ! //the first number in each pair is a number of pixels ! //the second number is a portion of the screen width or height ! sp->window->locate( ! //the first pair of numbers describes the X coordinate of the ! //upper left hand corner of the ship panel ! //-PANEL_WIDTH, 1 means it should be -PANEL_WIDTH + 1 * SCREEN_WIDTH ! //or, in english, PANEL_WIDTH to the left of the right edge of the screen ! -PANEL_WIDTH, 1, ! //the second pair of numbers describes the Y coordinate of the ! //upper left hand corner of the ship panel ! //0, 0 means it should be 0 + 0 * SCREEN_HEIGHT ! //or, in english, the top edge of the screen ! 0, 0, ! //the third pair of numbers describes the width of the ship panel ! //PANEL_WIDTH, 0 means it should be PANEL_WIDTH + 0 * SCREEN_WIDTH ! //or, in english, the normal width for a panel ! PANEL_WIDTH, 0, ! //the fourth pair of numbers describes the height of the ship panel ! PANEL_HEIGHT, 0 ! ); ! add(sp); //now we make the panel appear in the game ! if ((log->type == Log::log_net1server) || (log->type == Log::log_net1client)) { //if we're in a network game... //then do the same thing, only for the other player --- 181,276 ---- enemies = new_team(); + // re-use the same fleet for all players. //this is where we deviate from SampleGame1 Fleet fleet;//first we declare a fleet log_file("fleets/all.scf"); //this is a fleet file containing every ship (more or less) fleet.load(NULL, "Fleet"); ! 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) ! //but that's not network enabled, so we manually load the file using the network-enabled log_file(), and pass NULL for the file name ! //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 ! // will be after the share_update, so specify the slot here already ! 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]; ! ! //necessary for networking... because i would otherwise be different on the 2 computers... ! //channel_server is used instead of channel_client becaues we want the servers value to override the clients ! if (i == -1) i = random(fleet.getSize()); ! //handles the case where random or always random was used ! ! //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 ! ! ShipPanel *sp = new ShipPanel(s); //here we create a ship panel for our ship ! sp->window->init(window); //here we tell the ship panel to display itself on our games window ! //this next bit of code tells the ship panel where on our display it should show up ! //it's little complicated, so I'll try to explain: ! //the location is made up of 4 pairs ! //the first 2 pairs describe the X & Y coordinates of the upper left corner ! //the next 2 pairs describe the width & height ! //the first number in each pair is a number of pixels ! //the second number is a portion of the screen width or height ! sp->window->locate( ! //the first pair of numbers describes the X coordinate of the ! //upper left hand corner of the ship panel ! //-PANEL_WIDTH, 1 means it should be -PANEL_WIDTH + 1 * SCREEN_WIDTH ! //or, in english, PANEL_WIDTH to the left of the right edge of the screen ! -PANEL_WIDTH, 1, ! //the second pair of numbers describes the Y coordinate of the ! //upper left hand corner of the ship panel ! //0, 0 means it should be 0 + 0 * SCREEN_HEIGHT ! //or, in english, the top edge of the screen ! 0, 0, ! //the third pair of numbers describes the width of the ship panel ! //PANEL_WIDTH, 0 means it should be PANEL_WIDTH + 0 * SCREEN_WIDTH ! //or, in english, the normal width for a panel ! PANEL_WIDTH, 0, ! //the fourth pair of numbers describes the height of the ship panel ! PANEL_HEIGHT, 0 ! ); ! ! ! add(sp); //now we make the panel appear in the game ! } ! ! /* ! if ((glog->type == Log::log_net1server) || (glog->type == Log::log_net1client)) { //if we're in a network game... //then do the same thing, only for the other player *************** *** 257,260 **** --- 292,296 ---- add(sp); } + */ //now, we need some enemies to fight *************** *** 343,347 **** //player 1 selects a new ship i = human_control[0]->choose_ship(window, "Hey You!\nPick a ship!", reference_fleet); ! log_int(channel_server, i); 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); --- 379,383 ---- //player 1 selects a new ship i = human_control[0]->choose_ship(window, "Hey You!\nPick a ship!", reference_fleet); ! 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); *************** *** 360,367 **** add(sp); ! if ((log->type == Log::log_net1server) || (log->type == Log::log_net1client)) { log_file("fleets/all.scf"); i = human_control[1]->choose_ship(window, "Hey You!\nPick a ship!", reference_fleet); ! log_int(channel_client, i); 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); --- 396,403 ---- add(sp); ! if ((glog->type == Log::log_net1server) || (glog->type == Log::log_net1client)) { 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); *************** *** 430,437 **** //BTW, if you have multiple focuses, the camera will track one of them, and the player can switch which one by pressing F3 ! if ((log->type == Log::log_net1server) || (log->type == Log::log_net1client)) { ! human_control[1] = create_control(channel_client, "Human"); human_control[1]->target_sign_color = 2; ! add_focus(human_control[1], channel_client); } else human_control[1] = NULL; --- 466,473 ---- //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; *************** *** 442,446 **** for (i = 0; i < 7; i += 1) add(new Asteroid()); ! if (log->type == Log::log_net1server) fleet.load("fleets/all.scf", "Fleet"); log_fleet(channel_server, &fleet); //this time, instead of transmitting the fleet file over the network and then loading --- 478,482 ---- for (i = 0; i < 7; i += 1) add(new Asteroid()); ! if (glog->type == Log::log_net1server) fleet.load("fleets/all.scf", "Fleet"); log_fleet(channel_server, &fleet); //this time, instead of transmitting the fleet file over the network and then loading Index: gsarena.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gsarena.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gsarena.cpp 29 Jan 2004 21:20:28 -0000 1.10 --- gsarena.cpp 12 Mar 2004 20:14:56 -0000 1.11 *************** *** 14,17 **** --- 14,18 ---- #include "../melee/mfleet.h" #include "../other/orbit.h" + #include "../scp.h" class SuperArena : public Game { //declaring our game type *************** *** 131,135 **** if (fleet->getSize()>0) { i = human_control[0]->choose_ship(window, "player 1 \nship 1", fleet); ! log_int(channel_server, i); 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]); --- 132,136 ---- 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]); *************** *** 143,156 **** } ! if ((log->type == Log::log_net1server) || (log->type == Log::log_net1client)) { fleet->load("fleets.ini", "Player2"); ! log_fleet(channel_client, fleet); if (fleet->getSize()>0) { i = human_control[1]->choose_ship(window, "player 2 \nship 1", fleet); ! log_int(channel_client, i); 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_client); human_panel[1] = new ShipPanel(s); human_panel[0]->window->init(window); --- 144,157 ---- } ! 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); *************** *** 173,177 **** sprintf( buf, "Player 1 \nShip %d", j+1 ); i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(channel_server, i); 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]); --- 174,178 ---- 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]); *************** *** 197,201 **** sprintf( buf, "Player 2 \nShip %d", j+1 ); i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(channel_server, i); 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]); --- 198,202 ---- 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]); *************** *** 223,227 **** sprintf( buf, "Player 3 \nShip %d", j+1 ); i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(channel_server, i); 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]); --- 224,228 ---- 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]); *************** *** 248,252 **** sprintf( buf, "Player 4 \nShip %d", j+1 ); i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(channel_server, i); 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]); --- 249,253 ---- 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]); *************** *** 274,278 **** sprintf( buf, "Player 5 \nShip %d", j+1 ); i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(channel_server, i); 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]); --- 275,279 ---- 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]); *************** *** 299,303 **** sprintf( buf, "Player 6 \nShip %d", j+1 ); i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(channel_server, i); 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]); --- 300,304 ---- 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]); *************** *** 324,328 **** sprintf( buf, "Player 7 \nShip %d", j+1 ); i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(channel_server, i); 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]); --- 325,329 ---- 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]); *************** *** 349,353 **** sprintf( buf, "Player 8 \nShip %d", j+1 ); i = human_control[0]->choose_ship(window, buf, fleet); ! log_int(channel_server, i); 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]); --- 350,354 ---- 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]); *************** *** 454,459 **** human_control[0] = create_control(channel_server, "Human"); ! if ((log->type == Log::log_net1server) || (log->type == Log::log_net1client)) { ! human_control[1] = create_control(channel_client, "Human"); } else human_control[1] = NULL; --- 455,460 ---- 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; Index: gtrug.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gtrug.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gtrug.cpp 29 Feb 2004 23:22:17 -0000 1.10 --- gtrug.cpp 12 Mar 2004 20:14:56 -0000 1.11 *************** *** 223,232 **** TrugPlayer *sp = add_player ( channel_server ); ! TrugPlayer *cp = add_player ( channel_client ); add(create_ship("kzedr", sp, random(size), random(PI2))); add(create_ship("chebr", cp, random(size), random(PI2))); ! if (log->type == Log::log_net1client) add(gui = new TrugGUI( cp )); else --- 223,232 ---- TrugPlayer *sp = add_player ( channel_server ); ! TrugPlayer *cp = add_player ( channel_player[1] ); add(create_ship("kzedr", sp, random(size), random(PI2))); add(create_ship("chebr", cp, random(size), random(PI2))); ! if (glog->type == Log::log_net1client) add(gui = new TrugGUI( cp )); else *************** *** 236,240 **** } ! TrugWidget::TrugWidget ( ) : channel(Game::channel_none) {} SpaceLocation *TrugWidget::get_focus() {return NULL;} void TrugWidget::next_focus() {} --- 236,240 ---- } ! TrugWidget::TrugWidget ( ) : channel(channel_none) {} SpaceLocation *TrugWidget::get_focus() {return NULL;} void TrugWidget::next_focus() {} Index: vanguard.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/vanguard.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** vanguard.cpp 29 Jan 2004 21:20:28 -0000 1.12 --- vanguard.cpp 12 Mar 2004 20:14:56 -0000 1.13 *************** *** 555,559 **** LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You!\nPick a ship!", &fleet); ! log_int(channel_server, i); if (i == -1) i = random() % fleet.getSize(); // HumanPlayer1 = create_ship(fleet.getShipType(i)->id, human_control[0], tw_random(Vector2(width, height)));rand()%(int)width, rand()%(int)height, 0, human_team); --- 555,559 ---- LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You!\nPick a ship!", &fleet); ! log_int(i, channel_server); if (i == -1) i = random() % fleet.getSize(); // HumanPlayer1 = create_ship(fleet.getShipType(i)->id, human_control[0], tw_random(Vector2(width, height)));rand()%(int)width, rand()%(int)height, 0, human_team); *************** *** 567,579 **** add_focus(HumanPlayer1, channel_server); ! if ((log->type == Log::log_net1server) || (log->type == Log::log_net1client)) { LOAD_FLEET i = human_control[1]->choose_ship(window, "Hey You Player!\nPick a ship!", &fleet); ! log_int(channel_client, i); 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_client); human_panel[1] = new ShipPanel(s); human_panel[1]->window->init(window); --- 567,579 ---- add_focus(HumanPlayer1, channel_server); ! if ((glog->type == Log::log_net1server) || (glog->type == Log::log_net1client)) { 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); *************** *** 587,591 **** LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI1!\nPick a ship!", &fleet); ! log_int(channel_server, i); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", width/4, height/4, random(PI2), enemy_team); --- 587,591 ---- LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI1!\nPick a ship!", &fleet); ! log_int(i, channel_server); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", width/4, height/4, random(PI2), enemy_team); *************** *** 595,599 **** LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI2!\nPick a ship!", &fleet); ! log_int(channel_server, i); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", width*3/4, height/4, random(PI2), enemy_team); --- 595,599 ---- LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI2!\nPick a ship!", &fleet); ! log_int(i, channel_server); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", width*3/4, height/4, random(PI2), enemy_team); *************** *** 603,607 **** LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI3!\nPick a ship!", &fleet); ! log_int(channel_server, i); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", width*3/4, height*3/4, random(PI2), enemy_team); --- 603,607 ---- LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI3!\nPick a ship!", &fleet); ! log_int(i, channel_server); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", width*3/4, height*3/4, random(PI2), enemy_team); *************** *** 611,615 **** LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI4!\nPick a ship!", &fleet); ! log_int(channel_server, i); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", width/4, height*3/4, random(PI2), enemy_team); --- 611,615 ---- LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI4!\nPick a ship!", &fleet); ! log_int(i, channel_server); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", width/4, height*3/4, random(PI2), enemy_team); *************** *** 619,623 **** LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI5!\nPick a ship!", &fleet); ! log_int(channel_server, i); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", rand()%(int)width, rand()%(int)height, random(PI2), enemy_team); --- 619,623 ---- LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI5!\nPick a ship!", &fleet); ! log_int(i, channel_server); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", rand()%(int)width, rand()%(int)height, random(PI2), enemy_team); *************** *** 627,631 **** LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI6!\nPick a ship!", &fleet); ! log_int(channel_server, i); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", random()%(int)width, random()%(int)height, random(PI2), enemy_team); --- 627,631 ---- LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI6!\nPick a ship!", &fleet); ! log_int(i, channel_server); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", random()%(int)width, random()%(int)height, random(PI2), enemy_team); *************** *** 635,639 **** LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI7!\nPick a ship!", &fleet); ! log_int(channel_server, i); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", random()%(int)width, random()%(int)height, random(PI2), enemy_team); --- 635,639 ---- LOAD_FLEET i = human_control[0]->choose_ship(window, "Hey You AI7!\nPick a ship!", &fleet); ! log_int(i, channel_server); if (i == -1) i = random() % fleet.getSize(); // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", random()%(int)width, random()%(int)height, random(PI2), enemy_team); *************** *** 846,851 **** human_control[0] = create_control(channel_server, "Human"); ! if ((log->type == Log::log_net1server) || (log->type == Log::log_net1client)) ! human_control[1] = create_control(channel_client, "Human"); else human_control[1] = NULL; --- 846,851 ---- 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; Index: vgGenSys.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/vgGenSys.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** vgGenSys.cpp 29 Feb 2004 23:22:17 -0000 1.11 --- vgGenSys.cpp 12 Mar 2004 20:14:56 -0000 1.12 *************** *** 13,16 **** --- 13,17 ---- #include "../melee/mlog.h" + #include "../scp.h" #ifndef _V_BODIES_H *************** *** 787,791 **** // initialization is for non-clients only ... ! if (log->type == Log::log_net1server || log->type == Log::log_normal) { --- 788,792 ---- // initialization is for non-clients only ... ! if (p_local == 0) // if you're the server { *************** *** 826,830 **** // share the result of the initialization. // send (or receive) ... channel_server is locally either the server, or the client. ! log_int(channel_server, i); --- 827,831 ---- // share the result of the initialization. // send (or receive) ... channel_server is locally either the server, or the client. ! log_int(i, channel_server); |
From: <geo...@us...> - 2004-03-12 20:35:33
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8642 Modified Files: scp.cpp scp.h Log Message: network update Index: scp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/scp.cpp,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** scp.cpp 4 Mar 2004 14:29:35 -0000 1.57 --- scp.cpp 12 Mar 2004 20:14:52 -0000 1.58 *************** *** 126,135 **** - void play_demo(const char *file_name = "demo.dmo") ; void play_game(const char *_gametype_name, Log *_log = NULL) ; void play_net1client ( const char * address = NULL, int port = -1 ) ; void play_net1server ( const char *_gametype_name, int port = -1 ) ; - int getKey(); [...973 lines suppressed...] *** 1105,1113 **** break; case MELEE_EX_DIALOG_SAVE_DEMO: { ! if (!old_game || !old_game->log) { tw_alert ( "Aaaaarggh! No recording to save!", ":("); return; } ! old_game->log->save("demo.dmo"); } break; --- 1782,1790 ---- break; case MELEE_EX_DIALOG_SAVE_DEMO: { ! if (!old_game || !glog) { tw_alert ( "Aaaaarggh! No recording to save!", ":("); return; } ! glog->save("demo.dmo"); } break; Index: scp.h =================================================================== RCS file: /cvsroot/timewarp/source/scp.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** scp.h 4 Feb 2004 10:36:28 -0000 1.7 --- scp.h 12 Mar 2004 20:14:54 -0000 1.8 *************** *** 2,5 **** --- 2,7 ---- #define __SCP_H__ + #include "melee/mlog.h" + const char *tw_version(); *************** *** 11,14 **** --- 13,31 ---- void ship_view_dialog(int si = 0, class Fleet *fleet = NULL); + extern Log *glog; //logging system for networking, demo recording/playback, etc. + void set_global(Log *somelog); + void log_char (char &data, int channel = channel_current); //helper for using the logging system + void log_char (unsigned char &data, int channel = channel_current); + void log_short(short &data, int channel = channel_current); //helper for using the logging system + void log_short(unsigned short &data, int channel = channel_current); + void log_int (int &data, int channel = channel_current); //helper for using the logging system + void log_int (unsigned int &data, int channel = channel_current); + void log_data (void *data, int length, int channel = channel_current); //helper for using the logging system + bool is_local (int channel); + void log_file (const char *fname); + + void test_net(); + + extern SAMPLE * menuAccept; extern SAMPLE * menuFocus; |
From: <geo...@us...> - 2004-03-12 20:35:33
|
Update of /cvsroot/timewarp/source/gamex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8642/gamex Modified Files: gamedata.cpp gamedata.h gamedata_map.cpp gameplanetscan.cpp gameplanetscan.h Log Message: network update Index: gamedata.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedata.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** gamedata.cpp 28 Feb 2004 15:18:24 -0000 1.16 --- gamedata.cpp 12 Mar 2004 20:14:57 -0000 1.17 *************** *** 22,25 **** --- 22,26 ---- IndexTypeList *starsurfacetypelist; IndexTypeList *mineraltypelist; + IndexTypeList *lifeformtypelist; IndexTypeList *structuretypelist; Index: gamedata.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedata.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** gamedata.h 28 Feb 2004 15:18:24 -0000 1.15 --- gamedata.h 12 Mar 2004 20:14:58 -0000 1.16 *************** *** 282,285 **** --- 282,286 ---- extern IndexTypeList *starsurfacetypelist; extern IndexTypeList *mineraltypelist; + extern IndexTypeList *lifeformtypelist; extern IndexTypeList *structuretypelist; Index: gamedata_map.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedata_map.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gamedata_map.cpp 29 Jan 2004 21:20:28 -0000 1.4 --- gamedata_map.cpp 12 Mar 2004 20:14:58 -0000 1.5 *************** *** 117,120 **** --- 117,121 ---- starsurfacetypelist = new IndexTypeList("gamex/stars/surface_*.ini"); mineraltypelist = new IndexTypeList("gamex/gamedata/mineraltypes/*.ini"); + lifeformtypelist = new IndexTypeList("gamex/gamedata/lifeformtypes/*.ini"); structuretypelist = new IndexTypeList("gamex/gamedata/structuretypes/*.ini"); Index: gameplanetscan.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gameplanetscan.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** gameplanetscan.cpp 29 Feb 2004 23:22:17 -0000 1.12 --- gameplanetscan.cpp 12 Mar 2004 20:14:58 -0000 1.13 *************** *** 28,32 **** #include "../melee/mshot.h" ! #include "../twgui/gamebuttonevent.h" --- 28,33 ---- #include "../melee/mshot.h" ! #include "twgui/twgui.h" ! #include "../other/configrw.h" *************** *** 892,911 **** // init stats ... sprintf(txt, "gamex/planetscan/surface_%s.ini", st); ! set_config_file(txt); ! nmin = get_config_int(0, "NumMin", 0); ! nmax = get_config_int(0, "NumMax", 10); ! avsize = get_config_int(0, "AvSize", 10); int i; for ( i = 0; i < mineraltypelist->N; ++i ) ! frac[i] = get_config_float("fraction", mineraltypelist->type[i].type_string, 0.0); ! int totfrac = 0; for ( i = 0; i < mineraltypelist->N; ++i ) ! totfrac += iround(frac[i]); for ( i = 0; i < mineraltypelist->N; ++i ) ! frac[i] /= totfrac; // so that the sum of all fractions == 1 --- 893,929 ---- // init stats ... sprintf(txt, "gamex/planetscan/surface_%s.ini", st); ! //set_config_file(txt); ! set_conf(txt, CONFIG_READ); ! section = 0; ! conf("NumMin", nmin, 0); ! conf("NumMax", nmax, 10); ! conf("AvSize", avsize, 10); + section = "fraction_mine"; int i; for ( i = 0; i < mineraltypelist->N; ++i ) ! conf(mineraltypelist->type[i].type_string, frac_mine[i], 0.0); ! int totfrac; ! totfrac = 0; for ( i = 0; i < mineraltypelist->N; ++i ) ! totfrac += iround(frac_mine[i]); for ( i = 0; i < mineraltypelist->N; ++i ) ! frac_mine[i] /= totfrac; ! // so that the sum of all fractions == 1 ! ! section = "fraction_life"; ! ! for ( i = 0; i < lifeformtypelist->N; ++i ) ! conf(lifeformtypelist->type[i].type_string, frac_life[i], 0.0); ! ! totfrac = 0; ! for ( i = 0; i < lifeformtypelist->N; ++i ) ! totfrac += iround(frac_life[i]); ! ! for ( i = 0; i < lifeformtypelist->N; ++i ) ! frac_life[i] /= totfrac; // so that the sum of all fractions == 1 *************** *** 983,993 **** ! // read the mineral loactions/ types from disk : sprintf(txt, "gamex/gamedata/surface/%08X.ini", body->id); ! set_config_file(txt); int N; ! N = get_config_int("minerals", "N", 0); for ( i = 0; i < N; ++i ) --- 1001,1012 ---- ! // read the mineral locations/ types from disk : sprintf(txt, "gamex/gamedata/surface/%08X.ini", body->id); ! set_conf(txt, CONFIG_READ); + section = "minerals"; int N; ! conf("N", N, 0); for ( i = 0; i < N; ++i ) *************** *** 997,1001 **** sprintf(id, "mineral%03i", i); ! strcpy(val, get_config_string("minerals", id, "")); double x, y; --- 1016,1021 ---- sprintf(id, "mineral%03i", i); ! //strcpy(val, get_config_string("minerals", id, "")); ! conf(id, val, ""); double x, y; *************** *** 1016,1022 **** } // read the structures ! N = get_config_int("structures", "N", 0); for ( i = 0; i < N; ++i ) --- 1036,1075 ---- } + // read the lifeform locations/ types from disk : + + section = "lifeforms"; + conf("N", N, 0); + + for ( i = 0; i < N; ++i ) + { + char id[512]; + char val[512]; + + sprintf(id, "lifeform%03i", i); + //strcpy(val, get_config_string("minerals", id, "")); + conf(id, val, ""); + + double x, y; + sscanf(val, "%lf %lf %s", &x, &y, id); + + int k; + k = lifeformtypelist->get_index(id, 0); + + SpaceSprite *spr; + spr = mineraltype[k]->sprite; + + life[i] = new Lifeform(0, Vector2(x,y) * scalesurface, 0, spr); + life[i]->type = lifeformtype[k]; + + add(life[i]); + } + + //en nog zorgen dat je een lifeform met een editor kunt neerzetten !! + // .. + // read the structures ! section = "structures"; ! conf("N", N, 0); for ( i = 0; i < N; ++i ) *************** *** 1026,1030 **** sprintf(id, "structure%03i", i); ! strcpy(val, get_config_string("structures", id, "")); double x, y; --- 1079,1084 ---- sprintf(id, "structure%03i", i); ! //strcpy(val, get_config_string("structures", id, "")); ! conf(id, val, ""); double x, y; *************** *** 1274,1277 **** --- 1328,1401 ---- + void GamePlanetscan::handle_ranlife() + { + int i; + + // delete existing lifeforms from the game: + for ( i = 0; i < num_items; ++i ) + { + if (item[i]->id == ID_LIFEFORM) + item[i]->state = 0; + } + + // place a number of lifeform sprites on the surface, of any type. + + int N; + char txt[512]; + + N = random(iround(nmin), iround(nmax)); + + for ( i = 0; i < N; ++i ) + { + // instead of :k = random(mineraltypelist->N); + // choose from a probability (-density-) distribution of the available types: + double r; + int k; + + r = random(1.0); + for ( k = 0; k < lifeformtypelist->N; ++k ) + { + r -= frac_life[k]; + if (r <= 0) + break; + } + if (k == lifeformtypelist->N) // invalid value (should not occur) + k = lifeformtypelist->N - 1; + + + SpaceSprite *spr; + spr = lifeformtype[k]->sprite; + + life[i] = new Lifeform(0, random(Vector2(400,200)) * scalesurface, 0, spr); + life[i]->type = lifeformtype[k]; + //life[i]->weight = 1; + //mine->init(mineralnamelist[k]); + + add(life[i]); + } + + + // write the lifeform locations/ types to disk : + + sprintf(txt, "gamex/gamedata/surface/%08X.ini", body->id); + set_config_file(txt); + + for ( i = 0; i < N; ++i ) + { + char id[512]; + char val[512]; + + set_config_int("lifeforms", "N", N); + + sprintf(id, "lifeform%03i", i); + sprintf(val, "%f %f %s", life[i]->pos.x/scalesurface, life[i]->pos.y/scalesurface, + life[i]->type->id); + set_config_string("lifeforms", id, val); + } + + flush_config_file(); + } + + void GamePlanetscan::handle_ranmin() { *************** *** 1302,1306 **** for ( k = 0; k < mineraltypelist->N; ++k ) { ! r -= frac[k]; if (r <= 0) break; --- 1426,1430 ---- for ( k = 0; k < mineraltypelist->N; ++k ) { ! r -= frac_mine[k]; if (r <= 0) break; *************** *** 1319,1338 **** add(mine[i]); - - - /* - k = random(Nlifeformtypes); - spr = lifeformtype[k]->sprite; - - Lifeform *life; - life = new Lifeform(0, random(Vector2(400,200)) * scalesurface, 0, spr); - //mine->init(mineralnamelist[k]); - - add(life); - */ } ! // write the mineral loactions/ types to disk : sprintf(txt, "gamex/gamedata/surface/%08X.ini", body->id); --- 1443,1450 ---- add(mine[i]); } ! // write the mineral locations/ types to disk : sprintf(txt, "gamex/gamedata/surface/%08X.ini", body->id); Index: gameplanetscan.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gameplanetscan.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gameplanetscan.h 22 Feb 2004 10:49:38 -0000 1.9 --- gameplanetscan.h 12 Mar 2004 20:14:58 -0000 1.10 *************** *** 66,73 **** int nmin, nmax; ! double avsize, frac[32]; Mineral *mine[64]; void handle_ranmin(); SpaceSprite *spr[10]; --- 66,75 ---- int nmin, nmax; ! double avsize, frac_life[32], frac_mine[32]; Mineral *mine[64]; + Lifeform *life[64]; void handle_ranmin(); + void handle_ranlife(); SpaceSprite *spr[10]; |
From: <geo...@us...> - 2004-03-12 20:34:47
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8642/melee Modified Files: mcontrol.cpp mcontrol.h mgame.cpp mgame.h mlog.cpp mlog.h mmain.cpp mmain.h mnet1.cpp mnet1.h moptions.cpp msprite.cpp Log Message: network update Index: mcontrol.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcontrol.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** mcontrol.cpp 4 Feb 2004 10:36:28 -0000 1.16 --- mcontrol.cpp 12 Mar 2004 20:14:58 -0000 1.17 *************** *** 18,103 **** - /* - adding lag handlers to mcontrol.cpp - They're not finished yet - they're in mcontrol.cpp because that's really the - only thing likely to use them - */ - /* - #include "mlog.h" - - class SimpleLagHandler : public Presence { - public: - virtual void preinit(); - virtual void init ( Game *game, int channel, int size, void *default_value ); - ~SimpleLagHandler(); - virtual void change_latency ( int new_lag_frames ) ; - virtual void post_item ( void *item ); - virtual void recv_item ( void *space ); - virtual void predict_item (int frames, void *space ); - void *data; - void *default_value; - unsigned int *transmit_bits; - Log *log; - int channel; - short int item_size; - short int lag_frames; - }; - - void SimpleLagHandler::preinit() { - data = NULL; - default_value = NULL; - log = NULL; - item_size = 0; - lag_frames = 0; - } - void SimpleLagHandler::init ( Game *game, int channel, int size, void *default_value ) { - this->log = game->log; - this->lag_frames = game->lag_frames; - this->channel = channel + Game::_channel_buffered; - this->item_size = size; - this->default_value = malloc( item_size ); - memcpy(this->default_value, default_value, item_size); - data = malloc ( item_size * lag_frames ); - return; - } - */ - /* - int lag = game->lag_frames; - if (sent & 1) { - source->recieve(); - } - if (source && source->exists()) { - if (send()) sent |= (1 << lag); - } - else source = NULL; - sent = sent << 1; - if (!source && (sent == 0)) die(); - - - if (already == lag) { - game->log_short(channel + Game::_channel_buffered, keys); - oldkeys = keys; - } - else if (already < lag) { - keys = intel_ordering_short(keys); - game->log->buffer(channel + Game::_channel_buffered, &keys, sizeof(KeyCode)); - keys = oldkeys; - already += 1; - } - else { - game->log->unbuffer(channel + Game::_channel_buffered, &oldkeys, sizeof(KeyCode)); - oldkeys = intel_ordering_short(oldkeys); - already -= 1; - } - */ - - - - - - - - enum { --- 18,21 ---- *************** *** 162,166 **** Control *getController(const char *type, const char *name, int channel) {STACKTRACE ! if ((channel != -1) && (channel & Game::_channel_buffered)) { error("getController - invalid channel # %d", channel); } --- 80,84 ---- Control *getController(const char *type, const char *name, int channel) {STACKTRACE ! if ((channel != -1) && (channel & _channel_buffered)) { error("getController - invalid channel # %d", channel); } *************** *** 176,180 **** int Control::rand() { ! if (channel == Game::channel_none) return random(); return (::rand() ^ ((::rand() << 12) + (::rand() <<24))) & 0x7fffffff; } --- 94,98 ---- int Control::rand() { ! if (channel == channel_none) return random(); return (::rand() ^ ((::rand() << 12) + (::rand() <<24))) & 0x7fffffff; } *************** *** 184,188 **** if (ship) { ship->control = this; ! if (temporary && (channel != Game::channel_none) && (already != 0) && (already != game->lag_frames)) {tw_error ("Control::select_ship - bad operation (incompatible with networking)");} } --- 102,106 ---- if (ship) { ship->control = this; ! if (temporary && (channel != channel_none) && (already != 0) && (already != game->lag_frames)) {tw_error ("Control::select_ship - bad operation (incompatible with networking)");} } *************** *** 389,392 **** --- 307,327 ---- */ + + void Control::gen_buffered_data() + { + if (ship && ship->exists()) + keys = think(); + else + keys = 0; + + if (channel != channel_none) + log_short(keys, channel + _channel_buffered); + // this will overwrite think() result, if it's a remote player. This does not matter, + // cause a remote player is simulated with a vegetable bot here, which does not generate + // meaningful data anyway (through think()). + } + + + void Control::calculate() {STACKTRACE *************** *** 400,412 **** select_ship( NULL, NULL); } ! else keys = think(); } if (!ship) { ! keys = 0; if (temporary) state = 0; } ! if (channel != Game::channel_none) { //prediction stuff _prediction_keys[_prediction_keys_index] = keys; --- 335,347 ---- select_ship( NULL, NULL); } ! //else keys = think(); // <--- goes into the gen_buffered_data !! } if (!ship) { ! //keys = 0; // <--- goes into the gen_buffered_data !! if (temporary) state = 0; } ! if (channel != channel_none) { //prediction stuff _prediction_keys[_prediction_keys_index] = keys; *************** *** 417,432 **** //network traffic ! int lf = game->lag_frames; ! if (0) ; ! else if (already < 0) {//unbuffering ! game->log->unbuffer(channel + Game::_channel_buffered, &keys, sizeof(KeyCode)); keys = intel_ordering_short(keys); already += 1; } else if (already < lf) {//buffering keys = intel_ordering_short(keys); ! game->log->buffer(channel + Game::_channel_buffered, &keys, sizeof(KeyCode)); keys = intel_ordering_short(keys); already += 1; } else if (already > lf) {//stupid error check --- 352,384 ---- //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 ! ! // Geo: note, that this is (or should be) already correctly buffered ! // log_short(channel + _channel_buffered, keys); <--- goes into the gen_buffered_data !! ! // an action like this, automatically halts the game, until data arrive. ! // or, if (lots of (also other)) data have arrived, it'll simply take what it ! // needs from the buffer. ! // it's not possible, once you've halted, to catch up by discarding data, ! // cause you don't know which parts of the game depend on those data. ! ! /* Geo: YOU SHOULD HAVE A PREDICTABLE PATTERN. reason: different items are thrown ! in a certain pattern onto the net, and you've to match that pattern. It should ! never depend on local properties. Therefore, I disable the stuff below. ! ! if (already < 0) {//unbuffering ! glog->unbuffer(channel + _channel_buffered, &keys, sizeof(KeyCode)); keys = intel_ordering_short(keys); already += 1; + + //message.print(1500, 14, "SHARE(send) key: %i", int(keys)); } else if (already < lf) {//buffering keys = intel_ordering_short(keys); ! glog->buffer(channel + _channel_buffered, &keys, sizeof(KeyCode)); keys = intel_ordering_short(keys); already += 1; + //message.print(1500, 14, "SHARE(send) key: %i", int(keys)); } else if (already > lf) {//stupid error check *************** *** 434,441 **** } else {//stable, perform no action ! game->log_short(channel + Game::_channel_buffered, keys); } } return; } --- 386,399 ---- } else {//stable, perform no action ! //message.print(1500, 14, "SHARE(send/rec) key: %i", int(keys)); ! log_short(channel + _channel_buffered, keys); } + */ } + // message.animate(0); + // if (ship && p_local == 0) + // readkey(); + return; } *************** *** 452,464 **** Control::Control(const char *name, int _channel) : temporary(false), target_sign_color(255), already(0), channel(_channel), ship(NULL), ! target(NULL), index(-1), always_random(0), _prediction_keys(NULL) {STACKTRACE id |= ID_CONTROL; attributes |= ATTRIB_SYNCHED; ! if (channel != Game::channel_none) { attributes |= ATTRIB_LOGGED; _prediction_keys = new KeyCode[_prediction_keys_size]; _prediction_keys_index = 0; ! if (channel & Game::_channel_buffered) { error("Control::Control - invalid channel!"); } --- 410,422 ---- Control::Control(const char *name, int _channel) : temporary(false), target_sign_color(255), 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; ! if (channel != channel_none) { attributes |= ATTRIB_LOGGED; _prediction_keys = new KeyCode[_prediction_keys_size]; _prediction_keys_index = 0; ! if (channel & _channel_buffered) { // ???????????? error("Control::Control - invalid channel!"); } *************** *** 470,474 **** } bool Control::die() { ! if (channel == Game::channel_none) return Presence::die(); // controls CANNOT arbitrarily be killed off, because the deal with networking directly error("controls cannot be killed"); --- 428,432 ---- } bool Control::die() { ! if (channel == channel_none) return Presence::die(); // controls CANNOT arbitrarily be killed off, because the deal with networking directly error("controls cannot be killed"); Index: mcontrol.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcontrol.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mcontrol.h 29 Jan 2004 21:20:29 -0000 1.8 --- mcontrol.h 12 Mar 2004 20:14:58 -0000 1.9 *************** *** 82,85 **** --- 82,88 ---- //for future mid-game lag changes virtual void _event ( Event *e ); + + + virtual void gen_buffered_data(); }; Index: mgame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** mgame.cpp 20 Feb 2004 08:42:44 -0000 1.33 --- mgame.cpp 12 Mar 2004 20:14:58 -0000 1.34 *************** *** 4,12 **** * melee/mgame.cpp - Melee base game module * - * 21-Jun-2002 - * - * - Game::create_ship() function modified to load ship ini files according to shp*.* - * file naming convention. - * - Cosmetic code changes. */ --- 4,7 ---- [...1371 lines suppressed...] + 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"); + } + } + + } + } + + } + + // leave the logs in default mode for subsequent operations !! + log_resetmode(); + } + Index: mgame.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** mgame.h 10 Jan 2004 22:27:59 -0000 1.14 --- mgame.h 12 Mar 2004 20:14:59 -0000 1.15 *************** *** 8,11 **** --- 8,13 ---- extern int interpolate_frames; + void idle_extra(int time = 5); // adding extra network-share to avoid total standstill which may happen, very occasionally... + class GameType { private: *************** *** 47,75 **** ! class Game : public Physics { ! public: ! GameType *type; ! enum { ! channel_none = -1, //not a valid channel ! channel_init = 4, // game type, version, length, etc.. things that need to read by a reader independant of a particular game type ! channel_playback = 8, // used for demo playbacks only ! channel_server = 12, //data originating on the server ! channel_client = 16, //data originating on the client ! _channel_buffered = 1 ! }; ! Log *log; //logging system for networking, demo recording/playback, etc. ! void log_char (int channel, char &data); //helper for using the logging system ! void log_char (int channel, unsigned char &data) {log_char (channel,*(char*)&data);} ! void log_short(int channel, short &data); //helper for using the logging system ! void log_short(int channel, unsigned short &data) {log_short (channel,*(short*)&data);} ! void log_int (int channel, int &data); //helper for using the logging system ! void log_int (int channel, unsigned int &data) {log_int (channel,*(int*)&data);} ! void log_data (int channel, void *data, int length); //helper for using the logging system ! virtual void log_file (const char *fname); void log_fleet(int channel, class Fleet *fleet); ! int is_local ( int channel ) ; protected: --- 49,137 ---- ! const int max_player = 8; ! extern const int channel_none; //not a valid channel ! extern const int _channel_buffered; ! extern const int channel_init; // game type, version, length, etc.. things that need to read by a reader independant of a particular game type ! extern const int channel_playback; // used for demo playbacks only ! // THE SERVER IS THE ONE WHO DEFINES THE DATA (eg initial game conditions; log_files) ! // the server is always player 0. ! extern const int channel_server; //data originating on the server ! // THE LOCAL CHANNEL IS THE ONE BELONGING TO THE COMPUTER YOU'RE SITTING AT; all other channels are remote ! // the local channel is always read/write, while remote channels are always read-only. ! // 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); ! ! ! class GameEvent2 ! { ! public: ! virtual void calculate(){}; ! }; ! ! ! template <class G> ! class GE : public GameEvent2 ! { ! public: ! typedef void (G::* reffunc) (); // store the class-function pointer ! G *game; // store pointer to the class in memory ! ! reffunc ref; ! ! GE(G *agame, reffunc aref) : GameEvent2() { game = agame; ref = aref; }; ! ! virtual void calculate() {(game->*ref)();}; ! }; ! ! const int max_events = 100; ! const int max_requests = 1024; ! class EventClass ! { ! public: ! int N; ! ! EventClass(); ! ! struct ref { ! GameEvent2 *call; ! char name[64]; ! } event[max_events]; ! void reg(GameEvent2 *g, char *id); ! ! void request(char *id); // adds a requested call to the stack ! void issue(int i); // calls one function of the stack ! ! int Nreq; ! int req[max_requests]; ! ! void handle(); ! ! bool sendmode; ! }; ! ! extern EventClass events; ! #define EVENT(classname, functionname) {events.reg(new GE<classname>(this, functionname), #functionname);} ! #define CALL(functionname) {events.request( #functionname );} ! ! ! class Game : public Physics ! { ! public: ! virtual void register_events(); ! virtual void do_game_events2(); ! ! GameType *type; ! ! virtual void log_file (const char *fname); // overload to allow networking void log_fleet(int channel, class Fleet *fleet); ! // int is_local ( int channel ) ; protected: *************** *** 135,141 **** int lag_frames; int prediction; ! virtual void increase_latency(); ! virtual void decrease_latency(); ! bool view_locked; bool physics_locked; --- 197,203 ---- int lag_frames; int prediction; ! virtual void increase_latency(int n); ! virtual void decrease_latency(int n); ! bool view_locked; bool physics_locked; *************** *** 157,161 **** virtual void unpause(); virtual bool is_paused(); ! virtual void idle(int time = 5); virtual void play_music(); --- 219,223 ---- virtual void unpause(); virtual bool is_paused(); ! virtual void use_idle(int time); virtual void play_music(); *************** *** 196,199 **** --- 258,279 ---- unsigned char local_checksum, client_checksum, server_checksum; + // just for debugging the buffered channel + void net_expect(int val); + + // put all buffered-data generating stuff in this subroutine, for (1) timelag control, + // and (2) for safety ;) Cause each has to be called in the correct order so that + // different data won't interfere with each other !! + void gen_buffered_data(); + + + // events + int lagchange; + void change_lag(); + void chat(); + void test_event1(); + + + // "extreme" desynch testing. + void heavy_compare(); }; Index: mlog.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mlog.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mlog.cpp 1 Mar 2004 23:21:49 -0000 1.11 --- mlog.cpp 12 Mar 2004 20:14:59 -0000 1.12 *************** *** 4,11 **** --- 4,18 ---- #include "../melee.h" + #include "../scp.h" #include "mlog.h" #include "mgame.h" #include "../util/net_tcp.h" + #include "../melee/mview.h" + + int channel_current = -1; + + int channel_file_names = 0; + int channel_file_data = 1; //direction for file channels must be the same *************** *** 14,17 **** --- 21,136 ---- //////////////////////////////////////////////////////////////////////// + + // if set to fake, it overrides all other read-settings to "false", to allow buffering + // of fake data, without having to make this explicit in higher level code. + static bool log_fake = false; + + void log_set_fake() + { + log_fake = true; + } + + void log_set_nofake() + { + log_fake = false; + } + + // to initialize a lag-buffer, you've to first push fake data, without reading operations, + // i.e. a predictable (and therefore synched), pushing of pre-defined (hard-coded) values. + // For this, you need stuff like this (and also to push/pop sequences of values to the buffer) + + static bool log_read_disable = false; // turn off most of the time, except when building the lag buffer (then you just write into the buffer!) + static bool log_write_disable = false; + bool log_synched = true; + + void log_set_default() + { + log_read_disable = false; + log_write_disable = false; + } + + void log_set_writeonly() + { + log_read_disable = true; // disable read (always) + log_write_disable = false; + } + + void log_set_readonly() + { + log_read_disable = log_fake; // enable read, but only if it's not in fake-mode + log_write_disable = true; // disable write + } + + + // check if the logging mode is currently read-only. This is useful for events, which + // should only "act" if you're in receiving mode. + bool log_readonly() + { + return (log_read_disable == false) && (log_write_disable == true); + } + + bool log_writeonly() + { + return (log_read_disable == true) && (log_write_disable == false); + } + + bool log_default() + { + return (log_read_disable == false) && (log_write_disable == false); + } + + + // check current channel settings + bool log_writable() + { + return (glog->writeable()); + } + + + bool log_readable() + { + return (glog->readable()); + } + + // define different "modes" of writability or readability + void log_resetmode() + { + log_set_default(); + log_synched = true; + } + + // default --> writeonly --> readonly + bool log_nextmode() + { + if (log_default()) + { + log_set_writeonly(); + log_synched = false; // written data are true-time, hence, not synched + return true; + } + else if (log_writeonly()) + { + log_set_readonly(); + if (!log_fake) + { + log_synched = true; // received data are game-time, hence, synched + return true; + } else { + log_synched = false; + return false; + } + + } + + else + return false; + } + + + + + bool log_show_data = false; // for inspecting values + + void Log::init() {STACKTRACE log_len = NULL; *************** *** 27,30 **** --- 146,161 ---- } + void Log::set_r(int ch) + { + set_direction(ch , direction_read); + set_direction(ch + _channel_buffered, direction_read); + } + + void Log::set_rw(int ch) + { + set_direction(ch, direction_write | direction_read | direction_immediate); + set_direction(ch + _channel_buffered, direction_write | direction_read); + } + void Log::set_direction ( int channel, char direction ) { STACKTRACE; *************** *** 73,78 **** expand_logs(channel+1); } ! if (log_dir[channel] & direction_write) _log ( channel, data, size); ! if (log_dir[channel] & direction_read) _unlog ( channel, data, size); return; } --- 204,210 ---- expand_logs(channel+1); } ! ! 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; } *************** *** 165,232 **** return log_len[channel] - log_pos[channel]; } - int Log::file_ready(const char *fname, void **location) { - STACKTRACE; - if (log_num <= channel_file_data) return -1; - int i = 0, j = 0; - while (i < log_len[channel_file_names]) { - if (strcmp((char*) log_data[channel_file_names] + i, fname)) { - i += strlen((char*) log_data[channel_file_names] + i) + 1; - // j += intel_ordering(*((int*)(log_data[channel_file_names] + i))); - int k; - memcpy(&k, (log_data[channel_file_names] + i), sizeof(int)); - j += intel_ordering(k); - i += sizeof(int); - } - else { - i += strlen((char*) log_data[channel_file_names] + i) + 1; - int k; - memcpy(&k, (log_data[channel_file_names] + i), sizeof(int)); - k = intel_ordering(k); ! if (j+k > log_len[channel_file_data]) { tw_error ("Log::file_ready - uh, that's bad"); } ! if (location) *location = log_data[channel_file_data] + j; ! return k; ! } ! } ! return -1; ! } ! void Log::log_file(const char *fname) {STACKTRACE ! void *loc; ! if (!(log_dir[channel_file_data] & direction_read)) { ! set_config_file(fname); ! return; ! } ! int len = file_ready(fname, &loc); ! if (len >= 0) { ! set_config_data((char*)loc, len); ! return; ! } ! if (!(log_dir[channel_file_data] & direction_write)) { ! tw_error("Log::log_file - file logs read only, \"%s\" not found", fname); ! } ! if (log_num <= channel_file_data) { ! expand_logs(channel_file_data + 1); ! } ! char buffy[2048]; ! PACKFILE *f; ! int i, j = 0; ! f = pack_fopen(fname, F_READ); ! if (!f) { tw_error("tw_log_file - bad file name %s", fname); } ! while (1) { ! i = pack_fread(buffy, 1024, f); ! if (i > 0) { ! _log(channel_file_data, buffy, i); ! j += i; ! } ! else break; ! } ! sprintf(buffy, "%s", fname); ! j = intel_ordering(j); ! memcpy(&buffy[strlen(buffy)+1], &j, sizeof(int)); ! _log (channel_file_names, buffy, strlen(buffy)+5); ! len = file_ready(fname, &loc); ! set_config_data((char*)loc, len); ! return; ! } void Log::deinit() {STACKTRACE --- 297,302 ---- return log_len[channel] - log_pos[channel]; } ! void Log::deinit() {STACKTRACE *************** *** 246,250 **** memset(zeros, 0, size); } ! if (log_dir[channel] & direction_write) { _log ( channel, data, size); // if (!(log_dir[channel] & direction_immediate)) send_packet(); --- 316,320 ---- memset(zeros, 0, size); } ! if ((log_dir[channel] & direction_write) && !log_write_disable) { _log ( channel, data, size); // if (!(log_dir[channel] & direction_immediate)) send_packet(); *************** *** 268,272 **** // if (log_dir[channel] & direction_write) _log ( channel, data, size); ! if (log_dir[channel] & direction_read) { _unlog ( channel, data, size); return true; --- 338,342 ---- // if (log_dir[channel] & direction_write) _log ( channel, data, size); ! if ((log_dir[channel] & direction_read) && !log_read_disable && !log_fake) { _unlog ( channel, data, size); return true; *************** *** 275,279 **** } ! void Log::flush() { return; } --- 345,353 ---- } ! void Log::flush_block() { ! return; ! } ! ! void Log::flush_noblock() { return; } *************** *** 283,286 **** --- 357,365 ---- } + void Log::use_idle(int time) + { + // nothing by default. + } + void Log::reset() { int i; *************** *** 297,302 **** playback = true; default_direction = Log::direction_read; ! Log::set_direction(Game::channel_playback, Log::direction_read | Log::direction_write | Log::direction_forget); ! Log::set_direction(Game::channel_playback + Game::_channel_buffered, Log::direction_read | Log::direction_write | Log::direction_forget); return; } --- 376,381 ---- playback = true; default_direction = Log::direction_read; ! Log::set_direction(channel_playback, Log::direction_read | Log::direction_write | Log::direction_forget); ! Log::set_direction(channel_playback + _channel_buffered, Log::direction_read | Log::direction_write | Log::direction_forget); return; } *************** *** 348,354 **** } ! void share_buffer(int channel, void *value, int num, int size, share_types st) { ! share_channel[Nshare] = channel; share_address[Nshare] = value; --- 427,446 ---- } ! ! static int chann(int player) { ! if (player == -1) ! return channel_init; ! ! else ! return channel_player[player]; ! } ! ! void share_buffer(int player, void *value, int num, int size, share_types st) ! { ! if (chann(player) == channel_none) ! return; ! ! share_channel[Nshare] = chann(player); share_address[Nshare] = value; *************** *** 364,368 **** // buffer an array ! game->log->buffer(share_channel[Nshare], share_address[Nshare], share_num[Nshare] * share_size[Nshare]); --- 456,460 ---- // buffer an array ! glog->buffer(share_channel[Nshare], share_address[Nshare], share_num[Nshare] * share_size[Nshare]); *************** *** 383,401 **** */ ! void share(int channel, int *value, int num) { ! share_buffer(channel, value, num, sizeof(int), TYPE_INT); } ! void share(int channel, short *value, int num) { ! share_buffer(channel, value, num, sizeof(short), TYPE_SHORT); } ! void share(int channel, char *value, int num) { ! share_buffer(channel, value, num, sizeof(char), TYPE_CHAR); } --- 475,493 ---- */ ! void share(int player, int *value, int num) { ! share_buffer(player, value, num, sizeof(int), TYPE_INT); } ! void share(int player, short *value, int num) { ! share_buffer(player, value, num, sizeof(short), TYPE_SHORT); } ! void share(int player, char *value, int num) { ! share_buffer(player, value, num, sizeof(char), TYPE_CHAR); } *************** *** 403,406 **** --- 495,501 ---- + + + /** \brief Retrieves the values that were sent for sharing, and writes the values to the proper memory locations. *************** *** 410,414 **** // do it here, cause why would you want to wait for each little packet till it // can be sent onto the net ? ! game->log->flush(); // superfluous, cause this is already used inside the unbuffer routine. --- 505,512 ---- // 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. *************** *** 420,424 **** { // unbuffer an array ! game->log->unbuffer(share_channel[n], share_address[n], share_size[n] * share_num[n]); // sort out bit-ordering for all values in the array --- 518,522 ---- { // unbuffer an array ! glog->unbuffer(share_channel[n], share_address[n], share_size[n] * share_num[n]); // sort out bit-ordering for all values in the array *************** *** 430,431 **** --- 528,644 ---- Nshare = 0; } + + + + + + bool Log::writeable(int ch) + { + if (ch < 0) + return false; + + return log_dir[ch] & direction_write; + } + + + bool Log::readable(int ch) + { + if (ch < 0) + return false; + + return log_dir[ch] & direction_read; + } + + + + + void Log::lint(int *val, int ch) + { + log(ch, val, sizeof(int)); + } + + void Log::ldata(char *data, int N, int ch) + { + log(ch, data, N); + } + + char *Log::create_buffer(int *size, int ch) + { + lint(size, ch); + return new char [*size]; + } + + + void Log::log_file(const char *fname) + { + STACKTRACE; + + int chold = channel_current; + channel_current = channel_file_data; + + if (log_read_disable || log_write_disable || log_fake) + tw_error("Faking sharing a file ? Unlikely !"); + + if (writeable() && !(log_dir[channel_current] & direction_immediate)) + tw_error("You should use an immediate connection to share file-data"); + + int L = 0; + if (writeable()) + L = file_size(fname); + + char *buffy = create_buffer(&L); + + if (writeable()) + { + PACKFILE *f; + + int i, j = 0; + f = pack_fopen(fname, F_READ); + if (!f) { tw_error("tw_log_file - bad file name %s", fname); } + + i = pack_fread(buffy, L, f); + if ( i != L ) { tw_error("tw_log_file - bad filesize"); }; + } + + ldata(buffy, L, sizeof(char)); // woops, I used sizeof(int) by mistake --> caused some unpred.behav. + + set_config_data(buffy, L); + + /* + // error check: + int i; + int sum = 0; + for ( i = 0; i < L; ++i ) + sum += buffy[i]; + + message.print(1500, 14, "L = %i sum = %i", L, sum); + message.animate(0); + //*/ + + delete buffy; + + + channel_current = chold; + + /* + // check if the file-share buffer isn't empty - it should be empty !! + // but this only makes sense for the host, cause remotes who are on the receiving end, + // can receive >1 file due to the lag, if the game is paused. + if (log_size_ch(channel_current) != 0) + tw_error("The file channel should be empty. Contains %i chars", log_size_ch(channel_current)); + so ... in principle this test makes sense, but only in places where it's safe to test. Like, + after all ships have been initialized. + */ + + return; + } + + + + int log_size_ch(int channel) + { + if (glog) + return glog->log_len[channel] - glog->log_pos[channel]; + else + return 0; + } Index: mlog.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mlog.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mlog.h 29 Feb 2004 18:46:40 -0000 1.6 --- mlog.h 12 Mar 2004 20:14:59 -0000 1.7 *************** *** 2,5 **** --- 2,41 ---- #define __MLOG_H__ + extern int channel_file_names; + extern int channel_file_data; //direction for file channels must be the same + + void log_set_fake(); + void log_set_nofake(); + + + void log_set_default(); + + // disables write operations + void log_set_readonly(); + + // disables read operations + void log_set_writeonly(); + + // check current read/write override settings + bool log_readonly(); + bool log_writeonly(); + bool log_default(); + + extern bool log_synched; // use in combination with "log_modes" + void log_resetmode(); + bool log_nextmode(); + + + // check current channel settings + bool log_writable(); + bool log_readable(); + + extern int channel_current; + + int log_size_ch(int channel); + + + extern bool log_show_data; // for inspecting values + class Log { //Logging system, usefull for networking & demo recording/playback *************** *** 20,26 **** // static int log_dir_files; //direction of channel (none, self->other, other->self, self->self) // static int log_dir_messages; //direction of channel (none, self->other, other->self, self->self) ! enum { ! channel_file_names = 0, channel_file_data = 1 //direction for file channels must be the same ! }; public: int type; --- 56,60 ---- // static int log_dir_files; //direction of channel (none, self->other, other->self, self->self) // static int log_dir_messages; //direction of channel (none, self->other, other->self, self->self) ! public: int type; *************** *** 30,34 **** bool playback; enum { ! direction_write = 1, direction_read = 2, direction_forget = 4 }; virtual void log (int channel, void *data, int size) ; --- 64,68 ---- bool playback; enum { ! direction_write = 1, direction_read = 2, direction_forget = 4, direction_immediate = 16 }; virtual void log (int channel, void *data, int size) ; *************** *** 40,43 **** --- 74,80 ---- void set_all_directions (char direction); + virtual void set_r(int ch); + virtual void set_rw(int ch); + virtual ~Log(); virtual void log_file(const char *fname); *************** *** 45,49 **** virtual int ready(int channel); //file_ready returns -1 if a file is not ready, otherwise it is the length of the file. if location is not NULL, it sets *location to pointing at the file data. ! virtual int file_ready(const char *fname, void **location = NULL); virtual void save (const char *fname); --- 82,86 ---- virtual int ready(int channel); //file_ready returns -1 if a file is not ready, otherwise it is the length of the file. if location is not NULL, it sets *location to pointing at the file data. ! // virtual int file_ready(const char *fname, void **location = NULL); virtual void save (const char *fname); *************** *** 53,60 **** virtual bool unbuffer (int channel, void *data, int size ); ! virtual void flush(); virtual bool listen(); virtual void reset(); ! }; class PlaybackLog : public Log { //Logging system, usefull for networking & demo recording/playback --- 90,108 ---- virtual bool unbuffer (int channel, void *data, int size ); ! virtual void flush_block(); ! virtual void flush_noblock(); virtual bool listen(); virtual void reset(); ! ! virtual void use_idle(int time); // is called in the games idle() function ! ! bool writeable(int ch = channel_current); ! bool readable(int ch = channel_current); ! ! void lint(int *val, int ch = channel_current); ! void ldata(char *data, int N, int ch = channel_current); ! char *Log::create_buffer(int *size, int ch = channel_current); ! ! }; class PlaybackLog : public Log { //Logging system, usefull for networking & demo recording/playback *************** *** 64,70 **** }; ! void share(int channel, int *value, int num = 1); ! void share(int channel, short *value, int num = 1); ! void share(int channel, char *value, int num = 1); void share_update(); --- 112,121 ---- }; ! ! /** \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(); Index: mmain.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** mmain.cpp 1 Mar 2004 17:46:30 -0000 1.29 --- mmain.cpp 12 Mar 2004 20:14:59 -0000 1.30 *************** *** 11,14 **** --- 11,15 ---- #include "../frame.h" + #include "mgame.h" #include "mmain.h" *************** *** 27,30 **** --- 28,32 ---- + /*void Game::player_said(int who, const char *what) { if ((who < 0) || (who >= num_players)) tw_error ("Who said that?!?"); *************** *** 32,49 **** return; }*/ ! int NormalGame::add_player (Control *c, int team_index, const char *name, const char *fleet_section, const char *fleet_file) {STACKTRACE ! int i = num_players; ! num_players += 1; ! player_control = (Control**) realloc(player_control, sizeof(Control*) * num_players); ! player_name = (char**) realloc(player_name, sizeof(char*) * num_players); ! // player_panel = (ShipPanel**) realloc(player_panel, sizeof(ShipPanel*) * num_players); ! player_fleet = (Fleet**) realloc(player_fleet, sizeof(Fleet *) * num_players); ! player_team = (TeamCode*) realloc(player_team, sizeof(TeamCode) * num_players); ! player_control[i] = c; add_focus(c, c->channel); ! // player_panel[i] = NULL; ! player_fleet[i] = new Fleet(); ! player_fleet[i]->reset(); ! player_name[i] = strdup(name); if (team_index >= team_table_size) { int i = team_table_size; --- 34,58 ---- return; }*/ ! int NormalGame::add_player (int num, Control *c, int team_index, const char *name, const char *fleet_section, ! const char *fleet_file) ! { ! STACKTRACE; ! ! if (num >= max_player) ! tw_error("trying to add more players than max allowed"); ! ! //int i = num_players; ! //num_players += 1; ! player_control = (Control**) realloc(player_control, sizeof(Control*) * (num+1)); ! player_name = (char**) realloc(player_name, sizeof(char*) * (num+1)); ! // player_panel = (ShipPanel**) realloc(player_panel, sizeof(ShipPanel*) * (num+1)); ! player_fleet = (Fleet**) realloc(player_fleet, sizeof(Fleet *) * (num+1)); ! player_team = (TeamCode*) realloc(player_team, sizeof(TeamCode) * (num+1)); ! player_control[num] = c; add_focus(c, c->channel); ! // player_panel[num] = NULL; ! player_fleet[num] = new Fleet(); ! player_fleet[num]->reset(); ! player_name[num] = strdup(name); if (team_index >= team_table_size) { int i = team_table_size; *************** *** 55,75 **** } } ! if (team_index) player_team[i] = team_table[team_index]; ! else player_team[i] = new_team(); char sect[40]; ! sprintf(sect, "Player%d", i+1); ! if (c->channel == channel_none) { ! tw_error("channel_none not allowed here"); //log_file(fleet_file); //::fleet->load(NULL, fleet_section); } ! else if (log->get_direction(c->channel) & Log::direction_write) { ! player_fleet[i]->load(fleet_file, fleet_section); ! log_fleet(c->channel, player_fleet[i]); ! c->target_sign_color = ((3+i) % 7) + 1; } else { ! log_fleet(c->channel, player_fleet[i]); } set_config_file("tmp.ini"); set_config_string(sect, "Name", name); --- 64,96 ---- } } ! if (team_index) player_team[num] = team_table[team_index]; ! else player_team[num] = new_team(); char sect[40]; ! sprintf(sect, "Player%d", num+1); ! if (c->channel == channel_none) ! { ! // tw_error("channel_none not allowed here"); //log_file(fleet_file); //::fleet->load(NULL, fleet_section); + + // change GEO: + // bot ships are defined by the server only (!) + if (glog->writeable(channel_server)) // the server... + player_fleet[num]->load(fleet_file, fleet_section); + + log_fleet(channel_server, player_fleet[num]); + c->target_sign_color = ((3+num) % 7) + 1; + } ! else if (glog->get_direction(c->channel) & Log::direction_write) ! { ! player_fleet[num]->load(fleet_file, fleet_section); ! log_fleet(c->channel, player_fleet[num]); ! c->target_sign_color = ((3+num) % 7) + 1; } else { ! log_fleet(c->channel, player_fleet[num]); } + set_config_file("tmp.ini"); set_config_string(sect, "Name", name); *************** *** 77,88 **** set_config_int(sect, "Team", team_index); set_config_int(sect, "Channel", c->channel); ! set_config_int(sect, "StartingFleetCost", player_fleet[i]->getCost()); ! set_config_int(sect, "StartingFleetSize", player_fleet[i]->getSize()); ! player_fleet[i]->save(NULL, sect); ! player_fleet[i]->save("fleets.tmp", sect); ! return i; } ! void NormalGame::init_objects() {STACKTRACE int i; //add(new Stars2()); --- 98,112 ---- set_config_int(sect, "Team", team_index); set_config_int(sect, "Channel", c->channel); ! set_config_int(sect, "StartingFleetCost", player_fleet[num]->getCost()); ! set_config_int(sect, "StartingFleetSize", player_fleet[num]->getSize()); ! player_fleet[num]->save(NULL, sect); ! player_fleet[num]->save("fleets.tmp", sect); ! return num; } ! void NormalGame::init_objects() ! { ! STACKTRACE; ! int i; //add(new Stars2()); *************** *** 93,103 **** if (view) view->camera.pos = size/2; add(new WedgeIndicator(planet, 75, 4)); ! for (i = 0; i < num_asteroids; i += 1) add(new Asteroid()); ! } ! void NormalGame::init_players() {STACKTRACE ! switch (log->type) { ! case Log::log_normal: { ! for (int i = 0; true; i += 1) { char buffy[64]; sprintf(buffy, "Player%d", i + 1); --- 117,138 ---- if (view) view->camera.pos = size/2; add(new WedgeIndicator(planet, 75, 4)); ! for (i = 0; i < num_asteroids; i += 1) ! add(new Asteroid()); ! } ! ! void NormalGame::init_players() ! { ! STACKTRACE; ! ! switch (glog->type) ! { ! case Log::log_normal: ! { ! int i; ! int count = 0; ! ! for ( i = 0; true; i += 1) ! { char buffy[64]; sprintf(buffy, "Player%d", i + 1); *************** *** 113,118 **** //if (strcmp(type, "MoronBot") == 0) channel = channel_none; int ti = get_config_int(buffy, "Team", 0); ! add_player(create_control(channel_server, type, config), ti, name, buffy); } } break; --- 148,162 ---- //if (strcmp(type, "MoronBot") == 0) channel = channel_none; int ti = get_config_int(buffy, "Team", 0); ! add_player(count, create_control(channel_server, type, config), ti, name, buffy); ! ! // you have to override the default settings, so that all multi-player aimed stuff ! // is channeled into a single player channel, which is handled locally. ! channel_player[count] = channel_server; ! ++count; } + + num_players = count; + num_humans = 1; // --> you should have just one human CHANNEL (note that there can be more humans, sharing this channel) + num_bots = 0; } break; *************** *** 120,131 **** case Log::log_net1server: { log_file("server.ini"); //int use_teams_menu = get_config_int("Network", "NetworkMeleeUseTeams", 0); //if (use_teams_menu) { if (1) { int j; ! for (j = 0; j < 2; j += 1) { int ch; ! if (j == 0) ch = channel_server; ! else ch = channel_client; if (is_local(ch)) { set_config_file("client.ini");//each side determines whether they are using manually specified teams --- 164,270 ---- case Log::log_net1server: { log_file("server.ini"); + + // the human players + + int j; + for (j = 0; j < num_humans; j += 1) + { + int ch; + ch = channel_player[j]; + + int team; + char buffy[64]; + char config[64]; + char name[512]; + const char *playertype; + + if (is_local(ch)) + { // put no networking stuff in this block + // if you're local, you've to define stuff, of course... + + set_config_file("client.ini");//each side determines whether they are using manually specified teams + //int use_teams_menu = get_config_int("Network", "NetworkMeleeUseTeams", 0); + + const char *simple_config = + "[Player1]\nType=Human\nConfig=0\nTeam=0\n"; + set_config_data(simple_config, strlen(simple_config)); + + sprintf(buffy, "Player1"); + playertype = get_config_string(buffy, "Type", NULL); + + if (strcmp(playertype, "none") == 0) + tw_error("Human player is a bot!"); + + //strcpy(name, get_config_string(buffy, "Name", buffy)); + sprintf(name, "player__%i", j); + + sprintf(config, "Config%d", get_config_int(buffy, "Config", 0)); + + team = get_config_int(buffy, "Team", 0); + } + + //int tmp = 1; + //log_int(ch, tmp); // this is only a signal for a variable # of bots. + // which we shouldn't use, cause channel_none players should be treated in + // another loop, imo ... + + channel_current = ch; + + log_int(team); + + int name_length = strlen(name)+1; + log_int(name_length); + log_data(name, name_length); + + if (is_local(ch)) + { + add_player(j, create_control(ch, playertype, config), team, name, buffy); + + } else { + add_player(j, create_control(ch, "Whatever"), team, name, NULL); + } + + } + + // give overview about the players? + message.print(1500, 14, "local channel = [%i]", channel_local()); + for (j = 0; j < num_humans; j += 1) + { + message.print(1500, 14, "[%s] [%s] [%i]", player_name[j], player_control[j]->getTypeName(), player_control[j]->channel); + message.animate(0); + } + + //if (p_local == 0) readkey(); + + // YOU SHOULD ADD BOTS HERE ?! + int team = new_team(); + for (j = num_humans; j < num_players; j += 1) + { + char name[512], fleetid[512]; + sprintf(name, "Bot_%i", j-num_humans+1); + sprintf(fleetid, "Player%i", j); + //int NormalGame::add_player (int num, Control *c, int team_index, const char *name, const char *fleet_section, + // const char *fleet_file) + int ch; + ch = channel_none; + channel_player[j] = ch; + add_player(j, create_control(ch, "WussieBot"), team, name, fleetid); + //channel_player[j] = channel_none; + } + + /* //int use_teams_menu = get_config_int("Network", "NetworkMeleeUseTeams", 0); //if (use_teams_menu) { if (1) { int j; ! ! for (j = 0; j < num_players; j += 1) ! { ! int ch; ! //if (j == 0) ch = channel_server; ! //else ch = channel_client; ! ch = channel_player[j]; ! if (is_local(ch)) { set_config_file("client.ini");//each side determines whether they are using manually specified teams *************** *** 154,161 **** {int tmp = 1; log_int(ch, tmp);} log_int(ch, ti); int name_length = strlen(name); log_int(ch, name_length); log_data(ch, (char*)name, name_length); ! add_player(create_control(ch, type, config), ti, name, buffy); } } --- 293,302 ---- {int tmp = 1; log_int(ch, tmp);} log_int(ch, ti); + int name_length = strlen(name); log_int(ch, name_length); log_data(ch, (char*)name, name_length); ! ! add_player(j, create_control(ch, type, config), ti, name, buffy); } } *************** *** 173,204 **** log_data(ch, name, name_length); name[name_length] = 0; ! add_player(create_control(ch, "Whatever"), team, name, NULL); } } } } ! /* else { ! set_config_file("client.ini"); ! int lp = get_config_int("Network", "LocalPlayers", 1); ! int cp = lp, sp = lp; ! log_int(channel_server, sp); ! log_int(channel_client, cp); ! int i; ! char buffy1[256]; ! char buffy2[256]; ! char buffy3[256]; ! for (i = 0; i < sp; i += 1) { ! sprintf(buffy1, "Config%d", i); ! sprintf(buffy2, "Server Player%d", i+1); ! sprintf(buffy3, "Player%d", i+1); ! add_player(create_control(channel_server, "Human", buffy1), 0, buffy2, buffy3); ! } ! for (i = 0; i < cp; i += 1) { ! sprintf(buffy1, "Config%d", i); ! sprintf(buffy2, "Client Player%d", i+1); ! sprintf(buffy3, "Player%d", sp+i+1); ! add_player(create_control(channel_client, "Human", buffy1), 0, buffy2, buffy3); ! } ! }*/ } break; --- 314,324 ---- log_data(ch, name, name_length); name[name_length] = 0; ! add_player(i, create_control(ch, "Whatever"), team, name, NULL); } } } } ! */ ! } break; *************** *** 231,237 **** num_kills = 0; kills = NULL; ! num_players = 0; } ! void NormalGame::init(Log *_log) {STACKTRACE Game::init(_log); --- 351,367 ---- num_kills = 0; kills = NULL; ! //num_players = 0; } ! ! ! ! void NormalGame::init(Log *_log) ! { ! STACKTRACE; ! ! // display_channel_info(); ! ! ! log_debug("normalgame::init calling game::init\n"); Game::init(_log); *************** *** 244,302 **** set_config_file ("tmp.ini"); set_config_string (NULL, "Ignorethis", ""); ! if (!log->playback) init_players(); log_file("tmp.ini"); ! if (log->playback) { ! for (int i = 0; true; i += 1) { char buffy[64]; sprintf(buffy, "Player%d", i + 1); log_file("tmp.ini"); const char *type = get_config_string(buffy, "Type", NULL); if (!type) break; const char *name = get_config_string(buffy, "Name", buffy); int channel = get_config_int(buffy, "Channel", -2); int ti = get_config_int(buffy, "Team", 0); ! add_player(create_control(channel, type), ti, name, buffy); player_fleet[i]->load(NULL, buffy); player_fleet[i]->save("fleets.tmp", buffy); - } - } - /* - int i; - set_config_file("tmp.ini"); - int num_players = get_config_int("Game", "NumPlayers", 0); - for (i = 0; i < num_players; i += 1) { - add_player(); } ! char tmp[80]; ! const char *t; ! ! for (i = 0; i < num_players; i += 1) { ! set_config_file("tmp.ini"); ! sprintf (tmp, "Player%d", i+1); ! name[i] = strdup(get_config_string(tmp, "Name", "nameless")); ! panel[i] = NULL; ! fleet->load(NULL, tmp); ! total_fleet[i] = fleet->cost; ! slot[i] = -2; ! fleet->save("./fleets.tmp", tmp); ! if ((i < first_local_player) || (i >= first_local_player + num_local_players)) { ! control[i] = getController("VegetableBot", name[i]); ! } ! else { ! set_config_file("./tmp.ini"); ! t = get_config_string(tmp, "Type", NULL); ! control[i] = getController(t, name[i]); ! if (!control[i]) tw_error("bad Controller type! (%s)", t); ! sprintf(tmp, "Config%d", get_config_int(tmp, "Config", 0)); ! player_control[i]->initialize(); ! player_control[i]->load("scp.ini", tmp); ! } ! }*/ ! ! prepare(); init_objects(); next_choose_new_ships_time = game_time + 200; --- 374,413 ---- set_config_file ("tmp.ini"); set_config_string (NULL, "Ignorethis", ""); ! ! log_debug("normalgame::init init players\n"); ! if (!glog->playback) ! init_players(); ! ! log_debug("normalgame::init sharing tmp.ini\n"); log_file("tmp.ini"); ! ! ! if (glog->playback) ! { ! for (int i = 0; true; i += 1) ! { char buffy[64]; sprintf(buffy, "Player%d", i + 1); log_file("tmp.ini"); + const char *type = get_config_string(buffy, "Type", NULL); if (!type) break; + const char *name = get_config_string(buffy, "Name", buffy); int channel = get_config_int(buffy, "Channel", -2); int ti = get_config_int(buffy, "Team", 0); ! ! add_player(i, create_control(channel, type), ti, name, buffy); ! player_fleet[i]->load(NULL, buffy); player_fleet[i]->save("fleets.tmp", buffy); } + } ! log_debug("normalgame::init prepare\n"); prepare(); init_objects(); + next_choose_new_ships_time = game_time + 200; *************** *** 305,308 **** --- 416,421 ---- indhealthtoggle = 0; + log_debug("normalgame::init done\n"); + return; } *************** *** 330,333 **** --- 443,448 ---- Game::calculate(); + // test_net(); + if (next_choose_new_ships_time <= game_time) { *************** *** 412,421 **** return; } ! void NormalGame::display_stats() {STACKTRACE pause(); int i; ! for (i = 0; i < num_players; i += 1) { Fleet *fleet = player_fleet[i]; ! switch (log->type) { case Log::log_net1client: case Log::log_net1server: { --- 527,540 ---- return; } ! void NormalGame::display_stats() ! { ! #ifdef _DEBUG ! STACKTRACE; ! pause(); int i; ! for (i = 0; i < num_humans; i += 1) { Fleet *fleet = player_fleet[i]; ! switch (glog->type) { case Log::log_net1client: case Log::log_net1server: { *************** *** 433,437 **** } unpause(); ! return; } bool NormalGame::handle_key(int k) --- 552,556 ---- } unpause(); ! #endif } bool NormalGame::handle_key(int k) *************** *** 449,458 **** break; case KEY_F7: { ! if (log->type == Log::log_normal) Game::handle_key(k); return true; } break; case KEY_F9: { ! if (log->type != Log::log_normal) return false; message.out("MUHAHAHAHAHA!!!!", 5000, 12); add(new Planet(random(size), meleedata.planetSprite, random(meleedata.planetSprite->frames()))); --- 568,577 ---- break; case KEY_F7: { ! if (glog->type == Log::log_normal) Game::handle_key(k); return true; } break; case KEY_F9: { ! if (glog->type != Log::log_normal) return false; message.out("MUHAHAHAHAHA!!!!", 5000, 12); add(new Planet(random(size), meleedata.planetSprite, random(meleedata.planetSprite->frames()))); *************** *** 488,502 **** ! void NormalGame::choose_new_ships() {STACKTRACE char tmp[40]; int i; pause(); message.out("Selecting ships...", 1000); ! int *slot = new int[num_players]; //choose ships and send them across network ! log_test(); ! for (i = 0; i < num_players; i += 1) { slot[i] = -2; if (player_control[i]->ship) { --- 607,627 ---- ! void NormalGame::choose_new_ships() ! { ! STACKTRACE; ! char tmp[40]; int i; pause(); + + message.out("Selecting ships...", 1000); ! int slot[max_player]; //choose ships and send them across network ! // log_test(); ! for (i = 0; i < num_players; i += 1) ! { slot[i] = -2; if (player_control[i]->ship) { *************** *** 515,546 **** sprintf(buffy, "%s\n", player_name[i]); ! slot[i] = player_control[i]->choose_ship(window, buffy, fleet); ! /* ! if (player_control[i]->channel != channel_none) { ! slot[i] = intel_ordering(slot[i]); ! log->buffer(player_control[i]->channel, &slot[i], sizeof(int)); ! log->flush(); ! //slot[i] = intel_ordering(slot[i]); ! } ! */ ! share(player_control[i]->channel, &slot[i]); } } //recieve the ships that were chosen - /* - log->listen(); - for (i = 0; i < num_players; i += 1) { - if (slot[i] == -2) continue; - if (player_control[i]->channel != channel_none) { - log->unbuffer(player_control[i]->channel, &slot[i], sizeof(int)); - slot[i] = intel_ordering(slot[i]); - } - } - */ share_update(); ! log_test(); //create the ships that were chosen --- 640,673 ---- sprintf(buffy, "%s\n", player_name[i]); ! // humans can choose ships ! if ( i < num_humans ) ! slot[i] = player_control[i]->choose_ship(window, buffy, fleet); ! else ! // bots choose "randomly" (but synched randomly so don't use rand() !!). ! // this is needed, otherwise a bot would need its own channel, while this way, ! // they can use channel_none. ! slot[i] = random(fleet->getSize()); ! ! share(i, &slot[i]); } } //recieve the ships that were chosen share_update(); ! // log_test(); ! ! ! /* ! // check which ships are chosen ! for ( i = 0; i < num_players; ++i ) ! { ! message.print(1500, 15, ! "P [%i] slot [%i] size [%i]", i, slot[i], player_fleet[i]->getSize()); ! message.animate(0); ! } ! readkey(); ! */ //create the ships that were chosen *************** *** 550,555 **** //fleet->load("./fleets.tmp", tmp); Fleet *fleet = player_fleet[i]; ! if (slot[i] == -1) slot[i] = random() % fleet->getSize(); ! if (slot[i] < 0 || slot[i] >= fleet->getSize()) {tw_error("trying to load invalid ship");} Ship *s = create_ship(fleet->getShipType(slot[i])->id, player_control[i], random(size), random(PI2), player_team[i]); if (!s) {tw_error("unable to create ship");} --- 677,689 ---- //fleet->load("./fleets.tmp", tmp); Fleet *fleet = player_fleet[i]; ! ! if (slot[i] == -1) ! slot[i] = random() % fleet->getSize(); ! ! if (slot[i] < 0 || slot[i] >= fleet->getSize()) ! { ! tw_error("trying to load invalid ship"); ! } ! Ship *s = create_ship(fleet->getShipType(slot[i])->id, player_control[i], random(size), random(PI2), player_team[i]); if (!s) {tw_error("unable to create ship");} *************** *** 578,585 **** int myfsize, otherfsize; myfsize = file_size(s->type->data->file); otherfsize = myfsize; if (player_control[i]->channel != channel_none) { ! log_int(player_control[i]->channel, otherfsize); } --- 712,720 ---- int myfsize, otherfsize; + // CRASH : client can't send packet to server myfsize = file_size(s->type->data->file); otherfsize = myfsize; if (player_control[i]->channel != channel_none) { ! log_int(otherfsize, player_control[i]->channel); } *************** *** 594,604 **** } ! log_test(); ! delete[] slot; message.out("Finished selecting ships...", 1500); unpause(); return; ! } --- 729,744 ---- } ! // log_test(); ! //delete[] slot; message.out("Finished selecting ships...", 1500); unpause(); + + // check if the file-share-channel is still "ök" + if (log_size_ch(channel_file_data) != 0) + tw_error("The file channel should be empty. Contains %i chars", log_size_ch(channel_current)); + return; ! } *************** *** 689,696 **** } int NormalGame::log_size_pl(int iplayer) { int k = player_control[iplayer]->channel; ! return game->log->log_len[k] - game->log->log_pos[k]; } --- 829,837 ---- } + int NormalGame::log_size_pl(int iplayer) { int k = player_control[iplayer]->channel; ! return log_size_ch(k); } *************** *** 715,719 **** // values to/from it .. ! log_test(); // I suppose, each player is making/ has made such a choice ... --- 856,860 ---- // values to/from it .. ! // log_test(); // I suppose, each player is making/ has made such a choice ... *************** *** 721,725 **** int k; int local_choice = 0; // only 1 local player needs to make a choice; the rest can be copied for local players ! for ( k = 0; k < num_players; ++k ) { // zero indicates an invalid choice (note that valid choices as 1 and 2 --> see the tw_alert menu below --- 862,866 ---- int k; int local_choice = 0; // only 1 local player needs to make a choice; the rest can be copied for local players ! for ( k = 0; k < num_humans; ++k ) { // zero indicates an invalid choice (note that valid choices as 1 and 2 --> see the tw_alert menu below *************** *** 757,761 **** // networking ! share(player_control[k]->channel, &choices[k]); } --- 898,902 ---- // networking ! share(k, &choices[k]); } *************** *** 765,772 **** ! log_test(); // extra test, check if all choices are "valid" (ie non-zero) ! for ( i = 0; i < num_players; ++i ) { if (!choices[i]) --- 906,913 ---- ! // log_test(); // extra test, check if all choices are "valid" (ie non-zero) ! for ( i = 0; i < num_humans; ++i ) { if (!choices[i]) *************** *** 777,785 **** // check if all the players want to restart, or quit, if not, give a warning and quit k = 0; ! for ( i = 0; i < num_players; ++i ) k += choices[i]; // disagreement ! if ( k != 1*num_players && k != 2*num_players ) { // give a warning to the local player --- 918,926 ---- // check if all the players want to restart, or quit, if not, give a warning and quit k = 0; ! for ( i = 0; i < num_humans; ++i ) k += choices[i]; // disagreement ! if ( k != 1*num_humans && k != 2*num_humans ) { // give a warning to the local player *************** *** 790,794 **** } // agreement on quitting ! else if ( k == 1*num_players ) { quit("none"); // THIS IS DESYNCHED ?! --- 931,935 ---- } // agreement on quitting ! else if ( k == 1*num_humans ) { quit("none"); // THIS IS DESYNCHED ?! *************** *** 798,802 **** { char buffy[512]; ! for ( i = 0; i < num_players; ++i ) { // first, kill remaining ship(s) --- 939,943 ---- { char buffy[512]; ! for ( i = 0; i < num_humans; ++i ) { // first, kill remaining ship(s) *************** *** 814,818 **** // perhaps something goes wrong here, when re-loading the ships ?? ! log_test(); --- 955,959 ---- // perhaps something goes wrong here, when re-loading the ships ?? ! // log_test(); *************** *** 835,841 **** int i; ! for ( i = 0; i < num_players; ++i ) { ! log_int(player_control[i]->channel, k); if ( k != m ) tw_error("weird, log stack is probably mixed up"); --- 976,982 ---- int i; ! for ( i ... [truncated message content] |
From: <geo...@us...> - 2004-03-12 20:34:46
|
Update of /cvsroot/timewarp/source/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8642/util Modified Files: base.cpp base.h get_time.c get_time.h net_tcp.cpp net_tcp.h Log Message: network update Index: base.cpp =================================================================== RCS file: /cvsroot/timewarp/source/util/base.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** base.cpp 7 Jan 2004 02:58:42 -0000 1.5 --- base.cpp 12 Mar 2004 20:15:01 -0000 1.6 *************** *** 77,78 **** --- 77,91 ---- } + + /** \brief You can use this to generate buffered data across the network. These are shared + on the network, and taken from it, in a neat, orderly way so that information doesn't get + mixed up. Make sure that you can also handle the null-case, where fake data are produced so + that there's an initial networking buffer (yeah that's needed, otherwise each has to + wait for the other). + */ + void BaseClass::gen_buffered_data() + { + // do nothing by default + } + + Index: base.h =================================================================== RCS file: /cvsroot/timewarp/source/util/base.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** base.h 14 Feb 2004 13:18:38 -0000 1.7 --- base.h 12 Mar 2004 20:15:01 -0000 1.8 *************** *** 65,68 **** --- 65,70 ---- virtual int serialize (void *stream); //returns 0 on failure virtual int _get_size() const; //returns 0 on failure + + virtual void gen_buffered_data(); // to synch networking. }; Index: get_time.c =================================================================== RCS file: /cvsroot/timewarp/source/util/get_time.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** get_time.c 29 Feb 2004 23:22:17 -0000 1.8 --- get_time.c 12 Mar 2004 20:15:01 -0000 1.9 *************** *** 64,72 **** //1. idle() functions for Allegro / SDL / unknown platform - - - int _no_idle = 0; #if defined(PLATFORM_IS_ALLEGRO) && !defined(NO_ALLEGRO_TIME) # include <allegro.h> --- 64,70 ---- //1. idle() functions for Allegro / SDL / unknown platform int _no_idle = 0; + #if defined(PLATFORM_IS_ALLEGRO) && !defined(NO_ALLEGRO_TIME) # include <allegro.h> Index: get_time.h =================================================================== RCS file: /cvsroot/timewarp/source/util/get_time.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** get_time.h 1 Mar 2004 15:47:24 -0000 1.6 --- get_time.h 12 Mar 2004 20:15:01 -0000 1.7 *************** *** 2,5 **** --- 2,6 ---- #define __GET_TIME_H__ + #ifdef __cplusplus extern "C" { *************** *** 18,22 **** //in all cases, the current time is measured relative to the call to init_time(); ! int idle ( int time ); //to yeild a number of milliseconds to the OS extern int _no_idle; //to disable the above function --- 19,23 ---- //in all cases, the current time is measured relative to the call to init_time(); ! int idle ( int time ); //to yield a number of milliseconds to the OS extern int _no_idle; //to disable the above function Index: net_tcp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/util/net_tcp.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** net_tcp.cpp 1 Mar 2004 15:47:24 -0000 1.7 --- net_tcp.cpp 12 Mar 2004 20:15:01 -0000 1.8 *************** *** 95,98 **** --- 95,107 ---- void (* NetTCP::message)(char*) = &msg; + + + void set_nonblocking(SOCKET &sd) + { + u_long no_block = 1; + ioctlsocket(sd, FIONBIO, &no_block); + } + + static fd_set read_set, write_set, except_set; static timeval tmv = {0, 0}; *************** *** 114,117 **** --- 123,132 ---- FD_ZERO(&write_set); FD_ZERO(&except_set); + + + NBuffer = 0; + MaxBuffer = 4096; + buffer = (char*) malloc(MaxBuffer); + return 0; } *************** *** 120,123 **** --- 135,141 ---- message ("NetTCP::deinit: network shut down"); if (isConnected()) disconnect(); + + free(buffer); + return; } *************** *** 202,212 **** --- 220,240 ---- close_socket(s); s = new_socket; + + set_nonblocking(s); + + // added GEO. + char *str; + str = inet_ntoa(other.sin_addr); // rewrites the address into string-dotted-format + strcpy(addr, str); + return 0; } } throw("NetTCP::listen: WTF?"); + return 0; } + int NetTCP::connect(const char *address, int port, int (*cancel_callback)()) { if (port > 65535) throw "NetTCP::connect - bad port number"; *************** *** 245,249 **** message ("NetTCP::connect: socket allocated"); - while (::connect(s, (struct sockaddr *)&other, sizeof(other)) == SOCKET_ERROR) { if (cancel_callback && cancel_callback()) { --- 273,276 ---- *************** *** 253,256 **** --- 280,286 ---- } } + + set_nonblocking(s); + return 0; } *************** *** 262,265 **** --- 292,296 ---- } + int NetTCP::ready2send() { int r; *************** *** 272,275 **** --- 303,308 ---- return r; } + + int NetTCP::ready2recv() { int r; *************** *** 282,297 **** return r; } ! int NetTCP::send(int size, const void *data) { ! int sofar = 0; ! while (sofar < size) { ! int tmp = ::send(s, ((char*) data) + sofar, size - sofar, 0); ! if (tmp > 0) sofar += tmp; ! if (tmp == SOCKET_ERROR) throw "NetTCP::send - error"; ! if (sofar == size) break; ! if (sofar > size) throw "NetTCP::send - trying to send more data than requested"; idle(1); - } - return sofar; } int NetTCP::recv(int min, int max, void *data) { int sofar = 0; --- 315,391 ---- return r; } ! ! ! // add L bytes to the buffer ! int NetTCP::add2buffer(char *data, int N) ! { ! while (NBuffer + N > MaxBuffer) ! { ! MaxBuffer *= 2; ! buffer = (char*) realloc(buffer, MaxBuffer); ! } ! ! memcpy(&buffer[NBuffer], data, N); ! ! NBuffer += N; ! ! return NBuffer; ! } ! ! ! // remove L bytes from the buffer (from the start of the buffer, so, move the rest of the buffer ! int NetTCP::rembuffer(int N) ! { ! if (N > NBuffer) ! throw("Trying to remove more buffered bytes then present"); ! ! memmove(buffer, &buffer[N], NBuffer-N); ! NBuffer -= N; ! ! return NBuffer; ! } ! ! ! int NetTCP::buflen() ! { ! return NBuffer; ! } ! ! ! int NetTCP::sendattempt() ! { ! int tmp; ! ! if (NBuffer <= 0) ! return 0; ! ! if (ready2send()) ! tmp = ::send(s, buffer, NBuffer, 0); ! else ! tmp = 0; ! ! if (tmp == SOCKET_ERROR) throw "NetTCP::send - error"; ! ! rembuffer(tmp); ! ! return tmp; ! } ! ! ! int NetTCP::sendall() ! { ! while ( buflen() > 0 ) ! { ! sendattempt(); ! idle(1); } + + if (buflen() < 0) throw "NetTCP::send - trying to send more data than requested"; + + return buflen(); + } + + int NetTCP::recv(int min, int max, void *data) { int sofar = 0; *************** *** 326,329 **** --- 420,501 ---- + + + + + + + + /* + + // stuf useful for server ? It uses an extra socket, the listener, to check for + // incoming connection requests. + + + int NetTCP2::SetupListener(int port, int (*cancel_callback)()) + { + + int i; + for (i = 0; i < MaxSockets; ++i ) + { + server_buffer[i].inp.N = 0; + server_buffer[i].out.N = 0; + sd[i] = INVALID_SOCKET; + } + + if (sd_listen != INVALID_SOCKET) throw ("NetTCP2::listen: socket already active"); + if (port <= 0) throw "NetTCP2::listen - Bad port number!"; + sd_listen = socket( AF_INET, SOCK_STREAM, 0); + if (sd_listen == INVALID_SOCKET) { + message("NetTCP2::listen: socket allocation failed"); + return -1; + } + message ("NetTCP2::listen: socket allocated"); + + sockaddr_in self; + self.sin_family = AF_INET; + self.sin_port = htons(port); + self.sin_addr.s_addr = 0; + memset(&(self.sin_zero), 0, 8); + + if (bind (sd_listen, (sockaddr *) &self, sizeof(sockaddr_in) ) == -1) { + char tmp[80]; + sprintf (tmp, "NetTCP2::listen: bind to port %d failed", port); + message (tmp); + close_socket(sd_listen); + sd_listen = INVALID_SOCKET; + return -2; + } + else { + char tmp[80]; + sprintf (tmp, "NetTCP2::listen: socket bound to port", port); + message (tmp); + } + if (::listen(sd_listen, 1) == -1) { + message ("NetTCP2::listen: listen failed"); + close_socket(sd_listen); + sd_listen = INVALID_SOCKET; + return -3; + } + + // set_as_host(); // show that this computer runs the host... + + return 1; + } + + + + int NetTCP2::CloseListener() + { + close_socket(sd_listen); // closing the listening socket. + return 1; + } + + + */ + + + + #else Index: net_tcp.h =================================================================== RCS file: /cvsroot/timewarp/source/util/net_tcp.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** net_tcp.h 10 Jan 2004 22:27:58 -0000 1.4 --- net_tcp.h 12 Mar 2004 20:15:01 -0000 1.5 *************** *** 5,8 **** --- 5,11 ---- class NetTCP { public: + + char addr[512]; + //init() is called once on each NetTCP before it is used int init(); *************** *** 19,23 **** int ready2recv(); //send (size, data) sends size bytes of data ! int send(int size, const void *data); //recv (min, max, data) recieves at least min bytes, and at most max bytes, storing them in data int recv(int min, int max, void *data); --- 22,26 ---- int ready2recv(); //send (size, data) sends size bytes of data ! int sendall(); //recv (min, max, data) recieves at least min bytes, and at most max bytes, storing them in data int recv(int min, int max, void *data); *************** *** 30,33 **** --- 33,49 ---- //describes the network type static const char *network_type(); + + int sendattempt(); + // the buffer used for subsequent send(attempts) + // adds N bytes to the buffer + // it's probably advantageous if each socket can manage its own buffer + int add2buffer(char *data, int N); + + // remove N bytes from the buffer + int rembuffer(int N); + + // returns the buffer length + int buflen(); + private: union { *************** *** 36,39 **** --- 52,59 ---- }; static void (*message)(char *txt); + + + char *buffer; + int MaxBuffer, NBuffer; }; |
From: <geo...@us...> - 2004-03-12 20:34:45
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8642/newships Modified Files: shpphepa.cpp shpterbi.cpp Log Message: network update Index: shpphepa.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpphepa.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpphepa.cpp 29 Feb 2004 23:22:19 -0000 1.15 --- shpphepa.cpp 12 Mar 2004 20:15:00 -0000 1.16 *************** *** 148,152 **** int PhedarPatrolShip::handle_damage(SpaceLocation *src, double normal, double direct) { ! STACKTRACE double totdam = normal + direct; --- 148,152 ---- int PhedarPatrolShip::handle_damage(SpaceLocation *src, double normal, double direct) { ! STACKTRACE; double totdam = normal + direct; *************** *** 168,176 **** double evac = 0; while ( evac < totdam && crew >= 1 ) // yeah, the last one may also leave !! ! { int i = int(crew+0.5); if ( i < 0 || i > maxcrew-1 ) ! {tw_error("Too many crew in this ship !!"); } // this is an evil macro - leave the brackets crewinspace[i] = new CrewPodPP( --- 168,176 ---- double evac = 0; while ( evac < totdam && crew >= 1 ) // yeah, the last one may also leave !! ! { // otherwise, it's hard to die ;) int i = int(crew+0.5); if ( i < 0 || i > maxcrew-1 ) ! {tw_error("Too many crew in this ship !!"); } crewinspace[i] = new CrewPodPP( *************** *** 195,199 **** --- 195,202 ---- // don't use == 0, but use < 1, cause of possible partial damage ? I assume, 0.8 crew is also dead crew... if ( crew < 1 ) + { + crew = 0; Ship::handle_damage(src, 0, 0); // use the "default" die procedure + } return iround(totdam); *************** *** 233,237 **** void CrewPodPP::calculate() { ! STACKTRACE frame_step += frame_time; while (frame_step >= frame_size) { --- 236,240 ---- void CrewPodPP::calculate() { ! STACKTRACE; frame_step += frame_time; while (frame_step >= frame_size) { *************** *** 266,270 **** void CrewPodPP::inflict_damage(SpaceObject *other) { ! STACKTRACE if (other->isShip() && other->damage_factor == 0) { // sound.stop(data->sampleExtra[0]); --- 269,273 ---- void CrewPodPP::inflict_damage(SpaceObject *other) { ! STACKTRACE; if (other->isShip() && other->damage_factor == 0) { // sound.stop(data->sampleExtra[0]); *************** *** 277,281 **** int CrewPodPP::handle_damage(SpaceLocation *source, double normal, double direct) { ! STACKTRACE state = 0; // this is extra; eg. if hit by a asteroid or so. return 0; --- 280,284 ---- int CrewPodPP::handle_damage(SpaceLocation *source, double normal, double direct) { ! STACKTRACE; state = 0; // this is extra; eg. if hit by a asteroid or so. return 0; Index: shpterbi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpterbi.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** shpterbi.cpp 29 Feb 2004 23:22:19 -0000 1.5 --- shpterbi.cpp 12 Mar 2004 20:15:00 -0000 1.6 *************** *** 737,741 **** weaponRange = creator->droneWeaponRange; ! control = new TeronDroneController( "Teron Drone", Game::channel_none ); control->load( "scp.ini", "Config0" ); game->add( control ); --- 737,741 ---- weaponRange = creator->droneWeaponRange; ! control = new TeronDroneController( "Teron Drone", channel_none ); control->load( "scp.ini", "Config0" ); game->add( control ); *************** *** 988,992 **** weaponArmour = creator->fighterWeaponArmour; ! control = new TeronShipController( "Teron Fighter", Game::channel_none ); control->load( "scp.ini", "Config0" ); game->add( control ); --- 988,992 ---- weaponArmour = creator->fighterWeaponArmour; ! control = new TeronShipController( "Teron Fighter", channel_none ); control->load( "scp.ini", "Config0" ); game->add( control ); *************** *** 1052,1056 **** weaponArmour = creator->turretWeaponArmour; ! control = new TeronShipController( "Teron Turret", Game::channel_none ); control->load( "scp.ini", "Config0" ); game->add( control ); --- 1052,1056 ---- weaponArmour = creator->turretWeaponArmour; ! control = new TeronShipController( "Teron Turret", channel_none ); control->load( "scp.ini", "Config0" ); game->add( control ); |
From: <geo...@us...> - 2004-03-12 20:34:45
|
Update of /cvsroot/timewarp/source/twgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8642/twgui Modified Files: gametest2.cpp Log Message: network update Index: gametest2.cpp =================================================================== RCS file: /cvsroot/timewarp/source/twgui/gametest2.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gametest2.cpp 28 Feb 2004 15:16:32 -0000 1.7 --- gametest2.cpp 12 Mar 2004 20:15:01 -0000 1.8 *************** *** 517,521 **** { // copied from normalgame::handle_key() ! if (log->type == Log::log_normal) { message.out("MUHAHAHAHAHA!!!!", 5000, 12); --- 517,521 ---- { // copied from normalgame::handle_key() ! if (glog->type == Log::log_normal) { message.out("MUHAHAHAHAHA!!!!", 5000, 12); *************** *** 781,785 **** for (;;) { ! idle(); fleetsel->tree_calculate(); --- 781,785 ---- for (;;) { ! idle(1); fleetsel->tree_calculate(); *************** *** 818,823 **** if (player_control[i]->channel != channel_none) { slot[i] = intel_ordering(slot[i]); ! log->buffer(player_control[i]->channel, &slot[i], sizeof(int)); ! log->flush(); //slot[i] = intel_ordering(slot[i]); } --- 818,823 ---- if (player_control[i]->channel != channel_none) { slot[i] = intel_ordering(slot[i]); ! glog->buffer(player_control[i]->channel, &slot[i], sizeof(int)); ! glog->flush_block(); //slot[i] = intel_ordering(slot[i]); } *************** *** 825,833 **** } //recieve the ships that were chosen ! log->listen(); for (i = 0; i < num_players; i += 1) { if (slot[i] == -2) continue; if (player_control[i]->channel != channel_none) { ! log->unbuffer(player_control[i]->channel, &slot[i], sizeof(int)); slot[i] = intel_ordering(slot[i]); } --- 825,833 ---- } //recieve the ships that were chosen ! glog->listen(); for (i = 0; i < num_players; i += 1) { if (slot[i] == -2) continue; if (player_control[i]->channel != channel_none) { ! glog->unbuffer(player_control[i]->channel, &slot[i], sizeof(int)); slot[i] = intel_ordering(slot[i]); } |
From: <geo...@us...> - 2004-03-12 20:34:45
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8642/other Modified Files: planet3d.cpp Log Message: network update Index: planet3d.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/planet3d.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** planet3d.cpp 17 Feb 2004 04:11:56 -0000 1.17 --- planet3d.cpp 12 Mar 2004 20:15:00 -0000 1.18 *************** *** 120,124 **** Planet *create_planet( Vector2 position ) { ! STACKTRACE // first, check the server.ini settings to see which type of planet you want --- 120,124 ---- Planet *create_planet( Vector2 position ) { ! STACKTRACE; // first, check the server.ini settings to see which type of planet you want *************** *** 128,132 **** // PlanetDimension = 3 ; 2 = standard 2d sprite, 3 = Tau's 3D planet idea. ! game->log_file ("client.ini"); --- 128,132 ---- // PlanetDimension = 3 ; 2 = standard 2d sprite, 3 = Tau's 3D planet idea. ! game->log_file ("server.ini"); *************** *** 136,144 **** // check if the 3D data file exists ! FILE *data3d = fopen("planet3d.dat", "rb"); ! if (!data3d) planetD = 2; ! else ! fclose(data3d); if (planetD == 2) --- 136,142 ---- // check if the 3D data file exists ! if (!exists("planet3d.dat")) planetD = 2; ! if (planetD == 2) |
From: <you...@us...> - 2004-03-10 19:26:44
|
Update of /cvsroot/timewarp/ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2358/ships Modified Files: shptauhu.ini Log Message: changing Tau Hunter .ini file (for Jumping Peppers) Index: shptauhu.ini =================================================================== RCS file: /cvsroot/timewarp/ships/shptauhu.ini,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** shptauhu.ini 5 Jan 2004 21:59:54 -0000 1.4 --- shptauhu.ini 10 Mar 2004 19:08:35 -0000 1.5 *************** *** 1,4 **** [Info] ! TWCost = 20 Name1 = Tau Name2 = Hunter --- 1,4 ---- [Info] ! TWCost = 22 Name1 = Tau Name2 = Hunter *************** *** 11,23 **** CrewMax = 26 Batt = 36 ! BattMax = 36 ! SpeedMax = 36 AccelRate = 7 ! TurnRate = 3.5 ! RechargeAmount = 1 ! RechargeRate = -0.75 ! WeaponDrain = 3 ! WeaponRate = 0 ! SpecialDrain = 36 SpecialRate = 16 HotspotRate = 4 --- 11,23 ---- CrewMax = 26 Batt = 36 ! BattMax = 28 ! SpeedMax = 28 AccelRate = 7 ! TurnRate = 2 ! RechargeAmount = 2 ! RechargeRate = 1 ! WeaponDrain = 4 ! WeaponRate = 1 ! SpecialDrain = 10 SpecialRate = 16 HotspotRate = 4 *************** *** 28,53 **** Velocity = 130 Length = 10 ! Spread = 5 ! Alternating = 1 ! Number = 2 Damage = 1 Relativity = 1.0 ! RechargeDelay = 8 [Special] Range = 4.0 Velocity = 80 ! Damage = 8 Armour = 4 ! RechargeDelay = 8 [Extra] Velocity = 84 ! Drain = 8 ExitVelocityFactor = 1.0 CriticalAngle = 30 CriticalRange = 40 FrameTime = 25 ! RechargeDelay = 4 --- 28,53 ---- Velocity = 130 Length = 10 ! Spread = 0 ! Alternating = 0 ! Number = 1 Damage = 1 Relativity = 1.0 ! RechargeDelay = 0 [Special] Range = 4.0 Velocity = 80 ! Damage = 0 Armour = 4 ! RechargeDelay = 0 [Extra] Velocity = 84 ! Drain = 4 ExitVelocityFactor = 1.0 CriticalAngle = 30 CriticalRange = 40 FrameTime = 25 ! RechargeDelay = 0 |
From: <you...@us...> - 2004-03-10 00:31:51
|
Update of /cvsroot/timewarp/ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14883/ships Modified Files: shpnisha.dat Log Message: changing graphics for Nissik Harasser (for Mercutio) Index: shpnisha.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpnisha.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvs3hmqHX and /tmp/cvsVcHqGK differ |
From: <you...@us...> - 2004-03-08 20:45:26
|
Update of /cvsroot/timewarp/ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10543/ships Modified Files: shpfiear.dat Log Message: changing victory music for Fieras Arbiter (for Abe Froman) Index: shpfiear.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpfiear.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvspYM2ii and /tmp/cvsEKZLfC differ |
From: <you...@us...> - 2004-03-08 07:24:02
|
Update of /cvsroot/timewarp/ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9153/ships Modified Files: shpdjila.dat Log Message: changing ditty music for Djinni Lancer (by AbeFroman) Index: shpdjila.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpdjila.dat,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvs3Ib00q and /tmp/cvs0EPGMu differ |
From: <yu...@us...> - 2004-03-05 18:07:26
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23011/source/other Added Files: gconfig.cpp gconfig.h Log Message: Removing hard coded planet and station, replacing them with config file --- NEW FILE: gconfig.cpp --- /* This file is part of "Star Control: TimeWarp" http://timewarp.sourceforge.net/ Copyright (C) 2001-2004 TimeWarp development team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ extern "C" { # include "lua.h" # include "lualib.h" # include "lauxlib.h" } #include <string> #include "melee.h" REGISTER_FILE #include "melee/mship.h" #include "games/ggob.h" #include "melee/mview.h" // for message #define gobgame ((GobGame*)game) static int l_InitializeSun(lua_State* ls); static int l_AddPlanet(lua_State* ls); static int l_AddStation(lua_State* ls); #ifdef ALLEGRO_MSVC #pragma warning (disable:4786) #endif ////////////////////////////////////////////////////////////////////////////////////////////// //Helper functions ////////////////////////////////////////////////////////////////////////////////////////////// /*! \brief Find planet by it name */ Planet * FindPlanet (std::string name) { Planet *p = NULL; Query q; q.begin(game->item[0], bit(LAYER_CBODIES), 99999999); // if first object is planet if (game->item[0]->isPlanet()) { p = (Planet*)game->item[0]; if (p->GetName() == name) return p; } while (q.current) { if (q.current->isPlanet()) { p = (Planet*)q.current; if (p->GetName() == name) return p; } q.next(); } return NULL; } void InitInitializeModule ( lua_State* L ) { ASSERT ( L != NULL ); ///////////////////////////////////////////////////////// // Register C function for using in lua //////////////////////////////////////////////////////// lua_register(L, "DialogStart", l_InitializeSun); lua_register(L, "AddPlanet", l_AddPlanet); lua_register(L, "AddStation", l_AddStation); } static int l_InitializeSun(lua_State* ls) { return 0; }; /*! \brief add planet to gob like game \param name (string) name of the planet used as unique ID of planet form config script \param x (string) planets absciss, can be integer value or '?' for ramdom position \param y (string) planets ordinate, can be integer value or '?' for ramdom position */ static int l_AddPlanet(lua_State* ls) { int top = lua_gettop(ls); // number of argument if (top != 3) { tw_error("Wrong argument count in Add Planet (lua script)"); } if ( !lua_isstring(ls, 1) ) {tw_error("AddPlanet wrong argument type for 1 arg");} if ( !lua_isstring(ls, 2) ) {tw_error("AddPlanet wrong argument type for 2 arg");} if ( !lua_isstring(ls, 3) ) {tw_error("AddPlanet wrong argument type for 3 arg");} const char* name = lua_tostring(ls, 1); const char* x = lua_tostring(ls, 2); const char* y = lua_tostring(ls, 3); // Load cordinates 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); Vector2 pos(nx,ny); Planet *p = create_planet(pos); if (p == NULL) {tw_error ("Unable to create planet");}; p->SetName(name); while (true) { SpaceLocation *n; n = p->nearest_planet(); if (!n || (p->distance(n) > 1500)) break; p->translate(random(game->size)); } return 0; } /*! \brief add gob space station \param name (string) space station name \param x (string) not used, supposed for station what does not orbiting planet \param y (string) not used, supposed for station what does not orbiting planet \param buildtype (string) Ship type producing by station \param commander (string) External AI script for station commander \param orbit (string) nearest planet \param sprite (string) sprite for station \param background (string) background picture */ static int l_AddStation(lua_State* ls) { int top = lua_gettop(ls); // number of argument if (top != 8) { tw_error("Wrong argument count in Add Planet (lua script)"); } if ( !lua_isstring(ls, 1) ) {tw_error("AddStation wrong argument type for 1 arg");} if ( !lua_isstring(ls, 2) ) {tw_error("AddStation wrong argument type for 2 arg");} if ( !lua_isstring(ls, 3) ) {tw_error("AddStation wrong argument type for 3 arg");} if ( !lua_isstring(ls, 4) ) {tw_error("AddStation wrong argument type for 4 arg");} if ( !lua_isstring(ls, 5) ) {tw_error("AddStation wrong argument type for 5 arg");} if ( !lua_isstring(ls, 6) ) {tw_error("AddStation wrong argument type for 6 arg");} if ( !lua_isstring(ls, 7) ) {tw_error("AddStation wrong argument type for 7 arg");} if ( !lua_isstring(ls, 8) ) {tw_error("AddStation wrong argument type for 8 arg");} 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); const char* orbit = lua_tostring(ls, 6); const char* sprite = lua_tostring(ls, 7); const char* background = lua_tostring(ls, 8); Planet *p = FindPlanet( orbit ); ASSERT (p!= NULL); DATAFILE *tmpdata; bool c = true; std::string file, pic; for (int i = 0; i< strlen(sprite);i++) { if (sprite[i] == '#') { c = false; continue; } if (c) file +=sprite[i]; else pic +=sprite[i]; } tmpdata = load_datafile_object(file.c_str(), pic.c_str()); if (!tmpdata) error( "couldn't find gob.dat#station0sprite"); SpaceSprite * stationSprite = new SpaceSprite(tmpdata, 1, SpaceSprite::MASKED | SpaceSprite::MIPMAPED, 64); unload_datafile_object(tmpdata); stationSprite->permanent_phase_shift(8); GobStation *gs = new GobStation(stationSprite, p, buildtype, /*"gob.dat#station0picture.bmp"*/ background, name ); //delete station_sprite; gs->install_external_ai(commander); gs->collide_flag_sameship = ALL_LAYERS; gs->collide_flag_sameteam = ALL_LAYERS; gs->collide_flag_anyone = ALL_LAYERS; gobgame->add ( gs ); return 0; } --- NEW FILE: gconfig.h --- /* This file is part of "Star Control: TimeWarp" http://timewarp.sourceforge.net/ Copyright (C) 2001-2004 TimeWarp development team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef __GCONFIG_H__ #define __GCONFIG_H__ void InitInitializeModule ( lua_State* L ); #endif |
From: <yu...@us...> - 2004-03-05 18:07:25
|
Update of /cvsroot/timewarp/gamedata/gob In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23011/gamedata/gob Added Files: config.lua Log Message: Removing hard coded planet and station, replacing them with config file --- NEW FILE: config.lua --- -- This is GOB game config file, allegro ini files is too simple for this task -- Stars = { { name="GOB Star", x = "10", y = "10", suns = { {name="Gob Star", x = "1000", y = "1000", sprite="vanguard.dat#Star000"}}, planets = { {name="GOB 1", x= "12000", y = "12000" }, {name="GOB 2", x= "?", y = "?" }, {name="GOB 3", x= "?", y = "?" }, {name="GOB 4", x= "?", y = "?" } }, starbases = { {name="Supox", x = "?", y = "?", buildtype = "supbl", commander = "gamedata/supox_station.lua", orbit = "GOB 1", sprite = "gob.dat#station0sprite", background = "gob.dat#station0picture.bmp" }, {name="Orz", x = "?", y = "?", buildtype="orzne", commander="gamedata/orz_station.lua", orbit="GOB 2", sprite = "gob.dat#station1sprite", background = "gob.dat#station1picture.bmp" }, {name="Kohr-Ah", x = "?", y = "?", buildtype="kohma", commander="gamedata/korah_station.lua", orbit="GOB 3", sprite = "gob.dat#station2sprite", background = "gob.dat#station2picture.bmp" }, {name="Utwig", x = "?", y = "?", buildtype="utwju", commander="gamedata/utwig_station.lua", orbit="GOB 4", sprite = "gob.dat#station2sprite", background = "gob.dat#station2picture.bmp" } } } } ------------------------------------------------------------------------------ -- Main file with the definitions of all the service functions used by -- -- other scripts. -- -- -- -- DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING! -- ------------------------------------------------------------------------------ function InitPlanets( planets ) for a, b in planets do AddPlanet (b.name, b.x, b.y ); end end function InitSpaceStations ( stations ) for a, b in stations do AddStation (b.name, b.x, b.y, b.buildtype, b.commander, b. orbit, b.sprite, b.background ) end end function InitStarSystem () for a, b in Stars do if b.name == "GOB Star" then InitPlanets( b.planets ); InitSpaceStations(b.starbases); end end end InitStarSystem(); |
From: <yu...@us...> - 2004-03-05 18:05:47
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22648/source/games Modified Files: ggob.cpp ggob.h gsolar.cpp Log Message: Removing hard coded planet and station, replacing them with config file Index: ggob.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ggob.cpp 2 Mar 2004 12:33:51 -0000 1.30 --- ggob.cpp 5 Mar 2004 17:51:28 -0000 1.31 *************** *** 35,42 **** #include "other/gup.h" - #include "other/configrw.h" ! ! #include "ais/ext_ai.h" --- 35,40 ---- #include "other/gup.h" #include "other/configrw.h" ! #include "other/gconfig.h" #include "ais/ext_ai.h" *************** *** 221,233 **** gobenemy = NULL; - int i; - for (i = 0; i < 3; i += 1) - stationSprite[i] = NULL; - for (i = 0; i < 3; i += 1) - station_pic_name[i] = NULL; - for (i = 0; i < 3; i += 1) - station_build_name[i] = NULL; defenderSprite = NULL; - } --- 219,223 ---- *************** *** 302,338 **** enemy_team = new_team(); ! DATAFILE *tmpdata; ! tmpdata = load_datafile_object("gob.dat", "station0sprite"); ! if (!tmpdata) error( "couldn't find gob.dat#station0sprite"); ! stationSprite[0] = new SpaceSprite(tmpdata, 1, SpaceSprite::MASKED | SpaceSprite::MIPMAPED, 64); ! unload_datafile_object(tmpdata); ! stationSprite[0]->permanent_phase_shift(8); ! ! tmpdata = load_datafile_object("gob.dat", "station1sprite"); ! if (!tmpdata) error ("couldn't find gob.dat#station1sprite"); ! stationSprite[1] = new SpaceSprite(tmpdata, 1, SpaceSprite::MASKED | SpaceSprite::MIPMAPED, 64); ! unload_datafile_object(tmpdata); ! stationSprite[1]->permanent_phase_shift(8); ! ! tmpdata = load_datafile_object("gob.dat", "station2sprite"); ! if (!tmpdata) error ("couldn't find gob.dat#station2sprite"); ! stationSprite[2] = new SpaceSprite(tmpdata, 1, SpaceSprite::MASKED | SpaceSprite::MIPMAPED, 64); ! unload_datafile_object(tmpdata); ! stationSprite[2]->permanent_phase_shift(8); ! ! tmpdata = load_datafile_object("gob.dat", "defender"); ! if (!tmpdata) error ("couldn't find gob.dat#defender"); ! defenderSprite = new SpaceSprite(tmpdata, 1, SpaceSprite::MASKED | SpaceSprite::MIPMAPED); ! unload_datafile_object(tmpdata); ! ! station_pic_name[0] = "gob.dat#station0picture.bmp"; ! station_pic_name[1] = "gob.dat#station1picture.bmp"; ! station_pic_name[2] = "gob.dat#station2picture.bmp"; ! station_build_name[0] = "supbl"; ! station_build_name[1] = "orzne"; ! station_build_name[2] = "kohma"; prepare(); --- 292,309 ---- enemy_team = new_team(); + // load objects from config file ! lua_State * ls = lua_open(); ! InitInitializeModule(ls); ! luaopen_base(ls); ! luaopen_table(ls); ! luaopen_io(ls); ! luaopen_string(ls); ! luaopen_math(ls); ! luaopen_debug(ls); + int a = lua_dofile (ls, "gamedata/gob/config.lua"); ! lua_close(ls); prepare(); *************** *** 340,362 **** add(new Stars()); - num_planets = 0; - i = 0; - add_planet_and_station(meleedata.planetSprite, i, stationSprite[i], station_build_name[i], station_pic_name[i], "Supox", "gamedata/supox_station.lua"); - i = 1; - add_planet_and_station(meleedata.planetSprite, i, stationSprite[i], station_build_name[i], station_pic_name[i], "Orz", "gamedata/orz_station.lua"); - i = 2; - add_planet_and_station(meleedata.planetSprite, i, stationSprite[i], station_build_name[i], station_pic_name[i], "Kohr-Ah", "gamedata/korah_station.lua"); - i = random(3); - add_planet_and_station(meleedata.planetSprite, i, stationSprite[i], "utwju", station_pic_name[i], "Utwig","gamedata/utwig_station.lua"); - for (i = 0; i < 19; i += 1) add(new GobAsteroid()); int ichoice = 2; // default, "no" 'don't load a game ! if (!lag_frames) ! { ! // check a menu to see what the player wants ... how ?? ! ichoice = tw_alert("Continue saved game?", "&YES", "&NO"); ! } if (ichoice == 2) --- 311,323 ---- add(new Stars()); for (i = 0; i < 19; i += 1) add(new GobAsteroid()); int ichoice = 2; // default, "no" 'don't load a game ! //if (!lag_frames) ! //{ ! // // check a menu to see what the player wants ... how ?? ! // ichoice = tw_alert("Continue saved game?", "&YES", "&NO"); ! //} if (ichoice == 2) *************** *** 409,418 **** sprintf(buffy, "Config%d", i); add_gobplayer(create_control(channel_server, "Human", buffy)); - // gobplayer[i]->new_ship(shiptype("supbl")); - // Ship *s = gobplayer[i]->ship; - // s->translate(size/2-s->normal_pos()); - // double angle = PI2 * i / (client_players + server_players); - // s->translate(rotate(Vector2(260, 120), angle)); - // s->accelerate(s, PI2/3 + angle, 0.17, MAX_SPEED); } --- 370,373 ---- *************** *** 443,449 **** /*! \brief Free game resources */ GobGame::~GobGame() { - delete stationSprite[0]; - delete stationSprite[1]; - delete stationSprite[2]; delete defenderSprite; int i; --- 398,401 ---- *************** *** 461,503 **** } - /*! \brief Add planet and station - \param planet_sprite ??? - \param planet_index ??? - \param station_sprite ??? - \param builds ??? - \param background ??? - \param sname station name (used for station identification ) - */ - void GobGame::add_planet_and_station ( SpaceSprite *planet_sprite, - int planet_index, - SpaceSprite *station_sprite, - const char *builds, - const char *background, - std::string sname, - std::string commander ) { - STACKTRACE; - - Planet *p = new Planet (size/2, planet_sprite, planet_index); - if (num_planets) while (true) { - SpaceLocation *n; - n = p->nearest_planet(); - if (!n || (p->distance(n) > 1500)) break; - p->translate(random(size)); - } - add ( p ); - - GobStation *gs = new GobStation(station_sprite, p, builds, - background, sname ); - gs->install_external_ai(commander.c_str()); - - gs->collide_flag_sameship = ALL_LAYERS; - gs->collide_flag_sameteam = ALL_LAYERS; - gs->collide_flag_anyone = ALL_LAYERS; - add ( gs ); - - gobgame->planet[gobgame->num_planets] = p; - gobgame->station[gobgame->num_planets] = gs; - gobgame->num_planets += 1; - } /*! \brief Print game information: enemies count, time, cordinates, money */ --- 413,416 ---- *************** *** 965,971 **** STACKTRACE; ! BITMAP *background = load_bitmap(background_pic, NULL); if (!background) { ! message.print(1000, 15, "%s", background_pic); error ("couldn't load station background"); } --- 878,884 ---- STACKTRACE; ! BITMAP *background = load_bitmap(background_pic.c_str(), NULL); if (!background) { ! message.print(1000, 15, "%s", background_pic.c_str()); error ("couldn't load station background"); } Index: ggob.h =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ggob.h 2 Mar 2004 12:33:51 -0000 1.16 --- ggob.h 5 Mar 2004 17:51:28 -0000 1.17 *************** *** 92,112 **** int next_add_new_enemy_time; - SpaceSprite *stationSprite[3]; - char *station_pic_name[3]; - char *station_build_name[3]; SpaceSprite *defenderSprite; public: int num_planets; ! Planet *planet[16]; ! GobStation *station[16]; ! void add_planet_and_station ( SpaceSprite *planet_sprite, ! int planet_index, ! SpaceSprite *station_sprite, ! const char *builds, ! const char *background, ! std::string sname, ! std::string commander); ! void save_game(); void load_game(); --- 92,100 ---- int next_add_new_enemy_time; SpaceSprite *defenderSprite; public: int num_planets; ! void save_game(); void load_game(); *************** *** 120,124 **** public: const char *build_type; ! const char *background_pic; GobStation ( SpaceSprite *pic, SpaceLocation *orbit_me, const char *ship, const char *background, --- 108,112 ---- public: const char *build_type; ! std::string background_pic; GobStation ( SpaceSprite *pic, SpaceLocation *orbit_me, const char *ship, const char *background, Index: gsolar.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gsolar.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gsolar.cpp 28 Feb 2004 15:18:24 -0000 1.9 --- gsolar.cpp 5 Mar 2004 17:51:28 -0000 1.10 *************** *** 363,378 **** - - - //#define STATION_LOG - - - /*void iMessage(char *cmdstr, int num) - { - char buf[200]; - sprintf(buf, cmdstr,num); - message.out(buf); - } */ - SpaceSprite *Solar::GetSprite(char *fileName, char *spriteName) { --- 363,366 ---- |
From: <yu...@us...> - 2004-03-05 18:05:47
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22648/source/melee Modified Files: manim.cpp mcbodies.h Log Message: Removing hard coded planet and station, replacing them with config file Index: manim.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/manim.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** manim.cpp 31 Jan 2004 20:46:44 -0000 1.8 --- manim.cpp 5 Mar 2004 17:51:28 -0000 1.9 *************** *** 2,6 **** #include "../melee.h" REGISTER_FILE ! #include "../util/aastr.h" #include "../ship.h" --- 2,6 ---- #include "../melee.h" REGISTER_FILE ! #include "../ship.h" *************** *** 8,11 **** --- 8,13 ---- #include "manim.h" + #include "../util/aastr.h" + Animation::Animation(SpaceLocation *creator, Vector2 opos, SpaceSprite *osprite, int first_frame, int num_frames, int frame_length, Index: mcbodies.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcbodies.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mcbodies.h 29 Jan 2004 21:20:29 -0000 1.7 --- mcbodies.h 5 Mar 2004 17:51:28 -0000 1.8 *************** *** 6,9 **** --- 6,10 ---- #include "mframe.h" + #include <string> class Asteroid : public SpaceObject { *************** *** 25,28 **** --- 26,30 ---- class Planet : public SpaceObject { + std::string name; public: double gravity_force; *************** *** 36,39 **** --- 38,44 ---- virtual void inflict_damage(SpaceObject *other); virtual void calculate(); + + void SetName(std::string sname) {name = sname;} + std::string GetName() {return name;}; }; |
From: <yu...@us...> - 2004-03-05 18:05:46
|
Update of /cvsroot/timewarp/source/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22648/source/util Modified Files: aastr.h Log Message: Removing hard coded planet and station, replacing them with config file Index: aastr.h =================================================================== RCS file: /cvsroot/timewarp/source/util/aastr.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** aastr.h 10 Jan 2004 22:27:58 -0000 1.5 --- aastr.h 5 Mar 2004 17:51:28 -0000 1.6 *************** *** 201,213 **** // Rotation. void aa_rotate_scaled_bitmap (BITMAP* src, BITMAP* dst, ! int x, int y, fixed angle, ! fixed scalex, fixed scaley); void aa_rotate_scaled_sprite (BITMAP* dst, BITMAP* src, ! int x, int y, fixed angle, ! fixed scalex, fixed scaley); void aa_rotate_bitmap (BITMAP* src, BITMAP* dst, ! int x, int y, fixed angle); void aa_rotate_sprite (BITMAP* dst, BITMAP* src, ! int x, int y, fixed angle); --- 201,213 ---- // Rotation. void aa_rotate_scaled_bitmap (BITMAP* src, BITMAP* dst, ! int x, int y, long angle, ! long scalex, long scaley); void aa_rotate_scaled_sprite (BITMAP* dst, BITMAP* src, ! int x, int y, long angle, ! long scalex, long scaley); void aa_rotate_bitmap (BITMAP* src, BITMAP* dst, ! int x, int y, long angle); void aa_rotate_sprite (BITMAP* dst, BITMAP* src, ! int x, int y, long angle); *************** *** 220,228 **** int mode); //does NOT perform checking/clipping on the source rectangle ! //parameters are fixed point (32-aa_BITS.aa_BITS) numbers void _aa_rotate_bitmap (BITMAP *_src, BITMAP *_dst, ! int _x, int _y, fixed _angle, ! fixed _scalex, fixed _scaley, int _mode); //destination is in integer format --- 220,228 ---- int mode); //does NOT perform checking/clipping on the source rectangle ! //parameters are long point (32-aa_BITS.aa_BITS) numbers void _aa_rotate_bitmap (BITMAP *_src, BITMAP *_dst, ! int _x, int _y, long _angle, ! long _scalex, long _scaley, int _mode); //destination is in integer format |
From: <yu...@us...> - 2004-03-05 18:05:46
|
Update of /cvsroot/timewarp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22648 Modified Files: twwin.dsp Log Message: Removing hard coded planet and station, replacing them with config file |
From: <yu...@us...> - 2004-03-05 18:05:46
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22648/source/other Modified Files: gdialog.cpp gdialog.h gquest.cpp gup.cpp Log Message: Removing hard coded planet and station, replacing them with config file Index: gdialog.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gdialog.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gdialog.cpp 1 Mar 2004 23:21:46 -0000 1.8 --- gdialog.cpp 5 Mar 2004 17:51:28 -0000 1.9 *************** *** 1,7 **** /* ! * Conversation module for GOB ! * (C) Yura Semashko aka Yurand <yu...@la...> ! * ! */ #include <allegro.h> --- 1,17 ---- /* ! This file is part of "Star Control: TimeWarp" ! http://timewarp.sourceforge.net/ ! Copyright (C) 2001-2004 TimeWarp development team ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! */ #include <allegro.h> Index: gdialog.h =================================================================== RCS file: /cvsroot/timewarp/source/other/gdialog.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gdialog.h 28 Feb 2004 01:05:49 -0000 1.3 --- gdialog.h 5 Mar 2004 17:51:28 -0000 1.4 *************** *** 1,2 **** --- 1,18 ---- + /* + This file is part of "Star Control: TimeWarp" + http://timewarp.sourceforge.net/ + Copyright (C) 2001-2004 TimeWarp development team + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + */ + #ifndef __GDIALOG_H__ #define __GDIALOG_H__ Index: gquest.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gquest.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** gquest.cpp 2 Mar 2004 12:33:51 -0000 1.17 --- gquest.cpp 5 Mar 2004 17:51:28 -0000 1.18 *************** *** 5,14 **** #endif ! #include "../melee.h" REGISTER_FILE ! #include "../melee/mship.h" ! #include "../games/ggob.h" #include "gdialog.h" ! #include "../melee/mview.h" // for message static GobPlayer * g_player = NULL; --- 5,14 ---- #endif ! #include "melee.h" REGISTER_FILE ! #include "melee/mship.h" ! #include "games/ggob.h" #include "gdialog.h" ! #include "melee/mview.h" // for message static GobPlayer * g_player = NULL; Index: gup.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gup.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gup.cpp 29 Jan 2004 21:20:30 -0000 1.9 --- gup.cpp 5 Mar 2004 17:51:28 -0000 1.10 *************** *** 578,582 **** void execute(Ship *ship, GobStation *station, GobPlayer *gs) { STACKTRACE ! locater = new Presence *[gobgame->num_planets]; for (int i = 0; i < gobgame->num_planets; i += 1) { --- 578,582 ---- void execute(Ship *ship, GobStation *station, GobPlayer *gs) { STACKTRACE ! /* locater = new Presence *[gobgame->num_planets]; for (int i = 0; i < gobgame->num_planets; i += 1) { *************** *** 584,587 **** --- 584,588 ---- gobgame->add (locater[i] ); } + */ } void clear(Ship *oship, Ship *nship, GobPlayer *gs) { |