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-02-24 23:32:06
|
Update of /cvsroot/timewarp/source/gamex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23694/gamex Modified Files: gamedata.cpp gamedialogue.cpp gamedialogue.h projectx.cpp projectx.h Log Message: changed gamex autoplay a little, so that you can choose gametypes or "normal" to start, and a few small other updates Index: gamedata.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedata.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gamedata.cpp 22 Feb 2004 11:37:59 -0000 1.14 --- gamedata.cpp 24 Feb 2004 23:25:08 -0000 1.15 *************** *** 50,53 **** --- 50,55 ---- void PlayerFleet::config(bool option) { + int i; + config_read = option; *************** *** 55,59 **** conf("N", N); ! int i; for ( i = 0; i < N; ++i ) { --- 57,64 ---- conf("N", N); ! if (option == CONFIG_READ) ! for (i = 0; i < N; ++i) ! fr[i] = new PlayerFleetRec("none"); ! for ( i = 0; i < N; ++i ) { *************** *** 66,73 **** void PlayerInfo::config(char *filename, bool option) { //configfilename = filename; ! set_config_file(filename); config_read = option; --- 71,79 ---- + void PlayerInfo::config(char *filename, bool option) { //configfilename = filename; ! set_conf(filename); config_read = option; Index: gamedialogue.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedialogue.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gamedialogue.cpp 22 Feb 2004 11:38:32 -0000 1.11 --- gamedialogue.cpp 24 Feb 2004 23:25:20 -0000 1.12 *************** *** 20,27 **** --- 20,30 ---- #include "general/sprites.h" + #include "../other/configrw.h" + static const int BlistLen = 128; + static GameAliendialog *dgame; *************** *** 39,42 **** --- 42,72 ---- + /** \brief toggle state of a certain node in a active dialogue. + id = the node identifier + */ + + + lua_func(enable) + { + Dialo *root = dgame->firstdialo; + + arg_string(id); + + Dialo *d; + d = root->findnode(id); + + if (d) + d->enable(); + + } + lua_ret + + /* + lua_func(disable) + { + arg_string(id); + } + lua_ret + */ *************** *** 80,85 **** } ! if (text[i] == '<' && strcmp(&text[i], "<lua>") == 0) ! break; ++i; --- 110,124 ---- } ! if (text[i] == '<') ! { ! if (strncmp(&text[i], "<lua>", 5) == 0) ! { ! if (i > 0) ! if (text[i-1] == '\n') ! --n; // you don't need to show the <lua> remark ! ! break; ! } ! } ++i; *************** *** 133,136 **** --- 172,177 ---- void GameAliendialog::init() { + dgame = this; + // the TTF library // antialias_init(0); *************** *** 227,233 **** --- 268,290 ---- // dialo should be defined BEFORE the game is initialized by a call to set_colony initBlist(dialo); + } + + char constr_savename_return[512]; + char *construct_savename(char *savename, char *ext) + { + char *fname = constr_savename_return; + + strcpy(fname, target_dir); + strcat(fname, "/"); + strcat(fname, savename); + strcat(fname, "."); + strcat(fname, ext); + + return fname; + } + void GameAliendialog::quit() { *************** *** 245,248 **** --- 302,308 ---- lua_close(L); + // FILE *outfile = savefile("...../... .dialogstate"); + // firstdialo->save_state(outfile); + // stop the ttf // antialias_exit(); *************** *** 373,376 **** --- 433,444 ---- if (dialo->mother) { + // and there is other stuff to do ... if the dialog has some + // commands, then we'll need to execute those ... + exec_commands(dialo_done); + // do this before initblist, because of ... well, state change + // otherwise, a node which has been altered, doesn't show up correctly + // in the option-list (cause altering it after initblist makes the + // alteration take no effect --> must be done before initblist). + // disable the question node, and go back // (a bit simple ... should really only be done after checking that *************** *** 386,394 **** // node has already been "done" showline_num = showline_Nlines; - // and there is other stuff to do ... if the dialog has some - // commands, then we'll need to execute those ... - exec_commands(dialo_done); } } --- 454,462 ---- // node has already been "done" showline_num = showline_Nlines; + + char *txt = showline(dialo->T, showline_num); + A->set_textinfo( txt, strlen(txt) ); } } *************** *** 499,502 **** --- 567,575 ---- char shipname[64]; + /** \brief Stores relation between an look-up string and a value-string (a simple map system), + which is used to replace stuff in dialogues with strings stored in the game (eg ship name and + player name). + */ + struct fgNamePtr { *************** *** 531,535 **** ! /** \brief Scans for special <identifiers> in the text, and replaces those with game-content. Currently the following commands are recognized: --- 604,608 ---- ! /** \brief Scans for special <identifiers> (fgnameptr) in the text, and replaces those with game-content. Currently the following commands are recognized: Index: gamedialogue.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedialogue.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gamedialogue.h 22 Feb 2004 11:38:32 -0000 1.10 --- gamedialogue.h 24 Feb 2004 23:25:20 -0000 1.11 *************** *** 22,26 **** FileStore *fs; ! Dialo *dialo, *firstdialo, *dialo_selected[32]; char *Blist[maxbranches]; --- 22,26 ---- FileStore *fs; ! Dialo *dialo, *dialo_selected[32]; char *Blist[maxbranches]; *************** *** 64,67 **** --- 64,69 ---- void set_colony(RaceColony *rc); void set_dialog(char *fname); + + Dialo *firstdialo; }; Index: projectx.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/projectx.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** projectx.cpp 22 Feb 2004 11:38:32 -0000 1.18 --- projectx.cpp 24 Feb 2004 23:25:20 -0000 1.19 *************** *** 20,24 **** ! void play_fg(DATAFILE **scp, int scpguimusic) { // destroy the gui --- 20,24 ---- ! void play_fg(DATAFILE **scp, int scpguimusic, const char *id) { // destroy the gui *************** *** 35,39 **** --- 35,41 ---- ProjectX *px; px = new ProjectX(); + px->startoption = id; px->play(); + //nm = 1; delete px; *************** *** 48,56 **** void ProjectX::init() { GameProject::init(); ! playerinfo.config("gamex/player/playerinfo.ini", CONFIG_READ); // initialize races info --- 50,74 ---- + char new_init_dir[512]; + char new_source_dir[512]; + char new_target_dir[512]; + void ProjectX::init() { GameProject::init(); ! // setup directories for default/ loading/ saving. ! strcpy(new_init_dir, "gamex"); ! init_dir = new_init_dir; ! ! strcpy(new_source_dir, "gamex"); ! source_dir = new_source_dir; ! ! strcpy(new_target_dir, "gamex"); // /save/save01"); ! target_dir = new_target_dir; ! ! ! ! playerinfo.config("player/playerinfo.ini", CONFIG_READ); // initialize races info *************** *** 69,95 **** ! /* ! add( new GameHyperspace() ); ! ! if (playerinfo.istar >= 0) ! add( new GameSolarview() ); ! ! if (playerinfo.iplanet >= 0) ! add( new GamePlanetview() ); ! // */ ! // add( new GameStarmap() ); ! // add( new GameSolarview() ); ! // add( new GamePlanetview() ); ! // add( new GamePlanetscan() ); ! // add( new GameMelee() ); ! // add( new GameDialogue() ); // the editor ! add( new GameAliendialog() ); // the alien interface -- need additional info, can't just load like this. ! // add( new GameTriggerEdit() ); ! // add( new GameTriggerEdit() ); ! } --- 87,126 ---- ! if (strcmp(startoption, "normal") == 0) ! { ! add( new GameHyperspace() ); ! ! if (playerinfo.istar >= 0) ! add( new GameSolarview() ); ! ! if (playerinfo.iplanet >= 0) ! add( new GamePlanetview() ); ! } ! if (strcmp(startoption, "starmap") == 0) ! add( new GameStarmap() ); ! ! if (strcmp(startoption, "solar") == 0) ! add( new GameSolarview() ); ! ! if (strcmp(startoption, "planet") == 0) ! add( new GamePlanetview() ); ! ! if (strcmp(startoption, "scan") == 0) ! add( new GamePlanetscan() ); ! ! if (strcmp(startoption, "melee") == 0) ! add( new GameMelee() ); ! ! // the dialog editor ! if (strcmp(startoption, "editor") == 0) ! add( new GameDialogue() ); ! ! // the alien dialog interface ! if (strcmp(startoption, "dialog") == 0) ! add( new GameAliendialog() ); } *************** *** 98,102 **** { //playerinfo.write(); ! playerinfo.config("gamex/player/playerinfo.ini", CONFIG_WRITE); // save edited races info (only saves changes) --- 129,133 ---- { //playerinfo.write(); ! playerinfo.config("player/playerinfo.ini", CONFIG_WRITE); // save edited races info (only saves changes) Index: projectx.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/projectx.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** projectx.h 10 Jan 2004 22:27:58 -0000 1.2 --- projectx.h 24 Feb 2004 23:25:20 -0000 1.3 *************** *** 7,11 **** // this manipulates the *scp pointer (loads/ unloads data ... real nasty). ! extern void play_fg(DATAFILE **scp, int scpguimusic); --- 7,12 ---- // this manipulates the *scp pointer (loads/ unloads data ... real nasty). ! extern void play_fg(DATAFILE **scp, int scpguimusic, const char *id = "normal"); ! *************** *** 14,17 **** --- 15,19 ---- { public: + const char *startoption; // you can use this to add the first gametype, or initialize some data as well. |
From: <geo...@us...> - 2004-02-24 23:29:36
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23194/melee Modified Files: mship.h Log Message: change crew float into crew double Index: mship.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** mship.h 21 Feb 2004 00:29:18 -0000 1.17 --- mship.h 24 Feb 2004 23:22:52 -0000 1.18 *************** *** 98,105 **** virtual void materialize(); ! float crew; ! float crew_max; ! float batt; ! float batt_max; double turn_rate; double turn_step; --- 98,105 ---- virtual void materialize(); ! double crew; ! double crew_max; ! double batt; ! double batt_max; double turn_rate; double turn_step; |
From: <geo...@us...> - 2004-02-24 23:29:15
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23124/other Modified Files: configrw.cpp configrw.h Log Message: no message Index: configrw.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/configrw.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** configrw.cpp 22 Feb 2004 11:37:59 -0000 1.2 --- configrw.cpp 24 Feb 2004 23:22:30 -0000 1.3 *************** *** 62,63 **** --- 62,90 ---- } + + + char *init_dir = "gamedata"; + char *source_dir = "save/save01"; + char *target_dir = "save/save01"; + + void set_conf(char *f) + { + char s[512]; + + if (config_read) + strcpy(s, source_dir); + else + strcpy(s, target_dir); + + // to-do: + // check if the target-directory exists, if not, create it. + // if (!file_exists(s, FA_DIREC, 0)) // this is too limited, "f" can also contain directory info... + // mkdir(s); + + strcat(s, "/"); + strcat(s, f); + + set_config_file(s); + } + + Index: configrw.h =================================================================== RCS file: /cvsroot/timewarp/source/other/configrw.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** configrw.h 22 Feb 2004 10:48:20 -0000 1.1 --- configrw.h 24 Feb 2004 23:22:30 -0000 1.2 *************** *** 52,55 **** --- 52,77 ---- + /** \brief the default directory, where all "clean" data are stored. Those data define + the start of a new game. + */ + + extern char *init_dir; + + /** \brief the directory used to get resources from. This can point to any valid data + directory: the init directory, or a save-game directory. + */ + extern char *source_dir; + + /** \brief the directory where game-data are save to + */ + extern char *target_dir; + + /** \brief this defines a set_config_file based on the source or target-dir, and + append the f filename to that directory. + */ + void set_conf(char *f); + + + #endif |
From: <geo...@us...> - 2004-02-24 23:28:43
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22995/games Modified Files: ggob.cpp ggob.h Log Message: added a primitive savegame option when you enter a starbase. Limited to Supox only... Index: ggob.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ggob.cpp 5 Feb 2004 01:36:19 -0000 1.23 --- ggob.cpp 24 Feb 2004 23:21:54 -0000 1.24 *************** *** 36,39 **** --- 36,150 ---- #include "../other/gup.h" + #include "../other/configrw.h" + + + void GobGame::config(bool option) + { + config_read = option; + + GobPlayer *gp = gobplayer[0]; + Ship *s = 0; + + // store ship properties (includes its upgrades) + section = "ship"; + + if (option == CONFIG_READ) + { + Vector2 P; + double a; + + char shipid[64]; + conf("name", shipid, "supbl"); + conf("x", P.x, 0); + conf("y", P.y, 0); + conf("a", a, 0); + + // needed, cause the ship initialization overwrites the config file used now + push_config_state(); + + //s = create_ship(shipid, gp->control, P, 0.0, 0); + gp->new_ship(shiptype(shipid)); + + pop_config_state(); + s = gp->ship; + + gp->ship = s; + gp->ship->pos = P; + gp->ship->angle = a; + + } else { + s = gp->ship; + conf("name", (char*)s->type->id, "supbl"); + conf("x", s->pos.x, 0); + conf("y", s->pos.y, 0); + conf("a", s->angle, 0); + } + + conf("crew", s->crew, 1); + conf("crewm", s->crew_max, 1); + conf("batt", s->batt, 1); + conf("battm", s->batt_max, 1); + conf("accr", s->accel_rate, 1); + conf("speedmax", s->speed_max, 1); + conf("turnr", s->turn_rate, 1); + conf("mass", s->mass, 1); + conf("rechamount", s->recharge_amount, 1); + conf("rechrate", s->recharge_rate, 1); + conf("specrate", s->special_rate, 1); + conf("specdrain", s->special_drain, 1); + conf("weaprate", s->weapon_rate, 1); + conf("weapdrain", s->weapon_drain, 1); + conf("damfac", s->damage_factor, 1); + // conf("", s-, 1); + + section = "props"; + conf("kills", gp->kills, 0); + conf("bucka", gp->buckazoids, 0); + conf("starb", gp->starbucks, 0); + conf("vbucka", gp->value_buckazoids, 0); + conf("vstarb", gp->value_starbucks, 0); + + section = "special"; + if (strcmp("supbl", s->type->id)) + { + conf("damage", ((SupoxBlade*)s)->weaponDamage, 1); + conf("drain", ((SupoxBlade*)s)->weapon_drain, 1); + conf("armour", ((SupoxBlade*)s)->weaponArmour, 1); + } + + + // hmm .. well .. there are lots of special ships and devices, so + // this is not all, by far, yet !! + + // conf("", s-, 1); + // conf("", s-, 1); + // conf("", s-, 1); + + s->vel = 0; + } + + + void GobGame::save_game() + { + // write player settings to some config file ? + set_config_file("gamedata/gob/player.ini"); + config(CONFIG_WRITE); + flush_config_file(); + } + + void GobGame::load_game() + { + set_config_file("gamedata/gob/player.ini"); + config(CONFIG_READ); + } + + + void GobGame::quit(const char *message) + { + //save_game(); + Game::quit(message); + } + + #define gobgame ((GobGame*)game) *************** *** 50,54 **** */ int GobAsteroid::handle_damage (SpaceLocation *source, double normal, double direct) { ! STACKTRACE if (!exists()) return 0; --- 161,165 ---- */ int GobAsteroid::handle_damage (SpaceLocation *source, double normal, double direct) { ! STACKTRACE; if (!exists()) return 0; *************** *** 63,67 **** /*! \brief After asteroid death show explosion and generate new asteroid */ void GobAsteroid::death () { ! STACKTRACE --- 174,178 ---- /*! \brief After asteroid death show explosion and generate new asteroid */ void GobAsteroid::death () { ! STACKTRACE; *************** *** 77,81 **** /*! \brief Init various gob variables and stations sprites to NULL */ void GobGame::preinit() { ! STACKTRACE Game::preinit(); --- 188,192 ---- /*! \brief Init various gob variables and stations sprites to NULL */ void GobGame::preinit() { ! STACKTRACE; Game::preinit(); *************** *** 102,106 **** */ void GobGame::add_gobplayer(Control *control) { ! STACKTRACE int i = gobplayers; --- 213,217 ---- */ void GobGame::add_gobplayer(Control *control) { ! STACKTRACE; int i = gobplayers; *************** *** 117,121 **** */ void GobPlayer::died(SpaceLocation *killer) { ! STACKTRACE if (upgrade_list[UpgradeIndex::divinefavor]->num && (random()&1)) { //divine favor --- 228,232 ---- */ void GobPlayer::died(SpaceLocation *killer) { ! STACKTRACE; if (upgrade_list[UpgradeIndex::divinefavor]->num && (random()&1)) { //divine favor *************** *** 136,140 **** */ void GobGame::play_sound (SAMPLE *sample, SpaceLocation *source, int vol, int freq) { ! STACKTRACE double v; --- 247,251 ---- */ void GobGame::play_sound (SAMPLE *sample, SpaceLocation *source, int vol, int freq) { ! STACKTRACE; double v; *************** *** 154,158 **** */ void GobGame::init(Log *_log) { ! STACKTRACE int i; --- 265,269 ---- */ void GobGame::init(Log *_log) { ! STACKTRACE; int i; *************** *** 229,259 **** for (i = 0; i < 19; i += 1) add(new GobAsteroid()); ! 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); } --- 340,407 ---- for (i = 0; i < 19; i += 1) add(new GobAsteroid()); ! int ichoice = 1; ! ichoice = tw_alert("Continue game?", "&YES", "&NO"); ! // check a menu to see what the player wants ... how ?? ! ! 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); ! } ! ! } else if (ichoice == 1) { ! ! // 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); ! 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); ! } ! ! load_game(); ! } else { ! tw_error("Strange, this option is not supported"); } *************** *** 304,308 **** */ void GobGame::add_planet_and_station ( SpaceSprite *planet_sprite, int planet_index, SpaceSprite *station_sprite, const char *builds, const char *background) { ! STACKTRACE Planet *p = new Planet (size/2, planet_sprite, planet_index); --- 452,456 ---- */ void GobGame::add_planet_and_station ( SpaceSprite *planet_sprite, int planet_index, SpaceSprite *station_sprite, const char *builds, const char *background) { ! STACKTRACE; Planet *p = new Planet (size/2, planet_sprite, planet_index); *************** *** 329,333 **** /*! \brief Print game information: enemies count, time, cordinates, money */ void GobGame::fps() { ! STACKTRACE Game::fps(); --- 477,481 ---- /*! \brief Print game information: enemies count, time, cordinates, money */ void GobGame::fps() { ! STACKTRACE; Game::fps(); *************** *** 356,360 **** */ void GobGame::calculate() { ! STACKTRACE quest_source->ProcessQuests(); --- 504,508 ---- */ void GobGame::calculate() { ! STACKTRACE; quest_source->ProcessQuests(); *************** *** 383,387 **** */ int GobGame::get_enemy_index(SpaceLocation *what) { ! STACKTRACE int i; --- 531,535 ---- */ int GobGame::get_enemy_index(SpaceLocation *what) { ! STACKTRACE; int i; *************** *** 399,405 **** */ void GobGame::ship_died(Ship *who, SpaceLocation *source) { ! STACKTRACE ! EventShipDie esd; esd.victim = who; esd.player_killer = get_player(source); --- 547,553 ---- */ void GobGame::ship_died(Ship *who, SpaceLocation *source) { ! STACKTRACE; ! EventShipDie esd; esd.victim = who; esd.player_killer = get_player(source); *************** *** 430,437 **** */ GobPlayer *GobGame::get_player(SpaceLocation *what) { ! STACKTRACE ! if ( what == NULL ) ! return NULL; int i; --- 578,585 ---- */ GobPlayer *GobGame::get_player(SpaceLocation *what) { ! STACKTRACE; ! if ( what == NULL ) ! return NULL; int i; *************** *** 445,449 **** */ void GobGame::add_new_enemy () { ! STACKTRACE const int num_enemy_types = 19; --- 593,597 ---- */ void GobGame::add_new_enemy () { ! STACKTRACE; const int num_enemy_types = 19; *************** *** 518,524 **** */ void GobEnemy::init(Ship *ship, int kill_starbucks, int kill_buckazoids) { ! STACKTRACE ! this->ship = ship; this->starbucks = kill_starbucks; this->buckazoids = kill_buckazoids; --- 666,672 ---- */ void GobEnemy::init(Ship *ship, int kill_starbucks, int kill_buckazoids) { ! STACKTRACE; ! this->ship = ship; this->starbucks = kill_starbucks; this->buckazoids = kill_buckazoids; *************** *** 529,535 **** */ void GobEnemy::died(SpaceLocation *what) { ! STACKTRACE ! GobPlayer *p = gobgame->get_player(what); if (p) { p->starbucks += starbucks; --- 677,683 ---- */ void GobEnemy::died(SpaceLocation *what) { ! STACKTRACE; ! GobPlayer *p = gobgame->get_player(what); if (p) { p->starbucks += starbucks; *************** *** 550,556 **** */ void GobPlayer::init(Control *c, TeamCode team, GobGame * g) { ! STACKTRACE ! channel = c->channel; starbucks = 0; buckazoids = 0; --- 698,704 ---- */ void GobPlayer::init(Control *c, TeamCode team, GobGame * g) { ! STACKTRACE; ! channel = c->channel; starbucks = 0; buckazoids = 0; *************** *** 578,584 **** /*! \brief Part of map<const char *, int> implementation, to be removed */ GobPlayer::pair *GobPlayer::_get_pair(const char *id) { ! STACKTRACE ! if (!pair_list) return NULL; int i; for (i = 0; i < num_pairs; i += 1) { --- 726,732 ---- /*! \brief Part of map<const char *, int> implementation, to be removed */ GobPlayer::pair *GobPlayer::_get_pair(const char *id) { ! STACKTRACE; ! if (!pair_list) return NULL; int i; for (i = 0; i < num_pairs; i += 1) { *************** *** 591,612 **** /*! \brief Part of map<const char *, int> implementation, to be removed */ void GobPlayer::_add_pair(const char *id, int value) { ! STACKTRACE ! ! if (_get_pair(id)) { ! error("GobPlayer::_add_pair - \"%s\" already exists", id); ! return; ! } ! pair_list = (pair*)realloc(pair_list, sizeof(pair) * (num_pairs+1)); ! pair_list[num_pairs].id = strdup(id); ! pair_list[num_pairs].value = value; ! num_pairs += 1; return; } /*! \brief Part of map<const char *, int> implementation, to be removed */ int GobPlayer::read_pair(const char *id) { ! STACKTRACE ! pair *p = _get_pair(id); if (p) return p->value; return -1; --- 739,760 ---- /*! \brief Part of map<const char *, int> implementation, to be removed */ void GobPlayer::_add_pair(const char *id, int value) { ! STACKTRACE; ! ! if (_get_pair(id)) { ! error("GobPlayer::_add_pair - \"%s\" already exists", id); return; + } + pair_list = (pair*)realloc(pair_list, sizeof(pair) * (num_pairs+1)); + pair_list[num_pairs].id = strdup(id); + pair_list[num_pairs].value = value; + num_pairs += 1; + return; } /*! \brief Part of map<const char *, int> implementation, to be removed */ int GobPlayer::read_pair(const char *id) { ! STACKTRACE; ! pair *p = _get_pair(id); if (p) return p->value; return -1; *************** *** 615,621 **** /*! \brief Part of map<const char *, int> implementation, to be removed */ void GobPlayer::write_pair(const char *id, int value) { ! STACKTRACE ! pair *p = _get_pair(id); if (p) p->value = value; else _add_pair(id, value); --- 763,769 ---- /*! \brief Part of map<const char *, int> implementation, to be removed */ void GobPlayer::write_pair(const char *id, int value) { ! STACKTRACE; ! pair *p = _get_pair(id); if (p) p->value = value; else _add_pair(id, value); *************** *** 629,635 **** */ int GobPlayer::charge (char *name, int price_starbucks, int price_buckazoids) { ! STACKTRACE ! char buffy1[512]; sprintf(buffy1, "Price: %d starbucks plus %d buckazoids", price_starbucks, price_buckazoids); if ((starbucks < price_starbucks) || (buckazoids < price_buckazoids)) { --- 777,783 ---- */ int GobPlayer::charge (char *name, int price_starbucks, int price_buckazoids) { ! STACKTRACE; ! char buffy1[512]; sprintf(buffy1, "Price: %d starbucks plus %d buckazoids", price_starbucks, price_buckazoids); if ((starbucks < price_starbucks) || (buckazoids < price_buckazoids)) { *************** *** 654,660 **** */ void GobPlayer::new_ship(ShipType *type) { ! STACKTRACE ! Ship *old = ship; Vector2 pos = 0; double a = 0; --- 802,808 ---- */ void GobPlayer::new_ship(ShipType *type) { ! STACKTRACE; ! Ship *old = ship; Vector2 pos = 0; double a = 0; *************** *** 706,712 **** */ void GobStation::buy_new_ship_menu(GobPlayer *s) { ! STACKTRACE ! char buffy1[512], buffy2[512]; ShipType *otype = s->ship->type; ShipType *ntype = shiptype(build_type); --- 854,860 ---- */ void GobStation::buy_new_ship_menu(GobPlayer *s) { ! STACKTRACE; ! char buffy1[512], buffy2[512]; ShipType *otype = s->ship->type; ShipType *ntype = shiptype(build_type); *************** *** 766,776 **** #define STATION_DIALOG_REPAIR 3 #define STATION_DIALOG_QUEST 4 static DIALOG station_dialog[] = {// (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) ! { d_button_proc, 385, 50, 150, 30, 255, 0, 0, D_EXIT, 0, 0, (void *)"Depart Station" , NULL, NULL }, ! { my_d_button_proc, 385, 90, 150, 30, 255, 0, 0, D_EXIT, 0, 0, (void *)"Upgrade Ship" , NULL, NULL }, ! { my_d_button_proc, 385, 130, 150, 30, 255, 0, 0, D_EXIT, 0, 0, (void *)"Buy New Ship" , NULL, NULL }, ! { my_d_button_proc, 385, 170, 150, 30, 255, 0, 0, D_EXIT, 0, 0, (void *)"Repair Ship" , NULL, NULL }, ! { my_d_button_proc, 385, 210, 150, 30, 255, 0, 0, D_EXIT, 0, 0, (void *)"Get Quest" , NULL, NULL }, { d_text_proc, 185, 420, 270, 30, 255, 0, 0, 0, 0, 0, dialog_string[0], NULL, NULL }, { d_tw_yield_proc, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, NULL, NULL, NULL }, --- 914,926 ---- #define STATION_DIALOG_REPAIR 3 #define STATION_DIALOG_QUEST 4 + #define STATION_DIALOG_SAVE 5 static DIALOG station_dialog[] = {// (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) ! { d_button_proc, 385, 50, 150, 30, 255, 0, 0, D_EXIT, 0, 0, (void *)"Depart Station" , NULL, NULL },//STATION_DIALOG_DEPART ! { my_d_button_proc, 385, 90, 150, 30, 255, 0, 0, D_EXIT, 0, 0, (void *)"Upgrade Ship" , NULL, NULL },//STATION_DIALOG_UPGRADE ! { my_d_button_proc, 385, 130, 150, 30, 255, 0, 0, D_EXIT, 0, 0, (void *)"Buy New Ship" , NULL, NULL },//STATION_DIALOG_NEWSHIP ! { my_d_button_proc, 385, 170, 150, 30, 255, 0, 0, D_EXIT, 0, 0, (void *)"Repair Ship" , NULL, NULL },//STATION_DIALOG_REPAIR ! { my_d_button_proc, 385, 210, 150, 30, 255, 0, 0, D_EXIT, 0, 0, (void *)"Get Quest" , NULL, NULL },//STATION_DIALOG_QUEST ! { my_d_button_proc, 385, 250, 150, 30, 255, 0, 0, D_EXIT, 0, 0, (void *)"Save Game" , NULL, NULL },//STATION_DIALOG_SAVE { d_text_proc, 185, 420, 270, 30, 255, 0, 0, 0, 0, 0, dialog_string[0], NULL, NULL }, { d_tw_yield_proc, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, NULL, NULL, NULL }, *************** *** 782,786 **** */ void GobStation::station_screen(GobPlayer *s) { ! STACKTRACE BITMAP *background = load_bitmap(background_pic, NULL); --- 932,936 ---- */ void GobStation::station_screen(GobPlayer *s) { ! STACKTRACE; BITMAP *background = load_bitmap(background_pic, NULL); *************** *** 862,865 **** --- 1012,1023 ---- } break; + + case STATION_DIALOG_SAVE: + { + // saves the last game. + gobgame->save_game(); + } + break; + case STATION_DIALOG_QUEST: // experiment code *************** *** 878,882 **** */ void GobStation::inflict_damage(SpaceObject *other) { ! STACKTRACE SpaceObject::inflict_damage(other); --- 1036,1040 ---- */ void GobStation::inflict_damage(SpaceObject *other) { ! STACKTRACE; SpaceObject::inflict_damage(other); *************** *** 911,915 **** */ char *upgradeListboxGetter(int index, int *list_size) { ! STACKTRACE static char tmp[150]; --- 1069,1073 ---- */ char *upgradeListboxGetter(int index, int *list_size) { ! STACKTRACE; static char tmp[150]; *************** *** 941,945 **** */ void GobStation::upgrade_menu(GobStation *station, GobPlayer *gs) { ! STACKTRACE int i; --- 1099,1103 ---- */ void GobStation::upgrade_menu(GobStation *station, GobPlayer *gs) { ! STACKTRACE; int i; *************** *** 991,995 **** */ void GobDefender::calculate() { ! STACKTRACE SpaceObject::calculate(); --- 1149,1153 ---- */ void GobDefender::calculate() { ! STACKTRACE; SpaceObject::calculate(); *************** *** 1044,1048 **** */ void RainbowRift::animate( Frame *frame ) { ! STACKTRACE Vector2 s; --- 1202,1206 ---- */ void RainbowRift::animate( Frame *frame ) { ! STACKTRACE; Vector2 s; *************** *** 1070,1074 **** /*! \brief ??? */ void RainbowRift::squiggle() { ! STACKTRACE int i; --- 1228,1232 ---- /*! \brief ??? */ void RainbowRift::squiggle() { ! STACKTRACE; int i; *************** *** 1097,1101 **** /*! \brief ??? */ void RainbowRift::calculate() { ! STACKTRACE while (game->game_time > next_time) { --- 1255,1259 ---- /*! \brief ??? */ void RainbowRift::calculate() { ! STACKTRACE; while (game->game_time > next_time) { Index: ggob.h =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ggob.h 5 Feb 2004 01:36:19 -0000 1.12 --- ggob.h 24 Feb 2004 23:21:55 -0000 1.13 *************** *** 107,110 **** --- 107,116 ---- GobStation *station[16]; void add_planet_and_station ( SpaceSprite *planet_sprite, int planet_index, SpaceSprite *station_sprite, const char *builds, const char *background); + + void save_game(); + void load_game(); + void config(bool option); + + virtual void quit(const char *message); }; |
From: <you...@us...> - 2004-02-23 06:03:54
|
Update of /cvsroot/timewarp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28305 Modified Files: scp.ini Log Message: changing default keys to: player1: cursor keys, ctrl and enter; player 2: WASD and J and K |
From: <geo...@us...> - 2004-02-22 11:52:07
|
Update of /cvsroot/timewarp/gamex/player In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30643/gamex/player Modified Files: playerinfo.ini Log Message: no message Index: playerinfo.ini =================================================================== RCS file: /cvsroot/timewarp/gamex/player/playerinfo.ini,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** playerinfo.ini 21 Feb 2004 00:29:18 -0000 1.6 --- playerinfo.ini 22 Feb 2004 11:39:23 -0000 1.7 *************** *** 1,8 **** RU = 1200.000000 - Angle = 10.288713 PlanetCode = -1 ! Moon = -1 ! Planet = -1 Star = -1 PosY = 379.324890 PosX = 256.044312 --- 1,19 ---- RU = 1200.000000 PlanetCode = -1 ! Moon = -1.000000 ! Planet = -1.000000 ! Star = -1.000000 ! PosY = 547.207397 ! PosX = 706.461060 ! ! [Names] ! player = Zel ! ship = Titanic Star = -1 PosY = 379.324890 PosX = 256.044312 + + [Fleet] + N = 1.000000 + crew0 = 1.000000 + id0 = spael |
From: <geo...@us...> - 2004-02-22 11:51:15
|
Update of /cvsroot/timewarp/source/gamex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30510/gamex Modified Files: gamedialogue.cpp gamedialogue.h projectx.cpp Log Message: dialog update (include lua commands ??) Index: gamedialogue.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedialogue.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gamedialogue.cpp 22 Feb 2004 10:49:38 -0000 1.10 --- gamedialogue.cpp 22 Feb 2004 11:38:32 -0000 1.11 *************** *** 26,30 **** ! lua_func(addship) --- 26,31 ---- ! /** \brief add a ship to the player fleet ! */ lua_func(addship) *************** *** 358,361 **** --- 359,364 ---- dialo->check_state(); + + Dialo *dialo_done = dialo; if (!dialo->state) *************** *** 387,391 **** // and there is other stuff to do ... if the dialog has some // commands, then we'll need to execute those ... ! exec_commands(); } } --- 390,394 ---- // and there is other stuff to do ... if the dialog has some // commands, then we'll need to execute those ... ! exec_commands(dialo_done); } } *************** *** 571,585 **** */ ! void GameAliendialog::exec_commands() { - // the dialog text - char *txt = dialo->T; // find the start of commands ! char *com = "addship(\"spael\");"; ! lua_dochunk(L, &com); } --- 574,593 ---- */ ! void GameAliendialog::exec_commands(Dialo *d) { // find the start of commands + char *txt = strstr(d->T, "<lua>"); + if (!txt) + return; ! // all lines following <lua> are assumed to be lua-commands. ! //char *com = "addship(\"spael\");"; ! ! txt += strlen("<lua>"); ! ! lua_dochunk(L, &txt); } Index: gamedialogue.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedialogue.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gamedialogue.h 22 Feb 2004 10:49:38 -0000 1.9 --- gamedialogue.h 22 Feb 2004 11:38:32 -0000 1.10 *************** *** 56,60 **** bool eol(char c); ! void exec_commands(); public: --- 56,60 ---- bool eol(char c); ! void exec_commands(Dialo *d); public: Index: projectx.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/projectx.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** projectx.cpp 22 Feb 2004 10:49:38 -0000 1.17 --- projectx.cpp 22 Feb 2004 11:38:32 -0000 1.18 *************** *** 16,19 **** --- 16,20 ---- #include "edit/edit_dialogue.h" #include "gamedialogue.h" + #include "../other/configrw.h" *************** *** 51,55 **** GameProject::init(); ! playerinfo.init("gamex/player/playerinfo.ini"); // initialize races info --- 52,56 ---- GameProject::init(); ! playerinfo.config("gamex/player/playerinfo.ini", CONFIG_READ); // initialize races info *************** *** 96,100 **** void ProjectX::quit() { ! playerinfo.write(); // save edited races info (only saves changes) --- 97,102 ---- void ProjectX::quit() { ! //playerinfo.write(); ! playerinfo.config("gamex/player/playerinfo.ini", CONFIG_WRITE); // save edited races info (only saves changes) |
From: <geo...@us...> - 2004-02-22 11:50:43
|
Update of /cvsroot/timewarp/source/gamex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30400/gamex Modified Files: gamedata.cpp gamedata.h Log Message: config update Index: gamedata.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedata.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** gamedata.cpp 22 Feb 2004 10:49:38 -0000 1.13 --- gamedata.cpp 22 Feb 2004 11:37:59 -0000 1.14 *************** *** 64,107 **** - void PlayerInfo::init(char *filename) - { - configfilename = filename; - - set_config_file(filename); - pos.x = get_config_float(0, "PosX", 0.0); - pos.y = get_config_float(0, "PosY", 0.0); - angle = get_config_float(0, "Angle", 0.0); - - istar = get_config_int(0, "Star", -1); - iplanet = get_config_int(0, "Planet", -1); - imoon = get_config_int(0, "Moon", -1); // of planets and moons - RU = get_config_float(0, "RU", 0); - - strncpy(playername, get_config_string("Names", "player", "nobody"), sizeof(playername)); - strncpy(shipname, get_config_string("Names", "ship", "dustbin"), sizeof(shipname)); ! fleet.config(CONFIG_READ); ! } ! void PlayerInfo::write() ! { ! set_config_file(configfilename); ! set_config_float(0, "PosX", pos.x); ! set_config_float(0, "PosY", pos.y); ! set_config_float(0, "Angle", angle); ! set_config_int(0, "Star", istar); ! set_config_int(0, "Planet", iplanet); ! set_config_int(0, "Moon", imoon); //set_config_int(0, "PlanetCode", iplanetcode); ! set_config_float(0, "RU", RU); ! fleet.config(CONFIG_WRITE); } void PlayerInfo::sync(LocalPlayerInfo *p) { --- 64,97 ---- ! void PlayerInfo::config(char *filename, bool option) ! { ! //configfilename = filename; ! set_config_file(filename); + config_read = option; + section = 0; ! conf("PosX", pos.x); ! conf("PosY", pos.y); ! conf("Angle", angle); ! conf("Star", istar, -1); ! conf("Planet", iplanet, -1); ! conf("Moon", imoon, -1); //set_config_int(0, "PlanetCode", iplanetcode); ! conf("RU", RU); ! section = "Names"; ! conf("player", playername, "nobody"); ! conf("ship", shipname, "dustbin"); ! ! fleet.config(option); } + void PlayerInfo::sync(LocalPlayerInfo *p) { Index: gamedata.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedata.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** gamedata.h 22 Feb 2004 10:49:38 -0000 1.13 --- gamedata.h 22 Feb 2004 11:37:59 -0000 1.14 *************** *** 194,198 **** class PlayerInfo { ! char *configfilename; public: Vector2 pos, vel; --- 194,198 ---- class PlayerInfo { ! //char *configfilename; public: Vector2 pos, vel; *************** *** 209,214 **** ! void init(char *filename); ! void write(); void sync(LocalPlayerInfo *p); --- 209,215 ---- ! //void init(char *filename); ! //void write(); ! void config(char *filename, bool option); void sync(LocalPlayerInfo *p); |
From: <geo...@us...> - 2004-02-22 11:50:42
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30400/other Modified Files: configrw.cpp Log Message: config update Index: configrw.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/configrw.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** configrw.cpp 22 Feb 2004 10:48:20 -0000 1.1 --- configrw.cpp 22 Feb 2004 11:37:59 -0000 1.2 *************** *** 21,25 **** x = get_config_int(section, id, def); else ! set_config_float(section, id, x); } --- 21,25 ---- x = get_config_int(section, id, def); else ! set_config_int(section, id, x); } |
From: <geo...@us...> - 2004-02-22 11:02:49
|
Update of /cvsroot/timewarp/source/gamex/edit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22294/gamex/edit Modified Files: edit_dialogue.h Log Message: small update Index: edit_dialogue.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/edit/edit_dialogue.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** edit_dialogue.h 15 Feb 2004 13:08:56 -0000 1.8 --- edit_dialogue.h 22 Feb 2004 10:49:36 -0000 1.9 *************** *** 15,18 **** --- 15,23 ---- const int maxdialotriggers = 16; + /** \brief The record of a dialogue-node. A dialogue consists of many of these + linked records. + + */ + struct Dialo { |
From: <geo...@us...> - 2004-02-22 11:02:49
|
Update of /cvsroot/timewarp/source/twgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22294/twgui Modified Files: gamebuttonevent.h twbutton.h twbuttontypes.h twhelpers.h Log Message: small update Index: gamebuttonevent.h =================================================================== RCS file: /cvsroot/timewarp/source/twgui/gamebuttonevent.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gamebuttonevent.h 25 Jan 2004 12:41:24 -0000 1.3 --- gamebuttonevent.h 22 Feb 2004 10:49:37 -0000 1.4 *************** *** 2,6 **** --- 2,12 ---- #ifndef __GAMEBUTTONEVENT_H__ #define __GAMEBUTTONEVENT_H__ + /** \brief Referenced by pointer by a button; if the value is non-zero, it + calls the routines in this struct, based on the mouse state. In this way you + can define specific funtions inside your game code. It's a template, so that it allows + you to pass pointers to game-class functions, i.e., functions which have access + to all the variables you need. + */ template <class G> Index: twbutton.h =================================================================== RCS file: /cvsroot/timewarp/source/twgui/twbutton.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** twbutton.h 15 Feb 2004 13:08:57 -0000 1.3 --- twbutton.h 22 Feb 2004 10:49:37 -0000 1.4 *************** *** 25,28 **** --- 25,32 ---- + /** \brief The bare button type. Any buttons are derived from this. Basically, + only the i/o is defined here. + + */ class EmptyButton { *************** *** 127,130 **** --- 131,138 ---- + /** \brief A more specialized button type, which provides graphical routines + for display. + + */ class GraphicButton : public EmptyButton Index: twbuttontypes.h =================================================================== RCS file: /cvsroot/timewarp/source/twgui/twbuttontypes.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** twbuttontypes.h 10 Jan 2004 22:27:59 -0000 1.7 --- twbuttontypes.h 22 Feb 2004 10:49:37 -0000 1.8 *************** *** 10,13 **** --- 10,17 ---- // to implement a button, you add bitmaps-feedback to the box-area control + /** \brief A single button. + + */ + class Button : public GraphicButton { *************** *** 29,32 **** --- 33,39 ---- + /** \brief A general area for displaying graphics, which can be changed if needed. + + */ class Area : public GraphicButton *************** *** 53,56 **** --- 60,68 ---- + /** \brief A more specialized area for displaying graphics. It allocates an extra + drawing bitmap (i.e. adds an extra drawing layer), so that you can draw over + the background without changing the background itself. + + */ // something which has a background, and its own drawing-area class AreaTablet : public Area *************** *** 74,80 **** ! // a switch, is a button that is always in 2 of states (on or off) : ! // (a "focus" is always indicated by some box around it). class SwitchButton : public GraphicButton --- 86,92 ---- + /** \brief A button that toggles between two states, on or off, whenever it's pushed. ! */ class SwitchButton : public GraphicButton *************** *** 101,104 **** --- 113,119 ---- + /** \brief An invisible button ; can be used to fake a trigger-button for a popup menu. + + */ class GhostButton : public EmptyButton *************** *** 112,115 **** --- 127,135 ---- + /** \brief Manages a horizontal or vertical (auto-determined based on bitmap + dimension) scrollbar. It has a background, and animates the bar-handle on top of + that. This can be used together with a "manager" class, the ScrollControl. + + */ class ScrollBar : public AreaTablet Index: twhelpers.h =================================================================== RCS file: /cvsroot/timewarp/source/twgui/twhelpers.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** twhelpers.h 10 Jan 2004 22:27:59 -0000 1.3 --- twhelpers.h 22 Feb 2004 10:49:37 -0000 1.4 *************** *** 5,11 **** #include "twbuttontypes.h" ! // discrete position (x,y = item number, not pixels) ! //class ScrollBar; ! //class EmptyButton; class ScrollControl --- 5,14 ---- #include "twbuttontypes.h" ! /** \brief Manages 2 scrollbars and 4 buttons to determine a position in 2D. This ! is used to determine item number, rather than pixels; the number of items is entered ! in initialization. ! ! */ ! class ScrollControl *************** *** 49,53 **** ! // a class you can use to edit text const int maxlines = 1024; --- 52,59 ---- ! /** \brief Manage a string with enter-characters, generating info about the lines ! of text that are present in there. ! ! */ const int maxlines = 1024; |
From: <geo...@us...> - 2004-02-22 11:02:25
|
Update of /cvsroot/timewarp/source/sc2ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22294/sc2ships Modified Files: shporzne.cpp Log Message: small update Index: shporzne.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shporzne.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shporzne.cpp 29 Jan 2004 21:20:31 -0000 1.11 --- shporzne.cpp 22 Feb 2004 10:49:39 -0000 1.12 *************** *** 348,351 **** --- 348,352 ---- collide_flag_anyone = 0; play_sound(data->sampleExtra[1]); + damage(invading, 0, 1); if (invading->spritePanel) { |
From: <geo...@us...> - 2004-02-22 11:02:23
|
Update of /cvsroot/timewarp/source/sc1ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22294/sc1ships Modified Files: shpumgdr.cpp Log Message: small update Index: shpumgdr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpumgdr.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpumgdr.cpp 14 Feb 2004 13:18:38 -0000 1.12 --- shpumgdr.cpp 22 Feb 2004 10:49:40 -0000 1.13 *************** *** 100,103 **** --- 100,104 ---- void UmgahCone::calculate() { + SpaceObject::calculate(); if(!(ship && ship->exists())) |
From: <geo...@us...> - 2004-02-22 11:02:21
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22294/games Modified Files: gluagame.cpp Log Message: small update Index: gluagame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gluagame.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gluagame.cpp 21 Feb 2004 23:04:57 -0000 1.8 --- gluagame.cpp 22 Feb 2004 10:49:38 -0000 1.9 *************** *** 95,127 **** - // just return the whole string... - // it also advances the string pointer ... - - static const char *get_lua_chunk (lua_State *L, void *data, size_t *size) - { - char **s = (char**) data; - - char *d = *s; - - *size = strlen(*s); - *s += *size; - - if (!*size) - return 0; - else - return d; - } - - - - void lua_dochunk(lua_State *L, char **data) - { - if (lua_load(L, get_lua_chunk, data, "loaded_chunk") != 0) - tw_error("lua: error loading memory chunk"); - - if (lua_pcall(L, 0, LUA_MULTRET, 0) != 0) - tw_error("lua: something went wrong executing command"); - } - --- 95,98 ---- |
From: <geo...@us...> - 2004-02-22 11:01:22
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22152 Modified Files: luaport.cpp luaport.h Log Message: no message Index: luaport.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/luaport.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** luaport.cpp 21 Feb 2004 19:47:55 -0000 1.1 --- luaport.cpp 22 Feb 2004 10:48:38 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- #include "luaport.h" + #include "../melee.h" *************** *** 71,72 **** --- 72,105 ---- + + + // just return the whole string... + // it also advances the string pointer ... + + static const char *get_lua_chunk (lua_State *L, void *data, size_t *size) + { + char **s = (char**) data; + + char *d = *s; + + *size = strlen(*s); + *s += *size; + + if (!*size) + return 0; + else + return d; + } + + + + void lua_dochunk(lua_State *L, char **data) + { + if (lua_load(L, get_lua_chunk, data, "loaded_chunk") != 0) + tw_error("lua: error loading memory chunk"); + + if (lua_pcall(L, 0, LUA_MULTRET, 0) != 0) + tw_error("lua: something went wrong executing command"); + } + + Index: luaport.h =================================================================== RCS file: /cvsroot/timewarp/source/other/luaport.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** luaport.h 21 Feb 2004 19:47:55 -0000 1.1 --- luaport.h 22 Feb 2004 10:48:38 -0000 1.2 *************** *** 65,67 **** --- 65,72 ---- + void lua_dochunk(lua_State *L, char **data); + + + + #endif |
From: <geo...@us...> - 2004-02-22 11:01:04
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22110 Added Files: configrw.cpp configrw.h Log Message: with this you can make a single config() subroutine to read / write values to a config file. --- NEW FILE: configrw.cpp --- #include <allegro.h> #include <string.h> #include <stdio.h> #include "configrw.h" bool config_read = true; const bool CONFIG_READ = true; const bool CONFIG_WRITE = false; char *section = 0; void conf(char *id, int &x, int def) { if (config_read) x = get_config_int(section, id, def); else set_config_float(section, id, x); } void conf(char *id, double &x, double def) { if (config_read) x = get_config_float(section, id, def); else set_config_float(section, id, x); } void conf(char *id, char *x, char *def) { if (config_read) strcpy(x, get_config_string(section, id, def)); else set_config_string(section, id, x); } void confnum(char *id0, int i, int &x) { char id[128]; sprintf(id, "%s%i", id0, i); conf(id, x); } void confnum(char *id0, int i, double &x) { char id[128]; sprintf(id, "%s%i", id0, i); conf(id, x); } void confnum(char *id0, int i, char *x) { char id[128]; sprintf(id, "%s%i", id0, i); conf(id, x); } --- NEW FILE: configrw.h --- #ifndef __CONFIG_RW__ #define __CONFIG_RW__ /** \brief sets the direction for all subsequent calls to conf: read from the config file, or write to the config file */ extern bool config_read; /** \brief the read-setting for the config_read variable */ extern const bool CONFIG_READ; /** \brief the write-setting for the config_read variable */ extern const bool CONFIG_WRITE; /** \brief sets the section string for all subsequent calls to conf. */ extern char *section; /** \brief reads or writes an integer value to a allegro config file. Required: config_read and section must be propertly defined. This works for values of int, double, and string. With this, you can write a single "config" subroutine, which reads or writes all variables based on the config_read setting. */ void conf(char *id, int &x, int def = 0); void conf(char *id, double &x, double def = 0); void conf(char *id, char *x, char *def = "none"); /** \brief front-end for conf for writing or reading an indexed value to a config file. Indexes are appended to a general id, starting with "1". This works for values of int, double or string. \param id0 is the general id for accessing value x \param i is the index for accessing value x */ void confnum(char *id0, int i, int &x); void confnum(char *id0, int i, double &x); void confnum(char *id0, int i, char *x); #endif |
From: <geo...@us...> - 2004-02-22 10:59:41
|
Update of /cvsroot/timewarp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21889 Modified Files: twwin.dsp Log Message: no message |
From: <geo...@us...> - 2004-02-21 23:17:31
|
Update of /cvsroot/timewarp/source/games/luatest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv747/games/luatest Modified Files: bridge.lua Log Message: added a "calculate" function in the lua script, which is repetitively called in the luagame::calculate function. Index: bridge.lua =================================================================== RCS file: /cvsroot/timewarp/source/games/luatest/bridge.lua,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** bridge.lua 21 Feb 2004 12:41:23 -0000 1.3 --- bridge.lua 21 Feb 2004 23:04:56 -0000 1.4 *************** *** 3,6 **** --- 3,18 ---- -- + nast = 0; + + function calculate() + + if nast < 30 then + addAsteroid(); + nast = nast + 1 + end + end + + + -- JUST THE INITIALIZATION... --require "StarClasses" |
From: <geo...@us...> - 2004-02-21 23:17:29
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv747/games Modified Files: gluagame.cpp Log Message: added a "calculate" function in the lua script, which is repetitively called in the luagame::calculate function. Index: gluagame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gluagame.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gluagame.cpp 21 Feb 2004 22:20:36 -0000 1.7 --- gluagame.cpp 21 Feb 2004 23:04:57 -0000 1.8 *************** *** 189,192 **** --- 189,200 ---- { Game::calculate(); + + // also execute the calculate() function in the lua script, + // if such a function exists that is ... + + lua_pushstring(L, "calculate"); + lua_gettable(L, LUA_GLOBALSINDEX); + lua_call(L, 0, 0); // 0 arguments, 0 results + } |
From: <geo...@us...> - 2004-02-21 22:33:05
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25799/games Modified Files: gluagame.cpp Log Message: added test for executing command that reside in a string in memory Index: gluagame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gluagame.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gluagame.cpp 21 Feb 2004 19:47:54 -0000 1.6 --- gluagame.cpp 21 Feb 2004 22:20:36 -0000 1.7 *************** *** 31,34 **** --- 31,35 ---- lua_State *L; virtual void LuaGame::quit(const char *message); + virtual void calculate(); }; *************** *** 94,97 **** --- 95,128 ---- + // just return the whole string... + // it also advances the string pointer ... + + static const char *get_lua_chunk (lua_State *L, void *data, size_t *size) + { + char **s = (char**) data; + + char *d = *s; + + *size = strlen(*s); + *s += *size; + + if (!*size) + return 0; + else + return d; + } + + + + void lua_dochunk(lua_State *L, char **data) + { + if (lua_load(L, get_lua_chunk, data, "loaded_chunk") != 0) + tw_error("lua: error loading memory chunk"); + + if (lua_pcall(L, 0, LUA_MULTRET, 0) != 0) + tw_error("lua: something went wrong executing command"); + } + + *************** *** 115,118 **** --- 146,155 ---- message.out(str, 3500, 15); + + + // this is used to see, if something can be initialized from a memory string - it can. + char *com = "addPlanet(1500,1500);"; + + lua_dochunk(L, &com); *************** *** 149,152 **** --- 186,195 ---- + void LuaGame::calculate() + { + Game::calculate(); + } + + REGISTER_GAME(LuaGame, "LuaTest") //registering our game type, so that it will appear in the menus |
From: <geo...@us...> - 2004-02-21 20:00:08
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27806/games Modified Files: gluagame.cpp Log Message: change to lua test game Index: gluagame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gluagame.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gluagame.cpp 21 Feb 2004 12:41:25 -0000 1.5 --- gluagame.cpp 21 Feb 2004 19:47:54 -0000 1.6 *************** *** 22,39 **** #include "../melee/manim.h" ! extern "C" { ! #include <lua.h> ! #include <lualib.h> ! #include <lauxlib.h> ! } - #define lua_register2(L,n,f) \ - (lua_pushstring(L, n), \ - lua_pushcfunction(L, f), \ - lua_settable(L, LUA_GLOBALSINDEX)) - /* lua_State *L; */ - /* const char *n; */ - /* lua_CFunction f; */ class LuaGame : public Game { //declaring our game type --- 22,29 ---- #include "../melee/manim.h" ! #include "../other/luaport.h" ! class LuaGame : public Game { //declaring our game type *************** *** 43,47 **** }; - LuaGame * globalLuaGame = NULL; class SpecialAsteroid : public Asteroid { --- 33,36 ---- *************** *** 69,155 **** - /** \brief A list of lua-type functions - - */ - - static const int max_lua_func = 1024; - static int Ndescriptors = 0; - - /** \brief Class that is used to initialize a list of lua-type functions during - game initialization. This list just stores some pointers and strings, has nothing - to do with lua, rather, it is temporary storage. - - */ - - class lua_func_registry - { - public: - char id[512]; - lua_CFunction f; - lua_func_registry(char *descr, lua_CFunction luafunc); - - } *descriptors[max_lua_func]; - - lua_func_registry::lua_func_registry(char *descr, lua_CFunction luafunc) - { - if (Ndescriptors < max_lua_func) - { - // store the lua-function information, needed to initialize lua later on. - strncpy(id, descr, sizeof(id)); - f = luafunc; - - // add this thing to a global list - descriptors[Ndescriptors] = this; - ++Ndescriptors; - } - } - - /** \brief Accesses a list of lua-type functions and registers them with lua. - */ - - static void register_functions(lua_State *L) - { - int i; - for ( i = 0; i < Ndescriptors; ++i ) - { - lua_register(L, descriptors[i]->id, descriptors[i]->f); - } - } - - - - // Some macros to reduce code/coding complexity : - - // declares the default (needed by the arg-macros) function body - // also declares narg, the number of arguments that are to be returned - // also declares the lua-registry class, which is used to build a list of functions available to lua. - #define lua_func(func) \ - extern int func(lua_State *L); \ - lua_func_registry regme##func (#func, func); \ - static int func(lua_State *L) \ - { \ - int narg = 0; - - // closing bracket, and returns the number of arguments to lua - #define lua_ret \ - if (lua_gettop(L) >= 1) tw_error("lua: not all arguments were read"); \ - return narg; \ - } - - // declares a double, and initializes with a value from the stack. - #define arg_double(x) \ - double x; \ - if (!lua_isnumber(L, -1)) tw_error("lua: argument is not a number"); \ - x = lua_tonumber(L, -1); \ - lua_pop(L, 1); - - - #define arg_string(x) \ - const char *x; \ - if (!lua_isstring(L, -1)) tw_error("lua: argument is not a string"); \ - x = lua_tostring(L, -1); \ - lua_pop(L, 1); - - --- 58,61 ---- *************** *** 188,203 **** - /** Adds an asteroid to the game environment. As a Lua call, the prototype is: - - NOT TRUE YET: - //addAsteroid(x,y) - // @param x the x coordinate of the asteroid - // @param y the y coordinate of the asteroid - /NOT TRUE YET: - */ - //int LuaGame::addAsteroid(lua_State * state) { - // globalLuaGame.add(new Asteroid()); - // return 0; - //} --- 94,97 ---- *************** *** 211,233 **** - L = lua_open(); - - luaopen_base(L);//TODO minimize the libraries used here - luaopen_table(L); - luaopen_io(L); - luaopen_string(L); - luaopen_math(L); - luaopen_debug(L); - - //terrible hack, only for experimental use!!! - //TODO remove this - globalLuaGame = this; - - lua_register(L, "addAsteroid", addAsteroid); - lua_register(L, "addPlanet", addPlanet); ! // lua_registers functions, that are conveniently stored in a separate listing ! // till now. ! register_functions(L); --- 105,111 ---- ! L = lua_init(); ! |
From: <geo...@us...> - 2004-02-21 20:00:07
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27806/other Added Files: luaport.cpp luaport.h Log Message: change to lua test game --- NEW FILE: luaport.cpp --- #include <string.h> #include "luaport.h" /** \brief A list of lua-type functions */ static const int max_lua_func = 1024; static int Ndescriptors = 0; lua_func_registry *descriptors[max_lua_func]; lua_func_registry::lua_func_registry(char *descr, lua_CFunction luafunc) { if (Ndescriptors < max_lua_func) { // store the lua-function information, needed to initialize lua later on. strncpy(id, descr, sizeof(id)); f = luafunc; // add this thing to a global list descriptors[Ndescriptors] = this; ++Ndescriptors; } } /** \brief Accesses a list of lua-type functions and registers them with lua. */ void register_lua_functions(lua_State *L) { int i; for ( i = 0; i < Ndescriptors; ++i ) { lua_register(L, descriptors[i]->id, descriptors[i]->f); } } lua_State *lua_init() { lua_State *L; L = lua_open(); luaopen_base(L); luaopen_table(L); luaopen_io(L); luaopen_string(L); luaopen_math(L); luaopen_debug(L); // lua_registers functions, that are conveniently stored in a separate listing // till now. register_lua_functions(L); return L; } --- NEW FILE: luaport.h --- #ifndef __LUA_PORT__ #define __LUA_PORT__ extern "C" { #include <lua.h> #include <lualib.h> #include <lauxlib.h> } /** \brief Class that is used to initialize a list of lua-type functions during game initialization. This list just stores some pointers and strings, has nothing to do with lua, rather, it is temporary storage. */ class lua_func_registry { public: char id[512]; lua_CFunction f; lua_func_registry(char *descr, lua_CFunction luafunc); }; // Some macros to reduce code/coding complexity : // declares the default (needed by the arg-macros) function body // also declares narg, the number of arguments that are to be returned // also declares the lua-registry class, which is used to build a list of functions available to lua. #define lua_func(func) \ extern int func(lua_State *L); \ lua_func_registry regme##func (#func, func); \ static int func(lua_State *L) \ { \ int nret = 0; // closing bracket, and returns the number of arguments to lua #define lua_ret \ if (lua_gettop(L) > nret) tw_error("lua: not all arguments were read"); \ return nret; \ } // declares a double, and initializes with a value from the stack. #define arg_double(x) \ double x; \ if (!lua_isnumber(L, -1)) tw_error("lua: argument is not a number"); \ x = lua_tonumber(L, -1); \ lua_pop(L, 1); #define arg_string(x) \ const char *x; \ if (!lua_isstring(L, -1)) tw_error("lua: argument is not a string"); \ x = lua_tostring(L, -1); \ lua_pop(L, 1); void register_lua_functions(lua_State *L); lua_State *lua_init(); #endif |
From: <geo...@us...> - 2004-02-21 12:53:25
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11624/games Modified Files: gluagame.cpp Log Message: change in the lua test code Index: gluagame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gluagame.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gluagame.cpp 29 Jan 2004 21:20:28 -0000 1.4 --- gluagame.cpp 21 Feb 2004 12:41:25 -0000 1.5 *************** *** 69,108 **** ! int addAsteroid(lua_State * L) { ! int args = lua_gettop(L); // number of arguments ! if (args == 1) { ! globalLuaGame->add(new SpecialAsteroid(lua_tostring(L,-1))); ! lua_pop(L,1); ! } ! else ! { ! globalLuaGame->add(new Asteroid()); ! } ! return 0; } ! int addPlanet(lua_State * L) { ! int args = lua_gettop(L); // number of arguments ! if (args != 2) ! return 0; // TODO prevent stack overflow - if ( ! lua_isnumber(L, -1) || - ! lua_isnumber(L, -2) ) - return 0; // TODO prevent stack overflow - double x = lua_tonumber(L, -1); - lua_pop(L, 1); - double y = lua_tonumber(L, -1); - lua_pop(L, 1); ! Vector2 v(x, y); ! Planet * planet = create_planet(v); ! //globalLuaGame->add( planet ); ! return 0; } /** Adds an asteroid to the game environment. As a Lua call, the prototype is: --- 69,191 ---- ! /** \brief A list of lua-type functions ! */ ! ! static const int max_lua_func = 1024; ! static int Ndescriptors = 0; ! ! /** \brief Class that is used to initialize a list of lua-type functions during ! game initialization. This list just stores some pointers and strings, has nothing ! to do with lua, rather, it is temporary storage. ! ! */ ! ! class lua_func_registry ! { ! public: ! char id[512]; ! lua_CFunction f; ! lua_func_registry(char *descr, lua_CFunction luafunc); ! ! } *descriptors[max_lua_func]; ! ! lua_func_registry::lua_func_registry(char *descr, lua_CFunction luafunc) ! { ! if (Ndescriptors < max_lua_func) ! { ! // store the lua-function information, needed to initialize lua later on. ! strncpy(id, descr, sizeof(id)); ! f = luafunc; ! ! // add this thing to a global list ! descriptors[Ndescriptors] = this; ! ++Ndescriptors; ! } } ! /** \brief Accesses a list of lua-type functions and registers them with lua. ! */ ! static void register_functions(lua_State *L) ! { ! int i; ! for ( i = 0; i < Ndescriptors; ++i ) ! { ! lua_register(L, descriptors[i]->id, descriptors[i]->f); ! } ! } ! // Some macros to reduce code/coding complexity : ! // declares the default (needed by the arg-macros) function body ! // also declares narg, the number of arguments that are to be returned ! // also declares the lua-registry class, which is used to build a list of functions available to lua. ! #define lua_func(func) \ ! extern int func(lua_State *L); \ ! lua_func_registry regme##func (#func, func); \ ! static int func(lua_State *L) \ ! { \ ! int narg = 0; ! ! // closing bracket, and returns the number of arguments to lua ! #define lua_ret \ ! if (lua_gettop(L) >= 1) tw_error("lua: not all arguments were read"); \ ! return narg; \ } + // declares a double, and initializes with a value from the stack. + #define arg_double(x) \ + double x; \ + if (!lua_isnumber(L, -1)) tw_error("lua: argument is not a number"); \ + x = lua_tonumber(L, -1); \ + lua_pop(L, 1); + + + #define arg_string(x) \ + const char *x; \ + if (!lua_isstring(L, -1)) tw_error("lua: argument is not a string"); \ + x = lua_tostring(L, -1); \ + lua_pop(L, 1); + + + + + + + lua_func(addPlanet) // initialize the function, and add some overhead for registering this function automatically + { + arg_double(x); // this gets a double from the stack + arg_double(y); + + Vector2 v(x, y); + Planet * planet = create_planet(v); + } + lua_ret // end the function, in a way that lua likes + + + + lua_func(addSpecialAsteroid) + { + arg_string(s); + if (s) + physics->add(new SpecialAsteroid(s)); + + } + lua_ret + + + + lua_func(addAsteroid) + { + physics->add(new Asteroid()); + } + lua_ret + + + + /** Adds an asteroid to the game environment. As a Lua call, the prototype is: *************** *** 119,129 **** ! void LuaGame::init(Log *_log) { //you need to call Game::init very early on, to set stuff up... rarely do you want to do anything before that Game::init(_log); ! //prepare needs to be called before you add items, or do physics or graphics or anything like that. Don't ask why. prepare(); ! L = lua_open(); --- 202,213 ---- ! void LuaGame::init(Log *_log) ! { //you need to call Game::init very early on, to set stuff up... rarely do you want to do anything before that Game::init(_log); ! //prepare needs to be called before you add items, or do physics or graphics or anything like that. Don't ask why. prepare(); ! L = lua_open(); *************** *** 135,179 **** luaopen_math(L); luaopen_debug(L); ! //terrible hack, only for experimental use!!! //TODO remove this globalLuaGame = this; ! lua_register(L, "addAsteroid", addAsteroid); lua_register(L, "addPlanet", addPlanet); char str[100] = ""; ! sprintf(str, "loading file returned %i\n", lua_dofile(L, "./source/games/luatest/bridge.lua")); ! message.out(str, 3500, 15); ! //add the starscape background add(new Stars()); ! //first, we create the teams. This battle has just 2 sides; the human player, and the AI enemies TeamCode human, enemies; human = new_team(); enemies = new_team(); ! //this creates a keyboard controller, using configuration 0 by default, since we don't specify another configuration Control *c = create_control(channel_server, "Human"); //the first parameter is channel_server, which means that this player is on the server computer //the second parameter is "Human", the name of a controller type ! //this creates a ship Ship *s = create_ship("plopl", c, Vector2(size.x/2,size.y/2), 0, human); ! //this causes the ship to warp into the game. note that we call add() on the phaser, not the ship, because the phaser will add the ship once it finishes warping in add(s->get_ship_phaser()); //add(s); add_focus(s); ! } ! void LuaGame::quit(const char *message) { ! Game::quit(message); ! lua_close(L); ! } --- 219,272 ---- luaopen_math(L); luaopen_debug(L); ! //terrible hack, only for experimental use!!! //TODO remove this globalLuaGame = this; ! lua_register(L, "addAsteroid", addAsteroid); lua_register(L, "addPlanet", addPlanet); + + // lua_registers functions, that are conveniently stored in a separate listing + // till now. + register_functions(L); char str[100] = ""; ! sprintf(str, "loading file returned %i\n", ! lua_dofile(L, "./source/games/luatest/bridge.lua")); + message.out(str, 3500, 15); + ! //add the starscape background add(new Stars()); ! //first, we create the teams. This battle has just 2 sides; the human player, and the AI enemies TeamCode human, enemies; human = new_team(); enemies = new_team(); ! //this creates a keyboard controller, using configuration 0 by default, since we don't specify another configuration Control *c = create_control(channel_server, "Human"); //the first parameter is channel_server, which means that this player is on the server computer //the second parameter is "Human", the name of a controller type ! //this creates a ship Ship *s = create_ship("plopl", c, Vector2(size.x/2,size.y/2), 0, human); ! //this causes the ship to warp into the game. note that we call add() on the phaser, not the ship, because the phaser will add the ship once it finishes warping in add(s->get_ship_phaser()); //add(s); add_focus(s); ! } ! ! ! void LuaGame::quit(const char *message) ! { ! Game::quit(message); ! lua_close(L); ! } |
From: <geo...@us...> - 2004-02-21 12:53:24
|
Update of /cvsroot/timewarp/source/games/luatest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11624/games/luatest Modified Files: bridge.lua Log Message: change in the lua test code Index: bridge.lua =================================================================== RCS file: /cvsroot/timewarp/source/games/luatest/bridge.lua,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** bridge.lua 14 Jan 2004 07:41:57 -0000 1.2 --- bridge.lua 21 Feb 2004 12:41:23 -0000 1.3 *************** *** 11,21 **** addAsteroid(); ! addAsteroid("Wakko"); ! addAsteroid("Yakko"); ! addAsteroid("Dot"); addPlanet(100,100); --addPlanet(150,150); --addPlanet(200,200); --- 11,22 ---- addAsteroid(); ! addSpecialAsteroid("Wakko"); ! addSpecialAsteroid("Yakko"); ! addSpecialAsteroid("Dot"); addPlanet(100,100); + --addPlanet(150,150); --addPlanet(200,200); |
From: <yu...@us...> - 2004-02-21 00:41:21
|
Update of /cvsroot/timewarp/source/gamex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19686/source/gamex Modified Files: ai_fleet.h gamesolarview.cpp Log Message: Deleted unneeded files, deleted needles keyflag enum Index: ai_fleet.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/ai_fleet.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ai_fleet.h 29 Jan 2004 21:20:28 -0000 1.5 --- ai_fleet.h 21 Feb 2004 00:29:16 -0000 1.6 *************** *** 12,15 **** --- 12,16 ---- class FleetAI { + protected: virtual void attack(Vector2 pos); }; Index: gamesolarview.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamesolarview.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** gamesolarview.cpp 15 Feb 2004 13:08:56 -0000 1.12 --- gamesolarview.cpp 21 Feb 2004 00:29:16 -0000 1.13 *************** *** 798,803 **** return; - - double dt = frame_time * 1E-3; --- 798,801 ---- *************** *** 825,829 **** } - if (key[KEY_UP]) player->accelerate(0, player->angle, 0.1*dt, 1.0); --- 823,826 ---- |