diff --git a/osx/Blades of Exile Char Editor/pc.main.cpp b/osx/Blades of Exile Char Editor/pc.main.cpp index 758f5134..edd4d3ef 100644 --- a/osx/Blades of Exile Char Editor/pc.main.cpp +++ b/osx/Blades of Exile Char Editor/pc.main.cpp @@ -579,7 +579,7 @@ void handle_extra_menu(int item_hit) break; case 4: - if (PSD[SDF_IS_PARTY_SPLIT] > 0) { + if (univ.party.is_split() > 0) { FCD(909,0); break; } @@ -588,14 +588,12 @@ void handle_extra_menu(int item_hit) break; case 5: - if (PSD[SDF_IS_PARTY_SPLIT] == 0) { + if (univ.party.is_split() == 0) { FCD(911,0); break; } FCD(910,0); - univ.town.p_loc.x = PSD[SDF_PARTY_SPLIT_X]; - univ.town.p_loc.y = PSD[SDF_PARTY_SPLIT_Y]; - PSD[SDF_IS_PARTY_SPLIT] = 0; + univ.town.p_loc = univ.party.left_at(); for (i = 0; i < 6; i++) if (univ.party[i].main_status >= MAIN_STATUS_SPLIT) univ.party[i].main_status -= MAIN_STATUS_SPLIT; @@ -647,7 +645,6 @@ void handle_extra_menu(int item_hit) if (FCD(912,0) != 1) break; remove_party_from_scen(); - PSD[SDF_IS_PARTY_SPLIT] = 0; break; } redraw_screen(); diff --git a/osx/boe.actions.cpp b/osx/boe.actions.cpp index 64aacffa..dff346f1 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -320,7 +320,7 @@ bool handle_action(EventRecord event) the_point = event.where; the_point.h -= ul.h; the_point.v -= ul.v; - for (i = 0; i < 20; i++) + for (i = 0; i < 20; i++) // TODO: Does this cause problems by leaving some specials uncalled? special_queue[i].spec = -1; end_scenario = false; @@ -1298,10 +1298,14 @@ bool handle_action(EventRecord event) // At this point, see if any specials have been queued up, and deal with them for (i = 0; i < 20; i++) if (special_queue[i].spec >= 0) { + long long store_time = univ.party.age; + univ.party.age = special_queue[i].trigger_time; s3 = 0; run_special(special_queue[i].mode,special_queue[i].type,special_queue[i].spec, special_queue[i].where,&s1,&s2,&s3); special_queue[i].spec = -1; + long long change_time = univ.party.age - special_queue[i].trigger_time; + univ.party.age = store_time + change_time; if (s3 > 0) draw_terrain(); } @@ -1412,22 +1416,24 @@ bool handle_action(EventRecord event) } } - if (PSD[SDF_IS_PARTY_SPLIT] > 0) { - end_split(0); + if (univ.party.is_split()) { + ASB(univ.party.end_split(0)); + update_explored(univ.town.p_loc); + center = univ.town.p_loc; if (is_combat()) { overall_mode = MODE_TOWN; - } - else if (is_town()) { - - } - center = univ.town.p_loc; } + else if (is_town()) { + + } + center = univ.town.p_loc; + } menu_activate(1); draw_terrain(); put_pc_screen(); put_item_screen(stat_window,0); if (party_toast() == true) { - play_sound(13); + play_sound(13); handle_death(); if (All_Done == true) return true; @@ -1751,7 +1757,6 @@ bool handle_keystroke(char chr,char chr2,EventRecord event){ case 'B': if(!in_scen_debug) break; - PSD[SDF_IS_PARTY_SPLIT] = 0; for(i=0;i<6;i++) if(univ.party[i].main_status >= MAIN_STATUS_SPLIT) univ.party[i].main_status -= MAIN_STATUS_SPLIT; @@ -1934,6 +1939,10 @@ bool handle_keystroke(char chr,char chr2,EventRecord event){ int x = atoi(response); if(x < 256 && x >= 0) PSD[i][j] = x; + else if(x == -1){ + sout << "SDF(" << i << ',' << j << ") = " << PSD[i][j]; + add_string_to_buf(sout.str()); + } } } break; @@ -2876,14 +2885,6 @@ bool outd_move_party(location destination,bool forced) add_string_to_buf("Land before mounting horses."); return false; } - if (scenario.ter_types[ter].special == TER_SPEC_DAMAGING) { - ASB("Your horses quite sensibly refuse."); - return false; - } - if (scenario.ter_types[ter].special == TER_SPEC_DANGEROUS) { - ASB("Your horses quite sensibly refuse."); - return false; - } give_help(60,0,0); add_string_to_buf("Move: You mount the horses. "); @@ -2906,6 +2907,10 @@ bool outd_move_party(location destination,bool forced) // Check if can fly over || ((flying() == true) && (scenario.ter_types[ter].fly_over == true)) ) { + if (scenario.ter_types[ter].special == TER_SPEC_DAMAGING || scenario.ter_types[ter].special == TER_SPEC_DANGEROUS) { + ASB("Your horses quite sensibly refuse."); + return false; + } univ.party.direction = set_direction(univ.party.p_loc, destination); if ((flying() == true) && (scenario.ter_types[ter].special == TER_SPEC_TOWN_ENTRANCE)) { diff --git a/osx/boe.combat.cpp b/osx/boe.combat.cpp index 37962b45..a523085a 100644 --- a/osx/boe.combat.cpp +++ b/osx/boe.combat.cpp @@ -498,7 +498,7 @@ bool pc_combat_move(location destination) //// draw_terrain(0); } if (s1 != current_pc) - return false; + return true; } // move if still alive @@ -3953,7 +3953,7 @@ void handle_disease() r1 = get_ran(1,0,7); if (univ.party[i].traits[6] == true) r1 -= 2; - if ((get_ran(1,0,7) <= 0) || (pc_has_abil_equip(i,67) < 24)) + if ((get_ran(1,0,7) <= 0) || (pc_has_abil_equip(i,ITEM_PROTECT_FROM_DISEASE) < 24)) univ.party[i].status[7] = move_to_zero(univ.party[i].status[7]); } put_pc_screen(); diff --git a/osx/boe.consts.h b/osx/boe.consts.h index 5c0afb99..ca9e1a6b 100644 --- a/osx/boe.consts.h +++ b/osx/boe.consts.h @@ -32,11 +32,11 @@ #define SFX_RUBBLE 128 /* stuff done flags */ -#define SDF_IS_PARTY_SPLIT 304][0 -#define SDF_PARTY_SPLIT_X 304][1 -#define SDF_PARTY_SPLIT_Y 304][2 -#define SDF_PARTY_SPLIT_PC 304][3 -#define SDF_PARTY_SPLIT_TOWN 304][4 // for future use, hopefully +//#define SDF_IS_PARTY_SPLIT 304][0 +//#define SDF_PARTY_SPLIT_X 304][1 +//#define SDF_PARTY_SPLIT_Y 304][2 +//#define SDF_PARTY_SPLIT_PC 304][3 +//#define SDF_PARTY_SPLIT_TOWN 304][4 // for future use, hopefully #define SDF_PARTY_STEALTHY 305][0 #define SDF_PARTY_FLIGHT 305][1 #define SDF_PARTY_DETECT_LIFE 305][2 diff --git a/osx/boe.dlgutil.cpp b/osx/boe.dlgutil.cpp index bb1b0b8a..a410e094 100644 --- a/osx/boe.dlgutil.cpp +++ b/osx/boe.dlgutil.cpp @@ -666,16 +666,22 @@ void handle_talk_event(Point p) asked[3] = place_string1[3]; } - if ((asked[0] == 'n') && (asked[1] == 'a') &&(asked[2] == 'm') &&(asked[3] == 'a')) { + if ((asked[0] == 'n') && (asked[1] == 'a') &&(asked[2] == 'm') &&(asked[3] == 'e')) { force_special = 2; } - if ((asked[0] == 'l') && (asked[1] == 'o') &&(asked[2] == 'o') &&(asked[3] == 'k')) { + else if ((asked[0] == 'l') && (asked[1] == 'o') &&(asked[2] == 'o') &&(asked[3] == 'k')) { force_special = 1; - } - if (((asked[0] == 'j') && (asked[1] == 'o') &&(asked[2] == 'b')) || + } + else if (((asked[0] == 'j') && (asked[1] == 'o') &&(asked[2] == 'b')) || ((asked[0] == 'w') && (asked[1] == 'o') &&(asked[2] == 'r')&&(asked[3] == 'k')) ) { - force_special = 3; - } + force_special = 3; + } + else if (((asked[0] == 'b') && (asked[1] == 'u') &&(asked[2] == 'y'))) { + force_special = 3; + } + else if (((asked[0] == 'b') && (asked[1] == 'y') &&(asked[2] == 'e'))) { + end_talk_mode(); + } if (force_special > 0) { switch (force_special) { diff --git a/osx/boe.graphics.cpp b/osx/boe.graphics.cpp index 72f60f31..c46c9c21 100644 --- a/osx/boe.graphics.cpp +++ b/osx/boe.graphics.cpp @@ -1350,7 +1350,7 @@ void draw_terrain(short mode) draw_one_terrain_spot(q,r,-1); } - if ((can_draw != 0) && (overall_mode != MODE_RESTING) && frills_on && (draw_frills)) + if ((can_draw != 0) && (overall_mode != MODE_RESTING) && frills_on && draw_frills) place_trim((short) q,(short) r,where_draw,spec_terrain); // if((is_town() && univ.town.is_spot(where_draw.x,where_draw.y)) || // (is_out() && univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].special_spot[where_draw.x][where_draw.y])) diff --git a/osx/boe.graphutil.cpp b/osx/boe.graphutil.cpp index c60867f9..1ac5289e 100644 --- a/osx/boe.graphutil.cpp +++ b/osx/boe.graphutil.cpp @@ -325,6 +325,7 @@ void play_see_monster_str(unsigned short m){ special_queue[i].spec = spec; special_queue[i].mode = SPEC_SEE_MONST; special_queue[i].type = 0; + special_queue[i].trigger_time = univ.party.age; special_queue[i].where = loc(); // TODO: Maybe a different location should be passed? break; } diff --git a/osx/boe.items.cpp b/osx/boe.items.cpp index b61e35b4..1e5ab58e 100644 --- a/osx/boe.items.cpp +++ b/osx/boe.items.cpp @@ -651,11 +651,11 @@ void destroy_an_item() { short i; ASB("Too many items. Some item destroyed."); - for (i = 0; i < NUM_TOWN_ITEMS; i++) - if (univ.town.items[i].type_flag == 15) { - univ.town.items[i].variety = ITEM_TYPE_NO_ITEM; - return; - } +// for (i = 0; i < NUM_TOWN_ITEMS; i++) +// if (univ.town.items[i].type_flag == 15) { +// univ.town.items[i].variety = ITEM_TYPE_NO_ITEM; +// return; +// } for (i = 0; i < NUM_TOWN_ITEMS; i++) if (univ.town.items[i].value < 3) { univ.town.items[i].variety = ITEM_TYPE_NO_ITEM; diff --git a/osx/boe.monster.cpp b/osx/boe.monster.cpp index 5a6fe2c7..591f52f9 100644 --- a/osx/boe.monster.cpp +++ b/osx/boe.monster.cpp @@ -1138,8 +1138,10 @@ void magic_adjust(cCreature *which_m,short *how_much) { if (which_m->spec_skill == 26) { *how_much = 0; - which_m->health += 3; - } + if(32767 - which_m->health > 3) + which_m->health = 32767; + else which_m->health += 3; + } if (which_m->immunities & 1) *how_much = *how_much / 2; if (which_m->immunities & 2) diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index 09b1b4a3..9a30bfd7 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -3194,7 +3194,7 @@ void hit_party(short how_much,eDamageType damage_type) bool dummy; for (i = 0; i < 6; i++) - if (univ.party[i].main_status == 1) + if (univ.party[i].main_status == MAIN_STATUS_ALIVE) dummy = damage_pc(i,how_much,damage_type,MONSTER_TYPE_UNKNOWN,0); // dummy = damage_pc(i,how_much,damage_type + 30); put_pc_screen(); diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index 524f01c6..a0947085 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -1496,16 +1496,18 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s // Absorb damage? if (((dam_type == 1) || (dam_type == 3) || (dam_type == 5)) && (victim->spec_skill == 26)) { - victim->health += how_much; + if(32767 - victim->health > how_much) + victim->health = 32767; + else victim->health += how_much; ASB(" Magic absorbed."); return false; } // Saving throw if (((dam_type == 1) || (dam_type == 5)) && (get_ran(1,0,20) <= victim->level)) - how_much = how_much / 2; + how_much /= 2; if ((dam_type == 3) && (get_ran(1,0,24) <= victim->level)) - how_much = how_much / 2; + how_much /= 2; // Rentar-Ihrno? if (victim->spec_skill == 36) @@ -2352,14 +2354,16 @@ void affect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, short *next_spec,short *next_spec_type,short *a,short *b,short *redraw) { bool check_mess = true; - short i,pc,r1; + short i,pc = 6,r1; cSpecial spec; spec = cur_node; *next_spec = cur_node.jumpto; - if(PSD[SDF_IS_PARTY_SPLIT] && cur_node.type != SPEC_AFFECT_DEADNESS) - pc = PSD[SDF_PARTY_SPLIT_PC]; - else pc = current_pc_picked_in_spec_enc; + if(univ.party.is_split() && cur_node.type != SPEC_AFFECT_DEADNESS) + pc = univ.party.pc_present(); + if(pc == 6 && univ.party.pc_present(current_pc_picked_in_spec_enc)) + pc = current_pc_picked_in_spec_enc; + if(pc == 6) pc = -1; switch (cur_node.type) { case SPEC_SELECT_PC: @@ -3057,7 +3061,7 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type, check_mess = false; break; } - if (PSD[SDF_IS_PARTY_SPLIT] > 0) { + if (univ.party.is_split() > 0) { ASB("Party is already split."); if (which_mode < 3) *a = 1; @@ -3069,9 +3073,11 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type, if (which_mode < 3) *a = 1; if (r1 != 6) { - PSD[SDF_PARTY_SPLIT_PC] = r1; + current_pc = r1; *next_spec = -1; - start_split(spec.ex1a,spec.ex1b,spec.ex2a); + ASB(univ.party.start_split(spec.ex1a,spec.ex1b,spec.ex2a,r1)); + update_explored(univ.town.p_loc); + center = univ.town.p_loc; } else check_mess = false; break; @@ -3084,7 +3090,9 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type, *a = 1; *next_spec = -1; check_mess = false; - end_split(spec.ex1a); + ASB(univ.party.end_split(spec.ex1a)); + update_explored(univ.town.p_loc); + center = univ.town.p_loc; break; case SPEC_TOWN_TIMER_START: univ.party.start_timer(spec.ex1a, spec.ex1b, 1); diff --git a/osx/boe.text.cpp b/osx/boe.text.cpp index ecc52da8..f8142150 100644 --- a/osx/boe.text.cpp +++ b/osx/boe.text.cpp @@ -1278,7 +1278,9 @@ void add_string_to_buf(std::string str) { if (in_startup_mode == true) return; - + + if(str == "") return; + SetControlValue(text_sbar,58); if (buf_pointer == mark_where_printing_long) { printing_long = true; diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index 2e260e79..83358b79 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -747,6 +747,7 @@ void handle_town_specials(short town_number, short entry_dir,location start_loc) special_queue[0].where = univ.town.p_loc; special_queue[0].type = 2; special_queue[0].mode = SPEC_ENTER_TOWN; + special_queue[0].trigger_time = univ.party.age; // TODO: Simply pushing into slot 0 seems like a bad idea } void handle_leave_town_specials(short town_number, short which_spec,location start_loc) @@ -757,6 +758,7 @@ void handle_leave_town_specials(short town_number, short which_spec,location sta special_queue[1].where = univ.party.p_loc; special_queue[1].type = 2; special_queue[1].mode = SPEC_LEAVE_TOWN; + special_queue[1].trigger_time = univ.party.age; // TODO: Simply pushing into slot 1 seems like a bad idea } bool abil_exists(short abil) // use when univ.out.outdoors diff --git a/osx/boe.townspec.cpp b/osx/boe.townspec.cpp index e3228143..402c400d 100644 --- a/osx/boe.townspec.cpp +++ b/osx/boe.townspec.cpp @@ -273,48 +273,6 @@ location get_spec_loc(short which) return where; } - -void start_split(short a,short b,short noise) -{ - short i; - - PSD[SDF_IS_PARTY_SPLIT] = 1; - PSD[SDF_PARTY_SPLIT_X] = univ.town.p_loc.x; - PSD[SDF_PARTY_SPLIT_Y] = univ.town.p_loc.y; - PSD[SDF_PARTY_SPLIT_TOWN] = univ.town.num; - univ.town.p_loc.x = a; - univ.town.p_loc.y = b; - for (i = 0; i < 6; i++) - if (i != PSD[SDF_PARTY_SPLIT_PC]) - univ.party[i].main_status += MAIN_STATUS_SPLIT; - current_pc = PSD[SDF_PARTY_SPLIT_PC]; - update_explored(univ.town.p_loc); - center = univ.town.p_loc; - if (noise > 0) - play_sound(10); -} - -void end_split(short noise) -{ - short i; - - if (PSD[SDF_IS_PARTY_SPLIT] == 0) { - ASB("Party already together!"); - return; - } - univ.town.p_loc.x = PSD[SDF_PARTY_SPLIT_X]; - univ.town.p_loc.y = PSD[SDF_PARTY_SPLIT_Y]; - PSD[SDF_IS_PARTY_SPLIT] = 0; - for (i = 0; i < 6; i++) - if (univ.party[i].main_status >= MAIN_STATUS_SPLIT) - univ.party[i].main_status -= MAIN_STATUS_SPLIT; - update_explored(univ.town.p_loc); - center = univ.town.p_loc; - if (noise > 0) - play_sound(10); - add_string_to_buf("You are reunited."); -} - // 0 if no pull. // 1 if pull // levers should always start to left. diff --git a/osx/boe.townspec.h b/osx/boe.townspec.h index f1c255cc..682eec0c 100644 --- a/osx/boe.townspec.h +++ b/osx/boe.townspec.h @@ -6,7 +6,7 @@ bool GFI(short dialog_num); bool run_trap(short pc_num,eTrapType trap_type,short trap_level,short diff); location get_spec_loc(short which); -void start_split(short a,short b,short noise) ; -void end_split(short noise) ; +//void start_split(short a,short b,short noise) ; +//void end_split(short noise) ; void switch_lever(location w); short handle_lever(location w); diff --git a/osx/classes/item.h b/osx/classes/item.h index 6759f1c7..b9c5e9f3 100644 --- a/osx/classes/item.h +++ b/osx/classes/item.h @@ -28,7 +28,7 @@ public: unsigned short graphic_num; eItemAbil ability; unsigned char ability_strength; - unsigned char type_flag; + unsigned short type_flag; unsigned char is_special; short value; unsigned char weight; diff --git a/osx/classes/party.cpp b/osx/classes/party.cpp index 4bddf341..a690d179 100644 --- a/osx/classes/party.cpp +++ b/osx/classes/party.cpp @@ -484,3 +484,73 @@ unsigned char cParty::get_ptr(short p){ if(iter == pointers.end()) return 0; return stuff_done[iter->second.first][iter->second.second]; } + +bool cParty::is_split(){ + bool ret = false; + for(int i = 0; i < 6; i++) + if(!stuff_done[304][i]) + ret = true; + return ret; +} + +bool cParty::pc_present(short i){ + if(i >= 6 || i < 0) return false; + return stuff_done[304][i]; +} + +location cParty::left_at(){ + return loc(stuff_done[304][6],stuff_done[304][7]); +} + +size_t cParty::left_in(){ + return stuff_done[304][8]; +} +extern cUniverse univ; +std::string cParty::start_split(short a,short b,snd_num_t noise,short who) { + short i; + + if(who >= 6 || who < 0) return ""; + if(is_split()) + return "Party already split!"; + stuff_done[304][who] = 0; + stuff_done[304][6] = univ.town.p_loc.x; + stuff_done[304][7] = univ.town.p_loc.y; + stuff_done[304][8] = univ.town.num; + univ.town.p_loc.x = a; + univ.town.p_loc.y = b; + for (i = 0; i < 6; i++) + if (!stuff_done[304][who]) + adven[i].main_status += MAIN_STATUS_SPLIT; + if (noise > 0) + play_sound(10); + return ""; +} + +std::string cParty::end_split(snd_num_t noise) { + short i; + + if (!is_split()) + return "Party already together!"; + univ.town.p_loc = left_at(); + univ.town.num = left_in(); + for (i = 0; i < 6; i++){ + if (univ.party[i].main_status >= MAIN_STATUS_SPLIT) + univ.party[i].main_status -= MAIN_STATUS_SPLIT; + stuff_done[304][i] = true; + } + if (noise > 0) + play_sound(10); + return "You are reunited."; +} + +short cParty::pc_present(){ + short ret = 7; + for(int i = 0; i < 6; i++){ + if(stuff_done[304][i] && ret == 7) + ret = i; + else if(stuff_done[304][i] && ret < 6) + ret = 6; + } + if(ret == 7) ret = 6; + return ret; +} diff --git a/osx/classes/party.h b/osx/classes/party.h index ddf7c6cf..61252778 100644 --- a/osx/classes/party.h +++ b/osx/classes/party.h @@ -122,6 +122,14 @@ public: void writeTo(std::ostream& file); void readFrom(std::istream& file); + std::string start_split(short a, short b, snd_num_t noise, short who); + std::string end_split(snd_num_t noise); + bool is_split(); + bool pc_present(short n); + short pc_present(); // If only one pc is present, returns the number of that pc. Otherwise returns 6. + location left_at(); // The location that the left-behind character in a split were left at. + size_t left_in(); // The town they were left in. + typedef std::vector::iterator encIter; typedef std::vector::iterator journalIter; typedef std::vector::iterator talkIter; diff --git a/osx/classes/pc.h b/osx/classes/pc.h index 3ff2de63..d8d7185e 100644 --- a/osx/classes/pc.h +++ b/osx/classes/pc.h @@ -14,27 +14,6 @@ namespace legacy { struct pc_record_type; }; -enum eMainStatus { - MAIN_STATUS_ABSENT = 0, // absent, empty slot - MAIN_STATUS_ALIVE = 1, - MAIN_STATUS_DEAD = 2, - MAIN_STATUS_DUST = 3, - MAIN_STATUS_STONE = 4, - MAIN_STATUS_FLED = 5, - MAIN_STATUS_SURFACE = 6, // fled to surface? - MAIN_STATUS_WON = 7, - MAIN_STATUS_SPLIT = 10, - // The rest are not really necessary, but are here for completeness so that all valid values have a name. - MAIN_STATUS_SPLIT_ABSENT = MAIN_STATUS_SPLIT + MAIN_STATUS_ABSENT, - MAIN_STATUS_SPLIT_ALIVE = MAIN_STATUS_SPLIT + MAIN_STATUS_ALIVE, - MAIN_STATUS_SPLIT_DEAD = MAIN_STATUS_SPLIT + MAIN_STATUS_DEAD, - MAIN_STATUS_SPLIT_DUST = MAIN_STATUS_SPLIT + MAIN_STATUS_DUST, - MAIN_STATUS_SPLIT_STONE = MAIN_STATUS_SPLIT + MAIN_STATUS_STONE, - MAIN_STATUS_SPLIT_FLED = MAIN_STATUS_SPLIT + MAIN_STATUS_FLED, - MAIN_STATUS_SPLIT_SURFACE = MAIN_STATUS_SPLIT + MAIN_STATUS_SURFACE, - MAIN_STATUS_SPLIT_WON = MAIN_STATUS_SPLIT + MAIN_STATUS_WON, -}; - class cPlayer { public: eMainStatus main_status; diff --git a/osx/classes/scenario.cpp b/osx/classes/scenario.cpp index e9678585..c47e4449 100644 --- a/osx/classes/scenario.cpp +++ b/osx/classes/scenario.cpp @@ -92,6 +92,7 @@ cScenario& cScenario::operator = (legacy::scenario_data_type& old){ last_out_edited.x = old.last_out_edited.x; last_out_edited.y = old.last_out_edited.y; last_town_edited = old.last_town_edited; + adjust_diff = true; return *this; } diff --git a/osx/classes/scenario.h b/osx/classes/scenario.h index b8ce151d..89ea2234 100644 --- a/osx/classes/scenario.h +++ b/osx/classes/scenario.h @@ -88,6 +88,8 @@ public: char spec_item_strs[50][256]; char spec_strs[100][256]; char monst_strs[100][256]; + bool adjust_diff : 1; + char : 7; FSSpec scen_file; // transient cOutdoors* outdoors; cTown* towns; diff --git a/osx/classes/simpletypes.h b/osx/classes/simpletypes.h index 55852625..43d1749e 100644 --- a/osx/classes/simpletypes.h +++ b/osx/classes/simpletypes.h @@ -12,6 +12,27 @@ typedef signed short spec_num_t; typedef signed short item_num_t; typedef unsigned short str_num_t; +enum eMainStatus { + MAIN_STATUS_ABSENT = 0, // absent, empty slot + MAIN_STATUS_ALIVE = 1, + MAIN_STATUS_DEAD = 2, + MAIN_STATUS_DUST = 3, + MAIN_STATUS_STONE = 4, + MAIN_STATUS_FLED = 5, + MAIN_STATUS_SURFACE = 6, // fled to surface? + MAIN_STATUS_WON = 7, + MAIN_STATUS_SPLIT = 10, + // The rest are not really necessary, but are here for completeness so that all valid values have a name. + MAIN_STATUS_SPLIT_ABSENT = MAIN_STATUS_SPLIT + MAIN_STATUS_ABSENT, + MAIN_STATUS_SPLIT_ALIVE = MAIN_STATUS_SPLIT + MAIN_STATUS_ALIVE, + MAIN_STATUS_SPLIT_DEAD = MAIN_STATUS_SPLIT + MAIN_STATUS_DEAD, + MAIN_STATUS_SPLIT_DUST = MAIN_STATUS_SPLIT + MAIN_STATUS_DUST, + MAIN_STATUS_SPLIT_STONE = MAIN_STATUS_SPLIT + MAIN_STATUS_STONE, + MAIN_STATUS_SPLIT_FLED = MAIN_STATUS_SPLIT + MAIN_STATUS_FLED, + MAIN_STATUS_SPLIT_SURFACE = MAIN_STATUS_SPLIT + MAIN_STATUS_SURFACE, + MAIN_STATUS_SPLIT_WON = MAIN_STATUS_SPLIT + MAIN_STATUS_WON, +}; + /* adven[i].race */ //complete enum eRace { RACE_UNKNOWN = -1, // for parameters to some functions; not valid in the class diff --git a/osx/classes/special.h b/osx/classes/special.h index 2d26b43b..531d064e 100644 --- a/osx/classes/special.h +++ b/osx/classes/special.h @@ -37,6 +37,7 @@ struct pending_special_type { eSpecContext mode; unsigned char type; // 0 - scen, 1 - out, 2 - town location where; + long long trigger_time; }; #endif \ No newline at end of file diff --git a/osx/classes/terrain.cpp b/osx/classes/terrain.cpp index f420b2a5..5699643f 100644 --- a/osx/classes/terrain.cpp +++ b/osx/classes/terrain.cpp @@ -17,7 +17,7 @@ #include "boe.consts.h" // TODO: Put these constants in a global file cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){ - static const short arenas[260] = { + static const short arenas[274] = { 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, // 0 - grassy field 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, // 1 - ordinary cave 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 2 - mountain @@ -26,7 +26,7 @@ cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* 50 */ // 5 - rubble-strewn cave 0, 3, 3, 3, 3, 3, 3, 5, 5, 5, // 6 - cave tree forest 6, 6, 7, 7, 1, 1, 8, 9, 10,11, // 7 - cave mushrooms - 10,11,12,13,13,9, 9, 9, 1, 1, // 8 - cave swamp + 11,11,12,13,13,9, 9, 9, 1, 1, // 8 - cave swamp 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 - surface rocks 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 100 */ // 10 - surface swamp 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 11 - surface woods @@ -38,12 +38,14 @@ cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 17 - surface road (proposed) 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, // 18 - hills road (proposed) 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, // 19 - crops (proposed) - 0, 0, 1, 0, 2, 0, 0, 1, 1, 1,/* 200 */ // (note: fumaroles would have lava.) - 1, 0, 2, 1, 1, 0, 1, 1, 1, 1, // the numbers in this array are indices into the other arrays - 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, // (ter_base, ground_type, and terrain_odds first index) - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /* 250 */ + 0, 0, 1, 0, 2, 0, 0, 1, 1, 1,/* 200 */ // 20 - cave camp (proposed) + 1, 0, 2, 1, 1, 1, 0, 1, 1, 1, // 21 - surface camp (proposed) + 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, // (note: fumaroles would have lava.) + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // the numbers in this array are indices into the other arrays + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // (ter_base, ground_type, and terrain_odds first index) + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 250 */ + 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1 }; static const short ground[274] = { 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, @@ -95,17 +97,18 @@ cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){ }; picture = old.picture; blockage = old.blockage; - if(picture >= 260) combat_arena = 1; - else combat_arena = arenas[picture]; if(picture < 260){ + combat_arena = arenas[picture]; ground_type = ground[picture]; trim_type = (eTrimType) trims[picture]; trim_ter = trim_ters[picture]; }else if(picture >= 400 && picture < 1000){ + combat_arena = arenas[picture - 140]; ground_type = ground[picture - 140]; trim_type = (eTrimType) trims[picture - 140]; trim_ter = trim_ters[picture - 140]; }else{ + combat_arena = 1; ground_type = 255; trim_type = TRIM_NONE; trim_ter = 0; diff --git a/osx/classes/universe.cpp b/osx/classes/universe.cpp index 53ea34ce..b905b346 100644 --- a/osx/classes/universe.cpp +++ b/osx/classes/universe.cpp @@ -814,6 +814,8 @@ short cUniverse::difficulty_adjust() { short party_level = 0; short adj = 1; + if(!scenario.adjust_diff) return 1; + for (short i = 0; i < 6; i++) if (party[i].main_status == 1) party_level += party[i].level;