Stop storing preferences and legacy flags in the saved game
- Nuke global preference variables (they're now fetched with get_xxx_pref whenever needed) - Nuke magic SDFs that store preferences and other info - The only preferences now stored in the saved game are those related to difficulty - play_sound no longer takes an option repeat parameter, but instead takes a delay which will be used if sounds are disabled - SDF array increased to 350x50 - When saving a legacy scenario, a dialog is shown to remind you to update and to allow you to clear the legacy flag
This commit is contained in:
@@ -44,15 +44,15 @@ future that the shield has been taken.</p>
|
||||
|
||||
<h2>Stuff Done Flags - the Specifics</h2>
|
||||
|
||||
<p>But what are the Stuff Done Flags? Picture a grid of numbers, 300 wide and 50 high, all
|
||||
of which start at 0. These 15000 numbers are your Stuff Done Flags, and they are all set
|
||||
<p>But what are the Stuff Done Flags? Picture a grid of numbers, 350 wide and 50 high, all
|
||||
of which start at 0. These 17500 numbers are your Stuff Done Flags, and they are all set
|
||||
to 0 when the party starts a scenario (and are saved in the save file, which is how the
|
||||
game remembers what you've done already when the save file is opened).</p>
|
||||
|
||||
<p>Stuff Done Flag are described by coordinates. Much as the coordinates of a spot of
|
||||
terrain are given by an X and Y value, a Stuff Done Flag has coordinates too. The first
|
||||
coordinate of a Stuff Done Flag is the column it is in (out of 300 columns, a number from
|
||||
0 to 299), and the second coordinate of a Stuff Done Flag is the row it is in (out of 50
|
||||
coordinate of a Stuff Done Flag is the column it is in (out of 350 columns, a number from
|
||||
0 to 349), and the second coordinate of a Stuff Done Flag is the row it is in (out of 50
|
||||
rows, a number from 0 to 49). For example, the taking of a shield may be attached to Stuff
|
||||
Done Flag X = 112, Y = 3, also written (112,3). Later chapters often refer to the two
|
||||
parts of a Stuff Done Flag (the X coordinate is the first part and the Y coordinate is the
|
||||
|
31
rsrc/dialogs/save-legacy-scen.xml
Normal file
31
rsrc/dialogs/save-legacy-scen.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
||||
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
|
||||
<dialog defbtn='update'>
|
||||
<pict type='dlog' num='16' top='6' left='6'/>
|
||||
<text top='6' left='49' width='384' height='80'>
|
||||
This scenario is currently set as a legacy scenario, meaning that certain mechanics are changed.
|
||||
If you have updated the scenario to account for these changes, then click the Update button
|
||||
to remove the legacy flag. If you have not yet updated the scenario, then click the Leave
|
||||
button to keep the legacy flag.
|
||||
</text>
|
||||
<!--
|
||||
TODO: I want to use font='plain' here but that makes it about 300% laggier
|
||||
-->
|
||||
<text top='80' left='49' width='384' height='200'>
|
||||
The following details need to be accounted for before clearing the legacy flag (the presence
|
||||
of the flag disables these changes):<br/><br/>
|
||||
~ The Resurrect spell now requires Resurrection Balm to cast. If this scenario is for
|
||||
high level parties, you should make sure that Resurrection Balm is available.<br/>
|
||||
~ Specials are now called while boating through town. This was automatically fixed when
|
||||
you first converted the scenario, but you may want to review any town specials set on
|
||||
water just in case.<br/>
|
||||
~ When special nodes are called in combat, the currently active PC is now selected by default.
|
||||
This means that any Affect PC nodes will affect only that PC instead of the whole party.
|
||||
You will need to add an explicit Select Target node to select the whole party if you want the
|
||||
old behaviour.<br/>
|
||||
~ Timed events can now be called when the party is resting. If the scenario relied on this not
|
||||
happening, it may need to be updated.<br/>
|
||||
</text>
|
||||
<button name='update' type='regular' top='300' left='368'>Update</button>
|
||||
<button name='cancel' type='regular' def-key='esc' top='300' left='302'>Leave</button>
|
||||
</dialog>
|
@@ -84,10 +84,9 @@ extern cShop active_shop;
|
||||
|
||||
extern rectangle shop_frame;
|
||||
extern short cen_x, cen_y, stat_window;//,pc_moves[6];
|
||||
extern bool give_delays;
|
||||
extern eGameMode overall_mode;
|
||||
extern location to_create;
|
||||
extern bool All_Done,play_sounds,frills_on,spell_forced,monsters_going;
|
||||
extern bool All_Done,frills_on,spell_forced,monsters_going;
|
||||
extern bool party_in_memory,in_scen_debug;
|
||||
|
||||
// game info globals
|
||||
@@ -1494,7 +1493,7 @@ void handle_monster_actions(bool& need_redraw, bool& need_reprint) {
|
||||
do_monster_turn();
|
||||
// Wand monsts
|
||||
if(overall_mode == MODE_OUTDOORS && univ.party.is_alive() && univ.party.age % 10 == 0) {
|
||||
if(get_ran(1,1,70 + PSD[SDF_LESS_WANDER_ENC] * 200) == 10)
|
||||
if(get_ran(1,1,70 + univ.party.less_wm * 200) == 10)
|
||||
create_wand_monst();
|
||||
for(int i = 0; i < 10; i++)
|
||||
if(univ.party.out_c[i].exists)
|
||||
@@ -1513,7 +1512,7 @@ void handle_monster_actions(bool& need_redraw, bool& need_reprint) {
|
||||
}
|
||||
}
|
||||
if(overall_mode == MODE_TOWN) {
|
||||
if(get_ran(1,1,160 - univ.town.difficulty + PSD[SDF_LESS_WANDER_ENC] * 200) == 2)
|
||||
if(get_ran(1,1,160 - univ.town.difficulty + univ.party.less_wm * 200) == 2)
|
||||
create_wand_monst();
|
||||
}
|
||||
}
|
||||
@@ -2266,7 +2265,7 @@ void do_save(short mode) {
|
||||
void do_rest(long length, int hp_restore, int mp_restore) {
|
||||
unsigned long age_before = univ.party.age;
|
||||
univ.party.age += length;
|
||||
if(!PSD[SDF_TIMERS_DURING_REST]) {
|
||||
if(univ.scenario.is_legacy) {
|
||||
univ.party.heal(hp_restore);
|
||||
univ.party.restore_sp(mp_restore);
|
||||
put_pc_screen();
|
||||
@@ -2353,7 +2352,7 @@ void increase_age() {
|
||||
move_to_zero(univ.party.light_level);
|
||||
|
||||
// decrease monster present counter
|
||||
move_to_zero(PSD[SDF_HOSTILES_PRESENT]);
|
||||
move_to_zero(univ.party.hostiles_present);
|
||||
|
||||
// Party spell effects
|
||||
if(univ.party.status[ePartyStatus::STEALTH] == 1) {
|
||||
@@ -2689,9 +2688,6 @@ void start_new_game(bool force) {
|
||||
extern cCustomGraphics spec_scen_g;
|
||||
spec_scen_g.party_sheet.reset();
|
||||
|
||||
// Don't reset instant help just because they started a new game.
|
||||
std::vector<int> help = get_iarray_pref("ReceivedHelp");
|
||||
std::copy(help.begin(), help.end(), std::inserter(univ.party.help_received, univ.party.help_received.begin()));
|
||||
// The original code called build_outdoors here, but they're not even in a scenario, so I removed it.
|
||||
// It was probably a relic of Exile III.
|
||||
// (It also refreshed stores... with uninitialized items.)
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "choicedlog.hpp"
|
||||
#include "boe.menus.hpp"
|
||||
#include "spell.hpp"
|
||||
#include "prefs.hpp"
|
||||
|
||||
extern eGameMode overall_mode;
|
||||
extern bool ghost_mode;
|
||||
@@ -747,7 +748,7 @@ void pc_attack_weapon(short who_att,iLiving& target,short hit_adj,short dam_adj,
|
||||
|
||||
if(weap.ability == eItemAbil::EXPLODING_WEAPON) {
|
||||
add_string_to_buf(" The weapon produces an explosion!");
|
||||
if(PSD[SDF_GAME_SPEED] == 0)
|
||||
if(get_int_pref("GameSpeed") == 0)
|
||||
pause(1);
|
||||
else pause(5);
|
||||
play_sound(5);
|
||||
@@ -1776,7 +1777,7 @@ void fire_missile(location target) {
|
||||
take_ap((overall_mode == MODE_FIRING) ? 3 : 2);
|
||||
univ.party[current_pc].void_sanctuary(); // TODO: Is this right?
|
||||
add_string_to_buf(" The arrow explodes!");
|
||||
if(PSD[SDF_GAME_SPEED] == 0)
|
||||
if(get_int_pref("GameSpeed") == 0)
|
||||
pause(dist(missile_firer.combat_pos,target));
|
||||
else
|
||||
pause(dist(missile_firer.combat_pos,target)*5);
|
||||
@@ -2054,7 +2055,7 @@ void combat_run_monst() {
|
||||
move_to_zero(univ.party.status[ePartyStatus::FIREWALK]);
|
||||
|
||||
// decrease monster present counter
|
||||
move_to_zero(PSD[SDF_HOSTILES_PRESENT]);
|
||||
move_to_zero(univ.party.hostiles_present);
|
||||
|
||||
dump_gold(1);
|
||||
|
||||
@@ -2258,7 +2259,7 @@ void do_monster_turn() {
|
||||
if(cur_monst->active == 2) { // Begin action loop for angry, active monsters
|
||||
// First note that hostile monsters are around.
|
||||
if(!cur_monst->is_friendly())
|
||||
PSD[SDF_HOSTILES_PRESENT] = 30;
|
||||
univ.party.hostiles_present = 30;
|
||||
|
||||
// Give monster its action points
|
||||
cur_monst->ap = cur_monst->speed;
|
||||
@@ -2354,7 +2355,8 @@ void do_monster_turn() {
|
||||
center_on_monst = true;
|
||||
center = cur_monst->cur_loc;
|
||||
draw_terrain(0);
|
||||
pause((PSD[SDF_GAME_SPEED] == 3) ? 9 : PSD[SDF_GAME_SPEED]);
|
||||
int speed = get_int_pref("GameSpeed");
|
||||
pause(speed == 3 ? 9 : speed);
|
||||
}
|
||||
|
||||
combat_posing_monster = current_working_monster = 100 + i;
|
||||
|
@@ -24,30 +24,6 @@
|
||||
#define NUM_OF_BOATS 30
|
||||
#define NUM_OF_HORSES 30
|
||||
|
||||
/* stuff done flags */
|
||||
#define SDF_COMBAT_SELECT_PARTY 305][3
|
||||
#define SDF_SKIP_STARTUP 305][4 // preferably deprecated
|
||||
#define SDF_LESS_SOUND 305][5
|
||||
#define SDF_NO_TARGET_LINE 305][6
|
||||
#define SDF_NO_BOAT_SPECIALS 305][7
|
||||
#define SDF_RESURRECT_NO_BALM 305][8
|
||||
#define SDF_HOSTILES_PRESENT 305][9
|
||||
#define SDF_NO_SOUNDS 306][1
|
||||
#define SDF_NO_FRILLS 306][2
|
||||
#define SDF_ROOM_DESCS_AGAIN 306][3
|
||||
#define SDF_NO_INSTANT_HELP 306][4 // boolean
|
||||
#define SDF_NO_SHORE_FRILLS 306][5
|
||||
#define SDF_GAME_SPEED 306][6
|
||||
#define SDF_EASY_MODE 306][7
|
||||
#define SDF_LESS_WANDER_ENC 306][8
|
||||
#define SDF_NO_TER_ANIM 306][9
|
||||
#define SDF_TIMERS_DURING_REST 307][0
|
||||
/*
|
||||
[305]
|
||||
[6] is No targeting line (use if getting crashes)
|
||||
[5] is Fewer sounds (use if getting crashes)
|
||||
*/
|
||||
|
||||
/* overall mode; some seem to be missing */
|
||||
enum eGameMode {
|
||||
MODE_OUTDOORS = 0,
|
||||
|
@@ -38,22 +38,20 @@
|
||||
|
||||
extern short stat_window;
|
||||
extern eGameMode overall_mode;
|
||||
extern bool play_sounds,give_intro_hint,show_startup_splash,changed_display_mode;
|
||||
extern bool changed_display_mode;
|
||||
extern sf::RenderWindow mainPtr;
|
||||
extern location ul;
|
||||
extern rectangle d_rects[80];
|
||||
extern short d_rect_index[80];
|
||||
extern short display_mode,current_pc;
|
||||
extern short current_pc;
|
||||
extern eStatMode stat_screen_mode;
|
||||
extern long register_flag;
|
||||
extern long ed_flag,ed_key;
|
||||
extern bool give_delays;
|
||||
extern location center;
|
||||
extern std::shared_ptr<cScrollbar> text_sbar,item_sbar,shop_sbar;
|
||||
extern std::shared_ptr<cButton> done_btn, help_btn;
|
||||
extern bool map_visible;
|
||||
extern sf::RenderWindow mini_map;
|
||||
extern bool game_run_before,skip_boom_delay;
|
||||
extern cUniverse univ;
|
||||
extern sf::Texture pc_gworld;
|
||||
extern std::map<eSkill,short> skill_max;
|
||||
@@ -64,6 +62,7 @@ short sign_mode,person_graphic,store_person_graphic,store_sign_mode;
|
||||
long num_talk_entries;
|
||||
char null_string[256] = "";
|
||||
short store_tip_page_on = 0;
|
||||
extern bool party_in_memory;
|
||||
|
||||
// Talking vars
|
||||
eGameMode store_pre_talk_mode;
|
||||
@@ -1089,45 +1088,7 @@ void do_sign(short town_num, short which_sign, short sign_type) {
|
||||
sign.show();
|
||||
}
|
||||
|
||||
void load_prefs(){
|
||||
give_intro_hint = get_bool_pref("GiveIntroHint", true);
|
||||
display_mode = get_int_pref("DisplayMode");
|
||||
play_sounds = get_bool_pref("PlaySounds", true);
|
||||
show_startup_splash = get_bool_pref("ShowStartupSplash", true);
|
||||
game_run_before = get_bool_pref("GameRunBefore");
|
||||
skip_boom_delay = get_bool_pref("SkipBoomDelay");
|
||||
|
||||
PSD[SDF_NO_FRILLS] = !get_bool_pref("DrawTerrainFrills", true);
|
||||
PSD[SDF_NO_INSTANT_HELP] = !get_bool_pref("ShowInstantHelp", true);
|
||||
PSD[SDF_NO_TER_ANIM] = !get_bool_pref("DrawTerrainAnimation", true);
|
||||
PSD[SDF_NO_SHORE_FRILLS] = !get_bool_pref("DrawTerrainShoreFrills", true);
|
||||
PSD[SDF_ROOM_DESCS_AGAIN] = get_bool_pref("RepeatRoomDescriptions");
|
||||
PSD[SDF_EASY_MODE] = get_bool_pref("EasyMode");
|
||||
PSD[SDF_LESS_WANDER_ENC] = get_bool_pref("LessWanderingMonsters");
|
||||
PSD[SDF_GAME_SPEED] = get_int_pref("GameSpeed");
|
||||
|
||||
std::vector<int> help = get_iarray_pref("ReceivedHelp");
|
||||
std::copy(help.begin(), help.end(), std::inserter(univ.party.help_received, univ.party.help_received.begin()));
|
||||
}
|
||||
|
||||
void save_prefs(bool resetHelp){
|
||||
set_pref("GiveIntroHint", give_intro_hint);
|
||||
set_pref("DisplayMode", display_mode);
|
||||
set_pref("PlaySounds", play_sounds);
|
||||
set_pref("ShowStartupSplash", show_startup_splash);
|
||||
set_pref("GameRunBefore", game_run_before);
|
||||
set_pref("SkipBoomDelay", skip_boom_delay);
|
||||
|
||||
if(overall_mode == MODE_STARTUP) {
|
||||
set_pref("DrawTerrainFrills", !PSD[SDF_NO_FRILLS]);
|
||||
set_pref("ShowInstantHelp", !PSD[SDF_NO_INSTANT_HELP]);
|
||||
set_pref("DrawTerrainAnimation", !PSD[SDF_NO_TER_ANIM]);
|
||||
set_pref("DrawTerrainShoreFrills", !PSD[SDF_NO_SHORE_FRILLS]);
|
||||
set_pref("RepeatRoomDescriptions", bool(PSD[SDF_ROOM_DESCS_AGAIN]));
|
||||
set_pref("EasyMode", bool(PSD[SDF_EASY_MODE]));
|
||||
set_pref("LessWanderingMonsters", bool(PSD[SDF_LESS_WANDER_ENC]));
|
||||
set_pref("GameSpeed", PSD[SDF_GAME_SPEED]);
|
||||
}
|
||||
|
||||
if(resetHelp) clear_pref("ReceivedHelp");
|
||||
|
||||
@@ -1150,22 +1111,27 @@ static bool prefs_event_filter (cDialog& me, std::string id, eKeyMod) {
|
||||
if(!did_cancel) {
|
||||
std::string cur_display_mode = dynamic_cast<cLedGroup&>(me["display"]).getSelected();
|
||||
// TODO: Make an enum for the display mode
|
||||
if(cur_display_mode == "mid") display_mode = 0;
|
||||
else if(cur_display_mode == "tl") display_mode = 1;
|
||||
else if(cur_display_mode == "tr") display_mode = 2;
|
||||
else if(cur_display_mode == "bl") display_mode = 3;
|
||||
else if(cur_display_mode == "br") display_mode = 4;
|
||||
else if(cur_display_mode == "win") display_mode = 5;
|
||||
PSD[SDF_NO_SOUNDS] = dynamic_cast<cLed&>(me["nosound"]).getState() != led_off;
|
||||
play_sounds = !PSD[SDF_NO_SOUNDS];
|
||||
PSD[SDF_NO_FRILLS] = dynamic_cast<cLed&>(me["nofrills"]).getState() != led_off;
|
||||
PSD[SDF_ROOM_DESCS_AGAIN] = dynamic_cast<cLed&>(me["repeatdesc"]).getState() != led_off;
|
||||
PSD[SDF_NO_INSTANT_HELP] = dynamic_cast<cLed&>(me["nohelp"]).getState() != led_off;
|
||||
PSD[SDF_EASY_MODE] = dynamic_cast<cLed&>(me["easier"]).getState() != led_off;
|
||||
PSD[SDF_LESS_WANDER_ENC] = dynamic_cast<cLed&>(me["lesswm"]).getState() != led_off;
|
||||
PSD[SDF_NO_TER_ANIM] = dynamic_cast<cLed&>(me["noanim"]).getState() != led_off;
|
||||
PSD[SDF_NO_SHORE_FRILLS] = dynamic_cast<cLed&>(me["noshore"]).getState() != led_off;
|
||||
show_startup_splash = dynamic_cast<cLed&>(me["skipsplash"]).getState() == led_off;
|
||||
if(cur_display_mode == "mid") set_pref("DisplayMode", 0);
|
||||
else if(cur_display_mode == "tl") set_pref("DisplayMode", 1);
|
||||
else if(cur_display_mode == "tr") set_pref("DisplayMode", 2);
|
||||
else if(cur_display_mode == "bl") set_pref("DisplayMode", 3);
|
||||
else if(cur_display_mode == "br") set_pref("DisplayMode", 4);
|
||||
else if(cur_display_mode == "win") set_pref("DisplayMode", 5);
|
||||
set_pref("PlaySounds", dynamic_cast<cLed&>(me["nosound"]).getState() == led_off);
|
||||
set_pref("DrawTerrainFrills", dynamic_cast<cLed&>(me["nofrills"]).getState() == led_off);
|
||||
set_pref("RepeatRoomDescriptions", dynamic_cast<cLed&>(me["repeatdesc"]).getState() != led_off);
|
||||
set_pref("ShowInstantHelp", dynamic_cast<cLed&>(me["nohelp"]).getState() == led_off);
|
||||
|
||||
if(overall_mode == MODE_STARTUP && !party_in_memory) {
|
||||
set_pref("EasyMode", dynamic_cast<cLed&>(me["easier"]).getState() != led_off);
|
||||
set_pref("LessWanderingMonsters", dynamic_cast<cLed&>(me["lesswm"]).getState() != led_off);
|
||||
} else {
|
||||
univ.party.easy_mode = dynamic_cast<cLed&>(me["easier"]).getState() != led_off;
|
||||
univ.party.less_wm = dynamic_cast<cLed&>(me["lesswm"]).getState() != led_off;
|
||||
}
|
||||
set_pref("DrawTerrainAnimation", dynamic_cast<cLed&>(me["noanim"]).getState() == led_off);
|
||||
set_pref("DrawTerrainShoreFrills", dynamic_cast<cLed&>(me["noshore"]).getState() == led_off);
|
||||
set_pref("ShowStartupSplash", dynamic_cast<cLed&>(me["skipsplash"]).getState() == led_off);
|
||||
std::string speed = dynamic_cast<cLedGroup&>(me["speed"]).getSelected();
|
||||
/* TODO: Should I add these additional preferences from Windows?
|
||||
party.stuff_done[SDF_NO_TARGET_LINE] = cd_get_led(1099,50);
|
||||
@@ -1173,21 +1139,18 @@ static bool prefs_event_filter (cDialog& me, std::string id, eKeyMod) {
|
||||
party.stuff_done[SDF_FASTER_BOOM_SPACES] = cd_get_led(1099,56);
|
||||
party.stuff_done[SDF_ASK_ABOUT_TEXT_BOX] = cd_get_led(1099,60);
|
||||
*/
|
||||
// TODO: NO_SOUNDS and NO_MAPS preferences are stored in two different places
|
||||
if(speed == "fast")
|
||||
PSD[SDF_GAME_SPEED] = 0;
|
||||
set_pref("GameSpeed", 0);
|
||||
else if(speed == "med")
|
||||
PSD[SDF_GAME_SPEED] = 1;
|
||||
set_pref("GameSpeed", 1);
|
||||
else if(speed == "slow")
|
||||
PSD[SDF_GAME_SPEED] = 2;
|
||||
set_pref("GameSpeed", 2);
|
||||
else if(speed == "snail")
|
||||
PSD[SDF_GAME_SPEED] = 3;
|
||||
set_pref("GameSpeed", 3);
|
||||
if(dynamic_cast<cLed&>(me["resethelp"]).getState() == led_red) {
|
||||
univ.party.help_received.clear();
|
||||
reset_help = true;
|
||||
}
|
||||
}
|
||||
give_delays = PSD[SDF_NO_FRILLS];
|
||||
save_prefs(reset_help);
|
||||
return true;
|
||||
}
|
||||
@@ -1199,7 +1162,7 @@ void pick_preferences() {
|
||||
prefsDlog.attachClickHandlers(&prefs_event_filter, {"okay", "cancel"});
|
||||
|
||||
cLedGroup& displayMode = dynamic_cast<cLedGroup&>(prefsDlog["display"]);
|
||||
switch(display_mode) {
|
||||
switch(get_int_pref("DisplayMode")) {
|
||||
case 0:
|
||||
displayMode.setSelected("mid");
|
||||
break;
|
||||
@@ -1220,17 +1183,22 @@ void pick_preferences() {
|
||||
break;
|
||||
}
|
||||
|
||||
dynamic_cast<cLed&>(prefsDlog["nosound"]).setState(!play_sounds ? led_red : led_off);
|
||||
dynamic_cast<cLed&>(prefsDlog["nofrills"]).setState(PSD[SDF_NO_FRILLS] ? led_red : led_off);
|
||||
dynamic_cast<cLed&>(prefsDlog["repeatdesc"]).setState(PSD[SDF_ROOM_DESCS_AGAIN] ? led_red : led_off);
|
||||
dynamic_cast<cLed&>(prefsDlog["nohelp"]).setState(PSD[SDF_NO_INSTANT_HELP] ? led_red : led_off);
|
||||
dynamic_cast<cLed&>(prefsDlog["easier"]).setState(PSD[SDF_EASY_MODE] ? led_red : led_off);
|
||||
dynamic_cast<cLed&>(prefsDlog["lesswm"]).setState(PSD[SDF_LESS_WANDER_ENC] ? led_red : led_off);
|
||||
dynamic_cast<cLed&>(prefsDlog["noanim"]).setState(PSD[SDF_NO_TER_ANIM] ? led_red : led_off);
|
||||
dynamic_cast<cLed&>(prefsDlog["noshore"]).setState(PSD[SDF_NO_SHORE_FRILLS] ? led_red : led_off);
|
||||
dynamic_cast<cLed&>(prefsDlog["skipsplash"]).setState(show_startup_splash ? led_off : led_red);
|
||||
dynamic_cast<cLed&>(prefsDlog["nosound"]).setState(get_bool_pref("PlaySounds", true) ? led_off : led_red);
|
||||
dynamic_cast<cLed&>(prefsDlog["nofrills"]).setState(get_bool_pref("DrawTerrainFrills", true) ? led_off : led_red);
|
||||
dynamic_cast<cLed&>(prefsDlog["repeatdesc"]).setState(get_bool_pref("RepeatRoomDescriptions") ? led_red : led_off);
|
||||
dynamic_cast<cLed&>(prefsDlog["nohelp"]).setState(get_bool_pref("ShowInstantHelp", true) ? led_off : led_red);
|
||||
if(overall_mode == MODE_STARTUP && !party_in_memory) {
|
||||
dynamic_cast<cLed&>(prefsDlog["easier"]).setState(get_bool_pref("EasyMode") ? led_red : led_off);
|
||||
dynamic_cast<cLed&>(prefsDlog["lesswm"]).setState(get_bool_pref("LessWanderingMonsters") ? led_red : led_off);
|
||||
} else {
|
||||
dynamic_cast<cLed&>(prefsDlog["easier"]).setState(univ.party.easy_mode ? led_red : led_off);
|
||||
dynamic_cast<cLed&>(prefsDlog["lesswm"]).setState(univ.party.less_wm ? led_red : led_off);
|
||||
}
|
||||
dynamic_cast<cLed&>(prefsDlog["noanim"]).setState(get_bool_pref("DrawTerrainAnimations", true) ? led_off : led_red);
|
||||
dynamic_cast<cLed&>(prefsDlog["noshore"]).setState(get_bool_pref("DrawTerrainShoreFrills", true) ? led_off : led_red);
|
||||
dynamic_cast<cLed&>(prefsDlog["skipsplash"]).setState(get_bool_pref("ShowStartupSplash", true) ? led_off : led_red);
|
||||
cLedGroup& gameSpeed = dynamic_cast<cLedGroup&>(prefsDlog["speed"]);
|
||||
switch(PSD[SDF_GAME_SPEED]) {
|
||||
switch(get_int_pref("GameSpeed")) {
|
||||
case 0:
|
||||
gameSpeed.setSelected("fast");
|
||||
break;
|
||||
@@ -1247,10 +1215,10 @@ void pick_preferences() {
|
||||
|
||||
void (*give_help)(short,short,cDialog&) = ::give_help;
|
||||
|
||||
int store_display_mode = display_mode;
|
||||
int store_display_mode = get_int_pref("DisplayMode");
|
||||
prefsDlog.run(std::bind(give_help, 55, 0, std::ref(prefsDlog)));
|
||||
|
||||
if(display_mode != store_display_mode)
|
||||
if(get_int_pref("DisplayMode") != store_display_mode)
|
||||
changed_display_mode = true;
|
||||
}
|
||||
|
||||
@@ -1381,10 +1349,10 @@ void tip_of_day() {
|
||||
tips["tip"].setText(place_str);
|
||||
|
||||
cLed& showAtStart = dynamic_cast<cLed&>(tips["onstart"]);
|
||||
showAtStart.setState(give_intro_hint ? led_red : led_off);
|
||||
showAtStart.setState(get_bool_pref("GiveIntroHint", true) ? led_red : led_off);
|
||||
|
||||
tips.run();
|
||||
give_intro_hint = showAtStart.getState() != led_off;
|
||||
set_pref("GiveIntroHint", showAtStart.getState() != led_off);
|
||||
save_prefs();
|
||||
|
||||
}
|
||||
|
@@ -23,7 +23,6 @@ void put_party_stats();
|
||||
void edit_party();
|
||||
void pick_preferences();
|
||||
void save_prefs(bool resetHelp = false);
|
||||
void load_prefs();
|
||||
void tip_of_day();
|
||||
short pick_a_scen();
|
||||
short pick_prefab_scen();
|
||||
|
@@ -25,9 +25,8 @@
|
||||
#define DONE_BUTTON_ITEM 1
|
||||
|
||||
extern eStatMode stat_screen_mode;
|
||||
extern bool give_delays;
|
||||
extern eGameMode overall_mode;
|
||||
extern bool play_sounds,sys_7_avail,party_in_memory,in_scen_debug,ghost_mode,node_step_through;
|
||||
extern bool party_in_memory,in_scen_debug,ghost_mode,node_step_through;
|
||||
extern location center;
|
||||
extern long register_flag;
|
||||
extern sf::RenderWindow mainPtr;
|
||||
@@ -132,13 +131,6 @@ void finish_load_party(){
|
||||
|
||||
add_string_to_buf("Load: Game loaded.");
|
||||
|
||||
// Set sounds, map saving, and speed
|
||||
if(((play_sounds) && (PSD[SDF_NO_SOUNDS] == 1)) ||
|
||||
(!play_sounds && (PSD[SDF_NO_SOUNDS] == 0))) {
|
||||
flip_sound();
|
||||
}
|
||||
give_delays = PSD[SDF_NO_FRILLS];
|
||||
|
||||
in_scen_debug = false;
|
||||
}
|
||||
|
||||
|
@@ -28,14 +28,14 @@
|
||||
#include "restypes.hpp"
|
||||
#include "boe.menus.hpp"
|
||||
#include "winutil.hpp"
|
||||
#include "prefs.hpp"
|
||||
#include "gitrev.hpp"
|
||||
|
||||
extern sf::RenderWindow mainPtr;
|
||||
extern short stat_window;
|
||||
extern bool give_delays;
|
||||
extern eGameMode overall_mode;
|
||||
extern short current_spell_range;
|
||||
extern bool anim_onscreen,play_sounds,frills_on,party_in_memory;
|
||||
extern bool anim_onscreen,frills_on,party_in_memory;
|
||||
extern bool flushingInput;
|
||||
extern bool cartoon_happening, fog_lifted;
|
||||
extern short anim_step;
|
||||
@@ -43,12 +43,11 @@ extern effect_pat_type current_pat;
|
||||
extern location ul;
|
||||
extern location center;
|
||||
extern short which_combat_type,current_pc;
|
||||
extern bool monsters_going,boom_anim_active,skip_boom_delay;
|
||||
extern bool monsters_going,boom_anim_active;
|
||||
extern sf::Image spell_pict;
|
||||
extern short current_ground;
|
||||
extern short num_targets_left;
|
||||
extern location spell_targets[8];
|
||||
extern short display_mode;
|
||||
extern std::shared_ptr<cScrollbar> text_sbar,item_sbar,shop_sbar;
|
||||
extern std::shared_ptr<cButton> done_btn, help_btn;
|
||||
extern sf::Texture bg_gworld;
|
||||
@@ -63,7 +62,6 @@ extern cUniverse univ;
|
||||
extern cCustomGraphics spec_scen_g;
|
||||
extern sf::RenderWindow mini_map;
|
||||
bool map_visible = false;
|
||||
extern bool show_startup_splash;
|
||||
extern std::string save_talk_str1, save_talk_str2;
|
||||
|
||||
rectangle menuBarRect;
|
||||
@@ -134,7 +132,8 @@ void adjust_window_mode() {
|
||||
bool firstTime = !mainPtr.isOpen();
|
||||
|
||||
// TODO: Make display_mode an enum
|
||||
if(display_mode == 5) {
|
||||
// 0 - center 1- ul 2 - ur 3 - dl 4 - dr 5 - small win
|
||||
if(get_int_pref("DisplayMode") == 5) {
|
||||
ul.x = 14; ul.y = 2;
|
||||
int height = 430 + menubarHeight;
|
||||
mainPtr.create(sf::VideoMode(605, height, 32), "Blades of Exile", sf::Style::Titlebar | sf::Style::Close, winSettings);
|
||||
@@ -145,7 +144,7 @@ void adjust_window_mode() {
|
||||
mainPtr.create(desktop, "Blades of Exile", sf::Style::None, winSettings);
|
||||
mainPtr.setPosition({0,0});
|
||||
rectangle windRect(mainPtr);
|
||||
switch(display_mode) {
|
||||
switch(get_int_pref("DisplayMode")) {
|
||||
case 0: ul.x = (windRect.right - 560) / 2; ul.y = (windRect.bottom - 422) / 2 + 14; break;
|
||||
case 1: ul.x = 10; ul.y = 28; break;
|
||||
case 2: ul.x = windRect.right - 570 - 6; ul.y = 28; break; // was 560. not 570
|
||||
@@ -387,9 +386,7 @@ void main_button_click(int which_button) {
|
||||
|
||||
draw_buttons(which_button);
|
||||
mainPtr.display();
|
||||
if(play_sounds)
|
||||
play_sound(37);
|
||||
else sf::sleep(time_in_ticks(5));
|
||||
play_sound(37, time_in_ticks(5));
|
||||
draw_buttons(-1);
|
||||
undo_clip(mainPtr);
|
||||
}
|
||||
@@ -402,9 +399,7 @@ void arrow_button_click(rectangle button_rect) {
|
||||
|
||||
refresh_stat_areas(1);
|
||||
mainPtr.display();
|
||||
if(play_sounds)
|
||||
play_sound(37);
|
||||
else sf::sleep(time_in_ticks(5));
|
||||
play_sound(37, time_in_ticks(5));
|
||||
undo_clip(mainPtr);
|
||||
refresh_stat_areas(0);
|
||||
}
|
||||
@@ -450,8 +445,8 @@ void Set_up_win () {
|
||||
|
||||
// Create and initialize map gworld
|
||||
if(!map_gworld.create(map_rect.width(), map_rect.height())) {
|
||||
play_sound(2,3);
|
||||
exit(1);
|
||||
play_sound(2);
|
||||
throw std::string("Failed to initialized automap!");
|
||||
} else {
|
||||
map_world_rect = rectangle(map_gworld);
|
||||
fill_rect(map_gworld, map_world_rect, sf::Color::White);
|
||||
@@ -989,7 +984,7 @@ void place_trim(short q,short r,location where,ter_num_t ter_type) {
|
||||
// FIrst quick check ... if a pit or barrier in outdoor combat, no trim
|
||||
if((is_combat()) && (which_combat_type == 0) && (ter_type == 90))
|
||||
return;
|
||||
if(PSD[SDF_NO_SHORE_FRILLS] > 0)
|
||||
if(!get_bool_pref("DrawTerrainShoreFrills", true))
|
||||
return;
|
||||
|
||||
targ.x = q;
|
||||
@@ -1399,7 +1394,7 @@ void boom_space(location where,short mode,short type,short damage,short sound) {
|
||||
return;
|
||||
if((boom_anim_active) && (type != 3))
|
||||
return;
|
||||
if((PSD[SDF_NO_FRILLS] > 0) && fast_bang)
|
||||
if(!get_bool_pref("DrawTerrainFrills", true) && fast_bang)
|
||||
return;
|
||||
if(is_out())
|
||||
return;
|
||||
@@ -1462,14 +1457,15 @@ void boom_space(location where,short mode,short type,short damage,short sound) {
|
||||
win_draw_string(mainPtr,text_rect,dam_str,eTextMode::CENTRE,style,ul);
|
||||
}
|
||||
mainPtr.display();
|
||||
bool skip_boom_delay = get_bool_pref("SkipBoomDelay");
|
||||
play_sound((skip_boom_delay?-1:1)*sound_to_play);
|
||||
if((sound == 6) && (fast_bang == 0) && (!skip_boom_delay))
|
||||
sf::sleep(time_in_ticks(12));
|
||||
|
||||
|
||||
if(fast_bang == 0 && !skip_boom_delay) {
|
||||
del_len = PSD[SDF_GAME_SPEED] * 3 + 4;
|
||||
if(!play_sounds)
|
||||
del_len = get_int_pref("GameSpeed") * 3 + 4;
|
||||
if(!get_bool_pref("PlaySounds", true))
|
||||
sf::sleep(time_in_ticks(del_len));
|
||||
}
|
||||
redraw_terrain();
|
||||
|
@@ -23,11 +23,10 @@
|
||||
extern sf::RenderWindow mainPtr;
|
||||
extern rectangle windRect;
|
||||
extern short stat_window;
|
||||
extern bool give_delays;
|
||||
extern bool cartoon_happening;
|
||||
extern eGameMode overall_mode;
|
||||
extern short current_spell_range;
|
||||
extern bool anim_onscreen,play_sounds,frills_on;
|
||||
extern bool anim_onscreen,frills_on;
|
||||
extern cUniverse univ;
|
||||
extern effect_pat_type current_pat;
|
||||
extern sf::RenderWindow mini_map;
|
||||
@@ -43,7 +42,6 @@ extern bool monsters_going,anim_onscreen;
|
||||
|
||||
extern short num_targets_left;
|
||||
extern location spell_targets[8];
|
||||
extern short display_mode;
|
||||
|
||||
extern long anim_ticks;
|
||||
|
||||
|
@@ -34,7 +34,6 @@ extern std::map<eSkill,short> skill_max;
|
||||
extern std::map<eSkill,short> skill_g_cost;
|
||||
extern const char* skill_ids[19];
|
||||
extern short cur_town_talk_loaded;
|
||||
extern bool give_intro_hint;
|
||||
extern sf::RenderWindow mainPtr;
|
||||
extern short on_monst_menu[256];
|
||||
|
||||
@@ -421,7 +420,7 @@ static bool display_monst_event_filter(cDialog& me, std::string item_hit, cCreat
|
||||
|
||||
if(roster[position % 60].number != on_monst_menu[position]) {
|
||||
cMonster& monst = univ.scenario.scen_monsters[on_monst_menu[position]];
|
||||
roster.assign(position % 60, cCreature(on_monst_menu[position]), monst, PSD[SDF_EASY_MODE], univ.difficulty_adjust());
|
||||
roster.assign(position % 60, cCreature(on_monst_menu[position]), monst, univ.party.easy_mode, univ.difficulty_adjust());
|
||||
store_m = roster[position % 60];
|
||||
}
|
||||
put_monst_info(me, store_m);
|
||||
@@ -837,11 +836,8 @@ static void give_help(short help1,short help2,cDialog* parent) {
|
||||
help_forced = true;
|
||||
help1 -= 200;
|
||||
}
|
||||
if((PSD[SDF_NO_INSTANT_HELP] > 0) && !help_forced)
|
||||
if(!get_bool_pref("ShowInstantHelp", true) && !help_forced)
|
||||
return;
|
||||
if(univ.party.help_received.count(help1) > 0 && !help_forced)
|
||||
return;
|
||||
univ.party.help_received.insert(help1);
|
||||
append_iarray_pref("ReceivedHelp", help1);
|
||||
str1 = get_str("help",help1);
|
||||
if(help2 > 0)
|
||||
|
@@ -38,7 +38,6 @@ bool All_Done = false;
|
||||
sf::Event event;
|
||||
sf::RenderWindow mainPtr;
|
||||
short had_text_freeze = 0,num_fonts;
|
||||
bool skip_boom_delay = false;
|
||||
bool first_startup_update = true;
|
||||
bool diff_depth_ok = false,first_sound_played = false,spell_forced = false;
|
||||
bool party_in_memory = false;
|
||||
@@ -61,10 +60,7 @@ signed char dir_x_dif[9] = {0,1,1,1,0,-1,-1,-1,0};
|
||||
signed char dir_y_dif[9] = {-1,-1,0,1,1,1,0,-1,0};
|
||||
|
||||
extern bool map_visible;
|
||||
bool game_run_before = false;
|
||||
bool give_intro_hint = true;
|
||||
bool in_scen_debug = false;
|
||||
bool show_startup_splash = true;
|
||||
bool belt_present = false;
|
||||
std::string scenario_temp_dir_name = "scenario";
|
||||
|
||||
@@ -77,12 +73,11 @@ eGameMode overall_mode = MODE_STARTUP;
|
||||
bool first_update = true,anim_onscreen = false,frills_on = true,changed_display_mode = false;
|
||||
short stat_window = 0,store_modifier;
|
||||
bool monsters_going = false,boom_anim_active = false;
|
||||
bool give_delays = false, finished_init = false;
|
||||
bool finished_init = false;
|
||||
|
||||
sf::RenderWindow mini_map;
|
||||
short which_item_page[6] = {0,0,0,0,0,0}; // Remembers which of the 2 item pages pc looked at
|
||||
location ul = {28,10};
|
||||
short display_mode = 0; // 0 - center 1- ul 2 - ur 3 - dl 4 - dr 5 - small win
|
||||
long stored_key;
|
||||
short pixel_depth,old_depth = 8;
|
||||
short current_ground = 0;
|
||||
@@ -117,11 +112,11 @@ int main(int argc, char* argv[]) {
|
||||
try{
|
||||
init_boe(argc, argv);
|
||||
|
||||
if(!game_run_before)
|
||||
if(!get_bool_pref("GameRunBefore"))
|
||||
cChoiceDlog("welcome").show();
|
||||
else if(give_intro_hint)
|
||||
else if(get_bool_pref("GiveIntroHint", true))
|
||||
tip_of_day();
|
||||
game_run_before = true;
|
||||
set_pref("GameRunBefore", true);
|
||||
finished_init = true;
|
||||
|
||||
if(ae_loading) {
|
||||
@@ -167,7 +162,6 @@ void init_boe(int argc, char* argv[]) {
|
||||
init_directories(argv[0]);
|
||||
init_menubar(); // Do this first of all because otherwise a default File and Window menu will be seen
|
||||
sync_prefs();
|
||||
load_prefs();
|
||||
init_graph_tool();
|
||||
init_snd_tool();
|
||||
|
||||
@@ -194,7 +188,7 @@ void init_boe(int argc, char* argv[]) {
|
||||
flushingInput = true;
|
||||
});
|
||||
show_logo();
|
||||
if(show_startup_splash)
|
||||
if(get_bool_pref("ShowStartupSplash", true))
|
||||
plop_fancy_startup();
|
||||
init_thread.join();
|
||||
|
||||
@@ -216,7 +210,7 @@ void Handle_One_Event() {
|
||||
Handle_Update();
|
||||
|
||||
//(cur_time - last_anim_time > 42)
|
||||
if((animTimer.getElapsedTime().asMilliseconds() >= fortyTicks) && (overall_mode != MODE_STARTUP) && (anim_onscreen) && (PSD[SDF_NO_TER_ANIM] == 0)
|
||||
if((animTimer.getElapsedTime().asMilliseconds() >= fortyTicks) && (overall_mode != MODE_STARTUP) && (anim_onscreen) && get_bool_pref("DrawTerrainAnimation", true)
|
||||
&& (!gInBackground)) {
|
||||
animTimer.restart();
|
||||
draw_terrain();
|
||||
@@ -747,6 +741,6 @@ void pause(short length) {
|
||||
// Before pausing, make sure the screen is updated.
|
||||
redraw_screen(REFRESH_NONE);
|
||||
|
||||
if(give_delays)
|
||||
if(get_bool_pref("DrawTerrainFrills", true))
|
||||
sf::sleep(time_in_ticks(len));
|
||||
}
|
||||
|
@@ -167,7 +167,7 @@ void set_up_monst(eAttitude mode,mon_num_t m_num) {
|
||||
short which = univ.town.monst.size();
|
||||
|
||||
cMonster& monst = m_num >= 10000 ? univ.party.summons[m_num - 10000] : univ.scenario.scen_monsters[m_num];
|
||||
univ.town.monst.assign(which, cCreature(m_num), monst, PSD[SDF_EASY_MODE], univ.difficulty_adjust());
|
||||
univ.town.monst.assign(which, cCreature(m_num), monst, univ.party.easy_mode, univ.difficulty_adjust());
|
||||
univ.town.monst[which].active = 2;
|
||||
univ.town.monst[which].summon_time = 0;
|
||||
univ.town.monst[which].attitude = mode;
|
||||
@@ -779,7 +779,7 @@ bool town_move_monster(short num,location dest) {
|
||||
|
||||
bool monster_placid(short m_num) {
|
||||
if(univ.town.monst[m_num].attitude == eAttitude::DOCILE ||
|
||||
(univ.town.monst[m_num].attitude == eAttitude::FRIENDLY && PSD[SDF_HOSTILES_PRESENT] == 0)) {
|
||||
(univ.town.monst[m_num].attitude == eAttitude::FRIENDLY && univ.party.hostiles_present == 0)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -1105,7 +1105,7 @@ short place_monster(mon_num_t which,location where,bool forced) {
|
||||
|
||||
// 10000 or more means an exported summon saved with the party
|
||||
cMonster& monst = which >= 10000 ? univ.party.summons[which - 10000] : univ.scenario.scen_monsters[which];
|
||||
univ.town.monst.assign(i, cCreature(which), monst, PSD[SDF_EASY_MODE], univ.difficulty_adjust());
|
||||
univ.town.monst.assign(i, cCreature(which), monst, univ.party.easy_mode, univ.difficulty_adjust());
|
||||
// TODO: Should this static_cast assignment be happening?
|
||||
// One effect is resetting max health to ignore difficulty_adjust()
|
||||
static_cast<cMonster&>(univ.town.monst[i]) = monst;
|
||||
@@ -1177,7 +1177,7 @@ void activate_monsters(short code,short /*attitude*/) {
|
||||
for(i = 0; i < univ.town->creatures.size(); i++)
|
||||
if(univ.town->creatures[i].spec_enc_code == code) {
|
||||
cTownperson& monst = univ.town->creatures[i];
|
||||
univ.town.monst.assign(i, monst, univ.scenario.scen_monsters[monst.number], PSD[SDF_EASY_MODE], univ.difficulty_adjust());
|
||||
univ.town.monst.assign(i, monst, univ.scenario.scen_monsters[monst.number], univ.party.easy_mode, univ.difficulty_adjust());
|
||||
univ.town.monst[i].spec_enc_code = 0;
|
||||
univ.town.monst[i].active = 2;
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "spell.hpp"
|
||||
#include "button.hpp"
|
||||
#include "restypes.hpp"
|
||||
#include "prefs.hpp"
|
||||
|
||||
short monsters_faces[190] = {
|
||||
0,1,2,3,4,5,6,7,8,9,
|
||||
@@ -52,7 +53,7 @@ extern tessel_ref_t bg[];
|
||||
extern sf::RenderWindow mainPtr;
|
||||
extern short which_combat_type;
|
||||
extern eGameMode overall_mode;
|
||||
extern bool play_sounds,boom_anim_active;
|
||||
extern bool boom_anim_active;
|
||||
extern sf::RenderTexture terrain_screen_gworld;
|
||||
extern rectangle sbar_rect,item_sbar_rect,shop_sbar_rect;
|
||||
extern std::shared_ptr<cScrollbar> text_sbar,item_sbar,shop_sbar;
|
||||
@@ -119,7 +120,7 @@ void apply_unseen_mask() {
|
||||
short i,j;
|
||||
bool need_bother = false;
|
||||
|
||||
if(PSD[SDF_NO_FRILLS] > 0 || fog_lifted)
|
||||
if(!get_bool_pref("DrawTerrainFrills", true) || fog_lifted)
|
||||
return;
|
||||
|
||||
if((is_combat()) && (which_combat_type == 0))
|
||||
@@ -151,7 +152,7 @@ void apply_light_mask(bool onWindow) {
|
||||
rectangle big_to = {13,13,337,265};
|
||||
short i,j;
|
||||
bool same_mask = true;
|
||||
if(PSD[SDF_NO_FRILLS] > 0 || fog_lifted)
|
||||
if(!get_bool_pref("DrawTerrainFrills", true) > 0 || fog_lifted)
|
||||
return;
|
||||
if(is_out() || overall_mode == MODE_RESTING)
|
||||
return;
|
||||
@@ -257,7 +258,7 @@ void add_missile(location dest,miss_num_t missile_type,short path_type,short x_a
|
||||
|
||||
if(!boom_anim_active)
|
||||
return;
|
||||
if(PSD[SDF_NO_FRILLS] > 0)
|
||||
if(!get_bool_pref("DrawTerrainFrills", true))
|
||||
return;
|
||||
// lose redundant missiles
|
||||
for(i = 0; i < 30; i++)
|
||||
@@ -310,7 +311,7 @@ void mondo_boom(location l,short type,short snd) {
|
||||
void add_explosion(location dest,short val_to_place,short place_type,short boom_type,short x_adj,short y_adj) {
|
||||
short i;
|
||||
|
||||
if(PSD[SDF_NO_FRILLS] > 0)
|
||||
if(!get_bool_pref("DrawTerrainFrills", true))
|
||||
return;
|
||||
if(!boom_anim_active)
|
||||
return;
|
||||
@@ -457,8 +458,8 @@ void do_missile_anim(short num_steps,location missile_origin,short sound_num) {
|
||||
}
|
||||
}
|
||||
mainPtr.display();
|
||||
if((PSD[SDF_GAME_SPEED] == 3) || ((PSD[SDF_GAME_SPEED] == 1) && (t % 4 == 0)) ||
|
||||
((PSD[SDF_GAME_SPEED] == 2) && (t % 3 == 0)))
|
||||
int speed = get_int_pref("GameSpeed");
|
||||
if(speed == 3 || (speed == 1 && t % 4 == 0) || (speed == 2 && t % 3 == 0))
|
||||
sf::sleep(time_in_ticks(1));
|
||||
}
|
||||
|
||||
@@ -617,7 +618,7 @@ void do_explosion_anim(short /*sound_num*/,short special_draw, short snd) {
|
||||
}
|
||||
//if(((PSD[SDF_GAME_SPEED] == 1) && (t % 3 == 0)) || ((PSD[SDF_GAME_SPEED] == 2) && (t % 2 == 0)))
|
||||
mainPtr.display();
|
||||
sf::sleep(time_in_ticks(2 * (1 + PSD[SDF_GAME_SPEED])));
|
||||
sf::sleep(time_in_ticks(2 * (1 + get_int_pref("GameSpeed"))));
|
||||
}
|
||||
|
||||
// Exit gracefully, and clean up screen
|
||||
@@ -630,9 +631,7 @@ void click_shop_rect(rectangle area_rect) {
|
||||
|
||||
draw_shop_graphics(1,area_rect);
|
||||
mainPtr.display();
|
||||
if(play_sounds)
|
||||
play_sound(37);
|
||||
else sf::sleep(time_in_ticks(5));
|
||||
play_sound(37, time_in_ticks(5));
|
||||
draw_shop_graphics(0,area_rect);
|
||||
|
||||
}
|
||||
@@ -871,8 +870,7 @@ void click_talk_rect(word_rect_t word) {
|
||||
win_draw_string(mainPtr, wordRect, word.word, eTextMode::LEFT_TOP, style);
|
||||
place_talk_face();
|
||||
mainPtr.display();
|
||||
if(play_sounds) play_sound(37);
|
||||
else sf::sleep(time_in_ticks(5));
|
||||
play_sound(37, time_in_ticks(5));
|
||||
rect_draw_some_item(talk_gworld.getTexture(),talkRect,talk_area_rect,ul);
|
||||
place_talk_face();
|
||||
}
|
||||
|
@@ -112,14 +112,11 @@ short store_pc_graphic;
|
||||
static void init_party_scen_data() {
|
||||
short i,j,k,l;
|
||||
bool stored_item = false;
|
||||
short store_help;
|
||||
|
||||
univ.party.age = 0;
|
||||
store_help = PSD[SDF_NO_INSTANT_HELP];
|
||||
for(i = 0; i < 310; i++)
|
||||
for(j = 0; j < 50; j++)
|
||||
PSD[i][j] = 0;
|
||||
PSD[SDF_NO_INSTANT_HELP] = store_help;
|
||||
univ.party.light_level = 0;
|
||||
univ.party.outdoor_corner.x = univ.scenario.out_sec_start.x;
|
||||
univ.party.outdoor_corner.y = univ.scenario.out_sec_start.y;
|
||||
@@ -332,15 +329,7 @@ void put_party_in_scen(std::string scen_name) {
|
||||
|
||||
// Compatibility flags
|
||||
if(univ.scenario.format.prog_make_ver[0] < 2){
|
||||
PSD[SDF_RESURRECT_NO_BALM] = 1;
|
||||
PSD[SDF_NO_BOAT_SPECIALS] = 1;
|
||||
PSD[SDF_COMBAT_SELECT_PARTY] = 1;
|
||||
PSD[SDF_TIMERS_DURING_REST] = 0;
|
||||
} else {
|
||||
PSD[SDF_RESURRECT_NO_BALM] = 0;
|
||||
PSD[SDF_NO_BOAT_SPECIALS] = 0;
|
||||
PSD[SDF_COMBAT_SELECT_PARTY] = 0;
|
||||
PSD[SDF_TIMERS_DURING_REST] = 1;
|
||||
univ.scenario.is_legacy = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1206,7 +1195,7 @@ void do_priest_spell(short pc_num,eSpell spell_num,bool freebie) {
|
||||
sout.str(" Your items glow.");
|
||||
} else {
|
||||
|
||||
if(!PSD[SDF_RESURRECT_NO_BALM]) {
|
||||
if(!univ.scenario.is_legacy) {
|
||||
if((item = univ.party[pc_num].has_abil(eItemAbil::RESURRECTION_BALM)) == 24) {
|
||||
add_string_to_buf(" Need resurrection balm.");
|
||||
break;
|
||||
@@ -2465,7 +2454,7 @@ bool damage_pc(cPlayer& which_pc,short how_much,eDamageType damage_type,eRace ty
|
||||
|
||||
|
||||
if(damage_type != eDamageType::MARKED) {
|
||||
if(PSD[SDF_EASY_MODE] > 0)
|
||||
if(univ.party.easy_mode)
|
||||
how_much -= 3;
|
||||
// toughness
|
||||
if(which_pc.traits[eTrait::TOUGHNESS])
|
||||
|
@@ -212,7 +212,7 @@ bool check_special_terrain(location where_check,eSpecCtx mode,cPlayer& which_pc,
|
||||
if(ter_special == eTerSpec::CALL_SPECIAL) runSpecial = true;
|
||||
if(univ.town->specials[spec_num].type == eSpecType::CANT_ENTER)
|
||||
runSpecial = true;
|
||||
if(!PSD[SDF_NO_BOAT_SPECIALS] && univ.party.in_boat >= 0 && univ.scenario.ter_types[ter].boat_over)
|
||||
if(!univ.scenario.is_legacy && univ.party.in_boat >= 0 && univ.scenario.ter_types[ter].boat_over)
|
||||
runSpecial = true;
|
||||
if(runSpecial) {
|
||||
give_help(54,0);
|
||||
@@ -1559,7 +1559,7 @@ bool damage_monst(cCreature& victim, short who_hit, short how_much, eDamageType
|
||||
}
|
||||
|
||||
if(victim.is_friendly() && who_hit < 7 &&
|
||||
((!processing_fields && !monsters_going) || (processing_fields && !PSD[SDF_HOSTILES_PRESENT]))) {
|
||||
((!processing_fields && !monsters_going) || (processing_fields && !univ.party.hostiles_present))) {
|
||||
add_string_to_buf("Damaged an innocent.");
|
||||
victim.attitude = eAttitude::HOSTILE_A;
|
||||
make_town_hostile();
|
||||
@@ -1976,7 +1976,7 @@ void run_special(eSpecCtx which_mode,short which_type,short start_spec,location
|
||||
case eSpecCtx::DROP_ITEM: case eSpecCtx::SHOPPING: case eSpecCtx::STARTUP:
|
||||
// Default behaviour - select entire party, or active member if split or in combat
|
||||
// We also have a legacy flag - originally, it always defaulted to whole party
|
||||
if(is_combat() && !PSD[SDF_COMBAT_SELECT_PARTY])
|
||||
if(is_combat() && !univ.scenario.is_legacy)
|
||||
current_pc_picked_in_spec_enc = &univ.party[current_pc];
|
||||
else {
|
||||
if(univ.party.is_split() && cur_node.type != eSpecType::AFFECT_DEADNESS)
|
||||
|
@@ -19,11 +19,12 @@
|
||||
#include "boe.menus.hpp"
|
||||
#include "mathutil.hpp"
|
||||
#include "restypes.hpp"
|
||||
#include "prefs.hpp"
|
||||
|
||||
#include <vector>
|
||||
using std::vector;
|
||||
|
||||
extern bool play_sounds,party_in_memory;
|
||||
extern bool party_in_memory;
|
||||
extern long register_flag;
|
||||
extern sf::RenderWindow mainPtr;
|
||||
extern location ul;
|
||||
@@ -47,9 +48,7 @@ bool handle_startup_press(location the_point) {
|
||||
if(the_point.in(startup_button[i])) {
|
||||
draw_start_button(i,5);
|
||||
mainPtr.display(); // TODO: I suspect this won't work
|
||||
if(play_sounds)
|
||||
play_sound(37);
|
||||
else sf::sleep(time_in_ticks(5));
|
||||
play_sound(3, time_in_ticks(5));
|
||||
draw_start_button(i,0);
|
||||
switch(i) {
|
||||
case STARTBTN_LOAD:
|
||||
@@ -131,9 +130,6 @@ bool handle_startup_press(location the_point) {
|
||||
return false;
|
||||
}
|
||||
|
||||
extern short display_mode;
|
||||
extern bool show_startup_splash;
|
||||
|
||||
void handle_splash_events() {
|
||||
extern sf::Event event;
|
||||
if(!mainPtr.pollEvent(event)) return;
|
||||
@@ -145,7 +141,7 @@ void show_logo() {
|
||||
rectangle whole_window,from_rect;
|
||||
rectangle logo_from = {0,0,350,350};
|
||||
|
||||
if(display_mode != 5)
|
||||
if(get_int_pref("DisplayMode") != 5)
|
||||
hideMenuBar();
|
||||
|
||||
whole_window = rectangle(mainPtr);
|
||||
@@ -159,7 +155,7 @@ void show_logo() {
|
||||
draw_splash(pict_to_draw, mainPtr, logo_from);
|
||||
handle_splash_events();
|
||||
}
|
||||
if(!show_startup_splash) {
|
||||
if(!get_int_pref("ShowStartupSplash", true)) {
|
||||
sf::Time delay = time_in_ticks(60);
|
||||
sf::Clock timer;
|
||||
while(timer.getElapsedTime() < delay)
|
||||
|
@@ -59,7 +59,6 @@ extern sf::RenderTexture terrain_screen_gworld;
|
||||
|
||||
// game globals
|
||||
extern location ul;
|
||||
extern bool play_sounds;
|
||||
extern rectangle item_buttons[8][6];
|
||||
// name, use, give, drip, info, sell/id
|
||||
extern rectangle pc_buttons[6][5];
|
||||
@@ -1233,7 +1232,7 @@ void make_cursor_sword() {
|
||||
bool day_reached(unsigned short which_day, unsigned short which_event) {
|
||||
// Windows version unconditionally added 20 days for no reason at all.
|
||||
// Instead, let's add 10 days, but only if easy mode enabled.
|
||||
if(PSD[SDF_EASY_MODE]) which_day += 10;
|
||||
if(univ.party.easy_mode) which_day += 10;
|
||||
if(which_event > 0) {
|
||||
if(univ.party.key_times.find(which_event) == univ.party.key_times.end())
|
||||
return false;
|
||||
|
@@ -249,7 +249,7 @@ void start_town_mode(short which_town, short entry_dir) {
|
||||
else {
|
||||
// First set up the values.
|
||||
cTownperson& preset = univ.town->creatures[i];
|
||||
univ.town.monst.assign(i, preset, univ.scenario.scen_monsters[preset.number], PSD[SDF_EASY_MODE], univ.difficulty_adjust());
|
||||
univ.town.monst.assign(i, preset, univ.scenario.scen_monsters[preset.number], univ.party.easy_mode, univ.difficulty_adjust());
|
||||
|
||||
if(univ.town.monst[i].spec_enc_code > 0)
|
||||
univ.town.monst[i].active = 0;
|
||||
@@ -461,7 +461,7 @@ void start_town_mode(short which_town, short entry_dir) {
|
||||
}
|
||||
|
||||
// No hostile monsters present.
|
||||
PSD[SDF_HOSTILES_PRESENT] = 0;
|
||||
univ.party.hostiles_present = 0;
|
||||
|
||||
add_string_to_buf("Now entering:");
|
||||
add_string_to_buf(" " + univ.town->town_name);
|
||||
|
@@ -130,8 +130,6 @@ void cParty::append(legacy::party_record_type& old){
|
||||
cConvers t;
|
||||
t.append(old.talk_save[i], univ.scenario);
|
||||
talk_save.push_back(t);
|
||||
if(old.help_received[i])
|
||||
help_received.insert(i);
|
||||
}
|
||||
}
|
||||
direction = eDirection(old.direction);
|
||||
@@ -549,6 +547,9 @@ void cParty::writeTo(std::ostream& file) const {
|
||||
file << "GOLD " << gold << '\n';
|
||||
file << "FOOD " << food << '\n';
|
||||
file << "NEXTID " << next_pc_id << '\n';
|
||||
file << "HOSTILES " << int(hostiles_present) << '\n';
|
||||
file << "EASY " << int(easy_mode) << '\n';
|
||||
file << "LESSWM " << int(less_wm) << '\n';
|
||||
for(int i = 0; i < 310; i++)
|
||||
for(int j = 0; j < 50; j++)
|
||||
if(stuff_done[i][j] > 0)
|
||||
@@ -603,8 +604,6 @@ void cParty::writeTo(std::ostream& file) const {
|
||||
file << "EVENT " << key.first << ' ' << key.second << '\n';
|
||||
for(int i : spec_items)
|
||||
file << "ITEM " << i << '\n';
|
||||
for(int i : help_received)
|
||||
file << "HELP " << i << '\n';
|
||||
for(int i = 0; i < 200; i++)
|
||||
if(m_killed[i] > 0)
|
||||
file << "TOWNSLAUGHTER " << i << ' ' << m_killed[i] << '\n';
|
||||
@@ -756,6 +755,18 @@ void cParty::readFrom(std::istream& file){
|
||||
unsigned int n;
|
||||
sin >> i >> j >> n;
|
||||
stuff_done[i][j] = n;
|
||||
} else if(cur == "HOSTILES") {
|
||||
int n;
|
||||
sin >> n;
|
||||
hostiles_present = n;
|
||||
} else if(cur == "EASY") {
|
||||
int n;
|
||||
sin >> n;
|
||||
easy_mode = n;
|
||||
} else if(cur == "LESSWM") {
|
||||
int n;
|
||||
sin >> n;
|
||||
less_wm = n;
|
||||
} else if(cur == "CREATEVERSION") {
|
||||
unsigned long long version;
|
||||
sin >> std::hex >> version >> std::dec;
|
||||
@@ -838,10 +849,6 @@ void cParty::readFrom(std::istream& file){
|
||||
int i;
|
||||
sin >> i;
|
||||
spec_items.insert(i);
|
||||
}else if(cur == "HELP"){
|
||||
int i;
|
||||
sin >> i;
|
||||
help_received.insert(i);
|
||||
}else if(cur == "TOWNSLAUGHTER"){
|
||||
int i;
|
||||
sin >> i;
|
||||
@@ -1112,7 +1119,7 @@ iLiving& cParty::pc_present() const {
|
||||
|
||||
// stuff done legit, i.e. flags are within proper ranges for stuff done flag
|
||||
bool cParty::sd_legit(short a, short b) {
|
||||
if((minmax(0,299,a) == a) && (minmax(0,49,b) == b))
|
||||
if((minmax(0,349,a) == a) && (minmax(0,49,b) == b))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@@ -71,7 +71,11 @@ public:
|
||||
unsigned long age;
|
||||
unsigned short gold;
|
||||
unsigned short food;
|
||||
unsigned char stuff_done[310][50];
|
||||
unsigned char stuff_done[350][50];
|
||||
// These used to be stored as magic SDFs
|
||||
unsigned char hostiles_present;
|
||||
bool easy_mode = false, less_wm = false;
|
||||
// End former magic SDFs
|
||||
std::array<unsigned char,90> magic_ptrs;
|
||||
unsigned char item_taken[200][8];
|
||||
short light_level;
|
||||
@@ -109,7 +113,6 @@ public:
|
||||
std::map<int,int> key_times;
|
||||
std::vector<cTimer> party_event_timers;
|
||||
std::set<int> spec_items;
|
||||
std::set<int> help_received;
|
||||
long m_killed[200]; // monsters killed per town
|
||||
long long total_m_killed, total_dam_done, total_xp_gained, total_dam_taken;
|
||||
std::string scen_name;
|
||||
|
@@ -14,8 +14,7 @@
|
||||
#include "graphtool.hpp"
|
||||
#include "restypes.hpp"
|
||||
#include "mathutil.hpp"
|
||||
|
||||
extern bool play_sounds;
|
||||
#include "prefs.hpp"
|
||||
|
||||
void cControl::setText(std::string l){
|
||||
lbl = l;
|
||||
@@ -210,7 +209,7 @@ bool cControl::handleClick(location){
|
||||
depressed = frame.contains(e.mouseMove.x, e.mouseMove.y);
|
||||
}
|
||||
}
|
||||
if(play_sounds) {
|
||||
if(get_bool_pref("PlaySounds", true)) {
|
||||
if(typeid(this) == typeid(cLed*))
|
||||
play_sound(34);
|
||||
else play_sound(37);
|
||||
|
@@ -23,13 +23,13 @@ using namespace ticpp;
|
||||
#include "winutil.hpp"
|
||||
#include "mathutil.hpp"
|
||||
#include "cursors.hpp"
|
||||
#include "prefs.hpp"
|
||||
|
||||
// TODO: Would be nice if I could avoid depending on mainPtr
|
||||
extern sf::RenderWindow mainPtr;
|
||||
extern cursor_type current_cursor;
|
||||
|
||||
extern sf::Texture bg_gworld;
|
||||
extern bool play_sounds;
|
||||
const short cDialog::BG_DARK = 5, cDialog::BG_LIGHT = 16;
|
||||
short cDialog::defaultBackground = cDialog::BG_DARK;
|
||||
cDialog* cDialog::topWindow = nullptr;
|
||||
@@ -715,7 +715,7 @@ void cDialog::process_keystroke(cKey keyHit){
|
||||
if(iter->second->isVisible() && iter->second->isClickable() && iter->second->getAttachedKey() == keyHit){
|
||||
iter->second->setActive(true);
|
||||
draw();
|
||||
if(play_sounds) {
|
||||
if(get_bool_pref("PlaySounds", true)) {
|
||||
if(typeid(iter->second) == typeid(cLed*))
|
||||
play_sound(34);
|
||||
else play_sound(37);
|
||||
|
@@ -15,7 +15,7 @@
|
||||
extern cUniverse univ;
|
||||
|
||||
extern sf::RenderWindow mainPtr;
|
||||
extern bool play_sounds,party_in_scen,scen_items_loaded;
|
||||
extern bool party_in_scen,scen_items_loaded;
|
||||
extern fs::path file_in_mem;
|
||||
|
||||
extern short store_flags[3];
|
||||
|
@@ -361,11 +361,11 @@ static void give_help(short help1,short help2,cDialog* parent) {
|
||||
help1 -= 200;
|
||||
}
|
||||
// This SDF is the "never show instant help" flag
|
||||
// TODO: Expose preferences to the PC editor
|
||||
#if 0
|
||||
if(univ.party.stuff_done[306][4] > 0 && !help_forced)
|
||||
return;
|
||||
if(univ.party.help_received.count(help1) > 0 && !help_forced)
|
||||
return;
|
||||
univ.party.help_received.insert(help1);
|
||||
#endif
|
||||
str1 = get_str("help",help1);
|
||||
if(help2 > 0)
|
||||
str2 = get_str("help",help2);
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "tinyprint.h"
|
||||
#include "map_parse.hpp"
|
||||
#include "winutil.hpp"
|
||||
#include "choicedlog.hpp"
|
||||
|
||||
#define DONE_BUTTON_ITEM 1
|
||||
|
||||
@@ -960,6 +961,9 @@ void save_scenario(bool rename) {
|
||||
if(toFile.empty()) return;
|
||||
}
|
||||
|
||||
if(scenario.is_legacy && cChoiceDlog("save-legacy-scen", {"update", "cancel"}).show() == "update")
|
||||
scenario.is_legacy = false;
|
||||
|
||||
scenario.reset_version();
|
||||
tarball scen_file;
|
||||
{
|
||||
|
@@ -16,13 +16,13 @@
|
||||
|
||||
#include "restypes.hpp"
|
||||
#include "mathutil.hpp"
|
||||
#include "prefs.hpp"
|
||||
|
||||
std::shared_ptr<sf::Sound> chan[4];
|
||||
const int numchannel = 4;
|
||||
int channel;
|
||||
short snd_played[4];
|
||||
|
||||
bool play_sounds = true;
|
||||
short last_played;
|
||||
std::unordered_set<int> always_async = {
|
||||
6,24,25,34,37,
|
||||
@@ -63,7 +63,7 @@ void init_snd_tool(){
|
||||
atexit(exit_snd_tool);
|
||||
}
|
||||
|
||||
void play_sound(short which, short how_many_times) { // if < 0, play asynch
|
||||
void play_sound(short which, sf::Time delay) { // if < 0, play asynch
|
||||
static bool inited = false;
|
||||
if(!inited) {
|
||||
inited = true;
|
||||
@@ -71,7 +71,11 @@ void play_sound(short which, short how_many_times) { // if < 0, play asynch
|
||||
}
|
||||
|
||||
std::shared_ptr<sf::SoundBuffer> sndhandle;
|
||||
if(!play_sounds || how_many_times == 0) return;
|
||||
if(!get_bool_pref("PlaySounds", true)) {
|
||||
if(which >= 0)
|
||||
sf::sleep(delay);
|
||||
return;
|
||||
}
|
||||
|
||||
if(abs(which) >= 100 && !ResMgr::have<SoundRsrc>(abs(which))) {
|
||||
std::cerr << "Error: Sound #" << abs(which) << " does not exist." << std::endl;
|
||||
@@ -100,8 +104,6 @@ void play_sound(short which, short how_many_times) { // if < 0, play asynch
|
||||
}
|
||||
if(which < 0)
|
||||
sf::sleep(time_in_ticks(sound_delay[-1 * which]));
|
||||
if(how_many_times > 1)
|
||||
play_sound(which, how_many_times - 1);
|
||||
}
|
||||
|
||||
void one_sound(short which) {
|
||||
@@ -115,7 +117,3 @@ void clear_sound_memory(){
|
||||
last_played = 100;
|
||||
}
|
||||
|
||||
void flip_sound() {
|
||||
play_sounds = (play_sounds) ? false : true;
|
||||
}
|
||||
|
||||
|
@@ -14,10 +14,9 @@
|
||||
typedef signed int snd_num_t;
|
||||
void init_snd_tool();
|
||||
bool sound_going(snd_num_t which_s);
|
||||
void play_sound(short which, short how_many_times = 1);
|
||||
void play_sound(short which, sf::Time delay = sf::Time());
|
||||
void one_sound(short which);
|
||||
|
||||
void clear_sound_memory();
|
||||
void flip_sound();
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user