diff --git a/osx/Scenario Editor/scen.graphics.cpp b/osx/Scenario Editor/scen.graphics.cpp index b9e0696c..dc5fde8c 100644 --- a/osx/Scenario Editor/scen.graphics.cpp +++ b/osx/Scenario Editor/scen.graphics.cpp @@ -862,11 +862,11 @@ void draw_terrain(){ from_rect = calc_rect(i,3); Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,1,0); } - for (x = 0; x < 64; x++) + for (x = 0; x < town->max_items(); x++) if ((cen_x + q - 4 == town->preset_items[x].loc.x) && (cen_y + r - 4 == town->preset_items[x].loc.y) && (town->preset_items[x].code >= 0)) { } - for (x = 0; x < 60; x++) + for (x = 0; x < town->max_monst(); x++) if ((cen_x + q - 4 == town->creatures(x).start_loc.x) && (cen_y + r - 4 == town->creatures(x).start_loc.y) && (town->creatures(x).number != 0)) { } @@ -956,7 +956,7 @@ void draw_monsts() { location where_draw,store_loc; GrafPtr cur_port; - for (i = 0; i < 60; i++) + for (i = 0; i < town->max_monst(); i++) if (town->creatures(i).number != 0) { where_draw.x = town->creatures(i).start_loc.x - cen_x + 4; where_draw.y = town->creatures(i).start_loc.y - cen_y + 4; @@ -1014,7 +1014,7 @@ void draw_items() { short pic_num; GrafPtr cur_port; - for (i = 0; i < 64; i++) { + for (i = 0; i < town->max_items(); i++) { if (town->preset_items[i].code >= 0) { where_draw.x = town->preset_items[i].loc.x - cen_x + 4; where_draw.y = town->preset_items[i].loc.y - cen_y + 4; diff --git a/osx/Scenario Editor/scen.graphics.h b/osx/Scenario Editor/scen.graphics.h index 55ed85fb..41890d33 100644 --- a/osx/Scenario Editor/scen.graphics.h +++ b/osx/Scenario Editor/scen.graphics.h @@ -21,7 +21,7 @@ void draw_one_tiny_terrain_spot (short i,short j,unsigned short terrain_to_draw) void Draw_Some_Item ( GWorldPtr src_gworld,Rect src_rect,GWorldPtr targ_gworld,location target, char masked,short main_win); //void rect_draw_some_item (GWorldPtr src_gworld,Rect src_rect,GWorldPtr targ_gworld,Rect targ_rect,char masked,short main_win); -Rect get_template_rect (unsigned char type_wanted); +Rect get_template_rect (unsigned short type_wanted); void draw_frames(); void place_location(); void place_just_location(); diff --git a/osx/classes/regtown.cpp b/osx/classes/regtown.cpp index 8713a9a8..a68588ca 100644 --- a/osx/classes/regtown.cpp +++ b/osx/classes/regtown.cpp @@ -259,3 +259,15 @@ short cMedTown::max_monst(){ short cTinyTown::max_monst(){ return 30; } + +short cBigTown::max_items(){ + return 64; +} + +short cMedTown::max_items(){ + return 64; +} + +short cTinyTown::max_items(){ + return 64; +} diff --git a/osx/classes/regtown.h b/osx/classes/regtown.h index 20b731fb..6f8d9385 100644 --- a/osx/classes/regtown.h +++ b/osx/classes/regtown.h @@ -31,6 +31,7 @@ public: unsigned char& lighting(size_t i, size_t r); short max_dim(); short max_monst(); + short max_items(); cBigTown(); void writeTo(std::ostream& file); @@ -50,6 +51,7 @@ public: unsigned char& lighting(size_t i, size_t r); short max_dim(); short max_monst(); + short max_items(); cMedTown(); void writeTo(std::ostream& file); @@ -69,6 +71,7 @@ public: unsigned char& lighting(size_t i, size_t r); short max_dim(); short max_monst(); + short max_items(); cTinyTown(); void writeTo(std::ostream& file); diff --git a/osx/classes/tmpltown.cpp b/osx/classes/tmpltown.cpp index ff59f8bd..9e3853f0 100644 --- a/osx/classes/tmpltown.cpp +++ b/osx/classes/tmpltown.cpp @@ -37,3 +37,7 @@ short cBigTemplTown::max_dim(){ short cBigTemplTown::max_monst(){ return 30; } + +short cBigTemplTown::max_items(){ + return 64; +} diff --git a/osx/classes/tmpltown.h b/osx/classes/tmpltown.h index b513bb10..86101d4e 100644 --- a/osx/classes/tmpltown.h +++ b/osx/classes/tmpltown.h @@ -45,6 +45,7 @@ public: unsigned char& lighting(size_t i, size_t r); short max_dim(); short max_monst(); + short max_items(); void writeTo(std::ostream& file); }; @@ -61,6 +62,7 @@ public: unsigned char& lighting(size_t i, size_t r); short max_dim(); short max_monst(); + short max_items(); void writeTo(std::ostream& file); }; @@ -77,6 +79,7 @@ public: unsigned char& lighting(size_t i, size_t r); short max_dim(); short max_monst(); + short max_items(); }; // City blocks - I want to figure out how to use these sometime. diff --git a/osx/classes/town.h b/osx/classes/town.h index 7053dbed..e5a68594 100644 --- a/osx/classes/town.h +++ b/osx/classes/town.h @@ -101,6 +101,7 @@ public: virtual unsigned char& lighting(size_t i, size_t r) = 0; virtual short max_dim() = 0; virtual short max_monst() = 0; + virtual short max_items() = 0; cTown(); cTown(short size); diff --git a/osx/oldstructs.h b/osx/oldstructs.h index ed8a7165..811e6b4e 100644 --- a/osx/oldstructs.h +++ b/osx/oldstructs.h @@ -18,358 +18,359 @@ namespace legacy { // // number of right slots for scrolling list on page at 1 time struct location { - char x,y __attribute__((aligned(2))); - }; + char x,y; + } __attribute__((packed)); struct special_node_type { - short type,sd1,sd2,pic,m1,m2,ex1a,ex1b,ex2a,ex2b,jumpto __attribute__((aligned(2))); - }; + short type,sd1,sd2,pic,m1,m2,ex1a,ex1b,ex2a,ex2b,jumpto; + } __attribute__((packed)); struct talking_node_type { - short personality,type __attribute__((aligned(2))); - char link1[4],link2[4] __attribute__((aligned(2))); - short extras[4] __attribute__((aligned(2))); - }; + short personality,type; + char link1[4],link2[4]; + short extras[4]; + } __attribute__((packed)); struct talking_record_type { - unsigned char strlens[200] __attribute__((aligned(2))); - talking_node_type talk_nodes[60] __attribute__((aligned(2))); - }; + unsigned char strlens[200]; + talking_node_type talk_nodes[60]; + } __attribute__((packed)); struct terrain_type_type { - short picture __attribute__((aligned(2))); - unsigned char blockage,flag1,flag2,special,trans_to_what,fly_over,boat_over __attribute__((aligned(2))); - unsigned char block_horse,light_radius,step_sound,shortcut_key,res1,res2,res3 __attribute__((aligned(2))); - }; + short picture; + unsigned char blockage,flag1,flag2,special,trans_to_what,fly_over,boat_over; + unsigned char block_horse,light_radius,step_sound,shortcut_key,res1,res2,res3; + } __attribute__((packed)); struct wandering_type { - unsigned char monst[4] __attribute__((aligned(2))); - }; + unsigned char monst[4]; + } __attribute__((packed)); struct out_wandering_type { - unsigned char monst[7] __attribute__((aligned(2))); - unsigned char friendly[3] __attribute__((aligned(2))); - short spec_on_meet,spec_on_win,spec_on_flee,cant_flee __attribute__((aligned(2))); - short end_spec1,end_spec2 __attribute__((aligned(2))); - }; + unsigned char monst[7]; + unsigned char friendly[3]; + short spec_on_meet,spec_on_win,spec_on_flee,cant_flee; + short end_spec1,end_spec2; + } __attribute__((packed)); struct outdoor_record_type { - unsigned char terrain[48][48] __attribute__((aligned(2))); - location special_locs[18] __attribute__((aligned(2))); - unsigned char special_id[18] __attribute__((aligned(2))); - location exit_locs[8] __attribute__((aligned(2))); - char exit_dests[8] __attribute__((aligned(2))); - location sign_locs[8] __attribute__((aligned(2))); - out_wandering_type wandering[4],special_enc[4] __attribute__((aligned(2))); - location wandering_locs[4] __attribute__((aligned(2))); - Rect info_rect[8] __attribute__((aligned(2))); - unsigned char strlens[180] __attribute__((aligned(2))); - special_node_type specials[60] __attribute__((aligned(2))); - }; + unsigned char terrain[48][48]; + location special_locs[18]; + unsigned char special_id[18]; + location exit_locs[8]; + char exit_dests[8]; + location sign_locs[8]; + out_wandering_type wandering[4],special_enc[4]; + location wandering_locs[4]; + Rect info_rect[8]; + unsigned char strlens[180]; + special_node_type specials[60]; + } __attribute__((packed)); struct creature_start_type { - unsigned char number __attribute__((aligned(2))); - unsigned char start_attitude __attribute__((aligned(2))); - location start_loc __attribute__((aligned(2))); - unsigned char mobile __attribute__((aligned(2))); - unsigned char time_flag __attribute__((aligned(2))); - unsigned char extra1,extra2 __attribute__((aligned(2))); - short spec1, spec2 __attribute__((aligned(2))); - char spec_enc_code,time_code __attribute__((aligned(2))); - short monster_time,personality __attribute__((aligned(2))); - short special_on_kill,facial_pic __attribute__((aligned(2))); - }; + unsigned char number; + unsigned char start_attitude; + location start_loc; + unsigned char mobile; + unsigned char time_flag; + unsigned char extra1,extra2; + short spec1, spec2; + char spec_enc_code,time_code; + short monster_time,personality; + short special_on_kill,facial_pic; + } __attribute__((packed)); struct short_item_record_type { - short variety, item_level __attribute__((aligned(2))); - char awkward, bonus, protection, charges, type __attribute__((aligned(2))); - unsigned char graphic_num,ability, type_flag, is_special __attribute__((aligned(2))); - short value __attribute__((aligned(2))); - bool identified, magic __attribute__((aligned(2))); - unsigned char weight, description_flag __attribute__((aligned(2))); - char full_name[25], name[15] __attribute__((aligned(2))); - unsigned char reserved1,reserved2 __attribute__((aligned(2))); - unsigned char magic_use_type, ability_strength, treas_class, real_abil __attribute__((aligned(2))); - }; + short variety, item_level; + char awkward, bonus, protection, charges, type; + unsigned char graphic_num,ability, type_flag, is_special; + short value; + bool identified, magic; + unsigned char weight, description_flag; + char full_name[25], name[15]; + unsigned char reserved1,reserved2; + unsigned char magic_use_type, ability_strength, treas_class, real_abil; + } __attribute__((packed)); struct item_record_type { - short variety, item_level __attribute__((aligned(2))); - char awkward, bonus, protection, charges, type, magic_use_type __attribute__((aligned(2))); - unsigned char graphic_num,ability, ability_strength,type_flag, is_special __attribute__((aligned(2))); - short value __attribute__((aligned(2))); - unsigned char weight, special_class __attribute__((aligned(2))); - location item_loc __attribute__((aligned(2))); - char full_name[25], name[15] __attribute__((aligned(2))); - unsigned char treas_class,item_properties,reserved1,reserved2 __attribute__((aligned(2))); - }; + short variety, item_level; + char awkward, bonus, protection, charges, type, magic_use_type; + unsigned char graphic_num,ability, ability_strength,type_flag, is_special; + short value __attribute__((aligned(2))); + unsigned char weight, special_class; + location item_loc; + char full_name[25], name[15]; + unsigned char treas_class,item_properties,reserved1,reserved2; + } __attribute__((packed)); struct preset_item_type { - location item_loc __attribute__((aligned(2))); - short item_code,ability __attribute__((aligned(2))); - unsigned char charges,always_there,property,contained __attribute__((aligned(2))); - }; + location item_loc; + short item_code,ability; + unsigned char charges,always_there,property,contained; + } __attribute__((packed)); struct preset_field_type { - location field_loc __attribute__((aligned(2))); - short field_type __attribute__((aligned(2))); - }; + location field_loc; + short field_type; + } __attribute__((packed)); struct town_record_type { - short town_chop_time,town_chop_key __attribute__((aligned(2))); - wandering_type wandering[4] __attribute__((aligned(2))); - location wandering_locs[4] __attribute__((aligned(2))); - location special_locs[50] __attribute__((aligned(2))); - unsigned char spec_id[50] __attribute__((aligned(2))); - location sign_locs[15] __attribute__((aligned(2))); - short lighting __attribute__((aligned(2))); - location start_locs[4] __attribute__((aligned(2))); - location exit_locs[4] __attribute__((aligned(2))); - short exit_specs[4] __attribute__((aligned(2))); - Rect in_town_rect __attribute__((aligned(2))); - preset_item_type preset_items[64] __attribute__((aligned(2))); - short max_num_monst __attribute__((aligned(2))); - preset_field_type preset_fields[50] __attribute__((aligned(2))); - short spec_on_entry,spec_on_entry_if_dead __attribute__((aligned(2))); - short timer_spec_times[8] __attribute__((aligned(2))); - short timer_specs[8] __attribute__((aligned(2))); - unsigned char strlens[180] __attribute__((aligned(2))); - special_node_type specials[100] __attribute__((aligned(2))); - unsigned char specials1,specials2,res1,res2 __attribute__((aligned(2))); - short difficulty __attribute__((aligned(2))); - }; + short town_chop_time,town_chop_key; + wandering_type wandering[4]; + location wandering_locs[4]; + location special_locs[50]; + unsigned char spec_id[50]; + location sign_locs[15]; + short lighting; + location start_locs[4]; + location exit_locs[4]; + short exit_specs[4]; + Rect in_town_rect; + preset_item_type preset_items[64]; + short max_num_monst; + preset_field_type preset_fields[50]; + short spec_on_entry,spec_on_entry_if_dead; + short timer_spec_times[8]; + short timer_specs[8]; + unsigned char strlens[180]; + special_node_type specials[100]; + unsigned char specials1,specials2,res1,res2; + short difficulty; + } __attribute__((packed)); struct big_tr_type { - unsigned char terrain[64][64] __attribute__((aligned(2))); - Rect room_rect[16] __attribute__((aligned(2))); - creature_start_type creatures[60] __attribute__((aligned(2))); - unsigned char lighting[8][64] __attribute__((aligned(2))); - }; + unsigned char terrain[64][64]; + Rect room_rect[16]; + creature_start_type creatures[60]; + unsigned char lighting[8][64]; + } __attribute__((packed)); struct ave_tr_type { - unsigned char terrain[48][48] __attribute__((aligned(2))); - Rect room_rect[16] __attribute__((aligned(2))); - creature_start_type creatures[40] __attribute__((aligned(2))); - unsigned char lighting[6][48] __attribute__((aligned(2))); - }; + unsigned char terrain[48][48]; + Rect room_rect[16]; + creature_start_type creatures[40]; + unsigned char lighting[6][48]; + } __attribute__((packed)); struct tiny_tr_type { - unsigned char terrain[32][32] __attribute__((aligned(2))); - Rect room_rect[16] __attribute__((aligned(2))); - creature_start_type creatures[30] __attribute__((aligned(2))); - unsigned char lighting[4][32] __attribute__((aligned(2))); - }; + unsigned char terrain[32][32]; + Rect room_rect[16]; + creature_start_type creatures[30]; + unsigned char lighting[4][32]; + } __attribute__((packed)); struct city_block_type { - short block_type __attribute__((aligned(2))); - short block_destroy_time __attribute__((aligned(2))); - char block_alignment __attribute__((aligned(2))); - char block_key_time __attribute__((aligned(2))); - location block_loc __attribute__((aligned(2))); - }; + short block_type; + short block_destroy_time; + char block_alignment; + char block_key_time; + location block_loc; + } __attribute__((packed)); struct city_ter_rect_type { - Rect what_rect __attribute__((aligned(2))); - unsigned char ter_type __attribute__((aligned(2))); - unsigned char hollow __attribute__((aligned(2))); - }; + Rect what_rect; + unsigned char ter_type; + unsigned char hollow; + } __attribute__((packed)); struct template_town_type { - creature_start_type creatures[30] __attribute__((aligned(2))); - city_block_type city_block[15] __attribute__((aligned(2))); - city_ter_rect_type city_ter_rect[10] __attribute__((aligned(2))); - }; + creature_start_type creatures[30]; + city_block_type city_block[15]; + city_ter_rect_type city_ter_rect[10]; + } __attribute__((packed)); struct scen_item_data_type { - item_record_type scen_items[400] __attribute__((aligned(2))); - char monst_names[256][20] __attribute__((aligned(2))); - char ter_names[256][30] __attribute__((aligned(2))); - }; + item_record_type scen_items[400]; + char monst_names[256][20]; + char ter_names[256][30]; + } __attribute__((packed)); struct item_storage_shortcut_type { - short ter_type,item_num[10],item_odds[10],property __attribute__((aligned(2))); - }; + short ter_type,item_num[10],item_odds[10],property; + } __attribute__((packed)); struct monster_record_type { - unsigned char m_num,level,m_name[26] __attribute__((aligned(2))); - short health,m_health,mp,max_mp __attribute__((aligned(2))); - unsigned char armor,skill __attribute__((aligned(2))); - short a[3] __attribute__((aligned(2))); - unsigned char a1_type,a23_type,m_type,speed,ap,mu,cl,breath,breath_type,treasure,spec_skill,poison __attribute__((aligned(2))); - short morale,m_morale __attribute__((aligned(2))); - short corpse_item,corpse_item_chance __attribute__((aligned(2))); - short status[15] __attribute__((aligned(2))); - unsigned char direction,immunities,x_width,y_width,radiate_1,radiate_2 __attribute__((aligned(2))); - unsigned char default_attitude,summon_type,default_facial_pic,res1,res2,res3 __attribute__((aligned(2))); - short picture_num __attribute__((aligned(2))); + unsigned char m_num,level,m_name[26]; + short health,m_health,mp,max_mp; + unsigned char armor,skill; + short a[3]; + unsigned char a1_type,a23_type,m_type,speed,ap,mu,cl,breath,breath_type,treasure,spec_skill,poison; + short morale,m_morale; + short corpse_item,corpse_item_chance; + short status[15]; + unsigned char direction,immunities,x_width,y_width,radiate_1,radiate_2; + unsigned char default_attitude,summon_type,default_facial_pic,res1,res2,res3; + short picture_num; - }; + } __attribute__((packed)); struct horse_record_type { - location horse_loc,horse_loc_in_sec,horse_sector __attribute__((aligned(2))); - short which_town __attribute__((aligned(2))); - bool exists,property __attribute__((aligned(2))); - }; + location horse_loc,horse_loc_in_sec,horse_sector; + short which_town; + bool exists,property; + } __attribute__((packed)); struct boat_record_type { - location boat_loc,boat_loc_in_sec,boat_sector __attribute__((aligned(2))); - short which_town __attribute__((aligned(2))); - bool exists,property __attribute__((aligned(2))); - }; + location boat_loc,boat_loc_in_sec,boat_sector; + short which_town; + bool exists,property; + } __attribute__((packed)); struct talk_save_type { - short personality __attribute__((aligned(2))); - short town_num __attribute__((aligned(2))); - short str1,str2 __attribute__((aligned(2))); - }; + short personality; + short town_num; + short str1,str2; + } __attribute__((packed)); struct creature_data_type { - short active,attitude __attribute__((aligned(2))); - unsigned char number __attribute__((aligned(2))); - location m_loc __attribute__((aligned(2))); - monster_record_type m_d __attribute__((aligned(2))); - short mobile __attribute__((aligned(2))); - short summoned __attribute__((aligned(2))); - creature_start_type monst_start __attribute__((aligned(2))); - }; + short active,attitude; + unsigned char number; + location m_loc; + monster_record_type m_d; + short mobile; + short summoned; + creature_start_type monst_start; + } __attribute__((packed)); struct creature_list_type { - creature_data_type dudes[60] __attribute__((aligned(2))); - short which_town __attribute__((aligned(2))); - short friendly __attribute__((aligned(2))); - }; + creature_data_type dudes[60]; + short which_town; + short friendly; + } __attribute__((packed)); struct outdoor_creature_type { - bool exists __attribute__((aligned(2))); - short direction __attribute__((aligned(2))); - out_wandering_type what_monst __attribute__((aligned(2))); - location which_sector,m_loc __attribute__((aligned(2))); - }; + bool exists; + short direction; + out_wandering_type what_monst; + location which_sector,m_loc; + } __attribute__((packed)); struct party_record_type { - long age __attribute__((aligned(2))); - short gold,food __attribute__((aligned(2))); - unsigned char stuff_done[310][10],item_taken[200][8] __attribute__((aligned(2))); - short light_level __attribute__((aligned(2))); - location outdoor_corner,i_w_c,p_loc,loc_in_sec __attribute__((aligned(2))); - boat_record_type boats[30] __attribute__((aligned(2))); - horse_record_type horses[30] __attribute__((aligned(2))); - creature_list_type creature_save[4] __attribute__((aligned(2))); - short in_boat,in_horse __attribute__((aligned(2))); - outdoor_creature_type out_c[10] __attribute__((aligned(2))); - item_record_type magic_store_items[5][10] __attribute__((aligned(2))); - short imprisoned_monst[4] __attribute__((aligned(2))); - char m_seen[256] __attribute__((aligned(2))); - char journal_str[50] __attribute__((aligned(2))); - short journal_day[50] __attribute__((aligned(2))); - short special_notes_str[140][2] __attribute__((aligned(2))); - talk_save_type talk_save[120] __attribute__((aligned(2))); - short direction,at_which_save_slot __attribute__((aligned(2))); - char alchemy[20] __attribute__((aligned(2))); - bool can_find_town[200] __attribute__((aligned(2))); - short key_times[100] __attribute__((aligned(2))); - short party_event_timers[30] __attribute__((aligned(2))); - short global_or_town[30] __attribute__((aligned(2))); - short node_to_call[30] __attribute__((aligned(2))); - char spec_items[50],help_received[120] __attribute__((aligned(2))); - short m_killed[200] __attribute__((aligned(2))); - long total_m_killed,total_dam_done,total_xp_gained,total_dam_taken __attribute__((aligned(2))); - char scen_name[256] __attribute__((aligned(2))); - }; + long age; + short gold,food; + unsigned char stuff_done[310][10],item_taken[200][8]; + short light_level; + location outdoor_corner,i_w_c,p_loc,loc_in_sec; + boat_record_type boats[30]; + horse_record_type horses[30]; + creature_list_type creature_save[4]; + short in_boat,in_horse; + outdoor_creature_type out_c[10]; + item_record_type magic_store_items[5][10]; + short imprisoned_monst[4]; + char m_seen[256]; + char journal_str[50]; + short journal_day[50]; + short special_notes_str[140][2]; + talk_save_type talk_save[120]; + short direction,at_which_save_slot; + char alchemy[20]; + bool can_find_town[200]; + short key_times[100]; + short party_event_timers[30]; + short global_or_town[30]; + short node_to_call[30]; + char spec_items[50],help_received[120]; + short m_killed[200]; + long total_m_killed,total_dam_done,total_xp_gained,total_dam_taken; + char scen_name[256]; + } __attribute__((packed)); struct scenario_data_type { - unsigned char out_width,out_height,difficulty,intro_pic,default_ground __attribute__((aligned(2))); - unsigned char town_size[200] __attribute__((aligned(2))); - unsigned char town_hidden[200] __attribute__((aligned(2))); - short flag_a __attribute__((aligned(2))); - short intro_mess_pic,intro_mess_len __attribute__((aligned(2))); - location where_start,out_sec_start,out_start __attribute__((aligned(2))); - short which_town_start __attribute__((aligned(2))); - short flag_b __attribute__((aligned(2))); - short town_data_size[200][5] __attribute__((aligned(2))); - short town_to_add_to[10] __attribute__((aligned(2))); - short flag_to_add_to_town[10][2] __attribute__((aligned(2))); - short flag_c __attribute__((aligned(2))); - short out_data_size[100][2] __attribute__((aligned(2))); - Rect store_item_rects[3] __attribute__((aligned(2))); - short store_item_towns[3] __attribute__((aligned(2))); - short flag_e __attribute__((aligned(2))); - short special_items[50] __attribute__((aligned(2))); - short special_item_special[50] __attribute__((aligned(2))); - short rating,uses_custom_graphics __attribute__((aligned(2))); - short flag_f __attribute__((aligned(2))); - monster_record_type scen_monsters[256] __attribute__((aligned(2))); - boat_record_type scen_boats[30] __attribute__((aligned(2))); - horse_record_type scen_horses[30] __attribute__((aligned(2))); - short flag_g __attribute__((aligned(2))); - terrain_type_type ter_types[256] __attribute__((aligned(2))); - short scenario_timer_times[20] __attribute__((aligned(2))); - short scenario_timer_specs[20] __attribute__((aligned(2))); - short flag_h __attribute__((aligned(2))); - special_node_type scen_specials[256] __attribute__((aligned(2))); - item_storage_shortcut_type storage_shortcuts[10] __attribute__((aligned(2))); - short flag_d __attribute__((aligned(2))); - unsigned char scen_str_len[300] __attribute__((aligned(2))); - short flag_i __attribute__((aligned(2))); - location last_out_edited __attribute__((aligned(2))); - short last_town_edited __attribute__((aligned(2))); - }; + unsigned char out_width,out_height,difficulty,intro_pic,default_ground; + unsigned char town_size[200]; + unsigned char town_hidden[200]; + short flag_a; + short intro_mess_pic,intro_mess_len; + location where_start __attribute__((aligned(2))); + location out_sec_start,out_start; + short which_town_start; + short flag_b; + short town_data_size[200][5]; + short town_to_add_to[10]; + short flag_to_add_to_town[10][2]; + short flag_c; + short out_data_size[100][2]; + Rect store_item_rects[3]; + short store_item_towns[3]; + short flag_e; + short special_items[50]; + short special_item_special[50]; + short rating,uses_custom_graphics; + short flag_f; + monster_record_type scen_monsters[256]; + boat_record_type scen_boats[30]; + horse_record_type scen_horses[30]; + short flag_g; + terrain_type_type ter_types[256]; + short scenario_timer_times[20]; + short scenario_timer_specs[20]; + short flag_h; + special_node_type scen_specials[256]; + item_storage_shortcut_type storage_shortcuts[10]; + short flag_d; + unsigned char scen_str_len[300]; + short flag_i; + location last_out_edited; + short last_town_edited; + } __attribute__((packed)); struct setup_save_type { - unsigned char setup[4][64][64] __attribute__((aligned(2))); - }; + unsigned char setup[4][64][64]; + } __attribute__((packed)); struct pc_record_type { - short main_status __attribute__((aligned(2))); - char name[20] __attribute__((aligned(2))); - short skills[30] __attribute__((aligned(2))); - short max_health,cur_health,max_sp,cur_sp,experience,skill_pts,level __attribute__((aligned(2))); - short status[15] __attribute__((aligned(2))); - item_record_type items[24] __attribute__((aligned(2))); - bool equip[24] __attribute__((aligned(2))); - bool priest_spells[62],mage_spells[62] __attribute__((aligned(2))); - short which_graphic,weap_poisoned __attribute__((aligned(2))); - bool advan[15],traits[15] __attribute__((aligned(2))); - short race,exp_adj,direction __attribute__((aligned(2))); - }; + short main_status; + char name[20]; + short skills[30]; + short max_health,cur_health,max_sp,cur_sp,experience,skill_pts,level; + short status[15]; + item_record_type items[24]; + bool equip[24]; + bool priest_spells[62],mage_spells[62]; + short which_graphic,weap_poisoned; + bool advan[15],traits[15]; + short race,exp_adj,direction; + } __attribute__((packed)); struct town_item_list { - item_record_type items[115] __attribute__((aligned(2))); - }; + item_record_type items[115]; + } __attribute__((packed)); struct stored_town_maps_type { - char town_maps[200][8][64] __attribute__((aligned(2))); - }; + char town_maps[200][8][64]; + } __attribute__((packed)); typedef struct stored_outdoor_maps_type { - char outdoor_maps[100][6][48] __attribute__((aligned(2))); - }; + char outdoor_maps[100][6][48]; + } __attribute__((packed)); struct stored_items_list_type { - item_record_type items[115] __attribute__((aligned(2))); - }; + item_record_type items[115]; + } __attribute__((packed)); struct current_town_type { - short town_num, difficulty __attribute__((aligned(2))); - town_record_type town __attribute__((aligned(2))); - char explored[64][64] __attribute__((aligned(2))); - bool hostile __attribute__((aligned(2))); - creature_list_type monst __attribute__((aligned(2))); - bool in_boat __attribute__((aligned(2))); - location p_loc __attribute__((aligned(2))); - }; + short town_num, difficulty; + town_record_type town; + char explored[64][64]; + bool hostile; + creature_list_type monst; + bool in_boat; + location p_loc; + } __attribute__((packed)); struct out_info_type { - char expl[96][96] __attribute__((aligned(2))); - }; + char expl[96][96]; + } __attribute__((packed)); // struct piles_of_stuff_dumping_type { -// char strings_ls[NLS][40] __attribute__((aligned(2))); -// char strings_rs[NRS][40] __attribute__((aligned(2))); -// char town_strs[180][256] __attribute__((aligned(2))); -// char out_strs[120][256] __attribute__((aligned(2))); -// char scen_strs[270][256] __attribute__((aligned(2))); -// char talk_strs[170][256] __attribute__((aligned(2))); -// scen_item_data_type scen_item_list __attribute__((aligned(2))); +// char strings_ls[NLS][40]; +// char strings_rs[NRS][40]; +// char town_strs[180][256]; +// char out_strs[120][256]; +// char scen_strs[270][256]; +// char talk_strs[170][256]; +// scen_item_data_type scen_item_list; // }; }; diff --git a/osx/tools/fileio.cpp b/osx/tools/fileio.cpp index 6a240038..63ef31f2 100644 --- a/osx/tools/fileio.cpp +++ b/osx/tools/fileio.cpp @@ -330,7 +330,6 @@ bool load_scenario(FSSpec file_to_load){ } len = (long) sizeof(legacy::scenario_data_type); - temp_scenario = new legacy::scenario_data_type; error = FSRead(file_id, &len, (char *) temp_scenario); if (error != 0){ FSClose(file_id);