diff --git a/osx/BoE.xcodeproj/project.pbxproj b/osx/BoE.xcodeproj/project.pbxproj index 31326a37..800b522d 100644 --- a/osx/BoE.xcodeproj/project.pbxproj +++ b/osx/BoE.xcodeproj/project.pbxproj @@ -87,6 +87,7 @@ 913D05BC0FA1EA0A00184C18 /* pc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 913D05BB0FA1EA0A00184C18 /* pc.cpp */; }; 913D05BD0FA1EA0A00184C18 /* pc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 913D05BB0FA1EA0A00184C18 /* pc.cpp */; }; 913D05BE0FA1EA0A00184C18 /* pc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 913D05BB0FA1EA0A00184C18 /* pc.cpp */; }; + 91A79DC70FA797BF00A6A41F /* menu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 91A79DC60FA797BF00A6A41F /* menu.xib */; }; 91AC60800FA26A3B00EEAE67 /* regtown.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91AC607F0FA26A3B00EEAE67 /* regtown.cpp */; }; 91AC60810FA26A3B00EEAE67 /* regtown.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91AC607F0FA26A3B00EEAE67 /* regtown.cpp */; }; 91AC60820FA26A3B00EEAE67 /* regtown.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91AC607F0FA26A3B00EEAE67 /* regtown.cpp */; }; @@ -313,6 +314,8 @@ 913D05B50FA1E9E300184C18 /* party.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = party.cpp; sourceTree = ""; }; 913D05BA0FA1EA0A00184C18 /* pc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pc.h; sourceTree = ""; }; 913D05BB0FA1EA0A00184C18 /* pc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pc.cpp; sourceTree = ""; }; + 91A79DC60FA797BF00A6A41F /* menu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = menu.xib; sourceTree = ""; }; + 91A79DDD0FA79DEE00A6A41F /* dialogs.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = dialogs.xib; sourceTree = ""; }; 91AC607E0FA26A3B00EEAE67 /* regtown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regtown.h; sourceTree = ""; }; 91AC607F0FA26A3B00EEAE67 /* regtown.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = regtown.cpp; sourceTree = ""; }; 91AC60A60FA26C1B00EEAE67 /* tmpltown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tmpltown.h; sourceTree = ""; }; @@ -757,6 +760,8 @@ 2B8F435C0C0973680012E4A8 /* BoE.icns */, 2BF04AC30BF518D4006C0831 /* Blades of Exile-Info.plist */, 91D635A90F90E7B500674AB3 /* Blades of Exile Scenarios */, + 91A79DC60FA797BF00A6A41F /* menu.xib */, + 91A79DDD0FA79DEE00A6A41F /* dialogs.xib */, ); name = rsrc; sourceTree = ""; @@ -883,6 +888,7 @@ 91279BB60F9D03B7007B0D52 /* boesave.icns in Resources */, 91279BB70F9D03B7007B0D52 /* boesounds.icns in Resources */, 91279BB80F9D03B7007B0D52 /* boegraphics.icns in Resources */, + 91A79DC70FA797BF00A6A41F /* menu.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1231,7 +1237,6 @@ 9127934B0F9C0FEA007B0D52 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ppc; COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1259,7 +1264,6 @@ 9127934C0F9C0FEA007B0D52 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ppc; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( diff --git a/osx/Scenario Editor/Blades of Exile Graphics b/osx/Scenario Editor/Blades of Exile Graphics index c704dd52..7bc90005 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 2fade5c7..3c181496 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -103,7 +103,7 @@ extern WindowPtr mainPtr; //extern big_tr_type t_d; //extern unsigned char out[96][96],out_e[96][96]; extern short which_item_page[6]; -extern short town_size[3],store_spell_target,pc_last_cast[2][6],pc_casting,store_mage,store_priest; +extern short /*town_size[3],*/store_spell_target,pc_last_cast[2][6],pc_casting,store_mage,store_priest; //extern town_item_list t_i; // shouldn't be here //extern unsigned char misc_i[64][64]; extern short spec_item_array[60]; @@ -301,7 +301,8 @@ bool handle_action(EventRecord event) short i,j,k,item_hit,which_t,s1,s2,s3; bool are_done = false; bool need_redraw = false, did_something = false, need_reprint = false; - bool town_move_done = false,pc_delayed = false,storage; + bool town_move_done = false,pc_delayed = false; + short storage; location destination,cur_loc,loc_in_sec,cur_direction; unsigned char debug_storage; short find_direction_from,ter_looked_at,button_hit = 12,store_cur_pc; @@ -838,9 +839,9 @@ bool handle_action(EventRecord event) k = 0; if (overall_mode == MODE_LOOK_TOWN) { while (k < 15) { - if (destination == univ.town.town->sign_locs[k]) { + if (destination == univ.town->sign_locs[k]) { need_reprint = true; - if (adjacent(univ.town.town->sign_locs[k],univ.town.p_loc)==true) + if (adjacent(univ.town->sign_locs[k],univ.town.p_loc)==true) do_sign(univ.town.num,k,(short) ter_looked_at,destination); else add_string_to_buf(" Too far away to read sign. "); } @@ -899,7 +900,7 @@ bool handle_action(EventRecord event) } else { - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { if (monst_on_space(destination,i) == true) { did_something = true; need_redraw = true; @@ -998,23 +999,23 @@ bool handle_action(EventRecord event) // Begin: Screen shift if ((overall_mode == MODE_SPELL_TARGET) || (overall_mode == MODE_FIRING) || (overall_mode == MODE_THROWING) || (overall_mode == MODE_FANCY_TARGET) || (overall_mode == MODE_LOOK_COMBAT) || (overall_mode == MODE_LOOK_TOWN)) { - if ((PtInRect (the_point, &border_rect[0])) && (center.y > univ.town.town->in_town_rect.top) + if ((PtInRect (the_point, &border_rect[0])) && (center.y > univ.town->in_town_rect.top) && (center.y > 4)) { center.y--; need_redraw = true; } - if ((PtInRect (the_point, &border_rect[1])) && (center.x > univ.town.town->in_town_rect.left) + if ((PtInRect (the_point, &border_rect[1])) && (center.x > univ.town->in_town_rect.left) && (center.x > 4)) { center.x--; need_redraw = true; } - if ((PtInRect (the_point, &border_rect[2])) && (center.y < univ.town.town->in_town_rect.bottom) - && (center.y < town_size[town_type] - 5)) { + if ((PtInRect (the_point, &border_rect[2])) && (center.y < univ.town->in_town_rect.bottom) + && (center.y < univ.town->max_dim() - 5)) { center.y++; need_redraw = true; } - if ((PtInRect (the_point, &border_rect[3])) && (center.x < univ.town.town->in_town_rect.right) - && (center.x < town_size[town_type] - 5)) { + if ((PtInRect (the_point, &border_rect[3])) && (center.x < univ.town->in_town_rect.right) + && (center.x < univ.town->max_dim() - 5)) { center.x++; need_redraw = true; } @@ -1774,7 +1775,7 @@ bool handle_keystroke(char chr,char chr2,EventRecord event) case 'K': if (debug_on) { - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { if ((is_combat()) && (univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].attitude % 2 == 1)) univ.town.monst.dudes[i].active = 0; @@ -2116,9 +2117,9 @@ void increase_age()//// PSD[SDF_PARTY_FLIGHT] = move_to_zero(PSD[SDF_PARTY_FLIGHT]); - if ((overall_mode > MODE_OUTDOORS) && (univ.town.town->lighting_type == 2)) + if ((overall_mode > MODE_OUTDOORS) && (univ.town->lighting_type == 2)) univ.party.light_level = max (0,univ.party.light_level - 9); - if (univ.town.town->lighting_type == 3) { + if (univ.town->lighting_type == 3) { if (univ.party.light_level > 0) ASB("Your light is drained."); univ.party.light_level = 0; @@ -2740,14 +2741,14 @@ bool town_move_party(location destination,short forced)//// } */ - if (monst_there(destination) > T_M) + if (monst_there(destination) > univ.town->max_monst()) keep_going = check_special_terrain(destination,1,0,&spec_num,&check_f); if (check_f == true) forced = true; if (spec_num == 50) forced = true; - ter = univ.town.town->terrain(destination.x,destination.y); + ter = univ.town->terrain(destination.x,destination.y); if (keep_going == true) { if (univ.party.in_boat >= 0) { @@ -2820,7 +2821,7 @@ bool town_move_party(location destination,short forced)//// ASB("You can't take horses there!"); return false; } - if ((univ.town.town->lighting_type > 0) && (get_ran(1,0,1) == 0)) { + if ((univ.town->lighting_type > 0) && (get_ran(1,0,1) == 0)) { ASB("The darkness spooks your horses."); return false; } @@ -2832,11 +2833,11 @@ bool town_move_party(location destination,short forced)//// add_string_to_buf((char *) create_line); // place_treasure(destination,5,3); - move_sound(univ.town.town->terrain(destination.x,destination.y),(short) univ.party.age); + move_sound(univ.town->terrain(destination.x,destination.y),(short) univ.party.age); if (univ.party.in_boat >= 0) { // Waterfall!!! - while (scenario.ter_types[univ.town.town->terrain(destination.x,destination.y + 1)].special == 15) { + while (scenario.ter_types[univ.town->terrain(destination.x,destination.y + 1)].special == 15) { add_string_to_buf(" Waterfall! "); destination.y += 2; univ.town.p_loc.y += 2; diff --git a/osx/boe.combat.cpp b/osx/boe.combat.cpp index 9755a98f..4c11be8f 100644 --- a/osx/boe.combat.cpp +++ b/osx/boe.combat.cpp @@ -42,9 +42,9 @@ extern short store_mage, store_priest; extern short store_mage_lev, store_priest_lev,store_item_spell_level; extern short store_spell_target,pc_casting,current_spell_range; extern effect_pat_type current_pat; -extern short town_size[3]; +//extern short town_size[3]; extern short town_type; -extern short monst_target[T_M]; // 0-5 target that pc 6 - no target 100 + x - target monster x +extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x extern short num_targets_left; extern location spell_targets[8]; extern bool web,crate,barrel,fire_barrier,force_barrier,quickfire,force_wall,fire_wall,antimagic,scloud,ice_wall,blade_wall; @@ -53,7 +53,7 @@ extern bool fast_bang; //extern unsigned char misc_i[64][64],sfx[64][64]; extern short store_current_pc; extern short refer_mage[62],refer_priest[62]; -extern location monster_targs[T_M]; +extern location monster_targs[60]; extern short combat_posing_monster , current_working_monster ; // 0-5 PC 100 + x - monster x extern short spell_caster, missile_firer,current_monst_tactic; @@ -111,7 +111,7 @@ extern short boom_gr[8]; char *d_string[] = {"North", "NorthEast", "East", "SouthEast", "South", "SouthWest", "West", "NorthWest"}; short pc_marked_damage[6]; -short monst_marked_damage[T_M]; +short monst_marked_damage[60]; location hor_vert_place[14] = {loc(0,0),loc(-1,1),loc(1,1),loc(-2,2),loc(0,2), loc(2,2),loc(0,1),loc(-1,2),loc(1,2),loc(-1,3), @@ -311,11 +311,11 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,unsigned char in_which_ univ.out.misc_i[i][j] = 0; univ.out.sfx[i][j] = 0; } - univ.town.town->in_town_rect = town_rect; + univ.town->in_town_rect = town_rect; create_out_combat_terrain((short) in_which_terrain,num_walls,0);//// - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { univ.town.monst.dudes[i].number = 0; univ.town.monst.dudes[i].active = 0; } @@ -351,7 +351,7 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,unsigned char in_which_ } // place monsters, w. friendly monsts landing near PCs - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].active > 0) { monst_target[i] = 6; @@ -380,12 +380,12 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,unsigned char in_which_ combat_active_pc = 6; spell_caster = 6; missile_firer = 6; - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) monst_target[i] = 6; for (i = 0; i < 6; i++) { pc_parry[i] = 0; - last_attacked[i] = T_M + 10; + last_attacked[i] = univ.town->max_monst() + 10; } for (i = 0; i < NUM_TOWN_ITEMS; i++) @@ -415,7 +415,7 @@ bool pc_combat_move(location destination) //// location monst_loc,store_loc; short spec_num; - if (monst_there(destination) > T_M) + if (monst_there(destination) > univ.town->max_monst()) keep_going = check_special_terrain(destination,2,current_pc,&spec_num,&check_f); if (check_f == true) forced = true; @@ -447,7 +447,7 @@ bool pc_combat_move(location destination) //// add_string_to_buf((char *) create_line); return true; } - else if ((monst_hit = monst_there(destination)) <= T_M) { + else if ((monst_hit = monst_there(destination)) <= univ.town->max_monst()) { s1 = univ.town.monst.dudes[monst_hit].attitude; s2 = (s1 % 2 == 1) ? 2 : fancy_choice_dialog(1045,0); if ((s2 == 2) && (s1 % 2 != 1)) @@ -479,7 +479,7 @@ bool pc_combat_move(location destination) //// || ((impassable(combat_terrain[destination.x][destination.y]) == false) && (pc_there(destination) == 6))) { // monsters get back-shots - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { monst_loc = univ.town.monst.dudes[i].m_loc; monst_exist = univ.town.monst.dudes[i].active; @@ -1167,7 +1167,7 @@ void do_combat_cast(location target)//// default: targ_num = monst_there(target); - if (targ_num > T_M) + if (targ_num > univ.town->max_monst()) add_string_to_buf(" Nobody there "); else { cur_monst = &univ.town.monst.dudes[targ_num]; @@ -1364,7 +1364,7 @@ void handle_marked_damage() damage_pc(i,pc_marked_damage[i],DAMAGE_MARKED,MONSTER_TYPE_UNKNOWN,0); pc_marked_damage[i] = 0; } - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if (monst_marked_damage[i] > 0) { damage_monst(i, current_pc, monst_marked_damage[i], 0, DAMAGE_MARKED,0); // was 9 rather than 10; probably a mistake @@ -1519,7 +1519,7 @@ void fire_missile(location target) { if (r1 > hit_chance[skill]) add_string_to_buf(" Missed."); - else if ((targ_monst = monst_there(target)) < T_M) { + else if ((targ_monst = monst_there(target)) < univ.town->max_monst()) { cur_monst = &univ.town.monst.dudes[targ_monst]; spec_dam = calc_spec_dam(ADVEN[missile_firer].items[ammo_inv_slot].ability, ADVEN[missile_firer].items[ammo_inv_slot].ability_strength,cur_monst); @@ -1540,10 +1540,10 @@ void fire_missile(location target) { 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 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); } @@ -1662,9 +1662,9 @@ void combat_run_monst() process_fields(); univ.party.light_level = move_to_zero(univ.party.light_level); - if ((which_combat_type == 1) && (univ.town.town->lighting_type == 2)) + if ((which_combat_type == 1) && (univ.town->lighting_type == 2)) univ.party.light_level = max (0,univ.party.light_level - 9); - if (univ.town.town->lighting_type == 3) + if (univ.town->lighting_type == 3) univ.party.light_level = 0; PSD[SDF_PARTY_DETECT_LIFE] = move_to_zero(PSD[SDF_PARTY_DETECT_LIFE]); @@ -1749,7 +1749,7 @@ void do_monster_turn() monsters_going = true; // This affects how graphics are drawn. - num_monst = T_M; + num_monst = univ.town->max_monst(); if (overall_mode < MODE_COMBAT) which_combat_type = 1; @@ -1765,7 +1765,7 @@ void do_monster_turn() if (r1 < 50) cur_monst->active = 2; - for (j = 0; j < T_M; j++) + for (j = 0; j < univ.town->max_monst(); j++) if (monst_near(j,cur_monst->m_loc,5,1) == true) { cur_monst->active = 2; } @@ -1773,7 +1773,7 @@ void do_monster_turn() if ((cur_monst->active == 1) && (cur_monst->attitude % 2 == 1)) { // Now it looks for PC-friendly monsters // dist check is for efficiency - for (j = 0; j < T_M; j++) + for (j = 0; j < univ.town->max_monst(); j++) if ((univ.town.monst.dudes[j].active > 0) && (univ.town.monst.dudes[j].attitude % 2 != 1) && (dist(cur_monst->m_loc,univ.town.monst.dudes[j].m_loc) <= 6) && @@ -1784,7 +1784,7 @@ void do_monster_turn() // See if friendly, fighting monster see hostile monster. If so, make mobile // dist check is for efficiency if ((cur_monst->active == 1) && (cur_monst->attitude == 2)) { - for (j = 0; j < T_M; j++) + for (j = 0; j < univ.town->max_monst(); j++) if ((univ.town.monst.dudes[j].active > 0) && (univ.town.monst.dudes[j].attitude % 2 == 1) && (dist(cur_monst->m_loc,univ.town.monst.dudes[j].m_loc) <= 6) && (can_see(cur_monst->m_loc,univ.town.monst.dudes[j].m_loc,0) < 5)) { @@ -3064,7 +3064,7 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// for (i = 0; i < 6; i++) if (pc_near(i,caster->m_loc,8)) slow_pc(i,2 + caster->m_d.level / 4); - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { if ((univ.town.monst.dudes[i].active != 0) && (((univ.town.monst.dudes[i].attitude % 2 == 1) && (caster->attitude % 2 != 1)) || ((univ.town.monst.dudes[i].attitude % 2 != 1) && (caster->attitude % 2 == 1)) || @@ -3075,7 +3075,7 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// break; case 18: // major haste play_sound(25); - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((monst_near(i,caster->m_loc,8,0)) && (caster->attitude == univ.town.monst.dudes[i].attitude)) { affected = &univ.town.monst.dudes[i]; @@ -3122,7 +3122,7 @@ bool monst_cast_mage(cPopulation::cCreature *caster,short targ)//// break; case 25: // major bless play_sound(25); - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((monst_near(i,caster->m_loc,8,0)) && (caster->attitude == univ.town.monst.dudes[i].attitude)) { affected = &univ.town.monst.dudes[i]; @@ -3348,7 +3348,7 @@ bool monst_cast_priest(cPopulation::cCreature *caster,short targ) if (spell == 23) disease_pc(i,2 + r2); } - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { if ((univ.town.monst.dudes[i].active != 0) && (((univ.town.monst.dudes[i].attitude % 2 == 1) && (caster->attitude % 2 != 1)) || ((univ.town.monst.dudes[i].attitude % 2 != 1) && (caster->attitude % 2 == 1)) || @@ -3375,7 +3375,7 @@ bool monst_cast_priest(cPopulation::cCreature *caster,short targ) case 16: case 24:// bless all,revive all play_sound(24); r1 = get_ran(2,1,4); r2 = get_ran(3,1,6); - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((monst_near(i,caster->m_loc,8,0)) && (caster->attitude == univ.town.monst.dudes[i].attitude)) { affected = &univ.town.monst.dudes[i]; @@ -3460,8 +3460,8 @@ location find_fireball_loc(location where,short radius,short mode,short *m) location check_loc,cast_loc(120,0); short cur_lev,level_max = 10; - for (check_loc.x = 1; check_loc.x < town_size[town_type] - 1; check_loc.x ++) - for (check_loc.y = 1; check_loc.y < town_size[town_type] - 1; check_loc.y ++) + for (check_loc.x = 1; check_loc.x < univ.town->max_dim() - 1; check_loc.x ++) + for (check_loc.y = 1; check_loc.y < univ.town->max_dim() - 1; check_loc.y ++) if ((dist(where,check_loc) <= 8) && (can_see(where,check_loc,2) < 5) && (get_obscurity(check_loc.x,check_loc.y) < 5)) { { cur_lev = count_levels(check_loc,radius); @@ -3495,7 +3495,7 @@ short count_levels(location where,short radius) { short i,store = 0; - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if (monst_near(i,where,radius,0) == true) { if (univ.town.monst.dudes[i].attitude % 2 == 1) store = store - univ.town.monst.dudes[i].m_d.level; @@ -3573,7 +3573,7 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,bool pre - active = univ.town.town->in_town_rect; + active = univ.town->in_town_rect; // eliminate barriers that can't be seen for (i = minmax(active.left + 1,active.right - 1,center.x - 4); i <= minmax(active.left + 1,active.right - 1,center.x + 4); i++) @@ -3586,8 +3586,8 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,bool pre // First actually make barriers, then draw them, then inflict damaging effects. - for (i = minmax(0,town_size[town_type] - 1,center.x - 4); i <= minmax(0,town_size[town_type] - 1,center.x + 4); i++) - for (j = minmax(0,town_size[town_type] - 1,center.y - 4); j <= minmax(0,town_size[town_type] - 1,center.y + 4); j++) + for (i = minmax(0,univ.town->max_dim() - 1,center.x - 4); i <= minmax(0,univ.town->max_dim() - 1,center.x + 4); i++) + for (j = minmax(0,univ.town->max_dim() - 1,center.y - 4); j <= minmax(0,univ.town->max_dim() - 1,center.y + 4); j++) if (get_obscurity(i,j) < 5) { effect = pat.pattern[i - center.x + 4][j - center.y + 4]; switch (effect) { @@ -3616,8 +3616,8 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,bool pre // Damage to pcs for (k = 0; k < 6; k++) - for (i = minmax(0,town_size[town_type] - 1,center.x - 4); i <= minmax(0,town_size[town_type] - 1,center.x + 4); i++) - for (j = minmax(0,town_size[town_type] - 1,center.y - 4); j <= minmax(0,town_size[town_type] - 1,center.y + 4); j++) { + for (i = minmax(0,univ.town->max_dim() - 1,center.x - 4); i <= minmax(0,univ.town->max_dim() - 1,center.x + 4); i++) + for (j = minmax(0,univ.town->max_dim() - 1,center.y - 4); j <= minmax(0,univ.town->max_dim() - 1,center.y + 4); j++) { spot_hit.x = i; spot_hit.y = j; if ((get_obscurity(i,j) < 5) && (ADVEN[k].main_status == 1) @@ -3662,12 +3662,12 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,bool pre fast_bang = 0; // Damage to monsters - for (k = 0; k < T_M; k++) + for (k = 0; k < univ.town->max_monst(); k++) if ((univ.town.monst.dudes[k].active > 0) && (dist(center,univ.town.monst.dudes[k].m_loc) <= 5)) { monster_hit = false; // First actually make barriers, then draw them, then inflict damaging effects. - for (i = minmax(0,town_size[town_type] - 1,center.x - 4); i <= minmax(0,town_size[town_type] - 1,center.x + 4); i++) - for (j = minmax(0,town_size[town_type] - 1,center.y - 4); j <= minmax(0,town_size[town_type] - 1,center.y + 4); j++) { + for (i = minmax(0,univ.town->max_dim() - 1,center.x - 4); i <= minmax(0,univ.town->max_dim() - 1,center.x + 4); i++) + for (j = minmax(0,univ.town->max_dim() - 1,center.y - 4); j <= minmax(0,univ.town->max_dim() - 1,center.y + 4); j++) { spot_hit.x = i; spot_hit.y = j; @@ -3758,7 +3758,7 @@ void do_shockwave(location target) if ((dist(target,pc_pos[i]) > 0) && (dist(target,pc_pos[i]) < 11) && (ADVEN[i].main_status == 1)) damage_pc(i, get_ran(2 + dist(target,pc_pos[i]) / 2, 1, 6), DAMAGE_UNBLOCKABLE,MONSTER_TYPE_UNKNOWN,0); - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active != 0) && (dist(target,univ.town.monst.dudes[i].m_loc) > 0) && (dist(target,univ.town.monst.dudes[i].m_loc) < 11) && (can_see(target,univ.town.monst.dudes[i].m_loc,0) < 5)) @@ -3777,7 +3777,7 @@ void radius_damage(location target,short radius, short dam, eDamageType type)/// if ((dist(target,univ.town.p_loc) > 0) && (dist(target,univ.town.p_loc) <= radius) && (ADVEN[i].main_status == 1)) damage_pc(i, dam, type,MONSTER_TYPE_UNKNOWN,0); - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active != 0) && (dist(target,univ.town.monst.dudes[i].m_loc) > 0) && (dist(target,univ.town.monst.dudes[i].m_loc) <= radius) && (can_see(target,univ.town.monst.dudes[i].m_loc,0) < 5)) @@ -3790,7 +3790,7 @@ void radius_damage(location target,short radius, short dam, eDamageType type)/// if ((dist(target,pc_pos[i]) > 0) && (dist(target,pc_pos[i]) <= radius) && (ADVEN[i].main_status == 1)) damage_pc(i, dam, type,MONSTER_TYPE_UNKNOWN,0); - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active != 0) && (dist(target,univ.town.monst.dudes[i].m_loc) > 0) && (dist(target,univ.town.monst.dudes[i].m_loc) <= radius) && (can_see(target,univ.town.monst.dudes[i].m_loc,0) < 5)) @@ -3841,7 +3841,7 @@ void hit_space(location target,short dam,eDamageType type,short report,short hit return; } - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((hit_monsters == true) && (univ.town.monst.dudes[i].active != 0) && (stop_hitting == false)) if (monst_on_space(target,i)) { if (processing_fields == true) @@ -4005,7 +4005,7 @@ bool out_monst_all_dead() { short i; - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].attitude % 2 == 1)) { //print_nums(5555,i,univ.town.monst.dudes[i].number); //print_nums(5555,univ.town.monst.dudes[i].m_loc.x,univ.town.monst.dudes[i].m_loc.y); @@ -4192,7 +4192,7 @@ bool combat_cast_mage_spell() case 56: sprintf ((char *) c_line, " Enemy paralyzed: ");break; } add_string_to_buf((char *) c_line); - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].attitude % 2 == 1) && (dist(pc_pos[current_pc],univ.town.monst.dudes[i].m_loc) <= mage_range[spell_num]) && (can_see(pc_pos[current_pc],univ.town.monst.dudes[i].m_loc,0) < 5)) { @@ -4343,7 +4343,7 @@ bool combat_cast_priest_spell() case 31: case 51: case 53: ADVEN[current_pc].cur_sp -= s_cost[1][spell_num]; store_sound = 24; - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { if ((univ.town.monst.dudes[i].active != 0) &&(univ.town.monst.dudes[i].attitude % 2 == 1) && (dist(pc_pos[current_pc],univ.town.monst.dudes[i].m_loc) <= priest_range[spell_num])) { which_m = &univ.town.monst.dudes[i]; @@ -4510,9 +4510,9 @@ void process_fields() return; if (quickfire) { //// - r = univ.town.town->in_town_rect; - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) + r = univ.town->in_town_rect; + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) qf[i][j] = (is_quickfire(i,j)) ? 2 : 0; for (k = 0; k < ((is_combat()) ? 4 : 1); k++) { for (i = r.left + 1; i < r.right ; i++) @@ -4534,7 +4534,7 @@ void process_fields() } } - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].active > 0) monst_inflict_fields(i); @@ -4542,8 +4542,8 @@ void process_fields() processing_fields = true; // this, in hit_space, makes damage considered to come from whole party if (force_wall) { force_wall = false; - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) if (is_force_wall(i,j)) { r1 = get_ran(3,1,6); loc.x = i; loc.y = j; @@ -4558,8 +4558,8 @@ void process_fields() } if (fire_wall) { fire_wall = false; - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) if (is_fire_wall(i,j)) { loc.x = i; loc.y = j; r1 = get_ran(2,1,6) + 1; @@ -4574,8 +4574,8 @@ void process_fields() } if (antimagic) { antimagic = false; - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) if (is_antimagic(i,j)) { r1 = get_ran(1,1,8); if (r1 == 2) @@ -4585,8 +4585,8 @@ void process_fields() } if (scloud) { scloud = false; - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) if (is_scloud(i,j)) { r1 = get_ran(1,1,4); if (r1 == 2) @@ -4599,8 +4599,8 @@ void process_fields() } if (sleep_field) { sleep_field = false; - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) if (is_sleep_cloud(i,j)) { r1 = get_ran(1,1,4); if (r1 == 2) @@ -4613,8 +4613,8 @@ void process_fields() } if (ice_wall) { ice_wall = false; - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) if (is_ice_wall(i,j)) { loc.x = i; loc.y = j; r1 = get_ran(3,1,6); @@ -4629,8 +4629,8 @@ void process_fields() } if (blade_wall) { blade_wall = false; - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) if (is_blade_wall(i,j)) { loc.x = i; loc.y = j; r1 = get_ran(6,1,8); @@ -4649,8 +4649,8 @@ void process_fields() // in hit_space if (quickfire) { - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) if (is_quickfire(i,j)) { loc.x = i; loc.y = j; r1 = get_ran(2,1,8); diff --git a/osx/boe.consts.h b/osx/boe.consts.h index 05a45fd8..57a26513 100644 --- a/osx/boe.consts.h +++ b/osx/boe.consts.h @@ -37,7 +37,6 @@ #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_ 304][9 #define SDF_PARTY_STEALTHY 305][0 #define SDF_PARTY_FLIGHT 305][1 #define SDF_PARTY_DETECT_LIFE 305][2 @@ -257,7 +256,7 @@ enum eTrapType { TRAP_GAS = 3, // poisons all TRAP_EXPLOSION = 4, // damages all => uses c_town.difficulty rather than trap_level to calculates damages (and even c_town.difficulty /13). TRAP_SLEEP_RAY = 5, - TRAP_false_ALARM = 6, + TRAP_FALSE_ALARM = 6, TRAP_DRAIN_XP = 7, TRAP_ALERT = 8, // makes town hostile TRAP_FLAMES = 9, // damages all => uses trap_level (*5) to calculates damages. diff --git a/osx/boe.dlgutil.cpp b/osx/boe.dlgutil.cpp index a5c54892..a2b92b9a 100644 --- a/osx/boe.dlgutil.cpp +++ b/osx/boe.dlgutil.cpp @@ -539,7 +539,7 @@ void start_talk_mode(short m_num,short personality,unsigned char monst_type,shor // first make sure relevant talk strs are loaded in if (personality / 10 != univ.town.cur_talk_loaded){ - if(personality / 10 == univ.town.num) univ.town.cur_talk = &univ.town.town->talking; + if(personality / 10 == univ.town.num) univ.town.cur_talk = &univ.town->talking; else load_town(personality / 10,*univ.town.cur_talk); univ.town.cur_talk_loaded = personality / 10; } @@ -1145,7 +1145,7 @@ void do_sign(short town_num, short which_sign, short sign_type,location sign_loc load_outdoor_str(loc(town_num % scenario.out_width, town_num / scenario.out_width),which_sign + 100,(char *) sign_text); } else { - sprintf((char *) sign_text,"%s",univ.town.town->town_strs(120 + which_sign)); + sprintf((char *) sign_text,"%s",univ.town->town_strs(120 + which_sign)); } csit(1014,2,(char *) sign_text); diff --git a/osx/boe.fields.cpp b/osx/boe.fields.cpp index 77dd1e91..bbf64cb2 100644 --- a/osx/boe.fields.cpp +++ b/osx/boe.fields.cpp @@ -18,7 +18,7 @@ extern unsigned char combat_terrain[64][64]; //extern unsigned char out[96][96], univ.out.out_e[96][96]; //extern unsigned char univ.out.misc_i[64][64],univ.out.sfx[64][64]; extern char terrain_blocked[256]; -extern short town_size[3]; +//extern short town_size[3]; extern cScenario scenario; extern cUniverse univ; @@ -401,9 +401,9 @@ void spread_sfx(short type,short prob) { short i,j; - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) - if ((univ.town.town->terrain(i,j) < 5) && (get_ran(1,1,100) <= prob)) + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) + if ((univ.town->terrain(i,j) < 5) && (get_ran(1,1,100) <= prob)) make_sfx(i,j,type); } \ No newline at end of file diff --git a/osx/boe.fileio.cpp b/osx/boe.fileio.cpp index 80d3d31a..f9bf3a39 100644 --- a/osx/boe.fileio.cpp +++ b/osx/boe.fileio.cpp @@ -50,7 +50,7 @@ extern WindowPtr mainPtr; //extern stored_town_maps_type maps; //extern stored_outdoor_maps_type o_maps; //extern big_tr_type t_d; -extern short town_size[3]; +//extern short town_size[3]; extern short town_type,current_pc; extern bool web,crate,barrel,fire_barrier,force_barrier,quickfire,force_wall,fire_wall,antimagic,scloud,ice_wall,blade_wall; extern bool sleep_field; @@ -59,7 +59,7 @@ extern bool sleep_field; //extern unsigned char template_terrain[64][64]; //extern tiny_tr_type anim_t_d; extern bool modeless_exists[18]; -extern location monster_targs[T_M]; +extern location monster_targs[60]; extern DialogPtr modeless_dialogs[18] ; extern short which_combat_type; extern char terrain_blocked[256]; @@ -223,11 +223,11 @@ void finish_load_party(){ load_area_graphics(); } else { - load_town_str(univ.town.num,univ.town.town); - load_town(univ.town.num,univ.town.town); + load_town_str(univ.town.num,univ.town.record); + load_town(univ.town.num,univ.town.record); univ.town.cur_talk_loaded = univ.town.num; - for (int i = 0; i < T_M; i++){ + for (int i = 0; i < univ.town->max_monst(); i++){ monster_targs[i].x = 0; monster_targs[i].y = 0; } @@ -235,8 +235,8 @@ void finish_load_party(){ town_type = scenario.town_size[univ.town.num]; // Set up field booleans - for (int j = 0; j < town_size[town_type]; j++) - for (int k = 0; k < town_size[town_type]; k++) { + for (int j = 0; j < univ.town->max_dim(); j++) + for (int k = 0; k < univ.town->max_dim(); k++) { if (is_web(j,k) == true) web = true; if (is_crate(j,k) == true) @@ -249,8 +249,8 @@ void finish_load_party(){ force_barrier = true; if (is_quickfire(j,k) == true) quickfire = true; - if ((scenario.ter_types[univ.town.town->terrain(j,k)].special >= 16) && - (scenario.ter_types[univ.town.town->terrain(j,k)].special <= 19)) + if ((scenario.ter_types[univ.town->terrain(j,k)].special >= 16) && + (scenario.ter_types[univ.town->terrain(j,k)].special <= 19)) belt_present = true; } force_wall = true; @@ -334,7 +334,7 @@ void do_apple_event_open(FSSpec file_info) void set_terrain(location l, unsigned char terrain_type) { - univ.town.town->terrain(l.x,l.y) = terrain_type; + univ.town->terrain(l.x,l.y) = terrain_type; combat_terrain[l.x][l.y] = terrain_type; } @@ -545,18 +545,18 @@ void init_town(){ // formerly part of load_town univ.out.sfx[i][j] = 0; } for (i = 0; i < 50; i++) - if ((univ.town.town->spec_id[i] >= 0) && (univ.town.town->special_locs[i].x < 100)){ - make_special(univ.town.town->special_locs[i].x,univ.town.town->special_locs[i].y); + if ((univ.town->spec_id[i] >= 0) && (univ.town->special_locs[i].x < 100)){ + make_special(univ.town->special_locs[i].x,univ.town->special_locs[i].y); } for (i = 0; i < 50; i++) { - if ((univ.town.town->preset_fields[i].type > 0) && (univ.town.town->preset_fields[i].type < 9)) - univ.out.misc_i[univ.town.town->preset_fields[i].loc.x][univ.town.town->preset_fields[i].loc.y] = - univ.out.misc_i[univ.town.town->preset_fields[i].loc.x][univ.town.town->preset_fields[i].loc.y] | - (unsigned char) (s_pow(2,univ.town.town->preset_fields[i].type - 1)); - if ((univ.town.town->preset_fields[i].type >= 14) && (univ.town.town->preset_fields[i].type <= 21)) - univ.out.sfx[univ.town.town->preset_fields[i].loc.x][univ.town.town->preset_fields[i].loc.y] = - univ.out.sfx[univ.town.town->preset_fields[i].loc.x][univ.town.town->preset_fields[i].loc.y] | - (unsigned char) (s_pow(2,univ.town.town->preset_fields[i].type - 14)); + if ((univ.town->preset_fields[i].type > 0) && (univ.town->preset_fields[i].type < 9)) + univ.out.misc_i[univ.town->preset_fields[i].loc.x][univ.town->preset_fields[i].loc.y] = + univ.out.misc_i[univ.town->preset_fields[i].loc.x][univ.town->preset_fields[i].loc.y] | + (unsigned char) (s_pow(2,univ.town->preset_fields[i].type - 1)); + if ((univ.town->preset_fields[i].type >= 14) && (univ.town->preset_fields[i].type <= 21)) + univ.out.sfx[univ.town->preset_fields[i].loc.x][univ.town->preset_fields[i].loc.y] = + univ.out.sfx[univ.town->preset_fields[i].loc.x][univ.town->preset_fields[i].loc.y] | + (unsigned char) (s_pow(2,univ.town->preset_fields[i].type - 14)); } // univ.town.cur_talk_loaded = univ.town.town_num; @@ -1010,7 +1010,7 @@ void start_data_dump() FSWrite(data_dump_file_id, &len, (char *) get_text); } - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { sprintf((char *)get_text," Monster %d Status %d Loc %d %d Number %d Att %d Tf %d\r", (short) i,(short) univ.town.monst.dudes[i].active,(short) univ.town.monst.dudes[i].m_loc.x, (short) univ.town.monst.dudes[i].m_loc.y,(short) univ.town.monst.dudes[i].number, diff --git a/osx/boe.global.h b/osx/boe.global.h index f1c93e48..6944c362 100644 --- a/osx/boe.global.h +++ b/osx/boe.global.h @@ -11,8 +11,6 @@ #define IN_FRONT (WindowPtr)-1L #define NIL 0L -#define T_M 60 - #define NUM_TOWN_ITEMS 115 diff --git a/osx/boe.graphics.cpp b/osx/boe.graphics.cpp index 336d7c81..b32eeb3c 100644 --- a/osx/boe.graphics.cpp +++ b/osx/boe.graphics.cpp @@ -32,7 +32,7 @@ extern short stat_window,give_delays; extern eGameMode overall_mode; extern short current_spell_range,town_type,store_anim_type; extern bool in_startup_mode,anim_onscreen,play_sounds,frills_on,startup_loaded,party_in_memory; -extern short town_size[3]; +//extern short town_size[3]; extern short anim_step; //extern party_record_type univ.party; //extern pc_record_type ADVEN[6]; @@ -599,7 +599,7 @@ void draw_startup_stats() OffsetRect(&to_rect,203,37); char_win_draw_string(mainPtr,to_rect, - "Your univ.party:",0,18,true); + "Your party:",0,18,true); TextSize(12); TextFace(bold); TextFont(geneva_font_num); @@ -1042,7 +1042,7 @@ void put_background() else bg_pict = bg[4]; } else { - if (univ.town.town->lighting_type > 0) { + if (univ.town->lighting_type > 0) { if (univ.party.outdoor_corner.x >= 7) bg_pict = bg[1]; else bg_pict = bg[9]; @@ -1155,16 +1155,16 @@ void draw_text_bar(short mode) } if (is_town()) { for (i = 0; i < 16; i++) - if (loc.in(univ.town.town->room_rect(i))) + if (loc.in(univ.town->room_rect(i))) if ((remember_tiny_text == 200 + i) && (mode == 0)) return; else { - put_text_bar(univ.town.town->town_strs(i + 1)); + put_text_bar(univ.town->town_strs(i + 1)); remember_tiny_text = 200 + i; return; } if (remember_tiny_text != 250) { - put_text_bar((char *) univ.town.town->town_strs(0)); //// + put_text_bar((char *) univ.town->town_strs(0)); //// remember_tiny_text = 250; } @@ -1177,7 +1177,7 @@ void draw_text_bar(short mode) } if ((is_combat()) && (monsters_going == true)) // Print bar for 1st monster with >0 ap - // that is monster that is going - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].m_d.ap > 0)) { print_monster_going((char *) combat_string,univ.town.monst.dudes[i].number,univ.town.monst.dudes[i].m_d.ap); put_text_bar((char *) combat_string); @@ -1469,23 +1469,23 @@ void add_monst_graphic(unsigned char m,short mode)//// void load_town_graphics() // Setting up town monsters takes some finess, due to the flexibility // of the situation -// This can be used for town or beginning univ.out.out outdoor combat +// This can be used for town or beginning outdoor combat { short i,j; - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) if (is_combat()) add_terrain_to_wish_list(combat_terrain[i][j]); - else add_terrain_to_wish_list(univ.town.town->terrain(i,j)); + else add_terrain_to_wish_list(univ.town->terrain(i,j)); - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].number != 0) && (univ.town.monst.dudes[i].active > 0)) add_monst_graphic(univ.town.monst.dudes[i].number,0); if (is_town()) for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) { - add_monst_graphic(univ.town.town->wandering[i].monst[j],0); + add_monst_graphic(univ.town->wandering[i].monst[j],0); } } @@ -1833,8 +1833,8 @@ void draw_terrain(short mode) where_draw.y += j - 6; if (!(is_out())) light_area[i][j] = (is_town()) ? pt_in_light(view_loc,where_draw) : combat_pt_in_light(where_draw); - if (!(is_out()) && ((where_draw.x < 0) || (where_draw.x > town_size[town_type] - 1) - || (where_draw.y < 0) || (where_draw.y > town_size[town_type] - 1))) + if (!(is_out()) && ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1) + || (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1))) unexplored_area[i][j] = 0; else unexplored_area[i][j] = 1 - is_explored(where_draw.x,where_draw.y); } @@ -1848,18 +1848,18 @@ void draw_terrain(short mode) off_terrain = false; draw_trim = true; - if (!(is_out()) && ((where_draw.x < 0) || (where_draw.x > town_size[town_type] - 1) - || (where_draw.y < 0) || (where_draw.y > town_size[town_type] - 1))) { + if (!(is_out()) && ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1) + || (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1))) { draw_trim = false; // Warning - this section changes where_draw if (where_draw.x < 0) where_draw.x = -1; - if (where_draw.x > town_size[town_type] - 1) - where_draw.x = town_size[town_type]; + if (where_draw.x > univ.town->max_dim() - 1) + where_draw.x = univ.town->max_dim(); if (where_draw.y < 0) where_draw.y = -1; - if (where_draw.y > town_size[town_type] - 1) - where_draw.y = town_size[town_type]; + if (where_draw.y > univ.town->max_dim() - 1) + where_draw.y = univ.town->max_dim(); if (can_see(view_loc,where_draw,0) < 5) can_draw = 1; else can_draw = 0; @@ -1883,7 +1883,7 @@ void draw_terrain(short mode) && (party_can_see(where_draw) < 6)) ? 1 : 0; } else { - spec_terrain = univ.town.town->terrain(where_draw.x,where_draw.y); + spec_terrain = univ.town->terrain(where_draw.x,where_draw.y); can_draw = is_explored(where_draw.x,where_draw.y); if (can_draw > 0) { @@ -2076,9 +2076,9 @@ void place_trim(short q,short r,location where,unsigned char ter_type) at_bot = true; } else { - if (where.x == town_size[town_type]) + if (where.x == univ.town->max_dim()) at_right = true; - if (where.y == town_size[town_type]) + if (where.y == univ.town->max_dim()) at_bot = true; } @@ -2268,18 +2268,18 @@ void place_road(short q,short r,location where) rect_draw_some_item (fields_gworld, road_rects[1], terrain_screen_gworld, to_rect, 0, 0); } - if (((is_out()) && (where.x < 96)) || (!(is_out()) && (where.x < town_size[town_type] - 1))) + if (((is_out()) && (where.x < 96)) || (!(is_out()) && (where.x < univ.town->max_dim() - 1))) ter = coord_to_ter(where.x + 1,where.y); - if (((is_out()) && (where.x == 96)) || (!(is_out()) && (where.x == town_size[town_type] - 1)) + if (((is_out()) && (where.x == 96)) || (!(is_out()) && (where.x == univ.town->max_dim() - 1)) || (extend_road_terrain(ter) == true)) { to_rect = road_dest_rects[1]; OffsetRect(&to_rect,13 + q * 28,13 + r * 36); rect_draw_some_item (fields_gworld, road_rects[0], terrain_screen_gworld, to_rect, 0, 0); } - if (((is_out()) && (where.y < 96)) || (!(is_out()) && (where.y < town_size[town_type] - 1))) + if (((is_out()) && (where.y < 96)) || (!(is_out()) && (where.y < univ.town->max_dim() - 1))) ter = coord_to_ter(where.x,where.y + 1); - if (((is_out()) && (where.y == 96)) || (!(is_out()) && (where.y == town_size[town_type] - 1)) + if (((is_out()) && (where.y == 96)) || (!(is_out()) && (where.y == univ.town->max_dim() - 1)) || (extend_road_terrain(ter) == true)) { to_rect = road_dest_rects[2]; OffsetRect(&to_rect,13 + q * 28,13 + r * 36); diff --git a/osx/boe.graphutil.cpp b/osx/boe.graphutil.cpp index 9665433e..826348be 100644 --- a/osx/boe.graphutil.cpp +++ b/osx/boe.graphutil.cpp @@ -24,7 +24,7 @@ extern short stat_window,give_delays; extern eGameMode overall_mode; extern short current_spell_range,town_type; extern bool in_startup_mode,anim_onscreen,play_sounds,frills_on,startup_loaded,cartoon_happening; -extern short town_size[3]; +//extern short town_size[3]; //extern cParty party; //extern pc_record_type adven[6]; //extern big_tr_type t_d; @@ -40,7 +40,7 @@ extern bool sleep_field; //extern unsigned char misc_i[64][64],sfx[64][64]; extern short on_monst_menu[256]; extern DialogPtr modeless_dialogs[18]; -extern short monst_target[T_M]; // 0-5 target that pc 6 - no target 100 + x - target monster x +extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x extern short combat_posing_monster , current_working_monster ; // 0-5 PC 100 + x - monster x //extern piles_of_stuff_dumping_type *data_store; @@ -290,7 +290,7 @@ void draw_monsters() //// } } if (is_town()) - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].m_d.spec_skill != 11)) if (party_can_see_monst(i)) { check_if_monst_seen(univ.town.monst.dudes[i].number); @@ -314,7 +314,7 @@ void draw_monsters() //// if (univ.town.monst.dudes[i].m_d.picture_num < 1000) { source_rect = get_monster_template_rect(univ.town.monst.dudes[i].number, ((univ.town.monst.dudes[i].m_d.direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0),k); - ter = univ.town.town->terrain(univ.town.monst.dudes[i].m_loc.x,univ.town.monst.dudes[i].m_loc.y); + ter = univ.town->terrain(univ.town.monst.dudes[i].m_loc.x,univ.town.monst.dudes[i].m_loc.y); // in bed? if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && (scenario.ter_types[ter].picture == 143) && @@ -328,7 +328,7 @@ void draw_monsters() //// } } if (is_combat()) { - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].m_d.spec_skill != 11)) if (((point_onscreen(center,univ.town.monst.dudes[i].m_loc) == true) && (cartoon_happening == true)) || (party_can_see_monst(i) == true)) { @@ -352,7 +352,7 @@ void draw_monsters() //// source_rect = get_monster_template_rect(univ.town.monst.dudes[i].number, ((univ.town.monst.dudes[i].m_d.direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0) ,k); - ter = univ.town.town->terrain(univ.town.monst.dudes[i].m_loc.x,univ.town.monst.dudes[i].m_loc.y); + ter = univ.town->terrain(univ.town.monst.dudes[i].m_loc.x,univ.town.monst.dudes[i].m_loc.y); if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && (scenario.ter_types[ter].picture == 143) && ((univ.town.monst.dudes[i].m_d.m_type < 7) @@ -586,8 +586,8 @@ void draw_sfx() { where_draw = center;where_draw.x += q - 4;where_draw.y += r - 4; - if ((where_draw.x < 0) || (where_draw.x > town_size[town_type] - 1) - || (where_draw.y < 0) || (where_draw.y > town_size[town_type] - 1)) + if ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1) + || (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1)) ; else if (univ.out.sfx[where_draw.x][where_draw.y] != 0) { for (i = 0; i < 8; i++) { @@ -617,8 +617,8 @@ void draw_one_field(unsigned char flag,short source_x,short source_y) { where_draw = center;where_draw.x += q - 4;where_draw.y += r - 4; - if ((where_draw.x < 0) || (where_draw.x > town_size[town_type] - 1) - || (where_draw.y < 0) || (where_draw.y > town_size[town_type] - 1)) + if ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1) + || (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1)) ; else { if (univ.out.misc_i[where_draw.x][where_draw.y] & flag) @@ -644,10 +644,12 @@ void draw_one_spec_item(unsigned char flag,short source_x,short source_y) for (q = 0; q < 9; q++) for (r = 0; r < 9; r++) { - where_draw = center;where_draw.x += q - 4;where_draw.y += r - 4; + where_draw = center; + where_draw.x += q - 4; + where_draw.y += r - 4; - if ((where_draw.x < 0) || (where_draw.x > town_size[town_type] - 1) - || (where_draw.y < 0) || (where_draw.y > town_size[town_type] - 1)) + if ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1) + || (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1)) ; else { if (univ.town.explored[where_draw.x][where_draw.y] & flag) @@ -688,7 +690,7 @@ void draw_party_symbol(short mode,location center) source_rect = get_party_template_rect(i,(univ.party.direction < 4) ? 0 : 1); // now wedge in bed graphic - if ((is_town()) && (scenario.ter_types[univ.town.town->terrain(univ.town.p_loc.x,univ.town.p_loc.y)].picture == 143)) + if ((is_town()) && (scenario.ter_types[univ.town->terrain(univ.town.p_loc.x,univ.town.p_loc.y)].picture == 143)) draw_one_terrain_spot((short) target.x,(short) target.y,10230,0); //// else Draw_Some_Item(party_template_gworld, source_rect, terrain_screen_gworld, target, 1, 0); } @@ -813,7 +815,7 @@ unsigned char get_t_t(char x,char y) // returns terrain type at where if (is_out()) return univ.out.out[x][y]; else if (is_town()) - return univ.town.town->terrain(x,y); + return univ.town->terrain(x,y); else return combat_terrain[x][y]; } @@ -884,12 +886,12 @@ void make_town_trim(short mode) store_mode = overall_mode; overall_mode = (mode == 0) ? MODE_TOWN : MODE_COMBAT; - for (where.x = 0; where.x < town_size[town_type]; where.x++) - for (where.y = 0; where.y < town_size[town_type]; where.y++) + for (where.x = 0; where.x < univ.town->max_dim(); where.x++) + for (where.y = 0; where.y < univ.town->max_dim(); where.y++) town_trim[where.x][where.y] = add_trim_to_array(where, - (mode == 0) ? univ.town.town->terrain(where.x,where.y) : combat_terrain[where.x][where.y]); - for (where.x = 0; where.x < town_size[town_type]; where.x++) - for (where.y = 0; where.y < town_size[town_type]; where.y++) { + (mode == 0) ? univ.town->terrain(where.x,where.y) : combat_terrain[where.x][where.y]); + for (where.x = 0; where.x < univ.town->max_dim(); where.x++) + for (where.y = 0; where.y < univ.town->max_dim(); where.y++) { if (town_trim[where.x][where.y] & 1) town_trim[where.x][where.y] &= 125; if (town_trim[where.x][where.y] & 4) @@ -945,9 +947,9 @@ char add_trim_to_array(location where,unsigned char ter_type) at_bot = true; } else { - if (where.x == town_size[town_type] - 1) + if (where.x == univ.town->max_dim() - 1) at_right = true; - if (where.y == town_size[town_type] - 1) + if (where.y == univ.town->max_dim() - 1) at_bot = true; } diff --git a/osx/boe.infodlg.cpp b/osx/boe.infodlg.cpp index 8897ffe5..ea44d01d 100644 --- a/osx/boe.infodlg.cpp +++ b/osx/boe.infodlg.cpp @@ -1077,7 +1077,7 @@ void put_talk() csit(960,9,""); if ((personality = univ.party.talk_save[store_page_on].personality) >= 0) { if (personality / 10 != univ.town.cur_talk_loaded){ - if(personality / 10 == univ.town.num) univ.town.cur_talk = &univ.town.town->talking; + if(personality / 10 == univ.town.num) univ.town.cur_talk = &univ.town->talking; else load_town(personality / 10,*univ.town.cur_talk); univ.town.cur_talk_loaded = personality / 10; } diff --git a/osx/boe.items.cpp b/osx/boe.items.cpp index a537cb17..2313db25 100644 --- a/osx/boe.items.cpp +++ b/osx/boe.items.cpp @@ -42,7 +42,7 @@ extern location pc_pos[6]; extern bool modeless_exists[18],diff_depth_ok; extern short modeless_key[18]; extern DialogPtr modeless_dialogs[18]; -extern short town_size[3]; +//extern short town_size[3]; extern short town_type; extern short dialog_answer; @@ -778,7 +778,7 @@ short get_item(location place,short pc_num,bool check_container) bool item_near = false; short mass_get = 1; - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].attitude == 1) && (can_see(place,univ.town.monst.dudes[i].m_loc,0) < 5)) mass_get = 0; @@ -798,11 +798,11 @@ short get_item(location place,short pc_num,bool check_container) } if (item_near == true) if (display_item(place,pc_num,mass_get,check_container) > 0) { // if true, there was a theft - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].attitude % 2 != 1) && (can_see(place,univ.town.monst.dudes[i].m_loc,0) < 5)) { make_town_hostile(); - i = T_M; + i = univ.town->max_monst(); add_string_to_buf("Your crime was seen!"); } } @@ -829,7 +829,7 @@ void make_town_hostile() give_help(53,0,0); univ.town.monst.friendly = 1; //// - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].summoned == 0)){ univ.town.monst.dudes[i].attitude = 1; num = univ.town.monst.dudes[i].number; diff --git a/osx/boe.locutils.cpp b/osx/boe.locutils.cpp index 2ba91efc..df36ac04 100644 --- a/osx/boe.locutils.cpp +++ b/osx/boe.locutils.cpp @@ -15,7 +15,7 @@ char terrain_blocked[256]; short short_can_see(); bool combat_pt_in_light(); -extern short town_size[3]; +//extern short town_size[3]; location obs_sec; location which_party_sec; @@ -117,15 +117,15 @@ location local_to_global(location local) } bool loc_off_world(location p1) { - if ((p1.x < 0) || (p1.x > town_size[town_type]) || (p1.y < 0) || (p1.y > town_size[town_type])) + if ((p1.x < 0) || (p1.x > univ.town->max_dim()) || (p1.y < 0) || (p1.y > univ.town->max_dim())) return true; else return false; } bool loc_off_act_area(location p1) { - if ((p1.x > univ.town.town->in_town_rect.left) && (p1.x < univ.town.town->in_town_rect.right) && - (p1.y > univ.town.town->in_town_rect.top) && (p1.y < univ.town.town->in_town_rect.bottom)) + if ((p1.x > univ.town->in_town_rect.left) && (p1.x < univ.town->in_town_rect.right) && + (p1.y > univ.town->in_town_rect.top) && (p1.y < univ.town->in_town_rect.bottom)) return false; return true; } @@ -307,7 +307,7 @@ unsigned char coord_to_ter(short x,short y) if ((overall_mode == MODE_OUTDOORS) || (overall_mode == MODE_LOOK_OUTDOORS)) what_terrain = univ.out.out[x][y]; else if (((overall_mode > MODE_OUTDOORS) && (overall_mode < MODE_COMBAT))|| (overall_mode == MODE_LOOK_TOWN)) - what_terrain = univ.town.town->terrain(x,y); + what_terrain = univ.town->terrain(x,y); else { what_terrain = combat_terrain[x][y]; } @@ -354,8 +354,8 @@ void update_explored(location dest) if (overall_mode > MODE_OUTDOORS) { make_explored(dest.x,dest.y); - for (look2.x = max(0,dest.x - 4); look2.x < min(town_size[town_type],dest.x + 5); look2.x++) - for (look2.y = max(0,dest.y - 4); look2.y < min(town_size[town_type],dest.y + 5); look2.y++) + for (look2.x = max(0,dest.x - 4); look2.x < min(univ.town->max_dim(),dest.x + 5); look2.x++) + for (look2.y = max(0,dest.y - 4); look2.y < min(univ.town->max_dim(),dest.y + 5); look2.y++) if (is_explored(look2.x,look2.y) == false) if ((can_see(dest, look2,0) < 5) && (pt_in_light(dest,look2) == true)) make_explored(look2.x,look2.y); @@ -383,7 +383,7 @@ bool is_blocked(location to_check) } if ((is_town()) || (is_combat())) { - ter = (is_town()) ? univ.town.town->terrain(to_check.x,to_check.y) : combat_terrain[to_check.x][to_check.y]; + ter = (is_town()) ? univ.town->terrain(to_check.x,to_check.y) : combat_terrain[to_check.x][to_check.y]; gr = scenario.ter_types[ter].picture; //// @@ -437,7 +437,7 @@ short monst_there(location where) // returns 90 if no { short i; - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active != 0) && (monst_on_space(where,i) == true)) return i; return 90; @@ -600,7 +600,7 @@ short light_radius() short extra_levels[6] = {10,20,50,75,110,140}; if (((which_combat_type == 0) && (is_combat())) - || (is_out()) || (univ.town.town->lighting_type == 0)) + || (is_out()) || (univ.town->lighting_type == 0)) return 200; for (i = 0; i < 6; i++) if (univ.party.light_level > extra_levels[i]) @@ -611,12 +611,12 @@ short light_radius() bool pt_in_light(location from_where,location to_where) // Assumes, of course, in town or combat { - if (univ.town.town->lighting_type == 0) + if (univ.town->lighting_type == 0) return true; - if ((to_where.x < 0) || (to_where.x >= town_size[town_type]) - || (to_where.y < 0) || (to_where.y >= town_size[town_type])) + if ((to_where.x < 0) || (to_where.x >= univ.town->max_dim()) + || (to_where.y < 0) || (to_where.y >= univ.town->max_dim())) return true; - if (univ.town.town->lighting(to_where.x / 8,to_where.y) & (char) (s_pow(2,to_where.x % 8))) + if (univ.town->lighting(to_where.x / 8,to_where.y) & (char) (s_pow(2,to_where.x % 8))) return true; if (dist(from_where,to_where) <= light_radius()) @@ -629,12 +629,12 @@ bool combat_pt_in_light(location to_where) { short i,rad; - if ((univ.town.town->lighting_type == 0) || (which_combat_type == 0)) + if ((univ.town->lighting_type == 0) || (which_combat_type == 0)) return true; - if ((to_where.x < 0) || (to_where.x >= town_size[town_type]) - || (to_where.y < 0) || (to_where.y >= town_size[town_type])) + if ((to_where.x < 0) || (to_where.x >= univ.town->max_dim()) + || (to_where.y < 0) || (to_where.y >= univ.town->max_dim())) return true; - if (univ.town.town->lighting(to_where.x / 8,to_where.y) & (char) (s_pow(2,to_where.x % 8))) + if (univ.town->lighting(to_where.x / 8,to_where.y) & (char) (s_pow(2,to_where.x % 8))) return true; rad = light_radius(); @@ -651,7 +651,7 @@ bool party_sees_a_monst() // Returns true is a hostile monster is in sight. { short i; - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { if (univ.town.monst.dudes[i].active > 0) if ((univ.town.monst.dudes[i].attitude == 1) && (party_can_see_monst(i) == true)) @@ -699,17 +699,17 @@ location push_loc(location from_where,location to_where) loc_to_try = to_where; loc_to_try.x = loc_to_try.x + (to_where.x - from_where.x); loc_to_try.y = loc_to_try.y + (to_where.y - from_where.y); - if ((univ.town.town->terrain(loc_to_try.x,loc_to_try.y) == 90) || - ((univ.town.town->terrain(loc_to_try.x,loc_to_try.y) >= 50)&& (univ.town.town->terrain(loc_to_try.x,loc_to_try.y) <= 64)) - || (univ.town.town->terrain(loc_to_try.x,loc_to_try.y) == 71) - || ((univ.town.town->terrain(loc_to_try.x,loc_to_try.y) >= 74)&& (univ.town.town->terrain(loc_to_try.x,loc_to_try.y) <= 78)) + if ((univ.town->terrain(loc_to_try.x,loc_to_try.y) == 90) || + ((univ.town->terrain(loc_to_try.x,loc_to_try.y) >= 50)&& (univ.town->terrain(loc_to_try.x,loc_to_try.y) <= 64)) + || (univ.town->terrain(loc_to_try.x,loc_to_try.y) == 71) + || ((univ.town->terrain(loc_to_try.x,loc_to_try.y) >= 74)&& (univ.town->terrain(loc_to_try.x,loc_to_try.y) <= 78)) ) { // Destroy crate loc_to_try.x = 0; return loc_to_try; } if ((get_obscurity((short) loc_to_try.x,(short) loc_to_try.y) > 0) || - (terrain_blocked[univ.town.town->terrain(loc_to_try.x,loc_to_try.y)] > 0) || + (terrain_blocked[univ.town->terrain(loc_to_try.x,loc_to_try.y)] > 0) || (loc_off_act_area(loc_to_try) == true) || (monst_there(loc_to_try) < 90) || (pc_there(loc_to_try) < 6)) @@ -753,10 +753,10 @@ void alter_space(short i,short j,unsigned char ter) univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].terrain[i][j] = ter; } else { - univ.town.town->terrain(i,j) = ter; + univ.town->terrain(i,j) = ter; combat_terrain[i][j] = ter; - if ((scenario.ter_types[univ.town.town->terrain(i,j)].special >= 16) && - (scenario.ter_types[univ.town.town->terrain(i,j)].special <= 19)) + if ((scenario.ter_types[univ.town->terrain(i,j)].special >= 16) && + (scenario.ter_types[univ.town->terrain(i,j)].special <= 19)) belt_present = true; } } \ No newline at end of file diff --git a/osx/boe.main.cpp b/osx/boe.main.cpp index e9f6d556..075f1fa2 100644 --- a/osx/boe.main.cpp +++ b/osx/boe.main.cpp @@ -82,7 +82,7 @@ bool belt_present = false; //setup_save_type setup_save; //unsigned char misc_i[64][64],sfx[64][64]; ////unsigned char template_terrain[64][64]; -location monster_targs[T_M]; +location monster_targs[60]; // TODO: Integrate this into the town cCreature type //outdoor_strs_type outdoor_text[2][2]; /* Display globals */ @@ -104,7 +104,7 @@ DialogPtr modeless_dialogs[18] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //Rect d_rects[80]; ////short d_rect_index[80]; -short town_size[3] = {64,48,32}; +//short town_size[3] = {64,48,32}; short which_item_page[6] = {0,0,0,0,0,0}; // Remembers which of the 2 item pages pc looked at Point ul = {28,10}; short display_mode = 0; // 0 - center 1- ul 2 - ur 3 - dl 4 - dr 5 - small win @@ -129,7 +129,8 @@ location pc_pos[6]; short current_pc; short combat_active_pc; effect_pat_type current_pat; -short monst_target[T_M]; // 0-5 target that pc 6 - no target 100 + x - target monster x +short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x +// TODO: Integrate this ^ into the town cCreature type short spell_caster, missile_firer,current_monst_tactic; short store_current_pc = 0; @@ -710,7 +711,7 @@ void close_program() { restore_depth(); //end_music(); - if(univ.town.town != NULL) delete univ.town.town; + if(univ.town.loaded()) univ.town.unload(); if(univ.town.cur_talk != NULL) delete univ.town.cur_talk; } diff --git a/osx/boe.monster.cpp b/osx/boe.monster.cpp index a0f21684..a4b445fb 100644 --- a/osx/boe.monster.cpp +++ b/osx/boe.monster.cpp @@ -25,11 +25,11 @@ extern unsigned char combat_terrain[64][64];//,out[96][96]; extern short which_combat_type; //extern pc_record_type ADVEN[6]; //extern big_tr_type t_d; -extern short monst_target[T_M]; // 0-5 target that pc 6 - no target 100 + x - target monster x +extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x extern short spell_caster, missile_firer,current_monst_tactic; extern short hit_chance[21]; //extern unsigned char univ.out.misc_i[64][64]; -extern location monster_targs[T_M]; +extern location monster_targs[60]; extern location pc_pos[6],center; extern short boom_gr[8],futzing; @@ -120,7 +120,7 @@ short count_monst() { short to_ret = 0,i; - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].active > 0) to_ret++; return to_ret; @@ -146,29 +146,29 @@ void create_wand_monst() //// if (overall_mode != MODE_OUTDOORS) // won't place wandering is more than 50 monsters - if ((is_null_wand_entry(univ.town.town->wandering[r1]) == 0) && (count_monst() <= 50) - && (univ.party.m_killed[univ.town.num] < univ.town.town->max_num_monst)) { + if ((is_null_wand_entry(univ.town->wandering[r1]) == 0) && (count_monst() <= 50) + && (univ.party.m_killed[univ.town.num] < univ.town->max_num_monst)) { r2 = get_ran(1,0,3); - while ((point_onscreen(univ.town.town->wandering_locs[r2],univ.town.p_loc) == true) && - (loc_off_act_area(univ.town.town->wandering_locs[r2]) == false) && (num_tries++ < 100)) + while ((point_onscreen(univ.town->wandering_locs[r2],univ.town.p_loc) == true) && + (loc_off_act_area(univ.town->wandering_locs[r2]) == false) && (num_tries++ < 100)) r2 = get_ran(1,0,3); for (i = 0; i < 4; i++) { - if (univ.town.town->wandering[r1].monst[i] != 0) { // place a monster - p_loc = univ.town.town->wandering_locs[r2]; + if (univ.town->wandering[r1].monst[i] != 0) { // place a monster + p_loc = univ.town->wandering_locs[r2]; p_loc.x += get_ran(1,0,4) - 2; p_loc.y += get_ran(1,0,4) - 2; if (is_blocked(p_loc) == false) - place_monster(univ.town.town->wandering[r1].monst[i],p_loc); - p_loc = univ.town.town->wandering_locs[r2]; + place_monster(univ.town->wandering[r1].monst[i],p_loc); + p_loc = univ.town->wandering_locs[r2]; p_loc.x += get_ran(1,0,4) - 2; p_loc.y += get_ran(1,0,4) - 2; if ((r1 >= 2) && (i == 0) && (is_blocked(p_loc) == false)) // place extra monsters? - place_monster(univ.town.town->wandering[r1].monst[i],p_loc); - p_loc = univ.town.town->wandering_locs[r2]; + place_monster(univ.town->wandering[r1].monst[i],p_loc); + p_loc = univ.town->wandering_locs[r2]; p_loc.x += get_ran(1,0,4) - 2; p_loc.y += get_ran(1,0,4) - 2; if ((r1 == 3) && (i == 1) && (is_blocked(p_loc) == false)) - place_monster(univ.town.town->wandering[r1].monst[i],p_loc); + place_monster(univ.town->wandering[r1].monst[i],p_loc); } } } @@ -283,7 +283,7 @@ void set_up_monst(short mode,unsigned char m_num) { short which; - for (which = 0; which < T_M; which++) + for (which = 0; which < univ.town->max_monst(); which++) if (univ.town.monst.dudes[which].active == 0) { univ.town.monst.dudes[which].active = 2; univ.town.monst.dudes[which].summoned = 0; @@ -292,7 +292,7 @@ void set_up_monst(short mode,unsigned char m_num) univ.town.monst.dudes[which].m_d = return_monster_template(m_num); univ.town.monst.dudes[which].mobile = true; univ.town.monst.dudes[which].monst_start = null_start_type; - which = T_M; + which = univ.town->max_monst(); } } @@ -303,7 +303,7 @@ void do_monsters() bool acted_yet = false; if (overall_mode == MODE_TOWN) - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].m_d.status[11] <= 0) && (univ.town.monst.dudes[i].m_d.status[12] <= 0)) { // have to pick targets @@ -373,7 +373,7 @@ void do_monsters() default: play_sound(46); break; } } - for (j = 0; j < T_M; j++) + for (j = 0; j < univ.town->max_monst(); j++) if ((univ.town.monst.dudes[j].active == 2) && ((dist(univ.town.monst.dudes[i].m_loc,univ.town.monst.dudes[j].m_loc) <= 5) == true)) univ.town.monst.dudes[i].active = 2; @@ -505,7 +505,7 @@ short monst_pick_target_monst(cPopulation::cCreature *which_m) { short min_dist = 1000,i,cur_targ = 6; - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { if ((univ.town.monst.dudes[i].active > 0) && // alive (((which_m->attitude % 2 == 1) && (univ.town.monst.dudes[i].attitude % 2 == 0)) || ((which_m->attitude % 2 == 0) && (univ.town.monst.dudes[i].attitude % 2 == 1)) || @@ -583,7 +583,7 @@ short closest_monst(location where,short mode) { short how_close = 200,i,store = 6; - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((((univ.town.monst.dudes[i].attitude % 2 == 1) && (mode == 1)) || ((univ.town.monst.dudes[i].attitude % 2 == 0) && (mode == 2))) && (dist(where,univ.town.monst.dudes[i].m_loc) < how_close)) { @@ -606,7 +606,7 @@ short switch_target_to_adjacent(short which_m,short orig_target) if ((univ.town.monst.dudes[orig_target - 100].active > 0) && (monst_adjacent(univ.town.monst.dudes[orig_target - 100].m_loc,which_m) == true)) return orig_target; - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].attitude % 2 == 1) && (monst_adjacent(univ.town.monst.dudes[i].m_loc,which_m) == true)) @@ -637,7 +637,7 @@ short switch_target_to_adjacent(short which_m,short orig_target) return i; // Check for a nice, adjacent, friendly monster and maybe attack - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].attitude % 2 == 0) && (monst_adjacent(univ.town.monst.dudes[i].m_loc,which_m) == true) && @@ -697,7 +697,7 @@ bool rand_move(char i) if (monster_targs[i].x == 0) { // maybe pick a wand loc, else juist pick a loc j = get_ran(1,0,3); - store_loc = univ.town.town->wandering_locs[j]; + store_loc = univ.town->wandering_locs[j]; if ((loc_off_act_area(store_loc) == false) && (get_ran(1,0,1) == 1)) monster_targs[i] = store_loc; @@ -812,7 +812,7 @@ bool combat_move_monster(short which,location destination) if (is_combat()) move_sound(combat_terrain[destination.x][destination.y], (short) univ.town.monst.dudes[which].m_d.ap); - else move_sound(univ.town.town->terrain(destination.x,destination.y), + else move_sound(univ.town->terrain(destination.x,destination.y), (short) univ.town.monst.dudes[which].m_d.ap); } @@ -1007,7 +1007,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon from_loc = univ.town.monst.dudes[which_monst].m_loc; switch (mode) { case 1: - ter = univ.town.town->terrain(where_check.x,where_check.y); + ter = univ.town->terrain(where_check.x,where_check.y); break; case 2: ter = combat_terrain[where_check.x][where_check.y]; @@ -1136,7 +1136,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon case 1: can_enter = false; if (!(monster_placid(which_monst))) { - univ.town.town->terrain(where_check.x,where_check.y) = scenario.ter_types[ter].flag1; + univ.town->terrain(where_check.x,where_check.y) = scenario.ter_types[ter].flag1; combat_terrain[where_check.x][where_check.y] = scenario.ter_types[ter].flag1; do_look = true; if (point_onscreen(center,where_check)) @@ -1173,7 +1173,7 @@ void forced_place_monster(unsigned char which,location where) bool free_spot = false; short i = 0,r1; - while ((free_spot == false) && (i < T_M)) { + while ((free_spot == false) && (i < univ.town->max_monst())) { if (univ.town.monst.dudes[i].active == 0) free_spot = true; i++; @@ -1340,12 +1340,12 @@ short place_monster(unsigned char which,location where) { short i = 0; - while ((i < T_M) && ((univ.town.monst.dudes[i].active != 0) || + while ((i < univ.town->max_monst()) && ((univ.town.monst.dudes[i].active != 0) || (univ.town.monst.dudes[i].monst_start.spec_enc_code > 0))) { i++; } - if (i < T_M) { + if (i < univ.town->max_monst()) { univ.town.monst.dudes[i].m_d = return_monster_template((unsigned char) which); univ.town.monst.dudes[i].attitude = scenario.scen_monsters[which].default_attitude; if (univ.town.monst.dudes[i].attitude % 2 == 0) @@ -1403,7 +1403,7 @@ bool summon_monster(unsigned char which,location where,short duration,short give } spot = place_monster(which,loc); - if (spot >= T_M) { + if (spot >= univ.town->max_monst()) { if (duration < 100) add_string_to_buf(" Too many monsters."); //ASB(" Monster fails to summon monster."); @@ -1431,16 +1431,16 @@ void activate_monsters(short code,short attitude) if (code == 0) return; - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].monst_start.spec_enc_code == code) { univ.town.monst.dudes[i].monst_start.spec_enc_code = 0; univ.town.monst.dudes[i].active = 2; which = univ.town.monst.dudes[i].number; - univ.town.monst.dudes[i].attitude = univ.town.town->creatures(i).start_attitude; + univ.town.monst.dudes[i].attitude = univ.town->creatures(i).start_attitude; univ.town.monst.dudes[i].summoned = 0; - univ.town.monst.dudes[i].m_loc = univ.town.town->creatures(i).start_loc; + univ.town.monst.dudes[i].m_loc = univ.town->creatures(i).start_loc; univ.town.monst.dudes[i].m_d = return_monster_template(univ.town.monst.dudes[i].number); monst_target[i] = 6; diff --git a/osx/boe.newgraph.cpp b/osx/boe.newgraph.cpp index 112a7669..63fb0ce0 100644 --- a/osx/boe.newgraph.cpp +++ b/osx/boe.newgraph.cpp @@ -56,7 +56,7 @@ extern Rect sbar_rect,item_sbar_rect,shop_sbar_rect; extern ControlHandle text_sbar,item_sbar,shop_sbar; extern location center; extern short pc_marked_damage[6],pc_dir[6]; -extern short monst_marked_damage[T_M]; +extern short monst_marked_damage[60]; extern location pc_pos[6]; //extern current_town_type univ.town; //extern big_tr_type t_d; @@ -133,11 +133,11 @@ extern location anim_str_loc; // if < 6; target PC, if >= 100, targ monst, if 6, go to anim_pc_loc short anim_pc_targets[6]; -short anim_monst_targets[T_M]; +short anim_monst_targets[60]; short anim_pcs[6]; -location anim_pc_locs[6],anim_monst_locs[T_M]; +location anim_pc_locs[6],anim_monst_locs[60]; location anim_string_loc; char anim_string[60]; char last_light_mask[13][13]; @@ -155,7 +155,7 @@ void apply_unseen_mask() if ((is_combat()) && (which_combat_type == 0)) return; - if (!(is_out()) && (univ.town.town->lighting_type > 0)) + if (!(is_out()) && (univ.town->lighting_type > 0)) return; for (i = 0; i < 11; i++) @@ -208,7 +208,7 @@ void apply_light_mask() return; if (is_out()) return; - if (univ.town.town->lighting_type == 0) + if (univ.town->lighting_type == 0) return; if (oval_region == NULL) { @@ -311,7 +311,7 @@ void start_missile_anim() } for (i = 0; i < 6; i++) pc_marked_damage[i] = 0; - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) monst_marked_damage[i] = 0; have_missile = false; have_boom = false; diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index fd0b1708..6f5f9eaf 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -108,7 +108,7 @@ Str255 empty_string = " "; extern bool fast_bang; //extern party_record_type party; //extern pc_record_type ADVEN[6]; -extern short stat_window,current_pc,town_size[3],town_type; +extern short stat_window,current_pc/*,town_size[3]*/,town_type; extern eGameMode overall_mode; //extern current_town_type univ.town; //extern big_tr_type t_d; @@ -141,7 +141,7 @@ extern short on_spell_menu[2][62]; extern short mage_need_select[62]; extern short priest_need_select[62]; extern short pc_marked_damage[6]; -extern short monst_marked_damage[T_M]; +extern short monst_marked_damage[60]; extern location golem_m_locs[16]; //extern town_item_list t_i; extern cScenario scenario; @@ -1516,7 +1516,7 @@ void do_mage_spell(short pc_num,short spell_num) item = pc_has_abil(pc_num,158);//// if (item == 24) add_string_to_buf(" You need a sapphire. "); - else if (univ.town.town->specials2 & 1) + else if (univ.town->specials2 & 1) add_string_to_buf(" The spell fails. "); else { remove_charge(pc_num,item); @@ -1992,10 +1992,10 @@ void cast_town_spell(location where) //// location loc; unsigned char ter; - if ((where.x <= univ.town.town->in_town_rect.left) || - (where.x >= univ.town.town->in_town_rect.right) || - (where.y <= univ.town.town->in_town_rect.top) || - (where.y >= univ.town.town->in_town_rect.bottom)) { + if ((where.x <= univ.town->in_town_rect.left) || + (where.x >= univ.town->in_town_rect.right) || + (where.y <= univ.town->in_town_rect.top) || + (where.y >= univ.town->in_town_rect.bottom)) { add_string_to_buf(" Can't target outside town."); return; } @@ -2004,14 +2004,14 @@ void cast_town_spell(location where) //// if (town_spell < 1000) ADVEN[who_cast].cur_sp -= spell_cost[town_spell / 100][town_spell % 100]; else town_spell -= 1000; - ter = univ.town.town->terrain(where.x,where.y); + ter = univ.town->terrain(where.x,where.y); if (adjust > 4) add_string_to_buf(" Can't see target. "); else switch (town_spell) { case 7: case 34: // Scry, Capture Soul targ = monst_there(where); - if (targ < T_M) { + if (targ < univ.town->max_monst()) { if (town_spell == 7) { univ.party.m_seen[univ.town.monst.dudes[targ].number] = true; adjust_monst_menu(); @@ -2060,8 +2060,8 @@ void cast_town_spell(location where) //// case 51: // am cloud add_string_to_buf(" You create an antimagic cloud. "); - for (loc.x = 0; loc.x < town_size[town_type]; loc.x++) - for (loc.y = 0; loc.y < town_size[town_type]; loc.y++) + for (loc.x = 0; loc.x < univ.town->max_dim(); loc.x++) + for (loc.y = 0; loc.y < univ.town->max_dim(); loc.y++) if ((dist(where,loc) <= 2) && (can_see(where,loc,2) < 5) && ((abs(loc.x - where.x) < 2) || (abs(loc.y - where.y) < 2))) make_antimagic(loc.x,loc.y); @@ -2081,7 +2081,7 @@ void cast_town_spell(location where) //// if (r1 < (135 - combat_percent[min(19,ADVEN[who_cast].level)])) { add_string_to_buf(" Door unlocked. "); play_sound(9); - univ.town.town->terrain(where.x,where.y) = scenario.ter_types[ter].flag1; + univ.town->terrain(where.x,where.y) = scenario.ter_types[ter].flag1; } else { play_sound(41); @@ -2127,10 +2127,10 @@ void sanctify_space(location where) short i,s1,s2,s3; for (i = 0; i < 50; i++) - if ((where == univ.town.town->special_locs[i]) && - (univ.town.town->spec_id[i] >= 0)) { - if (univ.town.town->specials[univ.town.town->spec_id[i]].type == 24) - run_special(16,2,univ.town.town->spec_id[i],where,&s1,&s2,&s3); + if ((where == univ.town->special_locs[i]) && + (univ.town->spec_id[i] >= 0)) { + if (univ.town->specials[univ.town->spec_id[i]].type == 24) + run_special(16,2,univ.town->spec_id[i],where,&s1,&s2,&s3); return; } add_string_to_buf(" Nothing happens."); @@ -2142,10 +2142,10 @@ void crumble_wall(location where) if (loc_off_act_area(where) == true) return; - ter = univ.town.town->terrain(where.x,where.y); + ter = univ.town->terrain(where.x,where.y); if (scenario.ter_types[ter].special == 7) { play_sound(60); - univ.town.town->terrain(where.x,where.y) = scenario.ter_types[ter].flag1; + univ.town->terrain(where.x,where.y) = scenario.ter_types[ter].flag1; add_string_to_buf(" Barrier crumbles."); } diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index d188d8bf..49500cc0 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -44,10 +44,10 @@ extern effect_pat_type current_pat; //extern town_item_list univ.town; extern cOutdoors::cWandering store_wandering_special; extern short pc_marked_damage[6]; -extern short monst_marked_damage[T_M]; +extern short monst_marked_damage[60]; extern DialogPtr modeless_dialogs[18]; extern bool fast_bang,end_scenario; -extern short town_size[3]; +//extern short town_size[3]; extern short town_type; extern cScenario scenario; extern cUniverse univ; @@ -102,8 +102,8 @@ bool town_specials(short which,short t_num) location l; - l = univ.town.town->special_locs[which]; - spec_id = univ.town.town->spec_id[which]; + l = univ.town->special_locs[which]; + spec_id = univ.town->spec_id[which]; if (spec_id < 0) return true; @@ -160,7 +160,7 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short from_loc = univ.party.p_loc; break; case 1: - ter = univ.town.town->terrain(where_check.x,where_check.y); + ter = univ.town->terrain(where_check.x,where_check.y); from_loc = univ.town.p_loc; break; case 2: @@ -216,16 +216,16 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short return false; } for (i = 0; i < 50; i++) - if ((where_check == univ.town.town->special_locs[i]) && - (univ.town.town->spec_id[i] >= 0)) { - if (univ.town.town->specials[univ.town.town->spec_id[i]].type == 4) { + if ((where_check == univ.town->special_locs[i]) && + (univ.town->spec_id[i] >= 0)) { + if (univ.town->specials[univ.town->spec_id[i]].type == 4) { *forced = true; } - *spec_num = univ.town.town->spec_id[i]; + *spec_num = univ.town->spec_id[i]; if ((is_blocked(where_check) == false) || (ter_special == 1) || (ter_special == 12) || (ter_special == 13)) { give_help(54,0,0); - run_special(mode,2,univ.town.town->spec_id[i],where_check,&s1,&s2,&s3); + run_special(mode,2,univ.town->spec_id[i],where_check,&s1,&s2,&s3); if (s1 > 0) can_enter = false; } @@ -849,7 +849,7 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, break; case 130: ASB("It throbs, and emits odd rays."); - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].attitude % 2 == 1) && (dist(pc_pos[current_pc],univ.town.monst.dudes[i].m_loc) <= 8) && (can_see(pc_pos[current_pc],univ.town.monst.dudes[i].m_loc,0) < 5)) { @@ -859,13 +859,13 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, } break; case 131: - if (univ.town.town->specials2 & 1) { + if (univ.town->specials2 & 1) { add_string_to_buf(" It doesn't work."); break; } add_string_to_buf(" You have a vision. "); - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) make_explored(i,j); clear_map(); break; @@ -918,7 +918,7 @@ bool use_space(location where) location from_loc,to_loc; - ter = univ.town.town->terrain(where.x,where.y); + ter = univ.town->terrain(where.x,where.y); from_loc = univ.town.p_loc; add_string_to_buf("Use..."); @@ -991,14 +991,14 @@ bool adj_town_look(location where) (where == univ.town.items[i].item_loc)) item_there = true; - terrain = univ.town.town->terrain(where.x,where.y); + terrain = univ.town->terrain(where.x,where.y); if (special(where.x,where.y)) {// && (get_blockage(terrain) > 0)) { if (adjacent(univ.town.p_loc,where) == false) add_string_to_buf(" Not close enough to search."); else { for (i = 0; i < 50; i++) - if (where == univ.town.town->special_locs[i]) { - if (get_blockage(univ.town.town->terrain(where.x,where.y)) > 0) { + if (where == univ.town->special_locs[i]) { + if (get_blockage(univ.town->terrain(where.x,where.y)) > 0) { // tell party you find something, if looking at a space they can't step in //if (univ.town.town.special_id[i] >= 10) // add_string_to_buf(" Search: You find something! "); @@ -1007,7 +1007,7 @@ bool adj_town_look(location where) } //call special can_open = town_specials(i,univ.town.town_num); - run_special(4,2,univ.town.town->spec_id[i],where,&s1,&s2,&s3); + run_special(4,2,univ.town->spec_id[i],where,&s1,&s2,&s3); if (s1 > 0) can_open = false; got_special = true; @@ -1424,10 +1424,10 @@ void push_things()//// if (belt_present == false) return; - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].active > 0) { l = univ.town.monst.dudes[i].m_loc; - ter = univ.town.town->terrain(l.x,l.y); + ter = univ.town->terrain(l.x,l.y); switch (scenario.ter_types[ter].special) { case 16: l.y--; break; case 17: l.x++; break; @@ -1444,7 +1444,7 @@ void push_things()//// for (i = 0; i < NUM_TOWN_ITEMS; i++) if (univ.town.items[i].variety > 0) { l = univ.town.items[i].item_loc; - ter = univ.town.town->terrain(l.x,l.y); + ter = univ.town->terrain(l.x,l.y); switch (scenario.ter_types[ter].special) { case 16: l.y--; break; case 17: l.x++; break; @@ -1460,7 +1460,7 @@ void push_things()//// } if (is_town()) { - ter = univ.town.town->terrain(univ.town.p_loc.x,univ.town.p_loc.y); + ter = univ.town->terrain(univ.town.p_loc.x,univ.town.p_loc.y); l = univ.town.p_loc; switch (scenario.ter_types[ter].special) { case 16: l.y--; break; @@ -1475,7 +1475,7 @@ void push_things()//// center = l; univ.town.p_loc = l; update_explored(l); - ter = univ.town.town->terrain(univ.town.p_loc.x,univ.town.p_loc.y); + ter = univ.town->terrain(univ.town.p_loc.x,univ.town.p_loc.y); draw_map(modeless_dialogs[5],5); if (is_barrel(univ.town.p_loc.x,univ.town.p_loc.y)) { take_barrel(univ.town.p_loc.x,univ.town.p_loc.y); @@ -1495,7 +1495,7 @@ void push_things()//// if (is_combat()) { for (i = 0; i < 6; i++) if (ADVEN[i].main_status == 1) { - ter = univ.town.town->terrain(pc_pos[i].x,pc_pos[i].y); + ter = univ.town->terrain(pc_pos[i].x,pc_pos[i].y); l = pc_pos[i]; switch (scenario.ter_types[ter].special) { case 16: l.y--; break; @@ -1505,7 +1505,7 @@ void push_things()//// } if (l != pc_pos[i]) { ASB("Someone gets pushed."); - ter = univ.town.town->terrain(l.x,l.y); + ter = univ.town->terrain(l.x,l.y); if (scenario.ter_types[ter].special >= 16) draw_terrain(0); pc_pos[i] = l; @@ -1540,9 +1540,9 @@ void special_increase_age() location null_loc; for (i = 0; i < 8; i++) - if ((univ.town.town->timer_spec_times[i] > 0) && (univ.party.age % univ.town.town->timer_spec_times[i] == 0) + if ((univ.town->timer_spec_times[i] > 0) && (univ.party.age % univ.town->timer_spec_times[i] == 0) && ((is_town() == true) || ((is_combat() == true) && (which_combat_type == 1)))) { - run_special(9,2,univ.town.town->timer_specs[i],null_loc,&s1,&s2,&s3); + run_special(9,2,univ.town->timer_specs[i],null_loc,&s1,&s2,&s3); stat_area = true; if (s3 > 0) redraw = true; @@ -1691,7 +1691,7 @@ cSpecial get_node(short cur_spec,short cur_spec_type) give_error("The scenario called a town special node univ.out.out of range.","",0); return dummy_node; } - return univ.town.town->specials[cur_spec]; + return univ.town->specials[cur_spec]; } return dummy_node; } @@ -2317,7 +2317,7 @@ void ifthen_spec(short which_mode,cSpecial cur_node,short cur_spec_type, else give_error("A Stuff Done flag is univ.out.out of range.","",0); break; case 135: - if (((is_town()) || (is_combat())) && (univ.town.town->terrain(spec.ex1a,spec.ex1b) == spec.ex2a)) + if (((is_town()) || (is_combat())) && (univ.town->terrain(spec.ex1a,spec.ex1b) == spec.ex2a)) *next_spec = spec.ex2b; break; case 136: @@ -2399,14 +2399,14 @@ void ifthen_spec(short which_mode,cSpecial cur_node,short cur_spec_type, *next_spec = spec.ex1b; break; case 148: - for (j = 0; j < town_size[town_type]; j++) - for (k = 0; k < town_size[town_type]; k++) + for (j = 0; j < univ.town->max_dim(); j++) + for (k = 0; k < univ.town->max_dim(); k++) if (is_barrel(j,k)) *next_spec = spec.ex1b; break; case 149: - for (j = 0; j < town_size[town_type]; j++) - for (k = 0; k < town_size[town_type]; k++) + for (j = 0; j < univ.town->max_dim(); j++) + for (k = 0; k < univ.town->max_dim(); k++) if (is_crate(j,k)) *next_spec = spec.ex1b; break; @@ -2564,14 +2564,14 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type, *redraw = 1; break; case 182: - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].number == spec.ex1a) { univ.town.monst.dudes[i].active = 0; } *redraw = 1; break; case 183: - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (((spec.ex1a == 0) && (1 == 1)) || ((spec.ex1a == 1) && (univ.town.monst.dudes[i].attitude % 2 == 0)) || @@ -3062,9 +3062,9 @@ void get_strs(char *str1,char *str2,short cur_type,short which_str1,short which_ break; case 2: if (which_str1 >= 0) - strcpy((char *) str1,univ.town.town->town_strs(which_str1)); + strcpy((char *) str1,univ.town->town_strs(which_str1)); if (which_str2 >= 0) - strcpy((char *) str2,univ.town.town->town_strs(which_str2)); + strcpy((char *) str2,univ.town->town_strs(which_str2)); break; } diff --git a/osx/boe.text.cpp b/osx/boe.text.cpp index dc5bbdd3..4fabd15a 100644 --- a/osx/boe.text.cpp +++ b/osx/boe.text.cpp @@ -845,7 +845,7 @@ short do_look(location space) } if ((overall_mode == MODE_LOOK_TOWN) || (overall_mode == MODE_LOOK_COMBAT)) { - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active != 0) && (is_lit == true) && (monst_on_space(space,i) == true) && ((overall_mode == MODE_LOOK_TOWN) || (can_see(pc_pos[current_pc],space,0) < 5)) @@ -1255,7 +1255,7 @@ short print_terrain(location space) which_terrain = univ.out.out[space.x][space.y]; } if (overall_mode == MODE_LOOK_TOWN) { - which_terrain = univ.town.town->terrain(space.x,space.y); + which_terrain = univ.town->terrain(space.x,space.y); } if (overall_mode == MODE_LOOK_COMBAT) { which_terrain = combat_terrain[space.x][space.y]; diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index 1eefc160..e3c8a995 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -38,7 +38,7 @@ extern short stat_window,store_spell_target,which_combat_type,current_pc,combat_ extern eGameMode overall_mode; extern location center; extern WindowPtr mainPtr; -extern short monst_target[T_M]; // 0-5 target that pc 6 - no target 100 + x - target monster x +extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x extern unsigned char combat_terrain[64][64]; //extern cOutdoors univ.out.outdoors[2][2]; //extern unsigned char univ.out.misc_i[64][64]; @@ -46,7 +46,7 @@ extern short store_current_pc,current_ground; //extern pascal bool cd_event_filter(); extern short dungeon_font_num,geneva_font_num; extern eGameMode store_pre_shop_mode,store_pre_talk_mode; -extern location monster_targs[T_M]; +extern location monster_targs[60]; extern short special_queue[20]; extern bool modeless_exists[18],diff_depth_ok,belt_present; @@ -57,7 +57,7 @@ extern DialogPtr modeless_dialogs[18]; //extern stored_town_maps_type maps; //extern stored_outdoor_maps_type o_maps; //extern big_tr_type t_d; -extern short town_size[3]; +//extern short town_size[3]; extern short town_type; //extern setup_save_type setup_save; extern bool web,crate,barrel,fire_barrier,force_barrier,quickfire,force_wall,fire_wall,antimagic,scloud,ice_wall,blade_wall; @@ -148,9 +148,9 @@ void start_town_mode(short which_town, short entry_dir) if (town_force < 200) which_town = town_force; - else if (PSD[304][9] == 0) { - play_town_sound = true; - } +// else if (PSD[304][9] == 0) { +// play_town_sound = true; +// } former_town = town_number = which_town; @@ -187,35 +187,37 @@ void start_town_mode(short which_town, short entry_dir) overall_mode = MODE_TOWN; - load_town(town_number,univ.town.town); + load_town(town_number,univ.town.record); univ.town.num = town_number; + univ.town.cur_talk = &univ.town->talking; + univ.town.cur_talk_loaded = univ.town.num; init_town(); - if (play_town_sound == true) { - if (univ.town.town->lighting_type > 0) +// if (play_town_sound == true) { + if (univ.town->lighting_type > 0) play_sound(95); else play_sound(16); - } +// } belt_present = false; // Set up map, using stored map - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) { + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) { univ.town.explored[i][j] = 0; //univ.out.sfx[i][j] = 0; if (univ.town.maps[univ.town.num][i / 8][j] & (char)(s_pow(2,i % 8))) make_explored(i,j); - if (univ.town.town->terrain(i,j) == 0) + if (univ.town->terrain(i,j) == 0) current_ground = 0; - else if (univ.town.town->terrain(i,j) == 2) + else if (univ.town->terrain(i,j) == 2) current_ground = 2; - if ((scenario.ter_types[univ.town.town->terrain(i,j)].special >= 16) && - (scenario.ter_types[univ.town.town->terrain(i,j)].special <= 19)) + if ((scenario.ter_types[univ.town->terrain(i,j)].special >= 16) && + (scenario.ter_types[univ.town->terrain(i,j)].special <= 19)) belt_present = true; } @@ -230,12 +232,12 @@ void start_town_mode(short which_town, short entry_dir) univ.town.monst = univ.party.creature_save[i]; monsters_loaded = true; - for (j = 0; j < T_M; j++) { + for (j = 0; j < univ.town->max_monst(); j++) { if (loc_off_act_area(univ.town.monst.dudes[j].m_loc) == true) univ.town.monst.dudes[j].active = 0; if (univ.town.monst.dudes[j].active == 2) univ.town.monst.dudes[j].active = 1; - univ.town.monst.dudes[j].m_loc = univ.town.town->creatures(j).start_loc; + univ.town.monst.dudes[j].m_loc = univ.town->creatures(j).start_loc; univ.town.monst.dudes[j].m_d.health = univ.town.monst.dudes[j].m_d.m_health; univ.town.monst.dudes[j].m_d.mp = univ.town.monst.dudes[j].m_d.max_mp; univ.town.monst.dudes[j].m_d.morale = univ.town.monst.dudes[j].m_d.m_morale; @@ -248,7 +250,7 @@ void start_town_mode(short which_town, short entry_dir) // Now, travelling NPCs might have arrived. Go through and put them in. // These should have protected status (i.e. spec1 >= 200, spec1 <= 204) - for (j = 0; j < T_M; j++) { + for (j = 0; j < univ.town->max_monst(); j++) { switch (univ.town.monst.dudes[j].monst_start.time_flag){ case 4: case 5 : //case 6: if ((((short) (univ.party.age / 1000) % 3) + 4) != univ.town.monst.dudes[j].monst_start.time_flag) @@ -258,7 +260,7 @@ void start_town_mode(short which_town, short entry_dir) univ.town.monst.dudes[j].monst_start.spec_enc_code = 0; // Now remove time flag so it doesn't get reappearing univ.town.monst.dudes[j].monst_start.time_flag = 0; - univ.town.monst.dudes[j].m_loc = univ.town.town->creatures(j).start_loc; + univ.town.monst.dudes[j].m_loc = univ.town->creatures(j).start_loc; univ.town.monst.dudes[j].m_d.health = univ.town.monst.dudes[j].m_d.m_health; } break ; @@ -294,8 +296,8 @@ void start_town_mode(short which_town, short entry_dir) } } - for (j = 0; j < town_size[town_type]; j++) - for (k = 0; k < town_size[town_type]; k++) { // now load in saved setup, + for (j = 0; j < univ.town->max_dim(); j++) + for (k = 0; k < univ.town->max_dim(); k++) { // now load in saved setup, // except that barrels and crates restore to orig locs temp = univ.town.setup[i][j][k] & 231; @@ -304,8 +306,8 @@ void start_town_mode(short which_town, short entry_dir) } if (!monsters_loaded) { - for (i = 0; i < T_M; i++){ - if (univ.town.town->creatures(i).number == 0) { + for (i = 0; i < univ.town->max_monst(); i++){ + if (univ.town->creatures(i).number == 0) { univ.town.monst.dudes[i].active = 0; univ.town.monst.dudes[i].number = 0; univ.town.monst.dudes[i].monst_start.time_flag = 0; @@ -315,14 +317,14 @@ void start_town_mode(short which_town, short entry_dir) // First set up the values. monst_target[i] = 6; univ.town.monst.dudes[i].active = 1; - univ.town.monst.dudes[i].number = univ.town.town->creatures(i).number; - univ.town.monst.dudes[i].attitude = univ.town.town->creatures(i).start_attitude; - univ.town.monst.dudes[i].m_loc = univ.town.town->creatures(i).start_loc; - univ.town.monst.dudes[i].mobile = univ.town.town->creatures(i).mobile; + univ.town.monst.dudes[i].number = univ.town->creatures(i).number; + univ.town.monst.dudes[i].attitude = univ.town->creatures(i).start_attitude; + univ.town.monst.dudes[i].m_loc = univ.town->creatures(i).start_loc; + univ.town.monst.dudes[i].mobile = univ.town->creatures(i).mobile; univ.town.monst.dudes[i].m_d = return_monster_template(univ.town.monst.dudes[i].number); univ.town.monst.dudes[i].summoned = 0; - univ.town.monst.dudes[i].monst_start = univ.town.town->creatures(i); + univ.town.monst.dudes[i].monst_start = univ.town->creatures(i); if (univ.town.monst.dudes[i].monst_start.spec_enc_code > 0) univ.town.monst.dudes[i].active = 0; @@ -363,8 +365,8 @@ void start_town_mode(short which_town, short entry_dir) univ.town.monst.dudes[i].active = 0; break; case 9: - if (univ.town.town->town_chop_time > 0) - if (day_reached(univ.town.town->town_chop_time,univ.town.town->town_chop_key)) { + if (univ.town->town_chop_time > 0) + if (day_reached(univ.town->town_chop_time,univ.town->town_chop_key)) { univ.town.monst.dudes[i].active += 10; break; } @@ -384,7 +386,7 @@ void start_town_mode(short which_town, short entry_dir) // Now munch all large monsters that are misplaced // only large monsters, as some smaller monsters are intentionally placed // where they cannot be - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { if (univ.town.monst.dudes[i].active > 0) if (((univ.town.monst.dudes[i].m_d.x_width > 1) || (univ.town.monst.dudes[i].m_d.y_width > 1)) && (monst_can_be_there(univ.town.monst.dudes[i].m_loc,i) == false)) @@ -393,16 +395,16 @@ void start_town_mode(short which_town, short entry_dir) // Thrash town? - if (univ.party.m_killed[univ.town.num] > univ.town.town->max_num_monst) + if (univ.party.m_killed[univ.town.num] > univ.town->max_num_monst) { town_toast = true; - add_string_to_buf("Area has been cleaned univ.out.out."); + add_string_to_buf("Area has been cleaned out."); } - if (univ.town.town->town_chop_time > 0) { - if (day_reached(univ.town.town->town_chop_time,univ.town.town->town_chop_key) == true) + if (univ.town->town_chop_time > 0) { + if (day_reached(univ.town->town_chop_time,univ.town->town_chop_key) == true) { - //add_string_to_buf("Area has been abandoned."); - for (i = 0; i < T_M; i++) + add_string_to_buf("Area has been abandoned."); + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].active < 10) && (univ.town.monst.dudes[i].attitude % 2 == 1)) univ.town.monst.dudes[i].active += 10; @@ -410,18 +412,18 @@ void start_town_mode(short which_town, short entry_dir) } } if (town_toast == true) { - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].active >= 10) univ.town.monst.dudes[i].active -= 10; else univ.town.monst.dudes[i].active = 0; } - handle_town_specials(town_number, (short) town_toast,(entry_dir < 9) ? univ.town.town->start_locs[entry_dir] : town_force_loc); + handle_town_specials(town_number, (short) town_toast,(entry_dir < 9) ? univ.town->start_locs[entry_dir] : town_force_loc); // Flush excess doomguards and viscous goos - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if ((univ.town.monst.dudes[i].m_d.spec_skill == 12) && - (univ.town.monst.dudes[i].number != univ.town.town->creatures(i).number)) + (univ.town.monst.dudes[i].number != univ.town->creatures(i).number)) univ.town.monst.dudes[i].active = 0; quickfire = false; @@ -431,8 +433,8 @@ void start_town_mode(short which_town, short entry_dir) fire_barrier = false; force_barrier = false; // Set up field booleans, correct for doors - for (j = 0; j < town_size[town_type]; j++) - for (k = 0; k < town_size[town_type]; k++) { + for (j = 0; j < univ.town->max_dim(); j++) + for (k = 0; k < univ.town->max_dim(); k++) { loc.x = j; loc.y = k; if (is_door(loc) == true) univ.out.misc_i[j][k] = univ.out.misc_i[j][k] & 3; @@ -461,32 +463,32 @@ void start_town_mode(short which_town, short entry_dir) } for (i = 0; i < 64; i++) - if ((univ.town.town->preset_items[i].code >= 0) + if ((univ.town->preset_items[i].code >= 0) && (((univ.party.item_taken[univ.town.num][i / 8] & s_pow(2,i % 8)) == 0) || - (univ.town.town->preset_items[i].always_there == true))) { + (univ.town->preset_items[i].always_there == true))) { for (j = 0; j < NUM_TOWN_ITEMS; j++) // place the preset item, if univ.party hasn't gotten it already if (univ.town.items[j].variety == 0) { - univ.town.items[j] = get_stored_item(univ.town.town->preset_items[i].code); - univ.town.items[j].item_loc = univ.town.town->preset_items[i].loc; + univ.town.items[j] = get_stored_item(univ.town->preset_items[i].code); + univ.town.items[j].item_loc = univ.town->preset_items[i].loc; // Not use the items data flags, starting with forcing an ability - if (univ.town.town->preset_items[i].ability >= 0) { + if (univ.town->preset_items[i].ability >= 0) { switch (univ.town.items[j].variety) { case 3: case 11: // If gold or food, this value is amount - if (univ.town.town->preset_items[i].ability > 0) - univ.town.items[j].item_level = univ.town.town->preset_items[i].ability; + if (univ.town->preset_items[i].ability > 0) + univ.town.items[j].item_level = univ.town->preset_items[i].ability; break; } } - if (univ.town.town->preset_items[i].property == true) + if (univ.town->preset_items[i].property == true) univ.town.items[j].item_properties = univ.town.items[j].item_properties | 2; if (town_toast == true) univ.town.items[j].item_properties = univ.town.items[j].item_properties & 253; - if (univ.town.town->preset_items[i].contained == true) + if (univ.town->preset_items[i].contained == true) univ.town.items[j].item_properties = univ.town.items[j].item_properties | 8; univ.town.items[j].is_special = i + 1; @@ -495,15 +497,15 @@ void start_town_mode(short which_town, short entry_dir) } - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if (loc_off_act_area(univ.town.monst.dudes[i].m_loc) == true) univ.town.monst.dudes[i].active = 0; for (i = 0; i < NUM_TOWN_ITEMS; i++) if (loc_off_act_area(univ.town.items[i].item_loc) == true) univ.town.items[i].variety = ITEM_TYPE_NO_ITEM; - // Clean univ.out.out unwanted monsters - for (i = 0; i < T_M; i++) + // Clean out unwanted monsters + for (i = 0; i < univ.town->max_monst(); i++) if (sd_legit(univ.town.monst.dudes[i].monst_start.spec1,univ.town.monst.dudes[i].monst_start.spec2) == true) { if (PSD[univ.town.monst.dudes[i].monst_start.spec1][univ.town.monst.dudes[i].monst_start.spec2] > 0) univ.town.monst.dudes[i].active = 0; @@ -516,7 +518,7 @@ void start_town_mode(short which_town, short entry_dir) load_area_graphics(); - univ.town.p_loc = (entry_dir < 9) ? univ.town.town->start_locs[entry_dir] : town_force_loc; + univ.town.p_loc = (entry_dir < 9) ? univ.town->start_locs[entry_dir] : town_force_loc; center = univ.town.p_loc; if (univ.party.in_boat >= 0) { univ.party.boats[univ.party.in_boat].which_town = which_town; @@ -538,7 +540,7 @@ void start_town_mode(short which_town, short entry_dir) PSD[SDF_HOSTILES_PRESENT] = 0; add_string_to_buf("Now entering:"); - sprintf ((char *) message, " %-30.30s ",univ.town.town->town_strs(0)); + sprintf ((char *) message, " %-30.30s ",univ.town->town_strs(0)); add_string_to_buf((char *) message); @@ -554,7 +556,7 @@ void start_town_mode(short which_town, short entry_dir) ADVEN[m].items[n].variety = ITEM_TYPE_NO_ITEM; } - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) {monster_targs[i].x = 0; monster_targs[i].y = 0;} //// check horses @@ -601,15 +603,15 @@ location end_town_mode(short switching_level,location destination) // returns n for (i = 0; i < 4; i++) if (univ.party.creature_save[i].which_town == univ.town.num) { univ.party.creature_save[i] = univ.town.monst; - for (j = 0; j < town_size[town_type]; j++) - for (k = 0; k < town_size[town_type]; k++) + for (j = 0; j < univ.town->max_dim(); j++) + for (k = 0; k < univ.town->max_dim(); k++) univ.town.setup[i][j][k] = univ.out.misc_i[j][k]; data_saved = true; } if (data_saved == false) { univ.party.creature_save[univ.party.at_which_save_slot] = univ.town.monst; - for (j = 0; j < town_size[town_type]; j++) - for (k = 0; k < town_size[town_type]; k++) + for (j = 0; j < univ.town->max_dim(); j++) + for (k = 0; k < univ.town->max_dim(); k++) univ.town.setup[univ.party.at_which_save_slot][j][k] = univ.out.misc_i[j][k]; univ.party.at_which_save_slot = (univ.party.at_which_save_slot == 3) ? 0 : univ.party.at_which_save_slot + 1; } @@ -630,15 +632,15 @@ location end_town_mode(short switching_level,location destination) // returns n // Clean up special data, just in case - for (i = 0; i < T_M; i++) { + for (i = 0; i < univ.town->max_monst(); i++) { univ.town.monst.dudes[i].monst_start.spec1 = 0; univ.town.monst.dudes[i].monst_start.spec2 = 0; } // Now store map //if (univ.town.town_num < 120) { - for (i = 0; i < town_size[town_type]; i++) - for (j = 0; j < town_size[town_type]; j++) + for (i = 0; i < univ.town->max_dim(); i++) + for (j = 0; j < univ.town->max_dim(); j++) if (is_explored(i,j) > 0) { univ.town.maps[univ.town.num][i / 8][j] = univ.town.maps[univ.town.num][i / 8][j] | (char) (s_pow(2,i % 8)); @@ -662,33 +664,33 @@ location end_town_mode(short switching_level,location destination) // returns n to_return = univ.party.p_loc; if (is_town()) { - if (destination.x <= univ.town.town->in_town_rect.left) { - if (univ.town.town->exit_locs[1].x > 0) - to_return = local_to_global(univ.town.town->exit_locs[1]); + if (destination.x <= univ.town->in_town_rect.left) { + if (univ.town->exit_locs[1].x > 0) + to_return = local_to_global(univ.town->exit_locs[1]); else to_return.x--; univ.party.p_loc = to_return; univ.party.p_loc.x++; - handle_leave_town_specials(univ.town.num, univ.town.town->exit_specs[1],destination) ; + handle_leave_town_specials(univ.town.num, univ.town->exit_specs[1],destination) ; } - else if (destination.x >= univ.town.town->in_town_rect.right) { - if (univ.town.town->exit_locs[3].x > 0) - to_return = local_to_global(univ.town.town->exit_locs[3]); + else if (destination.x >= univ.town->in_town_rect.right) { + if (univ.town->exit_locs[3].x > 0) + to_return = local_to_global(univ.town->exit_locs[3]); else to_return.x++; univ.party.p_loc = to_return; univ.party.p_loc.x--; - handle_leave_town_specials(univ.town.num, univ.town.town->exit_specs[3],destination) ; + handle_leave_town_specials(univ.town.num, univ.town->exit_specs[3],destination) ; } - else if (destination.y <= univ.town.town->in_town_rect.top) { - if (univ.town.town->exit_locs[0].x > 0) - to_return = local_to_global(univ.town.town->exit_locs[0]); + else if (destination.y <= univ.town->in_town_rect.top) { + if (univ.town->exit_locs[0].x > 0) + to_return = local_to_global(univ.town->exit_locs[0]); else to_return.y--; univ.party.p_loc = to_return; univ.party.p_loc.y++; - handle_leave_town_specials(univ.town.num, univ.town.town->exit_specs[0],destination) ; + handle_leave_town_specials(univ.town.num, univ.town->exit_specs[0],destination) ; } - else if (destination.y >= univ.town.town->in_town_rect.bottom) { - if (univ.town.town->exit_locs[2].x > 0) - to_return = local_to_global(univ.town.town->exit_locs[2]); + else if (destination.y >= univ.town->in_town_rect.bottom) { + if (univ.town->exit_locs[2].x > 0) + to_return = local_to_global(univ.town->exit_locs[2]); else to_return.y++; univ.party.p_loc = to_return; univ.party.p_loc.y--; - handle_leave_town_specials(univ.town.num, univ.town.town->exit_specs[2],destination) ; + handle_leave_town_specials(univ.town.num, univ.town->exit_specs[2],destination) ; } } @@ -735,8 +737,8 @@ void handle_town_specials(short town_number, short entry_dir,location start_loc) // run_special(5,2,univ.town.town.spec_on_entry_if_dead,start_loc,&s1,&s2,&s3); // else run_special(5,2,univ.town.town.spec_on_entry,start_loc,&s1,&s2,&s3); if (entry_dir > 0) - special_queue[0] = univ.town.town->spec_on_entry_if_dead; - else special_queue[0] = univ.town.town->spec_on_entry; + special_queue[0] = univ.town->spec_on_entry_if_dead; + else special_queue[0] = univ.town->spec_on_entry; } void handle_leave_town_specials(short town_number, short which_spec,location start_loc) @@ -778,11 +780,11 @@ void start_town_combat(short direction) overall_mode = MODE_COMBAT; combat_active_pc = 6; - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) monst_target[i] = 6; for (i = 0; i < 6; i++) { - last_attacked[i] = T_M + 10; + last_attacked[i] = univ.town->max_monst() + 10; pc_parry[i] = 0; pc_dir[i] = direction; ADVEN[current_pc].direction = direction; @@ -882,9 +884,9 @@ void create_town_combat_terrain() { location where; - for (where.x = 0; where.x < town_size[town_type]; where.x++) - for (where.y = 0; where.y < town_size[town_type]; where.y++) - combat_terrain[where.x][where.y] = univ.town.town->terrain(where.x,where.y); + for (where.x = 0; where.x < univ.town->max_dim(); where.x++) + for (where.y = 0; where.y < univ.town->max_dim(); where.y++) + combat_terrain[where.x][where.y] = univ.town->terrain(where.x,where.y); } void create_out_combat_terrain(short type,short num_walls,short spec_code) @@ -989,28 +991,28 @@ void create_out_combat_terrain(short type,short num_walls,short spec_code) univ.out.misc_i[i][j] = 0; univ.out.sfx[i][j] = 0; if ((j <= 8) || (j >= 35) || (i <= 8) || (i >= 35)) - univ.town.town->terrain(i,j) = 90; - else univ.town.town->terrain(i,j) = ter_base[ter_type]; + univ.town->terrain(i,j) = 90; + else univ.town->terrain(i,j) = ter_base[ter_type]; } for (i = 0; i < 48; i++) for (j = 0; j < 48; j++) for (k = 0; k < 5; k++) - if ((univ.town.town->terrain(i,j) != 90) && (get_ran(1,1,1000) < terrain_odds[ter_type][k * 2 + 1])) - univ.town.town->terrain(i,j) = terrain_odds[ter_type][k * 2]; + if ((univ.town->terrain(i,j) != 90) && (get_ran(1,1,1000) < terrain_odds[ter_type][k * 2 + 1])) + univ.town->terrain(i,j) = terrain_odds[ter_type][k * 2]; - univ.town.town->terrain(0,0) = ter_base[ter_type]; + univ.town->terrain(0,0) = ter_base[ter_type]; if ((ter_type == 3) || (ter_type == 4) ) { - univ.town.town->terrain(0,0) = 83; + univ.town->terrain(0,0) = 83; for (i = 15; i < 26; i++) for (j = 9; j < 35; j++) - univ.town.town->terrain(i,j) = 83; + univ.town->terrain(i,j) = 83; } if ((type >= 79) && (type <= 81)) { - univ.town.town->terrain(0,0) = 82; + univ.town->terrain(0,0) = 82; for (i = 19; i < 23; i++) for (j = 9; j < 35; j++) - univ.town.town->terrain(i,j) = 82; + univ.town->terrain(i,j) = 82; } @@ -1021,31 +1023,31 @@ void create_out_combat_terrain(short type,short num_walls,short spec_code) stuff_ul = special_ter_locs[i]; for (j = 0; j < 4; j++) for (k = 0; k < 4; k++) - univ.town.town->terrain(stuff_ul.x + j,stuff_ul.y + k) = mntn_pillar[k][j]; + univ.town->terrain(stuff_ul.x + j,stuff_ul.y + k) = mntn_pillar[k][j]; } - if (univ.town.town->terrain(0,0) == 0) + if (univ.town->terrain(0,0) == 0) for (i = 0; i < 15; i++) if (get_ran(1,0,25) == 1) { stuff_ul = special_ter_locs[i]; for (j = 0; j < 4; j++) for (k = 0; k < 4; k++) - univ.town.town->terrain(stuff_ul.x + j,stuff_ul.y + k) = cave_pillar[k][j]; + univ.town->terrain(stuff_ul.x + j,stuff_ul.y + k) = cave_pillar[k][j]; } - if (univ.town.town->terrain(0,0) == 0) + if (univ.town->terrain(0,0) == 0) for (i = 0; i < 15; i++) if (get_ran(1,0,40) == 1) { stuff_ul = special_ter_locs[i]; for (j = 0; j < 4; j++) for (k = 0; k < 4; k++) - univ.town.town->terrain(stuff_ul.x + j,stuff_ul.y + k) = cave_lake[k][j]; + univ.town->terrain(stuff_ul.x + j,stuff_ul.y + k) = cave_lake[k][j]; } - if (univ.town.town->terrain(0,0) == 2) + if (univ.town->terrain(0,0) == 2) for (i = 0; i < 15; i++) if (get_ran(1,0,40) == 1) { stuff_ul = special_ter_locs[i]; for (j = 0; j < 4; j++) for (k = 0; k < 4; k++) - univ.town.town->terrain(stuff_ul.x + j,stuff_ul.y + k) = surf_lake[k][j]; + univ.town->terrain(stuff_ul.x + j,stuff_ul.y + k) = surf_lake[k][j]; } @@ -1055,27 +1057,27 @@ void create_out_combat_terrain(short type,short num_walls,short spec_code) for (j = 9; j < 35; j++) switch (r1) { case 0: - univ.town.town->terrain(j,8) = 6; + univ.town->terrain(j,8) = 6; break; case 1: - univ.town.town->terrain(8,j) = 9; + univ.town->terrain(8,j) = 9; break; case 2: - univ.town.town->terrain(j,35) = 12; + univ.town->terrain(j,35) = 12; break; case 3: - univ.town.town->terrain(32,j) = 15; + univ.town->terrain(32,j) = 15; break; } } - if ((univ.town.town->terrain(17,8) == 6) && (univ.town.town->terrain(8,20) == 9)) - univ.town.town->terrain(8,8) = 21; - if ((univ.town.town->terrain(32,20) == 15) && (univ.town.town->terrain(17,35) == 12)) - univ.town.town->terrain(32,35) = 19; - if ((univ.town.town->terrain(17,8) == 6) && (univ.town.town->terrain(32,20) == 15)) - univ.town.town->terrain(32,8) = 32; - if ((univ.town.town->terrain(8,20) == 9) && (univ.town.town->terrain(17,35) == 12)) - univ.town.town->terrain(8,35) = 20; + if ((univ.town->terrain(17,8) == 6) && (univ.town->terrain(8,20) == 9)) + univ.town->terrain(8,8) = 21; + if ((univ.town->terrain(32,20) == 15) && (univ.town->terrain(17,35) == 12)) + univ.town->terrain(32,35) = 19; + if ((univ.town->terrain(17,8) == 6) && (univ.town->terrain(32,20) == 15)) + univ.town->terrain(32,8) = 32; + if ((univ.town->terrain(8,20) == 9) && (univ.town->terrain(17,35) == 12)) + univ.town->terrain(8,35) = 20; } if (ground_type[ter_type] == 36) { for (i = 0; i < num_walls; i++) { @@ -1083,32 +1085,32 @@ void create_out_combat_terrain(short type,short num_walls,short spec_code) for (j = 9; j < 35; j++) switch (r1) { case 0: - univ.town.town->terrain(j,8) = 24; + univ.town->terrain(j,8) = 24; break; case 1: - univ.town.town->terrain(8,j) = 26; + univ.town->terrain(8,j) = 26; break; case 2: - univ.town.town->terrain(j,35) = 28; + univ.town->terrain(j,35) = 28; break; case 3: - univ.town.town->terrain(32,j) = 30; + univ.town->terrain(32,j) = 30; break; } } - if ((univ.town.town->terrain(17,8) == 6) && (univ.town.town->terrain(8,20) == 9)) - univ.town.town->terrain(8,8) = 35; - if ((univ.town.town->terrain(32,20) == 15) && (univ.town.town->terrain(17,35) == 12)) - univ.town.town->terrain(32,35) = 33; - if ((univ.town.town->terrain(17,8) == 6) && (univ.town.town->terrain(32,20) == 15)) - univ.town.town->terrain(32,8) = 32; - if ((univ.town.town->terrain(8,20) == 9) && (univ.town.town->terrain(17,35) == 12)) - univ.town.town->terrain(8,35) = 34; + if ((univ.town->terrain(17,8) == 6) && (univ.town->terrain(8,20) == 9)) + univ.town->terrain(8,8) = 35; + if ((univ.town->terrain(32,20) == 15) && (univ.town->terrain(17,35) == 12)) + univ.town->terrain(32,35) = 33; + if ((univ.town->terrain(17,8) == 6) && (univ.town->terrain(32,20) == 15)) + univ.town->terrain(32,8) = 32; + if ((univ.town->terrain(8,20) == 9) && (univ.town->terrain(17,35) == 12)) + univ.town->terrain(8,35) = 34; } for (i = 0; i < 48; i++) for (j = 0; j < 48; j++) - combat_terrain[i][j] = univ.town.town->terrain(i,j); + combat_terrain[i][j] = univ.town->terrain(i,j); make_town_trim(1); } @@ -1121,7 +1123,7 @@ void elim_monst(unsigned char which,short spec_a,short spec_b) if (sd_legit(spec_a,spec_b) == false) return; if (PSD[spec_a][spec_b] > 0) { - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].number == which) { univ.town.monst.dudes[i].active = 0; } @@ -1162,7 +1164,7 @@ void pick_lock(location where,short pc_num) bool will_break = false; short unlock_adjust; - terrain = univ.town.town->terrain(where.x,where.y); + terrain = univ.town->terrain(where.x,where.y); which_item = pc_has_abil_equip(pc_num,161); if (which_item == 24) { add_string_to_buf(" Need lockpick equipped. "); @@ -1200,7 +1202,7 @@ void pick_lock(location where,short pc_num) else { add_string_to_buf(" Door unlocked. "); play_sound(9); - univ.town.town->terrain(where.x,where.y) = scenario.ter_types[terrain].flag1; + univ.town->terrain(where.x,where.y) = scenario.ter_types[terrain].flag1; } } @@ -1209,7 +1211,7 @@ void bash_door(location where,short pc_num) //// unsigned char terrain; short r1,unlock_adjust; - terrain = univ.town.town->terrain(where.x,where.y); + terrain = univ.town->terrain(where.x,where.y); r1 = get_ran(1,1,100) - 15 * stat_adj(pc_num,0) + univ.town.difficulty * 4; if ((scenario.ter_types[terrain].special < 9) || (scenario.ter_types[terrain].special > 10)) { @@ -1225,7 +1227,7 @@ void bash_door(location where,short pc_num) //// else { add_string_to_buf(" Lock breaks. "); play_sound(9); - univ.town.town->terrain(where.x,where.y) = scenario.ter_types[terrain].flag1; + univ.town->terrain(where.x,where.y) = scenario.ter_types[terrain].flag1; } } @@ -1241,27 +1243,27 @@ void erase_specials()//// if ((is_town() == false) && (is_combat() == false)) return; for (k = 0; k < 50; k++) { - if (univ.town.town->spec_id[k] >= 0) { - sn = univ.town.town->specials[univ.town.town->spec_id[k]]; + if (univ.town->spec_id[k] >= 0) { + sn = univ.town->specials[univ.town->spec_id[k]]; sd1 = sn.sd1; sd2 = sn.sd2; if ((sd_legit(sd1,sd2) == true) && (PSD[sd1][sd2] == 250)) { - where = univ.town.town->special_locs[k]; - if ((where.x != 100) && ((where.x > town_size[town_type]) || (where.y > town_size[town_type]) + where = univ.town->special_locs[k]; + if ((where.x != 100) && ((where.x > univ.town->max_dim()) || (where.y > univ.town->max_dim()) || (where.x < 0) || (where.y < 0))) { SysBeep(2); add_string_to_buf("Town corrupt. Problem fixed."); print_nums(where.x,where.y,k); - univ.town.town->special_locs[k].x = 0; + univ.town->special_locs[k].x = 0; } if (where.x != 100) { - switch (scenario.ter_types[univ.town.town->terrain(where.x,where.y)].picture) { - case 207: univ.town.town->terrain(where.x,where.y) = 0; break; - case 208: univ.town.town->terrain(where.x,where.y) = 170; break; - case 209: univ.town.town->terrain(where.x,where.y) = 210; break; - case 210: univ.town.town->terrain(where.x,where.y) = 217; break; - case 211: univ.town.town->terrain(where.x,where.y) = 2; break; - case 212: univ.town.town->terrain(where.x,where.y) = 36; break; + switch (scenario.ter_types[univ.town->terrain(where.x,where.y)].picture) { + case 207: univ.town->terrain(where.x,where.y) = 0; break; + case 208: univ.town->terrain(where.x,where.y) = 170; break; + case 209: univ.town->terrain(where.x,where.y) = 210; break; + case 210: univ.town->terrain(where.x,where.y) = 217; break; + case 211: univ.town->terrain(where.x,where.y) = 2; break; + case 212: univ.town->terrain(where.x,where.y) = 36; break; } take_special(where.x,where.y); } @@ -1340,7 +1342,7 @@ short get_town_spec_id(location where) { short i = 0; - while ((univ.town.town->special_locs[i] != where) && (i < 50)) + while ((univ.town->special_locs[i] != where) && (i < 50)) i++; return i; } @@ -1526,7 +1528,7 @@ pascal void draw_map (DialogPtr the_dialog, short the_item) SetPort(old_port); return; } - }else if((is_town() && univ.town.town->specials2 & 1)) { + }else if((is_town() && univ.town->specials2 & 1)) { if (modeless_exists[5] == true) { SetPort(GetDialogPort(the_dialog)); FillCRect(&map_bar_rect,bg[4]); @@ -1594,7 +1596,7 @@ pascal void draw_map (DialogPtr the_dialog, short the_item) if (out_mode == true) what_ter = univ.out.out[where.x + 48 * univ.party.i_w_c.x][where.y + 48 * univ.party.i_w_c.y]; - else what_ter = univ.town.town->terrain(where.x,where.y); + else what_ter = univ.town->terrain(where.x,where.y); ter_temp_from = orig_draw_rect; @@ -1632,7 +1634,7 @@ pascal void draw_map (DialogPtr the_dialog, short the_item) if ((pic < 400) && (where.x < area_to_put_on_map_rect.right - 1)) { if (out_mode == true) what_ter2 = univ.out.out[(where.x + 1)+ 48 * univ.party.i_w_c.x][where.y + 48 * univ.party.i_w_c.y]; - else what_ter2 = univ.town.town->terrain(where.x + 1,where.y); + else what_ter2 = univ.town->terrain(where.x + 1,where.y); if (out_mode == true) expl2 = univ.out.out_e[(where.x + 1) + 48 * univ.party.i_w_c.x][where.y + 48 * univ.party.i_w_c.y]; else expl2 = is_explored(where.x + 1,where.y); @@ -1692,7 +1694,7 @@ pascal void draw_map (DialogPtr the_dialog, short the_item) // Now place PCs and monsters if ((draw_pcs == true) && (modeless_exists[5] == true)) { if ((is_town()) && (PSD[SDF_PARTY_DETECT_LIFE] > 0)) - for (i = 0; i < T_M; i++) + for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].active > 0) { where = univ.town.monst.dudes[i].m_loc; if ((is_explored(where.x,where.y)) && @@ -1747,9 +1749,9 @@ pascal void draw_map (DialogPtr the_dialog, short the_item) bool is_door(location destination) { - if ((scenario.ter_types[univ.town.town->terrain(destination.x,destination.y)].special == 9) || - (scenario.ter_types[univ.town.town->terrain(destination.x,destination.y)].special == 1) || - (scenario.ter_types[univ.town.town->terrain(destination.x,destination.y)].special == 10)) + if ((scenario.ter_types[univ.town->terrain(destination.x,destination.y)].special == 9) || + (scenario.ter_types[univ.town->terrain(destination.x,destination.y)].special == 1) || + (scenario.ter_types[univ.town->terrain(destination.x,destination.y)].special == 10)) return true; return false; } diff --git a/osx/boe.townspec.cpp b/osx/boe.townspec.cpp index 3fc848b1..ae77b485 100644 --- a/osx/boe.townspec.cpp +++ b/osx/boe.townspec.cpp @@ -154,7 +154,7 @@ bool run_trap(short pc_num,eTrapType trap_type,short trap_level,short diff) if (trap_type == TRAP_RANDOM) trap_type = (eTrapType) get_ran(1,1,4); - if (trap_type == TRAP_false_ALARM) + if (trap_type == TRAP_FALSE_ALARM) return true; if (pc_num < 6) { @@ -264,8 +264,8 @@ location get_spec_loc(short which) short i; for (i = 0; i < 50; i++) - if (univ.town.town->spec_id[i] == which) - return univ.town.town->special_locs[i]; + if (univ.town->spec_id[i] == which) + return univ.town->special_locs[i]; return where; } @@ -325,6 +325,6 @@ short handle_lever(location w) void switch_lever(location w) { - alter_space(w.x,w.y,scenario.ter_types[univ.town.town->terrain(w.x,w.y)].trans_to_what); + alter_space(w.x,w.y,scenario.ter_types[univ.town->terrain(w.x,w.y)].trans_to_what); } diff --git a/osx/misc/fileio.cpp b/osx/misc/fileio.cpp index 71f6ac97..c4701b8c 100644 --- a/osx/misc/fileio.cpp +++ b/osx/misc/fileio.cpp @@ -526,7 +526,7 @@ bool load_town_str(short which_town, short which_str, char* str){ error = SetFPos (file_id, 3, len); for (i = 0; i < 140; i++) { - len = (long) (univ.town.town->strlens[i]); + len = (long) (univ.town->strlens[i]); if(i == which_str){ FSRead(file_id, &len, (char *) str); str[len] = 0; @@ -973,7 +973,7 @@ bool load_party(FSSpec file_to_load){ return false; } - if(univ.town.town != NULL) delete univ.town.town; + if(univ.town.loaded()) univ.town.unload(); // LOAD TOWN if (town_restore) { @@ -1003,7 +1003,7 @@ bool load_party(FSSpec file_to_load){ return false; } - }else univ.town.num = 200, univ.town.town = NULL; + }else univ.town.num = 200; // LOAD STORED ITEMS for (i = 0; i < 3; i++) { diff --git a/osx/misc/viewdlog.cpp b/osx/misc/viewdlog.cpp index 92043474..d98b1205 100644 --- a/osx/misc/viewdlog.cpp +++ b/osx/misc/viewdlog.cpp @@ -31,7 +31,7 @@ int main() Initialize(); Point p = {0,0}; - init_graph_tool(NULL,p); + init_graph_tool(NULL,&p); init_snd_tool(); // menu_bar_handle = GetNewMBar(128); @@ -65,6 +65,7 @@ int main() display_strings("The dialog id 8000 could not be loaded.", "", "Dialog not found.",23,4,0); exit(1); } + cd_attach_key(8000, 4, 24); //Handle_One_Event(); cd_run_dialog(); cd_kill_dialog(8000,0); @@ -95,12 +96,12 @@ void Initialize(void) { char *path = "Scenario Editor/Blades of Exile Graphics"; error = FSPathMakeRef((UInt8*) path, &gRef, false); - error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &graphicsRef); if (error != noErr) { //SysBeep(1); printf("Error! File Blades of Exile Graphics not found.\n"); ExitToShell(); } + error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &graphicsRef); } { char *path = "Scenario Editor/Blades of Exile Sounds"; @@ -115,33 +116,34 @@ void Initialize(void) { char *path = "Blades of Exile.app/Contents/Resources/bladesofexile.rsrc"; error = FSPathMakeRef((UInt8*) path, &gRef, false); - error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &boeRef); if (error != noErr) { //SysBeep(1); printf("Error! Blades of Exile resource not found.\n"); ExitToShell(); } + error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &boeRef); } { - char *path = "Blades of Exile Character Editor.app/Contents/Resources/boechared.rsrc"; + char *path = "Blades of Exile Character Editor.app/Contents/Resources/bladespced.rsrc"; error = FSPathMakeRef((UInt8*) path, &gRef, false); - error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &scenRef); if (error != noErr) { //SysBeep(1); printf("Error! Blades of Exile PC Editor resource not found.\n"); ExitToShell(); } + error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &scenRef); } { - char *path = "Scenario Editor/BoE Scenario Editor/Contents/Resources/boescen.rsrc"; + char *path = "Scenario Editor/BoE Scenario Editor.app/Contents/Resources/BoEscen.rsrc"; error = FSPathMakeRef((UInt8*) path, &gRef, false); - error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &pcRef); if (error != noErr) { //SysBeep(1); printf("Error! Blades of Exile Scenario Editor resources not found.\n"); ExitToShell(); } + error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &pcRef); } + UseResFile(boeRef); // path = "Scenario Editor/Blades of Exile Sounds"; // FSPathMakeRef((UInt8*) path, &sRef, false); // error = FSOpenResourceFile(&sRef, 0, NULL, fsRdPerm, &soundRef); @@ -216,6 +218,8 @@ void choose_dialog_event_filter(short item_hit){ switch(item_hit){ case 3: short n = cd_retrieve_text_edit_num(8000, 2); + if(n == 8000) break; + printf("Showing dialog %i\n",n); if(cd_create_dialog_parent_num(n,8000) == -3){ char msg[100]; sprintf(msg,"The dialog id %i could not be loaded.",n); @@ -230,18 +234,21 @@ void choose_dialog_event_filter(short item_hit){ All_Done = true; break; case 6: + printf("Switching to BoE resfile.\n"); cd_set_led_range(8000,6,8,6); UseResFile(boeRef); cd_set_bg_pat_num(5); cd_set_text_clr(white); break; case 7: + printf("Switching to PC resfile.\n"); cd_set_led_range(8000,6,8,7); UseResFile(pcRef); cd_set_bg_pat_num(5); cd_set_text_clr(white); break; case 8: + printf("Switching to Scen resfile.\n"); cd_set_led_range(8000,6,8,8); UseResFile(scenRef); cd_set_bg_pat_num(16); diff --git a/osx/universe.cpp b/osx/universe.cpp index 546f1c53..c5c141df 100644 --- a/osx/universe.cpp +++ b/osx/universe.cpp @@ -28,19 +28,19 @@ __attribute__((deprecated)) void cCurTown::append(legacy::current_town_type& old,short which_size){ num = old.town_num; difficulty = old.difficulty; - if(town != NULL) delete town; + if(record != NULL) delete record; switch(which_size){ case 0: - town = new cBigTown; + record = new cBigTown; break; case 1: - town = new cMedTown; + record = new cMedTown; break; case 2: - town = new cTinyTown; + record = new cTinyTown; break; } - *town = old.town; + *record = old.town; for(int i = 0; i < 64; i++) for(int j = 0; j < 64; j++) explored[i][j] = old.explored[i][j]; @@ -49,27 +49,27 @@ void cCurTown::append(legacy::current_town_type& old,short which_size){ in_boat = old.in_boat; p_loc.x = old.p_loc.x; p_loc.y = old.p_loc.y; - cur_talk = &town->talking; + cur_talk = &record->talking; cur_talk_loaded = num; } __attribute__((deprecated)) void cCurTown::append(legacy::big_tr_type& old){ int i,j; - for(i = 0; i < town->max_dim(); i++) - for(j = 0; j < town->max_dim(); j++) - town->terrain(i,j) = old.terrain[i][j]; + for(i = 0; i < record->max_dim(); i++) + for(j = 0; j < record->max_dim(); j++) + record->terrain(i,j) = old.terrain[i][j]; for(i = 0; i < 16; i++){ - town->room_rect(i).top = old.room_rect[i].top; - town->room_rect(i).left = old.room_rect[i].left; - town->room_rect(i).bottom = old.room_rect[i].bottom; - town->room_rect(i).right = old.room_rect[i].right; + record->room_rect(i).top = old.room_rect[i].top; + record->room_rect(i).left = old.room_rect[i].left; + record->room_rect(i).bottom = old.room_rect[i].bottom; + record->room_rect(i).right = old.room_rect[i].right; } - for(i = 0; i < town->max_monst(); i++) - town->creatures(i) = old.creatures[i]; - for(i = 0; i < town->max_dim() / 8; i++) - for(j = 0; j < town->max_dim(); j++) - town->lighting(i,j) = old.lighting[i][j]; + for(i = 0; i < record->max_monst(); i++) + record->creatures(i) = old.creatures[i]; + for(i = 0; i < record->max_dim() / 8; i++) + for(j = 0; j < record->max_dim(); j++) + record->lighting(i,j) = old.lighting[i][j]; } __attribute__((deprecated)) @@ -102,3 +102,17 @@ void cCurOut::append(unsigned char(& old_sfx)[64][64], unsigned char(& old_misc_ misc_i[i][j] = old_misc_i[i][j]; } } + +cTown* cCurTown::operator -> (){ + return record; +} + +bool cCurTown::loaded() const{ + return record != NULL; +} + +void cCurTown::unload(){ + delete record; + record = NULL; +} + diff --git a/osx/universe.h b/osx/universe.h index 05395692..412f68d7 100644 --- a/osx/universe.h +++ b/osx/universe.h @@ -18,10 +18,10 @@ namespace legacy { class cCurTown { public: + cTown* record; // formerly current_town_type short num; // 200 if outdoors (my addition) short difficulty; - cTown* town; char explored[64][64]; bool hostile; cPopulation monst; @@ -42,6 +42,10 @@ public: void append(legacy::stored_town_maps_type& old); void append(unsigned char(& old_sfx)[64][64], unsigned char(& old_misc_i)[64][64]); void cCurTown::append(legacy::big_tr_type& old); + + cTown* operator -> (); + bool loaded() const; + void unload(); }; class cCurOut {