From: <do...@us...> - 2012-11-14 08:21:00
|
Revision: 7163 http://exult.svn.sourceforge.net/exult/?rev=7163&view=rev Author: dominus Date: 2012-11-14 08:20:48 +0000 (Wed, 14 Nov 2012) Log Message: ----------- added data/bg|si/autonotes.txt to game flx bundles and the misc option to toggle it. Could use additional work so that it only toggles showing the auto notes but still records them, and maybe only record the flag # and load the text from the autonotes file instead of the notebook.xml. Modified Paths: -------------- exult/trunk/ChangeLog exult/trunk/Makefile.common exult/trunk/data/Makefile.am exult/trunk/data/bg/flx.in exult/trunk/data/si/flx.in exult/trunk/gamemgr/bggame.cc exult/trunk/gamemgr/sigame.cc exult/trunk/gamewin.cc exult/trunk/gamewin.h exult/trunk/gumps/MiscOptions_gump.cc exult/trunk/gumps/MiscOptions_gump.h exult/trunk/gumps/Notebook_gump.cc exult/trunk/gumps/Notebook_gump.h Modified: exult/trunk/ChangeLog =================================================================== --- exult/trunk/ChangeLog 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/ChangeLog 2012-11-14 08:20:48 UTC (rev 7163) @@ -1,4 +1,8 @@ 2012-11-11 Dominik Reichardt <do...@us...> + * varios files: added data/bg|si/autonotes.txt to game flx bundles and the + misc option to toggle it. + +2012-11-11 Dominik Reichardt <do...@us...> * gumps/Notebook_gump.cc: when cheating show location of notes in the notebook. 2012-10-28 Marzo Sette Torres Junior <ma...@ya...> Modified: exult/trunk/Makefile.common =================================================================== --- exult/trunk/Makefile.common 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/Makefile.common 2012-11-14 08:20:48 UTC (rev 7163) @@ -322,7 +322,8 @@ data/bg/paperdol_info.txt \ data/bg/shape_info.txt \ data/bg/blends.dat \ - data/bg/container.dat + data/bg/container.dat \ + data/bg/autonotes.txt EXULT_SI_FLX = data/exult_si.flx data/exult_si_flx.h EXULT_SI_FLX_OBJECTS = \ @@ -335,7 +336,8 @@ data/si/paperdol_info.txt \ data/si/shape_info.txt \ data/si/blends.dat \ - data/si/container.dat + data/si/container.dat \ + data/si/autonotes.txt EXULT_BG_PAPERDOL_VGA = data/bg/bg_paperdol.vga data/bg/bg_paperdol_vga.h EXULT_BG_PAPERDOL_VGA_OBJECTS = \ Modified: exult/trunk/data/Makefile.am =================================================================== --- exult/trunk/data/Makefile.am 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/data/Makefile.am 2012-11-14 08:20:48 UTC (rev 7163) @@ -42,7 +42,8 @@ bg/avatar_data.txt \ bg/shape_info.txt \ bg/blends.dat \ - bg/container.dat + bg/container.dat \ + bg/autonotes.txt EXULT_SI_FLX_OBJECTS = \ si/flx.in \ @@ -54,7 +55,8 @@ si/avatar_data.txt \ si/shape_info.txt \ si/blends.dat \ - si/container.dat + si/container.dat \ + si/autonotes.txt EXULT_IPHONE_FLX_OBJECTS = \ iphone/flx.in \ Modified: exult/trunk/data/bg/flx.in =================================================================== --- exult/trunk/data/bg/flx.in 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/data/bg/flx.in 2012-11-14 08:20:48 UTC (rev 7163) @@ -12,3 +12,4 @@ avatar_data.txt blends.dat container.dat +autonotes.txt Modified: exult/trunk/data/si/flx.in =================================================================== --- exult/trunk/data/si/flx.in 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/data/si/flx.in 2012-11-14 08:20:48 UTC (rev 7163) @@ -8,3 +8,4 @@ avatar_data.txt blends.dat container.dat +autonotes.txt Modified: exult/trunk/gamemgr/bggame.cc =================================================================== --- exult/trunk/gamemgr/bggame.cc 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/gamemgr/bggame.cc 2012-11-14 08:20:48 UTC (rev 7163) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2011 The Exult Team + * Copyright (C) 2000-2012 The Exult 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 @@ -173,6 +173,7 @@ add_resource("config/shape_info", gameflx, EXULT_BG_FLX_SHAPE_INFO_TXT); add_resource("config/shape_files", gameflx, EXULT_BG_FLX_SHAPE_FILES_TXT); add_resource("config/avatar_data", gameflx, EXULT_BG_FLX_AVATAR_DATA_TXT); + add_resource("config/autonotes", gameflx, EXULT_BG_FLX_AUTONOTES_TXT); add_resource("palettes/count", 0, 18); add_resource("palettes/0", PALETTES_FLX, 0); Modified: exult/trunk/gamemgr/sigame.cc =================================================================== --- exult/trunk/gamemgr/sigame.cc 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/gamemgr/sigame.cc 2012-11-14 08:20:48 UTC (rev 7163) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2011 The Exult Team + * Copyright (C) 2000-2012 The Exult 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 @@ -139,6 +139,7 @@ add_resource("config/shape_info", gameflx, EXULT_SI_FLX_SHAPE_INFO_TXT); add_resource("config/shape_files", gameflx, EXULT_SI_FLX_SHAPE_FILES_TXT); add_resource("config/avatar_data", gameflx, EXULT_SI_FLX_AVATAR_DATA_TXT); + add_resource("config/autonotes", gameflx, EXULT_SI_FLX_AUTONOTES_TXT); add_resource("palettes/count", 0, 14); add_resource("palettes/0", PALETTES_FLX, 0); Modified: exult/trunk/gamewin.cc =================================================================== --- exult/trunk/gamewin.cc 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/gamewin.cc 2012-11-14 08:20:48 UTC (rev 7163) @@ -462,6 +462,9 @@ config->value("config/gameplay/alternate_drop", str, "no"); alternate_drop = str == "yes"; config->set("config/gameplay/alternate_drop", alternate_drop?"yes":"no", false); + config->value("config/gameplay/allow_autonotes", str, "no"); + allow_autonotes = str == "yes"; + config->set("config/gameplay/allow_autonotes", allow_autonotes?"yes":"no", false); config->value("config/gameplay/scroll_with_mouse", str, "no"); scroll_with_mouse = str == "yes"; config->set("config/gameplay/scroll_with_mouse", @@ -2921,6 +2924,18 @@ CYCLE_RED_PLASMA(); Notebook_gump::initialize(); // Read in journal. + + //read autonotes + std::string d, autonotesfilename; + d = "config/disk/game/"+Game::get_gametitle()+"/autonotes"; + config->value(d.c_str(),autonotesfilename,"(default)"); + if (autonotesfilename == "(default)") { + config->set(d.c_str(), autonotesfilename, true); + Notebook_gump::read_auto_text(); + } else { + Notebook_gump::read_auto_text_file(autonotesfilename.c_str()); + } + usecode->read(); // Read the usecode flags CYCLE_RED_PLASMA(); Modified: exult/trunk/gamewin.h =================================================================== --- exult/trunk/gamewin.h 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/gamewin.h 2012-11-14 08:20:48 UTC (rev 7163) @@ -138,6 +138,7 @@ int allow_right_pathfind; // If moving with right click is allowed bool scroll_with_mouse; // scroll game view with mousewheel bool alternate_drop; // don't split stacks, can be inverted with a CTRL key modifier + bool allow_autonotes; bool in_exult_menu; // used for menu options // Private methods: void set_scrolls(Tile_coord cent); @@ -253,6 +254,10 @@ { return alternate_drop; } void set_alternate_drop(bool s) { alternate_drop = s; } + bool get_allow_autonotes() const + { return allow_autonotes; } + void set_allow_autonotes(bool s) + { allow_autonotes = s; } bool is_in_exult_menu() const // used for menu options { return in_exult_menu; } void set_in_exult_menu (bool im) Modified: exult/trunk/gumps/MiscOptions_gump.cc =================================================================== --- exult/trunk/gumps/MiscOptions_gump.cc 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/gumps/MiscOptions_gump.cc 2012-11-14 08:20:48 UTC (rev 7163) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2011 The Exult Team + * Copyright (C) 2001-2012 The Exult 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 @@ -38,7 +38,7 @@ #include "Enabled_button.h" #include "font.h" #include "gamewin.h" - +#include "Notebook_gump.h" using std::string; static const int rowy[] = { 4, 16, 28, 40, 52, 64, 76, 88, 100, 112, 124, 136, 148 }; @@ -121,8 +121,10 @@ mode = state; else if (btn == buttons[id_charmDiff]) charmDiff = state; - else if (btn == buttons[id_alternate_drop]) + else if (btn == buttons[id_alternate_drop]) alternate_drop = state; + else if (btn == buttons[id_allow_autonotes]) + allow_autonotes = state; } void MiscOptions_gump::build_buttons() @@ -147,15 +149,20 @@ std::string *stacks_text = new std::string[2]; stacks_text[0] = "No"; stacks_text[1] = "Yes"; + std::string *autonotes_text = new std::string[2]; + autonotes_text[0] = "No"; + autonotes_text[1] = "Yes"; + buttons[id_scroll_mouse] = new MiscTextToggle (this, yesNo1, colx[5], rowy[0], 40, scroll_mouse, 2); buttons[id_menu_intro] = new MiscTextToggle (this, yesNo2, colx[5], rowy[1], 40, menu_intro, 2); buttons[id_usecode_intro] = new MiscTextToggle (this, yesNo3, colx[5], rowy[2], 40, usecode_intro, 2); - - buttons[id_alternate_drop] = new MiscTextToggle(this, stacks_text, colx[5], rowy[3], 40, alternate_drop, 2); - + buttons[id_alternate_drop] = new MiscTextToggle(this, stacks_text, colx[5], rowy[3], + 40, alternate_drop, 2); + buttons[id_allow_autonotes] = new MiscTextToggle(this, autonotes_text, colx[5], rowy[4], + 40, allow_autonotes, 2); buttons[id_difficulty] = new MiscTextToggle (this, diffs, colx[3], rowy[8], 85, difficulty, 7); buttons[id_show_hits] = new MiscEnabledToggle(this, colx[3], rowy[9], @@ -197,6 +204,7 @@ mode = 0; charmDiff = Combat::charmed_more_difficult ? 1: 0; alternate_drop = gwin->get_alternate_drop(); + allow_autonotes = gwin->get_allow_autonotes(); } MiscOptions_gump::MiscOptions_gump() @@ -237,9 +245,13 @@ Combat::charmed_more_difficult = (charmDiff != 0); config->set("config/gameplay/combat/charmDifficulty", charmDiff ? "hard" : "normal", false); + gwin->set_alternate_drop(alternate_drop); + config->set("config/gameplay/alternate_drop", + alternate_drop ? "yes" : "no", false); + gwin->set_allow_autonotes(allow_autonotes); + config->set("config/gameplay/allow_autonotes", + allow_autonotes ? "yes" : "no", false); - gwin->set_alternate_drop(alternate_drop); - config->set("config/gameplay/alternate_drop", alternate_drop ? "yes" : "no", false); config->write_back(); } @@ -255,6 +267,7 @@ font->paint_text(iwin->get_ib8(), "Skip intro:", x + colx[0], y + rowy[1] + 1); font->paint_text(iwin->get_ib8(), "Skip scripted first scene:", x + colx[0], y + rowy[2] + 1); font->paint_text(iwin->get_ib8(), "Alternate drag'n'drop:", x+colx[0], y+ rowy[3] + 1); + font->paint_text(iwin->get_ib8(), "Allow Autonotes:", x+colx[0], y+ rowy[4] + 1); font->paint_text(iwin->get_ib8(), "Combat Options:", x + colx[0], y + rowy[7] + 1); font->paint_text(iwin->get_ib8(), "Difficulty:", x + colx[1], y + rowy[8] + 1); Modified: exult/trunk/gumps/MiscOptions_gump.h =================================================================== --- exult/trunk/gumps/MiscOptions_gump.h 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/gumps/MiscOptions_gump.h 2012-11-14 08:20:48 UTC (rev 7163) @@ -1,5 +1,5 @@ /* -Copyright (C) 2001-2011 The Exult Team +Copyright (C) 2001-2012 The Exult Team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -37,6 +37,7 @@ bool usecode_intro; bool menu_intro; bool alternate_drop; + bool allow_autonotes; void build_buttons(); enum button_ids { @@ -47,6 +48,7 @@ id_menu_intro, id_usecode_intro, id_alternate_drop, + id_allow_autonotes, id_difficulty, id_show_hits, id_mode, Modified: exult/trunk/gumps/Notebook_gump.cc =================================================================== --- exult/trunk/gumps/Notebook_gump.cc 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/gumps/Notebook_gump.cc 2012-11-14 08:20:48 UTC (rev 7163) @@ -32,6 +32,7 @@ #include "msgfile.h" #include "fnames.h" #include "cheat.h" +#include "U7file.h" using std::ofstream; using std::ifstream; @@ -794,8 +795,10 @@ break; } updnx = cursor.x - x - (curpage%2 ? rpagex : lpagex); +#if DEBUG std::cout << "updnx = " << updnx << std::endl; // std::cout << "Notebook chr: " << chr << std::endl; +#endif return true; } @@ -816,6 +819,7 @@ it != notes.end(); ++it) if ((*it)->gflag == gflag) return; + if (gwin->get_allow_autonotes()) add_new(newstrdup(text), gflag); } @@ -855,8 +859,10 @@ conf.read_abs_config_file(NOTEBOOKXML, root); string identstr; + // not spamming the terminal with all the notes in normal play +#if DEBUG conf.dump(cout, identstr); - +#endif Configuration::KeyTypeList note_nds; string basekey = "notebook"; conf.getsubkeys(note_nds, basekey); @@ -908,14 +914,38 @@ * Read in text to be inserted automatically when global flags are set. */ +// read in from external file +void Notebook_gump::read_auto_text_file(const char* filename) +{ + ifstream notesfile; + if (gwin->get_allow_autonotes()) + { + cout << "Loading autonotes from file " << filename << endl; + initialized_auto_text = true; + U7open(notesfile, filename, true); + Read_text_msg_file(notesfile, auto_text); + notesfile.close(); + } +} + +// read in from flx bundled file void Notebook_gump::read_auto_text ( ) { - ifstream in; - initialized_auto_text = true; - if (!U7open_static(in, AUTONOTES, true)) - return; - Read_text_msg_file(in, auto_text); + if (gwin->get_allow_autonotes()) + { + //cout << "Loading default autonotes" << endl; + initialized_auto_text = true; + const str_int_pair& resource = game->get_resource("config/autonotes"); + U7object txtobj(resource.str, resource.num); + size_t len; + char *txt = txtobj.retrieve(len); + if (txt && len > 0) + { + BufferDataSource buf(txt,len); + Read_text_msg_file(&buf, auto_text); + delete[] txt; + } + } } - Modified: exult/trunk/gumps/Notebook_gump.h =================================================================== --- exult/trunk/gumps/Notebook_gump.h 2012-11-11 16:06:58 UTC (rev 7162) +++ exult/trunk/gumps/Notebook_gump.h 2012-11-14 08:20:48 UTC (rev 7163) @@ -1,5 +1,5 @@ /* -Copyright (C) 2000-2011 The Exult Team +Copyright (C) 2000-2012 The Exult Team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -99,6 +99,7 @@ static void write(); // Write it out to gamedat. static void read(); // Read it in. static void read_auto_text(); + static void read_auto_text_file(const char* filename); }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |