diff --git a/osx/Scenario Editor/Blades of Exile Graphics b/osx/Scenario Editor/Blades of Exile Graphics index 805ef13e..c704dd52 100644 Binary files a/osx/Scenario Editor/Blades of Exile Graphics and b/osx/Scenario Editor/Blades of Exile Graphics differ diff --git a/osx/boe.actions.cpp b/osx/boe.actions.cpp index 7141619e..ad861462 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -1395,7 +1395,7 @@ bool handle_action(EventRecord event) in_startup_mode = true; draw_startup(0); menu_activate(1); - strcpy((char*)univ.party.scen_name,".exs"); // should be harmless... + univ.party.scen_name = ".exs"; // should be harmless... if (FCD(901,0) == 2){ FSSpec* file = nav_put_party(); save_party(*file); diff --git a/osx/boe.combat.cpp b/osx/boe.combat.cpp index 8a9f81ba..7dc4ebf4 100644 --- a/osx/boe.combat.cpp +++ b/osx/boe.combat.cpp @@ -1539,7 +1539,10 @@ void fire_missile(location target) { poison_amt++; poison_monst(cur_monst,poison_amt); } - + } + else if((targ_monst = pc_there(target)) < 6 && ADVEN[current_pc].items[ammo_inv_slot].ability == 176){ + ASB(" There is a flash of light."); + heal_pc(targ_monst,r2); } else hit_space(target,r2,DAMAGE_WEAPON,1,0); diff --git a/osx/boe.dlgutil.cpp b/osx/boe.dlgutil.cpp index b41cd6e3..dd037ce3 100644 --- a/osx/boe.dlgutil.cpp +++ b/osx/boe.dlgutil.cpp @@ -627,29 +627,20 @@ void handle_talk_event(Point p) SysBeep(20); return; } - for (j = 0; j < 120; j++) - if ((univ.party.talk_save[j].personality == store_personality) && - (univ.party.talk_save[j].str1 == strnum1) && - (univ.party.talk_save[j].str2 == strnum2)) { - ASB("This is already saved."); - print_buf(); - return; - } - for (j = 0; j < 120; j++) - if (univ.party.talk_save[j].personality <= 0) { - give_help(57,0,0); - play_sound(0); - univ.party.talk_save[j].personality = store_personality; - univ.party.talk_save[j].town_num = (unsigned char) univ.town.num; - univ.party.talk_save[j].str1 = strnum1; - univ.party.talk_save[j].str2 = strnum2; + if(univ.party.has_talk_save(store_personality, strnum1, strnum2)){ + ASB("This is already saved."); + print_buf(); + return; + } else { + give_help(57,0,0); + play_sound(0); + bool success = univ.party.save_talk(store_personality,univ.town.num,strnum1,strnum2); + if(success){ ASB("Noted in journal."); - j = 200; - } - if (j < 200) { - SysBeep(20); - ASB("No more room in talking journal."); - } + } else { + ASB("No more room in talking journal."); + } + } print_buf(); return; break; diff --git a/osx/boe.infodlg.cpp b/osx/boe.infodlg.cpp index 6a5207ca..8897ffe5 100644 --- a/osx/boe.infodlg.cpp +++ b/osx/boe.infodlg.cpp @@ -967,39 +967,43 @@ void adventure_notes_event_filter (short item_hit) break; case 10: case 9: case 11: - univ.party.special_notes_str[(store_page_on * 3) + item_hit - 9][0] = -1; + short which_to_delete = (store_page_on * 3) + item_hit - 9; + cParty::encIter iter = univ.party.special_notes.begin(); + iter += which_to_delete; + univ.party.special_notes.erase(iter); + //univ.party.special_notes_str[(store_page_on * 3) + item_hit - 9][0] = -1; break; } for (i = 0; i < 3; i++) { - if (univ.party.special_notes_str[i][0] > 0) { - switch (univ.party.special_notes_str[i][0] / 1000) { + if (univ.party.special_notes.size() > i) { + switch (univ.party.special_notes[i].str_num / 1000) { case 0: - strcpy((char *) place_str,scenario.scen_strs(univ.party.special_notes_str[i][0] % 1000)); break; + strcpy((char *) place_str,scenario.scen_strs(univ.party.special_notes[i].str_num % 1000)); break; case 1: - load_outdoor_str(loc(univ.party.special_notes_str[i][1] % scenario.out_width, - univ.party.special_notes_str[i][1] / scenario.out_width),univ.party.special_notes_str[i][0] % 1000,(char *)place_str); + load_outdoor_str(loc(univ.party.special_notes[i].where % scenario.out_width, + univ.party.special_notes[i].where / scenario.out_width),univ.party.special_notes[i].str_num % 1000,(char *)place_str); break; case 2: - load_town_str(univ.party.special_notes_str[i][1],univ.party.special_notes_str[i][0],(char *)place_str); break; + load_town_str(univ.party.special_notes[i].where,univ.party.special_notes[i].str_num,(char *)place_str); break; } - get_str(place_str,univ.party.special_notes_str[i][0],univ.party.special_notes_str[i][1]); + get_str(place_str,univ.party.special_notes[i].str_num,univ.party.special_notes[i].where); csit(961,3 + i,(char *) place_str); cd_activate_item(961,9 + i,1); } else cd_activate_item(961,9 + i,0); } for (i = store_page_on * 3; i < (store_page_on * 3) + 3; i++) { - if (univ.party.special_notes_str[i][0] > 0) { - switch (univ.party.special_notes_str[i][0] / 1000) { + if (univ.party.special_notes.size() > i) { + switch (univ.party.special_notes[i].str_num / 1000) { case 0: - strcpy((char *) place_str,scenario.scen_strs(univ.party.special_notes_str[i][0] % 1000)); break; + strcpy((char *) place_str,scenario.scen_strs(univ.party.special_notes[i].str_num % 1000)); break; case 1: - load_outdoor_str(loc(univ.party.special_notes_str[i][1] % scenario.out_width, - univ.party.special_notes_str[i][1] / scenario.out_width), univ.party.special_notes_str[i][0] % 1000,(char *)place_str); + load_outdoor_str(loc(univ.party.special_notes[i].where % scenario.out_width, + univ.party.special_notes[i].where / scenario.out_width), univ.party.special_notes[i].str_num % 1000,(char *)place_str); break; case 2: - load_town_str(univ.party.special_notes_str[i][1],univ.party.special_notes_str[i][0] % 1000,(char *)place_str); break; + load_town_str(univ.party.special_notes[i].where,univ.party.special_notes[i].str_num % 1000,(char *)place_str); break; } @@ -1020,9 +1024,9 @@ void adventure_notes() Str255 place_str; store_num_i = 0; - for (i = 0; i < 140; i++) - if (univ.party.special_notes_str[i][0] > 0) - store_num_i = i + 1; + //for (i = 0; i < 140; i++) + //if (univ.party.special_notes_str[i][0] > 0) + store_num_i = univ.party.special_notes.size(); //i + 1; store_page_on = 0; if (store_num_i == 0) { ASB("Nothing in your journal."); @@ -1035,16 +1039,16 @@ void adventure_notes() cd_create_dialog_parent_num(961,0); for (i = 0; i < 3; i++) { - if (univ.party.special_notes_str[i][0] > 0) { - switch (univ.party.special_notes_str[i][0] / 1000) { + if (univ.party.special_notes.size() > i) { + switch (univ.party.special_notes[i].str_num / 1000) { case 0: - strcpy((char *) place_str,scenario.scen_strs(univ.party.special_notes_str[i][0] % 1000)); break; + strcpy((char *) place_str,scenario.scen_strs(univ.party.special_notes[i].str_num % 1000)); break; case 1: - load_outdoor_str(loc(univ.party.special_notes_str[i][1] % scenario.out_width, - univ.party.special_notes_str[i][1] / scenario.out_width), univ.party.special_notes_str[i][0] % 1000,(char *)place_str); + load_outdoor_str(loc(univ.party.special_notes[i].where % scenario.out_width, + univ.party.special_notes[i].where / scenario.out_width), univ.party.special_notes[i].str_num % 1000,(char *)place_str); break; case 2: - load_town_str(univ.party.special_notes_str[i][1],univ.party.special_notes_str[i][0] % 1000,(char *)place_str); break; + load_town_str(univ.party.special_notes[i].where,univ.party.special_notes[i].str_num % 1000,(char *)place_str); break; } csit(961,3 + i,(char *) place_str); @@ -1084,29 +1088,29 @@ void put_talk() //get_str(place_str,120 + ((personality - 1) / 10),((personality - 1) % 10) + 1); csit(960,7,univ.town.cur_talk->talk_strs[personality % 10]); - if (univ.party.talk_save[store_page_on].str1 >= 1000) { - if (univ.party.talk_save[store_page_on].str1 >= 3000) - csit(960,3,scenario.scen_strs(univ.party.talk_save[store_page_on].str1 - 3000)); + if (univ.party.talk_save[store_page_on].str_num1 >= 1000) { + if (univ.party.talk_save[store_page_on].str_num1 >= 3000) + csit(960,3,scenario.scen_strs(univ.party.talk_save[store_page_on].str_num1 - 3000)); else { load_town_str(univ.party.talk_save[store_page_on].town_num, - univ.party.talk_save[store_page_on].str1 - 2000 ,(char *) place_str); + univ.party.talk_save[store_page_on].str_num1 - 2000 ,(char *) place_str); csit(960,3,(char *) place_str); } } - else if (univ.party.talk_save[store_page_on].str1 > 0) - csit(960,3,univ.town.cur_talk->talk_strs[univ.party.talk_save[store_page_on].str1]); + else if (univ.party.talk_save[store_page_on].str_num1 > 0) + csit(960,3,univ.town.cur_talk->talk_strs[univ.party.talk_save[store_page_on].str_num1]); - if (univ.party.talk_save[store_page_on].str2 >= 1000) { - if (univ.party.talk_save[store_page_on].str2 >= 3000) - csit(960,5,scenario.scen_strs(univ.party.talk_save[store_page_on].str2 - 3000 + 160)); + if (univ.party.talk_save[store_page_on].str_num2 >= 1000) { + if (univ.party.talk_save[store_page_on].str_num2 >= 3000) + csit(960,5,scenario.scen_strs(univ.party.talk_save[store_page_on].str_num2 - 3000 + 160)); else { load_town_str(univ.party.talk_save[store_page_on].town_num, - univ.party.talk_save[store_page_on].str2 - 2000/* + 20*/,(char *) place_str); + univ.party.talk_save[store_page_on].str_num2 - 2000/* + 20*/,(char *) place_str); csit(960,5,(char *) place_str); } } - else if (univ.party.talk_save[store_page_on].str2 > 0) - csit(960,5,univ.town.cur_talk->talk_strs[univ.party.talk_save[store_page_on].str2]); + else if (univ.party.talk_save[store_page_on].str_num2 > 0) + csit(960,5,univ.town.cur_talk->talk_strs[univ.party.talk_save[store_page_on].str_num2]); } } @@ -1194,10 +1198,10 @@ void journal_event_filter (short item_hit) } for (i = 0; i < 3; i++) { - if (univ.party.journal_str[i + (store_page_on * 3)] > 0) { + if (univ.party.journal.size() > i + (store_page_on * 3)) { ////get_str(place_str,17,univ.party.journal_str[i + (store_page_on * 3)]); - csit(962,3 + i,scenario.scen_strs(univ.party.journal_str[i] + 10)); - sprintf((char *)place_str,"Day: %d",univ.party.journal_day[i + (store_page_on * 3)]); + csit(962,3 + i,scenario.scen_strs(univ.party.journal[i].str_num + 10)); + sprintf((char *)place_str,"Day: %d",univ.party.journal[i + (store_page_on * 3)].day); csit(962,9 + i,(char *)place_str); } else {csit(962,3 + i,"");csit(962,9 + i,"");} @@ -1212,9 +1216,9 @@ void journal() Str255 place_str; store_num_i = 0; - for (i = 0; i < 120; i++) - if (univ.party.journal_str[i] > 0) - store_num_i = i + 1; + //for (i = 0; i < 120; i++) + //if (univ.party.journal[i].str_num > 0) + store_num_i = univ.party.journal.size();//i + 1; store_page_on = 0; make_cursor_sword(); @@ -1222,10 +1226,10 @@ void journal() cd_create_dialog_parent_num(962,0); for (i = 0; i < 3; i++) { - if (univ.party.journal_str[i] > 0) { + if (univ.party.journal.size() > i) { ////get_str(place_str,17,univ.party.journal_str[i]); - csit(962,3 + i,scenario.scen_strs(univ.party.journal_str[i] + 10)); - sprintf((char *)place_str,"Day: %d",univ.party.journal_day[i]); + csit(962,3 + i,scenario.scen_strs(univ.party.journal[i].str_num + 10)); + sprintf((char *)place_str,"Day: %d",univ.party.journal[i].day); csit(962,9 + i,(char *)place_str); } } @@ -1242,13 +1246,8 @@ void add_to_journal(short event) { short i; - for (i = 0; i < 120; i++) - if (univ.party.journal_str[i] == 0) { - univ.party.journal_str[i] = event; - univ.party.journal_day[i] = calc_day(); - i = 120; - } - ASB("Something was added to your journal."); + if(univ.party.add_to_journal(event, calc_day())) + ASB("Something was added to your journal."); } @@ -1301,34 +1300,19 @@ void record_display_strings(){ bool had1 = false, had2 = false; int i; play_sound(0); - for (i = 0; i < 140; i++) - if ((store_str_label_1 == univ.party.special_notes_str[i][0]) && - (store_str_label_1b == univ.party.special_notes_str[i][1])) + for (i = 0; i < univ.party.special_notes.size(); i++) + if ((store_str_label_1 == univ.party.special_notes[i].str_num) && + (store_str_label_1b == univ.party.special_notes[i].where)) had1 = true; if (!had1) { - //give_help(58,0,store_which_string_dlog); - for (i = 0; i < 140; i++) - if (univ.party.special_notes_str[i][0] <= 0) { - univ.party.special_notes_str[i][0] = store_str_label_1; - univ.party.special_notes_str[i][1] = store_str_label_1b; - //univ.party.special_notes_str[i][1] = store_str1b; - ASB("Info added to Encounter Notes."); - i = 140; - } - + give_help(58,0,store_which_string_dlog); + univ.party.record(store_str_label_1, store_str_label_1b); } - for (i = 0; i < 140; i++) - if ((store_str_label_2 == univ.party.special_notes_str[i][0]) && - (store_str_label_2b == univ.party.special_notes_str[i][1])) + for (i = 0; i < univ.party.special_notes.size(); i++) + if ((store_str_label_2 == univ.party.special_notes[i].str_num) && + (store_str_label_2b == univ.party.special_notes[i].where)) had2 = true; if (!had2) { - for (i = 0; i < 140; i++) - if (univ.party.special_notes_str[i][0] <= 0) { - univ.party.special_notes_str[i][0] = store_str_label_2; - univ.party.special_notes_str[i][1] = store_str_label_2b; - //univ.party.special_notes_str[i][1] = store_str2b; - i = 140; - } - + univ.party.record(store_str_label_2,store_str_label_2b); } } \ No newline at end of file diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index ad6416d6..20d2b99b 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -232,13 +232,16 @@ void init_party(short mode) univ.party.imprisoned_monst[i] = 0; for (i = 0; i < 256; i++) univ.party.m_seen[i] = 0; - for (i = 0; i < 50; i++) - univ.party.journal_str[i] = -1; - for (i = 0; i < 140; i++) - for (j = 0; j < 2; j++) - univ.party.special_notes_str[i][j] = 0; - for (i = 0; i < 120; i++) - univ.party.talk_save[i].personality = -1; +// for (i = 0; i < 50; i++) +// univ.party.journal_str[i] = -1; +// for (i = 0; i < 140; i++) +// for (j = 0; j < 2; j++) +// univ.party.special_notes_str[i][j] = 0; +// for (i = 0; i < 120; i++) +// univ.party.talk_save[i].personality = -1; + univ.party.journal.clear(); + univ.party.special_notes.clear(); + univ.party.talk_save.clear(); univ.party.total_m_killed = 0; univ.party.total_dam_done = 0; @@ -252,16 +255,17 @@ void init_party(short mode) univ.party.can_find_town[i] = 0; for (i = 0; i < 20; i++) univ.party.key_times[i] = 30000; - for (i = 0; i < 30; i++) - univ.party.party_event_timers[i] = 0; +// for (i = 0; i < 30; i++) +// univ.party.party_event_timers[i] = 0; + univ.party.party_event_timers.clear(); for (i = 0; i < 50; i++) univ.party.spec_items[i] = 0; for (i = 0; i < 120; i++) { - univ.party.help_received[i] = 0; - } + univ.party.help_received[i] = 0; + } for (i = 0; i < 200; i++) - univ.party.m_killed[i] = 0; - sprintf((char *) univ.party.scen_name,""); + univ.party.m_killed[i] = 0; + univ.party.scen_name = ""; for (i = 0; i < 200; i++) for (j = 0; j < 8; j++) @@ -371,13 +375,16 @@ void init_party_scen_data() univ.party.imprisoned_monst[i] = 0; for (i = 0; i < 256; i++) univ.party.m_seen[i] = 0; - for (i = 0; i < 50; i++) - univ.party.journal_str[i] = -1; - for (i = 0; i < 140; i++) - for (j = 0; j < 2; j++) - univ.party.special_notes_str[i][j] = 0; - for (i = 0; i < 120; i++) - univ.party.talk_save[i].personality = -1; +// for (i = 0; i < 50; i++) +// univ.party.journal_str[i] = -1; +// for (i = 0; i < 140; i++) +// for (j = 0; j < 2; j++) +// univ.party.special_notes_str[i][j] = 0; +// for (i = 0; i < 120; i++) + // univ.party.talk_save[i].personality = -1; + univ.party.journal.clear(); + univ.party.special_notes.clear(); + univ.party.talk_save.clear(); univ.party.direction = 0; univ.party.at_which_save_slot = 0; @@ -385,8 +392,9 @@ void init_party_scen_data() univ.party.can_find_town[i] = 1 - scenario.town_hidden[i]; for (i = 0; i < 20; i++) univ.party.key_times[i] = 30000; - for (i = 0; i < 30; i++) - univ.party.party_event_timers[i] = 0; +// for (i = 0; i < 30; i++) +// univ.party.party_event_timers[i] = 0; + univ.party.party_event_timers.clear(); for (i = 0; i < 50; i++) univ.party.spec_items[i] = (scenario.special_items[i] >= 10) ? 1 : 0; @@ -474,8 +482,9 @@ void put_party_in_scen(string scen_name) univ.party.age = 0; for (i = 0; i < 200; i++) univ.party.m_killed[i] = 0; - for (i = 0; i < 30; i++) - univ.party.party_event_timers[i] = 0; +// for (i = 0; i < 30; i++) +// univ.party.party_event_timers[i] = 0; + univ.party.party_event_timers.clear(); FSRef file_ref; diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index aeb76de6..1b82a956 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -1554,19 +1554,18 @@ void special_increase_age() if (s3 > 0) redraw = true; } - for (i = 0; i < 30; i++) - if (univ.party.party_event_timers[i] > 0) { - if (univ.party.party_event_timers[i] == 1) { - if (univ.party.global_or_town[i] == 0) - run_special(11,0,univ.party.node_to_call[i],null_loc,&s1,&s2,&s3); - else run_special(11,2,univ.party.node_to_call[i],null_loc,&s1,&s2,&s3); - univ.party.party_event_timers[i] = 0; + for (i = 0; i < univ.party.party_event_timers.size(); i++) { + if (univ.party.party_event_timers[i].time == 1) { + if (univ.party.party_event_timers[i].global_or_town == 0) + run_special(11,0,univ.party.party_event_timers[i].node_to_call,null_loc,&s1,&s2,&s3); + else run_special(11,2,univ.party.party_event_timers[i].node_to_call,null_loc,&s1,&s2,&s3); + univ.party.party_event_timers[i].time = 0; stat_area = true; if (s3 > 0) redraw = true; } - else univ.party.party_event_timers[i]--; - } + else univ.party.party_event_timers[i].time--; + } if (stat_area == true) { put_pc_screen(); put_item_screen(stat_window,0); @@ -1770,13 +1769,7 @@ void general_spec(short which_mode,cSpecial cur_node,short cur_spec_type, break; case 13: check_mess = true; - for (i = 0; i < 30; i++) - if (univ.party.party_event_timers[i] == 0) { - univ.party.party_event_timers[i] = spec.ex1a; - univ.party.node_to_call[i] = spec.ex1b; - univ.party.global_or_town[i] = 0; - i = 30; - } + univ.party.start_timer(spec.ex1a, spec.ex1b, 0); break; case 14: play_sound(spec.ex1a); @@ -1784,26 +1777,26 @@ void general_spec(short which_mode,cSpecial cur_node,short cur_spec_type, case 15: check_mess = true; if (spec.ex1a != minmax(0,29,spec.ex1a)) - give_error("Horse univ.out.out of range.","",0); + give_error("Horse out of range.","",0); else univ.party.horses[spec.ex1a].property = (spec.ex2a == 0) ? 1 : 0; break; case 16: check_mess = true; if (spec.ex1a != minmax(0,29,spec.ex1a)) - give_error("Boat univ.out.out of range.","",0); + give_error("Boat out of range.","",0); else univ.party.boats[spec.ex1a].property = (spec.ex2a == 0) ? 1 : 0; break; case 17: check_mess = true; if (spec.ex1a != minmax(0,scenario.num_towns - 1,spec.ex1a)) - give_error("Town univ.out.out of range.","",0); + give_error("Town out of range.","",0); else univ.party.can_find_town[spec.ex1a] = (spec.ex1b == 0) ? 0 : 1; *redraw = true; break; case 18: check_mess = true; if (spec.ex1a != minmax(1,10,spec.ex1a)) - give_error("Event code univ.out.out of range.","",0); + give_error("Event code out of range.","",0); else if (univ.party.key_times[spec.ex1a] == 30000) univ.party.key_times[spec.ex1a] = calc_day(); break; @@ -2784,14 +2777,7 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type, end_split(spec.ex1a); break; case 195: - for (i = 0; i < 30; i++) - if (univ.party.party_event_timers[i] == 0) { - univ.party.party_event_timers[i] = spec.ex1a; - univ.party.node_to_call[i] = spec.ex1b; - univ.party.global_or_town[i] = 1; - i = 30; - } - break; + univ.party.start_timer(spec.ex1a, spec.ex1b, 1); break; } if (check_mess == true) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); diff --git a/osx/boe.startup.cpp b/osx/boe.startup.cpp index 0e9efb58..175b306c 100644 --- a/osx/boe.startup.cpp +++ b/osx/boe.startup.cpp @@ -123,7 +123,7 @@ void startup_load()//// if(load_party(*file_to_load)){ party_in_memory = true; update_pc_graphics(); - in_startup_mode = strlen(univ.party.scen_name); + in_startup_mode = univ.party.scen_name.length(); } if (!in_startup_mode) { //end_anim(); diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index 77c4c7a5..ac71d7c7 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -647,9 +647,12 @@ location end_town_mode(short switching_level,location destination) // returns n to_return = univ.party.p_loc; - for (i = 0; i < 30; i++) - if ((univ.party.party_event_timers[i] > 0) && (univ.party.global_or_town[i] == 1)) - univ.party.party_event_timers[i] = 0; + for (i = univ.party.party_event_timers.size() - 1; i >= 0; i++) + if (univ.party.party_event_timers[i].global_or_town == 1) { + cParty::timerIter iter = univ.party.party_event_timers.begin(); + iter += i; + univ.party.party_event_timers.erase(iter); + } } @@ -907,13 +910,13 @@ void create_out_combat_terrain(short type,short num_walls,short spec_code) 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 13 - stalagmites 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 14 - cave road (proposed) 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 150 */ // 15 - surface road (proposed) - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 16 - crops (proposed) - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 17 - cave fumarole (proposed) - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, // 18 - surface fumarole (proposed) - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, // (note: fumaroles would have lava.) - 0, 0, 1, 0, 2, 0, 0, 1, 1, 1,/* 200 */ // the numbers in this array are indices into the other arrays - 1, 0, 2, 1, 1, 0, 1, 1, 1, 1, // (ter_base, ground_type, and terrain_odds first index) - 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 16 - hills road (proposed) + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 17 - crops (proposed) + 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, // 18 - cave fumarole (proposed) + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, // 19 - surface fumarole (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 */ diff --git a/osx/misc/fileio.cpp b/osx/misc/fileio.cpp index edac53a6..71f6ac97 100644 --- a/osx/misc/fileio.cpp +++ b/osx/misc/fileio.cpp @@ -1087,7 +1087,7 @@ bool load_party(FSSpec file_to_load){ return false; univ.file = file_spec; }else{ - strcpy(univ.party.scen_name,""); + univ.party.scen_name = ""; } // Compatibility flags diff --git a/osx/misc/mathutil.cpp b/osx/misc/mathutil.cpp index 6ef985f0..5e3f2461 100644 --- a/osx/misc/mathutil.cpp +++ b/osx/misc/mathutil.cpp @@ -13,6 +13,8 @@ short get_ran (short times,short min,short max){ long int store; short i, to_ret = 0; + if(max < min) max = min; + for (i = 1; i < times + 1; i++) { store = rand(); to_ret += min + (store % (max - min + 1));//min + (((store + 32767) * (max - min + 1)) / 65536); diff --git a/osx/outdoors.h b/osx/outdoors.h index eec81f76..8705dd81 100644 --- a/osx/outdoors.h +++ b/osx/outdoors.h @@ -30,7 +30,7 @@ public: bool exists; short direction; cWandering what_monst; - location which_sector,m_loc; + location which_sector,m_loc,home_sector; // home_sector is the sector it was spawned in cCreature& operator = (legacy::outdoor_creature_type old); }; diff --git a/osx/party.cpp b/osx/party.cpp index 3e373bad..b85050f8 100644 --- a/osx/party.cpp +++ b/osx/party.cpp @@ -33,9 +33,9 @@ cParty& cParty::operator = (legacy::party_record_type& old){ for(i = 0; i < 30; i++){ boats[i] = old.boats[i]; horses[i] = old.horses[i]; - party_event_timers[i] = old.party_event_timers[i]; - global_or_town[i] = old.global_or_town[i]; - node_to_call[i] = old.node_to_call[i]; + party_event_timers[i].time = old.party_event_timers[i]; + party_event_timers[i].global_or_town = old.global_or_town[i]; + party_event_timers[i].node_to_call = old.node_to_call[i]; } for(i = 0; i < 4; i++){ creature_save[i] = old.creature_save[i]; @@ -51,13 +51,13 @@ cParty& cParty::operator = (legacy::party_record_type& old){ for(i = 0; i < 256; i++) m_seen[i] = old.m_seen[i]; for(i = 0; i < 50; i++){ - journal_str[i] = old.journal_str[i]; - journal_day[i] = old.journal_day[i]; + journal[i].str_num = old.journal_str[i]; + journal[i].day = old.journal_day[i]; spec_items[i] = old.spec_items[i]; } for(i = 0; i < 140; i++){ - special_notes_str[i][0] = old.special_notes_str[i][0]; - special_notes_str[i][1] = old.special_notes_str[i][1]; + special_notes[i].str_num = old.special_notes_str[i][0]; + special_notes[i].where = old.special_notes_str[i][1]; } for(i = 0; i < 120; i++){ talk_save[i] = old.talk_save[i]; @@ -77,7 +77,7 @@ cParty& cParty::operator = (legacy::party_record_type& old){ total_dam_done = old.total_dam_done; total_xp_gained = old.total_xp_gained; total_dam_taken = old.total_dam_taken; - strcpy(scen_name,old.scen_name); + scen_name = old.scen_name; } __attribute__((deprecated)) @@ -90,8 +90,8 @@ __attribute__((deprecated)) cParty::cConvers& cParty::cConvers::operator = (legacy::talk_save_type old){ personality = old.personality; town_num = old.town_num; - str1 = old.str1; - str2 = old.str2; + str_num1 = old.str1; + str_num2 = old.str2; } __attribute__((deprecated)) @@ -110,3 +110,49 @@ void cParty::add_pc(cPlayer new_pc){ break; } } + +bool cParty::has_talk_save(short who, short str1, short str2){ + for (int j = 0; j < talk_save.size(); j++) + if ((talk_save[j].personality == who) && (talk_save[j].str_num1 == str1) && (talk_save[j].str_num2 == str2)) + return true; + return false; +} + +bool cParty::save_talk(short who, unsigned char where, short str1, short str2){ + if(talk_save.size() == talk_save.max_size()) return false; // This is extremely unlikely + cConvers talk; + talk.personality = who; + talk.town_num = where; + talk.str_num1 = str1; + talk.str_num2 = str2; + // TODO: locate the strings and store them in the record. + talk_save.push_back(talk); + return true; +} + +bool cParty::add_to_journal(short event, short day){ + if(journal.size() == journal.max_size()) return false; // Practically impossible + cJournal entry; + entry.str_num = event; + entry.day = day; + journal.push_back(entry); + return true; +} + +bool cParty::record(short what, short where){ + if(special_notes.size() == special_notes.max_size()) return false; // Never happen + cEncNote note; + note.str_num = what; + note.where = where; + special_notes.push_back(note); + return true; +} + +bool cParty::start_timer(short time, short node, short type){ + if(party_event_timers.size() == party_event_timers.max_size()) return false; // Shouldn't be reached + cTimer t; + t.time = time; + t.global_or_town = type; + t.node_to_call = node; + party_event_timers.push_back(t); +} diff --git a/osx/party.h b/osx/party.h index 22d92f02..cf7ab00e 100644 --- a/osx/party.h +++ b/osx/party.h @@ -6,6 +6,10 @@ * */ +#include +#include +using namespace std; + namespace legacy { struct party_record_type; struct big_tr_type; @@ -21,15 +25,33 @@ public: public: short personality; short town_num; - short str1, str2; + short str_num1, str_num2; + string who_said, in_town, the_str1, the_str2, in_scen; // the actual strings; not always saved, like maps cConvers& operator = (legacy::talk_save_type old); }; + class cJournal { + public: + unsigned short str_num; + unsigned short day; + string the_str, in_scen; // the actual strings; not always saved, like maps + }; + class cEncNote { + public: + unsigned short str_num, where; + string the_str1, the_str2, in_scen; // the actual strings; not always saved, like maps + }; + class cTimer { + public: + short time; + short global_or_town; + short node_to_call; + }; // formerly party_record_type long age; unsigned short gold; unsigned short food; - unsigned char stuff_done[310][10]; + unsigned char stuff_done[310][50]; unsigned char item_taken[200][8]; short light_level; location outdoor_corner; @@ -45,32 +67,46 @@ public: cItemRec magic_store_items[5][10]; short imprisoned_monst[4]; // Soul Crystal? char m_seen[256]; - char journal_str[50]; - short journal_day[50]; - short special_notes_str[140][2]; - cConvers talk_save[120]; + vector journal; + vector special_notes; + vector talk_save; short direction; short at_which_save_slot; char alchemy[20]; bool can_find_town[200]; short key_times[100]; - short party_event_timers[30]; - short global_or_town[30]; - short node_to_call[30]; + vector party_event_timers; + //short global_or_town[30]; + //short node_to_call[30]; char spec_items[50]; char help_received[120]; - short m_killed[300]; // monsters killed per town, I think + short m_killed[200]; // monsters killed per town, I think long long total_m_killed, total_dam_done, total_xp_gained, total_dam_taken; - char scen_name[256]; + string scen_name; cPlayer adven[6]; cItemRec stored_items[3][115]; // formerly stored_items_list_type + string graphicsFile; // the name of the png file holding this party's custom item, pc, and summonable monster graphics + cMonster summons; // an array of monsters which can be summoned by the parties items yet don't originate from this scenario + bool graphicUsed[250]; // whether each custom graphics slot on the party's sheet is actually used; needed to place new custom graphics on the sheet. + unsigned short scen_won, scen_played; // numbers of scenarios won and played respectively by this party + cParty& operator = (legacy::party_record_type& old); void append(legacy::big_tr_type& old); void append(legacy::stored_items_list_type& old,short which_list); void add_pc(legacy::pc_record_type old); void add_pc(cPlayer new_pc); + bool has_talk_save(short who, short str1, short str2); + bool save_talk(short who, unsigned char where, short str1, short str2); + bool add_to_journal(short event, short day); + bool record(short what, short where); + bool start_timer(short time, short node, short type); + + typedef vector::iterator encIter; + typedef vector::iterator journalIter; + typedef vector::iterator talkIter; + typedef vector::iterator timerIter; }; diff --git a/osx/terrain.cpp b/osx/terrain.cpp index 8e6a3961..21d26697 100644 --- a/osx/terrain.cpp +++ b/osx/terrain.cpp @@ -23,7 +23,4 @@ cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){ light_radius = old.light_radius; step_sound = old.step_sound; shortcut_key = old.shortcut_key; - res1 = old.res1; - res2 = old.res2; - res3 = old.res3; } \ No newline at end of file diff --git a/osx/terrain.h b/osx/terrain.h index 6087afab..7e47fadc 100644 --- a/osx/terrain.h +++ b/osx/terrain.h @@ -21,10 +21,13 @@ public: unsigned char block_horse; unsigned char light_radius; unsigned char step_sound; - unsigned char shortcut_key; - unsigned char res1; - unsigned char res2; - unsigned char res3; + unsigned char shortcut_key; // for editor use only + unsigned char obj_num; // ditto (formerly res1) + unsigned char ground_type; // ditto (formerly res2) + unsigned char trim_type; // ditto, mostly (formerly res3) + unsigned short trim_ter; // ditto + unsigned short combat_arena; + location obj_pos; // editor use only cTerrain& operator = (legacy::terrain_type_type& old); }; \ No newline at end of file