From 440eb5a765a0e9b5ea79e2d2dffbf641d47bb36c Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sun, 26 Apr 2009 22:30:53 +0000 Subject: [PATCH] Starting to turn the constants in boe.consts.h into enums. So far the overall mode and the player main status have been changed. Also tried in vain to fix the problem with controls not being drawn. git-svn-id: http://openexile.googlecode.com/svn/trunk@34 4ebdad44-0ea0-11de-aab3-ff745001d230 --- osx/Scenario Editor/scen.actions.cpp | 3 +- osx/boe.actions.cpp | 38 +++++++------- osx/boe.combat.cpp | 12 ++--- osx/boe.consts.h | 61 +++++++++++----------- osx/boe.dlgutil.cpp | 15 +++--- osx/boe.fields.cpp | 3 +- osx/boe.fileio.cpp | 3 +- osx/boe.graphics.cpp | 5 +- osx/boe.graphutil.cpp | 7 +-- osx/boe.items.cpp | 12 +++-- osx/boe.locutils.cpp | 5 +- osx/boe.main.cpp | 9 ++-- osx/boe.monster.cpp | 2 +- osx/boe.newgraph.cpp | 9 ++-- osx/boe.party.cpp | 63 +++++++++++----------- osx/boe.party.h | 4 +- osx/boe.specials.cpp | 16 ++++-- osx/boe.text.cpp | 5 +- osx/boe.town.cpp | 5 +- osx/boe.townspec.cpp | 8 +-- osx/misc/dlglowlevel.cpp | 78 ++++++++++++++++++---------- osx/misc/dlgtool.cpp | 18 ++++--- osx/pc.cpp | 20 +++++-- osx/pc.h | 26 +++++++++- 24 files changed, 261 insertions(+), 166 deletions(-) diff --git a/osx/Scenario Editor/scen.actions.cpp b/osx/Scenario Editor/scen.actions.cpp index cfafe510..f1d407d3 100644 --- a/osx/Scenario Editor/scen.actions.cpp +++ b/osx/Scenario Editor/scen.actions.cpp @@ -44,7 +44,8 @@ short flood_count = 0; Rect terrain_rects[256],terrain_rect_base = {0,0,16,16},command_rects[21]; -extern short cen_x, cen_y, overall_mode,cur_town; +extern short cen_x, cen_y, cur_town; +extern eGameMode overall_mode; extern Boolean mouse_button_held,editing_town; extern short cur_viewing_mode,user_given_password; extern cTown* town; diff --git a/osx/boe.actions.cpp b/osx/boe.actions.cpp index b7fc3aac..26d7f1fe 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -86,7 +86,8 @@ short store_shop_type; short debug_ok = 0; short store_selling_values[8] = {0,0,0,0,0,0,0,0}; -extern short cen_x, cen_y, overall_mode, stat_window,give_delays,pc_moves[6]; +extern short cen_x, cen_y, stat_window,give_delays,pc_moves[6]; +extern eGameMode overall_mode; extern Point to_create; extern Boolean in_startup_mode,All_Done,play_sounds,frills_on,spell_forced,save_maps,monsters_going; extern Boolean debug_on,cartoon_happening,party_in_memory,in_scen_debug; @@ -356,7 +357,8 @@ Boolean handle_action(EventRecord event) } break; - case MODE_TOWN: case MODE_TALK_TOWN: case MODE_USE: case MODE_LOOK_TOWN: case 5: + case MODE_TOWN: case MODE_TALK_TOWN: case MODE_USE_TOWN: case MODE_LOOK_TOWN: case 5: + // I think 5 is "town drop" // cur_loc = c_town.p_loc; cur_loc = center; for (i = 0; i < 8; i++) @@ -370,7 +372,7 @@ Boolean handle_action(EventRecord event) case MODE_TALKING: case MODE_SHOPPING: break; case MODE_TOWN_TARGET: case MODE_COMBAT: case MODE_SPELL_TARGET: case MODE_FIRING: case MODE_THROWING: - case MODE_FANCY_TARGET: case MODE_DROPPING: case MODE_LOOK_COMBAT: + case MODE_FANCY_TARGET: case MODE_DROP_COMBAT: case MODE_LOOK_COMBAT: cur_loc = (overall_mode > MODE_COMBAT) ? center : pc_pos[current_pc]; for (i = 0; i < 9; i++) if (PtInRect (the_point, &combat_buttons[i]) == TRUE) { @@ -562,9 +564,9 @@ Boolean handle_action(EventRecord event) add_string_to_buf("Use: Select a space or item."); add_string_to_buf(" (Hit button again to cancel.)"); need_reprint = TRUE; - overall_mode = MODE_USE; + overall_mode = MODE_USE_TOWN; } - else if (overall_mode == MODE_USE) { + else if (overall_mode == MODE_USE_TOWN) { overall_mode = MODE_TOWN; need_reprint = TRUE; add_string_to_buf(" Cancelled."); @@ -930,7 +932,7 @@ Boolean handle_action(EventRecord event) // Begin : Targeting a space if ((overall_mode == MODE_SPELL_TARGET) || (overall_mode == MODE_FIRING) || (overall_mode == MODE_THROWING) || - (overall_mode == MODE_FANCY_TARGET) || (overall_mode == MODE_DROPPING)) { + (overall_mode == MODE_FANCY_TARGET) || (overall_mode == MODE_DROP_COMBAT)) { destination.x = destination.x + i - 4; destination.y = destination.y + j - 4; if (overall_mode == MODE_SPELL_TARGET) @@ -945,7 +947,7 @@ Boolean handle_action(EventRecord event) did_something = TRUE; center = pc_pos[current_pc]; } - if (overall_mode == MODE_DROPPING) { // dropping + if (overall_mode == MODE_DROP_COMBAT) { // dropping if (adjacent(pc_pos[current_pc],destination) == FALSE) add_string_to_buf("Drop: must be adjacent."); else { @@ -964,18 +966,18 @@ Boolean handle_action(EventRecord event) destination.x = destination.x + i - 4; destination.y = destination.y + j - 4; switch (overall_mode) { - case 3: + case MODE_TOWN_TARGET: cast_town_spell(destination); did_something = TRUE; break; - case 4: + case MODE_USE_TOWN: if (adjacent(destination,univ.town.p_loc) == FALSE) add_string_to_buf(" Must be adjacent. "); else { did_something = use_space(destination); } break; - case 5: + case MODE_DROP_TOWN: if (adjacent(univ.town.p_loc,destination) == FALSE) add_string_to_buf("Drop: must be adjacent."); else if (get_obscurity(destination.x,destination.y) == 5) @@ -1147,7 +1149,7 @@ Boolean handle_action(EventRecord event) add_string_to_buf("Item action: Finish what you're doing first."); else switch (j) { case 0: // equip - if (overall_mode == MODE_USE) { + if (overall_mode == MODE_USE_TOWN) { add_string_to_buf("Note: Clicking 'U' button by item"); add_string_to_buf(" uses the item."); use_item(stat_window, item_hit); @@ -1180,7 +1182,7 @@ Boolean handle_action(EventRecord event) else { add_string_to_buf("Drop item: Click where to drop item."); store_drop_item = item_hit; - overall_mode = (is_town()) ? 5 : MODE_DROPPING; + overall_mode = (is_town()) ? MODE_DROP_TOWN : MODE_DROP_COMBAT; } break; case 4: // info @@ -1401,8 +1403,8 @@ Boolean handle_action(EventRecord event) } else if (party_toast() == TRUE) { for (i = 0; i < 6; i++) - if (ADVEN[i].main_status == 5) { - ADVEN[i].main_status = 1; + if (ADVEN[i].main_status == MAIN_STATUS_FLED) { + ADVEN[i].main_status = MAIN_STATUS_ALIVE; if (is_combat()) { end_town_mode(0,univ.town.p_loc); add_string_to_buf("End combat. "); @@ -1754,7 +1756,7 @@ Boolean handle_keystroke(char chr,char chr2,EventRecord event) univ.party.gold += 100; univ.party.food += 100; for (i = 0; i < 6; i++) { - ADVEN[i].main_status = 1; + ADVEN[i].main_status = MAIN_STATUS_ALIVE; ADVEN[i].cur_health = ADVEN[i].max_health; ADVEN[i].cur_sp = 100; } @@ -2104,7 +2106,7 @@ void increase_age()//// if (PSD[SDF_PARTY_FLIGHT] == 1) { if (scenario.ter_types[univ.out.out[univ.party.p_loc.x][univ.party.p_loc.y]].blockage > 2) { add_string_to_buf(" You plummet to your deaths. "); - slay_party(2); + slay_party(MAIN_STATUS_DEAD); print_buf(); pause(150); } @@ -2366,10 +2368,10 @@ void drop_pc(short which) return; } add_string_to_buf("Delete PC: OK. "); - kill_pc(which,0); + kill_pc(which,MAIN_STATUS_ABSENT); for (i = which; i < 5; i++) ADVEN[i] = ADVEN[i + 1]; - ADVEN[5].main_status = 0; + ADVEN[5].main_status = MAIN_STATUS_ABSENT; set_stat_window(0); put_pc_screen(); } diff --git a/osx/boe.combat.cpp b/osx/boe.combat.cpp index 69578061..bf4ac55e 100644 --- a/osx/boe.combat.cpp +++ b/osx/boe.combat.cpp @@ -27,7 +27,7 @@ //extern current_town_type univ.town; //extern big_tr_type t_d; //extern town_item_list t_i; -extern short overall_mode; +extern eGameMode overall_mode; extern short which_combat_type; extern short stat_window; extern location center; @@ -434,7 +434,7 @@ Boolean pc_combat_move(location destination) //// } else if ((combat_terrain[destination.x][destination.y] == 90) && (which_combat_type == 0)) { if (get_ran(1,1,10) < 3) { - ADVEN[current_pc].main_status = 5; + ADVEN[current_pc].main_status = MAIN_STATUS_FLED; if (combat_active_pc == current_pc) combat_active_pc = 6; sprintf ((char *) create_line, "Moved: Fled. "); @@ -2320,7 +2320,7 @@ void monster_attack_pc(short who_att,short target) { add_string_to_buf(" Petrifying touch!"); print_buf(); - kill_pc(target,4); // 4 being the stoned (petrified, duh!) status + kill_pc(target,MAIN_STATUS_STONE); // 4 being the stoned (petrified, duh!) status } // Undead xp drain @@ -2621,7 +2621,7 @@ void monst_fire_missile(short m_num,short skill,short bless,short level,location else { sprintf ((char *) create_line, " %s is turned to stone. ",(char *) ADVEN[target].name); add_string_to_buf((char *) create_line); - kill_pc(target,4); + kill_pc(target,MAIN_STATUS_STONE); } } else { @@ -4010,8 +4010,8 @@ void end_combat() short i; for (i = 0; i < 6; i++) { - if (ADVEN[i].main_status == 5) - ADVEN[i].main_status = 1; + if (ADVEN[i].main_status == MAIN_STATUS_FLED) + ADVEN[i].main_status = MAIN_STATUS_ALIVE; ADVEN[i].status[0] = 0; ADVEN[i].status[1] = 0; ADVEN[i].status[3] = 0; diff --git a/osx/boe.consts.h b/osx/boe.consts.h index fe657226..0ace3e5a 100644 --- a/osx/boe.consts.h +++ b/osx/boe.consts.h @@ -64,24 +64,27 @@ */ /* overall mode; some seem to be missing */ -#define MODE_OUTDOORS 0 -#define MODE_TOWN 1 -#define MODE_TALK_TOWN 2 // looking for someone to talk -#define MODE_TOWN_TARGET 3 // spell target, that is -#define MODE_USE 4 -#define MODE_COMBAT 10 -#define MODE_SPELL_TARGET 11 -#define MODE_FIRING 12 // firing from bow or crossbow -#define MODE_THROWING 13 // throwing missle -#define MODE_FANCY_TARGET 14 // spell target, that is; I think it's for multitarget spells -#define MODE_DROPPING 15 -#define MODE_TALKING 20 -#define MODE_SHOPPING 21 -#define MODE_LOOK_OUTDOORS 35 // looking at something -#define MODE_LOOK_TOWN 36 -#define MODE_LOOK_COMBAT 37 -#define MODE_STARTUP 45 -#define MODE_RESTING 50 +enum eGameMode { + MODE_OUTDOORS = 0, + MODE_TOWN = 1, + MODE_TALK_TOWN = 2, // looking for someone to talk + MODE_TOWN_TARGET = 3, // spell target, that is + MODE_USE_TOWN = 4, + MODE_DROP_TOWN = 5, + MODE_COMBAT = 10, + MODE_SPELL_TARGET = 11, + MODE_FIRING = 12, // firing from bow or crossbow + MODE_THROWING = 13, // throwing missle + MODE_FANCY_TARGET = 14, // spell target, that is; I think it's for multitarget spells + MODE_DROP_COMBAT = 15, + MODE_TALKING = 20, + MODE_SHOPPING = 21, + MODE_LOOK_OUTDOORS = 35, // looking at something + MODE_LOOK_TOWN = 36, + MODE_LOOK_COMBAT = 37, + MODE_STARTUP = 45, + MODE_RESTING = 50, +}; // Scenario Editor Modes // 0 - drawing // 2 - town wandering arrival point @@ -130,17 +133,17 @@ //#define MODE_SCEN_INTRO 61 //#define MODE_ 62 -/* adven[i].main_status */ //complete -#define MAIN_STATUS_ABSENT 0 // absent, empty slot -#define MAIN_STATUS_ALIVE 1 -#define MAIN_STATUS_DEAD 2 -#define MAIN_STATUS_DUST 3 -#define MAIN_STATUS_STONE 4 -#define MAIN_STATUS_FLED 5 -#define MAIN_STATUS_SURFACE 6 // fled to surface? -#define MAIN_STATUS_WON 7 -/* main status modifiers */ -#define MAIN_STATUS_SPLIT 10 // split from party +///* adven[i].main_status */ //complete +//#define MAIN_STATUS_ABSENT 0 // absent, empty slot +//#define MAIN_STATUS_ALIVE 1 +//#define MAIN_STATUS_DEAD 2 +//#define MAIN_STATUS_DUST 3 +//#define MAIN_STATUS_STONE 4 +//#define MAIN_STATUS_FLED 5 +//#define MAIN_STATUS_SURFACE 6 // fled to surface? +//#define MAIN_STATUS_WON 7 +///* main status modifiers */ +//#define MAIN_STATUS_SPLIT 10 // split from party /* adven[i].skills */ //complete diff --git a/osx/boe.dlgutil.cpp b/osx/boe.dlgutil.cpp index 8b0bffa1..4f0992da 100644 --- a/osx/boe.dlgutil.cpp +++ b/osx/boe.dlgutil.cpp @@ -35,7 +35,8 @@ using std::vector; //extern big_tr_type t_d; -extern short stat_window,overall_mode,dialog_answer; +extern short stat_window,dialog_answer; +extern eGameMode overall_mode; //extern current_town_type univ.town; //extern party_record_type party; extern Boolean in_startup_mode,play_sounds,give_intro_hint,show_startup_splash; @@ -74,7 +75,8 @@ short store_tip_page_on = 0; // Talking vars word_rect_type store_words[50]; -short store_pre_talk_mode,store_personality,store_personality_graphic,shop_identify_cost; +eGameMode store_pre_talk_mode; +short store_personality,store_personality_graphic,shop_identify_cost; GWorldPtr talk_gworld = NULL; Boolean talk_end_forced; Str255 old_str1,old_str2,one_back1,one_back2; @@ -100,7 +102,8 @@ extern std::vector scen_header_strs; // n000 + i - magic store n item i short store_shop_items[30],store_shop_costs[30]; // talk_area_rect and talk_help_rect used for this too -short store_shop_min,store_shop_max,store_pre_shop_mode,store_cost_mult; +short store_shop_min,store_shop_max,store_cost_mult; +eGameMode store_pre_shop_mode; char store_store_name[256]; // 0 - whole area, 1 - active area 2 - graphic 3 - item name // 4 - item cost 5 - item extra str 6 - item help button @@ -299,7 +302,7 @@ void handle_sale(short what_chosen,short cost) ADVEN[current_pc].items[i].item_properties & 239; break; case 5: case 6: case 7: - ADVEN[current_pc].main_status = 1; break; + ADVEN[current_pc].main_status = MAIN_STATUS_ALIVE; break; case 8: ADVEN[current_pc].status[9] = 0; break; } @@ -1674,9 +1677,9 @@ void edit_party_event_filter (short item_hit) break; case 6: case 11: case 16: case 21: case 26: case 31: which_pc = (item_hit - 6) / 5; - if (ADVEN[which_pc].main_status != 0) { + if (ADVEN[which_pc].main_status != MAIN_STATUS_ABSENT) { if (FCD(1053,989) == 2) - ADVEN[which_pc].main_status = 0; + ADVEN[which_pc].main_status = MAIN_STATUS_ABSENT; put_party_stats(); } else { diff --git a/osx/boe.fields.cpp b/osx/boe.fields.cpp index 61abd7bc..613ead3a 100644 --- a/osx/boe.fields.cpp +++ b/osx/boe.fields.cpp @@ -8,7 +8,8 @@ #include "mathutil.h" //extern current_town_type univ.town; -extern short overall_mode,which_combat_type,current_pc,town_type; +extern short which_combat_type,current_pc,town_type; +extern eGameMode overall_mode; extern Boolean web,crate,barrel,fire_barrier,force_barrier,quickfire,force_wall,fire_wall,antimagic,scloud,ice_wall,blade_wall; extern Boolean sleep_field; //extern big_tr_type t_d; diff --git a/osx/boe.fileio.cpp b/osx/boe.fileio.cpp index eebaf77b..1f1622e1 100644 --- a/osx/boe.fileio.cpp +++ b/osx/boe.fileio.cpp @@ -38,7 +38,8 @@ DialogPtr the_dialog; //extern pc_record_type adven[6]; //extern cOutdoors outdoors[2][2]; //extern unsigned char out[96][96],out_e[96][96]; -extern short overall_mode,give_delays,stat_screen_mode; +extern short give_delays,stat_screen_mode; +extern eGameMode overall_mode; extern Boolean in_startup_mode,play_sounds,sys_7_avail,save_maps,party_in_memory,in_scen_debug; //extern current_town_type c_town; //extern town_item_list t_i; diff --git a/osx/boe.graphics.cpp b/osx/boe.graphics.cpp index 297670b3..fbb4cfc7 100644 --- a/osx/boe.graphics.cpp +++ b/osx/boe.graphics.cpp @@ -28,7 +28,8 @@ extern WindowPtr mainPtr; extern Rect windRect; -extern short stat_window,give_delays,overall_mode; +extern short stat_window,give_delays; +extern eGameMode overall_mode; extern short current_spell_range,town_type,store_anim_type; extern Boolean in_startup_mode,anim_onscreen,play_sounds,frills_on,startup_loaded,party_in_memory; extern short town_size[3]; @@ -2297,7 +2298,7 @@ void place_road(short q,short r,location where) void draw_rest_screen() { - short store_mode; + eGameMode store_mode; store_mode = overall_mode; overall_mode = MODE_RESTING; diff --git a/osx/boe.graphutil.cpp b/osx/boe.graphutil.cpp index 76cd10f7..6f79105c 100644 --- a/osx/boe.graphutil.cpp +++ b/osx/boe.graphutil.cpp @@ -20,7 +20,8 @@ extern WindowPtr mainPtr; extern Rect windRect; -extern short stat_window,give_delays,overall_mode; +extern short stat_window,give_delays; +extern eGameMode overall_mode; extern short current_spell_range,town_type; extern Boolean in_startup_mode,anim_onscreen,play_sounds,frills_on,startup_loaded,cartoon_happening; extern short town_size[3]; @@ -879,7 +880,7 @@ void make_town_trim(short mode) //mode; // 0 - town 1 - outdoor combat { location where; - short store_mode; + eGameMode store_mode; store_mode = overall_mode; overall_mode = (mode == 0) ? MODE_TOWN : MODE_COMBAT; @@ -904,7 +905,7 @@ void make_town_trim(short mode) void make_out_trim() { location where; - short store_mode; + eGameMode store_mode; store_mode = overall_mode; overall_mode = MODE_OUTDOORS; diff --git a/osx/boe.items.cpp b/osx/boe.items.cpp index 673f0945..e8f97f7f 100644 --- a/osx/boe.items.cpp +++ b/osx/boe.items.cpp @@ -25,7 +25,8 @@ #include "mathutil.h" #include "dlgutil.h" -extern short stat_window,overall_mode,current_cursor,which_combat_type,current_pc; +extern short stat_window,current_cursor,which_combat_type,current_pc; +extern eGameMode overall_mode; //extern party_record_type party; //extern current_town_type univ.town; //extern town_item_list univ.town.items; @@ -134,7 +135,8 @@ bool give_to_pc(short pc_num,cItemRec item,short print_result) } return FALSE; } - if (((free_space = pc_has_space(pc_num)) == 24) || (ADVEN[pc_num].main_status != 1)) + free_space = pc_has_space(pc_num); + if ((free_space == 24) || (ADVEN[pc_num].main_status != 1)) return FALSE; else { item.item_properties = item.item_properties & 253; // not property @@ -589,7 +591,7 @@ void drop_item(short pc_num,short item_num,location where_drop) else take_item(pc_num,item_num); break; - case 5: case MODE_DROPPING: + case MODE_DROP_TOWN: case MODE_DROP_COMBAT: loc = where_drop; if ((item_store.type_flag > 0) && (item_store.charges > 1)) { how_many = get_num_of_items(item_store.charges); @@ -846,8 +848,8 @@ void make_town_hostile() if (fry_party == TRUE) { for (i = 0; i < 6; i++) - if (ADVEN[i].main_status > 0) - ADVEN[i].main_status = 0; + if (ADVEN[i].main_status > MAIN_STATUS_ABSENT) + ADVEN[i].main_status = MAIN_STATUS_ABSENT; stat_window = 6; boom_anim_active = FALSE; } diff --git a/osx/boe.locutils.cpp b/osx/boe.locutils.cpp index a7207955..6b46dc16 100644 --- a/osx/boe.locutils.cpp +++ b/osx/boe.locutils.cpp @@ -21,7 +21,8 @@ location which_party_sec; //extern party_record_type party; //extern current_town_type univ.town; -extern short overall_mode,which_combat_type,current_pc,town_type; +extern short which_combat_type,current_pc,town_type; +extern eGameMode overall_mode; //extern big_tr_type t_d; //extern cOutdoors outdoors[2][2]; extern unsigned char combat_terrain[64][64]; @@ -136,7 +137,7 @@ location get_cur_loc() return univ.party.p_loc; break; - case MODE_TOWN: case MODE_TALK_TOWN: case MODE_TOWN_TARGET: case MODE_USE: case MODE_LOOK_TOWN: + case MODE_TOWN: case MODE_TALK_TOWN: case MODE_TOWN_TARGET: case MODE_USE_TOWN: case MODE_LOOK_TOWN: return univ.town.p_loc; break; diff --git a/osx/boe.main.cpp b/osx/boe.main.cpp index dd990824..c28e815c 100644 --- a/osx/boe.main.cpp +++ b/osx/boe.main.cpp @@ -89,7 +89,8 @@ location monster_targs[T_M]; short combat_posing_monster = -1, current_working_monster = -1; // 0-5 PC 100 + x - monster x Boolean fast_bang = FALSE; short spec_item_array[60]; -short overall_mode = MODE_STARTUP,current_spell_range; +short current_spell_range; +eGameMode overall_mode = MODE_STARTUP; Boolean first_update = TRUE,anim_onscreen = FALSE,frills_on = TRUE,sys_7_avail,suppress_stat_screen = FALSE; short stat_window = 0,store_modifier; Boolean monsters_going = FALSE,boom_anim_active = FALSE,cartoon_happening = FALSE; @@ -279,7 +280,7 @@ void Initialize(void) // To make the Random sequences truly random, we need to make the seed start // at a different number. An easy way to do this is to put the current time // and date into the seed. Since it is always incrementing the starting seed - // will always be different. Don‚Äôt for each call of Random, or the sequence + // will always be different. Don‚Äö√Ñ√¥t for each call of Random, or the sequence // will no longer be random. Only needed once, here in the init. // unsigned long time; @@ -800,7 +801,7 @@ void handle_file_menu(int item_hit) if (choice == 1) return; for (i = 0; i < 6; i++) - ADVEN[i].main_status = 0; + ADVEN[i].main_status = MAIN_STATUS_ABSENT; party_in_memory = FALSE; reload_startup(); in_startup_mode = TRUE; @@ -858,7 +859,7 @@ void handle_options_menu(int item_hit) choice = char_select_pc(0,0,"Delete who?"); if (choice < 6) { if ((i = FCD(1053,0)) == 2) - kill_pc(choice,0); + kill_pc(choice,MAIN_STATUS_ABSENT); } update_pc_graphics(); initiate_redraw(); diff --git a/osx/boe.monster.cpp b/osx/boe.monster.cpp index a0fa292a..26dc3589 100644 --- a/osx/boe.monster.cpp +++ b/osx/boe.monster.cpp @@ -19,7 +19,7 @@ //extern current_town_type univ.town; //extern party_record_type party; -extern short overall_mode; +extern eGameMode overall_mode; //extern cOutdoors univ.out.outdoors[2][2]; extern unsigned char combat_terrain[64][64];//,out[96][96]; extern short which_combat_type; diff --git a/osx/boe.newgraph.cpp b/osx/boe.newgraph.cpp index eb0c98f2..83f0d469 100644 --- a/osx/boe.newgraph.cpp +++ b/osx/boe.newgraph.cpp @@ -46,7 +46,8 @@ extern Rect windRect; extern long anim_ticks; extern PixPatHandle bg[]; extern WindowPtr mainPtr; -extern short dungeon_font_num,geneva_font_num,overall_mode,town_type,which_combat_type; +extern short dungeon_font_num,geneva_font_num,town_type,which_combat_type; +extern eGameMode overall_mode; extern Boolean play_sounds,boom_anim_active,cartoon_happening,in_startup_mode; extern GWorldPtr fields_gworld,mixed_gworld,dlg_buttons_gworld[NUM_BUTTONS][2],terrain_screen_gworld,missiles_gworld; //extern party_record_type party; @@ -77,7 +78,8 @@ RgnHandle oval_region = NULL,dark_mask_region,temp_rect_rgn; // Talk vars extern word_rect_type store_words[50]; -extern short store_pre_talk_mode,store_personality,store_personality_graphic,current_pc; +extern eGameMode store_pre_talk_mode; +extern short store_personality,store_personality_graphic,current_pc; extern GWorldPtr talk_gworld; extern Boolean talk_end_forced; extern Str255 old_str1,old_str2,one_back1,one_back2; @@ -89,7 +91,8 @@ extern unsigned char store_monst_type; // Shop vars extern short store_shop_items[30],store_shop_costs[30]; -extern short store_shop_type,store_shop_min,store_shop_max,store_pre_shop_mode,store_cost_mult; +extern short store_shop_type,store_shop_min,store_shop_max,store_cost_mult; +extern eGameMode store_pre_shop_mode; extern char store_store_name[256]; extern Rect shopping_rects[8][7]; extern Rect bottom_help_rects[4]; diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index 128775a6..a08d42e6 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -108,7 +108,8 @@ Str255 empty_string = " "; extern Boolean fast_bang; //extern party_record_type party; //extern pc_record_type ADVEN[6]; -extern short stat_window,overall_mode,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; //extern unsigned char out[96][96],out_e[96][96]; @@ -442,8 +443,8 @@ void put_party_in_scen(string scen_name) for (i = 0; i < 15; i++) ADVEN[j].status[i] = 0; for (j = 0; j < 6; j++) { - if (ADVEN[j].main_status >= 10) - ADVEN[j].main_status -= 10; + if (ADVEN[j].main_status >= MAIN_STATUS_SPLIT) + ADVEN[j].main_status -= MAIN_STATUS_SPLIT; ADVEN[j].cur_health = ADVEN[j].max_health; ADVEN[j].cur_sp = ADVEN[j].max_sp; } @@ -566,7 +567,7 @@ Boolean create_pc(short spot,short parent_num) cd_initial_draw(989); pick_pc_name(spot,parent_num); - ADVEN[spot].main_status = 1; + ADVEN[spot].main_status = MAIN_STATUS_ALIVE; if (in_startup_mode == FALSE) { ADVEN[spot].items[0] = start_items[ADVEN[spot].race * 2]; @@ -1018,8 +1019,8 @@ void spend_xp_event_filter (short item_hit) switch (item_hit) { case 73: - if ((mode == 0) && (ADVEN[pc_num].main_status < 0)) - ADVEN[pc_num].main_status = 0; + if ((mode == 0) && (ADVEN[pc_num].main_status < MAIN_STATUS_ABSENT)) + ADVEN[pc_num].main_status = MAIN_STATUS_ABSENT; dialog_answer = 0; talk_done = TRUE; break; @@ -1843,8 +1844,8 @@ void do_priest_spell(short pc_num,short spell_num) //// one_sound(-53); one_sound(52); } if (spell_num == 49) { - if (ADVEN[target].main_status == 4) { - ADVEN[target].main_status = 1; + if (ADVEN[target].main_status == MAIN_STATUS_STONE) { + ADVEN[target].main_status = MAIN_STATUS_ALIVE; sprintf ((char *) c_line, " %s destoned. ", (char *) ADVEN[target].name); play_sound(53); @@ -1876,10 +1877,10 @@ void do_priest_spell(short pc_num,short spell_num) //// sprintf ((char *) c_line, " %s now dust. ", (char *) ADVEN[target].name); play_sound(5); - ADVEN[target].main_status = 3; + ADVEN[target].main_status = MAIN_STATUS_DUST; } else { - ADVEN[target].main_status = 1; + ADVEN[target].main_status = MAIN_STATUS_ALIVE; for (i = 0; i < 3; i++) if (get_ran(1,0,2) < 2) ADVEN[target].skills[i] -= (ADVEN[target].skills[i] > 1) ? 1 : 0; @@ -1892,8 +1893,8 @@ void do_priest_spell(short pc_num,short spell_num) //// } if (spell_num == 56) { - if (ADVEN[target].main_status != 1) { - ADVEN[target].main_status = 1; + if (ADVEN[target].main_status != MAIN_STATUS_ALIVE) { + ADVEN[target].main_status = MAIN_STATUS_ALIVE; for (i = 0; i < 3; i++) if (get_ran(1,0,2) < 1) ADVEN[target].skills[i] -= (ADVEN[target].skills[i] > 1) ? 1 : 0; @@ -2159,7 +2160,7 @@ void do_mindduel(short pc_num,cPopulation::cCreature *monst) if (ADVEN[pc_num].status[9] > 7) { sprintf((char *) c_line," %s is killed!",ADVEN[pc_num].name); add_string_to_buf((char *) c_line); - kill_pc(pc_num,2); + kill_pc(pc_num,MAIN_STATUS_DEAD); } } @@ -2970,8 +2971,8 @@ void pc_graphic_event_filter (short item_hit) case 4: update_pc_graphics(); if (store_graphic_mode == 0) { - if (ADVEN[store_graphic_pc_num].main_status < 0) - ADVEN[store_graphic_pc_num].main_status = 0; + if (ADVEN[store_graphic_pc_num].main_status < MAIN_STATUS_ABSENT) + ADVEN[store_graphic_pc_num].main_status = MAIN_STATUS_ABSENT; toast_dialog(); } else { @@ -3185,14 +3186,14 @@ void hit_party(short how_much,short damage_type) put_pc_screen(); } -void slay_party(short mode) +void slay_party(eMainStatus mode) { short i; - boom_anim_active = FALSE; - for (i = 0; i < 6; i++) - if (ADVEN[i].main_status == 1) - ADVEN[i].main_status = mode; + boom_anim_active = FALSE; + for (i = 0; i < 6; i++) + if (ADVEN[i].main_status == MAIN_STATUS_ALIVE) + ADVEN[i].main_status = mode; put_pc_screen(); } @@ -3368,12 +3369,12 @@ Boolean damage_pc(short which_pc,short how_much,short damage_type,short type_of_ if (how_much > 25) { sprintf ((char *) c_line, " %s is obliterated. ",(char *) ADVEN[which_pc].name); add_string_to_buf((char *) c_line); - kill_pc(which_pc, 3); + kill_pc(which_pc, MAIN_STATUS_DUST); } else { sprintf ((char *) c_line, " %s is killed.",(char *) ADVEN[which_pc].name); add_string_to_buf((char *) c_line); - kill_pc(which_pc,2); + kill_pc(which_pc,MAIN_STATUS_DEAD); } if ((ADVEN[which_pc].cur_health == 0) && (ADVEN[which_pc].main_status == 1)) play_sound(3); @@ -3381,26 +3382,26 @@ Boolean damage_pc(short which_pc,short how_much,short damage_type,short type_of_ return TRUE; } -void kill_pc(short which_pc,short type) +void kill_pc(short which_pc,eMainStatus type) { short i = 24; Boolean dummy,no_save = FALSE; location item_loc; - if (type >= 10) { - type -= 10; + if (type >= MAIN_STATUS_SPLIT) { + type -= MAIN_STATUS_SPLIT; no_save = TRUE; } - if (type != 4) + if (type != MAIN_STATUS_STONE) i = pc_has_abil_equip(which_pc,48); - if ((no_save == FALSE) && (type != 0) && (ADVEN[which_pc].skills[18] > 0) && + if ((no_save == FALSE) && (type != MAIN_STATUS_ABSENT) && (ADVEN[which_pc].skills[18] > 0) && (get_ran(1,1,100) < hit_chance[ADVEN[which_pc].skills[18]])) { add_string_to_buf(" But you luck out! "); ADVEN[which_pc].cur_health = 0; } - else if ((i == 24) || (type == 0)) { + else if ((i == 24) || (type == MAIN_STATUS_ABSENT)) { if (combat_active_pc == which_pc) combat_active_pc = 6; @@ -3409,7 +3410,7 @@ void kill_pc(short which_pc,short type) item_loc = (overall_mode >= MODE_COMBAT) ? pc_pos[which_pc] : univ.town.p_loc; - if (type == 2) + if (type == MAIN_STATUS_DEAD) make_sfx(item_loc.x,item_loc.y,3); else if (type == 3) make_sfx(item_loc.x,item_loc.y,6); @@ -3420,7 +3421,7 @@ void kill_pc(short which_pc,short type) dummy = place_item(ADVEN[which_pc].items[i],item_loc,TRUE); ADVEN[which_pc].items[i].variety = 0; } - if ((type == 2) || (type == 3)) + if ((type == MAIN_STATUS_DEAD) || (type == MAIN_STATUS_DUST)) play_sound(21); ADVEN[which_pc].main_status = type; pc_moves[which_pc] = 0; @@ -3430,7 +3431,7 @@ void kill_pc(short which_pc,short type) take_item(which_pc,i); heal_pc(which_pc,200); } - if (ADVEN[current_pc].main_status != 1) + if (ADVEN[current_pc].main_status != MAIN_STATUS_ALIVE) current_pc = first_active_pc(); put_pc_screen(); set_stat_window(current_pc); diff --git a/osx/boe.party.h b/osx/boe.party.h index 2c5f7c47..81f66913 100644 --- a/osx/boe.party.h +++ b/osx/boe.party.h @@ -59,9 +59,9 @@ void affect_pc(short which_pc,short type,short how_much); void affect_party(short type,short how_much); void void_sanctuary(short pc_num); void hit_party(short how_much,short damage_type); -void slay_party(short mode); +void slay_party(eMainStatus mode); Boolean damage_pc(short which_pc,short how_much,short damage_type,short type_of_attacker); -void kill_pc(short which_pc,short type); +void kill_pc(short which_pc,eMainStatus type); void set_pc_moves(); void take_ap(short num); short cave_lore_present(); diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index dffbb937..8e296e4d 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -29,7 +29,7 @@ #include "fileio.h" extern WindowPtr mainPtr; -extern short overall_mode; +extern eGameMode overall_mode; //extern party_record_type party; //extern current_town_type univ.town; //extern unsigned char univ.out.out[96][96],out_e[96][96],sfx[64][64]; @@ -2119,10 +2119,18 @@ void affect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, for (i = 0; i < 6; i++) if ((pc < 0) || (pc == i)) { if (spec.ex1b == 0) { - if ((ADVEN[i].main_status > 0) && (ADVEN[i].main_status < 10)) - ADVEN[i].main_status = 1; + if ((ADVEN[i].main_status > MAIN_STATUS_ABSENT) && (ADVEN[i].main_status < MAIN_STATUS_SPLIT)) + ADVEN[i].main_status = MAIN_STATUS_ALIVE; + } + else switch(spec.ex1a){ + // When passed to kill_pc, the SPLIT party status actually means "no saving throw". + case 0: + kill_pc(i,MAIN_STATUS_SPLIT_DEAD); + case 1: + kill_pc(i,MAIN_STATUS_SPLIT_DUST); + case 2: + kill_pc(i,MAIN_STATUS_SPLIT_STONE); } - else kill_pc(i,spec.ex1a + 2 + 10); } *redraw = 1; break; diff --git a/osx/boe.text.cpp b/osx/boe.text.cpp index 0e1af739..4a2f0fc7 100644 --- a/osx/boe.text.cpp +++ b/osx/boe.text.cpp @@ -47,14 +47,15 @@ Rect status_panel_clip_rect = {11, 299, 175, 495},item_panel_clip_rect = {11,297 Rect item_buttons_from[7] = {{11,0,24,14},{11,14,24,28},{11,28,24,42},{11,42,24,56}, {24,0,36,30},{24,30,36,60},{36,0,48,30}}; -short store_mode; +eGameMode store_mode; extern short had_text_freeze,stat_screen_mode; // graphics globals extern Rect status_panel_rect,status_panel_title_rect; extern Rect text_panel_rect; -extern short overall_mode,which_combat_type,stat_window; +extern short which_combat_type,stat_window; +extern eGameMode overall_mode; extern WindowPtr mainPtr; extern Rect more_info_button; extern short which_item_page[6],current_cursor; diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index 1478fb07..edab00fa 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -34,7 +34,8 @@ //extern party_record_type party; //extern pc_record_type ADVEN[6]; //extern town_item_list univ.town; -extern short stat_window,overall_mode,store_spell_target,which_combat_type,current_pc,combat_active_pc; +extern short stat_window,store_spell_target,which_combat_type,current_pc,combat_active_pc; +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 @@ -44,7 +45,7 @@ extern unsigned char combat_terrain[64][64]; extern short store_current_pc,current_ground; //extern pascal Boolean cd_event_filter(); extern short dungeon_font_num,geneva_font_num; -extern short store_pre_shop_mode,store_pre_talk_mode; +extern eGameMode store_pre_shop_mode,store_pre_talk_mode; extern location monster_targs[T_M]; extern short special_queue[20]; diff --git a/osx/boe.townspec.cpp b/osx/boe.townspec.cpp index ab935915..a9079219 100644 --- a/osx/boe.townspec.cpp +++ b/osx/boe.townspec.cpp @@ -19,7 +19,7 @@ #include "mathutil.h" #include "dlgutil.h" -extern short overall_mode; +extern eGameMode overall_mode; //extern party_record_type univ.party; //extern current_town_type univ.town; //extern unsigned char out[96][96],out_e[96][96]; @@ -282,7 +282,7 @@ void start_split(short a,short b,short noise) univ.town.p_loc.y = b; for (i = 0; i < 6; i++) if (i != PSD[SDF_PARTY_SPLIT_PC]) - ADVEN[i].main_status += 10; + ADVEN[i].main_status += MAIN_STATUS_SPLIT; current_pc = PSD[SDF_PARTY_SPLIT_PC]; update_explored(univ.town.p_loc); center = univ.town.p_loc; @@ -302,8 +302,8 @@ void end_split(short noise) univ.town.p_loc.y = PSD[SDF_PARTY_SPLIT_Y]; PSD[SDF_IS_PARTY_SPLIT] = 0; for (i = 0; i < 6; i++) - if (ADVEN[i].main_status >= 10) - ADVEN[i].main_status -= 10; + if (ADVEN[i].main_status >= MAIN_STATUS_SPLIT) + ADVEN[i].main_status -= MAIN_STATUS_SPLIT; update_explored(univ.town.p_loc); center = univ.town.p_loc; if (noise > 0) diff --git a/osx/misc/dlglowlevel.cpp b/osx/misc/dlglowlevel.cpp index fc98a5f6..908a91df 100644 --- a/osx/misc/dlglowlevel.cpp +++ b/osx/misc/dlglowlevel.cpp @@ -512,7 +512,8 @@ void draw_preset_ter_pic(short which_g,Rect& rect){ // terrain short draw_dest = (w__gw == 1) ? 0 : 2; printf("Getting terrain icon from sheet %i.\n",which_g / 50); GWorldPtr from_gworld = dlg_gworlds["ter"][which_g / 50]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; which_g = which_g % 50; Rect from_rect = calc_rect(which_g % 10, which_g / 10); if (rect.right - rect.left > 28) @@ -524,7 +525,8 @@ void draw_preset_anim_ter_pic(short which_g,Rect& rect){ // animated terrain short draw_dest = (w__gw == 1) ? 0 : 2; Rect from_rect = calc_rect(4 * (which_g / 5), which_g % 5); GWorldPtr from_gworld = *dlg_gworlds["anim"]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; printf("Getting animated terrain graphic %i from sheet 20", which_g); //printf(" at {%i,%i,%i,%i}",from_rect.top,from_rect.left,from_rect.bottom,from_rect.right); //printf(" – column %i, row %i.\n",from_rect.left/28,from_rect.top/36); @@ -539,7 +541,8 @@ void draw_preset_monst_pic_small(short which_g,Rect& rect){ // monster short draw_dest = (w__gw == 1) ? 0 : 2; short m_start_pic = m_pic_index[which_g].i; GWorldPtr from_gworld = dlg_gworlds["monst"][m_start_pic / 20]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog) : from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; m_start_pic = m_start_pic % 20; Rect from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); rect.right = rect.left + 28; rect.bottom = rect.top + 36; @@ -556,7 +559,8 @@ void draw_preset_monst_pic_wide(short which_g,Rect& rect){ if (w__gw == 0) PaintRect(&rect); GWorldPtr from_gworld = dlg_gworlds["monst"][m_start_pic / 20]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog) : from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; m_start_pic = m_start_pic % 20; Rect from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); OffsetRect(&small_monst_rect,rect.left,rect.top + 7); @@ -581,7 +585,8 @@ void draw_preset_monst_pic_tall(short which_g,Rect& rect){ if (w__gw == 0) PaintRect(&rect); GWorldPtr from_gworld = dlg_gworlds["monst"][m_start_pic / 20]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog) : from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; m_start_pic = m_start_pic % 20; Rect from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); OffsetRect(&small_monst_rect,rect.left + 7,rect.top); @@ -606,7 +611,8 @@ void draw_preset_monst_pic_large(short which_g,Rect& rect){ if (w__gw == 0) PaintRect(&rect); GWorldPtr from_gworld = dlg_gworlds["monst"][m_start_pic / 20]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog) : from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; m_start_pic = m_start_pic % 20; Rect from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); OffsetRect(&small_monst_rect,rect.left,rect.top); @@ -657,14 +663,16 @@ void draw_preset_item_pic(short which_g,Rect& rect){ // item InsetRect(&to_rect,5,9); OffsetRect(&from_rect,18 * (which_g % 10), 18 * (which_g / 10)); } - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; rect_draw_some_item(from_gworld,from_rect,to_gworld,to_rect,1,draw_dest); } void draw_preset_dlg_pic(short which_g,Rect& rect){ // dialog short draw_dest = (w__gw == 1) ? 0 : 2; GWorldPtr from_gworld = *dlg_gworlds["dlog"]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = {0,0,36,36}; OffsetRect(&from_rect,36 * (which_g % 4),36 * (which_g / 4)); rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,0,draw_dest); @@ -676,7 +684,8 @@ void draw_preset_pc_pic(short which_g,Rect& rect){ // PC if (*dlg_gworlds["pc"] != NULL) from_gworld = *dlg_gworlds["pc"]; else from_gworld = load_pict(902); - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; //which_g -= 800; Rect from_rect = calc_rect(2 * (which_g / 8), which_g % 8); PaintRect(&rect); @@ -688,7 +697,8 @@ void draw_preset_pc_pic(short which_g,Rect& rect){ // PC void draw_preset_talk_pic(short which_g,Rect& rect){ // talk face rect.right = rect.left + 32; rect.bottom = rect.top + 32; GWorldPtr from_gworld = *dlg_gworlds["talkfaces"]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = {0,0,32,32}; OffsetRect(&from_rect,32 * ((which_g - 1) % 10),32 * ((which_g - 1) / 10)); rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,0,0); @@ -697,17 +707,20 @@ void draw_preset_talk_pic(short which_g,Rect& rect){ // talk face void draw_item_info_help_pic(Rect& rect){ // item info help short draw_dest = (w__gw == 1) ? 0 : 2; Rect from_rect = {0,174,113,312}; + GWorldPtr from_gworld = *dlg_gworlds["mixed"]; + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: *dlg_gworlds["mixed"]); + GWorldPtr to_gworld = (GWorldPtr)hDialog; rect.right = rect.left + from_rect.right - from_rect.left; rect.bottom = rect.top + from_rect.bottom - from_rect.top; - rect_draw_some_item(*dlg_gworlds["mixed"],from_rect,(GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: *dlg_gworlds["mixed"]) - ,rect,0,draw_dest); + rect_draw_some_item(from_gworld ,from_rect, to_gworld ,rect,0,draw_dest); } void draw_pc_info_help_pic(Rect& rect){ // item info help short draw_dest = (w__gw == 1) ? 0 : 2; Rect from_rect = {130,0,157,106}; GWorldPtr from_gworld = *dlg_gworlds["mixed"]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: *dlg_gworlds["mixed"]); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; rect.right = rect.left + from_rect.right - from_rect.left; rect.bottom = rect.top + from_rect.bottom - from_rect.top; rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,0,draw_dest); @@ -716,7 +729,8 @@ void draw_pc_info_help_pic(Rect& rect){ // item info help void draw_preset_scen_pic_large(short which_g,Rect& rect){ short draw_dest = (w__gw == 1) ? 0 : 2; GWorldPtr from_gworld = load_pict(900 + which_g); - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = {0,0,64,64}; rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,0,draw_dest); DisposeGWorld(from_gworld); @@ -725,7 +739,8 @@ void draw_preset_scen_pic_large(short which_g,Rect& rect){ void draw_help_pic(short which_g,Rect& rect){ // button help short draw_dest = (w__gw == 1) ? 0 : 2; GWorldPtr from_gworld = load_pict(1401); - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = {0,0,125,320}; rect.right = rect.left + from_rect.right; rect.bottom = rect.top + from_rect.bottom; @@ -737,7 +752,8 @@ void draw_help_pic(short which_g,Rect& rect){ // button help void draw_combat_ap_help_pic(Rect& rect){ // combat ap help short draw_dest = (w__gw == 1) ? 0 : 2; GWorldPtr from_gworld = load_pict(1402); - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = {0,0,100,275}; rect.right = rect.left + from_rect.right; rect.bottom = rect.top + from_rect.bottom; @@ -748,7 +764,8 @@ void draw_combat_ap_help_pic(Rect& rect){ // combat ap help void draw_pc_stat_help_pic(Rect& rect){ // stat symbols help short draw_dest = (w__gw == 1) ? 0 : 2; GWorldPtr from_gworld = load_pict(1400); - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = {0,0,94,386}; rect.right = rect.left + from_rect.right; rect.bottom = rect.top + from_rect.bottom; @@ -759,7 +776,8 @@ void draw_pc_stat_help_pic(Rect& rect){ // stat symbols help void draw_preset_scen_pic(short which_g,Rect& rect){ short draw_dest = (w__gw == 1) ? 0 : 2; GWorldPtr from_gworld = load_pict(851); - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = {0,0,32,32}; OffsetRect(&from_rect,32 * (which_g % 5),32 * (which_g / 5)); rect.right = rect.left + 32; @@ -771,7 +789,8 @@ void draw_preset_scen_pic(short which_g,Rect& rect){ void draw_preset_field_pic(short which_g,Rect& rect){ // dialog short draw_dest = (w__gw == 1) ? 0 : 2; GWorldPtr from_gworld = *dlg_gworlds["fields"]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = calc_rect(which_g % 8, which_g / 8); if (w__gw == 0) PaintRect(&rect); @@ -784,7 +803,8 @@ void draw_custom_space_pic(short which_g,Rect& rect){ rect.right = rect.left + 28; rect.bottom = rect.top + 32; GWorldPtr from_gworld = *dlg_gworlds["custom"]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = get_custom_rect(which_g); if ((w__gw == 0) && (fr == TRUE)) PaintRect(&rect); @@ -799,7 +819,8 @@ void draw_custom_monst_wide_pic(short which_g,Rect& rect){ if ((w__gw == 0) && (fr == TRUE)) PaintRect(&rect); GWorldPtr from_gworld = *dlg_gworlds["custom"]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = get_custom_rect(which_g); OffsetRect(&small_monst_rect,rect.left,rect.top + 7); rect_draw_some_item(from_gworld,from_rect,to_gworld,small_monst_rect,1,draw_dest); @@ -816,7 +837,8 @@ void draw_custom_monst_tall_pic(short which_g,Rect& rect){ if ((w__gw == 0) && (fr == TRUE)) PaintRect(&rect); GWorldPtr from_gworld = *dlg_gworlds["custom"]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = get_custom_rect(which_g); OffsetRect(&small_monst_rect,rect.left + 7,rect.top); rect_draw_some_item(from_gworld,from_rect,to_gworld,small_monst_rect,1,draw_dest); @@ -833,7 +855,8 @@ void draw_custom_monst_large_pic(short which_g,Rect& rect){ if ((w__gw == 0) && (fr == TRUE)) PaintRect(&rect); GWorldPtr from_gworld = *dlg_gworlds["custom"]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = get_custom_rect(which_g); OffsetRect(&small_monst_rect,rect.left,rect.top); rect_draw_some_item(from_gworld,from_rect,to_gworld,small_monst_rect,1,draw_dest); @@ -851,7 +874,8 @@ void draw_custom_monst_large_pic(short which_g,Rect& rect){ void draw_custom_dlg_pic_split(short which_g,Rect& rect){ // dialog, split short draw_dest = (w__gw == 1) ? 0 : 2; GWorldPtr from_gworld = *dlg_gworlds["custom"]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = get_custom_rect(which_g); Rect to_rect = rect; to_rect.right = to_rect.left + 18; @@ -869,7 +893,8 @@ void draw_custom_dlg_pic_split(short which_g,Rect& rect){ // dialog, split void draw_custom_talk_pic_split(short which_g,Rect& rect){ // facial graphic, split short draw_dest = (w__gw == 1) ? 0 : 2; GWorldPtr from_gworld = *dlg_gworlds["custom"]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = get_custom_rect(which_g); Rect to_rect = rect; to_rect.right = to_rect.left + 16; @@ -887,7 +912,8 @@ void draw_custom_talk_pic_split(short which_g,Rect& rect){ // facial graphic, sp void draw_preset_dlg_pic_large(short which_g,Rect& rect){ short draw_dest = (w__gw == 1) ? 0 : 2; GWorldPtr from_gworld = *dlg_gworlds["dlog"]; - GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + //GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr) (hDialog): from_gworld); + GWorldPtr to_gworld = (GWorldPtr) hDialog; Rect from_rect = {0,0,72,72}; OffsetRect(&from_rect,36 * (which_g % 4),36 * (which_g / 4)); rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,0,draw_dest); diff --git a/osx/misc/dlgtool.cpp b/osx/misc/dlgtool.cpp index 7a466a01..90ca482a 100644 --- a/osx/misc/dlgtool.cpp +++ b/osx/misc/dlgtool.cpp @@ -597,7 +597,8 @@ void cd_draw_item(short dlog_num,short item_num){ case DLG_BUTTON: case DLG_DEFAULT_BTN: GetPortBounds(dlg_buttons_gworld[buttons[items[item_index].flag].type][0], &from_rect); rect_draw_some_item(dlg_buttons_gworld[buttons[items[item_index].flag].type][0],from_rect, - dlg_buttons_gworld[buttons[items[item_index].flag].type][0],items[item_index].rect,0,2); + (GWorldPtr)dlgs[dlg_index].win,//dlg_buttons_gworld[buttons[items[item_index].flag].type][0], + items[item_index].rect,0,2); RGBForeColor(&clr[2]); TextSize(12); OffsetRect(&items[item_index].rect,-1 * buttons[items[item_index].flag].left_adj,0); @@ -610,7 +611,8 @@ void cd_draw_item(short dlog_num,short item_num){ case DLG_CUSTOM_BTN: case DLG_CUSTOM_DEF_BTN: GetPortBounds(dlg_buttons_gworld[buttons[items[item_index].flag].type][0], &from_rect); rect_draw_some_item(dlg_buttons_gworld[buttons[items[item_index].flag].type][0],from_rect, - dlg_buttons_gworld[buttons[items[item_index].flag].type][0],items[item_index].rect,0,2); + (GWorldPtr)dlgs[dlg_index].win,//dlg_buttons_gworld[buttons[items[item_index].flag].type][0], + items[item_index].rect,0,2); RGBForeColor(&clr[2]); TextSize(12); char_win_draw_string(dlgs[dlg_index].win,items[item_index].rect, @@ -625,17 +627,17 @@ void cd_draw_item(short dlog_num,short item_num){ switch (items[item_index].flag) { case 0: rect_draw_some_item(dlg_buttons_gworld[10][0], - from_rect, dlg_buttons_gworld[10][0], + from_rect, (GWorldPtr)dlgs[dlg_index].win,//dlg_buttons_gworld[10][0], items[item_index].rect,0,2); break; case 1: rect_draw_some_item(dlg_buttons_gworld[9][1], - from_rect, dlg_buttons_gworld[9][1], + from_rect, (GWorldPtr)dlgs[dlg_index].win,//dlg_buttons_gworld[9][1], items[item_index].rect,0,2); break; case 2: rect_draw_some_item(dlg_buttons_gworld[9][0], - from_rect, dlg_buttons_gworld[9][0], + from_rect, (GWorldPtr)dlgs[dlg_index].win,//dlg_buttons_gworld[9][0], items[item_index].rect,0,2); break; } @@ -896,7 +898,8 @@ void cd_press_button(short dlog_num, short item_num){ TextSize(12); GetPortBounds(dlg_buttons_gworld[buttons[items[item_index].flag].type][0], &from_rect); rect_draw_some_item(dlg_buttons_gworld[buttons[items[item_index].flag].type][1],from_rect, - dlg_buttons_gworld[buttons[items[item_index].flag].type][1],items[item_index].rect,0,2); + (GWorldPtr)dlgs[dlg_index].win,//dlg_buttons_gworld[buttons[items[item_index].flag].type][1], + items[item_index].rect,0,2); TextFace(bold); RGBForeColor(&clr[3]); if (items[item_index].type < DLG_LED_BUTTON) { @@ -918,7 +921,8 @@ void cd_press_button(short dlog_num, short item_num){ else Delay(14,&dummy); rect_draw_some_item(dlg_buttons_gworld[buttons[items[item_index].flag].type][0],from_rect, - dlg_buttons_gworld[buttons[items[item_index].flag].type][0],items[item_index].rect,0,2); + (GWorldPtr)dlgs[dlg_index].win,//dlg_buttons_gworld[buttons[items[item_index].flag].type][0], + items[item_index].rect,0,2); RGBForeColor(&clr[2]); if (items[item_index].type < DLG_LED_BUTTON) { diff --git a/osx/pc.cpp b/osx/pc.cpp index 08bec028..a477c7fd 100644 --- a/osx/pc.cpp +++ b/osx/pc.cpp @@ -12,7 +12,7 @@ __attribute__((deprecated)) cPlayer& cPlayer::operator = (legacy::pc_record_type old){ int i; - main_status = old.main_status; + main_status = (eMainStatus) old.main_status; strcpy(name,old.name); for(i = 0; i < 20; i++) skills[i] = old.skills[i]; @@ -60,7 +60,7 @@ short cPlayer::get_tnl(){ cPlayer::cPlayer(){ short i; - main_status = 0; + main_status = MAIN_STATUS_ABSENT; sprintf ((char *) name, "\n"); for (i = 0; i < 30; i++) @@ -97,7 +97,7 @@ cPlayer::cPlayer(){ cPlayer::cPlayer(long key,short slot){ short i; - main_status = 1; + main_status = MAIN_STATUS_ALIVE; if(key == 'dbug'){ switch (slot) { case 0: @@ -141,7 +141,7 @@ cPlayer::cPlayer(long key,short slot){ } //which_graphic = num * 3 + 1; // 1, 4, 7, 10, 13, 16 which_graphic = slot + 4; // 4, 5, 6, 7, 8, 9 - weap_poisoned = 16; + weap_poisoned = 24; // was 16, as an E2 relic for (i = 0; i < 15; i++) { advan[i] = FALSE; @@ -173,7 +173,7 @@ cPlayer::cPlayer(long key,short slot){ {0,1,0,0,0, 0,0,0,0,0, 0,0,0,0,0} }; - main_status = 1; + main_status = MAIN_STATUS_ALIVE; switch (slot) { case 0: sprintf ((char *) name, "Jenneke"); @@ -229,4 +229,14 @@ cPlayer::cPlayer(long key,short slot){ } } +void operator += (eMainStatus& stat, eMainStatus othr){ + if(othr == MAIN_STATUS_SPLIT) + stat = (eMainStatus) (10 + stat); +} + +void operator -= (eMainStatus& stat, eMainStatus othr){ + if(othr == MAIN_STATUS_SPLIT) + stat = (eMainStatus) (-10 + stat); +} + // \ No newline at end of file diff --git a/osx/pc.h b/osx/pc.h index 508a34e1..59a9d2f7 100644 --- a/osx/pc.h +++ b/osx/pc.h @@ -9,9 +9,30 @@ namespace legacy { struct pc_record_type; }; +enum eMainStatus { + MAIN_STATUS_ABSENT = 0, // absent, empty slot + MAIN_STATUS_ALIVE = 1, + MAIN_STATUS_DEAD = 2, + MAIN_STATUS_DUST = 3, + MAIN_STATUS_STONE = 4, + MAIN_STATUS_FLED = 5, + MAIN_STATUS_SURFACE = 6, // fled to surface? + MAIN_STATUS_WON = 7, + MAIN_STATUS_SPLIT = 10, + // The rest are not really necessary, but are here for completeness so that all valid values have a name. + MAIN_STATUS_SPLIT_ABSENT = MAIN_STATUS_SPLIT + MAIN_STATUS_ABSENT, + MAIN_STATUS_SPLIT_ALIVE = MAIN_STATUS_SPLIT + MAIN_STATUS_ALIVE, + MAIN_STATUS_SPLIT_DEAD = MAIN_STATUS_SPLIT + MAIN_STATUS_DEAD, + MAIN_STATUS_SPLIT_DUST = MAIN_STATUS_SPLIT + MAIN_STATUS_DUST, + MAIN_STATUS_SPLIT_STONE = MAIN_STATUS_SPLIT + MAIN_STATUS_STONE, + MAIN_STATUS_SPLIT_FLED = MAIN_STATUS_SPLIT + MAIN_STATUS_FLED, + MAIN_STATUS_SPLIT_SURFACE = MAIN_STATUS_SPLIT + MAIN_STATUS_SURFACE, + MAIN_STATUS_SPLIT_WON = MAIN_STATUS_SPLIT + MAIN_STATUS_WON, +}; + class cPlayer { public: - short main_status; + eMainStatus main_status; char name[20]; short skills[30]; short max_health; @@ -39,3 +60,6 @@ public: cPlayer(long key,short slot); short get_tnl(); }; + +void operator += (eMainStatus& stat, eMainStatus othr); +void operator -= (eMainStatus& stat, eMainStatus othr);