diff --git a/osx/Blades of Exile Char Editor/BoE Char Editor.xcodeproj/project.pbxproj b/osx/Blades of Exile Char Editor/BoE Char Editor.xcodeproj/project.pbxproj deleted file mode 100644 index 19654900..00000000 --- a/osx/Blades of Exile Char Editor/BoE Char Editor.xcodeproj/project.pbxproj +++ /dev/null @@ -1,345 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - -/* Begin PBXBuildFile section */ - 2BF04B1E0BF51924006C0831 /* dlogtool.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AEA0BF51924006C0831 /* dlogtool.c */; }; - 2BF04DE90BF7A6FE006C0831 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BF04DE80BF7A6FE006C0831 /* Carbon.framework */; }; - 91B3E9930F93A7EA00BF5B67 /* BoECharEd.icns in Resources */ = {isa = PBXBuildFile; fileRef = 91B3E9920F93A7EA00BF5B67 /* BoECharEd.icns */; }; - 91B3EA110F93AD4D00BF5B67 /* Blades of Exile Base in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91B3E9D70F93AC1900BF5B67 /* Blades of Exile Base */; }; - 91B3EA120F93AD4D00BF5B67 /* Blades of Exile Graphics in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91B3E9D80F93AC1900BF5B67 /* Blades of Exile Graphics */; }; - 91B3EA130F93AD4D00BF5B67 /* Blades of Exile Sounds in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91B3E9D90F93AC1900BF5B67 /* Blades of Exile Sounds */; }; - 9D05E34E0DD1380400FCD60F /* char.ed.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D05E3410DD1380400FCD60F /* char.ed.c */; }; - 9D05E34F0DD1380400FCD60F /* ed.action.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D05E3420DD1380400FCD60F /* ed.action.c */; }; - 9D05E3500DD1380400FCD60F /* ed.editors.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D05E3440DD1380400FCD60F /* ed.editors.c */; }; - 9D05E3510DD1380400FCD60F /* ed.fileio.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D05E3460DD1380400FCD60F /* ed.fileio.c */; }; - 9D05E3520DD1380400FCD60F /* ed.global.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D05E3480DD1380400FCD60F /* ed.global.c */; }; - 9D05E3530DD1380400FCD60F /* ed.graphics.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D05E34A0DD1380400FCD60F /* ed.graphics.c */; }; - 9D05E3540DD1380400FCD60F /* ed.sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D05E34C0DD1380400FCD60F /* ed.sound.c */; }; - 9D86FBE10DD50BF900EDC359 /* bladespced.rsrc in Resources */ = {isa = PBXBuildFile; fileRef = 9D86FBE00DD50BF900EDC359 /* bladespced.rsrc */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 91B3EA1F0F93AD8900BF5B67 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "Scenario Editor"; - dstSubfolderSpec = 16; - files = ( - 91B3EA110F93AD4D00BF5B67 /* Blades of Exile Base in CopyFiles */, - 91B3EA120F93AD4D00BF5B67 /* Blades of Exile Graphics in CopyFiles */, - 91B3EA130F93AD4D00BF5B67 /* Blades of Exile Sounds in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 2BF04AC10BF518D4006C0831 /* Blades of Exile Character Editor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Blades of Exile Character Editor.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2BF04AC30BF518D4006C0831 /* Blades of Exile Character Editor-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Blades of Exile Character Editor-Info.plist"; sourceTree = ""; }; - 2BF04AEA0BF51924006C0831 /* dlogtool.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = dlogtool.c; sourceTree = ""; }; - 2BF04AEB0BF51924006C0831 /* dlogtool.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dlogtool.h; sourceTree = ""; }; - 2BF04AF70BF51924006C0831 /* item_data.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = item_data.h; sourceTree = ""; }; - 2BF04DE80BF7A6FE006C0831 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; - 91B3E9920F93A7EA00BF5B67 /* BoECharEd.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = BoECharEd.icns; sourceTree = ""; }; - 91B3E9D70F93AC1900BF5B67 /* Blades of Exile Base */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Blades of Exile Base"; path = "../Scenario Editor/Blades of Exile Base"; sourceTree = SOURCE_ROOT; }; - 91B3E9D80F93AC1900BF5B67 /* Blades of Exile Graphics */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Blades of Exile Graphics"; path = "../Scenario Editor/Blades of Exile Graphics"; sourceTree = SOURCE_ROOT; }; - 91B3E9D90F93AC1900BF5B67 /* Blades of Exile Sounds */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Blades of Exile Sounds"; path = "../Scenario Editor/Blades of Exile Sounds"; sourceTree = SOURCE_ROOT; }; - 9D05E3410DD1380400FCD60F /* char.ed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = char.ed.c; sourceTree = ""; }; - 9D05E3420DD1380400FCD60F /* ed.action.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ed.action.c; sourceTree = ""; }; - 9D05E3430DD1380400FCD60F /* ed.action.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ed.action.h; sourceTree = ""; }; - 9D05E3440DD1380400FCD60F /* ed.editors.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ed.editors.c; sourceTree = ""; }; - 9D05E3450DD1380400FCD60F /* ed.editors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ed.editors.h; sourceTree = ""; }; - 9D05E3460DD1380400FCD60F /* ed.fileio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ed.fileio.c; sourceTree = ""; }; - 9D05E3470DD1380400FCD60F /* ed.fileio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ed.fileio.h; sourceTree = ""; }; - 9D05E3480DD1380400FCD60F /* ed.global.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ed.global.c; sourceTree = ""; }; - 9D05E3490DD1380400FCD60F /* ed.global.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ed.global.h; sourceTree = ""; }; - 9D05E34A0DD1380400FCD60F /* ed.graphics.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ed.graphics.c; sourceTree = ""; }; - 9D05E34B0DD1380400FCD60F /* ed.graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ed.graphics.h; sourceTree = ""; }; - 9D05E34C0DD1380400FCD60F /* ed.sound.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ed.sound.c; sourceTree = ""; }; - 9D05E34D0DD1380400FCD60F /* ed.sound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ed.sound.h; sourceTree = ""; }; - 9D86FBE00DD50BF900EDC359 /* bladespced.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; path = bladespced.rsrc; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 2BF04ABF0BF518D4006C0831 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 2BF04DE90BF7A6FE006C0831 /* Carbon.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 2BF04A9F0BF51845006C0831 = { - isa = PBXGroup; - children = ( - 91B3E9750F93A7A300BF5B67 /* headers */, - 91B3E9740F93A79F00BF5B67 /* src */, - 9D86FBD90DD50BA900EDC359 /* Resources */, - 2BF04DE80BF7A6FE006C0831 /* Carbon.framework */, - 2BF04AB30BF5187A006C0831 /* Products */, - ); - sourceTree = ""; - }; - 2BF04AB30BF5187A006C0831 /* Products */ = { - isa = PBXGroup; - children = ( - 2BF04AC10BF518D4006C0831 /* Blades of Exile Character Editor.app */, - ); - name = Products; - sourceTree = ""; - }; - 91B3E9740F93A79F00BF5B67 /* src */ = { - isa = PBXGroup; - children = ( - 9D05E3410DD1380400FCD60F /* char.ed.c */, - 9D05E3420DD1380400FCD60F /* ed.action.c */, - 9D05E3440DD1380400FCD60F /* ed.editors.c */, - 9D05E3460DD1380400FCD60F /* ed.fileio.c */, - 9D05E3480DD1380400FCD60F /* ed.global.c */, - 9D05E34A0DD1380400FCD60F /* ed.graphics.c */, - 9D05E34C0DD1380400FCD60F /* ed.sound.c */, - 2BF04AEA0BF51924006C0831 /* dlogtool.c */, - ); - name = src; - sourceTree = ""; - }; - 91B3E9750F93A7A300BF5B67 /* headers */ = { - isa = PBXGroup; - children = ( - 9D05E3430DD1380400FCD60F /* ed.action.h */, - 9D05E3450DD1380400FCD60F /* ed.editors.h */, - 9D05E3470DD1380400FCD60F /* ed.fileio.h */, - 9D05E3490DD1380400FCD60F /* ed.global.h */, - 9D05E34B0DD1380400FCD60F /* ed.graphics.h */, - 9D05E34D0DD1380400FCD60F /* ed.sound.h */, - 2BF04AEB0BF51924006C0831 /* dlogtool.h */, - 2BF04AF70BF51924006C0831 /* item_data.h */, - ); - name = headers; - sourceTree = ""; - }; - 9D86FBD90DD50BA900EDC359 /* Resources */ = { - isa = PBXGroup; - children = ( - 91B3E9D70F93AC1900BF5B67 /* Blades of Exile Base */, - 91B3E9D80F93AC1900BF5B67 /* Blades of Exile Graphics */, - 91B3E9D90F93AC1900BF5B67 /* Blades of Exile Sounds */, - 91B3E9920F93A7EA00BF5B67 /* BoECharEd.icns */, - 9D86FBE00DD50BF900EDC359 /* bladespced.rsrc */, - 2BF04AC30BF518D4006C0831 /* Blades of Exile Character Editor-Info.plist */, - ); - name = Resources; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 2BF04AC00BF518D4006C0831 /* Blades of Exile Character Editor */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2BF04AC40BF518D4006C0831 /* Build configuration list for PBXNativeTarget "Blades of Exile Character Editor" */; - buildPhases = ( - 2BF04ABD0BF518D4006C0831 /* Resources */, - 91B3EA1F0F93AD8900BF5B67 /* CopyFiles */, - 2BF04ABE0BF518D4006C0831 /* Sources */, - 2BF04ABF0BF518D4006C0831 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "Blades of Exile Character Editor"; - productName = "Blades of Exile Character Editor"; - productReference = 2BF04AC10BF518D4006C0831 /* Blades of Exile Character Editor.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 2BF04AA10BF51845006C0831 /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 2BF04AA20BF51845006C0831 /* Build configuration list for PBXProject "BoE Char Editor" */; - compatibilityVersion = "Xcode 2.4"; - hasScannedForEncodings = 0; - mainGroup = 2BF04A9F0BF51845006C0831; - productRefGroup = 2BF04AB30BF5187A006C0831 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 2BF04AC00BF518D4006C0831 /* Blades of Exile Character Editor */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 2BF04ABD0BF518D4006C0831 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9D86FBE10DD50BF900EDC359 /* bladespced.rsrc in Resources */, - 91B3E9930F93A7EA00BF5B67 /* BoECharEd.icns in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 2BF04ABE0BF518D4006C0831 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2BF04B1E0BF51924006C0831 /* dlogtool.c in Sources */, - 9D05E34E0DD1380400FCD60F /* char.ed.c in Sources */, - 9D05E34F0DD1380400FCD60F /* ed.action.c in Sources */, - 9D05E3500DD1380400FCD60F /* ed.editors.c in Sources */, - 9D05E3510DD1380400FCD60F /* ed.fileio.c in Sources */, - 9D05E3520DD1380400FCD60F /* ed.global.c in Sources */, - 9D05E3530DD1380400FCD60F /* ed.graphics.c in Sources */, - 9D05E3540DD1380400FCD60F /* ed.sound.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2BF04AA30BF51845006C0831 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - ppc, - i386, - ); - COPY_PHASE_STRIP = NO; - GCC_INPUT_FILETYPE = sourcecode.cpp.cpp; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; - GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; - GCC_WARN_PEDANTIC = NO; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_LABEL = YES; - GCC_WARN_UNUSED_PARAMETER = YES; - GCC_WARN_UNUSED_VALUE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "/usr/include/c++/4.0.0/"; - LINK_WITH_STANDARD_LIBRARIES = YES; - MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; - MACOSX_DEPLOYMENT_TARGET_ppc = 10.3; - SDKROOT = "$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/"; - SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk; - SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk; - STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static; - STRIP_INSTALLED_PRODUCT = NO; - SYMROOT = ../build; - }; - name = Debug; - }; - 2BF04AA40BF51845006C0831 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - i386, - ppc, - ); - COPY_PHASE_STRIP = YES; - GCC_INPUT_FILETYPE = sourcecode.cpp.cpp; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; - GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_LABEL = YES; - GCC_WARN_UNUSED_PARAMETER = YES; - GCC_WARN_UNUSED_VALUE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "/usr/include/c++/4.0.0/"; - LINK_WITH_STANDARD_LIBRARIES = YES; - MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; - MACOSX_DEPLOYMENT_TARGET_ppc = 10.3; - SDKROOT = "$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/"; - SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk; - SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk; - STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static; - SYMROOT = ../build; - }; - name = Release; - }; - 2BF04AC50BF518D4006C0831 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ppc; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; - INFOPLIST_FILE = "Blades of Exile Character Editor-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; - OTHER_CFLAGS = "-fpack-struct=2"; - OTHER_LDFLAGS = ( - "-framework", - Carbon, - ); - PREBINDING = NO; - PRODUCT_NAME = "Blades of Exile Character Editor"; - WRAPPER_EXTENSION = app; - ZERO_LINK = YES; - }; - name = Debug; - }; - 2BF04AC60BF518D4006C0831 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ppc; - COPY_PHASE_STRIP = YES; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; - INFOPLIST_FILE = "Blades of Exile Character Editor-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.3; - OTHER_CFLAGS = "-fpack-struct=2"; - OTHER_LDFLAGS = ( - "-framework", - Carbon, - ); - PREBINDING = NO; - PRODUCT_NAME = "Blades of Exile Character Editor"; - WRAPPER_EXTENSION = app; - ZERO_LINK = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2BF04AA20BF51845006C0831 /* Build configuration list for PBXProject "BoE Char Editor" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2BF04AA30BF51845006C0831 /* Debug */, - 2BF04AA40BF51845006C0831 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 2BF04AC40BF518D4006C0831 /* Build configuration list for PBXNativeTarget "Blades of Exile Character Editor" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2BF04AC50BF518D4006C0831 /* Debug */, - 2BF04AC60BF518D4006C0831 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 2BF04AA10BF51845006C0831 /* Project object */; -} diff --git a/osx/Blades of Exile Char Editor/bladespced.rsrc b/osx/Blades of Exile Char Editor/bladespced.rsrc index 03fbd8cf..38f65f81 100644 Binary files a/osx/Blades of Exile Char Editor/bladespced.rsrc and b/osx/Blades of Exile Char Editor/bladespced.rsrc differ diff --git a/osx/Blades of Exile Char Editor/char.ed.c b/osx/Blades of Exile Char Editor/char.ed.c index 1db8301e..bb4cdeef 100644 --- a/osx/Blades of Exile Char Editor/char.ed.c +++ b/osx/Blades of Exile Char Editor/char.ed.c @@ -27,8 +27,10 @@ #include "ed.editors.h" #include "ed.action.h" #include "ed.fileio.h" -#include "ed.sound.h" -#include "dlogtool.h" +#include "soundtool.h" +#include "dlgtool.h" +#include "dlgconsts.h" +#include "graphtool.h" Rect pc_area_buttons[6][4] ; // 0 - whole 1 - pic 2 - name 3 - stat strs 4,5 - later Rect item_string_rects[24][4]; // 0 - name 1 - drop 2 - id 3 - @@ -55,15 +57,11 @@ EventRecord event; WindowPtr mainPtr; Handle menu_bar_handle; MenuHandle apple_menu,file_menu,reg_menu,extra_menu,edit_menu,items_menu[4]; -Boolean gInBackground = FALSE,play_sounds = TRUE,file_in_mem = FALSE,save_blocked = FALSE; +Boolean gInBackground = FALSE,file_in_mem = FALSE,save_blocked = FALSE; long start_time; -Boolean dialog_not_toast = TRUE, party_in_scen = FALSE; +Boolean party_in_scen = FALSE; Boolean scen_items_loaded = FALSE; -// Cursors -short current_cursor = 120; -CursHandle sword_curs, boot_curs, key_curs, target_curs; - // Shareware globals Boolean registered = TRUE,ed_reg = TRUE; long register_flag = 0; @@ -82,10 +80,12 @@ unsigned char misc_i[64][64],sfx[64][64]; unsigned char template_terrain[64][64]; short store_flags[3]; +extern short sword_curs; town_record_type anim_town; tiny_tr_type anim_t_d; +m_pic_index_t m_pic_index[200]; // not used, but the lack of it causes a link error stored_items_list_type stored_items[3]; stored_town_maps_type maps; stored_town_maps_type town_maps; @@ -114,7 +114,6 @@ void handle_reg_menu(int item_hit); void handle_extra_menu(int item_hit); void handle_edit_menu(int item_hit); void update_item_menu(); -void load_cursors(); void set_cursor(CursHandle which_curs); void find_quickdraw(); void check_sys_7(); @@ -123,7 +122,6 @@ pascal OSErr handle_open_doc(AppleEvent *theAppleEvent,AppleEvent *reply,long ha pascal OSErr handle_quit(AppleEvent *theAppleEvent,AppleEvent *reply,long handlerRefcon); Boolean verify_restore_quit(short mode); void set_up_apple_events(); -pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit); void set_pixel_depth(); void restore_depth(); void handle_item_menu(int item_hit); @@ -154,7 +152,9 @@ int main(void) Initialize(); init_main_buttons(); Set_up_win(); - load_cursors(); + Point p = {0,0}; + init_graph_tool(redraw_screen,p); + init_snd_tool(); find_quickdraw(); set_pixel_depth(); Set_Window_Drag_Bdry(); @@ -189,7 +189,7 @@ int main(void) DrawMenuBar(); - cd_init_dialogs(); + init_dialogs(); /* Multifinder_Present = (NGetTrapAddress(_WaitNextEvent, ToolTrap) != NGetTrapAddress(_Unimplemented, ToolTrap)); */ @@ -561,7 +561,7 @@ void handle_extra_menu(int item_hit) boat_record_type v_boat = {{12,17},{0,0},{0,0},80,TRUE,FALSE}; if (file_in_mem == FALSE) { - display_strings(20,5,0,0,"Editing party",57,707,0); + display_strings(20,5,0,0,"Editing party",57,7,PICT_DLG_TYPE,0); return; } switch(item_hit) { @@ -597,29 +597,29 @@ void handle_extra_menu(int item_hit) case 6: - display_strings(20,20,0,0,"Editing party",57,707,0); + display_strings(20,20,0,0,"Editing party",57,7,PICT_DLG_TYPE,0); for (i = 0; i < 4; i++) party.creature_save[i].which_town = 200; break; case 8: // damage - display_strings(20,1,0,0,"Editing party",57,715,0); + display_strings(20,1,0,0,"Editing party",57,15,PICT_DLG_TYPE,0); for (i = 0; i < 6; i++) adven[i].cur_health = adven[i].max_health; break; case 9: // spell pts - display_strings(20,2,0,0,"Editing party",57,715,0); + display_strings(20,2,0,0,"Editing party",57,15,PICT_DLG_TYPE,0); for (i = 0; i < 6; i++) adven[i].cur_sp = adven[i].max_sp; break; case 10: // raise dead - display_strings(20,3,0,0,"Editing party",57,715,0); + display_strings(20,3,0,0,"Editing party",57,15,PICT_DLG_TYPE,0); for (i = 0; i < 6; i++) if ((adven[i].main_status == 2) || (adven[i].main_status == 3) || (adven[i].main_status == 4)) adven[i].main_status = 1; break; case 11: // conditions - display_strings(20,4,0,0,"Editing party",57,715,0); + display_strings(20,4,0,0,"Editing party",57,15,PICT_DLG_TYPE,0); for (i = 0; i < 6; i++) { adven[i].status[2] = 0; if (adven[i].status[3] < 0) @@ -635,7 +635,7 @@ void handle_extra_menu(int item_hit) case 13: if (party_in_scen == FALSE) { - display_strings(20,25,0,0,"Editing party",57,715,0); + display_strings(20,25,0,0,"Editing party",57,15,PICT_DLG_TYPE,0); break; } if (FCD(912,0) != 1) @@ -652,7 +652,7 @@ void handle_edit_menu(int item_hit) short choice,i,j,k; if (file_in_mem == FALSE) { - display_strings(20,5,0,0,"Editing party",57,707,0); + display_strings(20,5,0,0,"Editing party",57,7,PICT_DLG_TYPE,0); return; } if ((ed_reg == FALSE) && (save_blocked == FALSE)) @@ -664,7 +664,7 @@ void handle_edit_menu(int item_hit) display_alchemy(); break; case 2: // all property - display_strings(20,6,0,0,"Editing party",57,707,0); + display_strings(20,6,0,0,"Editing party",57,7,PICT_DLG_TYPE,0); for (i = 0; i < 30; i++) { party.boats[i].property = FALSE; party.horses[i].property = FALSE; @@ -675,10 +675,10 @@ void handle_edit_menu(int item_hit) break; case 6: // ouit maps if (party_in_scen == FALSE) { - display_strings(20,25,0,0,"Editing party",57,715,0); + display_strings(20,25,0,0,"Editing party",57,15,PICT_DLG_TYPE,0); break; } - display_strings(20,13,0,0,"Editing party",57,715,0); + display_strings(20,13,0,0,"Editing party",57,15,PICT_DLG_TYPE,0); for (i = 0; i < 100; i++) for (j = 0; j < 6; j++) for (k = 0; k < 48; k++) @@ -686,10 +686,10 @@ void handle_edit_menu(int item_hit) break; case 7: // town maps if (party_in_scen == FALSE) { - display_strings(20,25,0,0,"Editing party",57,715,0); + display_strings(20,25,0,0,"Editing party",57,15,PICT_DLG_TYPE,0); break; } - display_strings(20,14,0,0,"Editing party",57,715,0); + display_strings(20,14,0,0,"Editing party",57,15,PICT_DLG_TYPE,0); for (i = 0; i < 200; i++) for (j = 0; j < 8; j++) for (k = 0; k < 64; k++) @@ -771,7 +771,7 @@ void handle_item_menu(int item_hit) item_record_type store_i; if (file_in_mem == FALSE) { - display_strings(20,5,0,0,"Editing party",57,707,0); + display_strings(20,5,0,0,"Editing party",57,7,PICT_DLG_TYPE,0); return; } if ((ed_reg == FALSE) && (save_blocked == FALSE)) @@ -802,19 +802,6 @@ void update_item_menu() } } -void load_cursors() -{ - short i,j; - - sword_curs = GetCursor(120); - - boot_curs = GetCursor(121); - key_curs = GetCursor(122); - target_curs = GetCursor(124); - - set_cursor(sword_curs); -} - void set_cursor(CursHandle which_curs) { HLock ((Handle) which_curs); @@ -984,73 +971,73 @@ void set_up_apple_events() SysBeep(2); } -pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit) -{ - char chr,chr2; - short the_type,wind_hit,item_hit; - Handle the_handle = NULL; - Rect the_rect,button_rect; - Point the_point; - CWindowPtr w; - RgnHandle updateRgn; - - dummy_item_hit = 0; - - switch (event->what) { - case updateEvt: - w = GetDialogWindow(hDlg); - updateRgn = NewRgn(); - GetWindowRegion(w, kWindowUpdateRgn, updateRgn); - if (EmptyRgn(updateRgn) == TRUE) { - return TRUE; - } - BeginUpdate(GetDialogWindow(hDlg)); - cd_redraw(hDlg); - EndUpdate(GetDialogWindow(hDlg)); - DrawDialog(hDlg); - return TRUE; - break; - - case keyDown: - chr = event->message & charCodeMask; - chr2 = (char) ((event->message & keyCodeMask) >> 8); - switch (chr2) { - case 126: chr = 22; break; - case 124: chr = 21; break; - case 123: chr = 20; break; - case 125: chr = 23; break; - case 53: chr = 24; break; - case 36: chr = 31; break; - case 76: chr = 31; break; - } - // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc - // 25-30 ctrl 1-6 31 - return - - wind_hit = cd_process_keystroke(hDlg,chr,&item_hit); - break; - - case mouseDown: - the_point = event->where; - GlobalToLocal(&the_point); - wind_hit = cd_process_click(hDlg,the_point, event->modifiers,&item_hit); - break; - - default: wind_hit = -1; break; - } - switch (wind_hit) { - case -1: break; - - case 917: edit_day_event_filter(item_hit); break; - case 970: case 971: case 972: case 973: display_strings_event_filter(item_hit); break; - case 991: display_pc_event_filter(item_hit); break; - case 996: display_alchemy_event_filter(item_hit); break; - case 1010: spend_xp_event_filter (item_hit); break; - case 1012: case 947: edit_gold_or_food_event_filter (item_hit); break; - case 1013: pick_race_abil_event_filter (item_hit); break; - case 1018: select_pc_event_filter (item_hit); break; - case 1024: edit_xp_event_filter (item_hit); break; - case 1073: give_reg_info_event_filter (item_hit); break; - default: fancy_choice_dialog_event_filter (item_hit); break; - } - return(wind_hit != -1); -} \ No newline at end of file +//pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit) +//{ +// char chr,chr2; +// short the_type,wind_hit,item_hit; +// Handle the_handle = NULL; +// Rect the_rect,button_rect; +// Point the_point; +// CWindowPtr w; +// RgnHandle updateRgn; +// +// dummy_item_hit = 0; +// +// switch (event->what) { +// case updateEvt: +// w = GetDialogWindow(hDlg); +// updateRgn = NewRgn(); +// GetWindowRegion(w, kWindowUpdateRgn, updateRgn); +// if (EmptyRgn(updateRgn) == TRUE) { +// return TRUE; +// } +// BeginUpdate(GetDialogWindow(hDlg)); +// cd_redraw(hDlg); +// EndUpdate(GetDialogWindow(hDlg)); +// DrawDialog(hDlg); +// return TRUE; +// break; +// +// case keyDown: +// chr = event->message & charCodeMask; +// chr2 = (char) ((event->message & keyCodeMask) >> 8); +// switch (chr2) { +// case 126: chr = 22; break; +// case 124: chr = 21; break; +// case 123: chr = 20; break; +// case 125: chr = 23; break; +// case 53: chr = 24; break; +// case 36: chr = 31; break; +// case 76: chr = 31; break; +// } +// // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc +// // 25-30 ctrl 1-6 31 - return +// +// wind_hit = cd_process_keystroke(hDlg,chr,&item_hit); +// break; +// +// case mouseDown: +// the_point = event->where; +// GlobalToLocal(&the_point); +// wind_hit = cd_process_click(hDlg,the_point, event->modifiers,&item_hit); +// break; +// +// default: wind_hit = -1; break; +// } +// switch (wind_hit) { +// case -1: break; +// +// case 917: edit_day_event_filter(item_hit); break; +// case 970: case 971: case 972: case 973: display_strings_event_filter(item_hit); break; +// case 991: display_pc_event_filter(item_hit); break; +// case 996: display_alchemy_event_filter(item_hit); break; +// case 1010: spend_xp_event_filter (item_hit); break; +// case 1012: case 947: edit_gold_or_food_event_filter (item_hit); break; +// case 1013: pick_race_abil_event_filter (item_hit); break; +// case 1018: select_pc_event_filter (item_hit); break; +// case 1024: edit_xp_event_filter (item_hit); break; +// case 1073: give_reg_info_event_filter (item_hit); break; +// default: fancy_choice_dialog_event_filter (item_hit); break; +// } +// return(wind_hit != -1); +//} \ No newline at end of file diff --git a/osx/Blades of Exile Char Editor/dlogtool.c b/osx/Blades of Exile Char Editor/dlogtool.c deleted file mode 100644 index 9053ab6e..00000000 --- a/osx/Blades of Exile Char Editor/dlogtool.c +++ /dev/null @@ -1,1373 +0,0 @@ - -//#include -//#include -//#include -//#include - -#include /*jmr*/ - -#define ND 15 -#define NI 500 -#define NL 100 - -#include "stdio.h" -#include "string.h" -#include "dlogtool.h" -#include "ed.global.h" -#include "ed.graphics.h" -#include "ed.sound.h" - -extern Boolean play_sounds,cursor_shown,dialog_not_toast; -extern WindowPtr mainPtr; -extern Boolean modeless_exists[18]; -extern DialogPtr modeless_dialogs[18]; - -extern GWorldPtr dlg_buttons_gworld[NUM_BUTTONS][2]; -extern GWorldPtr pc_gworld,dlogpics_gworld; -extern PixPatHandle bg[14]; -extern short geneva_font_num; - -short current_key = 0; -short dlg_keys[ND]; -short dlg_types[ND]; -DialogPtr dlgs[ND]; -DialogPtr dlg_parent[ND]; -short dlg_highest_item[ND]; -Boolean dlg_draw_ready[ND]; - -short item_dlg[NI]; -short item_number[NI]; -char item_type[NI]; -Rect item_rect[NI]; -short item_flag[NI]; -char item_active[NI]; -char item_key[NI]; -short item_label[NI]; -short item_label_loc[NI]; - -char text_long_str[10][256]; -char text_short_str[140][35]; -char labels[NL][25]; -Boolean label_taken[NL]; - - -short store_free_slot,store_dlog_num; - -short button_type[110] = {1,1,4,5,1,1,0,0,1,1, - 1,1,1,1,1,1,1,1,8,8, - 9,9,9,1,1,2,1,6,7,1, - 1,12,1,1,2,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,1,1,1,2,1,1,1,2,2, // 50 - 1,1,1,1,1,1,2,3,1,1, - 1,1,1,1,2,2,2,2,2,1, - 1,1,1,1,2,2,1,1,1,2, - 0,1,1,1,14,13,12,12,12,1, - 1,1,1,2,1,2,0,1,1,1}; -char *button_strs[110] = {"Done ","Ask"," "," ","Keep", "Cancel","+","-","Buy","Leave", - "Get","1","2","3","4","5","6","Cast"," "," ", - " "," "," ","Buy","Sell","Other Spells","Buy x10"," "," ","Save", - "Race","Train","Items","Spells","Heal Party","1","2","3","4","5", - "6","7","8","9","10","11","12","13","14","15", - /*50*/ "16","Take","Create","Delete","Race/Special","Skill","Name","Graphic","Bash Door","Pick Lock", - "Leave","Steal","Attack","OK","Yes","No","Step In"," ","Record","Climb", - "Flee","Onward","Answer","Drink","Approach","Mage Spells","Priest Spells","Advantages","New Game","Land", - "Under","Restore","Restart","Quit","Save First","Just Quit","Rest","Read","Pull","Alchemy", - "17","Push","Pray","Wait","","","Delete","Graphic","Create","Give", - "Destroy","Pay","Free","Next Tip","Touch", "Open File"," ","","",""}; -short button_left_adj[110] = {2,0,0,0,6,0,0,0,0,5, - 0,0,0,0,0,0,0,4,0,0, - 0,0,0,0,0,5,0,0,0,0, - 6,6,0,0,0,0,0,0,0,0, - 0,0,0,0,6,6,6,6,6,6, - 6,6,0,2,0,0,0,2,3,3, // 50 - 6,6,0,7,5,5,0,0,2,6, - 4,2,0,0,0,4,10,4,0,6, - 6,2,1,6,4,3,0,4,6,4, - 6,6,6,6,0,0,0,2,0,0, - 2,6,6,3,6,7,0,0,0,0}; -char button_def_key[110] = {0,0,20,21,'k', 24,0,0,0,0, - 'g','1','2','3','4', '5','6',0,0,0, - 0,0,0,0,0,' ',0,22,23,0, - 0,0,0,0,0,'1','2','3','4','5', - '6','7','8','9','a', 'b','c','d','e','f', - 'g',0,0,0,0,0,0,0,0,0, - 0,0,0,0,'y','n',0,'?','r',0, - 0,0,0,0,0,0,0,0,0, 0, - 0,0,0,0,0,0,0,0,0,0, - 'g',0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0}; - // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc - // 25-30 ctrl 1-6 31 - return\ - - -void beep() -{ - SysBeep(20); -} - -void cd_init_dialogs() -{ - short i; - - for (i = 0; i < ND; i++) { - dlg_keys[i] = -1; - dlg_types[i] = 0; - dlgs[i] = NULL; - dlg_highest_item[i] = 0; - } - for (i = 0; i < NI; i++) { - item_dlg[i] = -1; - } - for (i = 0; i < NL; i++) { - label_taken[i] = FALSE; - } -} - - -short cd_create_dialog_parent_num(short dlog_num,short parent) -{ - short i; - - // Casting from WindowPtr to DialogPtr is a hack, but it is necessary because - // the code assumes that the two are interchangeable. I *think* that mainPtr - // is detected and won't be passed to functions that require a dialog. -jmr - if ((parent == 0) || (parent == 1)) - return cd_create_dialog(dlog_num, (DialogPtr)mainPtr); - i = cd_get_dlg_index(parent); - if (i < 0) - return -1; - return cd_create_dialog(dlog_num,dlgs[i]); - -} - -short cd_create_dialog(short dlog_num, DialogPtr parent) -{ - short i,j,free_slot = -1,free_item = -1; - DialogPtr dlg; - - char item_str[256]; - short type,flag; - - store_dlog_num = dlog_num; - //store_parent = parent; - for (i = 0; i < ND; i++) { - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - return -1; - } - for (i = 0; i < ND; i++) { - if (dlg_keys[i] < 0) { - free_slot = i; - i = 500; - } - } - if (free_slot < 0) - return -2; - current_key++; - dlg_keys[free_slot] = current_key; - dlg_types[free_slot] = dlog_num; - dlg_highest_item[free_slot] = 1; - dlg_draw_ready[free_slot] = FALSE; - dlgs[free_slot] = NULL; - - // first, create dummy dlog - store_free_slot = free_slot; - //dlg = CreateDialog(store_hInstance,MAKEINTRESOURCE(dlog_num),0,d_proc); - dlg = GetNewDialog (dlog_num, NIL, IN_FRONT); - dlgs[free_slot] = dlg; - if (dlgs[free_slot] == NULL) { - play_sound(3); - return -3; - } -// center_window(dlgs[free_slot]); - - dlg_parent[free_slot] = parent; - - process_new_window (dlgs[free_slot]); - - - switch (dlog_num) { -/* case 1010: SetWTitle(dlgs[free_slot],"Training a PC"); break; - case 1014: SetWTitle(dlgs[free_slot],"Reading a Sign"); break; - case 1015: SetWTitle(dlgs[free_slot],"Talking to Someone"); break; - case 1018: SetWTitle(dlgs[free_slot],"Select a PC"); break; - case 1019: SetWTitle(dlgs[free_slot],"In a Shop"); break; - case 1020: SetWTitle(dlgs[free_slot],"In a Shop"); break; - case 1021: SetWTitle(dlgs[free_slot],"Buying Food"); break; - case 1048: SetWTitle(dlgs[free_slot],"Visiting the Healer"); break; - case 1050: SetWTitle(dlgs[free_slot],"Pick PC Graphic"); break; - case 998: SetWTitle(dlgs[free_slot],"Item Info"); break; - case 992: SetWTitle(dlgs[free_slot],"PC Spells"); break; - case 1097: SetWTitle(dlgs[free_slot],"Skills Library"); break; - case 1096: SetWTitle(dlgs[free_slot],"Spells Library"); break; - case 999: SetWTitle(dlgs[free_slot],"Monster Library"); break; - case 997: SetWTitle(dlgs[free_slot],"Help Library"); break; - case 995: SetWTitle(dlgs[free_slot],"Introduction"); break; - case 996: SetWTitle(dlgs[free_slot],"Alchemy"); break; - case 1013: SetWTitle(dlgs[free_slot],"Races/Advantages"); break; - case 1099: SetWTitle(dlgs[free_slot],"Preferences"); break; - case 1098: SetWTitle(dlgs[free_slot],"Casting a Spell"); break; - case 987: SetWTitle(dlgs[free_slot],"Getting Items"); break; - case 989: SetWTitle(dlgs[free_slot],"Create a Party"); break; - case 1047: SetWTitle(dlgs[free_slot],"Do Alchemy"); break;*/ - } - - ShowWindow(GetDialogWindow(dlgs[free_slot])); - SetPort(GetDialogPort(dlgs[free_slot])); - TextFont(geneva_font_num); - TextFace(bold); - TextSize(10); - ForeColor(blackColor); - BackColor(whiteColor); - dialog_not_toast = TRUE; - //DestroyWindow(dlg); //Necesary? Dunno. - -/* if (dlg_parent[free_slot] != NULL) { - EnableWindow(dlg_parent[free_slot],FALSE); - if (dlg_parent[free_slot] == mainPtr) - for (i = 0; i < 18; i++) - if (modeless_exists[i] == TRUE) - EnableWindow(modeless_dialogs[i],FALSE); - } */ - return 0; -} - -void process_new_window (DialogPtr hDlg) { - short i = -1,j,free_slot = -1,free_item = -1,type,flag; - char but_str[30]; - Str255 item_str; - Boolean str_stored = FALSE; - Rect dlg_rect,store_rect; - short win_height = 0, win_width = 0; - short the_type; - Handle the_handle = NULL; - Rect small_rect; - short item_hit,what_talk_field,num_items; - short str_offset = 1; - long typel,flagl; - - free_slot = store_free_slot; - num_items = CountDITL(hDlg); - - dlg_highest_item[free_slot] = 0; - - // Now, give the window its items - for (i = 0; i < num_items; i++) { - str_offset = 1; - GetDialogItem( hDlg, i + 1, &the_type, &the_handle, &small_rect); - if (the_type % 128 == 8) { - GetDialogItemText(the_handle,item_str); - p2c(item_str); - dlg_highest_item[free_slot]++; - str_stored = FALSE; - if (strlen((char *)item_str) == 0) { - sprintf((char *) item_str, "+"); - type = 3; - flag = 1; - str_stored = TRUE; - } - else if (item_str[0] == '+') { // default is framed text - type = 3; - flag = 1; - str_stored = TRUE; - } - else if (item_str[0] == '*') { - type = 3; - flag = 0; - str_stored = TRUE; - } - else if (item_str[0] == '~') { - type = 7; - flag = 0; - str_stored = TRUE; - } - else if (item_str[0] == '!') { - type = 4; - flag = 0; - str_stored = TRUE; - } - else if (item_str[0] == '=') { - type = 9; - flag = 1; - str_stored = TRUE; - } - else if (((item_str[0] >= 65) && (item_str[0] <= 122)) || (item_str[0] == '"')) { - type = 9; - flag = 0; - str_offset = 0; - str_stored = TRUE; - } - else if ((item_str[0] == '^') || (item_str[0] == '&')) { - type = (item_str[0] == '^') ? 10 : 11; - flag = 1; - if (string_length((char *) item_str) > 55) - flag = 2; - str_stored = TRUE; - } - else { -//#ifndef EXILE_BIG_GUNS -// sscanf((char *) item_str,"%d_%d",&type,&flag); -//#endif -//#ifdef EXILE_BIG_GUNS - sscanf((char *) item_str,"%hd_%hd",&type,&flag); -//#endif - } - - free_item = -1; - // find free item - switch (type) { - case 0: case 1: case 2: case 5: case 6: - for (j = 150; j < NI; j++){ - if (item_dlg[j] < 0) { - free_item = j; - j = NI + 1; - } - } - break; - default: - if ((type == 9) || - ((str_stored == TRUE) && (strlen((char *) item_str) > 35))) { - for (j = 0; j < 10; j++){ - if (item_dlg[j] < 0) { - free_item = j; - j = NI + 1; - } - } - } - else { - for (j = 10; j < 140; j++){ - if (item_dlg[j] < 0) { - free_item = j; - j = NI + 1; - } - } - } - break; - } - - if (free_item >= 0) { - item_dlg[free_item] = store_dlog_num; - item_type[free_item] = type; - item_number[free_item] = i + 1; - - item_rect[free_item] = get_item_rect(hDlg,i + 1); - - item_flag[free_item] = flag; - item_active[free_item] = 1; - item_label[free_item] = 0; - item_label_loc[free_item] = -1; - item_key[free_item] = 0; - switch (type) { - case 0: case 1: - GetPortBounds(dlg_buttons_gworld[button_type[flag]][0], &store_rect); - item_rect[free_item].right = item_rect[free_item].left + store_rect.right; - item_rect[free_item].bottom = item_rect[free_item].top + store_rect.bottom; - item_key[free_item] = button_def_key[flag]; - if (type == 1) - item_key[free_item] = 31; - break; - case 2: - item_rect[free_item].right = item_rect[free_item].left + 14; - item_rect[free_item].bottom = item_rect[free_item].top + 10; - item_key[free_item] = 255; - break; - case 3: case 4: case 7: case 8: case 9: case 10: case 11: - sprintf(((free_item < 10) ? text_long_str[free_item] : text_short_str[free_item - 10]),""); - if (str_stored == TRUE) { - if (free_item < 10) - sprintf(text_long_str[free_item],"%s", - (char *) (item_str + str_offset)); - else - sprintf(text_short_str[free_item - 10],"%-34s", - (char *) (item_str + str_offset)); - } - item_key[free_item] = 255; - if (type >= 10) { - GetPortBounds(dlg_buttons_gworld[1][0], &store_rect); - item_rect[free_item].right = item_rect[free_item].left + store_rect.right; - item_rect[free_item].bottom = item_rect[free_item].top + store_rect.bottom; - if (type == 11) - item_key[free_item] = 31; - } - break; - } - win_height = max(win_height, item_rect[free_item].bottom + 5); - win_width = max(win_width, item_rect[free_item].right + 6); - - } - - } - } - ShortenDITL(hDlg,dlg_highest_item[free_slot]); - SizeWindow(GetDialogWindow(hDlg),win_width,win_height,FALSE); - dlg_highest_item[free_slot] = num_items; -} - - -short cd_kill_dialog(short dlog_num,short parent_message) -{ - short i,which_dlg = -1; - - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - which_dlg = i; - if (which_dlg < 0) - return -1; - - for (i = 0; i < NI; i++) - if (item_dlg[i] == dlog_num) { - if (item_label[i] > 0) - label_taken[item_label_loc[i]] = FALSE; - item_dlg[i] = -1; - } - -/* if (dlg_parent[which_dlg] != NULL) { - EnableWindow(dlg_parent[which_dlg],TRUE); - if (dlg_parent[which_dlg] == mainPtr) - for (i = 0; i < 18; i++) - if (modeless_exists[i] == TRUE) - EnableWindow(modeless_dialogs[i],TRUE); - SetFocus(dlg_parent[which_dlg]); - SetWindowPos(dlg_parent[which_dlg],WindowPtr_TOP,0,0,100,100, - SWP_NOMOVE | SWP_NOSIZE); - cd_set_edit_focus(); - } */ -// if (parent_message > 0) -// SendMessage(dlg_parent[which_dlg],WM_COMMAND,parent_message,0); - - DisposeDialog(dlgs[which_dlg]); - dlg_keys[which_dlg] = -1; - if (dlg_parent[which_dlg] != NULL) - SetPort(GetDialogPort(dlg_parent[which_dlg])); - dialog_not_toast = TRUE; - return 0; -} - -short cd_process_click(DialogPtr window,Point the_point, short mods,short *item) -{ - short i,which_dlg,dlg_num,item_id; - short dlog_key; - - if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlog_key)) < 0) - return -1; - - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) - if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { - if ((PtInRect(the_point,&item_rect[item_id])) && (item_active[item_id] > 0) - && ((item_type[item_id] < 3) || (item_type[item_id] == 8) - || (item_type[item_id] == 10)|| (item_type[item_id] == 11))) { - *item = i; - if ((mods & 2048) != 0) - *item += 100; - if (item_type[item_id] != 8) - cd_press_button(dlg_num,i); - return dlg_num; - } - } - return -1; -} - - - -short cd_process_keystroke(DialogPtr window,char char_hit,short *item) -{ - short i,which_dlg,dlg_num,dlg_key,item_id; - - if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlg_key)) < 0) - return -1; - // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc - // 25-30 ctrl 1-6 - - - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) - if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { - if ((item_key[item_id] == char_hit) && (item_active[item_id] > 0) - && ((item_type[item_id] < 3) || (item_type[item_id] == 8) - || (item_type[item_id] == 10) || (item_type[item_id] == 11))) { - *item = i; - if (item_type[item_id] != 8) - cd_press_button(dlg_num,i); - return dlg_num; - } - } - - // kludgy. If you get an escape and is isn't processed, make it an enter - if (char_hit == 24) { - char_hit = 31; - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) - if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { - if ((item_key[item_id] == char_hit) && (item_active[item_id] > 0) - && ((item_type[item_id] < 3) || (item_type[item_id] == 8))) { - *item = i; - if (item_type[item_id] != 8) - cd_press_button(dlg_num,i); - return dlg_num; - } - } - } - return -1; -} - -/* -void cd_init_button(short dlog_num,short item_num, short button_num, short status) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - if (item_type[item_index] > 1) { - beep(); - return; - } - item_flag[item_index] = button_num; - item_active[item_index] = status; - item_rect[item_index].right = item_rect[item_index].left + button_width[button_num]; - item_rect[item_index].bottom = item_rect[item_index].top + button_width[button_num]; - item_key[item_index] = button_def_key[button_num]; - cd_draw_item(dlog_num,item_num); -} -*/ - -void cd_attach_key(short dlog_num,short item_num,char key) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - if ((item_type[item_index] > 2) && (item_type[item_index] != 8)) { - beep(); - return; - } - item_key[item_index] = key; -} - -void csp(short dlog_num, short item_num, short pict_num) -{ - cd_set_pict( dlog_num, item_num, pict_num); -} - -void cd_set_pict(short dlog_num, short item_num, short pict_num) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - if (item_type[item_index] != 5) { - beep(); - return; - } - item_flag[item_index] = pict_num; - if (pict_num == -1) - cd_erase_item(dlog_num,item_num); - else cd_draw_item(dlog_num,item_num); -} - -void cd_activate_item(short dlog_num, short item_num, short status) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - item_active[item_index] = status; - cd_draw_item(dlog_num,item_num); -} - -short cd_get_active(short dlog_num, short item_num) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return -1; - - return item_active[item_index]; -} - - -void cd_get_item_text(short dlog_num, short item_num, char *str) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return ; - if (item_index >= 150) { - beep(); - return; - } - if (item_index < 10) - sprintf(str,"%s",text_long_str[item_index]); - else sprintf(str,"%s",text_short_str[item_index - 10]); -} - -void csit(short dlog_num, short item_num, char *str) -{ -cd_set_item_text( dlog_num, item_num, str); -} - -void cd_retrieve_text_edit_str(short dlog_num, char *str) -{ - short dlg_index,item_index; - short the_type; - Handle the_handle = NULL; - Rect the_rect; - Str255 store_ptr; - - sprintf(str,""); - if (cd_get_indices(dlog_num,3,&dlg_index,&item_index) < 0) - return ; - GetDialogItem( dlgs[dlg_index], 2, &the_type, &the_handle, &the_rect); - GetDialogItemText(the_handle,store_ptr); - p2c(store_ptr); - strcpy(str,(char *) store_ptr); -} - -// NOTE!!! Expects a c string -void cd_set_text_edit_str(short dlog_num, char *str) -{ - short dlg_index,item_index; - short the_type; - Handle the_handle = NULL; - Rect the_rect; - Str255 store_ptr; - - if (cd_get_indices(dlog_num,3,&dlg_index,&item_index) < 0) { - SysBeep(50); - SysBeep(50); - SysBeep(50); - return ; - } - - strcpy((char *) store_ptr,str); - c2p(store_ptr); - GetDialogItem( dlgs[dlg_index], 2, &the_type, &the_handle, &the_rect ); - SetDialogItemText( the_handle, store_ptr); - -} -void cd_set_item_text(short dlog_num, short item_num, char *str) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return ; - if (item_index >= 150) { - beep(); - return; - } - if (item_index < 10) - sprintf(text_long_str[item_index],"%s",str); - else sprintf(text_short_str[item_index - 10],"%-34s",str); - cd_draw_item( dlog_num,item_num); -} - -void cdsin(short dlog_num, short item_num, short num) -{ - cd_set_item_num( dlog_num, item_num, num); -} - - -void cd_set_item_num(short dlog_num, short item_num, short num) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return ; - if (item_index >= 150) { - beep(); - return; - } - if (item_index < 10) - sprintf(text_long_str[item_index],"%d",num); - else sprintf(text_short_str[item_index - 10],"%d",num); - cd_draw_item( dlog_num,item_num); -} - -void cd_set_led(short dlog_num,short item_num,short state) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - if (item_type[item_index] != 2) { - beep(); - return; - } - item_flag[item_index] = state; - cd_draw_item(dlog_num,item_num); -} - -void cd_set_flag(short dlog_num,short item_num,short flag) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - item_flag[item_index] = flag; - cd_draw_item(dlog_num,item_num); -} - - -short cd_get_led(short dlog_num,short item_num) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return 0; - - if (item_type[item_index] != 2) { - beep(); - return 0; - } - return item_flag[item_index]; -} - - -void cd_text_frame(short dlog_num,short item_num,short frame) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - if (item_index >= 150) { - beep(); - return; - } - item_flag[item_index] = frame; - cd_draw_item(dlog_num,item_num); -} - -void cd_add_label(short dlog_num, short item_num, char *label, short label_flag) -{ - short dlg_index,item_index,label_loc = -1; - short i; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - if (item_label_loc[item_index] < 0) { - item_label[item_index] = label_flag; - for (i = 0; i < 100; i++) - if (label_taken[i] == FALSE) { - label_loc = i; - label_taken[i] = TRUE; - i = 100; - } - if (label_loc < 0) { - beep(); - return; - } - item_label_loc[item_index] = label_loc; - } - else cd_erase_item(dlog_num,item_num + 100); - label_loc = item_label_loc[item_index]; - sprintf((char *) labels[label_loc],"%-24s",label); - if (item_active[item_index] > 0) - cd_draw_item(dlog_num,item_num); -} - -void cd_take_label(short dlog_num, short item_num) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - item_label[item_index] = 0; - label_taken[item_label_loc[item_index]] = FALSE; -} - -void cd_key_label(short dlog_num, short item_num,short loc) -{ - short dlg_index,item_index; - char str[10]; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - sprintf((char *) str," "); - str[0] = item_key[item_index]; - cd_add_label(dlog_num,item_num, str, 7 + loc * 100); -} - -void cd_draw_item(short dlog_num,short item_num) -{ - short dlg_index,item_index,store_label; - RGBColor c[3] = {{0,0,0},{65535,0,0},{0,0,8192}}; - Rect from_rect,to_rect; - GrafPtr old_port; - - - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - if (dlg_draw_ready[dlg_index] == FALSE) - return; - - GetPort(&old_port); - SetPort(GetDialogPort(dlgs[dlg_index])); - - if (item_active[item_index] == 0) { - cd_erase_item(dlog_num,item_num); - cd_erase_item(dlog_num,item_num + 100); - } - else { - switch (item_type[item_index]) { - case 0: case 1: case 10: case 11: - GetPortBounds(dlg_buttons_gworld[button_type[item_flag[item_index]]][0], &from_rect); - rect_draw_some_item(dlg_buttons_gworld[button_type[item_flag[item_index]]][0],from_rect, - dlg_buttons_gworld[button_type[item_flag[item_index]]][0],item_rect[item_index],0,2); - RGBForeColor(&c[2]); - TextSize(12); - if (item_type[item_index] < 2) - OffsetRect(&item_rect[item_index],-1 * button_left_adj[item_flag[item_index]],0); - if (item_type[item_index] < 2) { - char_win_draw_string(GetDialogPort(dlgs[dlg_index]),item_rect[item_index], - (char *) (button_strs[item_flag[item_index]]),1,8); - } - else { - char_win_draw_string(GetDialogPort(dlgs[dlg_index]),item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),1,8); - } - if (item_type[item_index] < 2) - OffsetRect(&item_rect[item_index],button_left_adj[item_flag[item_index]],0); - TextSize(10); - ForeColor(blackColor); - break; - - case 2: - GetPortBounds(dlg_buttons_gworld[9][0], &from_rect); - switch (item_flag[item_index]) { - case 0: rect_draw_some_item( dlg_buttons_gworld[10][0],from_rect, dlg_buttons_gworld[10][0],item_rect[item_index],0,2); break; - case 1: rect_draw_some_item( dlg_buttons_gworld[9][1],from_rect, dlg_buttons_gworld[9][1],item_rect[item_index],0,2); break; - case 2: rect_draw_some_item( dlg_buttons_gworld[9][0],from_rect, dlg_buttons_gworld[9][0],item_rect[item_index],0,2); break; - } - break; - - case 3: case 4: case 7: case 8: case 9: - cd_erase_item(dlog_num,item_num); - /*if ((item_type[item_index] == 3) || (item_type[item_index] == 9)) - SelectObject(win_dc,small_bold_font); */ - if (item_type[item_index] == 4) - TextFace(0); - if (item_type[item_index] == 7) - TextSize(12); - ForeColor(blackColor); - if (item_flag[item_index] % 10 == 1) - cd_frame_item(dlog_num,item_num,2); - ForeColor(whiteColor); - - if (item_flag[item_index] >= 10) { - //SetTextColor(win_dc,PALETTEINDEX(c[1])); - RGBForeColor(&c[1]); - } - if (item_rect[item_index].bottom - item_rect[item_index].top < 20) { - item_rect[item_index].left += 3; - char_win_draw_string(GetDialogPort(dlgs[dlg_index]),item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),3,12); - item_rect[item_index].left -= 3; - } - else { - InsetRect(&item_rect[item_index],4,4); - char_win_draw_string(GetDialogPort(dlgs[dlg_index]),item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),0,(item_type[item_index] == 7) ? 14 : 12); - InsetRect(&item_rect[item_index],-4,-4); - } - if ((item_type[item_index] == 8) && (dlog_num == 989)) { - item_rect[item_index].bottom -= 12; - undo_clip(); - } - TextFont(geneva_font_num); - TextFace(0); - TextFace(bold); - TextSize(10); - ForeColor(blackColor); - break; - - case 5: - if (item_flag[item_index] == -1) - cd_erase_item(dlog_num,item_num); - else draw_dialog_graphic(GetDialogPort(dlgs[dlg_index]), item_rect[item_index], item_flag[item_index], - (item_flag[item_index] >= 2000) ? FALSE : TRUE,0); - break; - } - } - - if (item_label[item_index] != 0) { - store_label = item_label[item_index]; - if (store_label >= 1000) { - store_label -= 1000; - //SelectObject(win_dc,bold_font); - } - else { - TextFace(0); - //SelectObject(win_dc,tiny_font); - } - to_rect = item_rect[item_index]; - switch (store_label / 100) { - case 0: - to_rect.right = to_rect.left; - to_rect.left -= 2 * (store_label % 100); - break; - case 1: - to_rect.bottom = to_rect.top; - to_rect.top -= 2 * (store_label % 100); - break; - case 2: - to_rect.left = to_rect.right; - to_rect.right += 2 * (store_label % 100); - break; - case 3: - to_rect.top = to_rect.bottom; - to_rect.bottom += 2 * (store_label % 100); - break; - } - - if (to_rect.bottom - to_rect.top < 14) { - to_rect.bottom += (14 - (to_rect.bottom - to_rect.top)) / 2 + 1; - to_rect.top -= (14 - (to_rect.bottom - to_rect.top)) / 2 + 1; - } - else OffsetRect(&to_rect, 0,(to_rect.bottom - to_rect.top) / 6); - //cd_erase_rect(dlog_num,to_rect); - if (item_active[item_index] != 0) { - ForeColor(whiteColor); - - char_win_draw_string(GetDialogPort(dlgs[dlg_index]),to_rect, - labels[item_label_loc[item_index]],2,12); - ForeColor(blackColor); - - } - TextFace(bold); - } - - - SetPort(old_port); - } - -void cd_initial_draw(short dlog_num) -{ - short i,which_dlg = -1; - - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - which_dlg = i; - if (which_dlg < 0) { - return; - } - dlg_draw_ready[which_dlg] = TRUE; - - cd_erase_item(dlog_num, 0); - cd_draw(dlog_num); -} - -void cd_draw(short dlog_num) -{ - short i,which_dlg = -1; - - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - which_dlg = i; - if (which_dlg < 0) - return; - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) { - cd_draw_item(dlog_num,i); - } -} - -void cd_redraw(DialogPtr window) -{ - short which_dlg,dlg_num,dlg_key; - - if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlg_key)) < 0) - return; - dlg_draw_ready[which_dlg] = TRUE; - cd_initial_draw(dlg_num); -} - -void cd_frame_item(short dlog_num, short item_num, short width) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - frame_dlog_rect(GetDialogPort(dlgs[dlg_index]), item_rect[item_index], width); -} - -void cd_erase_item(short dlog_num, short item_num) -// if item_num is 0, nail whole window -// item_num + 100 just erase label -{ - short i,dlg_index,item_index,store_label; - Rect to_fry; - Boolean just_label = FALSE; - GrafPtr old_port; - - - - if (item_num >= 100) { - item_num -= 100; - just_label = TRUE; - } - - if (item_num == 0) { - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - dlg_index = i; - //GetWindowRect(dlgs[dlg_index],&to_fry); - GetPortBounds(GetDialogPort(dlgs[dlg_index]), &to_fry); - //OffsetRect(&to_fry,-1 * to_fry.left,-1 * to_fry.top); - } - else { - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - to_fry = item_rect[item_index]; - if (just_label == TRUE) { - if (item_label[item_index] != 0) { - store_label = item_label[item_index]; - if (store_label >= 1000) - store_label -= 1000; - - switch (store_label / 100) { - case 0: - to_fry.right = to_fry.left; - to_fry.left -= 2 * (store_label % 100); - break; - case 1: - to_fry.bottom = to_fry.top; - to_fry.top -= 2 * (store_label % 100); - break; - case 2: - to_fry.left = to_fry.right; - to_fry.right += 2 * (store_label % 100); - break; - case 3: - to_fry.top = to_fry.bottom; - to_fry.bottom += 2 * (store_label % 100); - break; - } - if ((i = 12 - (to_fry.bottom - to_fry.top)) > 0) { - // adjust rect ... but doesn't work for bold letters - to_fry.bottom += i / 2; - to_fry.bottom++; // extra pixel to get dangly letters - to_fry.top -= i / 2; - } - } - } - InsetRect(&to_fry,-1,-1); - - } - if (dlg_draw_ready[dlg_index] == FALSE) { - return; - } - GetPort(&old_port); - SetPort(GetDialogPort(dlgs[dlg_index])); - FillCRect(&to_fry,bg[5]); - SetPort(old_port); -} - -void cd_erase_rect(short dlog_num,Rect to_fry) -{ - short i,dlg_index,item_index,store_label; - GrafPtr old_port; - - if ((dlg_index = cd_get_dlg_index(dlog_num)) < 0) - return; - if (dlg_draw_ready[dlg_index] == FALSE) - return; - - GetPort(&old_port); - SetPort(GetDialogPort(dlgs[dlg_index])); - FillCRect(&to_fry,bg[5]); - SetPort(old_port); -} - -void cd_press_button(short dlog_num, short item_num) -{ - short dlg_index,item_index; - unsigned long dummy; - Rect from_rect,to_rect,x = {0,0,55,55}; - GrafPtr old_port; - RGBColor c[2] = {{0,0,4096},{0,0,8192}}; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - // no press action for redio buttons - if (item_type[item_index] == 2) { - play_sound(34); - return; - } - - GetPort(&old_port); - SetPort(GetDialogPort(dlgs[dlg_index])); - - - ForeColor(blackColor); - TextSize(12); - GetPortBounds(dlg_buttons_gworld[button_type[item_flag[item_index]]][0], &from_rect); - rect_draw_some_item(dlg_buttons_gworld[button_type[item_flag[item_index]]][1],from_rect, - dlg_buttons_gworld[button_type[item_flag[item_index]]][1],item_rect[item_index],0,2); - TextFace(bold); - RGBForeColor(&c[0]); - if (item_type[item_index] < 2) { - OffsetRect(&item_rect[item_index],-1 * button_left_adj[item_flag[item_index]],0); - char_win_draw_string(GetDialogPort(dlgs[dlg_index]),item_rect[item_index], - (char *) (button_strs[item_flag[item_index]]),1,8); - OffsetRect(&item_rect[item_index],button_left_adj[item_flag[item_index]],0); - } - else { - char_win_draw_string(GetDialogPort(dlgs[dlg_index]),item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),1,8); - } - - if (play_sounds == TRUE) { - play_sound(37); - Delay(6,&dummy); - } - else Delay(14,&dummy); - - rect_draw_some_item(dlg_buttons_gworld[button_type[item_flag[item_index]]][0],from_rect, - dlg_buttons_gworld[button_type[item_flag[item_index]]][0],item_rect[item_index],0,2); - - RGBForeColor(&c[1]); - if (item_type[item_index] < 2) { - OffsetRect(&item_rect[item_index],-1 * button_left_adj[item_flag[item_index]],0); - char_win_draw_string(GetDialogPort(dlgs[dlg_index]),item_rect[item_index], - (char *) (button_strs[item_flag[item_index]]),1,8); - OffsetRect(&item_rect[item_index],button_left_adj[item_flag[item_index]],0); - } - else { - char_win_draw_string(GetDialogPort(dlgs[dlg_index]),item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),1,8); - } - TextSize(10); - TextFace(bold); - ForeColor(blackColor); - Delay(8,&dummy); - - SetPort(old_port); - } - -// LOW LEVEL - -short cd_get_indices(short dlg_num, short item_num, short *dlg_index, short *item_index) -{ - if ((*dlg_index = cd_get_dlg_index(dlg_num)) < 0) { - return -1; - } - if ((*item_index = cd_get_item_id(dlg_num,item_num)) < 0) { - return -1; - } - return 0; - } - -short cd_get_dlg_index(short dlog_num) -{ - short i; - - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - return i; - return -1; -} - -short cd_find_dlog(DialogPtr window, short *dlg_num, short *dlg_key) -{ - short i; - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlgs[i] == window)) { - *dlg_num = dlg_types[i]; - *dlg_key = dlg_keys[i]; - return i; - } - return -1; -} - -short cd_get_item_id(short dlg_num, short item_num) -{ - short i; - - for (i = 0; i < NI; i++) - if ((item_dlg[i] == dlg_num) && (item_number[i] == item_num)) - return i; - return -1; -} - -// External graphics tools (huh huh huh ... tool ... huh huh huh) - -void center_window(WindowPtr window) -{ -// if this is needed, see adjust_window_mode -} - -Rect get_item_rect(DialogPtr hDlg, short item_num) -{ - short the_type; - Handle the_handle = NULL; - Rect small_rect; - short item_hit,what_talk_field; - - GetDialogItem( hDlg, item_num, &the_type, &the_handle, &small_rect); - - return small_rect; -} - - -void frame_dlog_rect(GrafPtr hDlg, Rect rect, short val) -{ - //COLORREF x = RGB(220,220,200),y = RGB(128,128,128); - //RGBColor lt_gray = {57344,57344,57344},dk_gray = {12287,12287,12287},med_gray = {24574,24574,24574}; - RGBColor lt_gray = {0,20230,40458},dk_gray = {0,20230,40458},med_gray = {0,20230,40458}; - GrafPtr old_port; - - - GetPort(&old_port); - SetPort(hDlg); - - InsetRect(&rect,-1 * val,-1 * val); - - RGBForeColor(&dk_gray); - MoveTo(rect.left,rect.top); - LineTo(rect.right,rect.top); - if (hDlg == GetWindowPort(mainPtr)) - RGBForeColor(&med_gray); - else RGBForeColor(<_gray); - LineTo(rect.right,rect.bottom); - LineTo(rect.left,rect.bottom); - RGBForeColor(&dk_gray); - LineTo(rect.left,rect.top); - ForeColor(blackColor); - SetPort(old_port); -} - -void draw_dialog_graphic(GrafPtr hDlg, Rect rect, short which_g, Boolean do_frame,short win_or_gworld) -// win_or_gworld: 0 - window 1 - gworld -// 0 - 300 number of terrain graphic -// 400 + x - monster graphic num -// 600 + x item graphic -// 700 + x dlog graphic -// 800 + x pc graphic -// 900 + x B&W graphic -// 950 null item -// 1000 + x Talking face -// 1100 - item info help -// 1200 - pc screen help -// 1300 - combat ap -// 1400-1402 - button help -// 1500 - stat symbols help -// 1600 + x - B&W maps -// 1700 + x - anim graphic -{ - short picnum; - Rect from1 = {0,0,36,28},from2 = {0,0,36,36},from3 = {0,0,72,72},tiny_obj_rect = {0,0,18,18}; - Rect from_rect = {0,0,36,28}; - Rect face_from = {0,0,32,32}; - Rect death_to = {6,6,78,78}; - Rect to_rect = {6,6,42,42}; - Rect m_to_rect = {6,10,42,38}; - Rect bw_from = {0,0,120,120}; - Rect map_from = {0,0,240,240}; - - Rect pc_info_from = {130,0,157,106}; - Rect item_info_from = {0,174,113,312}; - Rect button_help_from = {0,0,125,320}; - Rect combat_ap_from = {0,0,100,275}; - Rect stat_symbols_from = {0,0,94,386}; - - RGBColor store_color; - GWorldPtr from_gworld; - short draw_dest = 2; - - if (win_or_gworld == 1) - draw_dest = 0; - - if (which_g < 0) - return; - - if (which_g >= 2000) - do_frame = FALSE; - which_g = which_g % 2000; - - if (which_g == 950) { // Empty. Maybe clear space. - if (win_or_gworld == 0) - FillCRect(&rect,bg[5]); - return; - } - GetBackColor(&store_color); - - BackColor(whiteColor); - - switch (which_g / 100) { - case 0: case 1: case 2: // terrain - from_gworld = load_pict(800 + which_g / 50); - which_g = which_g % 50; - from_rect = calc_rect(which_g % 10, which_g / 10); - if (rect.right - rect.left > 28) - InsetRect(&rect,4,0); - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg): from_gworld) - ,rect,0,draw_dest); - DisposeGWorld(from_gworld); - break; - case 3: // animated terrain - which_g -= 300; - from_gworld = load_pict(820); - from_rect = calc_rect(4 * (which_g / 5), which_g % 5); - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,rect,0,draw_dest); - DisposeGWorld(from_gworld); - break; - case 4: case 5: // monster - which_g -= 400; - from_gworld = load_pict(1100 + which_g / 20); - which_g = which_g % 20; - from_rect = calc_rect(2 * (which_g / 10), which_g % 10); - rect.right = rect.left + 28; rect.bottom = rect.top + 36; - if (win_or_gworld == 0) - PaintRect(&rect); - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg): from_gworld) - ,rect,1,draw_dest); - DisposeGWorld(from_gworld); - break; - - case 7: // dialog - which_g -= 700; - from_gworld = dlogpics_gworld; - OffsetRect(&from2,36 * (which_g % 4),36 * (which_g / 4)); - rect_draw_some_item(from_gworld,from2,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,rect,0,draw_dest); - break; - - case 8: // PC - from_gworld = pc_gworld; - which_g -= 800; - from_rect = calc_rect(2 * (which_g / 8), which_g % 8); - PaintRect(&rect); - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,rect,1,draw_dest); - - break; - case 9: // B&W - which_g -= 900; - from_gworld = load_pict(875); - from_rect = bw_from; - OffsetRect(&from_rect,120 * ((which_g) % 3),120 * ((which_g) / 3)); - if (win_or_gworld == 1) - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) hDlg,rect,0,0); - else rect_draw_some_item(from_gworld,from_rect,from_gworld,rect,0,draw_dest); - DisposeGWorld(from_gworld); - break; - - - } - - if (do_frame == TRUE) - frame_dlog_rect(hDlg,rect,3); - RGBBackColor(&store_color); -} - - - -Rect calc_rect(short i, short j) -{ - Rect base_rect = {0,0,36,28}; - - OffsetRect(&base_rect,i * 28, j * 36); - return base_rect; -} \ No newline at end of file diff --git a/osx/Blades of Exile Char Editor/dlogtool.h b/osx/Blades of Exile Char Editor/dlogtool.h deleted file mode 100644 index b2f61d21..00000000 --- a/osx/Blades of Exile Char Editor/dlogtool.h +++ /dev/null @@ -1,47 +0,0 @@ -void cd_init_dialogs(); -short cd_create_dialog_parent_num(short dlog_num,short parent); -short cd_create_dialog(short dlog_num, DialogPtr parent); -void process_new_window (DialogPtr hDlg); -void cd_set_edit_focus(); -short cd_kill_dialog(short dlog_num,short parent_message); -short cd_process_click(DialogPtr window,Point the_point, short mods,short *item); -short cd_process_keystroke(DialogPtr window,char char_hit,short *item); -void cd_init_button(short dlog_num,short item_num, short button_num, short status); -void cd_attach_key(short dlog_num,short item_num,char key); -void csp(short dlog_num, short item_num, short pict_num); -void cd_set_pict(short dlog_num, short item_num, short pict_num); -void cd_activate_item(short dlog_num, short item_num, short status); -short cd_get_active(short dlog_num, short item_num); -void cd_get_item_text(short dlog_num, short item_num, char *str); -void csit(short dlog_num, short item_num, char *str); -void cd_retrieve_text_edit_str(short dlog_num, char *str); -void cd_set_text_edit_str(short dlog_num, char *str); -void cd_set_item_text(short dlog_num, short item_num, char *str); -void cdsin(short dlog_num, short item_num, short num) ; -void cd_set_item_num(short dlog_num, short item_num, short num); -void cd_set_led(short dlog_num,short item_num,short state); -void cd_set_flag(short dlog_num,short item_num,short flag); -short cd_get_led(short dlog_num,short item_num); -void cd_text_frame(short dlog_num,short item_num,short frame); -void cd_add_label(short dlog_num, short item_num, char *label, short label_flag); -void cd_take_label(short dlog_num, short item_num); -void cd_key_label(short dlog_num, short item_num,short loc); -void cd_draw_item(short dlog_num,short item_num); -void cd_initial_draw(short dlog_num); -void cd_draw(short dlog_num); -void cd_redraw(DialogPtr window); -void cd_frame_item(short dlog_num, short item_num, short width); -void cd_erase_item(short dlog_num, short item_num); -void cd_erase_rect(short dlog_num,Rect to_fry); -void cd_press_button(short dlog_num, short item_num); -short cd_get_indices(short dlg_num, short item_num, short *dlg_index, short *item_index); -short cd_get_dlg_index(short dlog_num); -short cd_find_dlog(DialogPtr window, short *dlg_num, short *dlg_key); -short cd_get_item_id(short dlg_num, short item_num); -void center_window(WindowPtr window); -Rect get_item_rect(DialogPtr hDlg, short item_num); -void frame_dlog_rect(GrafPtr hDlg, Rect rect, short val); -void draw_dialog_graphic(GrafPtr hDlg, Rect rect, short which_g, Boolean do_frame,short win_or_gworld); -Rect calc_rect(short i, short j); -void beep() ; - diff --git a/osx/Blades of Exile Char Editor/ed.action.c b/osx/Blades of Exile Char Editor/ed.action.c index 99ed7d26..be7fdf3e 100644 --- a/osx/Blades of Exile Char Editor/ed.action.c +++ b/osx/Blades of Exile Char Editor/ed.action.c @@ -12,9 +12,12 @@ #include "ed.global.h" #include "ed.editors.h" #include "ed.fileio.h" -#include "ed.action.h" -#include "ed.sound.h" -#include "dlogtool.h" +#include "ed.action.h" +#include "graphtool.h" +#include "soundtool.h" +#include "dlgtool.h" +#include "mathutil.h" +#include "dlgconsts.h" /* Adventure globals */ extern party_record_type party; @@ -28,9 +31,8 @@ extern setup_save_type setup_save; extern stored_items_list_type stored_items[3]; extern stored_town_maps_type town_maps; extern stored_outdoor_maps_type o_maps; -pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit); -extern Boolean dialog_not_toast,ed_reg; +extern Boolean ed_reg; extern long ed_flag,ed_key; extern WindowPtr mainPtr; @@ -165,7 +167,7 @@ void edit_gold_or_food_event_filter (short item_hit) Str255 get_text; long dummy; - cd_retrieve_text_edit_str((store_which_to_edit == 0) ? 1012 : 947,(char *) get_text); + cd_retrieve_text_edit_str((store_which_to_edit == 0) ? 1012 : 947,2,(char *) get_text); dialog_answer = 0; #ifndef EXILE_BIG_GUNS sscanf((char *) get_text,"%d",&dialog_answer); @@ -174,7 +176,7 @@ void edit_gold_or_food_event_filter (short item_hit) sscanf((char *) get_text,"%d",&dummy); dialog_answer = dummy; #endif - dialog_not_toast = FALSE; + toast_dialog(); } void edit_gold_or_food(short which_to_edit) @@ -188,17 +190,11 @@ void edit_gold_or_food(short which_to_edit) store_which_to_edit = which_to_edit; make_cursor_sword(); - cd_create_dialog((which_to_edit == 0) ? 1012 : 947, (DialogPtr)mainPtr); + cd_create_dialog((which_to_edit == 0) ? 1012 : 947, mainPtr); sprintf((char *) sign_text,"%d",(short) ((which_to_edit == 0) ? party.gold : party.food)); - cd_set_text_edit_str((which_to_edit == 0) ? 1012 : 947,(char *) sign_text); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + cd_set_text_edit_str((which_to_edit == 0) ? 1012 : 947,2,(char *) sign_text); + + item_hit = cd_run_dialog(); cd_kill_dialog((which_to_edit == 0) ? 1012 : 947,0); dialog_answer = minmax(0,25000,dialog_answer); if (which_to_edit == 0) @@ -212,7 +208,7 @@ void edit_day_event_filter (short item_hit) Str255 get_text; long dummy; - cd_retrieve_text_edit_str(917,(char *) get_text); + cd_retrieve_text_edit_str(917,2,(char *) get_text); dialog_answer = 0; #ifndef EXILE_BIG_GUNS sscanf((char *) get_text,"%d",&dialog_answer); @@ -221,7 +217,7 @@ void edit_day_event_filter (short item_hit) sscanf((char *) get_text,"%d",&dummy); dialog_answer = dummy; #endif - dialog_not_toast = FALSE; + toast_dialog(); } void edit_day() @@ -234,19 +230,12 @@ void edit_day() make_cursor_sword(); - cd_create_dialog(917,(DialogPtr)mainPtr); + cd_create_dialog(917,mainPtr); sprintf((char *) sign_text,"%d",(short) ( ((party.age) / 3700) + 1)); - cd_set_text_edit_str(917,(char *) sign_text); + cd_set_text_edit_str(917,2,(char *) sign_text); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + item_hit = cd_run_dialog(); cd_kill_dialog(917,0); @@ -269,14 +258,14 @@ void put_pc_graphics() cd_set_item_text(991,69,adven[which_pc_displayed].name); } -Boolean display_pc_event_filter (short item_hit) +void display_pc_event_filter (short item_hit) { short pc_num; pc_num = which_pc_displayed; switch (item_hit) { case 1: case 65: - dialog_not_toast = FALSE; + toast_dialog(); break; case 66: @@ -303,8 +292,7 @@ Boolean display_pc_event_filter (short item_hit) 1 - adven[which_pc_displayed].priest_spells[item_hit - 3]; put_pc_graphics(); break; - } - return FALSE; + } } void display_pc(short pc_num,short mode,short parent) @@ -330,26 +318,20 @@ void display_pc(short pc_num,short mode,short parent) } put_pc_graphics(); - cd_set_pict(991,2,714 + mode); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + cd_set_pict(991,2,14 + mode,PICT_DLG_TYPE); + + item_hit = cd_run_dialog(); cd_kill_dialog(991,0); } -Boolean display_alchemy_event_filter (short item_hit) +void display_alchemy_event_filter (short item_hit) { short i; switch (item_hit) { case 1: case 3: - dialog_not_toast = FALSE; + toast_dialog(); break; default: party.alchemy[item_hit - 4] = 1 - party.alchemy[item_hit - 4]; @@ -361,7 +343,6 @@ Boolean display_alchemy_event_filter (short item_hit) cd_set_led(996,i + 4,1); else cd_set_led(996,i + 4,0); } - return FALSE; } void display_alchemy() @@ -386,18 +367,11 @@ void display_alchemy() if (party.alchemy[i] > 0) cd_set_led(996,i + 4,1); else cd_set_led(996,i + 4,0); - } - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); cd_kill_dialog(996,0); - dialog_not_toast = TRUE; + untoast_dialog(); } @@ -460,7 +434,7 @@ void do_xp_draw() update_gold_skills(); } -Boolean spend_xp_event_filter (short item_hit) +void spend_xp_event_filter (short item_hit) { short what_talk_field,i,j,pc_num,mode = 1; char get_text[256]; @@ -598,16 +572,15 @@ Boolean spend_xp_event_filter (short item_hit) store_train_pc = pc_num; if (talk_done == TRUE) { - dialog_not_toast = FALSE; + toast_dialog(); } - return FALSE; } void update_gold_skills() { csit(1010,47,"Lots!"); csit(1010,46,"Lots!"); } -Boolean spend_xp(short pc_num, short mode, short parent) +bool spend_xp(short pc_num, short mode, short parent) //short mode; // 0 - create 1 - train // returns 1 if cancelled { @@ -632,15 +605,8 @@ Boolean spend_xp(short pc_num, short mode, short parent) do_xp_draw(); dialog_answer = 0; - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); cd_kill_dialog(1010,0); @@ -654,7 +620,7 @@ void give_reg_info_event_filter (short item_hit) switch (item_hit) { case 1: - dialog_not_toast = FALSE; + toast_dialog(); break; } } @@ -670,15 +636,8 @@ void give_reg_info() make_cursor_sword(); cd_create_dialog_parent_num(1073,0); - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); cd_kill_dialog(1073,0); } @@ -688,7 +647,7 @@ void edit_xp_event_filter (short item_hit) Str255 get_text; long dummy; - cd_retrieve_text_edit_str(1024,(char *) get_text); + cd_retrieve_text_edit_str(1024,2,(char *) get_text); dialog_answer = 0; #ifndef EXILE_BIG_GUNS sscanf((char *) get_text,"%d",&dialog_answer); @@ -697,7 +656,7 @@ void edit_xp_event_filter (short item_hit) sscanf((char *) get_text,"%d",&dummy); dialog_answer = dummy; #endif - dialog_not_toast = FALSE; + toast_dialog(); } void edit_xp(pc_record_type *pc) @@ -711,21 +670,14 @@ void edit_xp(pc_record_type *pc) make_cursor_sword(); - cd_create_dialog(1024,(DialogPtr)mainPtr); + cd_create_dialog(1024,mainPtr); sprintf((char *) sign_text,"%d",(short)pc->experience); - cd_set_text_edit_str(1024,(char *) sign_text); + cd_set_text_edit_str(1024,2,(char *) sign_text); item_hit = get_tnl(store_xp_pc); cdsin(1024,8,item_hit); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + item_hit = cd_run_dialog(); cd_kill_dialog(1024,0); diff --git a/osx/Blades of Exile Char Editor/ed.action.h b/osx/Blades of Exile Char Editor/ed.action.h index 594655fc..0e0a2ca4 100644 --- a/osx/Blades of Exile Char Editor/ed.action.h +++ b/osx/Blades of Exile Char Editor/ed.action.h @@ -3,16 +3,16 @@ void flash_rect(Rect to_flash); void edit_gold_or_food_event_filter (short item_hit); void edit_gold_or_food(short which_to_edit); void put_pc_graphics(); -Boolean display_pc_event_filter (short item_hit); +void display_pc_event_filter (short item_hit); void display_pc(short pc_num,short mode,short parent); -Boolean display_alchemy_event_filter (short item_hit); +void display_alchemy_event_filter (short item_hit); void display_alchemy(); void do_xp_keep(short pc_num,short mode); void draw_xp_skills(); void do_xp_draw(); -Boolean spend_xp_event_filter (short item_hit); +void spend_xp_event_filter (short item_hit); void update_gold_skills(); -Boolean spend_xp(short pc_num, short mode, short parent); +bool spend_xp(short pc_num, short mode, short parent); void give_reg_info_event_filter (short item_hit); void give_reg_info(); void do_registration_event_filter (short item_hit); diff --git a/osx/Blades of Exile Char Editor/ed.editors.c b/osx/Blades of Exile Char Editor/ed.editors.c index dd442189..f6d36404 100644 --- a/osx/Blades of Exile Char Editor/ed.editors.c +++ b/osx/Blades of Exile Char Editor/ed.editors.c @@ -8,7 +8,8 @@ #include "ed.graphics.h" #include "ed.global.h" #include "ed.editors.h" -#include "dlogtool.h" +#include "graphtool.h" +#include "dlgtool.h" /* Adventure globals */ extern party_record_type party; @@ -21,11 +22,9 @@ extern unsigned char out[96][96],out_e[96][96]; extern setup_save_type setup_save; extern stored_items_list_type stored_items[3]; -pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit); extern short dialog_answer; extern short store_flags[3]; -extern Boolean dialog_not_toast; extern short current_active_pc; @@ -165,7 +164,7 @@ void take_item(short pc_num,short which_item) void fancy_choice_dialog_event_filter (short item_hit) { - dialog_not_toast = FALSE; + toast_dialog(); dialog_answer = item_hit; } @@ -180,15 +179,7 @@ short fancy_choice_dialog(short which_dlog,short parent) cd_create_dialog_parent_num(which_dlog,parent); - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + item_hit = cd_run_dialog(); cd_kill_dialog(which_dlog,0); i = dialog_answer; @@ -199,7 +190,7 @@ short fancy_choice_dialog(short which_dlog,short parent) void select_pc_event_filter (short item_hit) { - dialog_not_toast = FALSE; + toast_dialog(); if (item_hit == 16) dialog_answer = 6; else dialog_answer = item_hit - 3; @@ -212,7 +203,7 @@ short char_select_pc(short active_only,short free_inv_only,char *title) make_cursor_sword(); - cd_create_dialog(1018,(DialogPtr)mainPtr); + cd_create_dialog(1018,mainPtr); if (active_only == 2) csit(1018,15,"Select PC to disarm trap:"); @@ -228,16 +219,9 @@ short char_select_pc(short active_only,short free_inv_only,char *title) csit(1018,9 + i,adven[i].name); } else cd_activate_item(1018, 9 + i, 0); - } + } -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + item_hit = cd_run_dialog(); cd_kill_dialog(1018,0); return dialog_answer; @@ -352,7 +336,7 @@ void pick_race_abil_event_filter(short item_hit) pc = store_pc; switch (item_hit) { case 3: - dialog_not_toast = FALSE; + toast_dialog(); break; case 4: case 5: case 6: if (store_trait_mode == 0) @@ -398,18 +382,11 @@ void pick_race_abil(pc_record_type *pc,short mode,short parent_num) display_traits_graphics(); if (mode == 1) csit(1013,19,start_str1); - else csit(1013,19,start_str2); - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + else csit(1013,19,start_str2); + + item_hit = cd_run_dialog(); cd_kill_dialog(1013,0); - dialog_not_toast = TRUE; + untoast_dialog(); } diff --git a/osx/Blades of Exile Char Editor/ed.fileio.c b/osx/Blades of Exile Char Editor/ed.fileio.c index e683e823..e121ab12 100644 --- a/osx/Blades of Exile Char Editor/ed.fileio.c +++ b/osx/Blades of Exile Char Editor/ed.fileio.c @@ -15,8 +15,10 @@ #include "ed.global.h" #include "ed.fileio.h" #include "ed.graphics.h" -#include "ed.sound.h" +#include "graphtool.h" +#include "soundtool.h" #include "ed.editors.h" +#include "mathutil.h" #define DONE_BUTTON_ITEM 1 #define IN_FRONT (WindowPtr)-1L diff --git a/osx/Blades of Exile Char Editor/ed.global.h b/osx/Blades of Exile Char Editor/ed.global.h index d3f2f9f9..9a4784a6 100644 --- a/osx/Blades of Exile Char Editor/ed.global.h +++ b/osx/Blades of Exile Char Editor/ed.global.h @@ -432,16 +432,4 @@ typedef struct { typedef struct { long l[10]; -} PrefRecord,*PrefPtr,**PrefHandle; - - -short s_pow(short x,short y); -short a_v(short x); -short ex_abs(short x); -short get_ran (short times,short min,short max); -Boolean same_point(location p1,location p2); -void BoEpause(short length); -short minmax(short min,short max,short k); -short min(short a,short b); -short max(short a,short b); -short move_to_zero(short val); +} PrefRecord,*PrefPtr,**PrefHandle; \ No newline at end of file diff --git a/osx/Blades of Exile Char Editor/ed.graphics.c b/osx/Blades of Exile Char Editor/ed.graphics.c index b8192e48..1164c79c 100644 --- a/osx/Blades of Exile Char Editor/ed.graphics.c +++ b/osx/Blades of Exile Char Editor/ed.graphics.c @@ -15,8 +15,13 @@ #include "string.h" #include "ed.global.h" #include "ed.graphics.h" -#include "ed.sound.h" -#include "dlogtool.h" +#include "ed.editors.h" +#include "ed.action.h" +#include "soundtool.h" +#include "graphtool.h" +#include "dlgtool.h" +#include "dlglowlevel.h" +#include "graphtool.h" /* Adventure globals */ extern party_record_type party; @@ -33,19 +38,18 @@ extern stored_outdoor_maps_type o_maps; extern WindowPtr mainPtr; extern Boolean registered,play_sounds,file_in_mem,party_in_scen,scen_items_loaded; -pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit); extern short store_flags[3]; extern GWorldPtr button_num_gworld; extern short current_active_pc; -extern Boolean dialog_not_toast,ed_reg; +extern Boolean ed_reg; extern CursHandle sword_curs, boot_curs, key_curs, target_curs; extern long register_flag,stored_key; extern long ed_flag,ed_key; GWorldPtr title_gworld,pc_gworld,dlogpics_gworld; -GWorldPtr dlg_buttons_gworld[NUM_BUTTONS][2],mixed_gworld,buttons_gworld; +GWorldPtr mixed_gworld,buttons_gworld; //GWorldPtr race_dark,train_dark,items_dark,spells_dark; //GWorldPtr race_light,train_light,items_light,spells_light; Rect whole_win_rect = {0,0,440,590}; @@ -79,6 +83,25 @@ Rect ed_buttons_from[2] = {{0,0,57,57},{0,57,57,114}}; short current_pressed_button = -1; Boolean init_once = FALSE; +void init_dialogs(){ + cd_init_dialogs(NULL,NULL,NULL,NULL,NULL,&dlogpics_gworld,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + cd_register_event_filter(917,edit_day_event_filter); + cd_register_event_filter(970,display_strings_event_filter); + cd_register_event_filter(971,display_strings_event_filter); + cd_register_event_filter(972,display_strings_event_filter); + cd_register_event_filter(973,display_strings_event_filter); + cd_register_event_filter(991,display_pc_event_filter); + cd_register_event_filter(996,display_alchemy_event_filter); + cd_register_event_filter(1010,spend_xp_event_filter); + cd_register_event_filter(947,edit_gold_or_food_event_filter); + cd_register_event_filter(1012,edit_gold_or_food_event_filter); + cd_register_event_filter(1013,pick_race_abil_event_filter); + cd_register_event_filter(1018,select_pc_event_filter); + cd_register_event_filter(1024,edit_xp_event_filter); + cd_register_event_filter(1073,give_reg_info_event_filter); + cd_register_default_event_filter(fancy_choice_dialog_event_filter); +} + void init_main_buttons() { @@ -266,11 +289,6 @@ void Set_up_win () mixed_gworld = load_pict(903); dlogpics_gworld = load_pict(850); buttons_gworld = load_pict(5001); - for (i = 0; i < NUM_BUTTONS; i++){ - for (j = 0; j < 2; j++){ - dlg_buttons_gworld[i][j] = load_pict(2000 + (2 * i) + j); - } - } for (i = 0; i < 14; i++){ bg[i] = GetPixPat (128 + i); @@ -335,25 +353,25 @@ void draw_main_screen() //Off0setRect(&dest_rect,0,45); OffsetRect(&dest_rect,0,21); if (file_in_mem == TRUE) - char_win_draw_string(GetWindowPort(mainPtr),dest_rect,"Click on character to edit it.",0,10); + char_win_draw_string(mainPtr,dest_rect,"Click on character to edit it.",0,10,true); else - char_win_draw_string(GetWindowPort(mainPtr),dest_rect,"Select Open from File menu.",0,10); + char_win_draw_string(mainPtr,dest_rect,"Select Open from File menu.",0,10,true); if(file_in_mem == TRUE && party_in_scen==TRUE && scen_items_loaded==FALSE){ OffsetRect(&dest_rect,200,0); - char_win_draw_string(GetWindowPort(mainPtr),dest_rect,"Warning: Scenario item data could not be loaded.",0,10); + char_win_draw_string(mainPtr,dest_rect,"Warning: Scenario item data could not be loaded.",0,10,true); OffsetRect(&dest_rect,-200,0); } OffsetRect(&dest_rect,0,12); if (file_in_mem == TRUE) - char_win_draw_string(GetWindowPort(mainPtr),dest_rect,"Press 'I' button to identify item, and 'D' button to drop item.",0,10); + char_win_draw_string(mainPtr,dest_rect,"Press 'I' button to identify item, and 'D' button to drop item.",0,10,true); TextSize(12); OffsetRect(&dest_rect,0,16); if (file_in_mem == TRUE) - char_win_draw_string(GetWindowPort(mainPtr),dest_rect,"Back up save file before editing it!",0,10); + char_win_draw_string(mainPtr,dest_rect,"Back up save file before editing it!",0,10,true); TextSize(10); TextFace(0); OffsetRect(&dest_rect,300,0); - char_win_draw_string(GetWindowPort(mainPtr),dest_rect,"Copyright 1997, Spiderweb Software, Inc.",0,10); + char_win_draw_string(mainPtr,dest_rect,"Copyright 1997, Spiderweb Software, Inc.",0,10,true); TextFace(bold); @@ -365,7 +383,7 @@ void draw_main_screen() if (ed_reg == FALSE) { sprintf((char *)temp_str,"Unregistered Copy |To find out how to order, |select How To Order from File Menu."); - win_draw_string(GetWindowPort(mainPtr),reg_rect,temp_str,0,12); + win_draw_string(GetWindowPort(mainPtr),reg_rect,temp_str,0,12,true); } } @@ -399,13 +417,13 @@ GWorldPtr load_pict(short picture_to_get) SysBeep(2);SysBeep(50);SysBeep(50); ExitToShell(); } - pic_rect = ( **( current_pic_handle) ).picFrame; + QDGetPictureBounds(current_pic_handle, &pic_rect); pic_wd = pic_rect.right - pic_rect.left; pic_hgt = pic_rect.bottom - pic_rect.top; GetGWorld (&origPort, &origDev); check_error = NewGWorld (&myGWorld, 0, &pic_rect, - NULL, NULL, 0); + NULL, NULL, kNativeEndianPixMap); if (check_error != noErr) { SysBeep(50); // sprintf((char *) debug, "Stuck on %d ",(short) picture_to_get); @@ -482,7 +500,7 @@ void draw_items(short clear_first) // else sprintf((char *) to_draw, "%d %d %d %d", // name_rect.left,name_rect.right,name_rect.top,name_rect.bottom); - char_win_draw_string(GetWindowPort(mainPtr),item_string_rects[i][0],(char *) to_draw,0,10); + char_win_draw_string(mainPtr,item_string_rects[i][0],(char *) to_draw,0,10,true); //Draw id/drop buttons rect_draw_some_item(mixed_gworld,d_from,mixed_gworld,item_string_rects[i][1],1,1); @@ -521,15 +539,15 @@ void display_party(short mode,short clear_first) no_party_rect=pc_info_rect; no_party_rect.top+=5; no_party_rect.left+=5; - char_win_draw_string(GetWindowPort(mainPtr),no_party_rect,"No party loaded.",0,10); + char_win_draw_string(mainPtr,no_party_rect,"No party loaded.",0,10,true); } else { from_rect = pc_info_rect; from_rect.top = from_rect.bottom - 14; if (party_in_scen == FALSE) - char_win_draw_string(GetWindowPort(mainPtr),from_rect,"Party not in a scenario.",0,10); + char_win_draw_string(mainPtr,from_rect,"Party not in a scenario.",0,10,true); else - char_win_draw_string(GetWindowPort(mainPtr),from_rect,"Party is in a scenario.",0,10); + char_win_draw_string(mainPtr,from_rect,"Party is in a scenario.",0,10,true); for (i = 0; i < 6; i++) { if (i == current_active_pc) // active pc is drawn in blue ForeColor(blueColor); @@ -562,7 +580,7 @@ void display_party(short mode,short clear_first) } ForeColor(whiteColor); - win_draw_string(GetWindowPort(mainPtr),pc_area_buttons[i][2],to_draw,1,10); + win_draw_string(GetWindowPort(mainPtr),pc_area_buttons[i][2],to_draw,1,10,true); TextFace(bold); TextSize(10); @@ -571,7 +589,7 @@ void display_party(short mode,short clear_first) if( (strlen(adven[i].name)) > 12) TextSize(8); ForeColor(blackColor); - win_draw_string(GetWindowPort(mainPtr),name_rect,to_draw,1,10); + win_draw_string(GetWindowPort(mainPtr),name_rect,to_draw,1,10,true); TextSize(10); } if ((current_pressed_button < 0) || (current_pressed_button == i)) @@ -581,18 +599,18 @@ void display_party(short mode,short clear_first) if (i == current_active_pc) { //Draw in race if (adven[i].race == 0) - char_win_draw_string(GetWindowPort(mainPtr),pc_race_rect,"Human ",1,10); + char_win_draw_string(mainPtr,pc_race_rect,"Human ",1,10,true); if (adven[i].race == 1) - char_win_draw_string(GetWindowPort(mainPtr),pc_race_rect,"Nephilim ",1,10); + char_win_draw_string(mainPtr,pc_race_rect,"Nephilim ",1,10,true); if (adven[i].race == 2) - char_win_draw_string(GetWindowPort(mainPtr),pc_race_rect,"Slithzerikai ",1,10); + char_win_draw_string(mainPtr,pc_race_rect,"Slithzerikai ",1,10,true); // Draw in skills sprintf((char *) to_draw, "Skills:"); - win_draw_string(GetWindowPort(mainPtr),skill_rect,to_draw,0,10); + win_draw_string(GetWindowPort(mainPtr),skill_rect,to_draw,0,10,true); sprintf((char *) to_draw, "Hp: %d/%d Sp: %d/%d",adven[i].cur_health,adven[i].max_health,adven[i].cur_sp, adven[i].max_sp); - win_draw_string(GetWindowPort(mainPtr),hp_sp_rect,to_draw,0,10); + win_draw_string(GetWindowPort(mainPtr),hp_sp_rect,to_draw,0,10,true); TextSize(9); @@ -604,10 +622,10 @@ void display_party(short mode,short clear_first) temp_rect.left = pc_skills_rect[k].left + 80; get_str(to_draw,9,string_num); - win_draw_string(GetWindowPort(mainPtr),pc_skills_rect[k],to_draw,0,9); + win_draw_string(GetWindowPort(mainPtr),pc_skills_rect[k],to_draw,0,9,true); sprintf((char *) skill_value,"%d",adven[i].skills[k]); - win_draw_string(GetWindowPort(mainPtr),temp_rect,skill_value,0,9); + win_draw_string(GetWindowPort(mainPtr),temp_rect,skill_value,0,9,true); //frame_dlog_rect(GetWindowPort(mainPtr),pc_skills_rect[k],0); string_num+=2; } @@ -617,7 +635,7 @@ void display_party(short mode,short clear_first) TextSize(10); TextFace(bold); sprintf((char *) to_draw, "Status:"); - win_draw_string(GetWindowPort(mainPtr),status_rect,to_draw,0,10); + win_draw_string(GetWindowPort(mainPtr),status_rect,to_draw,0,10,true); TextSize(9); TextFace(0); @@ -625,82 +643,82 @@ void display_party(short mode,short clear_first) //frame_dlog_rect(GetWindowPort(mainPtr),pc_status_rect[k],0); if (adven[i].status[0] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Poisoned Weap.",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Poisoned Weap.",0,9,true); cur_rect++; } if (adven[i].status[1] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Blessed",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Blessed",0,9,true); cur_rect++; } else if(adven[i].status[1] < 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Cursed",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Cursed",0,9,true); cur_rect++; } if (adven[i].status[2] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Poisoned",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Poisoned",0,9,true); cur_rect++; } if (adven[i].status[3] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Hasted",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Hasted",0,9,true); cur_rect++; } else if(adven[i].status[3] < 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Slowed",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Slowed",0,9,true); cur_rect++; } if (adven[i].status[4] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Invulnerable",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Invulnerable",0,9,true); cur_rect++; } if (adven[i].status[5] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Magic Resistant",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Magic Resistant",0,9,true); cur_rect++; } if (adven[i].status[6] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Webbed",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Webbed",0,9,true); cur_rect++; } if (adven[i].status[7] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Diseased",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Diseased",0,9,true); cur_rect++; } if (adven[i].status[8] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Sanctury",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Sanctury",0,9,true); cur_rect++; } if (adven[i].status[9] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Dumbfounded",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Dumbfounded",0,9,true); cur_rect++; } if (adven[i].status[10] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Martyr's Shield",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Martyr's Shield",0,9,true); cur_rect++; } if (adven[i].status[11] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Asleep",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Asleep",0,9,true); cur_rect++; } if (adven[i].status[12] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Paralyzed",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Paralyzed",0,9,true); cur_rect++; } if (adven[i].status[13] > 0) if(cur_rect <= 9) { - char_win_draw_string(GetWindowPort(mainPtr),pc_status_rect[cur_rect],"Acid",0,9); + char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Acid",0,9,true); cur_rect++; } //end pc status section @@ -709,7 +727,7 @@ void display_party(short mode,short clear_first) TextSize(10); TextFace(bold); sprintf((char *) to_draw, "Traits:"); - win_draw_string(GetWindowPort(mainPtr),traits_rect,to_draw,0,10); + win_draw_string(GetWindowPort(mainPtr),traits_rect,to_draw,0,10,true); //for(k = 0 ; k < 16; k++) //frame_dlog_rect(GetWindowPort(mainPtr),pc_traits_rect[k],0); TextSize(9); @@ -717,78 +735,78 @@ void display_party(short mode,short clear_first) cur_rect=0; if (adven[i].traits[0] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Toughness",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Toughness",0,9,true); cur_rect++; } if (adven[i].traits[1] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Magically Apt",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Magically Apt",0,9,true); cur_rect++; } if (adven[i].traits[2] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Ambidextrous",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Ambidextrous",0,9,true); cur_rect++; } if (adven[i].traits[3] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Nimble Fingers",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Nimble Fingers",0,9,true); cur_rect++; } if (adven[i].traits[4] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Cave Lore",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Cave Lore",0,9,true); cur_rect++; } if (adven[i].traits[5] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Woodsman",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Woodsman",0,9,true); cur_rect++; } if (adven[i].traits[6] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Good Constitution",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Good Constitution",0,9,true); cur_rect++; } if (adven[i].traits[7] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Highly Alert",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Highly Alert",0,9,true); cur_rect++; } if (adven[i].traits[8] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Exceptional Str.",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Exceptional Str.",0,9,true); cur_rect++; } if (adven[i].traits[9] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Recuperation",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Recuperation",0,9,true); cur_rect++; } if (adven[i].traits[10] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Sluggish",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Sluggish",0,9,true); cur_rect++; } if (adven[i].traits[11] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Magically Inept",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Magically Inept",0,9,true); cur_rect++; } if (adven[i].traits[12] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Frail",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Frail",0,9,true); cur_rect++; } if (adven[i].traits[13] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Chronic Disease",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Chronic Disease",0,9,true); cur_rect++; } if (adven[i].traits[14] == 1) if(cur_rect <= 15) { - char_win_draw_string(GetWindowPort(mainPtr),pc_traits_rect[cur_rect],"Bad Back",0,9); + char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Bad Back",0,9,true); cur_rect++; } @@ -798,7 +816,7 @@ void display_party(short mode,short clear_first) ForeColor(whiteColor); TextSize(9); TextFace(0); - char_win_draw_string(GetWindowPort(mainPtr),pc_area_buttons[i][3],"Alive ",1,10); + char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Alive ",1,10,true); TextFace(bold); TextSize(10); break; @@ -806,7 +824,7 @@ void display_party(short mode,short clear_first) ForeColor(whiteColor); TextSize(9); TextFace(0); - char_win_draw_string(GetWindowPort(mainPtr),pc_area_buttons[i][3],"Dead ",1,10); + char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Dead ",1,10,true); TextFace(bold); TextSize(10); break; @@ -814,7 +832,7 @@ void display_party(short mode,short clear_first) ForeColor(whiteColor); TextSize(9); TextFace(0); - char_win_draw_string(GetWindowPort(mainPtr),pc_area_buttons[i][3],"Dust ",1,10); + char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Dust ",1,10,true); TextFace(bold); TextSize(10); break; @@ -822,7 +840,7 @@ void display_party(short mode,short clear_first) ForeColor(whiteColor); TextSize(9); TextFace(0); - char_win_draw_string(GetWindowPort(mainPtr),pc_area_buttons[i][3],"Stone ",1,10); + char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Stone ",1,10,true); TextFace(bold); TextSize(10); break; @@ -830,7 +848,7 @@ void display_party(short mode,short clear_first) ForeColor(whiteColor); TextSize(9); TextFace(0); - char_win_draw_string(GetWindowPort(mainPtr),pc_area_buttons[i][3],"Fled ",1,10); + char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Fled ",1,10,true); TextFace(bold); TextSize(10); break; @@ -838,7 +856,7 @@ void display_party(short mode,short clear_first) ForeColor(whiteColor); TextSize(9); TextFace(0); - char_win_draw_string(GetWindowPort(mainPtr),pc_area_buttons[i][3],"Surface ",1,10); + char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Surface ",1,10,true); TextFace(bold); TextSize(10); break; @@ -846,7 +864,7 @@ void display_party(short mode,short clear_first) ForeColor(whiteColor); TextFace(0); TextSize(9); - char_win_draw_string(GetWindowPort(mainPtr),pc_area_buttons[i][3],"Absent ",1,10); + char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Absent ",1,10,true); TextFace(bold); TextSize(10); break; @@ -871,19 +889,19 @@ void display_party(short mode,short clear_first) ForeColor(whiteColor); switch(i) { case 0: - char_win_draw_string(GetWindowPort(mainPtr),edit_rect[0][1]," Add Mage Spells ",0,10); + char_win_draw_string(mainPtr,edit_rect[0][1]," Add Mage Spells ",0,10,true); break; case 1: - char_win_draw_string(GetWindowPort(mainPtr),edit_rect[1][1]," Add Priest Spells ",0,10); + char_win_draw_string(mainPtr,edit_rect[1][1]," Add Priest Spells ",0,10,true); break; case 2: - char_win_draw_string(GetWindowPort(mainPtr),edit_rect[2][1]," Edit Traits",0,10); + char_win_draw_string(mainPtr,edit_rect[2][1]," Edit Traits",0,10,true); break; case 3: - char_win_draw_string(GetWindowPort(mainPtr),edit_rect[3][1]," Edit Skills",0,10); + char_win_draw_string(mainPtr,edit_rect[3][1]," Edit Skills",0,10,true); break; case 4: - char_win_draw_string(GetWindowPort(mainPtr),edit_rect[4][1]," Edit XP",0,10); + char_win_draw_string(mainPtr,edit_rect[4][1]," Edit XP",0,10,true); break; default: break; @@ -909,193 +927,193 @@ void add_string_to_buf(char *str) { } -void rect_draw_some_item (GWorldPtr src_gworld, Rect src_rect, GWorldPtr targ_gworld,Rect targ_rect, -char masked,short main_win) -//char masked; // if 10 - make AddOver -//short main_win; // if 2, drawing onto dialog -{ - Rect destrec; - PixMapHandle test1, test2; - const BitMap *store_dest; - GrafPtr cur_port; - RGBColor store_color; +//void rect_draw_some_item (GWorldPtr src_gworld, Rect src_rect, GWorldPtr targ_gworld,Rect targ_rect, +//char masked,short main_win) +////char masked; // if 10 - make AddOver +////short main_win; // if 2, drawing onto dialog +//{ +// Rect destrec; +// PixMapHandle test1, test2; +// const BitMap *store_dest; +// GrafPtr cur_port; +// RGBColor store_color; +// +// if (main_win == 2) { +// GetBackColor(&store_color); +// BackColor(whiteColor); +// } +// +// GetPort(&cur_port); +// store_dest = GetPortBitMapForCopyBits(cur_port); +// +// test1 = GetPortPixMap(src_gworld); +// +// LockPixels(test1); +// if (main_win == 0) { +// test2 = GetPortPixMap(targ_gworld); +// LockPixels(test2); +// if (masked == 1) +// CopyBits ( (BitMap *) *test1 , +// (BitMap *) *test2 , +// &src_rect, &targ_rect, +// transparent , NULL); +// else CopyBits ( (BitMap *) *test1 , +// (BitMap *) *test2 , +// &src_rect, &targ_rect, +// (masked == 10) ? addOver : 0, NULL); +// UnlockPixels(test2); +// } +// else { +// if (masked == 1) +// CopyBits ( (BitMap *) *test1 , +// store_dest , +// &src_rect, &targ_rect, +// transparent , NULL); +// else CopyBits ( (BitMap *) *test1 , +// store_dest , +// &src_rect, &targ_rect, +// (masked == 10) ? addOver : 0, NULL); +// } +// UnlockPixels(test1); +// +// if (main_win == 2) +// RGBBackColor(&store_color); +//} - if (main_win == 2) { - GetBackColor(&store_color); - BackColor(whiteColor); - } - - GetPort(&cur_port); - store_dest = GetPortBitMapForCopyBits(cur_port); - - test1 = GetPortPixMap(src_gworld); +//short string_length(char *str) +//{ +// short text_len[257]; +// short total_width = 0,i,len; +// Str255 p_str; +// +// for (i = 0; i < 257; i++) +// text_len[i]= 0; +// +// strcpy((char *) p_str,str); +// c2pstr((char*) p_str); +// MeasureText(256,p_str,text_len); +// len = strlen((char *)str); +// +// for (i = 0; i < 257; i++) +// if ((text_len[i] > total_width) && (i <= len)) +// total_width = text_len[i]; +// return total_width; +//} - LockPixels(test1); - if (main_win == 0) { - test2 = GetPortPixMap(targ_gworld); - LockPixels(test2); - if (masked == 1) - CopyBits ( (BitMap *) *test1 , - (BitMap *) *test2 , - &src_rect, &targ_rect, - transparent , NULL); - else CopyBits ( (BitMap *) *test1 , - (BitMap *) *test2 , - &src_rect, &targ_rect, - (masked == 10) ? addOver : 0, NULL); - UnlockPixels(test2); - } - else { - if (masked == 1) - CopyBits ( (BitMap *) *test1 , - store_dest , - &src_rect, &targ_rect, - transparent , NULL); - else CopyBits ( (BitMap *) *test1 , - store_dest , - &src_rect, &targ_rect, - (masked == 10) ? addOver : 0, NULL); - } - UnlockPixels(test1); - - if (main_win == 2) - RGBBackColor(&store_color); -} - -short string_length(char *str) -{ - short text_len[257]; - short total_width = 0,i,len; - Str255 p_str; - - for (i = 0; i < 257; i++) - text_len[i]= 0; - - strcpy((char *) p_str,str); - c2p(p_str); - MeasureText(256,p_str,text_len); - len = strlen((char *)str); - - for (i = 0; i < 257; i++) - if ((text_len[i] > total_width) && (i <= len)) - total_width = text_len[i]; - return total_width; -} - -void char_win_draw_string(GrafPtr dest_window,Rect dest_rect,char *str,short mode,short line_height) -{ - Str255 store_s; - strcpy((char *) store_s,str); - win_draw_string( dest_window, dest_rect,store_s, mode, line_height); -} - -// mode: 0 - align up and left, 1 - center on one line -// str is a c string, 256 characters -// uses current font -void win_draw_string(GrafPtr dest_window,Rect dest_rect,Str255 str,short mode,short line_height) -{ - GrafPtr old_port; - Str255 p_str,str_to_draw,str_to_draw2,c_str; - Str255 null_s = " "; - short str_len,i; - short last_line_break = 0,last_word_break = 0,on_what_line = 0; - short text_len[257]; - short total_width = 0; - Boolean end_loop,force_skip = FALSE; - KeyMap key_state; - long dummy3; - RgnHandle current_clip; - short adjust_x = 0,adjust_y = 0; - strcpy((char *) p_str,(char *) str); - strcpy((char *) c_str,(char *) str); - c2p(p_str); - for (i = 0; i < 257; i++) - text_len[i]= 0; - MeasureText(256,p_str,text_len); - str_len = (short) strlen((char *)str); - if (str_len == 0) { - return; - } - GetPort(&old_port); - SetPort(dest_window); - - //FrameRect(&dest_rect); - - current_clip = NewRgn(); - GetClip(current_clip); - - dest_rect.bottom += 5; - //ClipRect(&dest_rect); - dest_rect.bottom -= 5; - - for (i = 0; i < 257; i++) - if ((text_len[i] > total_width) && (i <= str_len)) - total_width = text_len[i]; - if ((mode == 0) && (total_width < dest_rect.right - dest_rect.left)) - mode = 2; - for (i = 0; i < 257; i++) - if ((i <= str_len) && (c_str[i] == '|') && (mode == 2)) - mode = 0; - - switch (mode) { - case 0: - MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); - for (i = 0;text_len[i] != text_len[i + 1], i < str_len;i++) { - if (((text_len[i] - text_len[last_line_break] > (dest_rect.right - dest_rect.left - 6)) && (last_word_break > last_line_break)) || (c_str[i] == '|')) { - if (c_str[i] == '|') { - c_str[i] = ' '; - force_skip = TRUE; - } - sprintf((char *)str_to_draw,"%s",(char *)null_s); - strncpy ((char *) str_to_draw,(char *) c_str + last_line_break,(size_t) (last_word_break - last_line_break - 1)); - sprintf((char *)str_to_draw2," %s",str_to_draw); - str_to_draw2[0] = (char) strlen((char *)str_to_draw); - DrawString(str_to_draw2); - on_what_line++; - MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); - last_line_break = last_word_break; - if (force_skip == TRUE) { - force_skip = FALSE; - i++; - last_line_break++; - last_word_break++; - } - } - if (c_str[i] == ' ') - last_word_break = i + 1; - //if (on_what_line == LINES_IN_TEXT_WIN - 1) - // i = 10000; - } - if (i - last_line_break > 1) { - strcpy((char *)str_to_draw,(char *)null_s); - strncpy ((char *) str_to_draw,(char *) c_str + last_line_break,(size_t) (i - last_line_break)); - sprintf((char *)str_to_draw2," %s",str_to_draw); - if (strlen((char *) str_to_draw2) > 3) { - str_to_draw2[0] = (char) strlen((char *)str_to_draw); - DrawString(str_to_draw2); - } - } - break; - case 1: - MoveTo((dest_rect.right + dest_rect.left) / 2 - (4 * total_width) / 9 + adjust_x, - (dest_rect.bottom + dest_rect.top - line_height) / 2 + 9 + adjust_y); - DrawString(p_str); - break; - case 2: - MoveTo(dest_rect.left + 1 + adjust_x, - dest_rect.top + 1 + adjust_y + 9); - DrawString(p_str); - break; - case 3: - MoveTo(dest_rect.left + 1 + adjust_x, - dest_rect.top + 1 + adjust_y + 9 + (dest_rect.bottom - dest_rect.top) / 6); - DrawString(p_str); - break; - } - SetClip(current_clip); - DisposeRgn(current_clip); - SetPort(old_port); -} +//void char_win_draw_string(GrafPtr dest_window,Rect dest_rect,char *str,short mode,short line_height) +//{ +// Str255 store_s; +// strcpy((char *) store_s,str); +// win_draw_string( dest_window, dest_rect,store_s, mode, line_height); +//} +// +//// mode: 0 - align up and left, 1 - center on one line +//// str is a c string, 256 characters +//// uses current font +//void win_draw_string(GrafPtr dest_window,Rect dest_rect,Str255 str,short mode,short line_height) +//{ +// GrafPtr old_port; +// Str255 p_str,str_to_draw,str_to_draw2,c_str; +// Str255 null_s = " "; +// short str_len,i; +// short last_line_break = 0,last_word_break = 0,on_what_line = 0; +// short text_len[257]; +// short total_width = 0; +// Boolean end_loop,force_skip = FALSE; +// KeyMap key_state; +// long dummy3; +// RgnHandle current_clip; +// short adjust_x = 0,adjust_y = 0; +// strcpy((char *) p_str,(char *) str); +// strcpy((char *) c_str,(char *) str); +// c2pstr((char*) p_str); +// for (i = 0; i < 257; i++) +// text_len[i]= 0; +// MeasureText(256,p_str,text_len); +// str_len = (short) strlen((char *)str); +// if (str_len == 0) { +// return; +// } +// GetPort(&old_port); +// SetPort(dest_window); +// +// //FrameRect(&dest_rect); +// +// current_clip = NewRgn(); +// GetClip(current_clip); +// +// dest_rect.bottom += 5; +// //ClipRect(&dest_rect); +// dest_rect.bottom -= 5; +// +// for (i = 0; i < 257; i++) +// if ((text_len[i] > total_width) && (i <= str_len)) +// total_width = text_len[i]; +// if ((mode == 0) && (total_width < dest_rect.right - dest_rect.left)) +// mode = 2; +// for (i = 0; i < 257; i++) +// if ((i <= str_len) && (c_str[i] == '|') && (mode == 2)) +// mode = 0; +// +// switch (mode) { +// case 0: +// MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); +// for (i = 0;text_len[i] != text_len[i + 1], i < str_len;i++) { +// if (((text_len[i] - text_len[last_line_break] > (dest_rect.right - dest_rect.left - 6)) && (last_word_break > last_line_break)) || (c_str[i] == '|')) { +// if (c_str[i] == '|') { +// c_str[i] = ' '; +// force_skip = TRUE; +// } +// sprintf((char *)str_to_draw,"%s",(char *)null_s); +// strncpy ((char *) str_to_draw,(char *) c_str + last_line_break,(size_t) (last_word_break - last_line_break - 1)); +// sprintf((char *)str_to_draw2," %s",str_to_draw); +// str_to_draw2[0] = (char) strlen((char *)str_to_draw); +// DrawString(str_to_draw2); +// on_what_line++; +// MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); +// last_line_break = last_word_break; +// if (force_skip == TRUE) { +// force_skip = FALSE; +// i++; +// last_line_break++; +// last_word_break++; +// } +// } +// if (c_str[i] == ' ') +// last_word_break = i + 1; +// //if (on_what_line == LINES_IN_TEXT_WIN - 1) +// // i = 10000; +// } +// if (i - last_line_break > 1) { +// strcpy((char *)str_to_draw,(char *)null_s); +// strncpy ((char *) str_to_draw,(char *) c_str + last_line_break,(size_t) (i - last_line_break)); +// sprintf((char *)str_to_draw2," %s",str_to_draw); +// if (strlen((char *) str_to_draw2) > 3) { +// str_to_draw2[0] = (char) strlen((char *)str_to_draw); +// DrawString(str_to_draw2); +// } +// } +// break; +// case 1: +// MoveTo((dest_rect.right + dest_rect.left) / 2 - (4 * total_width) / 9 + adjust_x, +// (dest_rect.bottom + dest_rect.top - line_height) / 2 + 9 + adjust_y); +// DrawString(p_str); +// break; +// case 2: +// MoveTo(dest_rect.left + 1 + adjust_x, +// dest_rect.top + 1 + adjust_y + 9); +// DrawString(p_str); +// break; +// case 3: +// MoveTo(dest_rect.left + 1 + adjust_x, +// dest_rect.top + 1 + adjust_y + 9 + (dest_rect.bottom - dest_rect.top) / 6); +// DrawString(p_str); +// break; +// } +// SetClip(current_clip); +// DisposeRgn(current_clip); +// SetPort(old_port); +//} void display_strings_event_filter (short item_hit) { @@ -1104,16 +1122,16 @@ void display_strings_event_filter (short item_hit) switch (item_hit) { case 1: - dialog_not_toast = FALSE; + toast_dialog(); break; } } void display_strings(short str1a,short str1b,short str2a,short str2b, - char *title,short sound_num,short graphic_num,short parent_num) + char *title,short sound_num,short graphic_num,short graphic_type,short parent_num) { short item_hit; - Str255 sign_text; + Str255 text; location view_loc; Boolean sound_done = FALSE; @@ -1135,56 +1153,28 @@ void display_strings(short str1a,short str1b,short str2a,short str2b, cd_activate_item(store_which_string_dlog,2,0); - csp(store_which_string_dlog,store_which_string_dlog,graphic_num); + csp(store_which_string_dlog,store_which_string_dlog,graphic_num,graphic_type); - get_str(sign_text,str1a,str1b); - csit(store_which_string_dlog,4,(char *) sign_text); + get_str(text,str1a,str1b); + csit(store_which_string_dlog,4,(char *) text); if ((str2a > 0) && (str2b > 0)) { - get_str(sign_text,str2a,str2b); - csit(store_which_string_dlog,5,(char *) sign_text); + get_str(text,str2a,str2b); + csit(store_which_string_dlog,5,(char *) text); } if (strlen(title) > 0) csit(store_which_string_dlog,6,title); - csp(store_which_string_dlog,3,graphic_num); + csp(store_which_string_dlog,3,graphic_num,graphic_type); if (sound_num >= 0) play_sound(sound_num); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif - cd_kill_dialog(store_which_string_dlog,0); -} - -void c2p(Str255 str) -{ - Str255 str2; - short len; - len = strlen((char *) str); - strcpy((char *) str2,(char *) str); - str[0] = (unsigned char) len; - strncpy((char *) (str + 1), (char *) str2,len); -} - -void p2c(Str255 str) -{ - Str255 str2; - short len; - - len = (short) str[0]; - strncpy((char *) str2,(char *) (str + 1), len); - str2[len] = 0; - strcpy((char *) str,(char *) str2); + item_hit = cd_run_dialog(); + cd_kill_dialog(store_which_string_dlog,0); } void get_str(Str255 str,short i, short j) { GetIndString(str, i, j); - p2c(str); + p2cstr(str); } void make_cursor_sword() diff --git a/osx/Blades of Exile Char Editor/ed.graphics.h b/osx/Blades of Exile Char Editor/ed.graphics.h index 169fb8e2..e8a5f05d 100644 --- a/osx/Blades of Exile Char Editor/ed.graphics.h +++ b/osx/Blades of Exile Char Editor/ed.graphics.h @@ -8,15 +8,10 @@ void draw_items(short clear_first); void display_party(short mode,short clear_first); void undo_clip(); void add_string_to_buf(char *str) ; -void rect_draw_some_item (GWorldPtr src_gworld, Rect src_rect, GWorldPtr targ_gworld,Rect targ_rect, -char masked,short main_win); -void char_win_draw_string(GrafPtr dest_window,Rect dest_rect,char *str,short mode,short line_height); -void win_draw_string(GrafPtr dest_window,Rect dest_rect,Str255 str,short mode,short line_height); void display_strings_event_filter (short item_hit); void display_strings(short str1a,short str1b,short str2a,short str2b, - char *title,short sound_num,short graphic_num,short parent_num); -void c2p(Str255 str) ; -void p2c(Str255 str); + char *title,short sound_num,short graphic_num,short graphic_type,short parent_num); void get_str(Str255 str,short i, short j); short string_length(char *str); void make_cursor_sword(); +void init_dialogs(); \ No newline at end of file diff --git a/osx/BoE.xcodeproj/project.pbxproj b/osx/BoE.xcodeproj/project.pbxproj index 9b716be1..14a09fd8 100644 --- a/osx/BoE.xcodeproj/project.pbxproj +++ b/osx/BoE.xcodeproj/project.pbxproj @@ -3,22 +3,34 @@ archiveVersion = 1; classes = { }; - objectVersion = 42; + objectVersion = 44; objects = { +/* Begin PBXAggregateTarget section */ + 91EBE9DA0F9A33A1002356F2 /* All */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 91EBE9F70F9A33D1002356F2 /* Build configuration list for PBXAggregateTarget "All" */; + buildPhases = ( + ); + dependencies = ( + 91EBE9DE0F9A33A6002356F2 /* PBXTargetDependency */, + 91EBE9E00F9A33A8002356F2 /* PBXTargetDependency */, + 91EBE9E20F9A33AC002356F2 /* PBXTargetDependency */, + ); + name = All; + productName = All; + }; +/* End PBXAggregateTarget section */ + /* Begin PBXBuildFile section */ 2BF04B0B0BF51924006C0831 /* bldsexil.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04ACB0BF51923006C0831 /* bldsexil.c */; }; 2BF04B0C0BF51924006C0831 /* blx.g.utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04ACD0BF51923006C0831 /* blx.g.utils.c */; }; 2BF04B0D0BF51924006C0831 /* blxactions.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04ACF0BF51923006C0831 /* blxactions.c */; }; 2BF04B0E0BF51924006C0831 /* blxfileio.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AD10BF51923006C0831 /* blxfileio.c */; }; - 2BF04B0F0BF51924006C0831 /* blxgraphics.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AD30BF51923006C0831 /* blxgraphics.c */; }; 2BF04B100BF51924006C0831 /* blxtown_spec.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AD50BF51923006C0831 /* blxtown_spec.c */; }; 2BF04B1C0BF51924006C0831 /* combat.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AE60BF51924006C0831 /* combat.c */; }; 2BF04B1D0BF51924006C0831 /* dialogutils.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AE80BF51924006C0831 /* dialogutils.c */; }; - 2BF04B1E0BF51924006C0831 /* dlogtool.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AEA0BF51924006C0831 /* dlogtool.c */; }; - 2BF04B1F0BF51924006C0831 /* Exile.sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AEC0BF51924006C0831 /* Exile.sound.c */; }; 2BF04B200BF51924006C0831 /* fields.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AEE0BF51924006C0831 /* fields.c */; }; - 2BF04B220BF51924006C0831 /* global.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AF20BF51924006C0831 /* global.c */; }; 2BF04B230BF51924006C0831 /* info.dialogs.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AF40BF51924006C0831 /* info.dialogs.c */; }; 2BF04B240BF51924006C0831 /* item_data.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AF60BF51924006C0831 /* item_data.c */; }; 2BF04B250BF51924006C0831 /* items.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AF80BF51924006C0831 /* items.c */; }; @@ -31,18 +43,132 @@ 2BF04B2D0BF51924006C0831 /* text.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04B070BF51924006C0831 /* text.c */; }; 2BF04B2E0BF51924006C0831 /* town.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04B090BF51924006C0831 /* town.c */; }; 2BF04DE90BF7A6FE006C0831 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BF04DE80BF7A6FE006C0831 /* Carbon.framework */; }; + 91278C340F9A4AC8007B0D52 /* dlglowlevel.h in Headers */ = {isa = PBXBuildFile; fileRef = 91B3F09A0F97672700BF5B67 /* dlglowlevel.h */; }; + 91B3EF1E0F969C4B00BF5B67 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BF04DE80BF7A6FE006C0831 /* Carbon.framework */; }; + 91B3EF1F0F969C9C00BF5B67 /* BoECharEd.icns in Resources */ = {isa = PBXBuildFile; fileRef = 91B3EF110F969BD300BF5B67 /* BoECharEd.icns */; }; + 91B3EF200F969C9C00BF5B67 /* bladespced.rsrc in Resources */ = {isa = PBXBuildFile; fileRef = 91B3EF120F969BD300BF5B67 /* bladespced.rsrc */; }; + 91B3EF2E0F969D7200BF5B67 /* Blades of Exile Graphics in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91B3EF260F969CE300BF5B67 /* Blades of Exile Graphics */; }; + 91B3EF2F0F969D7200BF5B67 /* Blades of Exile Sounds in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91B3EF270F969CE300BF5B67 /* Blades of Exile Sounds */; }; + 91B3EF300F969D7B00BF5B67 /* Blades of Exile Graphics in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91B3EF260F969CE300BF5B67 /* Blades of Exile Graphics */; }; + 91B3EF310F969D7B00BF5B67 /* Blades of Exile Sounds in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91B3EF270F969CE300BF5B67 /* Blades of Exile Sounds */; }; + 91B3EF390F969E8600BF5B67 /* Blades of Exile Character Editor-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 91B3EF130F969BD300BF5B67 /* Blades of Exile Character Editor-Info.plist */; }; + 91B3EF450F969F1700BF5B67 /* BoE Scenario Editor-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 91B3EED90F969BA700BF5B67 /* BoE Scenario Editor-Info.plist */; }; + 91B3EF460F969F1700BF5B67 /* BOEScen.rsrc in Resources */ = {isa = PBXBuildFile; fileRef = 91B3EEDA0F969BA700BF5B67 /* BOEScen.rsrc */; }; + 91B3EF470F969F1700BF5B67 /* BoE Scenario Editor.icns in Resources */ = {isa = PBXBuildFile; fileRef = 91B3EEDB0F969BA700BF5B67 /* BoE Scenario Editor.icns */; }; + 91B3EF480F969F2300BF5B67 /* char.ed.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EF050F969BD300BF5B67 /* char.ed.c */; }; + 91B3EF490F969F2300BF5B67 /* ed.action.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EF060F969BD300BF5B67 /* ed.action.c */; }; + 91B3EF4A0F969F2300BF5B67 /* ed.editors.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EF070F969BD300BF5B67 /* ed.editors.c */; }; + 91B3EF4B0F969F2300BF5B67 /* ed.fileio.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EF080F969BD300BF5B67 /* ed.fileio.c */; }; + 91B3EF4D0F969F2300BF5B67 /* ed.graphics.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EF0A0F969BD300BF5B67 /* ed.graphics.c */; }; + 91B3EF500F969F3000BF5B67 /* Exiletedit.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EEEB0F969BA700BF5B67 /* Exiletedit.c */; }; + 91B3EF530F969F3000BF5B67 /* keydlgs.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EEEE0F969BA700BF5B67 /* keydlgs.c */; }; + 91B3EF540F969F3000BF5B67 /* scenario.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EEEF0F969BA700BF5B67 /* scenario.c */; }; + 91B3EF560F969F3000BF5B67 /* tactions.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EEF10F969BA700BF5B67 /* tactions.c */; }; + 91B3EF570F969F3000BF5B67 /* tfileio.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EEF20F969BA700BF5B67 /* tfileio.c */; }; + 91B3EF590F969F3000BF5B67 /* townout.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EEF40F969BA700BF5B67 /* townout.c */; }; + 91B3EF5A0F969F3000BF5B67 /* buttonmg.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EEF50F969BA700BF5B67 /* buttonmg.c */; }; + 91B3EF5B0F969F3000BF5B67 /* dialogutils.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EEF60F969BA700BF5B67 /* dialogutils.c */; }; + 91B3EF5D0F969F3500BF5B67 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BF04DE80BF7A6FE006C0831 /* Carbon.framework */; }; + 91B3F0800F975CBD00BF5B67 /* dlgtool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91B3F0620F96D25200BF5B67 /* dlgtool.cpp */; }; + 91B3F0810F975CC400BF5B67 /* dlgtool.h in Headers */ = {isa = PBXBuildFile; fileRef = 91B3F0610F96D25200BF5B67 /* dlgtool.h */; }; + 91B3F0820F975CC900BF5B67 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BF04DE80BF7A6FE006C0831 /* Carbon.framework */; }; + 91B3F0850F975D0E00BF5B67 /* dlgconsts.h in Headers */ = {isa = PBXBuildFile; fileRef = 91B3F0840F975D0E00BF5B67 /* dlgconsts.h */; }; + 91B3F09D0F97672700BF5B67 /* dlglowlevel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91B3F09B0F97672700BF5B67 /* dlglowlevel.cpp */; }; + 91B3F10B0F9779C300BF5B67 /* graphtool.h in Headers */ = {isa = PBXBuildFile; fileRef = 91B3F1090F9779C300BF5B67 /* graphtool.h */; }; + 91B3F10C0F9779C300BF5B67 /* graphtool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91B3F10A0F9779C300BF5B67 /* graphtool.cpp */; }; + 91B3F1100F9779D000BF5B67 /* soundtool.h in Headers */ = {isa = PBXBuildFile; fileRef = 91B3F10E0F9779D000BF5B67 /* soundtool.h */; }; + 91B3F1110F9779D000BF5B67 /* soundtool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91B3F10F0F9779D000BF5B67 /* soundtool.cpp */; }; + 91B3F1120F9779E100BF5B67 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BF04DE80BF7A6FE006C0831 /* Carbon.framework */; }; + 91B3F11F0F97801F00BF5B67 /* mathutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 91B3F11D0F97801F00BF5B67 /* mathutil.h */; }; + 91B3F1200F97801F00BF5B67 /* mathutil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91B3F11E0F97801F00BF5B67 /* mathutil.cpp */; }; + 91B3F1850F97894A00BF5B67 /* tGraphics.c in Sources */ = {isa = PBXBuildFile; fileRef = 91B3EEF30F969BA700BF5B67 /* tGraphics.c */; }; 91D62F340F8EB84800674AB3 /* bladesofexile.rsrc in Resources */ = {isa = PBXBuildFile; fileRef = 91D62F330F8EB84800674AB3 /* bladesofexile.rsrc */; }; 91D634560F8FD77800674AB3 /* BoE.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2B8F435C0C0973680012E4A8 /* BoE.icns */; }; - 91D634570F8FD78D00674AB3 /* Blades of Exile-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2BF04AC30BF518D4006C0831 /* Blades of Exile-Info.plist */; }; 91D635B60F90E7D200674AB3 /* stealth.exs in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91D635AA0F90E7B500674AB3 /* stealth.exs */; }; 91D635B70F90E7D200674AB3 /* stealth.meg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91D635AB0F90E7B500674AB3 /* stealth.meg */; }; 91D635B80F90E7D200674AB3 /* valleydy.exs in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91D635AC0F90E7B500674AB3 /* valleydy.exs */; }; 91D635B90F90E7D200674AB3 /* valleydy.meg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91D635AD0F90E7B500674AB3 /* valleydy.meg */; }; 91D635BA0F90E7D200674AB3 /* zakhazi.exs in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91D635AE0F90E7B500674AB3 /* zakhazi.exs */; }; 91D635BB0F90E7D200674AB3 /* zakhazi.meg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91D635AF0F90E7B500674AB3 /* zakhazi.meg */; }; + 91EBE6D90F9A15BD002356F2 /* blxgraphics.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AD30BF51923006C0831 /* blxgraphics.c */; }; + 91EBE8AB0F9A2BE1002356F2 /* loc_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 91EBE8AA0F9A2BE1002356F2 /* loc_utils.c */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 91278CAD0F9A525D007B0D52 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2BF04AA10BF51845006C0831 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 91B3F0790F975C7100BF5B67 /* DlogTool */; + remoteInfo = DlogTool; + }; + 91B3F0F60F97786F00BF5B67 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2BF04AA10BF51845006C0831 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 91B3F0790F975C7100BF5B67; + remoteInfo = DlogTool; + }; + 91B3F1070F9779A800BF5B67 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2BF04AA10BF51845006C0831 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 91B3F1030F97799300BF5B67; + remoteInfo = GrpSndTool; + }; + 91E830520F99261F00810708 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2BF04AA10BF51845006C0831 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 91B3F0790F975C7100BF5B67; + remoteInfo = DlogTool; + }; + 91EBE9DD0F9A33A6002356F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2BF04AA10BF51845006C0831 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2BF04AC00BF518D4006C0831; + remoteInfo = "Blades of Exile"; + }; + 91EBE9DF0F9A33A8002356F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2BF04AA10BF51845006C0831 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 91B3EF170F969C2200BF5B67; + remoteInfo = "Blades of Exile Character Editor"; + }; + 91EBE9E10F9A33AC002356F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2BF04AA10BF51845006C0831 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 91B3EF3E0F969F0000BF5B67; + remoteInfo = "BoE Scenario Editor"; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ + 91B3EF2C0F969D4700BF5B67 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "Scenario Editor"; + dstSubfolderSpec = 16; + files = ( + 91B3EF300F969D7B00BF5B67 /* Blades of Exile Graphics in CopyFiles */, + 91B3EF310F969D7B00BF5B67 /* Blades of Exile Sounds in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 91B3EF320F969D9900BF5B67 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "Scenario Editor"; + dstSubfolderSpec = 16; + files = ( + 91B3EF2E0F969D7200BF5B67 /* Blades of Exile Graphics in CopyFiles */, + 91B3EF2F0F969D7200BF5B67 /* Blades of Exile Sounds in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 91D635A30F90E77C00674AB3 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -80,15 +206,10 @@ 2BF04AE70BF51924006C0831 /* combat.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = combat.h; sourceTree = ""; }; 2BF04AE80BF51924006C0831 /* dialogutils.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = dialogutils.c; sourceTree = ""; }; 2BF04AE90BF51924006C0831 /* dialogutils.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dialogutils.h; sourceTree = ""; }; - 2BF04AEA0BF51924006C0831 /* dlogtool.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = dlogtool.c; sourceTree = ""; }; - 2BF04AEB0BF51924006C0831 /* dlogtool.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dlogtool.h; sourceTree = ""; }; - 2BF04AEC0BF51924006C0831 /* Exile.sound.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = Exile.sound.c; sourceTree = ""; }; - 2BF04AED0BF51924006C0831 /* Exile.sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Exile.sound.h; sourceTree = ""; }; 2BF04AEE0BF51924006C0831 /* fields.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = fields.c; sourceTree = ""; }; 2BF04AEF0BF51924006C0831 /* fields.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = fields.h; sourceTree = ""; }; 2BF04AF00BF51924006C0831 /* gamma.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gamma.c; sourceTree = ""; }; 2BF04AF10BF51924006C0831 /* gamma.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = gamma.h; sourceTree = ""; }; - 2BF04AF20BF51924006C0831 /* global.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = global.c; sourceTree = ""; }; 2BF04AF30BF51924006C0831 /* global.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = global.h; sourceTree = ""; }; 2BF04AF40BF51924006C0831 /* info.dialogs.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = info.dialogs.c; sourceTree = ""; }; 2BF04AF50BF51924006C0831 /* info.dialogs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = info.dialogs.h; sourceTree = ""; }; @@ -105,16 +226,74 @@ 2BF04B000BF51924006C0831 /* party.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = party.c; sourceTree = ""; }; 2BF04B010BF51924006C0831 /* party.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = party.h; sourceTree = ""; }; 2BF04B020BF51924006C0831 /* powerpc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = powerpc.c; sourceTree = ""; }; - 2BF04B030BF51924006C0831 /* specials.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = specials.c; sourceTree = ""; }; + 2BF04B030BF51924006C0831 /* specials.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = specials.c; sourceTree = ""; wrapsLines = 1; }; 2BF04B040BF51924006C0831 /* specials.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = specials.h; sourceTree = ""; }; 2BF04B050BF51924006C0831 /* startup.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = startup.c; sourceTree = ""; }; 2BF04B060BF51924006C0831 /* startup.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = startup.h; sourceTree = ""; }; 2BF04B070BF51924006C0831 /* text.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = text.c; sourceTree = ""; }; 2BF04B080BF51924006C0831 /* text.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = text.h; sourceTree = ""; }; - 2BF04B090BF51924006C0831 /* town.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = town.c; sourceTree = ""; }; + 2BF04B090BF51924006C0831 /* town.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = town.c; sourceTree = ""; wrapsLines = 1; }; 2BF04B0A0BF51924006C0831 /* town.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = town.h; sourceTree = ""; }; 2BF04DE80BF7A6FE006C0831 /* Carbon.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Carbon.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 91B3E8A50F938FFE00BF5B67 /* consts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = consts.h; sourceTree = ""; }; + 91B3EED90F969BA700BF5B67 /* BoE Scenario Editor-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "BoE Scenario Editor-Info.plist"; path = "Scenario Editor/BoE Scenario Editor-Info.plist"; sourceTree = ""; }; + 91B3EEDA0F969BA700BF5B67 /* BOEScen.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; name = BOEScen.rsrc; path = "Scenario Editor/BOEScen.rsrc"; sourceTree = ""; }; + 91B3EEDB0F969BA700BF5B67 /* BoE Scenario Editor.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = "BoE Scenario Editor.icns"; path = "Scenario Editor/BoE Scenario Editor.icns"; sourceTree = ""; }; + 91B3EEDD0F969BA700BF5B67 /* fileio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fileio.h; path = "Scenario Editor/fileio.h"; sourceTree = ""; }; + 91B3EEDE0F969BA700BF5B67 /* global.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = global.h; path = "Scenario Editor/global.h"; sourceTree = ""; }; + 91B3EEDF0F969BA700BF5B67 /* itemlist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = itemlist.h; path = "Scenario Editor/itemlist.h"; sourceTree = ""; }; + 91B3EEE00F969BA700BF5B67 /* keydlgs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = keydlgs.h; path = "Scenario Editor/keydlgs.h"; sourceTree = ""; }; + 91B3EEE10F969BA700BF5B67 /* scenario.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scenario.h; path = "Scenario Editor/scenario.h"; sourceTree = ""; }; + 91B3EEE30F969BA700BF5B67 /* tactions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tactions.h; path = "Scenario Editor/tactions.h"; sourceTree = ""; }; + 91B3EEE40F969BA700BF5B67 /* tfileio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tfileio.h; path = "Scenario Editor/tfileio.h"; sourceTree = ""; }; + 91B3EEE50F969BA700BF5B67 /* tGraphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tGraphics.h; path = "Scenario Editor/tGraphics.h"; sourceTree = ""; }; + 91B3EEE60F969BA700BF5B67 /* townout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = townout.h; path = "Scenario Editor/townout.h"; sourceTree = ""; }; + 91B3EEE70F969BA700BF5B67 /* buttonmg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = buttonmg.h; path = "Scenario Editor/buttonmg.h"; sourceTree = ""; }; + 91B3EEE80F969BA700BF5B67 /* dialogutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dialogutils.h; path = "Scenario Editor/dialogutils.h"; sourceTree = ""; }; + 91B3EEEB0F969BA700BF5B67 /* Exiletedit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Exiletedit.c; path = "Scenario Editor/Exiletedit.c"; sourceTree = ""; }; + 91B3EEEC0F969BA700BF5B67 /* fileio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fileio.c; path = "Scenario Editor/fileio.c"; sourceTree = ""; }; + 91B3EEEE0F969BA700BF5B67 /* keydlgs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = keydlgs.c; path = "Scenario Editor/keydlgs.c"; sourceTree = ""; }; + 91B3EEEF0F969BA700BF5B67 /* scenario.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = scenario.c; path = "Scenario Editor/scenario.c"; sourceTree = ""; }; + 91B3EEF10F969BA700BF5B67 /* tactions.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tactions.c; path = "Scenario Editor/tactions.c"; sourceTree = ""; }; + 91B3EEF20F969BA700BF5B67 /* tfileio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tfileio.c; path = "Scenario Editor/tfileio.c"; sourceTree = ""; }; + 91B3EEF30F969BA700BF5B67 /* tGraphics.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tGraphics.c; path = "Scenario Editor/tGraphics.c"; sourceTree = ""; }; + 91B3EEF40F969BA700BF5B67 /* townout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = townout.c; path = "Scenario Editor/townout.c"; sourceTree = ""; }; + 91B3EEF50F969BA700BF5B67 /* buttonmg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = buttonmg.c; path = "Scenario Editor/buttonmg.c"; sourceTree = ""; }; + 91B3EEF60F969BA700BF5B67 /* dialogutils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dialogutils.c; path = "Scenario Editor/dialogutils.c"; sourceTree = ""; }; + 91B3EEF80F969BA700BF5B67 /* viewdlog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = viewdlog.cpp; path = misc/viewdlog.cpp; sourceTree = ""; }; + 91B3EEFC0F969BD300BF5B67 /* ed.action.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ed.action.h; path = "Blades of Exile Char Editor/ed.action.h"; sourceTree = ""; }; + 91B3EEFD0F969BD300BF5B67 /* ed.editors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ed.editors.h; path = "Blades of Exile Char Editor/ed.editors.h"; sourceTree = ""; }; + 91B3EEFE0F969BD300BF5B67 /* ed.fileio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ed.fileio.h; path = "Blades of Exile Char Editor/ed.fileio.h"; sourceTree = ""; }; + 91B3EEFF0F969BD300BF5B67 /* ed.global.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ed.global.h; path = "Blades of Exile Char Editor/ed.global.h"; sourceTree = ""; }; + 91B3EF000F969BD300BF5B67 /* ed.graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ed.graphics.h; path = "Blades of Exile Char Editor/ed.graphics.h"; sourceTree = ""; }; + 91B3EF030F969BD300BF5B67 /* item_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = item_data.h; path = "Blades of Exile Char Editor/item_data.h"; sourceTree = ""; }; + 91B3EF050F969BD300BF5B67 /* char.ed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = char.ed.c; path = "Blades of Exile Char Editor/char.ed.c"; sourceTree = ""; }; + 91B3EF060F969BD300BF5B67 /* ed.action.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ed.action.c; path = "Blades of Exile Char Editor/ed.action.c"; sourceTree = ""; }; + 91B3EF070F969BD300BF5B67 /* ed.editors.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ed.editors.c; path = "Blades of Exile Char Editor/ed.editors.c"; sourceTree = ""; }; + 91B3EF080F969BD300BF5B67 /* ed.fileio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ed.fileio.c; path = "Blades of Exile Char Editor/ed.fileio.c"; sourceTree = ""; }; + 91B3EF0A0F969BD300BF5B67 /* ed.graphics.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ed.graphics.c; path = "Blades of Exile Char Editor/ed.graphics.c"; sourceTree = ""; }; + 91B3EF110F969BD300BF5B67 /* BoECharEd.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = BoECharEd.icns; path = "Blades of Exile Char Editor/BoECharEd.icns"; sourceTree = ""; }; + 91B3EF120F969BD300BF5B67 /* bladespced.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; name = bladespced.rsrc; path = "Blades of Exile Char Editor/bladespced.rsrc"; sourceTree = ""; }; + 91B3EF130F969BD300BF5B67 /* Blades of Exile Character Editor-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Blades of Exile Character Editor-Info.plist"; path = "Blades of Exile Char Editor/Blades of Exile Character Editor-Info.plist"; sourceTree = ""; }; + 91B3EF180F969C2200BF5B67 /* Blades of Exile Character Editor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Blades of Exile Character Editor.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 91B3EF250F969CE300BF5B67 /* Blades of Exile Base */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Blades of Exile Base"; path = "Scenario Editor/Blades of Exile Base"; sourceTree = ""; }; + 91B3EF260F969CE300BF5B67 /* Blades of Exile Graphics */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Blades of Exile Graphics"; path = "Scenario Editor/Blades of Exile Graphics"; sourceTree = ""; }; + 91B3EF270F969CE300BF5B67 /* Blades of Exile Sounds */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Blades of Exile Sounds"; path = "Scenario Editor/Blades of Exile Sounds"; sourceTree = ""; }; + 91B3EF3F0F969F0000BF5B67 /* BoE Scenario Editor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "BoE Scenario Editor.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 91B3F0610F96D25200BF5B67 /* dlgtool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dlgtool.h; path = misc/dlgtool.h; sourceTree = ""; }; + 91B3F0620F96D25200BF5B67 /* dlgtool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dlgtool.cpp; path = misc/dlgtool.cpp; sourceTree = ""; }; + 91B3F0670F96D29600BF5B67 /* ViewDlog-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "ViewDlog-Info.plist"; path = "misc/ViewDlog-Info.plist"; sourceTree = ""; }; + 91B3F07A0F975C7100BF5B67 /* libDlogTool.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libDlogTool.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 91B3F0840F975D0E00BF5B67 /* dlgconsts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dlgconsts.h; path = misc/dlgconsts.h; sourceTree = ""; }; + 91B3F09A0F97672700BF5B67 /* dlglowlevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dlglowlevel.h; path = misc/dlglowlevel.h; sourceTree = ""; }; + 91B3F09B0F97672700BF5B67 /* dlglowlevel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dlglowlevel.cpp; path = misc/dlglowlevel.cpp; sourceTree = ""; wrapsLines = 0; }; + 91B3F1040F97799300BF5B67 /* libGrpSndTool.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libGrpSndTool.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 91B3F1090F9779C300BF5B67 /* graphtool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = graphtool.h; path = misc/graphtool.h; sourceTree = ""; }; + 91B3F10A0F9779C300BF5B67 /* graphtool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = graphtool.cpp; path = misc/graphtool.cpp; sourceTree = ""; }; + 91B3F10E0F9779D000BF5B67 /* soundtool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = soundtool.h; path = misc/soundtool.h; sourceTree = ""; }; + 91B3F10F0F9779D000BF5B67 /* soundtool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = soundtool.cpp; path = misc/soundtool.cpp; sourceTree = ""; }; + 91B3F11D0F97801F00BF5B67 /* mathutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mathutil.h; path = misc/mathutil.h; sourceTree = ""; }; + 91B3F11E0F97801F00BF5B67 /* mathutil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mathutil.cpp; path = misc/mathutil.cpp; sourceTree = ""; }; 91D62F330F8EB84800674AB3 /* bladesofexile.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; path = bladesofexile.rsrc; sourceTree = ""; }; 91D635AA0F90E7B500674AB3 /* stealth.exs */ = {isa = PBXFileReference; lastKnownFileType = file; path = stealth.exs; sourceTree = ""; }; 91D635AB0F90E7B500674AB3 /* stealth.meg */ = {isa = PBXFileReference; lastKnownFileType = file; path = stealth.meg; sourceTree = ""; }; @@ -122,6 +301,8 @@ 91D635AD0F90E7B500674AB3 /* valleydy.meg */ = {isa = PBXFileReference; lastKnownFileType = file; path = valleydy.meg; sourceTree = ""; }; 91D635AE0F90E7B500674AB3 /* zakhazi.exs */ = {isa = PBXFileReference; lastKnownFileType = file; path = zakhazi.exs; sourceTree = ""; }; 91D635AF0F90E7B500674AB3 /* zakhazi.meg */ = {isa = PBXFileReference; lastKnownFileType = file; path = zakhazi.meg; sourceTree = ""; }; + 91EBE8AA0F9A2BE1002356F2 /* loc_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loc_utils.c; path = "Scenario Editor/loc_utils.c"; sourceTree = ""; }; + 91EBE8AC0F9A2BF2002356F2 /* loc_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = loc_utils.h; path = "Scenario Editor/loc_utils.h"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -133,15 +314,51 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 91B3EF160F969C2200BF5B67 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 91B3EF1E0F969C4B00BF5B67 /* Carbon.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 91B3EF3D0F969F0000BF5B67 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 91B3EF5D0F969F3500BF5B67 /* Carbon.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 91B3F0780F975C7100BF5B67 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 91B3F0820F975CC900BF5B67 /* Carbon.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 91B3F1020F97799300BF5B67 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 91B3F1120F9779E100BF5B67 /* Carbon.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 2BF04A9F0BF51845006C0831 = { isa = PBXGroup; children = ( - 91D62F2E0F8EB80200674AB3 /* rsrc */, - 91D62F2D0F8EB7BA00674AB3 /* headers */, - 91D62F2C0F8EB7AB00674AB3 /* src */, + 91B3F0FF0F97797200BF5B67 /* GrpSndTool */, + 91B3EF5F0F969F4900BF5B67 /* DlgTool */, + 91B3EF5E0F969F3D00BF5B67 /* ViewDlog */, + 91B3EF380F969E4A00BF5B67 /* Game */, + 91B3EEF90F969BBD00BF5B67 /* CharEd */, + 91B3EECD0F969B7000BF5B67 /* ScenEd */, + 91B3EF220F969CA300BF5B67 /* Files */, 2BF04DE80BF7A6FE006C0831 /* Carbon.framework */, 2BF04AB30BF5187A006C0831 /* Products */, ); @@ -151,10 +368,170 @@ isa = PBXGroup; children = ( 2BF04AC10BF518D4006C0831 /* Blades of Exile.app */, + 91B3EF180F969C2200BF5B67 /* Blades of Exile Character Editor.app */, + 91B3EF3F0F969F0000BF5B67 /* BoE Scenario Editor.app */, + 91B3F07A0F975C7100BF5B67 /* libDlogTool.a */, + 91B3F1040F97799300BF5B67 /* libGrpSndTool.a */, ); name = Products; sourceTree = ""; }; + 91B3EECD0F969B7000BF5B67 /* ScenEd */ = { + isa = PBXGroup; + children = ( + 91B3EEEA0F969BA700BF5B67 /* src */, + 91B3EEDC0F969BA700BF5B67 /* headers */, + 91B3EED50F969BA700BF5B67 /* rsrc */, + ); + name = ScenEd; + sourceTree = ""; + }; + 91B3EED50F969BA700BF5B67 /* rsrc */ = { + isa = PBXGroup; + children = ( + 91B3EED90F969BA700BF5B67 /* BoE Scenario Editor-Info.plist */, + 91B3EEDA0F969BA700BF5B67 /* BOEScen.rsrc */, + 91B3EEDB0F969BA700BF5B67 /* BoE Scenario Editor.icns */, + ); + name = rsrc; + sourceTree = ""; + }; + 91B3EEDC0F969BA700BF5B67 /* headers */ = { + isa = PBXGroup; + children = ( + 91EBE8AC0F9A2BF2002356F2 /* loc_utils.h */, + 91B3EEDD0F969BA700BF5B67 /* fileio.h */, + 91B3EEDE0F969BA700BF5B67 /* global.h */, + 91B3EEDF0F969BA700BF5B67 /* itemlist.h */, + 91B3EEE00F969BA700BF5B67 /* keydlgs.h */, + 91B3EEE10F969BA700BF5B67 /* scenario.h */, + 91B3EEE30F969BA700BF5B67 /* tactions.h */, + 91B3EEE40F969BA700BF5B67 /* tfileio.h */, + 91B3EEE50F969BA700BF5B67 /* tGraphics.h */, + 91B3EEE60F969BA700BF5B67 /* townout.h */, + 91B3EEE70F969BA700BF5B67 /* buttonmg.h */, + 91B3EEE80F969BA700BF5B67 /* dialogutils.h */, + ); + name = headers; + sourceTree = ""; + }; + 91B3EEEA0F969BA700BF5B67 /* src */ = { + isa = PBXGroup; + children = ( + 91EBE8AA0F9A2BE1002356F2 /* loc_utils.c */, + 91B3EEEB0F969BA700BF5B67 /* Exiletedit.c */, + 91B3EEEC0F969BA700BF5B67 /* fileio.c */, + 91B3EEEE0F969BA700BF5B67 /* keydlgs.c */, + 91B3EEEF0F969BA700BF5B67 /* scenario.c */, + 91B3EEF10F969BA700BF5B67 /* tactions.c */, + 91B3EEF20F969BA700BF5B67 /* tfileio.c */, + 91B3EEF30F969BA700BF5B67 /* tGraphics.c */, + 91B3EEF40F969BA700BF5B67 /* townout.c */, + 91B3EEF50F969BA700BF5B67 /* buttonmg.c */, + 91B3EEF60F969BA700BF5B67 /* dialogutils.c */, + ); + name = src; + sourceTree = ""; + }; + 91B3EEF90F969BBD00BF5B67 /* CharEd */ = { + isa = PBXGroup; + children = ( + 91B3EF0D0F969BD300BF5B67 /* rsrc */, + 91B3EF040F969BD300BF5B67 /* src */, + 91B3EEFB0F969BD300BF5B67 /* headers */, + ); + name = CharEd; + sourceTree = ""; + }; + 91B3EEFB0F969BD300BF5B67 /* headers */ = { + isa = PBXGroup; + children = ( + 91B3EEFC0F969BD300BF5B67 /* ed.action.h */, + 91B3EEFD0F969BD300BF5B67 /* ed.editors.h */, + 91B3EEFE0F969BD300BF5B67 /* ed.fileio.h */, + 91B3EEFF0F969BD300BF5B67 /* ed.global.h */, + 91B3EF000F969BD300BF5B67 /* ed.graphics.h */, + 91B3EF030F969BD300BF5B67 /* item_data.h */, + ); + name = headers; + sourceTree = ""; + }; + 91B3EF040F969BD300BF5B67 /* src */ = { + isa = PBXGroup; + children = ( + 91B3EF050F969BD300BF5B67 /* char.ed.c */, + 91B3EF060F969BD300BF5B67 /* ed.action.c */, + 91B3EF070F969BD300BF5B67 /* ed.editors.c */, + 91B3EF080F969BD300BF5B67 /* ed.fileio.c */, + 91B3EF0A0F969BD300BF5B67 /* ed.graphics.c */, + ); + name = src; + sourceTree = ""; + }; + 91B3EF0D0F969BD300BF5B67 /* rsrc */ = { + isa = PBXGroup; + children = ( + 91B3EF110F969BD300BF5B67 /* BoECharEd.icns */, + 91B3EF120F969BD300BF5B67 /* bladespced.rsrc */, + 91B3EF130F969BD300BF5B67 /* Blades of Exile Character Editor-Info.plist */, + ); + name = rsrc; + sourceTree = ""; + }; + 91B3EF220F969CA300BF5B67 /* Files */ = { + isa = PBXGroup; + children = ( + 91B3EF250F969CE300BF5B67 /* Blades of Exile Base */, + 91B3EF260F969CE300BF5B67 /* Blades of Exile Graphics */, + 91B3EF270F969CE300BF5B67 /* Blades of Exile Sounds */, + ); + name = Files; + sourceTree = ""; + }; + 91B3EF380F969E4A00BF5B67 /* Game */ = { + isa = PBXGroup; + children = ( + 91D62F2C0F8EB7AB00674AB3 /* src */, + 91D62F2D0F8EB7BA00674AB3 /* headers */, + 91D62F2E0F8EB80200674AB3 /* rsrc */, + ); + name = Game; + sourceTree = ""; + }; + 91B3EF5E0F969F3D00BF5B67 /* ViewDlog */ = { + isa = PBXGroup; + children = ( + 91B3EEF80F969BA700BF5B67 /* viewdlog.cpp */, + 91B3F0670F96D29600BF5B67 /* ViewDlog-Info.plist */, + ); + name = ViewDlog; + sourceTree = ""; + }; + 91B3EF5F0F969F4900BF5B67 /* DlgTool */ = { + isa = PBXGroup; + children = ( + 91B3F0610F96D25200BF5B67 /* dlgtool.h */, + 91B3F0620F96D25200BF5B67 /* dlgtool.cpp */, + 91B3F0840F975D0E00BF5B67 /* dlgconsts.h */, + 91B3F09A0F97672700BF5B67 /* dlglowlevel.h */, + 91B3F09B0F97672700BF5B67 /* dlglowlevel.cpp */, + ); + name = DlgTool; + sourceTree = ""; + }; + 91B3F0FF0F97797200BF5B67 /* GrpSndTool */ = { + isa = PBXGroup; + children = ( + 91B3F1090F9779C300BF5B67 /* graphtool.h */, + 91B3F10A0F9779C300BF5B67 /* graphtool.cpp */, + 91B3F10E0F9779D000BF5B67 /* soundtool.h */, + 91B3F10F0F9779D000BF5B67 /* soundtool.cpp */, + 91B3F11D0F97801F00BF5B67 /* mathutil.h */, + 91B3F11E0F97801F00BF5B67 /* mathutil.cpp */, + ); + name = GrpSndTool; + sourceTree = ""; + }; 91D62F2C0F8EB7AB00674AB3 /* src */ = { isa = PBXGroup; children = ( @@ -166,11 +543,8 @@ 2BF04AD50BF51923006C0831 /* blxtown_spec.c */, 2BF04AE60BF51924006C0831 /* combat.c */, 2BF04AE80BF51924006C0831 /* dialogutils.c */, - 2BF04AEA0BF51924006C0831 /* dlogtool.c */, - 2BF04AEC0BF51924006C0831 /* Exile.sound.c */, 2BF04AEE0BF51924006C0831 /* fields.c */, 2BF04AF00BF51924006C0831 /* gamma.c */, - 2BF04AF20BF51924006C0831 /* global.c */, 2BF04AF40BF51924006C0831 /* info.dialogs.c */, 2BF04AF60BF51924006C0831 /* item_data.c */, 2BF04AF80BF51924006C0831 /* items.c */, @@ -197,8 +571,6 @@ 2BF04AD60BF51923006C0831 /* blxtown_spec.h */, 2BF04AE70BF51924006C0831 /* combat.h */, 2BF04AE90BF51924006C0831 /* dialogutils.h */, - 2BF04AEB0BF51924006C0831 /* dlogtool.h */, - 2BF04AED0BF51924006C0831 /* Exile.sound.h */, 2BF04AEF0BF51924006C0831 /* fields.h */, 2BF04AF10BF51924006C0831 /* gamma.h */, 2BF04AF30BF51924006C0831 /* global.h */, @@ -245,6 +617,29 @@ }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + 91B3F0760F975C7100BF5B67 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 91B3F0810F975CC400BF5B67 /* dlgtool.h in Headers */, + 91B3F0850F975D0E00BF5B67 /* dlgconsts.h in Headers */, + 91278C340F9A4AC8007B0D52 /* dlglowlevel.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 91B3F1000F97799300BF5B67 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 91B3F10B0F9779C300BF5B67 /* graphtool.h in Headers */, + 91B3F1100F9779D000BF5B67 /* soundtool.h in Headers */, + 91B3F11F0F97801F00BF5B67 /* mathutil.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ 2BF04AC00BF518D4006C0831 /* Blades of Exile */ = { isa = PBXNativeTarget; @@ -252,23 +647,100 @@ buildPhases = ( 2BF04ABD0BF518D4006C0831 /* Resources */, 91D635A30F90E77C00674AB3 /* CopyFiles */, + 91B3EF2C0F969D4700BF5B67 /* CopyFiles */, 2BF04ABE0BF518D4006C0831 /* Sources */, 2BF04ABF0BF518D4006C0831 /* Frameworks */, ); buildRules = ( ); dependencies = ( + 91E830530F99261F00810708 /* PBXTargetDependency */, ); name = "Blades of Exile"; productName = "Blades of Exile"; productReference = 2BF04AC10BF518D4006C0831 /* Blades of Exile.app */; productType = "com.apple.product-type.application"; }; + 91B3EF170F969C2200BF5B67 /* Blades of Exile Character Editor */ = { + isa = PBXNativeTarget; + buildConfigurationList = 91B3EF1D0F969C2400BF5B67 /* Build configuration list for PBXNativeTarget "Blades of Exile Character Editor" */; + buildPhases = ( + 91B3EF140F969C2200BF5B67 /* Resources */, + 91B3EF320F969D9900BF5B67 /* CopyFiles */, + 91B3EF150F969C2200BF5B67 /* Sources */, + 91B3EF160F969C2200BF5B67 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 91278CAE0F9A525D007B0D52 /* PBXTargetDependency */, + ); + name = "Blades of Exile Character Editor"; + productName = "Blades of Exile Character Editor"; + productReference = 91B3EF180F969C2200BF5B67 /* Blades of Exile Character Editor.app */; + productType = "com.apple.product-type.application"; + }; + 91B3EF3E0F969F0000BF5B67 /* BoE Scenario Editor */ = { + isa = PBXNativeTarget; + buildConfigurationList = 91B3EF440F969F0100BF5B67 /* Build configuration list for PBXNativeTarget "BoE Scenario Editor" */; + buildPhases = ( + 91B3EF3B0F969F0000BF5B67 /* Resources */, + 91B3EF3C0F969F0000BF5B67 /* Sources */, + 91B3EF3D0F969F0000BF5B67 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 91B3F0F70F97786F00BF5B67 /* PBXTargetDependency */, + ); + name = "BoE Scenario Editor"; + productName = "BoE Scenario Editor"; + productReference = 91B3EF3F0F969F0000BF5B67 /* BoE Scenario Editor.app */; + productType = "com.apple.product-type.application"; + }; + 91B3F0790F975C7100BF5B67 /* DlogTool */ = { + isa = PBXNativeTarget; + buildConfigurationList = 91B3F07E0F975CA500BF5B67 /* Build configuration list for PBXNativeTarget "DlogTool" */; + buildPhases = ( + 91B3F0760F975C7100BF5B67 /* Headers */, + 91B3F0770F975C7100BF5B67 /* Sources */, + 91B3F0780F975C7100BF5B67 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 91B3F1080F9779A800BF5B67 /* PBXTargetDependency */, + ); + name = DlogTool; + productName = DlogTool; + productReference = 91B3F07A0F975C7100BF5B67 /* libDlogTool.a */; + productType = "com.apple.product-type.library.static"; + }; + 91B3F1030F97799300BF5B67 /* GrpSndTool */ = { + isa = PBXNativeTarget; + buildConfigurationList = 91B3F10D0F9779C300BF5B67 /* Build configuration list for PBXNativeTarget "GrpSndTool" */; + buildPhases = ( + 91B3F1000F97799300BF5B67 /* Headers */, + 91B3F1010F97799300BF5B67 /* Sources */, + 91B3F1020F97799300BF5B67 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = GrpSndTool; + productName = GrpSndTool; + productReference = 91B3F1040F97799300BF5B67 /* libGrpSndTool.a */; + productType = "com.apple.product-type.library.static"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 2BF04AA10BF51845006C0831 /* Project object */ = { isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + }; buildConfigurationList = 2BF04AA20BF51845006C0831 /* Build configuration list for PBXProject "BoE" */; compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 0; @@ -277,7 +749,12 @@ projectDirPath = ""; projectRoot = ""; targets = ( + 91B3F1030F97799300BF5B67 /* GrpSndTool */, + 91B3F0790F975C7100BF5B67 /* DlogTool */, 2BF04AC00BF518D4006C0831 /* Blades of Exile */, + 91B3EF170F969C2200BF5B67 /* Blades of Exile Character Editor */, + 91B3EF3E0F969F0000BF5B67 /* BoE Scenario Editor */, + 91EBE9DA0F9A33A1002356F2 /* All */, ); }; /* End PBXProject section */ @@ -289,7 +766,26 @@ files = ( 91D62F340F8EB84800674AB3 /* bladesofexile.rsrc in Resources */, 91D634560F8FD77800674AB3 /* BoE.icns in Resources */, - 91D634570F8FD78D00674AB3 /* Blades of Exile-Info.plist in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 91B3EF140F969C2200BF5B67 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 91B3EF1F0F969C9C00BF5B67 /* BoECharEd.icns in Resources */, + 91B3EF200F969C9C00BF5B67 /* bladespced.rsrc in Resources */, + 91B3EF390F969E8600BF5B67 /* Blades of Exile Character Editor-Info.plist in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 91B3EF3B0F969F0000BF5B67 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 91B3EF450F969F1700BF5B67 /* BoE Scenario Editor-Info.plist in Resources */, + 91B3EF460F969F1700BF5B67 /* BOEScen.rsrc in Resources */, + 91B3EF470F969F1700BF5B67 /* BoE Scenario Editor.icns in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -304,14 +800,10 @@ 2BF04B0C0BF51924006C0831 /* blx.g.utils.c in Sources */, 2BF04B0D0BF51924006C0831 /* blxactions.c in Sources */, 2BF04B0E0BF51924006C0831 /* blxfileio.c in Sources */, - 2BF04B0F0BF51924006C0831 /* blxgraphics.c in Sources */, 2BF04B100BF51924006C0831 /* blxtown_spec.c in Sources */, 2BF04B1C0BF51924006C0831 /* combat.c in Sources */, 2BF04B1D0BF51924006C0831 /* dialogutils.c in Sources */, - 2BF04B1E0BF51924006C0831 /* dlogtool.c in Sources */, - 2BF04B1F0BF51924006C0831 /* Exile.sound.c in Sources */, 2BF04B200BF51924006C0831 /* fields.c in Sources */, - 2BF04B220BF51924006C0831 /* global.c in Sources */, 2BF04B230BF51924006C0831 /* info.dialogs.c in Sources */, 2BF04B240BF51924006C0831 /* item_data.c in Sources */, 2BF04B250BF51924006C0831 /* items.c in Sources */, @@ -323,11 +815,98 @@ 2BF04B2C0BF51924006C0831 /* startup.c in Sources */, 2BF04B2D0BF51924006C0831 /* text.c in Sources */, 2BF04B2E0BF51924006C0831 /* town.c in Sources */, + 91EBE6D90F9A15BD002356F2 /* blxgraphics.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 91B3EF150F969C2200BF5B67 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 91B3EF480F969F2300BF5B67 /* char.ed.c in Sources */, + 91B3EF490F969F2300BF5B67 /* ed.action.c in Sources */, + 91B3EF4A0F969F2300BF5B67 /* ed.editors.c in Sources */, + 91B3EF4B0F969F2300BF5B67 /* ed.fileio.c in Sources */, + 91B3EF4D0F969F2300BF5B67 /* ed.graphics.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 91B3EF3C0F969F0000BF5B67 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 91B3EF500F969F3000BF5B67 /* Exiletedit.c in Sources */, + 91B3EF530F969F3000BF5B67 /* keydlgs.c in Sources */, + 91B3EF540F969F3000BF5B67 /* scenario.c in Sources */, + 91B3EF560F969F3000BF5B67 /* tactions.c in Sources */, + 91B3EF570F969F3000BF5B67 /* tfileio.c in Sources */, + 91B3EF590F969F3000BF5B67 /* townout.c in Sources */, + 91B3EF5A0F969F3000BF5B67 /* buttonmg.c in Sources */, + 91B3EF5B0F969F3000BF5B67 /* dialogutils.c in Sources */, + 91B3F1850F97894A00BF5B67 /* tGraphics.c in Sources */, + 91EBE8AB0F9A2BE1002356F2 /* loc_utils.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 91B3F0770F975C7100BF5B67 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 91B3F0800F975CBD00BF5B67 /* dlgtool.cpp in Sources */, + 91B3F09D0F97672700BF5B67 /* dlglowlevel.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 91B3F1010F97799300BF5B67 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 91B3F10C0F9779C300BF5B67 /* graphtool.cpp in Sources */, + 91B3F1110F9779D000BF5B67 /* soundtool.cpp in Sources */, + 91B3F1200F97801F00BF5B67 /* mathutil.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 91278CAE0F9A525D007B0D52 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 91B3F0790F975C7100BF5B67 /* DlogTool */; + targetProxy = 91278CAD0F9A525D007B0D52 /* PBXContainerItemProxy */; + }; + 91B3F0F70F97786F00BF5B67 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 91B3F0790F975C7100BF5B67 /* DlogTool */; + targetProxy = 91B3F0F60F97786F00BF5B67 /* PBXContainerItemProxy */; + }; + 91B3F1080F9779A800BF5B67 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 91B3F1030F97799300BF5B67 /* GrpSndTool */; + targetProxy = 91B3F1070F9779A800BF5B67 /* PBXContainerItemProxy */; + }; + 91E830530F99261F00810708 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 91B3F0790F975C7100BF5B67 /* DlogTool */; + targetProxy = 91E830520F99261F00810708 /* PBXContainerItemProxy */; + }; + 91EBE9DE0F9A33A6002356F2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2BF04AC00BF518D4006C0831 /* Blades of Exile */; + targetProxy = 91EBE9DD0F9A33A6002356F2 /* PBXContainerItemProxy */; + }; + 91EBE9E00F9A33A8002356F2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 91B3EF170F969C2200BF5B67 /* Blades of Exile Character Editor */; + targetProxy = 91EBE9DF0F9A33A8002356F2 /* PBXContainerItemProxy */; + }; + 91EBE9E20F9A33AC002356F2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 91B3EF3E0F969F0000BF5B67 /* BoE Scenario Editor */; + targetProxy = 91EBE9E10F9A33AC002356F2 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin XCBuildConfiguration section */ 2BF04AA30BF51845006C0831 /* Debug */ = { isa = XCBuildConfiguration; @@ -351,7 +930,8 @@ LINK_WITH_STANDARD_LIBRARIES = YES; MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; MACOSX_DEPLOYMENT_TARGET_ppc = 10.3; - SDKROOT = "$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/"; + OTHER_LDFLAGS_QUOTED_FOR_PROJECT_1 = "\"$(PROJECT_DIR)/misc/\""; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk; SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk; STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static; @@ -369,8 +949,11 @@ COPY_PHASE_STRIP = YES; GCC_CHAR_IS_UNSIGNED_CHAR = YES; GCC_INPUT_FILETYPE = sourcecode.cpp.cpp; + GCC_ONE_BYTE_BOOL = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; @@ -381,10 +964,12 @@ LINK_WITH_STANDARD_LIBRARIES = YES; MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; MACOSX_DEPLOYMENT_TARGET_ppc = 10.3; - SDKROOT = "$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/"; + OTHER_LDFLAGS_QUOTED_FOR_PROJECT_1 = "\"$(PROJECT_DIR)/misc/\""; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk; SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk; STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static; + WARNING_CFLAGS = "float-equal"; }; name = Release; }; @@ -404,9 +989,12 @@ INSTALL_PATH = "$(HOME)/Applications"; OTHER_CFLAGS = "-fpack-struct=2"; OTHER_LDFLAGS = ( + misc/libDlogTool.a, + misc/libGrpSndTool.a, "-framework", Carbon, ); + OTHER_LDFLAGS_QUOTED_FOR_TARGET_1 = "\"$(PROJECT_DIR)/misc/\""; PREBINDING = NO; PRODUCT_NAME = "Blades of Exile"; WRAPPER_EXTENSION = app; @@ -428,12 +1016,290 @@ INSTALL_PATH = "$(HOME)/Applications"; OTHER_CFLAGS = "-fpack-struct=2"; OTHER_LDFLAGS = ( + misc/libDlogTool.a, + misc/libGrpSndTool.a, + "-framework", + Carbon, + ); + OTHER_LDFLAGS_QUOTED_FOR_TARGET_1 = "\"$(PROJECT_DIR)/misc/\""; + PREBINDING = NO; + PRODUCT_NAME = "Blades of Exile"; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + 91B3EF1B0F969C2300BF5B67 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; + INFOPLIST_FILE = "Blades of Exile Char Editor/Blades of Exile Character Editor-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + misc/libDlogTool.a, + misc/libGrpSndTool.a, + "-framework", + Carbon, + ); + OTHER_LDFLAGS_QUOTED_FOR_TARGET_1 = "\"$(PROJECT_DIR)/misc/\""; + PREBINDING = NO; + PRODUCT_NAME = "Blades of Exile Character Editor"; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + 91B3EF1C0F969C2300BF5B67 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; + INFOPLIST_FILE = "Blades of Exile Char Editor/Blades of Exile Character Editor-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + misc/libDlogTool.a, + misc/libGrpSndTool.a, + "-framework", + Carbon, + ); + OTHER_LDFLAGS_QUOTED_FOR_TARGET_1 = "\"$(PROJECT_DIR)/misc/\""; + PREBINDING = NO; + PRODUCT_NAME = "Blades of Exile Character Editor"; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + 91B3EF420F969F0100BF5B67 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)/Scenario Editor"; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; + INFOPLIST_FILE = "Scenario Editor/BoE Scenario Editor-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; + OTHER_CFLAGS = "-fpack-struct=2"; + OTHER_CPLUSPLUSFLAGS = "-fpack-struct=2"; + OTHER_LDFLAGS = ( + misc/libDlogTool.a, + misc/libGrpSndTool.a, "-framework", Carbon, ); PREBINDING = NO; - PRODUCT_NAME = "Blades of Exile"; + PRODUCT_NAME = "BoE Scenario Editor"; + SDKROOT = ""; + SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk; WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + 91B3EF430F969F0100BF5B67 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)/Scenario Editor"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; + INFOPLIST_FILE = "Scenario Editor/BoE Scenario Editor-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; + OTHER_CFLAGS = "-fpack-struct=2"; + OTHER_CPLUSPLUSFLAGS = "-fpack-struct=2"; + OTHER_LDFLAGS = ( + misc/libDlogTool.a, + misc/libGrpSndTool.a, + "-framework", + Carbon, + ); + PREBINDING = NO; + PRODUCT_NAME = "BoE Scenario Editor"; + SDKROOT = ""; + SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + 91B3F07B0F975C7300BF5B67 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + CONFIGURATION_BUILD_DIR = misc; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; + INSTALL_PATH = "$(PROJECT_DIR)/misc/"; + OTHER_LDFLAGS = ( + "-framework", + Carbon, + ); + PREBINDING = NO; + PRIVATE_HEADERS_FOLDER_PATH = "$(PROJECT_DIR)/misc/"; + PRODUCT_NAME = DlogTool; + PUBLIC_HEADERS_FOLDER_PATH = "$(PROJECT_DIR)/misc/"; + ZERO_LINK = YES; + }; + name = Debug; + }; + 91B3F07C0F975C7300BF5B67 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + CONFIGURATION_BUILD_DIR = misc; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; + INSTALL_PATH = "$(PROJECT_DIR)/misc/"; + OTHER_LDFLAGS = ( + "-framework", + Carbon, + ); + PREBINDING = NO; + PRIVATE_HEADERS_FOLDER_PATH = "$(PROJECT_DIR)/misc/"; + PRODUCT_NAME = DlogTool; + PUBLIC_HEADERS_FOLDER_PATH = "$(PROJECT_DIR)/misc/"; + ZERO_LINK = NO; + }; + name = Release; + }; + 91B3F1050F97799300BF5B67 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + CONFIGURATION_BUILD_DIR = misc; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; + INSTALL_PATH = "$(PROJECT_DIR)/misc/"; + OTHER_LDFLAGS = ( + "-framework", + Carbon, + ); + PREBINDING = NO; + PRIVATE_HEADERS_FOLDER_PATH = "$(PROJECT_DIR)/misc/"; + PRODUCT_NAME = GrpSndTool; + PUBLIC_HEADERS_FOLDER_PATH = "$(PROJECT_DIR)/misc/"; + ZERO_LINK = YES; + }; + name = Debug; + }; + 91B3F1060F97799300BF5B67 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + CONFIGURATION_BUILD_DIR = misc; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; + INSTALL_PATH = "$(PROJECT_DIR)/misc/"; + OTHER_LDFLAGS = ( + "-framework", + Carbon, + ); + PREBINDING = NO; + PRIVATE_HEADERS_FOLDER_PATH = "$(PROJECT_DIR)/misc/"; + PRODUCT_NAME = GrpSndTool; + PUBLIC_HEADERS_FOLDER_PATH = "$(PROJECT_DIR)/misc/"; + ZERO_LINK = NO; + }; + name = Release; + }; + 91EBE9DB0F9A33A1002356F2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + PRODUCT_NAME = All; + }; + name = Debug; + }; + 91EBE9DC0F9A33A1002356F2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + PRODUCT_NAME = All; ZERO_LINK = NO; }; name = Release; @@ -459,6 +1325,51 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 91B3EF1D0F969C2400BF5B67 /* Build configuration list for PBXNativeTarget "Blades of Exile Character Editor" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 91B3EF1B0F969C2300BF5B67 /* Debug */, + 91B3EF1C0F969C2300BF5B67 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 91B3EF440F969F0100BF5B67 /* Build configuration list for PBXNativeTarget "BoE Scenario Editor" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 91B3EF420F969F0100BF5B67 /* Debug */, + 91B3EF430F969F0100BF5B67 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 91B3F07E0F975CA500BF5B67 /* Build configuration list for PBXNativeTarget "DlogTool" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 91B3F07B0F975C7300BF5B67 /* Debug */, + 91B3F07C0F975C7300BF5B67 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 91B3F10D0F9779C300BF5B67 /* Build configuration list for PBXNativeTarget "GrpSndTool" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 91B3F1050F97799300BF5B67 /* Debug */, + 91B3F1060F97799300BF5B67 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 91EBE9F70F9A33D1002356F2 /* Build configuration list for PBXAggregateTarget "All" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 91EBE9DB0F9A33A1002356F2 /* Debug */, + 91EBE9DC0F9A33A1002356F2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 2BF04AA10BF51845006C0831 /* Project object */; diff --git a/osx/Exile.sound.c b/osx/Exile.sound.c deleted file mode 100644 index 373f6b8d..00000000 --- a/osx/Exile.sound.c +++ /dev/null @@ -1,304 +0,0 @@ -#include "math.h" - - -#include - -#include "global.h" -#include "Exile.sound.h" -#include "text.h" -#include "fields.h" - -#define NUM_SOUNDS 99 - -extern void FlushAndPause(unsigned long ticks); - -Handle sound_handles[NUM_SOUNDS]; - -extern Boolean play_sounds,in_startup_mode; -extern WindowPtr mainPtr; -extern Boolean gInBackground; -extern party_record_type party; -extern Boolean monsters_going; -extern short num_chirps_played,overall_mode; -extern scenario_data_type scenario; - -short last_played = 10000; -short error_beeps = 0; - -Boolean always_asynch[100] = {FALSE,FALSE,FALSE,FALSE,FALSE, - FALSE,TRUE,FALSE,FALSE,FALSE, - FALSE,FALSE,FALSE,FALSE,FALSE, // 10 - FALSE,FALSE,FALSE,FALSE,FALSE, - FALSE,FALSE,FALSE,FALSE,TRUE, // 20 - TRUE,FALSE,FALSE,FALSE,FALSE, - FALSE,FALSE,FALSE,FALSE,TRUE, // 30 - FALSE,FALSE,TRUE,FALSE,TRUE, - FALSE,TRUE,TRUE,TRUE,TRUE, // 40 - TRUE,TRUE,TRUE,TRUE,TRUE, - TRUE,FALSE,FALSE,FALSE,FALSE, // 50 - TRUE,FALSE,FALSE,FALSE,FALSE, - FALSE,TRUE,FALSE,FALSE,FALSE, // 60 - FALSE,FALSE,FALSE,FALSE,FALSE, - FALSE,FALSE,FALSE,FALSE,FALSE, // 70 - FALSE,TRUE,TRUE,TRUE,TRUE, - TRUE,TRUE,TRUE,TRUE,FALSE, // 80 - TRUE,FALSE,FALSE,FALSE,FALSE, - FALSE,TRUE,FALSE,FALSE,FALSE, // 90 - FALSE,FALSE,FALSE,FALSE,FALSE}; -Boolean load_when_play[100] = { -0,0,1,1,1,1,0,1,1,1, -0,0,0,1,0,1,1,1,1,1, -1,1,1,1,1,1,1,0,1,1, -1,1,1,1,0,1,1,0,1,1, -1,1,1,1,1,1,1,0,0,0, -0,1,1,1,1,0,1,1,1,1, -1,0,1,1,1,1,1,1,1,0, -0,0,0,0,0,0,1,1,1,1, -1,1,1,1,1,0,0,0,0,0, -1,1,1,1,1,1,1,1,1,0 -}; - - - -short sound_delay[100] = {0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,25,25,0,0,0,0, - 0,0,0,0,8,0,0,8,0,0, - 0,0,0,10,20,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,13,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0 - }; -//Allocate SndChannelPtr chan[4] as a global variable. -//Allocate char numchannel = 3; (This gives 4 channels, = 2 gives 3 etc... -//Allocate char channel; This is just used as a counter so each sound is played by the next -//channel in line. You can have up to 4 sounds playing at once. - -short snd_played[4] = {-1,-1,-1,-1}; -pascal void snd_channel_callback(SndChannelPtr theChannel,SndCommand theCommand); - - -SndChannelPtr chan[4]; -char numchannel = 3; -char channel = 0; - -Boolean sound_going(short which_s) { - short i; - - for (i = 0; i < 4; i++) - if (snd_played[i] == which_s) - return TRUE; - return FALSE; - } - -pascal void snd_channel_callback(SndChannelPtr theChannel,SndCommand* theCommand) { - long theA5; - short channel = -1,i,which_sound; - -#ifndef EXILE_BIG_GUNS - theA5 = SetA5(theCommand->param2); -#endif - - for (i = 0; i < 4; i++) - if (chan[i] == theChannel) - channel = i; - which_sound = snd_played[channel]; - snd_played[channel] = -1; - //if (in_startup_mode == FALSE) - // print_num(0,snd_played[channel],channel); - if ((sound_going(which_sound) == FALSE) && (load_when_play[which_sound] == TRUE)) { - HUnlock(sound_handles[which_sound]); - //if (in_startup_mode == FALSE) - // print_num(99,snd_played[channel],channel); - } - -#ifndef EXILE_BIG_GUNS - theA5 = SetA5(theA5); -#endif - } - -void load_sounds () -{ - short i,t; - SndCallBackUPP callback; - - for (i = 0; i < NUM_SOUNDS; i++) - if (load_when_play[i] == FALSE) { - sound_handles[i] = GetResource('snd ', 20000 + i); - } - - callback = NewSndCallBackUPP(snd_channel_callback); - - for(t=0;t<4;t++)/****** setup 4 sound channels **********/ - { - SndNewChannel(&chan[t], sampledSynth, initMono + initNoDrop, callback); - chan[t]->qLength = 128; - } - -} - -void play_sound(short which) // if < 0, play asynch -{ - if (PSD[304][9] > 0) - return; - if (in_startup_mode == TRUE) { - //if (FrontWindow() != mainPtr) { - // return; - // } - if (gInBackground) { - return; - } - } - if (play_sounds == TRUE) - force_play_sound(which); -} - -/* -sound(id) -int id; -{ - Boolean secondtry = FALSE; - - channel++; - - if (channel > numchannel) channel = 0; - - sndhandle = NIL; - sndhandle = GetResource('snd ',abs(id)); - - if (sndhandle != NIL) - { - HLock(sndhandle); - HNoPurge(sndhandle); - - if (id > 0) SndPlay(chan[channel],sndhandle,TRUE);/****** Normal SndPlay *****/ -/* else SndPlay(chan[channel],sndhandle,FALSE);/****** play ASYNC *****/ -/* } -} -*/ - -void force_play_sound(short which) -{ - Handle sndhandle; - OSErr err; - short which2; - SndCommand theCommand; - - if ((which > NUM_SOUNDS) || (-1 * which > NUM_SOUNDS)) { - //SysBeep(2); - return; - } -// if (play_sounds == TRUE) -// SndPlay(NIL, sound_handles[which], TRUE); - - if (play_sounds == TRUE) { - which2 = a_v(which); - - channel++; - - if (channel > numchannel) channel = 0; - - if (snd_played[channel] >= 0) - return; - - if ((sound_going(which2) == FALSE) && (load_when_play[((which < 0) ? -1 * which : which)] == TRUE)) { - sound_handles[((which < 0) ? -1 * which : which)] - = GetResource('snd ',20000 + ((which < 0) ? -1 * which : which)); - } - sndhandle = sound_handles[((which < 0) ? -1 * which : which)]; - - if (which > 0) - if (always_asynch[which] == TRUE) - which = which * -1; - - if (sndhandle != NIL) - { - HLock(sndhandle); - - if (which < 0) err = SndPlay(chan[channel],(SndListHandle) sndhandle,TRUE);/****** Normal SndPlay *****/ - else { - err = SndPlay(chan[channel],(SndListHandle) sndhandle,FALSE); - } - if (err != 0) { - if (error_beeps < 5) { - SysBeep(50); - error_beeps++; - } - add_string_to_buf("Sound Error. Error codes:"); - print_nums(channel,which,err); - add_string_to_buf("Your system could not play a sound."); - add_string_to_buf("Make sure editor isn't running."); - add_string_to_buf("Turn off sounds if necessary."); - HUnlock(sndhandle); - return; - } - //HUnlock(sndhandle); - - //if (which < 0) { - snd_played[channel] = which2; - theCommand.cmd = callBackCmd; - theCommand.param1 = 0; -#ifndef EXILE_BIG_GUNS - theCommand.param2 = SetCurrentA5(); -#endif -#ifdef EXILE_BIG_GUNS - theCommand.param2 = 0; -#endif - SndDoCommand(chan[channel],&theCommand,TRUE); - // } - - } - else SysBeep(2); - if (which < 0) - FlushAndPause(sound_delay[-1 * which]); - } -} - -void one_sound(short which) -{ - if (which == last_played) - return; - play_sound(which); - last_played = which; -} - -void clear_sound_memory() -{ - last_played = 100; -} - -void flip_sound() -{ - play_sounds = (play_sounds == TRUE) ? FALSE : TRUE; -} - -void move_sound(unsigned char ter,short step) -{ - short pic,spec; - - pic = scenario.ter_types[ter].picture; - spec = scenario.ter_types[ter].special; - - if ((monsters_going == FALSE) && (overall_mode < 10) && (party.in_boat >= 0)) { - if (spec == 21) - return; - play_sound(48); - } - else if ((monsters_going == FALSE) && (overall_mode < 10) && (party.in_horse >= 0)) {//// - play_sound(85); - } - else if ((ter >= 84) && (ter <= 89)) - play_sound(47); - else if ((pic == 80) || (pic == 76)) // already played in special terrain check - ; - else if (pic == 180) - play_sound(55); - else if (step % 2 == 0) - play_sound(49); - else play_sound(50); -} - -void incidental_noises() -{} \ No newline at end of file diff --git a/osx/Exile.sound.h b/osx/Exile.sound.h deleted file mode 100644 index 5a767ca7..00000000 --- a/osx/Exile.sound.h +++ /dev/null @@ -1,9 +0,0 @@ -void move_sound(unsigned char ter,short step); -void flip_sound(); -void clear_sound_memory(); -void one_sound(short which); -void force_play_sound(short which); -void play_sound(short which) ; -void load_sounds (); -Boolean sound_going(short which_s); -void incidental_noises(); diff --git a/osx/Scenario Editor/Blades of Exile Graphics b/osx/Scenario Editor/Blades of Exile Graphics index eabe7399..7602fa8d 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/Scenario Editor/Blades of Exile Sounds b/osx/Scenario Editor/Blades of Exile Sounds index 41bcfd24..865b8e21 100644 Binary files a/osx/Scenario Editor/Blades of Exile Sounds and b/osx/Scenario Editor/Blades of Exile Sounds differ diff --git a/osx/Scenario Editor/Exiletedit.c b/osx/Scenario Editor/Exiletedit.c index 420d7010..2b8de9e8 100644 --- a/osx/Scenario Editor/Exiletedit.c +++ b/osx/Scenario Editor/Exiletedit.c @@ -2,26 +2,28 @@ #include #include -#include "Global.h" +#include "global.h" +#include "graphtool.h" #include "tGraphics.h" #include "tactions.h" #include "tfileio.h" -#include "dlogtool.h" +#include "dlgtool.h" #include "buttonmg.h" -#include "sound.h" +#include "soundtool.h" #include "townout.h" #include "scenario.h" #include "keydlgs.h" +#include "mathutil.h" /* Globals */ Rect windRect, Drag_Rect; -Boolean All_Done = FALSE,dialog_not_toast = FALSE,play_sounds = TRUE; +Boolean All_Done = FALSE; // delete play_sounds EventRecord event; WindowPtr mainPtr; town_record_type town; big_tr_type t_d; -Boolean diff_depth_ok = FALSE,mouse_button_held = FALSE,editing_town = FALSE; +bool diff_depth_ok = FALSE,mouse_button_held = FALSE,editing_town = FALSE; short cur_viewing_mode = 0; short town_type = 0; // 0 - big 1 - ave 2 - small short max_dim[3] = {64,48,32}; @@ -66,13 +68,11 @@ void handle_help_menu(int item_hit); pascal void right_sbar_action(ControlHandle bar, short part); void Mouse_Pressed(); void close_program(); - void ding(); -pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit); +void ding(); void set_pixel_depth(); void restore_depth(); void find_quickdraw() ; - scenario_data_type scenario; piles_of_stuff_dumping_type *data_store; Rect right_sbar_rect; @@ -95,13 +95,18 @@ int main(void) init_current_terrain(); //create_file(); //ExitToShell(); - cd_init_dialogs(); - - cen_x = 18; cen_y = 18; - + init_directories(); Initialize(); load_sounds(); + load_graphics(); + + init_dialogs(); + Point p = {0,0}; + init_graph_tool(redraw_screen,p); + init_snd_tool(); + + cen_x = 18; cen_y = 18; run_startup_g(); init_lb(); @@ -120,7 +125,7 @@ int main(void) //create_basic_scenario(); menu_bar_handle = GetNewMBar(128); - if (menu_bar_handle == NIL) { + if (menu_bar_handle == NULL) { SysBeep(50); SysBeep(50); SysBeep(50); ExitToShell(); } @@ -176,7 +181,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; @@ -637,7 +642,7 @@ void Mouse_Pressed() if (content_part != 0) { switch (content_part) { case kControlIndicatorPart: - content_part = TrackControl(control_hit,event.where,NIL); + content_part = TrackControl(control_hit,event.where,NULL); if (control_hit == right_sbar) if (content_part == kControlIndicatorPart) { draw_rb(); @@ -663,124 +668,130 @@ void close_program() restore_depth(); } - void ding() - { - SysBeep(1); - } - - pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit) -{ - char chr,chr2; - short the_type,wind_hit,item_hit; - Handle the_handle = NULL; - Rect the_rect,button_rect; - Point the_point; - WindowRef w; - RgnHandle rgn; - - dummy_item_hit = 0; - - switch (event->what) { - case updateEvt: - w = GetDialogWindow(hDlg); - rgn = NewRgn(); - GetWindowRegion(w,kWindowUpdateRgn,rgn); - if (EmptyRgn(rgn) == TRUE) { - DisposeRgn(rgn); - return TRUE; - } - DisposeRgn(rgn); - BeginUpdate(w); - cd_redraw(w); - EndUpdate(w); - DrawDialog(hDlg); - return FALSE; - break; - - case keyDown: - chr = event->message & charCodeMask; - chr2 = (char) ((event->message & keyCodeMask) >> 8); - switch (chr2) { - case 126: chr = 22; break; - case 124: chr = 21; break; - case 123: chr = 20; break; - case 125: chr = 23; break; - case 53: chr = 24; break; - case 36: chr = 31; break; - case 76: chr = 31; break; - } - // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc - // 25-30 ctrl 1-6 31 - return - - wind_hit = cd_process_keystroke(GetDialogWindow(hDlg),chr,&item_hit); - break; - - case mouseDown: - the_point = event->where; - GlobalToLocal(&the_point); - wind_hit = cd_process_click(GetDialogWindow(hDlg),the_point, event->modifiers,&item_hit); - break; - - default: wind_hit = -1; break; - } - switch (wind_hit) { - case -1: break; - //case 958: _event_filter(item_hit); break; - case 970: case 971: case 972: case 973: display_strings_event_filter(item_hit); break; - case 800: edit_make_scen_1_event_filter(item_hit); break; - case 801: edit_make_scen_2_event_filter(item_hit); break; - case 802: user_password_filter(item_hit); break; - case 803: edit_scen_details_event_filter(item_hit); break; - case 804: edit_scen_intro_event_filter(item_hit); break; - case 805: set_starting_loc_filter(item_hit); break; - case 806: edit_spec_item_event_filter(item_hit); break; - case 807: edit_save_rects_event_filter(item_hit); break; - case 808: edit_horses_event_filter(item_hit); break; - case 809: edit_boats_event_filter(item_hit); break; - case 810: edit_add_town_event_filter(item_hit); break; - case 811: edit_scenario_events_event_filter(item_hit); break; - case 812: edit_item_placement_event_filter(item_hit); break; - case 813: edit_ter_type_event_filter(item_hit); break; - case 814: edit_monst_type_event_filter(item_hit); break; - case 815: edit_monst_abil_event_filter(item_hit); break; - case 816: edit_text_event_filter(item_hit); break; - case 817: edit_talk_node_event_filter(item_hit); break; - case 818: edit_item_type_event_filter(item_hit); break; - case 819: choose_graphic_event_filter(item_hit); break; - case 820: choose_text_res_event_filter(item_hit); break; - case 821: edit_basic_dlog_event_filter(item_hit); break; - case 822: edit_spec_enc_event_filter(item_hit); break; - case 823: give_password_filter(item_hit); break; - case 824: edit_item_abil_event_filter(item_hit); break; - case 825: edit_special_num_event_filter(item_hit); break; - case 826: edit_spec_text_event_filter(item_hit); break; - case 830: new_town_event_filter(item_hit); break; - case 831: edit_sign_event_filter(item_hit); break; - case 832: edit_town_details_event_filter(item_hit); break; - case 833: edit_town_events_event_filter(item_hit); break; - case 834: edit_advanced_town_event_filter(item_hit); break; - case 835: edit_town_wand_event_filter(item_hit); break; - case 836: edit_placed_item_event_filter(item_hit); break; - case 837: edit_placed_monst_event_filter(item_hit); break; - case 838: edit_placed_monst_adv_event_filter(item_hit); break; - case 839: edit_town_strs_event_filter(item_hit); break; - case 840: edit_area_rect_event_filter(item_hit); break; - case 841: pick_import_town_event_filter(item_hit); break; - case 842: edit_dialog_text_event_filter(item_hit); break; - case 850: edit_out_strs_event_filter(item_hit); break; - case 851: outdoor_details_event_filter(item_hit); break; - case 852: edit_out_wand_event_filter(item_hit); break; - case 854: pick_out_event_filter(item_hit); break; - case 855: case 856: pick_town_num_event_filter(item_hit); break; - case 857: change_ter_event_filter(item_hit); break; - default: fancy_choice_dialog_event_filter (item_hit); break; - - } - - if (wind_hit == -1) - return FALSE; - else return TRUE; +void ding() +{ + SysBeep(1); } + +//pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit) +//{ +// char chr,chr2; +// short the_type,wind_hit,item_hit; +// Handle the_handle = NULL; +// Rect the_rect,button_rect; +// Point the_point; +// WindowRef w; +// RgnHandle rgn; +// +// dummy_item_hit = 0; +// +// switch (event->what) { +// case updateEvt: +// w = GetDialogWindow(hDlg); +// rgn = NewRgn(); +// GetWindowRegion(w,kWindowUpdateRgn,rgn); +// if (EmptyRgn(rgn) == TRUE) { +// DisposeRgn(rgn); +// return TRUE; +// } +// DisposeRgn(rgn); +// BeginUpdate(w); +// cd_redraw(w); +// EndUpdate(w); +// DrawDialog(hDlg); +// return FALSE; +// break; +// +// case keyDown: +// chr = event->message & charCodeMask; +// chr2 = (char) ((event->message & keyCodeMask) >> 8); +// switch (chr2) { +// case 126: chr = 22; break; +// case 124: chr = 21; break; +// case 123: chr = 20; break; +// case 125: chr = 23; break; +// case 53: chr = 24; break; +// case 36: chr = 31; break; +// case 76: chr = 31; break; +// } +// // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc +// // 25-30 ctrl 1-6 31 - return +// +// wind_hit = cd_process_keystroke(GetDialogWindow(hDlg),chr,&item_hit); +// break; +// +// case mouseDown: +// the_point = event->where; +// GlobalToLocal(&the_point); +// cd_process_click(GetDialogWindow(hDlg),the_point, event->modifiers,&item_hit); +// wind_hit = -1; +// break; +// +// case mouseUp: +// the_point = event->where; +// GlobalToLocal(&the_point); +// wind_hit = cd_process_click(GetDialogWindow(hDlg),the_point, event->modifiers,&item_hit); +// break; +// +// default: wind_hit = -1; break; +// } +//// switch (wind_hit) { +//// case -1: break; +//// //case 958: _event_filter(item_hit); break; +//// case 970: case 971: case 972: case 973: display_strings_event_filter(item_hit); break; +//// case 800: edit_make_scen_1_event_filter(item_hit); break; +//// case 801: edit_make_scen_2_event_filter(item_hit); break; +//// case 802: user_password_filter(item_hit); break; +//// case 803: edit_scen_details_event_filter(item_hit); break; +//// case 804: edit_scen_intro_event_filter(item_hit); break; +//// case 805: set_starting_loc_filter(item_hit); break; +//// case 806: edit_spec_item_event_filter(item_hit); break; +//// case 807: edit_save_rects_event_filter(item_hit); break; +//// case 808: edit_horses_event_filter(item_hit); break; +//// case 809: edit_boats_event_filter(item_hit); break; +//// case 810: edit_add_town_event_filter(item_hit); break; +//// case 811: edit_scenario_events_event_filter(item_hit); break; +//// case 812: edit_item_placement_event_filter(item_hit); break; +//// case 813: edit_ter_type_event_filter(item_hit); break; +//// case 814: edit_monst_type_event_filter(item_hit); break; +//// case 815: edit_monst_abil_event_filter(item_hit); break; +//// case 816: edit_text_event_filter(item_hit); break; +//// case 817: edit_talk_node_event_filter(item_hit); break; +//// case 818: edit_item_type_event_filter(item_hit); break; +//// case 819: choose_graphic_event_filter(item_hit); break; +//// case 820: choose_text_res_event_filter(item_hit); break; +//// case 821: edit_basic_dlog_event_filter(item_hit); break; +//// case 822: edit_spec_enc_event_filter(item_hit); break; +//// case 823: give_password_filter(item_hit); break; +//// case 824: edit_item_abil_event_filter(item_hit); break; +//// case 825: edit_special_num_event_filter(item_hit); break; +//// case 826: edit_spec_text_event_filter(item_hit); break; +//// case 830: new_town_event_filter(item_hit); break; +//// case 831: edit_sign_event_filter(item_hit); break; +//// case 832: edit_town_details_event_filter(item_hit); break; +//// case 833: edit_town_events_event_filter(item_hit); break; +//// case 834: edit_advanced_town_event_filter(item_hit); break; +//// case 835: edit_town_wand_event_filter(item_hit); break; +//// case 836: edit_placed_item_event_filter(item_hit); break; +//// case 837: edit_placed_monst_event_filter(item_hit); break; +//// case 838: edit_placed_monst_adv_event_filter(item_hit); break; +//// case 839: edit_town_strs_event_filter(item_hit); break; +//// case 840: edit_area_rect_event_filter(item_hit); break; +//// case 841: pick_import_town_event_filter(item_hit); break; +//// case 842: edit_dialog_text_event_filter(item_hit); break; +//// case 850: edit_out_strs_event_filter(item_hit); break; +//// case 851: outdoor_details_event_filter(item_hit); break; +//// case 852: edit_out_wand_event_filter(item_hit); break; +//// case 854: pick_out_event_filter(item_hit); break; +//// case 855: case 856: pick_town_num_event_filter(item_hit); break; +//// case 857: change_ter_event_filter(item_hit); break; +//// default: fancy_choice_dialog_event_filter (item_hit); break; +//// } +// +// if (wind_hit == -1) +// return FALSE; +// else return TRUE; +//} void set_pixel_depth() { GDHandle cur_device; diff --git a/osx/Scenario Editor/buttonmg.c b/osx/Scenario Editor/buttonmg.c index 2d948ea7..5409c7f0 100644 --- a/osx/Scenario Editor/buttonmg.c +++ b/osx/Scenario Editor/buttonmg.c @@ -1,11 +1,12 @@ #include -#include "string.h" -#include "stdio.h" +#include +#include #include "global.h" +#include "graphtool.h" #include "tGraphics.h" -#include "math.h" +#include #include "buttonmg.h" extern piles_of_stuff_dumping_type *data_store; diff --git a/osx/Scenario Editor/dlogtool.c b/osx/Scenario Editor/dlogtool.c index 528e504b..7c80e542 100644 --- a/osx/Scenario Editor/dlogtool.c +++ b/osx/Scenario Editor/dlogtool.c @@ -237,7 +237,7 @@ short cd_create_dialog(short dlog_num,WindowPtr parent) //TextSize(10); ForeColor(blackColor); BackColor(whiteColor); - dialog_not_toast = TRUE; + untoast_dialog(); //DestroyWindow(dlg); //Necesary? Dunno. /* if (dlg_parent[free_slot] != NULL) { @@ -277,7 +277,7 @@ void process_new_window (WindowPtr hDlg) { GetDialogItem( GetDialogFromWindow(hDlg), i + 1, &the_type, &the_handle, &small_rect); if (the_type % 128 == 8) { GetDialogItemText(the_handle,item_str); - p2c(item_str); + p2cstr(item_str); dlg_highest_item[free_slot]++; str_stored = FALSE; if (strlen((char *)item_str) == 0) { @@ -490,7 +490,7 @@ short cd_kill_dialog(short dlog_num,short parent_message) SetPortWindowPort( dlg_parent[which_dlg]); if (FrontWindow() != mainPtr) redraw_screen(); - dialog_not_toast = TRUE; + untoast_dialog(); return 0; } @@ -667,7 +667,7 @@ void cd_retrieve_text_edit_str(short dlog_num, short item_num, char *str) } GetDialogItem(GetDialogFromWindow(dlgs[dlg_index]), item_num, &the_type, &the_handle, &the_rect); GetDialogItemText(the_handle,store_ptr); - p2c(store_ptr); + p2cstr(store_ptr); strcpy(str,(char *) store_ptr); } @@ -703,7 +703,7 @@ void cd_set_text_edit_str(short dlog_num, short item_num, char *str) SysBeep(50); return ; } strcpy((char *) store_ptr,str); - c2p(store_ptr); + c2pstr(store_ptr); GetDialogItem(GetDialogFromWindow( dlgs[dlg_index]), item_num, &the_type, &the_handle, &the_rect ); SetDialogItemText ( the_handle, store_ptr); } @@ -721,7 +721,7 @@ void cd_set_text_edit_num(short dlog_num, short item_num, short num) } sprintf((char *) store_ptr,"%d",num); - c2p(store_ptr); + c2pstr(store_ptr); GetDialogItem( GetDialogFromWindow(dlgs[dlg_index]), item_num, &the_type, &the_handle, &the_rect ); SetDialogItemText ( the_handle, store_ptr); } diff --git a/osx/Scenario Editor/global.h b/osx/Scenario Editor/global.h index 7e0e90a0..db813ef6 100644 --- a/osx/Scenario Editor/global.h +++ b/osx/Scenario Editor/global.h @@ -2,7 +2,6 @@ #define MOUSE_REGION 0L #define DRAG_EDGE 15 #define IN_FRONT (WindowPtr)-1L -#define NIL 0L #define DISPLAY_LEFT 23 #define DISPLAY_TOP 23 @@ -32,58 +31,9 @@ #define CDST cd_set_text_edit_str #define CDSN cd_set_text_edit_num -// These constants are for draw_dialog_graphic() to know where to find the graphic. -#define PICT_OLD_TYPE -1 -#define PICT_BLANK_TYPE 0 -#define PICT_TER_TYPE 1 // 28x36 terrain graphic -#define PICT_TER_ANIM_TYPE 2 -#define PICT_MONST_TYPE 3 -#define PICT_DLG_TYPE 4 // 36x36 dialog graphic -#define PICT_TALK_TYPE 5 // 32x32 facial graphic -#define PICT_SCEN_TYPE 6 // 32x32 scenario icon -#define PICT_ITEM_TYPE 7 // Item graphic (two sizes available) -/* The following four are modifiers to be added to the above seven constants - * Usage for PICT_CUSTOM_TYPE: - * PICT_CUSTOM_TYPE + PICT_XXX_TYPE, where XXX is anything valid other than OLD or BLANK. - * PICT_CUSTOM_TYPE + PICT_MONST_TYPE + PICT_WIDE_MONST, for a 2x1 monster - * PICT_CUSTOM_TYPE + PICT_MONST_TYPE + PICT_TALL_MONST, for a 1x2 monster - * PICT_CUSTOM_TYPE + PICT_MONST_TYPE + PICT_TALL_MONST + PICT_WIDE_MONST, for a 2x2 monster - * Notes: - * - PICT_TALL_MONST and PICT_WIDE_MONST only apply to custom monsters - the preset - * monster graphics have these settings hardcoded. - * - Also note that custom scenario graphics are not currently supported. This doesn't really - * matter, though, since if they were they'd be handled like talk (facial) graphics. - * - Custom animated terrain graphics should use PICT_TER_TYPE rather than PICT_TER_ANIM_TYPE. - */ -#define PICT_CUSTOM_TYPE 100 -#define PICT_WIDE_MONSTER 10 -#define PICT_TALL_MONSTER 20 -#define DLG_NEW_PICTURE 20 // Adding this one makes it a DLG_ constant rather than a PICT_ constant -// These constants are the total number of preset graphics of each type. -#define PICT_N_TER 252 // 336 -#define PICT_N_TER_ANIM 13 // 18 -#define PICT_N_MONST 172 -#define PICT_N_DLG 35 // 36 -#define PICT_N_TALK 83 -#define PICT_N_SCEN 29 -#define PICT_N_ITEM 122 - -// These constants are used to create the definition of the dialogs, and -// to parse a dialog resource when displaying it to the screen. -#define DLG_BUTTON_TYPE 0 -#define DLG_DEFAULT_BTN_TYPE 1 -// Not sure what 10 and 11 do, but they may be similar to above two -#define DLG_LED_BUTTON 2 -// 3, 4, 7, 8, 9 are various text objects; not completely sure which is which -#define DLG_TEXT_BOLD 3 -#define DLG_TEXT_PLAIN 4 -#define DLG_TEXT_LARGE 7 -#define DLG_OLD_PICTURE 5 -// And I don't know what 6 is for either - typedef struct { char x,y; - } location; +} location; typedef struct { short type,sd1,sd2,pic,m1,m2,ex1a,ex1b,ex2a,ex2b,jumpto; @@ -390,13 +340,4 @@ typedef struct { char scen_strs[270][256]; char talk_strs[170][256]; scen_item_data_type scen_item_list; - } piles_of_stuff_dumping_type; - -short get_ran (short times,short min,short max); -short s_pow(short x,short y); -short dist(location p1,location p2); - -short max(short a,short b); -short min(short a,short b); -short minmax(short min,short max,short k); -//short abs(short x); +} piles_of_stuff_dumping_type; diff --git a/osx/Scenario Editor/keydlgs.c b/osx/Scenario Editor/keydlgs.c index 95e01275..16914c84 100644 --- a/osx/Scenario Editor/keydlgs.c +++ b/osx/Scenario Editor/keydlgs.c @@ -1,13 +1,15 @@ #include #include "Global.h" +#include "graphtool.h" #include "tGraphics.h" #include "dialogutils.h" -#include "dlogtool.h" +#include "dlgtool.h" +#include "dlgconsts.h" #include "keydlgs.h" #include "scenario.h" extern short cen_x, cen_y, overall_mode; -extern Boolean mouse_button_held,dialog_not_toast; +extern Boolean mouse_button_held; extern short cur_viewing_mode; extern town_record_type town; extern big_tr_type t_d; @@ -20,7 +22,6 @@ extern special_node_type null_spec_node; extern talking_node_type null_talk_node; extern piles_of_stuff_dumping_type *data_store; extern outdoor_record_type current_terrain; -extern pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit); extern short dialog_answer; short store_which_string_dlog; @@ -40,8 +41,6 @@ short store_which_node,store_spec_str_mode,store_spec_mode; short last_node[256]; special_node_type store_spec_node; short num_specs[3] = {256,60,100}; -CursHandle cursors[8] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; -short current_cursor = 0; short ex1a_choose[12] = {19,50,55,56,57,58,59,60,182,229,-1,-1}; short ex2a_choose[18] = {55,56,57,-1,-1, -1,135,136,171,172, 181,192,226,-1,-1, -1,-1,-1}; @@ -162,7 +161,7 @@ char edit_jumpto_mess[256] = { void fancy_choice_dialog_event_filter (short item_hit) { - dialog_not_toast = FALSE; + toast_dialog(); dialog_answer = item_hit; } @@ -177,9 +176,7 @@ short fancy_choice_dialog(short which_dlog,short parent) cd_create_dialog_parent_num(which_dlog,parent); - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + item_hit = cd_run_dialog(); cd_kill_dialog(which_dlog,0); @@ -214,7 +211,7 @@ void display_strings_event_filter (short item_hit) switch (item_hit) { case 1: - dialog_not_toast = FALSE; + toast_dialog(); break; } @@ -251,8 +248,8 @@ void display_strings(char *text1, char *text2, csp(store_which_string_dlog,3,graphic_num,graphic_type); //if (sound_num >= 0) // play_sound(sound_num); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + + item_hit = cd_run_dialog(); cd_kill_dialog(store_which_string_dlog,0); } @@ -265,11 +262,11 @@ void choose_graphic_event_filter (short item_hit) switch (item_hit) { case 1: dialog_answer = store_cur_pic; - dialog_not_toast = FALSE; + toast_dialog(); break; case 4: dialog_answer = -1; - dialog_not_toast = FALSE; + toast_dialog(); break; case 78: if (which_page == 0) @@ -338,9 +335,8 @@ short choose_graphic(short first_g,short last_g,short cur_choice,short g_type,sh cd_activate_item(819,78,0); } put_choice_pics(g_type); - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + + item_hit = cd_run_dialog(); cd_kill_dialog(819,0); @@ -355,11 +351,11 @@ void choose_text_res_event_filter (short item_hit) switch (item_hit) { case 2: dialog_answer = store_cur_t; - dialog_not_toast = FALSE; + toast_dialog(); break; case 7: dialog_answer = -1; - dialog_not_toast = FALSE; + toast_dialog(); break; case 5: if (which_page == 0) @@ -430,9 +426,8 @@ short choose_text_res(short res_list,short first_t,short last_t,short cur_choice cd_activate_item(820,6,0); } put_text_res(); - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + + item_hit = cd_run_dialog(); cd_kill_dialog(820,0); @@ -453,7 +448,7 @@ void edit_text_event_filter (short item_hit) CDGT(816,2,data_store->town_strs[store_which_str]); switch (item_hit) { case 9: - dialog_not_toast = FALSE; + toast_dialog(); break; case 4: @@ -495,8 +490,8 @@ void edit_text_str(short which_str,short mode) CDST(816,2,data_store->town_strs[which_str]); cd_attach_key(816,3,0); cd_attach_key(816,4,0); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + + item_hit = cd_run_dialog(); cd_kill_dialog(816,0); } @@ -509,7 +504,7 @@ void edit_area_rect_event_filter (short item_hit) switch (item_hit) { case 6: dialog_answer = TRUE; - dialog_not_toast = FALSE; + toast_dialog(); CDGT(840,2,(char *) str); if (store_str_mode == 0) sprintf(data_store->out_strs[store_which_str + 1],"%-29.29s",(char *) str); @@ -518,7 +513,7 @@ void edit_area_rect_event_filter (short item_hit) case 3: dialog_answer = FALSE; - dialog_not_toast = FALSE; + toast_dialog(); break; } } @@ -537,10 +532,9 @@ Boolean edit_area_rect_str(short which_str,short mode) if (store_str_mode == 0) CDST(840,2,data_store->out_strs[store_which_str + 1]); - else CDST(840,2,data_store->town_strs[store_which_str + 1]); - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + else CDST(840,2,data_store->town_strs[store_which_str + 1]); + + item_hit = cd_run_dialog(); cd_kill_dialog(840,0); @@ -687,7 +681,7 @@ void edit_spec_enc_event_filter (short item_hit) switch (item_hit) { case 12: if (save_spec_enc() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 14: //go_back if (save_spec_enc() == FALSE) @@ -706,7 +700,7 @@ void edit_spec_enc_event_filter (short item_hit) "Press the Go Back button until it disappears.",822); break; } - dialog_not_toast = FALSE; break; + toast_dialog(); break; case 43: case 44: case 45: // 1b, 2b, jump to spec if (save_spec_enc() == FALSE) break; @@ -787,7 +781,7 @@ void edit_spec_enc_event_filter (short item_hit) break; case 49: // message if (save_spec_enc() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); if ((edit_spec_mess_mess[store_spec_node.type] == 2) || (edit_spec_mess_mess[store_spec_node.type] == 4) || (edit_spec_mess_mess[store_spec_node.type] == 5)) { @@ -803,7 +797,7 @@ void edit_spec_enc_event_filter (short item_hit) break; case 46: // pict if (save_spec_enc() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); i = -1; switch (edit_pict_mess[store_spec_node.type]) { case 1: i = choose_graphic(/*700,731*/0,PICT_N_DLG,store_spec_node.pic,PICT_DLG_TYPE,822); break; @@ -818,7 +812,7 @@ void edit_spec_enc_event_filter (short item_hit) case 37: // 1st spec type if (save_spec_enc() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); i = choose_text_res(22,1,28,store_spec_node.type + 1,822,"Choose General Use Special:"); if (i >= 0) { store_spec_node.type = i - 1; @@ -827,7 +821,7 @@ void edit_spec_enc_event_filter (short item_hit) break; case 38: // 2 spec type if (save_spec_enc() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); i = choose_text_res(22,51,64,store_spec_node.type + 1,822,"Choose One-Shot Special:"); if (i >= 0) { store_spec_node.type = i - 1; @@ -839,14 +833,14 @@ void edit_spec_enc_event_filter (short item_hit) break; case 39: // 3 spec type if (save_spec_enc() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); i = choose_text_res(22,81,107,store_spec_node.type + 1,822,"Choose Affect Party Special:"); if (i >= 0) store_spec_node.type = i - 1; put_spec_enc_in_dlog(); break; case 40: // 4 spec type if (save_spec_enc() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); i = choose_text_res(22,131,156,store_spec_node.type + 1,822,"Choose If-Then Special:"); if (i >= 0) { store_spec_node.type = i - 1; @@ -855,14 +849,14 @@ void edit_spec_enc_event_filter (short item_hit) break; case 41: // 5 spec type if (save_spec_enc() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); i = choose_text_res(22,171,219,store_spec_node.type + 1,822,"Choose Town Special:"); if (i >= 0) store_spec_node.type = i - 1; put_spec_enc_in_dlog(); break; case 42: // 6 spec type if (save_spec_enc() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); i = choose_text_res(22,226,230,store_spec_node.type + 1,822,"Choose Outdoor Special:"); if (i >= 0) store_spec_node.type = i - 1; put_spec_enc_in_dlog(); @@ -915,8 +909,7 @@ void edit_spec_enc(short which_node,short mode,short parent_num) cd_activate_item(822,14,0); put_spec_enc_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &spec_enc_hit); + spec_enc_hit = cd_run_dialog(); cd_kill_dialog(822,0); } @@ -947,7 +940,7 @@ void edit_spec_text_event_filter (short item_hit) switch (item_hit) { case 7: - dialog_not_toast = FALSE; + toast_dialog(); break; case 6: @@ -1045,7 +1038,7 @@ void edit_spec_text_event_filter (short item_hit) } } } - dialog_not_toast = FALSE; + toast_dialog(); break; } } @@ -1082,22 +1075,19 @@ void edit_spec_text(short mode,short *str1,short *str2,short parent) CDST(826,3,data_store->out_strs[*str2 + 10]); if (mode == 2) CDST(826,3,data_store->town_strs[*str2 + 20]); - } - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + } + item_hit = cd_run_dialog(); cd_kill_dialog(826,0); } -void edit_dialog_text_event_filter (short item_hit) -{ +void edit_dialog_text_event_filter (short item_hit){ Str255 str; short i; switch (item_hit) { case 9: - dialog_not_toast = FALSE; + toast_dialog(); break; case 8: @@ -1115,7 +1105,7 @@ void edit_dialog_text_event_filter (short item_hit) break; } } - dialog_not_toast = FALSE; + toast_dialog(); break; } } @@ -1204,10 +1194,9 @@ void edit_dialog_text(short mode,short *str1,short parent) if (mode == 2) CDST(842,2 + i,data_store->town_strs[*str1 + 20 + i]); } - } - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + } + + item_hit = cd_run_dialog(); cd_kill_dialog(842,0); } @@ -1220,7 +1209,7 @@ void edit_special_num_event_filter (short item_hit) switch (item_hit) { case 8: dialog_answer = -1; - dialog_not_toast = FALSE; + toast_dialog(); break; case 4: @@ -1230,7 +1219,7 @@ void edit_special_num_event_filter (short item_hit) break; } dialog_answer = i; - dialog_not_toast = FALSE; + toast_dialog(); break; } } @@ -1245,9 +1234,8 @@ short edit_special_num(short mode,short what_start) cd_create_dialog_parent_num(825,0); CDSN(825,2,what_start); - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + + item_hit = cd_run_dialog(); cd_kill_dialog(825,0); @@ -1268,10 +1256,10 @@ void edit_scen_intro_event_filter (short item_hit) } for (i = 0; i < 6; i++) CDGT(804, 2 + i,data_store->scen_strs[4 + i]); - dialog_not_toast = FALSE; + toast_dialog(); break; case 10: - dialog_not_toast = FALSE; + toast_dialog(); break; case 16: @@ -1299,36 +1287,16 @@ void edit_scen_intro() CDST(804, 2 + i,data_store->scen_strs[4 + i]); csp(804,11,scenario.intro_pic/* + 1600*/,PICT_SCEN_TYPE); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + item_hit = cd_run_dialog(); cd_kill_dialog(804,0); } - void make_cursor_sword() { set_cursor(0); } -void set_cursor(short which_c) -{ - short i; - - if (cursors[0] == NULL) { - for (i = 0; i < 8; i++) - cursors[i] = GetCursor(130 + i); - } - current_cursor = which_c; - HLock ((Handle) cursors[current_cursor]); - SetCursor (*cursors[current_cursor]); - HUnlock((Handle) cursors[current_cursor]); -} -void restore_cursor() -{ - set_cursor(current_cursor); -} - // only used at beginning of program short choice_dialog(short pic,short num) { @@ -1352,7 +1320,7 @@ short choice_dialog(short pic,short num) ShowWindow(GetDialogWindow(select_dialog)); - ModalDialog(NIL, &item_hit); + ModalDialog(NULL, &item_hit); DisposeDialog(select_dialog); diff --git a/osx/Scenario Editor/loc_utils.c b/osx/Scenario Editor/loc_utils.c new file mode 100644 index 00000000..f5f9195f --- /dev/null +++ b/osx/Scenario Editor/loc_utils.c @@ -0,0 +1,741 @@ +#include + +#include "mathutil.h" +#include "global.h" +#include "loc_utils.h" +#include "monster.h" +#include "fields.h" +#include "mathutil.h" + + +char terrain_blocked[256]; + + +short short_can_see(); +Boolean combat_pt_in_light(); +//extern short town_size[3]; +location obs_sec; +location which_party_sec; + +//extern party_record_type party; +//extern current_town_type c_town; +extern short overall_mode/*,which_combat_type*/,current_pc,town_type; +extern big_tr_type t_d; +//extern outdoor_record_type outdoors[2][2]; +extern unsigned char combat_terrain[64][64]; +extern unsigned char out[96][96], out_e[96][96]; +extern location pc_pos[6],center; +//extern pc_record_type adven[6]; +extern Boolean belt_present,web,crate,barrel,fire_barrier,force_barrier,quickfire,force_wall,fire_wall,antimagic,scloud,ice_wall,blade_wall; +extern unsigned char map_graphic_placed[8][64]; // keeps track of what's been filled on map +extern scenario_data_type scenario; +extern bool editing_town; +extern outdoor_record_type current_terrain; + +location light_locs[40]; +short num_lights = 0; +char d_s[60]; + +//// +void set_terrain_blocked() +{ + short i; + + for (i = 0; i < 256; i++) + terrain_blocked[i] = scenario.ter_types[i].blockage; +} + +short dist(location p1,location p2) +{ + return s_sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y)); +} + +bool same_point(location p1,location p2){ + if ((p1.x == p2.x) & (p1.y == p2.y)) + return TRUE; + else return FALSE; +} + +short vdist(location p1,location p2) { + short i,j; + i = abs((short) (p1.x - p2.x)); j = abs((short) (p1.y - p2.y)); + return max(i,j); +} + +Boolean adjacent(location p1,location p2) +{ + if ((abs((short) (p1.x - p2.x)) <= 1) && (abs((short) (p1.y - p2.y)) <= 1)) + return TRUE; + else return FALSE; +} + +Boolean point_onscreen(location center,location check) +{ + if ((abs((short) (center.x - check.x)) <=4) && (abs((short) (center.y - check.y)) <= 4)) + return TRUE; + else return FALSE; +} + + +short set_direction (location old_pt, location new_pt) +{ + if (old_pt.x == new_pt.x) + if (old_pt.y > new_pt.y) + return 0; + else return 4; + if (old_pt.x > new_pt.x) { + if (old_pt.y > new_pt.y) + return 7; + if (old_pt.y < new_pt.y) + return 5; + return 6; + } + if (old_pt.y > new_pt.y) + return 1; + if (old_pt.y < new_pt.y) + return 3; + return 2; +} + +//location global_to_local(location global) +//{ +// location local; +// +// local = global; +// if (party.i_w_c.x == 1) +// local.x = local.x - 48; +// if (party.i_w_c.y == 1) +// local.y = local.y - 48; +// return local; +//} +//location local_to_global(location local) +//{ +// location global; +// +// global = local; +// if (party.i_w_c.x == 1) +// global.x = global.x + 48; +// if (party.i_w_c.y == 1) +// global.y = global.y + 48; +// return global; +//} +//Boolean loc_off_world(location p1) +//{ +// if ((p1.x < 0) || (p1.x > town_size[town_type]) || (p1.y < 0) || (p1.y > town_size[town_type])) +// return TRUE; +// else return FALSE; +//} + +//Boolean loc_off_act_area(location p1) +//{ +// if ((p1.x > c_town.town.in_town_rect.left) && (p1.x < c_town.town.in_town_rect.right) && +// (p1.y > c_town.town.in_town_rect.top) && (p1.y < c_town.town.in_town_rect.bottom)) +// return FALSE; +// return TRUE; +//} + +//location get_cur_loc() +//{ +// switch (overall_mode) { +// case 0: case 35: +// return party.p_loc; +// break; +// +// case 1: case 2: case 3: case 4: case 36: +// return c_town.p_loc; +// break; +// +// default: +// return pc_pos[current_pc]; +// break; +// } +//} + +//short short_can_see(shortloc p1,shortloc p2) +//{ +// location s1,s2; +// +// s1.x = (char) p1.x; +// s1.y = (char) p1.y; +// s2.x = (char) p2.x; +// s2.y = (char) p2.y; +// return (can_see(s1,s2,0)); +//} + +Boolean is_lava(short x,short y) +{ + if ((coord_to_ter(x,y) == 75) || (coord_to_ter(x,y) == 76)) + return TRUE; + else return FALSE; +} + + +short can_see(location p1,location p2,short mode) +//mode; // 0 - normal 1 - counts 1 for blocked spaces or lava (used for party placement in +// town combat) +// 2 - no light check +{ + short dx,dy,count,storage = 0; + + if (p1.y == p2.y) { + if (p1.x > p2.x) { + for (count = p2.x + 1; count < p1.x; count++) { + storage = storage + get_obscurity(count, p1.y); + if (((scenario.ter_types[coord_to_ter(count,p1.y)].blockage > 2) || (is_lava(count,p1.y) == TRUE)) && (mode == 1)) + return 5; + } + } + else { + for (count = p1.x + 1; count < p2.x; count++) { + + storage = storage + get_obscurity(count, p1.y); + if (((scenario.ter_types[coord_to_ter(count,p1.y)].blockage > 2) || (is_lava(count,p1.y) == TRUE)) && (mode == 1)) + return 5; + } + } + return storage; + } + if (p1.x == p2.x) { + if (p1.y > p2.y) { + for (count = p1.y - 1; count > p2.y; count--) { + storage = storage + get_obscurity(p1.x, count); + if (((scenario.ter_types[coord_to_ter(p1.x,count)].blockage > 2) || (is_lava(p1.x,count) == TRUE)) && (mode == 1)) + return 5; + } + } + else { + for (count = p1.y + 1; count < p2.y; count++) { + storage = storage + get_obscurity(p1.x, count); + if (((scenario.ter_types[coord_to_ter(p1.x,count)].blockage > 2) || (is_lava(p1.x,count) == TRUE)) && (mode == 1)) + return 5; + } + } + return storage; + } + dx = p2.x - p1.x; + dy = p2.y - p1.y; + + if (abs(dy) > abs(dx)) { + if (p2.y > p1.y) { + for (count = 1; count < dy; count++) { + storage = storage + get_obscurity(p1.x + (count * dx) / dy, p1.y + count); + if ( ((scenario.ter_types[coord_to_ter(p1.x + (count * dx) / dy,p1.y + count)].blockage > 2) || + (is_lava(p1.x + (count * dx) / dy,p1.y + count) == TRUE)) + && (mode == 1)) + return 5; + } + } + else { + for (count = -1; count > dy; count--) { + storage = storage + get_obscurity(p1.x + (count * dx) / dy, p1.y + count); + if ( ((scenario.ter_types[coord_to_ter(p1.x + (count * dx) / dy, p1.y + count)].blockage > 2) || + (is_lava(p1.x + (count * dx) / dy, p1.y + count) == TRUE)) + && (mode == 1)) + return 5; + } + } + return storage; + } + if (abs(dy) <= abs(dx)) { + if (p2.x > p1.x) { + for (count = 1; count < dx; count++) { + storage = storage + get_obscurity(p1.x + count, p1.y + (count * dy) / dx); + if (((scenario.ter_types[coord_to_ter(p1.x + count,p1.y + (count * dy) / dx)].blockage > 2) || + (is_lava(p1.x + count,p1.y + (count * dy) / dx) == TRUE)) + && (mode == 1)) + return 5; + } + } + else { + for (count = -1; count > dx; count--) { + storage = storage + get_obscurity(p1.x + count, p1.y + (count * dy) / dx); + if ( ((scenario.ter_types[coord_to_ter(p1.x + count,p1.y + (count * dy) / dx)].blockage > 2) || + (is_lava(p1.x + count,p1.y + (count * dy) / dx) == TRUE)) + && (mode == 1)) + return 5; + } + } + return storage; + } + if (storage > 5) + return 5; + else return storage; +} + +short get_obscurity(short x,short y) +{ + unsigned char what_terrain; + short store; + + what_terrain = coord_to_ter(x,y); + + store = scenario.ter_types[what_terrain].blockage; + if ((store == 1) || (store == 5)) + return 5; + if (store == 4) + return 1; + return 0; +} + +unsigned char coord_to_ter(short x,short y) +{ + unsigned char what_terrain; + + if (editing_town == TRUE) + what_terrain = t_d.terrain[x][y]; + else what_terrain = current_terrain.terrain[x][y]; + + return what_terrain; +} + +//// +Boolean is_container(location loc) +{ + unsigned char ter; + + if ((is_barrel(loc.x,loc.y)) || (is_crate(loc.x,loc.y))) + return TRUE; + ter = coord_to_ter(loc.x,loc.y); + if (scenario.ter_types[ter].special == 14) + return TRUE; + return FALSE; +} + +//void update_explored(location dest) +//{ +// shortloc shortdest,look; +// +// location look2; +// +// shortdest.x = (short) dest.x; +// shortdest.y = (short) dest.y; +// +// which_party_sec.x = party.outdoor_corner.x + party.i_w_c.x; +// which_party_sec.y = party.outdoor_corner.y + party.i_w_c.y; +// +// if (overall_mode == MODE_OUTDOORS) { +// out_e[dest.x][dest.y] = 2; +// for (look.x = shortdest.x - 4; look.x < shortdest.x + 5; look.x++) +// for (look.y = shortdest.y - 4; look.y < shortdest.y + 5; look.y++) { +// +// if (out_e[look.x][look.y] == 0) +// if (short_can_see(shortdest, look) < 5) +// out_e[look.x][look.y] = 1; +// } +// +// +// } +// +// 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++) +// 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); +// } +//} + + +// All purpose function to check is spot is free for travel into. +//Boolean is_blocked(location to_check) +//{ +// short i,gr; +// unsigned char ter; +// +// if (is_out()) { +// if (impassable(out[to_check.x][to_check.y]) == TRUE) { +// return TRUE; +// } +// if (same_point (to_check,party.p_loc) == TRUE) +// return TRUE; +// for (i = 0; i < 20; i++) +// if ((party.out_c[i].exists) == TRUE) +// if (same_point(party.out_c[i].m_loc, to_check) == TRUE) +// return TRUE; +// return FALSE; +// } +// +// if ((is_town()) || (is_combat())) { +// ter = (is_town()) ? t_d.terrain[to_check.x][to_check.y] : combat_terrain[to_check.x][to_check.y]; +// gr = scenario.ter_types[ter].picture; +// +// //// +// // Terrain blocking? +// if (impassable(ter) == TRUE) { +// return TRUE; +// } +// +// // Keep away from marked specials during combat +// if ((is_combat()) && (gr <= 212) && (gr >= 207)) +// return TRUE; +// if ((is_combat()) && (gr == 406)) +// return TRUE; +// +// // Party there? +// if (is_town()) +// if (same_point (to_check,c_town.p_loc) == TRUE) +// return TRUE; +// if (is_combat()) +// for (i = 0; i < 6; i++) +// if ((adven[i].main_status == 1) && (same_point (to_check,pc_pos[i]) == TRUE)) +// return TRUE; +// +// // Monster there? +// if (monst_there(to_check) < 90) +// return TRUE; +// +// // Magic barrier? +// if (is_force_barrier(to_check.x,to_check.y)) +// return TRUE; +// +// return FALSE; +// } +// return TRUE; +//} + +bool monst_on_space(location loc,short m_num) +{ + short i,j; + + if (editing_town == FALSE) + return FALSE; + if (t_d.creatures[m_num].number == 0) + return FALSE; + if ((loc.x - t_d.creatures[m_num].start_loc.x >= 0) && + (loc.x - t_d.creatures[m_num].start_loc.x <= scenario.scen_monsters[t_d.creatures[m_num].number].x_width - 1) && + (loc.y - t_d.creatures[m_num].start_loc.y >= 0) && + (loc.y - t_d.creatures[m_num].start_loc.y <= scenario.scen_monsters[t_d.creatures[m_num].number].y_width - 1)) + return TRUE; + return FALSE; + +} + +//short monst_there(location where) // returns 90 if no +//{ +// short i; +// +// for (i = 0; i < T_M; i++) +// if ((c_town.monst.dudes[i].active != 0) && (monst_on_space(where,i) == TRUE)) +// return i; +// return 90; +//} + +//Boolean monst_can_be_there(location loc,short m_num) +//{ +// short i,j; +// location destination; +// +// // First clear monst away so it doesn't block itself +// c_town.monst.dudes[m_num].m_loc.x += 100; +// +// for (i = 0; i < c_town.monst.dudes[m_num].m_d.x_width; i++) +// for (j = 0; j < c_town.monst.dudes[m_num].m_d.y_width; j++) { +// destination.x = loc.x + i; destination.y = loc.y + j; +// if ((is_blocked(destination) == TRUE) +// || (loc_off_act_area(destination) == TRUE)) { +// c_town.monst.dudes[m_num].m_loc.x -= 100; +// return FALSE; +// } +// } +// c_town.monst.dudes[m_num].m_loc.x -= 100; +// return TRUE; +//} + +//Boolean monst_adjacent(location loc,short m_num) +//{ +// short i,j; +// location destination; +// +// for (i = 0; i < c_town.monst.dudes[m_num].m_d.x_width; i++) +// for (j = 0; j < c_town.monst.dudes[m_num].m_d.y_width; j++) { +// destination.x = c_town.monst.dudes[m_num].m_loc.x + i; +// destination.y = c_town.monst.dudes[m_num].m_loc.y + j; +// if (adjacent(destination,loc) == TRUE) +// return TRUE; +// } +// return FALSE; +//} + +//Boolean monst_can_see(short m_num,location l) +//{ +// short i,j; +// location destination; +// +// for (i = 0; i < c_town.monst.dudes[m_num].m_d.x_width; i++) +// for (j = 0; j < c_town.monst.dudes[m_num].m_d.y_width; j++) { +// destination.x = c_town.monst.dudes[m_num].m_loc.x + i; +// destination.y = c_town.monst.dudes[m_num].m_loc.y + j; +// if (can_see(destination,l,0) < 5) +// return TRUE; +// } +// return FALSE; +//} + +//Boolean party_can_see_monst(short m_num) +//{ +// short i,j; +// location destination; +// +// for (i = 0; i < c_town.monst.dudes[m_num].m_d.x_width; i++) +// for (j = 0; j < c_town.monst.dudes[m_num].m_d.y_width; j++) { +// destination.x = c_town.monst.dudes[m_num].m_loc.x + i; +// destination.y = c_town.monst.dudes[m_num].m_loc.y + j; +// if (party_can_see(destination) < 6) +// return TRUE; +// } +// return FALSE; +//} + +//Boolean can_see_monst(location l,short m_num) +//{ +// short i,j; +// location destination; +// +// for (i = 0; i < c_town.monst.dudes[m_num].m_d.x_width; i++) +// for (j = 0; j < c_town.monst.dudes[m_num].m_d.y_width; j++) { +// destination.x = c_town.monst.dudes[m_num].m_loc.x + i; +// destination.y = c_town.monst.dudes[m_num].m_loc.y + j; +// if (can_see(l,destination,0) < 5) +// return TRUE; +// } +// return FALSE; +//} + +//Boolean outd_is_blocked(location to_check) +//{ +// short i; +// +// if (overall_mode == MODE_OUTDOORS) { +// if (impassable(out[to_check.x][to_check.y]) == TRUE) { +// return TRUE; +// } +// for (i = 0; i < 10; i++) +// if ((party.out_c[i].exists) == TRUE) +// if (same_point(party.out_c[i].m_loc, to_check) == TRUE) +// return TRUE; +// return FALSE; +// } +//return FALSE; +//} + +Boolean special_which_blocks_monst(location to_check) +{ + if (terrain_blocked[coord_to_ter(to_check.x,to_check.y)] == 2) + return TRUE; + else return FALSE; +} + +// Checks if space is a special that prevents movement into or placement of a PC on +Boolean is_special(location to_check) +{ + unsigned char which_ter; + + if (special_which_blocks_monst(to_check) == FALSE) + return FALSE; + which_ter = coord_to_ter(to_check.x,to_check.y); + if (terrain_blocked[which_ter] == 2) + return TRUE; + else return FALSE; +} + +//Boolean outd_is_special(location to_check) +//{ +// if (overall_mode == MODE_OUTDOORS) { +// if (terrain_blocked[out[to_check.x][to_check.y]] == 2) { +// return TRUE; +// } +// else return FALSE; +// } +// return FALSE; +//} + +Boolean impassable(unsigned char terrain_to_check) +{ + if (terrain_blocked[terrain_to_check] > 2) + return TRUE; + else return FALSE; +} + +//short get_blockage(unsigned char terrain_type) +//{ +// // little kludgy in here for pits +// if ((terrain_type == 90) && (is_combat()) && (which_combat_type == 0)) +// return 5; +// if ((terrain_blocked[terrain_type] == 5) || (terrain_blocked[terrain_type] == 1)) +// return 5; +// else if (terrain_blocked[terrain_type] > 3) +// return 1; +// else { +// return 0; +// } +//} + + + +//short light_radius() +//{ +// short store = 1,i; +// short extra_levels[6] = {10,20,50,75,110,140}; +// +// if (((which_combat_type == 0) && (is_combat())) +// || (is_out()) || (c_town.town.lighting == 0)) +// return 200; +// for (i = 0; i < 6; i++) +// if (party.light_level > extra_levels[i]) +// store++; +// return store; +//} + +//Boolean pt_in_light(location from_where,location to_where) // Assumes, of course, in town or combat +//{ +// +// if (c_town.town.lighting == 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])) +// return TRUE; +// if (t_d.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()) +// return TRUE; +// +// return FALSE; +//} + +//Boolean combat_pt_in_light(location to_where) +//{ +// short i,rad; +// +// if ((c_town.town.lighting == 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])) +// return TRUE; +// if (t_d.lighting[to_where.x / 8][to_where.y] & (char) (s_pow(2,to_where.x % 8))) +// return TRUE; +// +// rad = light_radius(); +// for (i = 0; i < 6; i++) +// if (adven[i].main_status == 1) { +// if (dist(pc_pos[i],to_where) <= rad) +// return TRUE; +// } +// +// return FALSE; +//} + +//Boolean party_sees_a_monst() // Returns true is a hostile monster is in sight. +//{ +// short i; +// +// for (i = 0; i < T_M; i++) { +// if (c_town.monst.dudes[i].active > 0) +// if ((c_town.monst.dudes[i].attitude == 1) && +// (party_can_see_monst(i) == TRUE)) +// return TRUE; +// } +// +// return FALSE; +//} + + +// Returns 6 if can't see, O.W. returns the # of a PC that can see +//short party_can_see(location where) +//{ +// short i; +// +// if (is_out()) { +// if ((point_onscreen(party.p_loc,where) == TRUE) && (can_see(party.p_loc,where,0) < 5)) +// return 1; +// else return 6; +// } +// if (is_town()) { +// if ( ((point_onscreen(c_town.p_loc,where) == TRUE) || (overall_mode == MODE_LOOK_TOWN)) && (pt_in_light(c_town.p_loc,where) == TRUE) +// && (can_see(c_town.p_loc,where,0) < 5)) +// return 1; +// else return 6; +// } +// +// // Now for combat checks. Doing separately for efficiency. Check first for light. If +// // dark, give up. +// if ((which_combat_type != 0) && (combat_pt_in_light(where) == FALSE)) +// return 6; +// +// for (i = 0; i < 6; i++) +// if (adven[i].main_status == 1) { +// if (can_see(pc_pos[i],where,0) < 5) +// return i; +// } +// +// return 6; +//} +//location push_loc(location from_where,location to_where) +//{ +// location loc_to_try; +// +// 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 ((t_d.terrain[loc_to_try.x][loc_to_try.y] == 90) || +// ((t_d.terrain[loc_to_try.x][loc_to_try.y] >= 50)&& (t_d.terrain[loc_to_try.x][loc_to_try.y] <= 64)) +// || (t_d.terrain[loc_to_try.x][loc_to_try.y] == 71) +// || ((t_d.terrain[loc_to_try.x][loc_to_try.y] >= 74)&& (t_d.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[t_d.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)) +// return from_where; +// else return loc_to_try; +//} + + + +Boolean spot_impassable(short i,short j) +{ + unsigned char ter; + + ter = coord_to_ter(i,j); + if (terrain_blocked[ter] == 5) + return TRUE; + else return FALSE; +} + +//void swap_ter(short i,short j,unsigned char ter1,unsigned char ter2) +//{ +// if (coord_to_ter(i,j) == ter1) +// alter_space(i,j,ter2); +// else if (coord_to_ter(i,j) == ter2) +// alter_space(i,j,ter1); +//} + +//void alter_space(short i,short j,unsigned char ter) +//{ +// location l; +// +// l.x = i; +// l.y = j; +// map_graphic_placed[i / 8][j] = 0; +//// map_graphic_placed[i / 8][j] = +//// map_graphic_placed[i / 8][j] & ~((unsigned char)(s_pow(2,i % 8))); +// +// if (is_out()) { +// l = local_to_global(l); +// out[l.x][l.y] = ter; +// outdoors[party.i_w_c.x][party.i_w_c.y].terrain[i][j] = ter; +// } +// else { +// t_d.terrain[i][j] = ter; +// combat_terrain[i][j] = ter; +// if ((scenario.ter_types[t_d.terrain[i][j]].special >= 16) && +// (scenario.ter_types[t_d.terrain[i][j]].special <= 19)) +// belt_present = TRUE; +// } +//} \ No newline at end of file diff --git a/osx/Scenario Editor/loc_utils.h b/osx/Scenario Editor/loc_utils.h new file mode 100644 index 00000000..e2857451 --- /dev/null +++ b/osx/Scenario Editor/loc_utils.h @@ -0,0 +1,42 @@ +void set_terrain_blocked(); +short dist(location p1,location p2); +short ex_sqrt(short val); +short vdist(location p1,location p2) ; +Boolean adjacent(location p1,location p2); +Boolean point_onscreen(location center,location check); +short set_direction (location old_pt, location new_pt); +location global_to_local(location global); +location local_to_global(location local); +Boolean loc_off_world(location p1); +Boolean loc_off_act_area(location p1); +location get_cur_loc(); +Boolean is_lava(short x,short y); +short can_see(location p1,location p2,short mode); +short get_obscurity(short x,short y); +unsigned char coord_to_ter(short x,short y); +Boolean is_container(location loc); +void update_explored(location dest); +Boolean is_blocked(location to_check); +bool monst_on_space(location loc,short m_num); +short monst_there(location where) ; +Boolean monst_can_be_there(location loc,short m_num); +Boolean monst_adjacent(location loc,short m_num); +Boolean monst_can_see(short m_num,location l); +Boolean party_can_see_monst(short m_num); +Boolean can_see_monst(location l,short m_num); +Boolean outd_is_blocked(location to_check); +Boolean special_which_blocks_monst(location to_check); +Boolean is_special(location to_check); +Boolean outd_is_special(location to_check); +Boolean impassable(unsigned char terrain_to_check); +short get_blockage(unsigned char terrain_type); +short light_radius(); +Boolean pt_in_light(location from_where,location to_where) ;// Assumes, of course, in town or combat +Boolean combat_pt_in_light(location to_where); +Boolean party_sees_a_monst(); // Returns true is a hostile monster is in sight. +short party_can_see(location where); +location push_loc(location from_where,location to_where); +Boolean spot_impassable(short i,short j); +void swap_ter(short i,short j,unsigned char ter1,unsigned char ter2); +void alter_space(short i,short j,unsigned char ter); +bool same_point(location p1,location p2); diff --git a/osx/Scenario Editor/scenario.c b/osx/Scenario Editor/scenario.c index ae2944b1..bbaf9c31 100644 --- a/osx/Scenario Editor/scenario.c +++ b/osx/Scenario Editor/scenario.c @@ -2,18 +2,20 @@ #include #include "string.h" #include "Global.h" +#include "graphtool.h" #include "tGraphics.h" #include "dialogutils.h" #include "itemlist.h" #include "scenario.h" -#include "dlogtool.h" +#include "dlgtool.h" +#include "dlgconsts.h" #include "keydlgs.h" #include "townout.h" #include "tfileio.h" #include "tactions.h" extern short cen_x, cen_y, overall_mode,cur_town; -extern Boolean mouse_button_held,dialog_not_toast; +extern Boolean mouse_button_held; extern short cur_viewing_mode,dialog_answer,given_password,user_given_password; extern town_record_type town; extern big_tr_type t_d; @@ -25,7 +27,6 @@ extern scenario_data_type scenario; extern special_node_type null_spec_node; extern talking_node_type null_talk_node; extern piles_of_stuff_dumping_type *data_store; -extern pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit); extern location cur_out; short store_which_ter; @@ -972,7 +973,7 @@ void put_ter_info_in_dlog() get_str(str,21,80 + store_ter.special); csit(813,68,(char *) str); if (store_ter.picture >= 1000) - csp(813,14,0,PICT_BLANK_TYPE); + csp(813,14,store_ter.picture % 1000,PICT_CUSTOM_TYPE + PICT_TER_TYPE); else if (store_ter.picture >= 400) csp(813,14,store_ter.picture - 400,PICT_TER_ANIM_TYPE); else csp(813,14,store_ter.picture,PICT_TER_TYPE); @@ -985,11 +986,12 @@ Boolean save_ter_info() store_ter.picture = CDGN(813,5); - if ((store_ter.picture < 0) || - ((store_ter.picture > 413) && (store_ter.picture < 1000))) { + if ((store_ter.picture < 0) || + ((store_ter.picture > PICT_N_TER) && (store_ter.picture < 400)) || + ((store_ter.picture > 400 + PICT_N_TER_ANIM) && (store_ter.picture < 1000))) { give_error("Picture number isn't in the proper range.","",813); return FALSE; - } + } if (store_which_ter > 90) { store_ter.blockage = cd_get_led_range(813,19,24); @@ -1044,10 +1046,10 @@ void edit_ter_type_event_filter (short item_hit) switch (item_hit) { case 9: - dialog_not_toast = FALSE; break; + toast_dialog(); break; case 62: if (save_ter_info() == TRUE) - dialog_not_toast = FALSE; break; + toast_dialog(); break; case 10: if (save_ter_info() == FALSE) break; store_which_ter--; @@ -1074,7 +1076,7 @@ void edit_ter_type_event_filter (short item_hit) else break; CDSN(813,5,store_ter.picture); if (store_ter.picture >= 1000) - csp(813,14,0,PICT_BLANK_TYPE); + csp(813,14,store_ter.picture % 1000,PICT_CUSTOM_TYPE + PICT_TER_TYPE); else if (store_ter.picture >= 400) csp(813,14,store_ter.picture - 400,PICT_TER_ANIM_TYPE); else csp(813,14,store_ter.picture,PICT_TER_TYPE); @@ -1123,9 +1125,8 @@ short edit_ter_type(short which_ter) cd_add_label(813,19 + i,blocked_strs[i],57); cd_attach_key(813,10,0); cd_attach_key(813,11,0); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); - + + item_hit = cd_run_dialog(); cd_kill_dialog(813,0); return 0; } @@ -1136,7 +1137,7 @@ void put_monst_info_in_dlog() if (store_monst.picture_num < 1000) csp(814,34,/*400 + */store_monst.picture_num,PICT_MONST_TYPE); - else csp(814,34,0,PICT_BLANK_TYPE); + else csp(814,34,store_monst.picture_num % 1000,PICT_CUSTOM_TYPE + PICT_MONST_TYPE); cdsin(814,33,store_which_monst); CDST(814,2,data_store->scen_item_list.monst_names[store_which_monst]); CDSN(814,3,store_monst.picture_num); @@ -1247,11 +1248,11 @@ void edit_monst_type_event_filter (short item_hit) switch (item_hit) { case 20: - dialog_not_toast = FALSE; break; + toast_dialog(); break; case 19: if (save_monst_info() == TRUE) { scenario.scen_monsters[store_which_monst] = store_monst; - dialog_not_toast = FALSE; + toast_dialog(); } break; case 23: // abils @@ -1347,9 +1348,8 @@ short edit_monst_type(short which_monst) cd_add_label(814,29 + i,attitude[i],57); cd_attach_key(814,21,0); cd_attach_key(814,22,0); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); - + + item_hit = cd_run_dialog(); cd_kill_dialog(814,0); return 0; @@ -1429,10 +1429,10 @@ void edit_monst_abil_event_filter (short item_hit) switch (item_hit) { case 8: store_monst2.level = -1; - dialog_not_toast = FALSE; break; + toast_dialog(); break; case 7: if (save_monst_abils() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 31: // abils if (save_monst_abils() == FALSE) break; @@ -1492,9 +1492,7 @@ monster_record_type edit_monst_abil(monster_record_type starting_record,short pa cd_add_label(815,18,"Immune To Cold",55); cd_add_label(815,20,"Immune To Poison",55); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); - + item_hit = cd_run_dialog(); cd_kill_dialog(815,0); return store_monst2; } @@ -1507,7 +1505,7 @@ void put_item_info_in_dlog() CDST(818,2,store_item.full_name); CDST(818,3,store_item.name); if (store_item.graphic_num >= 150) - csp(818,49,0,PICT_BLANK_TYPE); + csp(818,49,store_item.graphic_num % 150,PICT_CUSTOM_TYPE + PICT_ITEM_TYPE); else csp(818,49,/*1800 + */store_item.graphic_num,PICT_ITEM_TYPE); CDSN(818,4,store_item.graphic_num); cd_set_led_range(818,18,45,store_item.variety); @@ -1587,10 +1585,10 @@ void edit_item_type_event_filter (short item_hit) switch (item_hit) { case 15: - dialog_not_toast = FALSE; break; + toast_dialog(); break; case 14: if (save_item_info() == TRUE) - dialog_not_toast = FALSE; break; + toast_dialog(); break; break; case 16: @@ -1661,8 +1659,8 @@ short edit_item_type(short which_item) cd_add_label(818,48,"Pole",23); cd_attach_key(818,16,0); cd_attach_key(818,17,0); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + + item_hit = cd_run_dialog(); cd_kill_dialog(818,0); return 0; @@ -1723,10 +1721,10 @@ void edit_item_abil_event_filter (short item_hit) switch (item_hit) { case 4: store_item2.ability = 0; - dialog_not_toast = FALSE; break; + toast_dialog(); break; case 3: if (save_item_abils() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 17: if (save_item_abils() == FALSE) break; @@ -1835,11 +1833,8 @@ item_record_type edit_item_abil(item_record_type starting_record,short parent_nu cd_add_label(824,10,"Magical",50); cd_add_label(824,11,"Cursed",50); cd_add_label(824,12,"Conceal ability",50); - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); - + item_hit = cd_run_dialog(); cd_kill_dialog(824,0); return store_item2; } @@ -1887,10 +1882,10 @@ void edit_spec_item_event_filter (short spec_item_hit) switch (spec_item_hit) { case 11: - dialog_not_toast = FALSE; break; + toast_dialog(); break; case 5: if (save_spec_item() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 20: @@ -1951,8 +1946,7 @@ void edit_spec_item(short which_item) cd_attach_key(806,21,0); cd_activate_item(806,12,0); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &spec_item_hit); + spec_item_hit = cd_run_dialog(); cd_kill_dialog(806,0); } @@ -2011,10 +2005,10 @@ void edit_save_rects_event_filter (short save_rects_hit) switch (save_rects_hit) { case 18: - dialog_not_toast = FALSE; break; + toast_dialog(); break; case 17: if (save_save_rects() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; } @@ -2030,9 +2024,7 @@ void edit_save_rects() put_save_rects_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &save_rects_hit); - + save_rects_hit = cd_run_dialog(); cd_kill_dialog(807,0); } @@ -2079,7 +2071,7 @@ void edit_horses_event_filter (short item_hit) switch (item_hit) { case 20: if (save_horses() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 21: if (save_horses() == FALSE) break; @@ -2112,9 +2104,7 @@ void edit_horses() put_horses_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &horses_hit); - + horses_hit = cd_run_dialog(); cd_kill_dialog(808,0); } @@ -2161,7 +2151,7 @@ void edit_boats_event_filter (short item_hit) switch (item_hit) { case 20: if (save_boats() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 22: if (save_boats() == FALSE) break; @@ -2194,9 +2184,7 @@ void edit_boats() put_boats_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &boats_hit); - + boats_hit = cd_run_dialog(); cd_kill_dialog(809,0); } @@ -2240,7 +2228,7 @@ void edit_add_town_event_filter (short item_hit) switch (item_hit) { case 32: if (save_add_town() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; } @@ -2256,9 +2244,7 @@ void edit_add_town() put_add_town_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &add_town_hit); - + add_town_hit = cd_run_dialog(); cd_kill_dialog(810,0); } @@ -2307,10 +2293,10 @@ void edit_item_placement_event_filter (short item_hit) switch (item_hit) { case 23: if (save_item_placement() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 24: - dialog_not_toast = FALSE; + toast_dialog(); break; case 26: if (save_item_placement() == FALSE) break; @@ -2358,9 +2344,7 @@ void edit_item_placement() put_item_placement_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_placement_hit); - + item_placement_hit = cd_run_dialog(); cd_kill_dialog(812,0); } @@ -2411,7 +2395,7 @@ void edit_scen_details_event_filter (short item_hit) switch (item_hit) { case 8: if (save_scen_details() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; default: cd_hit_led_range(803,21,24,item_hit); @@ -2430,9 +2414,7 @@ void edit_scen_details() put_scen_details_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &scen_details_hit); - + scen_details_hit = cd_run_dialog(); cd_kill_dialog(803,0); } @@ -2470,11 +2452,11 @@ void edit_make_scen_1_event_filter (short item_hit) return; } dialog_answer = 1; - dialog_not_toast = FALSE; + toast_dialog(); break; case 9: dialog_answer = 0; - dialog_not_toast = FALSE; + toast_dialog(); break; default: cd_flip_led(800,11,item_hit); @@ -2492,9 +2474,7 @@ short edit_make_scen_1(char *filename,char *title,short *grass) put_make_scen_1_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &make_scen_1_hit); - + make_scen_1_hit = cd_run_dialog(); CDGT(800,2,title); title[30] = 0; CDGT(800,3,filename); @@ -2542,11 +2522,11 @@ void edit_make_scen_2_event_filter (short item_hit) if (cre(i + j + k, 1,200,"The total number of towns must be from 1 to 200 (you must have at least 1 town).","",801) == TRUE) return ; - dialog_not_toast = FALSE; + toast_dialog(); break; case 10: dialog_answer = 0; - dialog_not_toast = FALSE; + toast_dialog(); break; default: cd_flip_led(801,26,item_hit); @@ -2565,8 +2545,7 @@ short edit_make_scen_2(short *val_array) put_make_scen_2_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &make_scen_2_hit); + make_scen_2_hit = cd_run_dialog(); for (i = 0; i < 5; i++) val_array[i] = CDGN(801,2 + i); @@ -2670,7 +2649,7 @@ void user_password_filter (short item_hit) give_error("The password must be from 0 to 30000.","",802); break; } - dialog_not_toast = FALSE; + toast_dialog(); break; } @@ -2686,8 +2665,7 @@ short get_password() CDSN(802,2,0); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &town_strs_hit); + town_strs_hit = cd_run_dialog(); CDGT(802,2,(char *) temp_str); i = wd_to_pwd(temp_str); @@ -2720,10 +2698,10 @@ void set_starting_loc_filter (short item_hit) scenario.which_town_start = i; scenario.where_start.x = j; scenario.where_start.y = k; - dialog_not_toast = FALSE; + toast_dialog(); break; case 12: - dialog_not_toast = FALSE; + toast_dialog(); break; } } @@ -2740,8 +2718,7 @@ void set_starting_loc() CDSN(805,3,scenario.where_start.x); CDSN(805,4,scenario.where_start.y); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &town_strs_hit); + town_strs_hit = cd_run_dialog(); cd_kill_dialog(805,0); @@ -2787,7 +2764,7 @@ void edit_scenario_events_event_filter (short item_hit) switch (item_hit) { case 22: if (save_scenario_events() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; default: if ((item_hit >= 30) && (item_hit <= 39)) { @@ -2822,8 +2799,7 @@ void edit_scenario_events() put_scenario_events_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &advanced_town_hit); + advanced_town_hit = cd_run_dialog(); cd_kill_dialog(811,0); } @@ -2836,7 +2812,7 @@ void give_password_filter (short item_hit) switch (item_hit) { default: - dialog_not_toast = FALSE; + toast_dialog(); break; } @@ -2852,8 +2828,7 @@ short enter_password() CDSN(823,2,0); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &town_strs_hit); + town_strs_hit = cd_run_dialog(); CDGT(823,2,(char *) temp_str); i = wd_to_pwd(temp_str); diff --git a/osx/Scenario Editor/sound.c b/osx/Scenario Editor/sound.c deleted file mode 100644 index e9b47104..00000000 --- a/osx/Scenario Editor/sound.c +++ /dev/null @@ -1,181 +0,0 @@ -#include "math.h" - -#include - -#include "sound.h" -#include "global.h" - -#define NUM_SOUNDS 99 - -Handle sound_handles[NUM_SOUNDS]; - -extern Boolean play_sounds,in_startup_mode; -extern WindowPtr mainPtr; -extern Boolean gInBackground; -extern party_record_type party; - -short last_played = 10000; - -Boolean always_asynch[100] = {FALSE,FALSE,FALSE,FALSE,FALSE, - FALSE,TRUE,FALSE,FALSE,FALSE, - FALSE,FALSE,FALSE,FALSE,FALSE, // 10 - FALSE,FALSE,FALSE,FALSE,FALSE, - FALSE,FALSE,FALSE,FALSE,TRUE, // 20 - TRUE,FALSE,FALSE,FALSE,FALSE, - FALSE,FALSE,FALSE,FALSE,TRUE, // 30 - FALSE,FALSE,TRUE,FALSE,TRUE, - FALSE,TRUE,TRUE,TRUE,TRUE, // 40 - TRUE,TRUE,TRUE,TRUE,TRUE, - TRUE,FALSE,FALSE,FALSE,FALSE, // 50 - TRUE,FALSE,FALSE,FALSE,FALSE, - FALSE,TRUE,FALSE,FALSE,FALSE, // 60 - FALSE,FALSE,FALSE,FALSE,FALSE, - FALSE,FALSE,FALSE,FALSE,FALSE, // 70 - FALSE,TRUE,TRUE,TRUE,TRUE, - TRUE,TRUE,TRUE,TRUE,FALSE, // 80 - TRUE,FALSE,FALSE,FALSE,FALSE, - FALSE,TRUE,FALSE,FALSE,FALSE, // 90 - FALSE,FALSE,FALSE,FALSE,FALSE}; -Boolean load_when_play[100] = { -0,0,1,1,1,1,0,1,1,1, -0,0,0,1,0,1,1,1,1,1, -1,1,1,1,1,1,1,0,1,1, -1,1,1,1,0,1,1,0,1,1, -1,1,1,1,1,1,1,0,0,0, -0,1,1,1,1,0,1,1,1,1, -1,0,1,1,1,1,1,1,1,0, -0,0,0,0,0,0,1,1,1,1, -1,1,1,1,1,0,0,0,0,0, -1,1,1,1,1,1,1,1,1,0 -}; - - - -short sound_delay[100] = {0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,25,25,0,0,0,0, - 0,0,0,0,8,0,0,8,0,0, - 0,0,0,10,20,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,13,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0 - }; -//Allocate SndChannelPtr chan[4] as a global variable. -//Allocate char numchannel = 3; (This gives 4 channels, = 2 gives 3 etc... -//Allocate char channel; This is just used as a counter so each sound is played by the next -//channel in line. You can have up to 4 sounds playing at once. - -SndChannelPtr chan[4]; -char numchannel = 3; -char channel; - -void load_sounds () -{ - short i,t; - - for (i = 0; i < NUM_SOUNDS; i++) { - load_when_play[i] = TRUE; - always_asynch[i] = FALSE; - if (load_when_play[i] == FALSE) { - sound_handles[i] = GetResource('snd ', 20000 + i); - } - } - - for(t=0;t<4;t++)/****** setup 4 sound channels **********/ - { - SndNewChannel(&chan[t], sampledSynth, initMono + initNoDrop, NIL); - chan[t]->qLength = 128; - } - -} - -void play_sound(short which) // if < 0, play asynch -{ - if (play_sounds == TRUE) - force_play_sound(which); -} - -/* -sound(id) -int id; -{ - Boolean secondtry = FALSE; - - channel++; - - if (channel > numchannel) channel = 0; - - sndhandle = NIL; - sndhandle = GetResource('snd ',abs(id)); - - if (sndhandle != NIL) - { - HLock(sndhandle); - HNoPurge(sndhandle); - - if (id > 0) SndPlay(chan[channel],sndhandle,TRUE);/****** Normal SndPlay *****/ -/* else SndPlay(chan[channel],sndhandle,FALSE);/****** play ASYNC *****/ -/* } -} -*/ - -void force_play_sound(short which) -{ - Handle sndhandle; - unsigned long dummy; - OSErr err; - -// if (play_sounds == TRUE) -// SndPlay(NIL, sound_handles[which], TRUE); - -// if (play_sounds == TRUE) { - channel++; - - if (channel > numchannel) channel = 0; - - if (load_when_play[((which < 0) ? -1 * which : which)] == TRUE) - sndhandle = GetResource('snd ',20000 + ((which < 0) ? -1 * which : which)); - else sndhandle = sound_handles[((which < 0) ? -1 * which : which)]; - - if (which > 0) - if (always_asynch[which] == TRUE) - which = which * -1; - - if (sndhandle != NIL) - { - HLock(sndhandle); - - if (which < 0) err = SndPlay(chan[channel],(SndListHandle) sndhandle,TRUE);/****** Normal SndPlay *****/ - else { - err = SndPlay(chan[channel],(SndListHandle) sndhandle,FALSE); - } - if (err != 0) { - } - HUnlock(sndhandle); - } - else SysBeep(2); - if (which < 0) - Delay(sound_delay[-1 * which],&dummy); -// } -} - -void one_sound(short which) -{ - if (which == last_played) - return; - play_sound(which); - last_played = which; -} - -void clear_sound_memory() -{ - last_played = 100; -} - -void flip_sound() -{ - play_sounds = (play_sounds == TRUE) ? FALSE : TRUE; -} - diff --git a/osx/Scenario Editor/sound.h b/osx/Scenario Editor/sound.h deleted file mode 100644 index bfdc42e6..00000000 --- a/osx/Scenario Editor/sound.h +++ /dev/null @@ -1,6 +0,0 @@ -void flip_sound(); -void clear_sound_memory(); -void one_sound(short which); -void force_play_sound(short which); -void play_sound(short which); -void load_sounds (); \ No newline at end of file diff --git a/osx/Scenario Editor/tGraphics.c b/osx/Scenario Editor/tGraphics.c index b44b7960..0371baac 100644 --- a/osx/Scenario Editor/tGraphics.c +++ b/osx/Scenario Editor/tGraphics.c @@ -3,11 +3,17 @@ #include "stdio.h" #include "string.h" #include "global.h" +#include "graphtool.h" #include "tGraphics.h" #include "math.h" -#include "dlogtool.h" +#include "dlgtool.h" #include "keydlgs.h" -#include "sound.h" +#include "soundtool.h" +#include "mathutil.h" + +#include "keydlgs.h" +#include "scenario.h" +#include "townout.h" void load_main_screen(); void load_terrain_template(); @@ -51,14 +57,27 @@ extern Boolean left_buttons_active,right_buttons_active; extern short left_button_status[NLS]; // 0 - clear, 1 - text, 2 - title text, +10 - button extern short right_button_status[NRS]; extern unsigned char m_pic_index[200]; -extern char *button_strs[140]; +extern btn_t buttons[]; extern location cur_out; short num_ir[3] = {12,10,4}; -GWorldPtr monst_gworld[10],terrain_gworld[7],small_terrain_gworld,editor_mixed,terrain_buttons_gworld; -GWorldPtr anim_gworld,field_gworld,dialog_gworld,items_gworld,tiny_obj_gworld,small_ter_gworld; -GWorldPtr spec_scen_g = NULL,dlg_buttons_gworld[NUM_BUTTONS][2],ter_draw_gworld,dlogpics_gworld,talkfaces_gworld,mixed_gworld; +GWorldPtr monst_gworld[10]; +GWorldPtr terrain_gworld[7]; +GWorldPtr editor_mixed; +GWorldPtr terrain_buttons_gworld; +GWorldPtr anim_gworld; +GWorldPtr field_gworld; +GWorldPtr dialog_gworld; +GWorldPtr items_gworld; +GWorldPtr tiny_obj_gworld; +GWorldPtr small_ter_gworld; +GWorldPtr spec_scen_g = NULL; +//GWorldPtr dlg_buttons_gworld[NUM_BUTTONS][2] +GWorldPtr ter_draw_gworld; +GWorldPtr dlogpics_gworld; +GWorldPtr talkfaces_gworld; +GWorldPtr mixed_gworld; PixPatHandle bg[14]; PixPatHandle map_pat[25]; short small_icons[24] = {0,23,37,38,39,35,33,34,30,0, @@ -109,6 +128,88 @@ short map_pats[220] = {50,50,1,1,1,6,6,6,6,6, unsigned char small_what_drawn[64][64]; extern Boolean small_any_drawn; +void init_dialogs(){ + cd_init_dialogs( + &anim_gworld, + &talkfaces_gworld, + &items_gworld, + &tiny_obj_gworld, + NULL, // &pc_gworld + &dlogpics_gworld, + monst_gworld, // don't take address because it's already an array. + terrain_gworld, // ditto + &small_ter_gworld, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + &spec_scen_g + ); + // switch (wind_hit) { + // case -1: break; + // //case 958: _event_filter(item_hit); break; + cd_register_event_filter(970,display_strings_event_filter); + cd_register_event_filter(971,display_strings_event_filter); + cd_register_event_filter(972,display_strings_event_filter); + cd_register_event_filter(973,display_strings_event_filter); + cd_register_event_filter(800,edit_make_scen_1_event_filter); + cd_register_event_filter(801,edit_make_scen_2_event_filter); + cd_register_event_filter(802,user_password_filter); + cd_register_event_filter(803,edit_scen_details_event_filter); + cd_register_event_filter(804,edit_scen_intro_event_filter); + cd_register_event_filter(805,set_starting_loc_filter); + cd_register_event_filter(806,edit_spec_item_event_filter); + cd_register_event_filter(807,edit_save_rects_event_filter); + cd_register_event_filter(808,edit_horses_event_filter); + cd_register_event_filter(809,edit_boats_event_filter); + cd_register_event_filter(810,edit_add_town_event_filter); + cd_register_event_filter(811,edit_scenario_events_event_filter); + cd_register_event_filter(812,edit_item_placement_event_filter); + cd_register_event_filter(813,edit_ter_type_event_filter); + cd_register_event_filter(814,edit_monst_type_event_filter); + cd_register_event_filter(815,edit_monst_abil_event_filter); + cd_register_event_filter(816,edit_text_event_filter); + cd_register_event_filter(817,edit_talk_node_event_filter); + cd_register_event_filter(818,edit_item_type_event_filter); + cd_register_event_filter(819,choose_graphic_event_filter); + cd_register_event_filter(820,choose_text_res_event_filter); + cd_register_event_filter(821,edit_basic_dlog_event_filter); + cd_register_event_filter(822,edit_spec_enc_event_filter); + cd_register_event_filter(823,give_password_filter); + cd_register_event_filter(824,edit_item_abil_event_filter); + cd_register_event_filter(825,edit_special_num_event_filter); + cd_register_event_filter(826,edit_spec_text_event_filter); + cd_register_event_filter(830,new_town_event_filter); + cd_register_event_filter(831,edit_sign_event_filter); + cd_register_event_filter(832,edit_town_details_event_filter); + cd_register_event_filter(833,edit_town_events_event_filter); + cd_register_event_filter(834,edit_advanced_town_event_filter); + cd_register_event_filter(835,edit_town_wand_event_filter); + cd_register_event_filter(836,edit_placed_item_event_filter); + cd_register_event_filter(837,edit_placed_monst_event_filter); + cd_register_event_filter(838,edit_placed_monst_adv_event_filter); + cd_register_event_filter(839,edit_town_strs_event_filter); + cd_register_event_filter(840,edit_area_rect_event_filter); + cd_register_event_filter(841,pick_import_town_event_filter); + cd_register_event_filter(842,edit_dialog_text_event_filter); + cd_register_event_filter(850,edit_out_strs_event_filter); + cd_register_event_filter(851,outdoor_details_event_filter); + cd_register_event_filter(852,edit_out_wand_event_filter); + cd_register_event_filter(854,pick_out_event_filter); + cd_register_event_filter(855,pick_town_num_event_filter); + cd_register_event_filter(856,pick_town_num_event_filter); + cd_register_event_filter(857,change_ter_event_filter); + cd_register_default_event_filter(fancy_choice_dialog_event_filter); + //return tmp; +} + void Set_up_win () { short i,j; @@ -167,6 +268,31 @@ void run_startup_g() } +void load_graphics(){ + int i; + //for (i = 0; i < NUM_BUTTONS; i++) + // for (j = 0; j < 2; j++) + // dlg_buttons_gworld[i][j] = load_pict(2000 + (2 * i) + j); // move to dlogtool + for (i = 0; i < 14; i++) + bg[i] = GetPixPat (128 + i); + for (i = 0; i < 25; i++) + map_pat[i] = GetPixPat (200 + i); + + for (i = 0; i < 10; i++) + monst_gworld[i] = load_pict(1100 + i); + for (i = 0; i < 7; i++) + terrain_gworld[i] = load_pict(800 + i); + editor_mixed = load_pict(906); + anim_gworld = load_pict(820); + field_gworld = load_pict(821); + talkfaces_gworld = load_pict(860); + items_gworld = load_pict(901); + tiny_obj_gworld = load_pict(900); + dlogpics_gworld = load_pict(850); + small_ter_gworld = load_pict(904); + mixed_gworld = load_pict(903); +} + void load_main_screen() { Str255 fn1 = "\pGeneva"; @@ -181,38 +307,16 @@ void load_main_screen() if (dungeon_font_num == 0) GetFNum(fn3,&dungeon_font_num); - NewGWorld(&terrain_buttons_gworld, 0,&terrain_buttons_rect, NIL, NIL, 0); + NewGWorld(&terrain_buttons_gworld, 0,&terrain_buttons_rect, NULL, NULL, kNativeEndianPixMap); SetPort( terrain_buttons_gworld); TextFont(geneva_font_num); TextSize(10); TextFace(bold); SetPortWindowPort(mainPtr); - NewGWorld(&ter_draw_gworld, 0,&terrain_rect, NIL, NIL, 0); + NewGWorld(&ter_draw_gworld, 0,&terrain_rect, NULL, NULL, kNativeEndianPixMap); world_screen = terrain_rect; OffsetRect(&world_screen,TER_RECT_UL_X,TER_RECT_UL_Y); - for (i = 0; i < NUM_BUTTONS; i++) - for (j = 0; j < 2; j++) - dlg_buttons_gworld[i][j] = load_pict(2000 + (2 * i) + j); - for (i = 0; i < 14; i++) - bg[i] = GetPixPat (128 + i); - for (i = 0; i < 25; i++) - map_pat[i] = GetPixPat (200 + i); - - for (i = 0; i < 10; i++) - monst_gworld[i] = load_pict(1100 + i); - for (i = 0; i < 7; i++) - terrain_gworld[i] = load_pict(800 + i); - small_terrain_gworld = load_pict(904); - editor_mixed = load_pict(906); - anim_gworld = load_pict(820); - field_gworld = load_pict(821); - talkfaces_gworld = load_pict(860); - items_gworld = load_pict(901); - tiny_obj_gworld = load_pict(900); - dlogpics_gworld = load_pict(850); - small_ter_gworld = load_pict(904); - mixed_gworld = load_pict(903); //draw_main_screen(); } @@ -307,7 +411,7 @@ void draw_lb_slot (short which,short mode) else OffsetRect(&text_rect,0,2); if (mode > 0) ForeColor(blueColor); - char_win_draw_string(mainPtr,text_rect,(char *)data_store->strings_ls[which],0,12); + char_win_draw_string(mainPtr,text_rect,(char *)data_store->strings_ls[which],0,12,true); ForeColor(blackColor); //char_win_draw_string(mainPtr,text_rect,"FIsh.",1,12); @@ -341,7 +445,7 @@ void draw_rb_slot (short which,short mode) if (mode > 0) ForeColor(redColor); - char_win_draw_string(mainPtr,text_rect,(char *)data_store->strings_rs[which],0,12); + char_win_draw_string(mainPtr,text_rect,(char *)data_store->strings_rs[which],0,12,true); ForeColor(blackColor); TextSize(10); TextFace(bold); @@ -425,163 +529,30 @@ void set_up_terrain_buttons() SetPortWindowPort(mainPtr); } -unsigned short readUShort(unsigned char ** ptr) -{ - unsigned short ret = CFSwapInt16LittleToHost(*(unsigned short*)*ptr); - *ptr += 2; - return ret; -} -unsigned int readUInt(unsigned char **ptr) -{ - unsigned int ret = CFSwapInt32LittleToHost(*(unsigned int*)*ptr); - *ptr += 4; - return ret; -} - -GWorldPtr load_bmp(unsigned char *data, long length) -{ - - if (length < 54) { - return NULL; // Too short for headers - } - unsigned char * cur = data + 10; - unsigned int offset = readUInt(&cur); - cur+=4; - unsigned int width = readUInt(&cur); - unsigned int height = readUInt(&cur); - cur += 2; - unsigned short bitCount = readUShort(&cur); - cur+=24; - int indexed; - unsigned int colourTable[256]; - int i; - if (bitCount == 8) { - if (length < 54 + 256 * 4) { - return NULL; - } - for (i = 0; i<256; ++i) { - unsigned char blue = *cur++; - unsigned char green = *cur++; - unsigned char red = *cur++; - cur++; - colourTable[i] = (red << 16) + (green << 8) + blue; - } - indexed = TRUE; - } - else if (bitCount == 24) { - indexed = FALSE; - } - else { - return NULL; - } - - int bmppadding = (width * bitCount / 8) % 4; - if (bmppadding != 0) { - bmppadding = 4 - bmppadding; - } - - if (length < offset + height * (bmppadding + width * bitCount / 8)) { - return NULL; - } - - cur = data + offset; - - GWorldPtr newGWorld; - Rect picRext = {0, 0, height, width}; - NewGWorld(&newGWorld,32,&picRext,NULL,NULL,0); - if (newGWorld == NULL) { - return NULL; - } - - PixMapHandle pixMap = GetGWorldPixMap(newGWorld); - LockPixels(pixMap); - unsigned int * picBuf = (unsigned int*) GetPixBaseAddr(pixMap); - int pixrow = ((*pixMap)->rowBytes & 0x3FFF) / 4; - - int j; - for (i = height - 1; i>= 0 ; --i) { - for (j=0; j= 60) return; OffsetRect(&boat_rect[0],61,0); - + if (cur_viewing_mode == 0) { - SetPort( ter_draw_gworld); - FillCRect(&terrain_rect,bg[6]); - FrameRect(&terrain_rect); - SetPortWindowPort(mainPtr); - for (q = 0; q < 9; q++) - for (r = 0; r < 9; r++) + SetPort( ter_draw_gworld); + FillCRect(&terrain_rect,bg[6]); + FrameRect(&terrain_rect); + SetPortWindowPort(mainPtr); + for (q = 0; q < 9; q++) + for (r = 0; r < 9; r++) { - where_draw.x = q; where_draw.y = r; - if (editing_town == TRUE) { - t_to_draw = t_d.terrain[cen_x + q - 4][cen_y + r - 4]; + where_draw.x = q; where_draw.y = r; + if (editing_town == TRUE) { + t_to_draw = t_d.terrain[cen_x + q - 4][cen_y + r - 4]; } else { if (cen_x + q - 4 == -1) @@ -593,45 +564,45 @@ void draw_terrain() else if (cen_y + r - 4 == 48) t_to_draw = borders[2][cen_x + q - 4]; else t_to_draw = current_terrain.terrain[cen_x + q - 4][cen_y + r - 4]; - } - draw_one_terrain_spot(q,r,t_to_draw); - which_pt.x = cen_x + q - 4; - which_pt.y =cen_y + r - 4; - - tiny_to = tiny_to_base; - OffsetRect(&tiny_to,28 * q, 36 * r); - - // draw start icon, if starting point - if ((editing_town == TRUE) && - (cur_town == scenario.which_town_start) && (scenario.where_start.x == cen_x + q - 4) - && (scenario.where_start.y == cen_y + r - 4)) { - from_rect = start_button_from; - to_rect = tiny_to; - to_rect.left -= 14; - rect_draw_some_item(editor_mixed,from_rect,ter_draw_gworld,to_rect,0,0); - OffsetRect(&tiny_to,0,-7); } - if ((editing_town == FALSE) - && (scenario.out_sec_start.x == cur_out.x) - && (scenario.out_sec_start.y == cur_out.y) - && (scenario.out_start.x == cen_x + q - 4) - && (scenario.out_start.y == cen_y + r - 4)) { - from_rect = start_button_from; - to_rect = tiny_to; - to_rect.left -= 14; - rect_draw_some_item(editor_mixed,from_rect,ter_draw_gworld,to_rect,0,0); - OffsetRect(&tiny_to,0,-7); + draw_one_terrain_spot(q,r,t_to_draw); + which_pt.x = cen_x + q - 4; + which_pt.y =cen_y + r - 4; + + tiny_to = tiny_to_base; + OffsetRect(&tiny_to,28 * q, 36 * r); + + // draw start icon, if starting point + if ((editing_town == TRUE) && + (cur_town == scenario.which_town_start) && (scenario.where_start.x == cen_x + q - 4) + && (scenario.where_start.y == cen_y + r - 4)) { + from_rect = start_button_from; + to_rect = tiny_to; + to_rect.left -= 14; + rect_draw_some_item(editor_mixed,from_rect,ter_draw_gworld,to_rect,0,0); + OffsetRect(&tiny_to,0,-7); } - small_i = small_icons[scenario.ter_types[t_to_draw].special]; - if ((small_i == 30) && (scenario.ter_types[t_to_draw].flag2 >= 5)) - small_i = 31; - if ((small_i == 31) && (scenario.ter_types[t_to_draw].flag2 == 10)) - small_i = 32; - tiny_from = base_small_button_from; - OffsetRect(&tiny_from,7 * (small_i % 10),7 * (small_i / 10)); - if (small_i > 0) { - rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); - OffsetRect(&tiny_to,0,-7); + if ((editing_town == FALSE) + && (scenario.out_sec_start.x == cur_out.x) + && (scenario.out_sec_start.y == cur_out.y) + && (scenario.out_start.x == cen_x + q - 4) + && (scenario.out_start.y == cen_y + r - 4)) { + from_rect = start_button_from; + to_rect = tiny_to; + to_rect.left -= 14; + rect_draw_some_item(editor_mixed,from_rect,ter_draw_gworld,to_rect,0,0); + OffsetRect(&tiny_to,0,-7); + } + small_i = small_icons[scenario.ter_types[t_to_draw].special]; + if ((small_i == 30) && (scenario.ter_types[t_to_draw].flag2 >= 5)) + small_i = 31; + if ((small_i == 31) && (scenario.ter_types[t_to_draw].flag2 == 10)) + small_i = 32; + tiny_from = base_small_button_from; + OffsetRect(&tiny_from,7 * (small_i % 10),7 * (small_i / 10)); + if (small_i > 0) { + rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); + OffsetRect(&tiny_to,0,-7); } if (is_special(cen_x + q - 4,cen_y + r - 4) == TRUE) { @@ -639,13 +610,13 @@ void draw_terrain() OffsetRect(&tiny_from,7 * (7),7 * (0)); rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); OffsetRect(&tiny_to,0,-7); - } + } if ((t_to_draw == 7) || (t_to_draw == 10) || (t_to_draw == 13) || (t_to_draw == 16)) { tiny_from = base_small_button_from; OffsetRect(&tiny_from,7 * (3),7 * (2)); rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); OffsetRect(&tiny_to,0,-7); - } + } //if (is_s_d(cen_x + q - 4,cen_y + r - 4) == TRUE) { // } if (editing_town == FALSE) { @@ -657,18 +628,18 @@ void draw_terrain() rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); OffsetRect(&tiny_to,0,-7); i = 4; - } - - } + } + } + if (editing_town == TRUE) { for (i = 0; i < 30; i++) { if ((scenario.scen_boats[i].which_town == cur_town) && (scenario.scen_boats[i].boat_loc.x == cen_x + q - 4) && (scenario.scen_boats[i].boat_loc.y == cen_y + r - 4)) - Draw_Some_Item(mixed_gworld,boat_rect[0],ter_draw_gworld,where_draw,1,0); - - } + Draw_Some_Item(mixed_gworld,boat_rect[0],ter_draw_gworld,where_draw,1,0); + + } for (i = 0; i < 30; i++) { source_rect = boat_rect[0]; OffsetRect(&source_rect,0,74); @@ -676,9 +647,9 @@ void draw_terrain() if ((scenario.scen_horses[i].which_town == cur_town) && (scenario.scen_horses[i].horse_loc.x == cen_x + q - 4) && (scenario.scen_horses[i].horse_loc.y == cen_y + r - 4)) - Draw_Some_Item(mixed_gworld,source_rect,ter_draw_gworld,where_draw,1,0); - - } + Draw_Some_Item(mixed_gworld,source_rect,ter_draw_gworld,where_draw,1,0); + + } for (i = 0; i < 4; i++) if ((cen_x + q - 4 == town.start_locs[i].x) && (cen_y + r - 4 == town.start_locs[i].y)) { @@ -686,7 +657,7 @@ void draw_terrain() OffsetRect(&tiny_from,7 * (6 + i),7 * (1)); rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); OffsetRect(&tiny_to,0,-7); - } + } for (i = 0; i < 4; i++) if ((cen_x + q - 4 == town.wandering_locs[i].x) && (cen_y + r - 4 == town.wandering_locs[i].y)) { @@ -695,68 +666,68 @@ void draw_terrain() rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); OffsetRect(&tiny_to,0,-7); i = 4; - } + } if (is_web(cen_x + q - 4,cen_y + r - 4) == TRUE) { from_rect = calc_rect(5,0); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); - } + } if (is_crate(cen_x + q - 4,cen_y + r - 4) == TRUE) { from_rect = calc_rect(6,0); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); - } + } if (is_barrel(cen_x + q - 4,cen_y + r - 4) == TRUE) { from_rect = calc_rect(7,0); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); - } + } if (is_fire_barrier(cen_x + q - 4,cen_y + r - 4) == TRUE) { from_rect = calc_rect(0,2); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); - } + } if (is_quickfire(cen_x + q - 4,cen_y + r - 4) == TRUE) { from_rect = calc_rect(7,1); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); - } + } if (is_force_barrier(cen_x + q - 4,cen_y + r - 4) == TRUE) { from_rect = calc_rect(2,2); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); - } + } for (i = 0; i < 8; i++) if (is_sfx(cen_x + q - 4,cen_y + r - 4,i)) { from_rect = calc_rect(i,3); Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); - } + } for (x = 0; x < 64; x++) if ((cen_x + q - 4 == town.preset_items[x].item_loc.x) && - (cen_y + r - 4 == town.preset_items[x].item_loc.y) && (town.preset_items[x].item_code >= 0)) { - } + (cen_y + r - 4 == town.preset_items[x].item_loc.y) && (town.preset_items[x].item_code >= 0)) { + } for (x = 0; x < 60; x++) if ((cen_x + q - 4 == t_d.creatures[x].start_loc.x) && - (cen_y + r - 4 == t_d.creatures[x].start_loc.y) && (t_d.creatures[x].number != 0)) { - } - - } + (cen_y + r - 4 == t_d.creatures[x].start_loc.y) && (t_d.creatures[x].number != 0)) { + } + } - if (editing_town == TRUE) { - draw_monsts(); - draw_items(); + } + if (editing_town == TRUE) { + draw_monsts(); + draw_items(); } - SetPort( ter_draw_gworld); - ClipRect(&clipping_rect); - - if (editing_town == TRUE) { - // draw info rects - for (i = 0; i < 16; i++) - if (t_d.room_rect[i].left > 0) { - draw_rect.left = 22 + 28 * (t_d.room_rect[i].left - cen_x + 4); - draw_rect.right = 22 + 28 * (t_d.room_rect[i].right - cen_x + 4); - draw_rect.top = 24 + 36 * (t_d.room_rect[i].top - cen_y + 4); - draw_rect.bottom = 24 + 36 * (t_d.room_rect[i].bottom - cen_y + 4); - ForeColor(redColor); - FrameRect(&draw_rect); - ForeColor(blackColor); + SetPort( ter_draw_gworld); + ClipRect(&clipping_rect); + + if (editing_town == TRUE) { + // draw info rects + for (i = 0; i < 16; i++) + if (t_d.room_rect[i].left > 0) { + draw_rect.left = 22 + 28 * (t_d.room_rect[i].left - cen_x + 4); + draw_rect.right = 22 + 28 * (t_d.room_rect[i].right - cen_x + 4); + draw_rect.top = 24 + 36 * (t_d.room_rect[i].top - cen_y + 4); + draw_rect.bottom = 24 + 36 * (t_d.room_rect[i].bottom - cen_y + 4); + ForeColor(redColor); + FrameRect(&draw_rect); + ForeColor(blackColor); } - // draw border rect + // draw border rect draw_rect.left = 21 + 28 * (town.in_town_rect.left - cen_x + 4); draw_rect.right = 21 + 28 * (town.in_town_rect.right - cen_x + 4); draw_rect.top = 25 + 36 * (town.in_town_rect.top - cen_y + 4); @@ -765,25 +736,25 @@ void draw_terrain() FrameRect(&draw_rect); ForeColor(blackColor); } - if (editing_town == FALSE) { - // draw info rects - for (i = 0; i < 8; i++) - if (current_terrain.info_rect[i].left > 0) { - draw_rect.left = 22 + 28 * (current_terrain.info_rect[i].left - cen_x + 4); - draw_rect.right = 22 + 28 * (current_terrain.info_rect[i].right - cen_x + 4); - draw_rect.top = 24 + 36 * (current_terrain.info_rect[i].top - cen_y + 4); - draw_rect.bottom = 24 + 36 * (current_terrain.info_rect[i].bottom - cen_y + 4); - ForeColor(redColor); - FrameRect(&draw_rect); - ForeColor(blackColor); + if (editing_town == FALSE) { + // draw info rects + for (i = 0; i < 8; i++) + if (current_terrain.info_rect[i].left > 0) { + draw_rect.left = 22 + 28 * (current_terrain.info_rect[i].left - cen_x + 4); + draw_rect.right = 22 + 28 * (current_terrain.info_rect[i].right - cen_x + 4); + draw_rect.top = 24 + 36 * (current_terrain.info_rect[i].top - cen_y + 4); + draw_rect.bottom = 24 + 36 * (current_terrain.info_rect[i].bottom - cen_y + 4); + ForeColor(redColor); + FrameRect(&draw_rect); + ForeColor(blackColor); } } - ClipRect(&terrain_rect); - SetPortWindowPort(mainPtr); - - small_any_drawn = FALSE; - //if (cur_viewing_mode == 0) - // draw_frames(); + ClipRect(&terrain_rect); + SetPortWindowPort(mainPtr); + + small_any_drawn = FALSE; + //if (cur_viewing_mode == 0) + // draw_frames(); } if (cur_viewing_mode == 1) { @@ -791,19 +762,19 @@ void draw_terrain() if (small_any_drawn == FALSE) { FillCRect(&terrain_rect,bg[6]); FrameRect(&terrain_rect); - } + } for (q = 0; q < ((editing_town == TRUE) ? max_dim[town_type] : 48); q++) for (r = 0; r < ((editing_town == TRUE) ? max_dim[town_type] : 48); r++) { t_to_draw = (editing_town == TRUE) ? t_d.terrain[q][r] : - current_terrain.terrain[q][r]; + current_terrain.terrain[q][r]; if ((small_what_drawn[q][r] != t_to_draw) || (small_any_drawn == FALSE)) { draw_one_tiny_terrain_spot(q,r,t_to_draw); small_what_drawn[q][r] = t_to_draw; - } + } } SetPortWindowPort(mainPtr); small_any_drawn = TRUE; - } + } //draw_cur_string(); place_location(); @@ -1047,63 +1018,6 @@ BitMap store_dest; } -void rect_draw_some_item (GWorldPtr src_gworld,Rect src_rect,GWorldPtr targ_gworld,Rect targ_rect, -char masked,short main_win) - -{ - Rect destrec; - PixMapHandle test1, test2; - const BitMap * store_dest; - GrafPtr cur_port; - RGBColor store_color; - - if (main_win == 2) { - GetBackColor(&store_color); - BackColor(whiteColor); - } - - GetPort(&cur_port); - store_dest = GetPortBitMapForCopyBits(cur_port); - - test1 = GetPortPixMap(src_gworld); - - LockPixels(test1); - if (main_win == 0) { - test2 = GetPortPixMap(targ_gworld); - LockPixels(test2); - if (masked == 1) - CopyBits ( (BitMap*)* test1 , - (BitMap*)*test2 , - &src_rect, &targ_rect, - transparent , NULL); - else CopyBits ( (BitMap*)* test1 , - (BitMap*)*test2 , - &src_rect, &targ_rect, - (masked == 10) ? addOver : 0, NULL); - UnlockPixels(test2); - } - else { - if (masked == 1) - CopyBits ( (BitMap*)*test1 , - store_dest , - &src_rect, &targ_rect, - transparent , NULL); - else CopyBits ((BitMap*) *test1 , - store_dest , - &src_rect, &targ_rect, - (masked == 10) ? addOver : 0, NULL); - } - UnlockPixels(test1); - - if (main_win == 2) - RGBBackColor(&store_color); -} - - -void discard_graphics() -{ -} - /* Input terrain currently trying to draw. Get back Rect in terrain template containing desired pixmap, or Rect to darkness if desired map not present */ Rect get_template_rect (unsigned char type_wanted) @@ -1124,7 +1038,6 @@ Rect get_template_rect (unsigned char type_wanted) return store_rect; } - void draw_frames() { char q,r,i,k; @@ -1195,7 +1108,7 @@ void place_location() MoveTo(5 ,terrain_rects[255].top + 28); sprintf((char *) draw_str,"Click terrain to edit. ",cen_x,cen_y); } - c2p(draw_str); + c2pstr((char*) draw_str); DrawString(draw_str); //draw_cur_string(); @@ -1271,7 +1184,7 @@ void place_just_location() MoveTo(5 ,terrain_rects[255].top + 28); sprintf((char *) draw_str,"Click terrain to edit. ",cen_x,cen_y); } - c2p(draw_str); + c2pstr((char*) draw_str); DrawString(draw_str); SetPortWindowPort(mainPtr); @@ -1289,13 +1202,13 @@ void place_just_location() void set_string(char *string,char *string2) { strcpy((char *)current_string,string); - c2p(current_string); + c2pstr((char*) current_string); // if (strlen(string2) == 0) // current_string2[0] = 0; // else // sprintf((char *)current_string2,"Bob"); strcpy((char *)current_string2,string2); - c2p(current_string2); + c2pstr((char*) current_string2); place_location(); } @@ -1504,206 +1417,28 @@ Boolean container_there(location l) return 0; } -void char_win_draw_string(WindowPtr dest_window,Rect dest_rect,char *str,short mode,short line_height) -{ - char_port_draw_string(GetWindowPort(dest_window),dest_rect,str,mode,line_height); -} - -void char_port_draw_string(GrafPtr dest_window,Rect dest_rect,char *str,short mode,short line_height) -{ - Str255 store_s; - - strcpy((char *) store_s,str); - win_draw_string( dest_window, dest_rect,store_s, mode, line_height); - -} - -// mode: 0 - align up and left, 1 - center on one line -// str is a c string, 256 characters -// uses current font -void win_draw_string(GrafPtr dest_window,Rect dest_rect,Str255 str,short mode,short line_height) -{ - GrafPtr old_port; - Str255 p_str,str_to_draw,str_to_draw2,c_str; - Str255 null_s = " "; - short str_len,i; - short last_line_break = 0,last_word_break = 0,on_what_line = 0; - short text_len[257]; - short total_width = 0; - Boolean end_loop,force_skip = FALSE; - KeyMap key_state; - long dummy3; - RgnHandle current_clip; - short adjust_x = 0,adjust_y = 0; - - strcpy((char *) p_str,(char *) str); - strcpy((char *) c_str,(char *) str); - c2p(p_str); - for (i = 0; i < 257; i++) - text_len[i]= 0; - MeasureText(256,p_str,text_len); - str_len = (short) strlen((char *)str); - if (str_len == 0) { - return; - } - - GetPort(&old_port); - SetPort( dest_window); - - //FrameRect(&dest_rect); - - //current_clip = NewRgn(); - //GetClip(current_clip); - - dest_rect.bottom += 5; - //ClipRect(&dest_rect); - dest_rect.bottom -= 5; - - - for (i = 0; i < 257; i++) - if ((text_len[i] > total_width) && (i <= str_len)) - total_width = text_len[i]; - if ((mode == 0) && (total_width < dest_rect.right - dest_rect.left)) - mode = 2; - for (i = 0; i < 257; i++) - if ((i <= str_len) && (c_str[i] == '|') && (mode == 2)) - mode = 0; - - - switch (mode) { - case 0: - MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); - for (i = 0;text_len[i] != text_len[i + 1], i < str_len;i++) { - if (((text_len[i] - text_len[last_line_break] > (dest_rect.right - dest_rect.left - 6)) - && (last_word_break > last_line_break)) || (c_str[i] == '|')) { - if (c_str[i] == '|') { - c_str[i] = ' '; - force_skip = TRUE; - } - sprintf((char *)str_to_draw,"%s",(char *)null_s); - strncpy ((char *) str_to_draw,(char *) c_str + last_line_break,(size_t) (last_word_break - last_line_break - 1)); - sprintf((char *)str_to_draw2," %s",str_to_draw); - str_to_draw2[0] = (char) strlen((char *)str_to_draw); - DrawString(str_to_draw2); - on_what_line++; - MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); - last_line_break = last_word_break; - if (force_skip == TRUE) { - force_skip = FALSE; - i++; - last_line_break++; - last_word_break++; - } - } - if (c_str[i] == ' ') - last_word_break = i + 1; - //if (on_what_line == LINES_IN_TEXT_WIN - 1) - // i = 10000; - } - - if (i - last_line_break > 1) { - strcpy((char *)str_to_draw,(char *)null_s); - strncpy ((char *) str_to_draw,(char *) c_str + last_line_break,(size_t) (i - last_line_break)); - sprintf((char *)str_to_draw2," %s",str_to_draw); - if (strlen((char *) str_to_draw2) > 3) { - str_to_draw2[0] = (char) strlen((char *)str_to_draw); - DrawString(str_to_draw2); - } - } - break; - case 1: - MoveTo((dest_rect.right + dest_rect.left) / 2 - (4 * total_width) / 9 + adjust_x, - (dest_rect.bottom + dest_rect.top - line_height) / 2 + 9 + adjust_y); - DrawString(p_str); - break; - case 2: - MoveTo(dest_rect.left + 1 + adjust_x, - dest_rect.top + 1 + adjust_y + 9); - DrawString(p_str); - break; - case 3: - MoveTo(dest_rect.left + 1 + adjust_x, - dest_rect.top + 1 + adjust_y + 9 + (dest_rect.bottom - dest_rect.top) / 6); - DrawString(p_str); - break; - } - //SetClip(current_clip); - //DisposeRgn(current_clip); - SetPort(old_port); -} - -void c2p(Str255 str) -{ - Str255 str2; - short len; - - len = strlen((char *) str); - strcpy((char *) str2,(char *) str); - str[0] = (unsigned char) len; - strncpy((char *) (str + 1), (char *) str2,len); -} - -void p2c(Str255 str) -{ - Str255 str2; - short len; - - len = (short) str[0]; - strncpy((char *) str2,(char *) (str + 1), len); - str2[len] = 0; - strcpy((char *) str,(char *) str2); -} - void get_str(Str255 str,short i, short j) { if (i == -1) { strcpy((char *) str,data_store->scen_item_list.monst_names[j]); return; - } + } if (i == -2) { strcpy((char *) str,data_store->scen_item_list.scen_items[j].full_name); return; - } + } if (i == -3) { - strcpy((char *) str,button_strs[available_dlog_buttons[j]]); + strcpy((char *) str,buttons[available_dlog_buttons[j]].str); return; - } + } if (i == -4) { strcpy((char *) str,data_store->scen_item_list.ter_names[j]); return; - } + } if (i == -5) { get_str(str,40,j * 7 + 1); return; - } + } GetIndString(str, i, j); - p2c(str); -} - -short string_length(char *str) -{ - short text_len[257]; - short total_width = 0,i,len; - Str255 p_str; - - for (i = 0; i < 257; i++) - text_len[i]= 0; - - strcpy((char *) p_str,str); - c2p(p_str); - MeasureText(256,p_str,text_len); - len = strlen((char *)str); - - for (i = 0; i < 257; i++) - if ((text_len[i] > total_width) && (i <= len)) - total_width = text_len[i]; - return total_width; -} - -Rect get_custom_rect (short which_rect) //// -{ - Rect store_rect = {0,0,36,28}; - - OffsetRect(&store_rect,28 * (which_rect % 10),36 * (which_rect / 10)); - return store_rect; + p2cstr(str); } \ No newline at end of file diff --git a/osx/Scenario Editor/tGraphics.h b/osx/Scenario Editor/tGraphics.h index 0aa90bcf..3b4d7af2 100644 --- a/osx/Scenario Editor/tGraphics.h +++ b/osx/Scenario Editor/tGraphics.h @@ -1,8 +1,9 @@ -void Set_up_win (); +void Set_up_win (); void run_startup_g(); -void load_main_screen(); -void draw_main_screen(); -void redraw_screen(); +void load_graphics(); +void load_main_screen(); +void draw_main_screen(); +void redraw_screen(); void draw_lb(); void draw_lb_slot (short which,short mode) ; void draw_rb(); @@ -19,8 +20,7 @@ void draw_one_terrain_spot (short i,short j,unsigned char terrain_to_draw); void draw_one_tiny_terrain_spot (short i,short j,unsigned char 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); +//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); void draw_frames(); void place_location(); @@ -56,12 +56,8 @@ Boolean is_quickfire(short i,short j); void make_quickfire(short i,short j); void take_quickfire(short i,short j); Boolean container_there(location l); -void char_win_draw_string(WindowPtr dest_window,Rect dest_rect,char *str,short mode,short line_height); -void char_port_draw_string(GrafPtr dest_window,Rect dest_rect,char *str,short mode,short line_height); -void win_draw_string(GrafPtr dest_window,Rect dest_rect,Str255 str,short mode,short line_height); -void c2p(Str255 str) ; -void p2c(Str255 str); void get_str(Str255 str,short i, short j); short string_length(char *str); Rect get_custom_rect (short which_rect); -GWorldPtr load_bmp(unsigned char *data, long length); \ No newline at end of file +GWorldPtr load_bmp(unsigned char *data, long length); +void init_dialogs(); \ No newline at end of file diff --git a/osx/Scenario Editor/tactions.c b/osx/Scenario Editor/tactions.c index 9c4e5b31..af7a0814 100644 --- a/osx/Scenario Editor/tactions.c +++ b/osx/Scenario Editor/tactions.c @@ -3,14 +3,17 @@ #include #include #include "Global.h" +#include "graphtool.h" #include "tGraphics.h" #include "dialogutils.h" #include "tactions.h" -#include "sound.h" +#include "soundtool.h" #include "scenario.h" #include "tfileio.h" #include "keydlgs.h" #include "townout.h" +#include "mathutil.h" +#include "loc_utils.h" #include "buttonmg.h" @@ -2807,132 +2810,6 @@ void adjust_space(location l) } -Boolean is_lava(short x,short y) -{ - if ((coord_to_ter(x,y) == 75) || (coord_to_ter(x,y) == 76)) - return TRUE; - else return FALSE; -} - -unsigned char coord_to_ter(short x,short y) -{ - unsigned char what_terrain; - - if (editing_town == TRUE) - what_terrain = t_d.terrain[x][y]; - else what_terrain = current_terrain.terrain[x][y]; - - return what_terrain; -} - -short get_obscurity(short x,short y) -{ - unsigned char what_terrain; - short store; - - what_terrain = coord_to_ter(x,y); - - store = scenario.ter_types[what_terrain].blockage; - if ((store == 1) || (store == 5)) - return 5; - if (store == 4) - return 1; - return 0; -} - - -short can_see(location p1,location p2,short mode) -//mode; // 0 - normal 1 - counts 1 for blocked spaces or lava (used for party placement in - // town combat) - // 2 - no light check -{ - short dx,dy,count,storage = 0; - - if (p1.y == p2.y) { - if (p1.x > p2.x) { - for (count = p2.x + 1; count < p1.x; count++) { - storage = storage + get_obscurity(count, p1.y); - if (((scenario.ter_types[coord_to_ter(count,p1.y)].blockage > 2) || (is_lava(count,p1.y) == TRUE)) && (mode == 1)) - return 5; - } - } - else { - for (count = p1.x + 1; count < p2.x; count++) { - - storage = storage + get_obscurity(count, p1.y); - if (((scenario.ter_types[coord_to_ter(count,p1.y)].blockage > 2) || (is_lava(count,p1.y) == TRUE)) && (mode == 1)) - return 5; - } - } - return storage; - } - if (p1.x == p2.x) { - if (p1.y > p2.y) { - for (count = p1.y - 1; count > p2.y; count--) { - storage = storage + get_obscurity(p1.x, count); - if (((scenario.ter_types[coord_to_ter(p1.x,count)].blockage > 2) || (is_lava(p1.x,count) == TRUE)) && (mode == 1)) - return 5; - } - } - else { - for (count = p1.y + 1; count < p2.y; count++) { - storage = storage + get_obscurity(p1.x, count); - if (((scenario.ter_types[coord_to_ter(p1.x,count)].blockage > 2) || (is_lava(p1.x,count) == TRUE)) && (mode == 1)) - return 5; - } - } - return storage; - } - dx = p2.x - p1.x; - dy = p2.y - p1.y; - - if (abs(dy) > abs(dx)) { - if (p2.y > p1.y) { - for (count = 1; count < dy; count++) { - storage = storage + get_obscurity(p1.x + (count * dx) / dy, p1.y + count); - if ( ((scenario.ter_types[coord_to_ter(p1.x + (count * dx) / dy,p1.y + count)].blockage > 2) || - (is_lava(p1.x + (count * dx) / dy,p1.y + count) == TRUE)) - && (mode == 1)) - return 5; - } - } - else { - for (count = -1; count > dy; count--) { - storage = storage + get_obscurity(p1.x + (count * dx) / dy, p1.y + count); - if ( ((scenario.ter_types[coord_to_ter(p1.x + (count * dx) / dy, p1.y + count)].blockage > 2) || - (is_lava(p1.x + (count * dx) / dy, p1.y + count) == TRUE)) - && (mode == 1)) - return 5; - } - } - return storage; - } - if (abs(dy) <= abs(dx)) { - if (p2.x > p1.x) { - for (count = 1; count < dx; count++) { - storage = storage + get_obscurity(p1.x + count, p1.y + (count * dy) / dx); - if (((scenario.ter_types[coord_to_ter(p1.x + count,p1.y + (count * dy) / dx)].blockage > 2) || - (is_lava(p1.x + count,p1.y + (count * dy) / dx) == TRUE)) - && (mode == 1)) - return 5; - } - } - else { - for (count = -1; count > dx; count--) { - storage = storage + get_obscurity(p1.x + count, p1.y + (count * dy) / dx); - if ( ((scenario.ter_types[coord_to_ter(p1.x + count,p1.y + (count * dy) / dx)].blockage > 2) || - (is_lava(p1.x + count,p1.y + (count * dy) / dx) == TRUE)) - && (mode == 1)) - return 5; - } - } - return storage; - } - if (storage > 5) - return 5; - else return storage; -} - Boolean place_item(location spot_hit,short which_item,short property,short always,short odds) // odds 0 - 100, with 100 always { @@ -3369,23 +3246,6 @@ void start_monster_editing(short just_redo_text) set_lb(NLS - 3,0,"",1); } -Boolean monst_on_space(location loc,short m_num) -{ - short i,j; - - if (editing_town == FALSE) - return FALSE; - if (t_d.creatures[m_num].number == 0) - return FALSE; - if ((loc.x - t_d.creatures[m_num].start_loc.x >= 0) && - (loc.x - t_d.creatures[m_num].start_loc.x <= scenario.scen_monsters[t_d.creatures[m_num].number].x_width - 1) && - (loc.y - t_d.creatures[m_num].start_loc.y >= 0) && - (loc.y - t_d.creatures[m_num].start_loc.y <= scenario.scen_monsters[t_d.creatures[m_num].number].y_width - 1)) - return TRUE; - return FALSE; - -} - void start_item_editing(short just_redo_text) { short i; @@ -3608,7 +3468,7 @@ void update_item_menu() } for (i = 0; i < 80; i++) { sprintf((char *) item_name, "%s",data_store->scen_item_list.scen_items[i + j * 80].full_name); - c2p(item_name); + c2pstr((char*) item_name); AppendMenu(item_menu[j],item_name); } } @@ -3620,7 +3480,7 @@ void update_item_menu() } for (i = 0; i < 64; i++) { sprintf((char *) item_name, "%s",data_store->scen_item_list.monst_names[i + j * 64]); - c2p( item_name); + c2pstr((char*) item_name); AppendMenu(mon_menu[j],item_name); } } diff --git a/osx/Scenario Editor/tactions.h b/osx/Scenario Editor/tactions.h index b1e910ce..83b9c9bf 100644 --- a/osx/Scenario Editor/tactions.h +++ b/osx/Scenario Editor/tactions.h @@ -61,7 +61,7 @@ void town_entry(location spot_hit); void start_dialogue_editing(short restoring); Boolean is_erasable_water(short i,short j); -Boolean monst_on_space(location loc,short m_num); +bool monst_on_space(location loc,short m_num); void place_edit_special(location loc); void set_special(location spot_hit); Boolean save_check(short which_dlog); diff --git a/osx/Scenario Editor/tfileio.c b/osx/Scenario Editor/tfileio.c index 7fab5a85..7a6081a1 100644 --- a/osx/Scenario Editor/tfileio.c +++ b/osx/Scenario Editor/tfileio.c @@ -4,9 +4,10 @@ #include "stdio.h" #include "tfileio.h" #include "keydlgs.h" -#include "tGraphics.h" +#include "graphtool.h" #include "scenario.h" -#include "sound.h" +#include "soundtool.h" +#include "mathutil.h" #import using std::endl; @@ -76,6 +77,8 @@ void init_directories() // ExitToShell(); // } + //error = CoreEndianInstallFlipper ('rsrc', 'PICT', flip_pict, NULL); + char cPath[768]; CFBundleRef mainBundle=CFBundleGetMainBundle(); CFURLRef graphicsURL = CFBundleCopyResourceURL(mainBundle,CFSTR("BOEScen.rsrc"),CFSTR(""),NULL); @@ -428,14 +431,16 @@ void load_scenario() len = (long) sizeof(scenario_data_type); if ((error = FSRead(file_id, &len, (char *) &scenario)) != 0){ - FSClose(file_id); oops_error(29); return; - } + FSClose(file_id); + oops_error(29); + return; + } if ((scenario.flag1 == 10) && (scenario.flag2 == 20) && (scenario.flag3 == 30) && (scenario.flag4 == 40)) { cur_scen_is_mac = TRUE; file_ok = TRUE; - } + } if ((scenario.flag1 == 20) && (scenario.flag2 == 40) && (scenario.flag3 == 60) && (scenario.flag4 == 80)) { @@ -443,22 +448,22 @@ void load_scenario() cur_scen_is_mac = FALSE; file_ok = TRUE; port_scenario(); - } + } if (file_ok == FALSE) { FSClose(file_id); give_error("This is not a legitimate Blades of Exile scenario.","",0); return; - } + } len = sizeof(scen_item_data_type); // item data if ((error = FSRead(file_id, &len, (char *) &(data_store->scen_item_list))) != 0){ FSClose(file_id); oops_error(30); return; - } + } port_item_list(); for (i = 0; i < 270; i++) { len = (long) (scenario.scen_str_len[i]); FSRead(file_id, &len, (char *) &(data_store->scen_strs[i])); data_store->scen_strs[i][len] = 0; - } + } FSClose(file_id); @@ -519,7 +524,7 @@ GWorldPtr load_bmp_from_file(Str255 filename) FSRead(file_id,&length,data); FSClose(file_id); GWorldPtr ret = load_bmp(data,length); - free(data); + delete [] data; return ret; } @@ -528,13 +533,13 @@ void load_spec_graphics() short i,file_num; Str255 file_name; char *whatever; - if (spec_scen_g != NULL) { DisposeGWorld(spec_scen_g); spec_scen_g = NULL; - } + } //build_scen_file_name(file_name); whatever = (char *) file_to_load.name; + printf("Loading scenario graphics... (%s)\n",whatever); for (i = 0; i < 63; i++) file_name[i] = whatever[i]; for (i = 0; i < 250; i++) { @@ -542,21 +547,24 @@ void load_spec_graphics() file_name[i + 1] = 'm'; file_name[i + 2] = 'e'; file_name[i + 3] = 'g'; - i = 250; - } + //file_name[i + 4] = 0; + break; } + } file_num = HOpenResFile(file_to_load.vRefNum,file_to_load.parID,file_name,1); - if (file_num < 0) - { + if (file_num < 0){ + printf("First attempt failed... (%s)\n",file_name); for (i = 0; i < 250; i++) { if (file_name[i] == '.') { file_name[i + 1] = 'b'; file_name[i + 2] = 'm'; file_name[i + 3] = 'p'; - i = 250; + //file_name[i + 4] = 0; + break; } } spec_scen_g = load_bmp_from_file(file_name); + if(spec_scen_g == NULL)printf("Scenario graphics not found (%s).\n",file_name); return; } @@ -699,7 +707,10 @@ void load_town(short which_town) len_to_jump += store; error = SetFPos (file_id, 1, len_to_jump); - if (error != 0) {FSClose(file_id);oops_error(35);} + if (error != 0) { + FSClose(file_id); + oops_error(35); + } len = sizeof(town_record_type); @@ -1185,8 +1196,8 @@ void make_new_scenario(Str255 file_name,short out_width,short out_height,short m Str255 newname = "::::"; strcat((char*)newname,(char*)file_name); - // now wrtie scenario - c2p(newname); + // now write scenario + c2pstr((char*) newname); //OK. FIrst find out what file name we're working with, and make the dummy file // which we'll build the new scenario in Blades of Exile Base diff --git a/osx/Scenario Editor/townout.c b/osx/Scenario Editor/townout.c index 0ec469b9..01df7cc7 100644 --- a/osx/Scenario Editor/townout.c +++ b/osx/Scenario Editor/townout.c @@ -2,15 +2,18 @@ #include #include #include "Global.h" +#include "graphtool.h" #include "tGraphics.h" #include "dialogutils.h" -#include "dlogtool.h" +#include "dlgtool.h" +#include "dlgconsts.h" #include "townout.h" #include "keydlgs.h" #include "tfileio.h" +#include "mathutil.h" extern short cen_x, cen_y, overall_mode,user_given_password; -extern Boolean mouse_button_held,dialog_not_toast,editing_town; +extern Boolean mouse_button_held,editing_town; extern short cur_viewing_mode; extern town_record_type town; extern big_tr_type t_d; @@ -24,7 +27,6 @@ extern talking_node_type null_talk_node; extern piles_of_stuff_dumping_type *data_store; extern outdoor_record_type current_terrain; extern unsigned char borders[4][50]; -extern pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit); extern location cur_out; extern talking_record_type talking; @@ -212,8 +214,10 @@ void put_placed_monst_in_dlog() cd_set_led_range(837,18,19,store_placed_monst.mobile); CDSN(837,2,store_placed_monst.personality); CDSN(837,3,store_placed_monst.facial_pic); - if ((store_placed_monst.facial_pic < 1) || (store_placed_monst.facial_pic >= 1000)) + if ((store_placed_monst.facial_pic < 1)) csp(837,11,0,PICT_BLANK_TYPE); + else if ((store_placed_monst.facial_pic >= 1000)) + csp(837,11,store_placed_monst.facial_pic,PICT_CUSTOM_TYPE + PICT_TALK_TYPE); else csp(837,11,store_placed_monst.facial_pic/* + 1000*/,PICT_TALK_TYPE); } Boolean get_placed_monst_in_dlog() @@ -240,10 +244,10 @@ void edit_placed_monst_event_filter (short item_hit) case 20: if (get_placed_monst_in_dlog() == FALSE) break; - dialog_not_toast = FALSE; + toast_dialog(); break; case 21: - dialog_not_toast = FALSE; + toast_dialog(); break; case 6: // choose m type if (get_placed_monst_in_dlog() == FALSE) @@ -295,9 +299,8 @@ void edit_placed_monst(short which_m) for (i = 0; i < 4; i++) cd_add_label(837,14 + i,attitude[i],57); - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + + item_hit = cd_run_dialog(); cd_kill_dialog(837,0); @@ -356,11 +359,11 @@ void edit_placed_monst_adv_event_filter (short item_hit) case 16: if (get_placed_monst_adv_in_dlog() == FALSE) break; - dialog_not_toast = FALSE; + toast_dialog(); break; case 17: store_placed_monst2.number = 0; - dialog_not_toast = FALSE; + toast_dialog(); break; default: @@ -395,10 +398,9 @@ creature_start_type edit_placed_monst_adv(creature_start_type monst_record) for (i = 0; i < 10; i++) { sprintf((char *) temp_str,"%d",i + 1); cd_add_label(838,31 + i,(char *) temp_str,18); - } - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + } + + item_hit = cd_run_dialog(); cd_kill_dialog(838,0); return store_placed_monst2; @@ -425,8 +427,8 @@ void put_placed_item_in_dlog() else cd_set_led(836,14,0); i = data_store->scen_item_list.scen_items[store_placed_item.item_code].graphic_num; - if (i >= 1000) - csp(836,4,0,PICT_BLANK_TYPE); + if (i >= 150) // was 1000 + csp(836,4,i % 150,PICT_CUSTOM_TYPE + PICT_ITEM_TYPE); else csp(836,4,/*1800 + */i,PICT_ITEM_TYPE); } Boolean get_placed_item_in_dlog() @@ -463,10 +465,10 @@ void edit_placed_item_event_filter (short item_hit) case 3: if (get_placed_item_in_dlog() == FALSE) break; - dialog_not_toast = FALSE; + toast_dialog(); break; case 20: - dialog_not_toast = FALSE; + toast_dialog(); break; case 18: i = choose_text_res(-2,0,399,store_placed_item.item_code,836,"Place which item?"); @@ -496,9 +498,8 @@ void edit_placed_item(short which_i) cd_activate_item(836,19,0); put_placed_item_in_dlog(); - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + + item_hit = cd_run_dialog(); cd_kill_dialog(836,0); @@ -515,7 +516,7 @@ void edit_sign_event_filter (short item_hit) CDGT(831,2,data_store->out_strs[100 + store_which_sign]); else CDGT(831,2,data_store->town_strs[120 + store_which_sign]); if (item_hit == 9) - dialog_not_toast = FALSE; + toast_dialog(); else { if (item_hit == 3) store_which_sign--; @@ -527,7 +528,7 @@ void edit_sign_event_filter (short item_hit) } break; case 3: - dialog_not_toast = FALSE; + toast_dialog(); break; } cdsin(831,5,store_which_sign); @@ -549,7 +550,7 @@ void edit_sign(short which_sign,short picture) cd_create_dialog_parent_num(831,0); if (picture >= 1000) - csp(831,6,0,PICT_BLANK_TYPE); + csp(831,6,picture % 1000,PICT_CUSTOM_TYPE + PICT_TER_TYPE); else if (picture >= 400) csp(831,6,picture - 400,PICT_TER_ANIM_TYPE); else csp(831,6,picture,PICT_TER_TYPE); @@ -560,8 +561,8 @@ void edit_sign(short which_sign,short picture) else CDST(831,2,data_store->town_strs[120 + store_which_sign]); //cd_activate_item(831,3,0); //cd_activate_item(831,4,0); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + + item_hit = cd_run_dialog(); cd_kill_dialog(831,0); } @@ -606,10 +607,10 @@ void edit_out_strs_event_filter (short item_hit) switch (item_hit) { case 10: if (save_out_strs() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 11: - dialog_not_toast = FALSE; + toast_dialog(); break; default: if ((item_hit >= 25) && (item_hit <= 32)) { @@ -635,8 +636,7 @@ void edit_out_strs() put_out_strs_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &out_strs_hit); + out_strs_hit = cd_run_dialog(); cd_kill_dialog(850,0); } @@ -682,10 +682,10 @@ void edit_town_strs_event_filter (short item_hit) switch (item_hit) { case 18: if (save_town_strs() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 19: - dialog_not_toast = FALSE; + toast_dialog(); break; default: if ((item_hit >= 41) && (item_hit <= 56)) { @@ -711,8 +711,7 @@ void edit_town_strs() put_town_strs_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &town_strs_hit); + town_strs_hit = cd_run_dialog(); cd_kill_dialog(839,0); } @@ -731,11 +730,11 @@ void pick_town_num_event_filter (short item_hit) give_error("This number is out of the correct range. (0 to the number of towns minus 1)","",store_whigh_dlog); break; } - dialog_not_toast = FALSE; + toast_dialog(); break; case 4: dialog_answer = -1; - dialog_not_toast = FALSE; + toast_dialog(); break; } @@ -756,8 +755,7 @@ short pick_town_num(short which_dlog,short def) sprintf((char *) str2,"%s (0 - %d)",(char *) temp_str,scenario.num_towns - 1); csit(which_dlog,7,(char *) str2); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &town_strs_hit); + town_strs_hit = cd_run_dialog(); cd_kill_dialog(store_whigh_dlog,0); return dialog_answer; @@ -777,11 +775,11 @@ void change_ter_event_filter (short item_hit) if (cre(b,0,255,"Both terrain types must be from 0 to 255.","",857) == TRUE) break; if (cre(c,0,100,"The Chance must be from 0 to 100.","",857) == TRUE) break; - dialog_not_toast = FALSE; + toast_dialog(); break; case 6: a = -1; b = -1; c = -1; - dialog_not_toast = FALSE; + toast_dialog(); break; case 10: case 11: i = CDGN(857,item_hit - 8); @@ -804,8 +802,7 @@ void change_ter(short *change_from,short *change_to,short *chance) CDSN(857,3,0); CDSN(857,4,100); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &town_strs_hit); + town_strs_hit = cd_run_dialog(); *change_from = a; *change_to = b; @@ -824,7 +821,7 @@ void outdoor_details_event_filter (short item_hit) CDGT(851,2,(char *) str); str[29] = 0; sprintf(data_store->out_strs[0],"%s",(char *) str); - dialog_not_toast = FALSE; + toast_dialog(); break; } @@ -843,8 +840,7 @@ void outdoor_details() sprintf((char *) temp_str,"X = %d, Y = %d",cur_out.x,cur_out.y); csit(851,8,(char *) temp_str); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &town_strs_hit); + town_strs_hit = cd_run_dialog(); cd_kill_dialog(851,0); } @@ -924,10 +920,10 @@ void edit_out_wand_event_filter (short item_hit) case 17: if (get_out_wand_in_dlog() == FALSE) break; - dialog_not_toast = FALSE; + toast_dialog(); break; case 18: - dialog_not_toast = FALSE; + toast_dialog(); break; case 19: if (get_out_wand_in_dlog() == FALSE) break; @@ -1001,9 +997,8 @@ void edit_out_wand(short mode) csit(852,47,"Outdoor Special Encounter:"); put_out_wand_in_dlog(); - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); + + item_hit = cd_run_dialog(); cd_kill_dialog(852,0); @@ -1053,7 +1048,7 @@ void edit_town_details_event_filter (short item_hit) switch (item_hit) { case 7: if (save_town_details() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; default: cd_hit_led_range(832,19,22,item_hit); @@ -1071,9 +1066,7 @@ void edit_town_details() put_town_details_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &town_details_hit); - + town_details_hit = cd_run_dialog(); cd_kill_dialog(832,0); } @@ -1111,7 +1104,7 @@ void edit_town_events_event_filter (short item_hit) switch (item_hit) { case 18: if (save_town_events() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; default: if ((item_hit >= 26) && (item_hit <= 33)) { @@ -1146,8 +1139,7 @@ void edit_town_events() put_town_events_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &advanced_town_hit); + advanced_town_hit = cd_run_dialog(); cd_kill_dialog(833,0); } @@ -1202,10 +1194,10 @@ void edit_advanced_town_event_filter (short item_hit) switch (item_hit) { case 16: if (save_advanced_town() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 17: - dialog_not_toast = FALSE; + toast_dialog(); break; case 37: cd_flip_led(834,37,item_hit); @@ -1224,8 +1216,7 @@ void edit_advanced_town() put_advanced_town_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &advanced_town_hit); + advanced_town_hit = cd_run_dialog(); cd_kill_dialog(834,0); } @@ -1267,7 +1258,7 @@ void edit_town_wand_event_filter (short item_hit) switch (item_hit) { case 18: if (save_town_wand() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 27: case 28: case 29: case 30: for (i = 0; i < 4; i++) { @@ -1293,8 +1284,7 @@ void edit_town_wand() put_town_wand_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &town_wand_hit); + town_wand_hit = cd_run_dialog(); cd_kill_dialog(835,0); } @@ -1336,10 +1326,10 @@ void edit_basic_dlog_event_filter (short item_hit) switch (item_hit) { case 7: if (save_basic_dlog() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 8: - dialog_not_toast = FALSE; + toast_dialog(); break; case 9: if (save_basic_dlog() == FALSE) break; @@ -1371,9 +1361,7 @@ void edit_basic_dlog(short which_node) put_basic_dlog_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &basic_dlog_hit); - + basic_dlog_hit = cd_run_dialog(); cd_kill_dialog(821,0); } @@ -1513,7 +1501,7 @@ void edit_talk_node_event_filter (short item_hit) switch (item_hit) { case 11: if (save_talk_node() == TRUE) - dialog_not_toast = FALSE; + toast_dialog(); break; case 13: //go_back if (save_talk_node() == FALSE) @@ -1528,7 +1516,7 @@ void edit_talk_node_event_filter (short item_hit) break; case 12: - dialog_not_toast = FALSE; break; + toast_dialog(); break; case 14: if (save_talk_node() == FALSE) break; @@ -1652,8 +1640,7 @@ void edit_talk_node(short which_node,short parent_num) else cd_activate_item(817,38,1); put_talk_node_in_dlog(); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &talk_node_hit); + talk_node_hit = cd_run_dialog(); cd_kill_dialog(817,0); } @@ -1666,11 +1653,11 @@ void pick_out_event_filter (short item_hit) switch (item_hit) { case 2: dialog_answer = store_cur_loc.x * 100 + store_cur_loc.y; - dialog_not_toast = FALSE; + toast_dialog(); break; case 3: dialog_answer = -1; - dialog_not_toast = FALSE; + toast_dialog(); break; case 12: if (store_cur_loc.x == 0) SysBeep(20); @@ -1711,9 +1698,8 @@ short pick_out(location default_loc) csit(854,8,(char *) temp_str); sprintf((char *) temp_str,"Y = %d",store_cur_loc.y); csit(854,11,(char *) temp_str); - - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &basic_dlog_hit); + + basic_dlog_hit = cd_run_dialog(); cd_kill_dialog(854,0); return dialog_answer; @@ -1727,11 +1713,11 @@ void new_town_event_filter (short item_hit) switch (item_hit) { case 3: dialog_answer = 1; - dialog_not_toast = FALSE; + toast_dialog(); break; case 23: dialog_answer = -1; - dialog_not_toast = FALSE; + toast_dialog(); break; default: cd_hit_led_range(830,11,13,item_hit); @@ -1757,8 +1743,7 @@ Boolean new_town(short which_town) sprintf((char *) temp_str,"Town name"); CDST(830,2,(char *) temp_str); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &basic_dlog_hit); + basic_dlog_hit = cd_run_dialog(); size = cd_get_led_range(830,11,13); preset = cd_get_led_range(830,18,20); @@ -1833,11 +1818,11 @@ void pick_import_town_event_filter (short item_hit) give_error("This number is out of the correct range. It must be at least 0.","",store_whigh_dlog); break; } - dialog_not_toast = FALSE; + toast_dialog(); break; case 8: dialog_answer = -1; - dialog_not_toast = FALSE; + toast_dialog(); break; } @@ -1855,8 +1840,7 @@ short pick_import_town(short which_dlog,short def) CDSN(store_whigh_dlog,2,0); - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &town_strs_hit); + town_strs_hit = cd_run_dialog(); cd_kill_dialog(store_whigh_dlog,0); return dialog_answer; diff --git a/osx/bldsexil.c b/osx/bldsexil.c index 31c38a11..11deebfc 100644 --- a/osx/bldsexil.c +++ b/osx/bldsexil.c @@ -10,21 +10,25 @@ #include "blxactions.h" #include "text.h" #include "party.h" -//#include "sound.h" #include "items.h" #include "fields.h" #include "town.h" -#include "dlogtool.h" +#include "dlgtool.h" #include "startup.h" #include "dialogutils.h" -#include "Exile.sound.h" #include "info.dialogs.h" #include "bldsexil.h" +#include "soundtool.h" +#include "graphtool.h" +#include "mathutil.h" +extern short arrow_curs[3][3]; +extern short sword_curs, boot_curs, drop_curs, target_curs; +extern short talk_curs, key_curs, look_curs, current_cursor; /* Mac stuff globals */ Rect windRect, Drag_Rect; -Boolean All_Done = FALSE,dialog_not_toast = FALSE; +Boolean All_Done = FALSE; EventRecord event; WindowPtr mainPtr; Handle menu_bar_handle; @@ -32,7 +36,7 @@ MenuHandle apple_menu,file_menu,extra_menu,help_menu,monster_info_menu,library_m MenuHandle actions_menu,music_menu,mage_spells_menu,priest_spells_menu; short had_text_freeze = 0,num_fonts; Boolean in_startup_mode = TRUE,app_started_normally = FALSE; -Boolean play_sounds = TRUE,first_startup_update = TRUE; +Boolean first_startup_update = TRUE; Boolean diff_depth_ok = FALSE,first_sound_played = FALSE,spell_forced = FALSE,startup_loaded = FALSE; Boolean save_maps = TRUE,party_in_memory = FALSE; CGrafPtr color_graf_port; @@ -55,8 +59,7 @@ short on_spell_menu[2][62]; short on_monst_menu[256]; // Cursors -short current_cursor = 120; -CursHandle arrow_curs[3][3], sword_curs, boot_curs, key_curs, target_curs,talk_curs,look_curs; +//short current_cursor = 120; // Shareware globals @@ -151,7 +154,7 @@ Boolean fry_startup = FALSE; // Main body of program Exile // #ifdef EXILE_BIG_GUNS -pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit); +//pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit); ControlActionUPP text_sbar_UPP; ControlActionUPP item_sbar_UPP; ControlActionUPP shop_sbar_UPP; @@ -162,21 +165,16 @@ ControlActionUPP shop_sbar_UPP; int main(void) { - - data_store = (piles_of_stuff_dumping_type *) NewPtr(sizeof(piles_of_stuff_dumping_type)); start_time = TickCount(); Initialize(); #ifdef EXILE_BIG_GUNS - main_dialog_UPP = NewModalFilterProc(cd_event_filter); -text_sbar_UPP = NewControlActionProc(sbar_action); -item_sbar_UPP = NewControlActionProc(item_sbar_action); -shop_sbar_UPP = NewControlActionProc(shop_sbar_action); - + //main_dialog_UPP = NewModalFilterProc(cd_event_filter); + text_sbar_UPP = NewControlActionProc(sbar_action); + item_sbar_UPP = NewControlActionProc(item_sbar_action); + shop_sbar_UPP = NewControlActionProc(shop_sbar_action); #endif - - load_cursors(); - + init_graph_tool(redraw_screen,ul); Set_Window_Drag_Bdry(); @@ -184,21 +182,21 @@ shop_sbar_UPP = NewControlActionProc(shop_sbar_action); load_sounds(); - if (sys_7_avail == TRUE) { - set_up_apple_events(); - } + set_up_apple_events(); //import_template_terrain(); //import_anim_terrain(0); plop_fancy_startup(); - party.stuff_done[306][2] = 0; - party.stuff_done[306][1] = 0; + party.stuff_done[SDF_NO_FRILLS] = 0; + party.stuff_done[SDF_NO_SOUNDS] = 0; init_screen_locs(); - cd_init_dialogs(); + + init_snd_tool(); + init_dialogs(); //init_party(0); - PSD[306][6] = 1; + PSD[SDF_GAME_SPEED] = 1; //init_anim(0); @@ -225,11 +223,8 @@ shop_sbar_UPP = NewControlActionProc(shop_sbar_action); menu_activate(0); - - fancy_startup_delay(); - init_spell_menus(); if (overall_mode == MODE_STARTUP) @@ -274,7 +269,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; @@ -298,8 +293,8 @@ void Initialize(void) if (stored_key == -100) { Alert(983,NIL); ExitToShell(); - } } + } set_pixel_depth(); mainPtr = GetNewCWindow(128,NIL,IN_FRONT); SetPort(GetWindowPort(mainPtr)); /* set window to current graf port */ @@ -480,9 +475,9 @@ void Handle_Update() if (first_update == TRUE) { first_update = FALSE; if (overall_mode == MODE_OUTDOORS) - redraw_screen(0); + redraw_screen(); if ((overall_mode > MODE_OUTDOORS) & (overall_mode < MODE_COMBAT)) - redraw_screen(0); + redraw_screen(); // 1st update never combat } else refresh_screen(0); @@ -1021,35 +1016,35 @@ void handle_music_menu(int item_hit) } } -void load_cursors() -{ - short i,j; - for (i = 0; i < 3; i++) - for (j = 0; j < 3; j++) - arrow_curs[i][j] = GetCursor(100 + (i - 1) + 10 * (j - 1)); - sword_curs = GetCursor(120); +//void load_cursors() +//{ +// short i,j; +// for (i = 0; i < 3; i++) +// for (j = 0; j < 3; j++) +// arrow_curs[i][j] = GetCursor(100 + (i - 1) + 10 * (j - 1)); +// sword_curs = GetCursor(120); +// +//// HLock ((Handle) sword_curs); +//// SetCursor (*sword_curs); +//// HUnlock((Handle) sword_curs); +// +// boot_curs = GetCursor(121); +// key_curs = GetCursor(122); +// target_curs = GetCursor(124); +// talk_curs = GetCursor(126); +// look_curs = GetCursor(129); +// +// set_cursor(sword_curs); +// current_cursor = 124; +// +//} -// HLock ((Handle) sword_curs); -// SetCursor (*sword_curs); -// HUnlock((Handle) sword_curs); - - boot_curs = GetCursor(121); - key_curs = GetCursor(122); - target_curs = GetCursor(124); - talk_curs = GetCursor(126); - look_curs = GetCursor(129); - - set_cursor(sword_curs); - current_cursor = 124; - -} - -void set_cursor(CursHandle which_curs) -{ - HLock ((Handle) which_curs); - SetCursor (*which_curs); - HUnlock((Handle) which_curs); -} +//void set_cursor(CursHandle which_curs) +//{ +// HLock ((Handle) which_curs); +// SetCursor (*which_curs); +// HUnlock((Handle) which_curs); +//} void change_cursor(Point where_curs) { @@ -1295,100 +1290,99 @@ void set_up_apple_events() } -pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit) -{ - char chr,chr2; - short wind_hit,item_hit; - Point the_point; - WindowRef w; - RgnHandle rgn; +void move_sound(unsigned char ter,short step){ + static bool on_swamp = false; + short pic,spec,snd; - dummy_item_hit = 0; + pic = scenario.ter_types[ter].picture; + spec = scenario.ter_types[ter].special; + snd = scenario.ter_types[ter].step_sound; - switch (event->what) { - case updateEvt: - w = GetDialogWindow(hDlg); - rgn = NewRgn(); - GetWindowRegion(w,kWindowUpdateRgn,rgn); - if (EmptyRgn(rgn) == TRUE) { - DisposeRgn(rgn); - return TRUE; - } - DisposeRgn(rgn); - BeginUpdate(w); - cd_redraw(w); - EndUpdate(w); - DrawDialog(hDlg); - return FALSE; - break; - - case keyDown: - chr = event->message & charCodeMask; - chr2 = (char) ((event->message & keyCodeMask) >> 8); - switch (chr2) { - case 126: chr = 22; break; - case 124: chr = 21; break; - case 123: chr = 20; break; - case 125: chr = 23; break; - case 53: chr = 24; break; - case 36: chr = 31; break; - case 76: chr = 31; break; - } - // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc - // 25-30 ctrl 1-6 31 - return - - wind_hit = cd_process_keystroke(GetDialogWindow(hDlg),chr,&item_hit); - break; + //if on swamp don't play squish sound : BoE legacy behavior, can be removed safely + if(snd == 4 && !flying() && party.in_boat == 0){ + if(on_swamp && get_ran(1,1,100) >= 10)return; + on_swamp = true; + }else on_swamp = false; - case mouseDown: - the_point = event->where; - GlobalToLocal(&the_point); - wind_hit = cd_process_click(GetDialogWindow(hDlg),the_point, event->modifiers,&item_hit); - break; - - default: wind_hit = -1; break; - } - switch (wind_hit) { - case -1: break; - case 823: give_password_filter(item_hit); break; - case 869: pick_prefab_scen_event_filter(item_hit); break; - case 947: pick_a_scen_event_filter(item_hit); break; - case 958: tip_of_day_event_filter(item_hit); break; - case 960: talk_notes_event_filter(item_hit); break; - case 961: adventure_notes_event_filter(item_hit); break; - case 962: journal_event_filter(item_hit); break; - case 970: case 971: case 972: case 973: display_strings_event_filter(item_hit); break; - case 987: display_item_event_filter(item_hit); break; - case 988: pick_trapped_monst_event_filter(item_hit); break; - case 989: edit_party_event_filter(item_hit); break; - case 991: display_pc_event_filter(item_hit); break; - case 996: display_alchemy_event_filter(item_hit); break; - case 997: display_help_event_filter(item_hit); break; - case 998: display_pc_item_event_filter(item_hit); break; - case 999: display_monst_event_filter(item_hit); break; - case 1010: spend_xp_event_filter (item_hit); break; - case 1012: get_num_of_items_event_filter (item_hit); break; - case 1013: pick_race_abil_event_filter (item_hit); break; - case 1014: sign_event_filter (item_hit); break; - case 1017: case 873: get_text_response_event_filter (item_hit); break; - case 1018: select_pc_event_filter (item_hit); break; - case 1019: give_pc_info_event_filter(item_hit); break; - case 1047: alch_choice_event_filter(item_hit); break; - case 1050: pc_graphic_event_filter(item_hit); break; - case 1051: pc_name_event_filter(item_hit); break; - case 1073: give_reg_info_event_filter (item_hit); break; - case 1075: do_registration_event_filter (item_hit); break; - case 1096: display_spells_event_filter (item_hit); break; - case 1097: display_skills_event_filter (item_hit); break; - case 1098: pick_spell_event_filter (item_hit); break; - case 1099: prefs_event_filter (item_hit); break; - default: fancy_choice_dialog_event_filter (item_hit); break; - } - - if (wind_hit == -1) - return FALSE; - else return TRUE; + if ((monsters_going == FALSE) && (overall_mode < 10) && (party.in_boat >= 0)) {// is on boat ? + if (spec == 21) //town entrance ? + return; + play_sound(48); //play boat sound + } + else if ((monsters_going == FALSE) && (overall_mode < 10) && (party.in_horse >= 0)) {//// is on horse ? + play_sound(85); //so play horse sound + } + else switch(scenario.ter_types[ter].step_sound){ + case 1: + play_sound(55); //squish + break; + case 2: + play_sound(47); //crunch + break; + case 3: + break; //silence : do nothing + case 4: + play_sound(17); // big splash + break; + default: //safety footsteps valve + if (step % 2 == 0) //footsteps alternate sound + play_sound(49); + else play_sound(50); + } } +void incidental_noises(bool on_surface){ + short sound_to_play; + if(on_surface){ + if(get_ran(1,1,100) < 40){ + sound_to_play = get_ran(1,1,3); + switch(sound_to_play){ + case 1: + play_sound(76); + break; + case 2: + play_sound(77); + break; + case 3: + play_sound(91); + break; + } + } + }else{ + if(get_ran(1,1,100) < 40){ + sound_to_play = get_ran(1,1,2); + switch(sound_to_play){ + case 1: + play_sound(78); + break; + case 2: + play_sound(79); + break; + } + } + } + // Dog: 80 + // Cat: 81 + // Sheep: 82 + // Cow: 83 + // Chicken: 92 +} +void pause(short length) +{ + long len; + unsigned long dummy; + + len = (long) length; + + if (give_delays == 0) + Delay(len, &dummy); +} +// stuff done legit, i.e. flags are within proper ranges for stuff done flag +bool sd_legit(short a, short b) +{ + if ((minmax(0,299,a) == a) && (minmax(0,9,b) == b)) + return TRUE; + return FALSE; +} \ No newline at end of file diff --git a/osx/bldsexil.h b/osx/bldsexil.h index 5e263697..cf73342d 100644 --- a/osx/bldsexil.h +++ b/osx/bldsexil.h @@ -21,7 +21,6 @@ void handle_mage_spells_menu(int item_hit); void handle_priest_spells_menu(int item_hit); void handle_monster_info_menu(int item_hit); void handle_music_menu(int item_hit); -void load_cursors(); void set_cursor(CursHandle which_curs); void change_cursor(Point where_curs); void find_quickdraw(); @@ -31,5 +30,8 @@ void check_sys_7(); pascal OSErr handle_open_app(AppleEvent *theAppleEvent,AppleEvent *reply,long handlerRefcon); pascal OSErr handle_open_doc(AppleEvent *theAppleEvent,AppleEvent *reply,long handlerRefcon); pascal OSErr handle_quit(AppleEvent *theAppleEvent,AppleEvent *reply,long handlerRefcon); -pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit); void set_up_apple_events(); +void move_sound(unsigned char ter,short step); +void incidental_noises(bool on_surface); +void pause(short length); +bool sd_legit(short a, short b); \ No newline at end of file diff --git a/osx/blx.g.utils.c b/osx/blx.g.utils.c index 4e6bbb0a..e2dc7df1 100644 --- a/osx/blx.g.utils.c +++ b/osx/blx.g.utils.c @@ -9,8 +9,10 @@ #include "blxgraphics.h" #include "info.dialogs.h" #include "monster.h" -#include "dlogtool.h" -#include "Exile.sound.h" +#include "dlgtool.h" +//#include "soundtool.h" +#include "graphtool.h" +#include "mathutil.h" extern WindowPtr mainPtr; extern Rect windRect; @@ -1045,7 +1047,7 @@ void adjust_monst_menu() if (on_monst_menu[i] >= 0) { //GetIndString(monst_name, 2,on_monst_menu[i]); sprintf((char *) monst_name,"%s",data_store->scen_item_list.monst_names[on_monst_menu[i]]); - c2p(monst_name); + c2pstr((char*)monst_name); AppendMenu(monst_menu,monst_name); } } diff --git a/osx/blxactions.c b/osx/blxactions.c index 201bbe27..10a9cda7 100644 --- a/osx/blxactions.c +++ b/osx/blxactions.c @@ -18,9 +18,11 @@ #include "newgraph.h" #include "combat.h" #include "items.h" -#include "Exile.sound.h" +#include "soundtool.h" #include "info.dialogs.h" #include "item_data.h" +#include "bldsexil.h" +#include "mathutil.h" Rect bottom_buttons[7]; @@ -640,7 +642,7 @@ Boolean handle_action(EventRecord event) center = c_town.p_loc; //put_pc_screen(); set_stat_window(current_pc); - redraw_screen(0); + redraw_screen(); play_sound(93); need_reprint = TRUE; need_redraw = TRUE; diff --git a/osx/blxfileio.c b/osx/blxfileio.c index f18f7bec..a3682df1 100644 --- a/osx/blxfileio.c +++ b/osx/blxfileio.c @@ -2,7 +2,7 @@ #include #include "global.h" -#include "stdio.h" +#include #include "blxfileio.h" #include "text.h" #include "town.h" @@ -14,8 +14,9 @@ #include "dialogutils.h" #include "info.dialogs.h" #include "blx.g.utils.h" - -#include "Exile.sound.h" +#include "graphtool.h" +#include "soundtool.h" +#include "mathutil.h" #include #include @@ -62,6 +63,7 @@ extern talking_record_type talking; extern outdoor_strs_type outdoor_text[2][2]; extern vector scen_headers; extern unsigned char combat_terrain[64][64]; +extern Boolean belt_present; typedef struct { char expl[96][96]; @@ -172,7 +174,7 @@ void do_apple_event_open(FSSpec file_info) void load_file() { - + NavReplyRecord reply; long file_size; OSErr error; @@ -183,19 +185,19 @@ void load_file() Boolean in_scen = FALSE; char flag_data[8]; - + long len,store_len,count; char *party_ptr; char *pc_ptr; flag_type flag; flag_type *flag_ptr; - - + + short flags[3][2] = {{5790,1342}, // slot 0 ... 5790 - out 1342 - town - {100,200}, // slot 1 100 in scenario, 200 not in - {3422,5567}}; // slot 2 ... 3422 - no maps 5567 - maps - - + {100,200}, // slot 1 100 in scenario, 200 not in + {3422,5567}}; // slot 2 ... 3422 - no maps 5567 - maps + + type_list.componentSignature = kNavGenericSignature; type_list.osTypeCount = 1; type_list.osType[0] = 'beSV'; @@ -213,43 +215,43 @@ void load_file() AEGetNthPtr(&reply.selection,1,typeFSS,&keyword,&descType,&file_to_load,sizeof(FSSpec),&actualSize); - + if ((error = FSpOpenDF(&file_to_load,1,&file_id)) != 0) { FCD(1064,0); SysBeep(2); return; } - - + + file_size = sizeof(party_record_type); - + len = sizeof(flag_type); - -// sprintf((char *) debug, " Len %d ", (short) len); -// add_string_to_buf((char *) debug); - + + // sprintf((char *) debug, " Len %d ", (short) len); + // add_string_to_buf((char *) debug); + for (i = 0; i < 3; i++) { if ((error = FSRead(file_id, &len, (char *) flag_data)) != 0) { FSClose(file_id); FCD(1064,0); return; - } + } flag_ptr = (flag_type *) flag_data; flag = *flag_ptr; if ((flag.i != flags[i][0]) && (flag.i != flags[i][1])) { // OK Exile II save file? FSClose(file_id); FCD(1063,0); return; - } - + } + if ((i == 0) && (flag.i == flags[i][1])) town_restore = TRUE; if ((i == 1) && (flag.i == flags[i][0])) { in_scen = TRUE; - } + } if ((i == 2) && (flag.i == flags[i][1])) maps_there = TRUE; - } + } // LOAD PARTY len = (long) sizeof(party_record_type); @@ -260,10 +262,10 @@ void load_file() SysBeep(2); FCD(1064,0); return; - } + } for (count = 0; count < store_len; count++) party_ptr[count] ^= 0x5C; - + // LOAD SETUP len = (long) sizeof(setup_save_type); if ((error = FSRead(file_id, &len, (char *) &setup_save)) != 0){ @@ -271,8 +273,8 @@ void load_file() SysBeep(2); FCD(1064,0); return; - } - + } + // LOAD PCS store_len = (long) sizeof(pc_record_type); for (i = 0; i < 6; i++) { @@ -281,203 +283,212 @@ void load_file() if ((error = FSRead(file_id, &len, (char *) pc_ptr)) != 0){ FSClose(file_id); SysBeep(2); - FCD(1064,0); + FCD(1064,0); return; - } + } for (count = 0; count < store_len; count++) pc_ptr[count] ^= 0x6B; - } - + } + if (in_scen == TRUE) { - - // LOAD OUTDOOR MAP - len = (long) sizeof(out_info_type); - if ((error = FSRead(file_id, &len, (char *) out_e)) != 0){ - FSClose(file_id); - SysBeep(2); - FCD(1064,0); - return; - } - - // LOAD TOWN - if (town_restore == TRUE) { - len = (long) sizeof(current_town_type); - if ((error = FSRead(file_id, &len, (char *) &c_town)) != 0){ - FSClose(file_id); - SysBeep(2); - FCD(1064,0); - return; - } - - len = (long) sizeof(big_tr_type); - if ((error = FSRead(file_id, &len, (char *) &t_d)) != 0){ - FSClose(file_id); - SysBeep(2); - FCD(1064,0); - return; - } - - len = (long) sizeof(town_item_list); - if ((error = FSRead(file_id, &len, (char *) &t_i)) != 0){ + + // LOAD OUTDOOR MAP + len = (long) sizeof(out_info_type); + if ((error = FSRead(file_id, &len, (char *) out_e)) != 0){ FSClose(file_id); SysBeep(2); - FCD(1064,0); + FCD(1064,0); return; + } + + // LOAD TOWN + if (town_restore == TRUE) { + len = (long) sizeof(current_town_type); + if ((error = FSRead(file_id, &len, (char *) &c_town)) != 0){ + FSClose(file_id); + SysBeep(2); + FCD(1064,0); + return; } - - } - - // LOAD STORED ITEMS - for (i = 0; i < 3; i++) { - len = (long) sizeof(stored_items_list_type); - if ((error = FSRead(file_id, &len, (char *) &stored_items[i])) != 0){ + + len = (long) sizeof(big_tr_type); + if ((error = FSRead(file_id, &len, (char *) &t_d)) != 0){ FSClose(file_id); SysBeep(2); - FCD(1064,0); + FCD(1064,0); return; - } - } - - // LOAD SAVED MAPS - if (maps_there == TRUE) { - len = (long) sizeof(stored_town_maps_type); - if ((error = FSRead(file_id, &len, (char *) &(data_store->town_maps))) != 0){ + } + + len = (long) sizeof(town_item_list); + if ((error = FSRead(file_id, &len, (char *) &t_i)) != 0){ FSClose(file_id); SysBeep(2); - FCD(1064,0); + FCD(1064,0); return; - } - - len = (long) sizeof(stored_outdoor_maps_type); - if ((error = FSRead(file_id, &len, (char *) &o_maps)) != 0) { + } + + } + + // LOAD STORED ITEMS + for (i = 0; i < 3; i++) { + len = (long) sizeof(stored_items_list_type); + if ((error = FSRead(file_id, &len, (char *) &stored_items[i])) != 0){ FSClose(file_id); SysBeep(2); - FCD(1064,0); + FCD(1064,0); return; - } + } } - - // LOAD SFX & MISC_I + + // LOAD SAVED MAPS + if (maps_there == TRUE) { + len = (long) sizeof(stored_town_maps_type); + if ((error = FSRead(file_id, &len, (char *) &(data_store->town_maps))) != 0){ + FSClose(file_id); + SysBeep(2); + FCD(1064,0); + return; + } + + len = (long) sizeof(stored_outdoor_maps_type); + if ((error = FSRead(file_id, &len, (char *) &o_maps)) != 0) { + FSClose(file_id); + SysBeep(2); + FCD(1064,0); + return; + } + } + + // LOAD SFX & MISC_I len = (long) (64 * 64); if ((error = FSRead(file_id, &len, (char *) sfx)) != 0){ - FSClose(file_id); - SysBeep(2); - FCD(1064,0); - return; - } + FSClose(file_id); + SysBeep(2); + FCD(1064,0); + return; + } if ((error = FSRead(file_id, &len, (char *) misc_i)) != 0){ - FSClose(file_id); - SysBeep(2); - FCD(1064,0); - return; - } - + FSClose(file_id); + SysBeep(2); + FCD(1064,0); + return; + } + } // end if_scen - + if ((error = FSClose(file_id)) != 0){ add_string_to_buf("Load: Can't close file. "); SysBeep(2); return; - } - + } + party_in_memory = TRUE; - + // now if not in scen, this is it. if (in_scen == FALSE) { if (in_startup_mode == FALSE) { reload_startup(); in_startup_mode = TRUE; draw_startup(0); - } - return; } - + return; + } + if (load_scenario() == FALSE) return; - + // if at this point, startup must be over, so make this call to make sure we're ready, // graphics wise end_startup(); - + set_up_ter_pics(); load_outdoors(party.outdoor_corner.x + 1,party.outdoor_corner.y + 1,1,1,0,0,NULL); load_outdoors(party.outdoor_corner.x,party.outdoor_corner.y + 1,0,1,0,0,NULL); load_outdoors(party.outdoor_corner.x + 1,party.outdoor_corner.y,1,0,0,0,NULL); load_outdoors(party.outdoor_corner.x,party.outdoor_corner.y,0,0,0,0,NULL); - + //end_anim(); overall_mode = (town_restore == TRUE) ? 1 : 0; stat_screen_mode = 0; build_outdoors(); erase_out_specials(); update_pc_graphics(); - - + + if (town_restore == FALSE) { center = party.p_loc; load_area_graphics(); + } + else { + load_town(c_town.town_num,2,-1,NULL); + load_town(c_town.town_num,1,-1,NULL); + + for (i = 0; i < T_M; i++){ + monster_targs[i].x = 0; + monster_targs[i].y = 0; } - else { - load_town(c_town.town_num,2,-1,NULL); - load_town(c_town.town_num,1,-1,NULL); - - for (i = 0; i < T_M; i++) - {monster_targs[i].x = 0; monster_targs[i].y = 0;} - - town_type = scenario.town_size[c_town.town_num]; - - // Set up field booleans - for (j = 0; j < town_size[town_type]; j++) - for (k = 0; k < town_size[town_type]; k++) { - // Set up field booleans - if (is_web(j,k) == TRUE) - web = TRUE; - if (is_crate(j,k) == TRUE) - crate = TRUE; - if (is_barrel(j,k) == TRUE) - barrel = TRUE; - if (is_fire_barrier(j,k) == TRUE) - fire_barrier = TRUE; - if (is_force_barrier(j,k) == TRUE) - force_barrier = TRUE; - if (is_quickfire(j,k) == TRUE) - quickfire = TRUE; - } -force_wall = TRUE;fire_wall = TRUE;antimagic = TRUE;scloud = TRUE;ice_wall = TRUE;blade_wall = TRUE; -sleep_field = TRUE; - center = c_town.p_loc; - load_area_graphics(); + + town_type = scenario.town_size[c_town.town_num]; + + // Set up field booleans + for (j = 0; j < town_size[town_type]; j++) + for (k = 0; k < town_size[town_type]; k++) { + if (is_web(j,k) == TRUE) + web = TRUE; + if (is_crate(j,k) == TRUE) + crate = TRUE; + if (is_barrel(j,k) == TRUE) + barrel = TRUE; + if (is_fire_barrier(j,k) == TRUE) + fire_barrier = TRUE; + if (is_force_barrier(j,k) == TRUE) + force_barrier = TRUE; + if (is_quickfire(j,k) == TRUE) + quickfire = TRUE; + if ((scenario.ter_types[t_d.terrain[j][k]].special >= 16) && + (scenario.ter_types[t_d.terrain[j][k]].special <= 19)) + belt_present = TRUE; } - + force_wall = TRUE; + fire_wall = TRUE; + antimagic = TRUE; + scloud = TRUE; + ice_wall = TRUE; + blade_wall = TRUE; + sleep_field = TRUE; + center = c_town.p_loc; + load_area_graphics(); + } + create_clip_region(); - redraw_screen(0); + redraw_screen(); current_pc = first_active_pc(); loaded_yet = TRUE; strcpy ((char *) last_load_file, (char *) file_to_load.name); store_file_reply = file_to_load; - + add_string_to_buf("Load: Game loaded. "); - + // Set sounds, map saving, and speed if (((play_sounds == TRUE) && (party.stuff_done[306][1] == 1)) || - ((play_sounds == FALSE) && (party.stuff_done[306][1] == 0))) { + ((play_sounds == FALSE) && (party.stuff_done[306][1] == 0))) { flip_sound(); - } + } give_delays = party.stuff_done[306][2]; if (party.stuff_done[306][0] == 0) save_maps = TRUE; - else save_maps = FALSE; - + else save_maps = FALSE; + //if (party.stuff_done[306][5] == 0) // end_music(); // else init_bg_music(); - + in_startup_mode = FALSE; in_scen_debug = FALSE; - + } void save_file(short mode) @@ -753,7 +764,7 @@ void change_val (unsigned char *val,short a,short b) void build_scen_file_name (Str255 file_n) { sprintf((char *) file_n,"::::Blades of Exile Scenarios:%s",party.scen_name); - c2p(file_n); + c2pstr((char*)file_n); } // mode 0 want town and talking, 1 talking only, 2 want a string only, and extra is string num @@ -1409,7 +1420,7 @@ void start_data_dump() void end_data_dump() { FSClose(data_dump_file_id); - force_play_sound(1); + play_sound(1); // formerly force_play_sound } // expecting party record to contain name of proper scenario to load @@ -1559,7 +1570,7 @@ void build_scen_headers() // now we need to store the file name, first stripping any path that occurs // before it last_colon = -1; - //p2c(scen_name); + //p2cstr(scen_name); // for (i = 0; i < strlen((char *) scen_name); i++) // if (scen_name[i] == ':') // last_colon = i; diff --git a/osx/blxgraphics.c b/osx/blxgraphics.c index 85f7db28..6c3ffcbd 100644 --- a/osx/blxgraphics.c +++ b/osx/blxgraphics.c @@ -7,12 +7,20 @@ #include "newgraph.h" #include "blx.g.utils.h" #include "monster.h" -#include "dlogtool.h" +#include "dlgtool.h" #include "loc_utils.h" #include "fields.h" #include "text.h" -#include "Exile.sound.h" +#include "graphtool.h" +#include "soundtool.h" #include "gamma.h" +#include "mathutil.h" + +#include "party.h" +#include "town.h" +#include "items.h" +#include "dialogutils.h" +#include "info.dialogs.h" extern WindowPtr mainPtr; extern Rect windRect; @@ -61,6 +69,17 @@ extern outdoor_strs_type outdoor_text[2][2]; extern GWorldPtr spec_scen_g; extern DialogPtr modeless_dialogs[18]; extern Boolean modeless_exists[18]; +//extern dlg_filter_t give_password_filter,pick_prefab_scen_event_filter,pick_a_scen_event_filter,tip_of_day_event_filter; +//extern dlg_filter_t talk_notes_event_filter,adventure_notes_event_filter,journal_event_filter,display_strings_event_filter; +//extern dlg_filter_t display_strings_event_filter,display_strings_event_filter,display_strings_event_filter; +//extern dlg_filter_t display_item_event_filter,pick_trapped_monst_event_filter,edit_party_event_filter,display_pc_event_filter; +//extern dlg_filter_t display_alchemy_event_filter,display_help_event_filter,display_pc_item_event_filter,display_monst_event_filter; +//extern dlg_filter_t spend_xp_event_filter,get_num_of_items_event_filter,pick_race_abil_event_filter,sign_event_filter; +//extern dlg_filter_t get_text_response_event_filter,get_text_response_event_filter,select_pc_event_filter; +//extern dlg_filter_t give_pc_info_event_filter,alch_choice_event_filter,pc_graphic_event_filter,pc_name_event_filter; +//extern dlg_filter_t give_reg_info_event_filter,do_registration_event_filter,display_spells_event_filter; +//extern dlg_filter_t display_skills_event_filter,pick_spell_event_filter,prefs_event_filter,fancy_choice_dialog_event_filter; + RgnHandle clip_region; PaletteHandle new_palette,old_palette,wank_palette; @@ -103,15 +122,34 @@ char light_area[13][13]; char unexplored_area[13][13]; // Declare the graphics -GWorldPtr mixed_gworld, pc_stats_gworld, item_stats_gworld, text_area_gworld; -GWorldPtr storage_gworld,terrain_screen_gworld,text_bar_gworld,orig_text_bar_gworld,buttons_gworld; -GWorldPtr party_template_gworld,items_gworld,tiny_obj_gworld,fields_gworld; -extern GWorldPtr map_gworld,tiny_map_graphics ; -GWorldPtr dlg_buttons_gworld[NUM_BUTTONS][2],missiles_gworld,dlogpics_gworld; +GWorldPtr mixed_gworld; +GWorldPtr pc_stats_gworld; +GWorldPtr item_stats_gworld; +GWorldPtr text_area_gworld; +GWorldPtr storage_gworld; +GWorldPtr terrain_screen_gworld; +GWorldPtr text_bar_gworld; +GWorldPtr orig_text_bar_gworld; +GWorldPtr buttons_gworld; +GWorldPtr party_template_gworld; +GWorldPtr items_gworld; +GWorldPtr tiny_obj_gworld; +GWorldPtr fields_gworld; +GWorldPtr map_gworld; +GWorldPtr tiny_map_graphics; +GWorldPtr missiles_gworld; +GWorldPtr dlogpics_gworld; +GWorldPtr anim_gworld; +GWorldPtr talkfaces_gworld; +GWorldPtr pc_gworld; +GWorldPtr monst_gworld[10]; +GWorldPtr terrain_gworld[7]; // Startup graphics, will die when play starts GWorldPtr startup_gworld; -GWorldPtr startup_button_orig,startup_button_g,anim_mess; +GWorldPtr startup_button_orig; +GWorldPtr startup_button_g; +GWorldPtr anim_mess; // Graphics storage vals short which_g_stored[STORED_GRAPHICS]; @@ -156,17 +194,78 @@ location ok_space[4] = {{0,0},{0,0},{0,0},{0,0}}; PictInfo p,p2; + +void init_dialogs(){ + cd_init_dialogs( + &anim_gworld, + &talkfaces_gworld, + &items_gworld, + &tiny_obj_gworld, + &pc_gworld, + &dlogpics_gworld, + monst_gworld, + terrain_gworld, + &tiny_map_graphics, + &fields_gworld, + &pc_stats_gworld, + &item_stats_gworld, + &text_area_gworld, + &storage_gworld, + &terrain_screen_gworld, + &text_bar_gworld, + &orig_text_bar_gworld, + &buttons_gworld, + &party_template_gworld, + &mixed_gworld, + &spec_scen_g + ); + cd_register_event_filter(823,give_password_filter); + cd_register_event_filter(869,pick_prefab_scen_event_filter); + cd_register_event_filter(947,pick_a_scen_event_filter); + cd_register_event_filter(958,tip_of_day_event_filter); + cd_register_event_filter(960,talk_notes_event_filter); + cd_register_event_filter(961,adventure_notes_event_filter); + cd_register_event_filter(962,journal_event_filter); + cd_register_event_filter(987,display_item_event_filter); + cd_register_event_filter(988,pick_trapped_monst_event_filter); + cd_register_event_filter(989,edit_party_event_filter); + cd_register_event_filter(991,display_pc_event_filter); + cd_register_event_filter(996,display_alchemy_event_filter); + cd_register_event_filter(997,display_help_event_filter); + cd_register_event_filter(998,display_pc_item_event_filter); + cd_register_event_filter(999,display_monst_event_filter); + cd_register_event_filter(1010,spend_xp_event_filter ); + cd_register_event_filter(1012,get_num_of_items_event_filter ); + cd_register_event_filter(1013,pick_race_abil_event_filter ); + cd_register_event_filter(1014,sign_event_filter ); + cd_register_event_filter(873,get_text_response_event_filter ); + cd_register_event_filter(1017,get_text_response_event_filter ); + cd_register_event_filter(1018,select_pc_event_filter ); + cd_register_event_filter(1019,give_pc_info_event_filter); + cd_register_event_filter(1047,alch_choice_event_filter); + cd_register_event_filter(1050,pc_graphic_event_filter); + cd_register_event_filter(1051,pc_name_event_filter); + cd_register_event_filter(1073,give_reg_info_event_filter ); + cd_register_event_filter(1075,do_registration_event_filter ); + cd_register_event_filter(1096,display_spells_event_filter ); + cd_register_event_filter(1097,display_skills_event_filter ); + cd_register_event_filter(1098,pick_spell_event_filter ); + cd_register_event_filter(1099,prefs_event_filter ); + cd_register_default_event_filter(fancy_choice_dialog_event_filter); + //return &tmp; +} + void adjust_window_mode() { Rect r; if (display_mode == 5) { ul.h = 0; ul.v = 0; - SizeWindow(mainPtr,588,430, TRUE); + SizeWindow(mainPtr,594,430, TRUE); MoveWindow(mainPtr,(windRect.right - 573) / 2,(windRect.bottom - 430) / 2 + 20,TRUE); GetWindowPortBounds(mainPtr, &r); - } - else { + } + else { MoveWindow(mainPtr,-6,-6,TRUE); SizeWindow(mainPtr,windRect.right + 12, windRect.bottom + 12, TRUE); switch (display_mode) { @@ -301,19 +400,20 @@ void plop_fancy_startup() Set_up_win(); init_startup(); + + if(!PSD[SDF_SKIP_STARTUP]){ + //init_anim(0); + pict_to_draw = GetPicture(3000); - //init_anim(0); - pict_to_draw = GetPicture(3000); - - if (fry_startup == FALSE) { - //for(i=100; i >= 0; i-=2) DoOneGammaFade(md, i); + if (fry_startup == FALSE) { + //for(i=100; i >= 0; i-=2) DoOneGammaFade(md, i); - PaintRect(&whole_window); - // load and switch to new palette - GetPictInfo(pict_to_draw,&p,2,256,0,0); - new_palette = p.thePalette; - SetPalette(mainPtr,new_palette,FALSE); - ActivatePalette(mainPtr); + PaintRect(&whole_window); + // load and switch to new palette + GetPictInfo(pict_to_draw,&p,2,256,0,0); + new_palette = p.thePalette; + SetPalette(mainPtr,new_palette,FALSE); + ActivatePalette(mainPtr); // reerase menu /* GetPort(&oldPort); GetDeskTopGrafPort(&wMgrPort); @@ -333,24 +433,23 @@ void plop_fancy_startup() } // menu erased - PaintRect(&whole_window); - OffsetRect(&intro_from,(whole_window.right - intro_from.right) / 2,(whole_window.bottom - intro_from.bottom) / 2); - DrawPicture(pict_to_draw, &intro_from); - ReleaseResource((Handle) pict_to_draw); + PaintRect(&whole_window); + OffsetRect(&intro_from,(whole_window.right - intro_from.right) / 2,(whole_window.bottom - intro_from.bottom) / 2); + DrawPicture(pict_to_draw, &intro_from); + ReleaseResource((Handle) pict_to_draw); // NSetPalette(mainPtr,old_palette,pmAllUpdates); // ActivatePalette(mainPtr); - QDFlushPortBuffer(GetWindowPort(mainPtr), wholeRegion); - if (fry_startup == FALSE) { + QDFlushPortBuffer(GetWindowPort(mainPtr), wholeRegion); + if (fry_startup == FALSE) { - play_sound(-22); - EventRecord event; - WaitNextEvent(mDownMask + keyDownMask + mUpMask,&event,220,NULL); + play_sound(-22); + EventRecord event; + WaitNextEvent(mDownMask + keyDownMask + mUpMask,&event,220,NULL); } - DisposeRgn(wholeRegion); - - + DisposeRgn(wholeRegion); + } } void fancy_startup_delay() @@ -481,7 +580,7 @@ void draw_startup_stats() TextSize(20); OffsetRect(&to_rect,175,40); char_win_draw_string(mainPtr,to_rect, - "No Party in Memory",0,18); + "No Party in Memory",0,18,true); } if (party_in_memory == TRUE) { frame_rect = startup_top; @@ -493,7 +592,7 @@ void draw_startup_stats() OffsetRect(&to_rect,203,37); char_win_draw_string(mainPtr,to_rect, - "Your party:",0,18); + "Your party:",0,18,true); TextSize(12); TextFace(bold); TextFont(geneva_font_num); @@ -513,7 +612,7 @@ void draw_startup_stats() TextSize(14); OffsetRect(&pc_rect,35,0); char_win_draw_string(mainPtr,pc_rect, - adven[i].name,0,18); + adven[i].name,0,18,true); OffsetRect(&to_rect,pc_rect.left + 8,pc_rect.top + 8); } @@ -526,20 +625,20 @@ void draw_startup_stats() case 1: sprintf((char *) str,"Level %d Nephilim",adven[i].level); break; case 2: sprintf((char *) str,"Level %d Slithzerikai",adven[i].level); break; } - char_win_draw_string(mainPtr,pc_rect,(char *) str,0,18); + char_win_draw_string(mainPtr,pc_rect,(char *) str,0,18,true); OffsetRect(&pc_rect,0,13); sprintf((char *) str,"Health %d, Spell pts. %d", adven[i].max_health,adven[i].max_sp); - char_win_draw_string(mainPtr,pc_rect,(char *) str,0,18); + char_win_draw_string(mainPtr,pc_rect,(char *) str,0,18,true); break; case 2: - char_win_draw_string(mainPtr,pc_rect,"Dead",0,18); + char_win_draw_string(mainPtr,pc_rect,"Dead",0,18,true); break; case 3: - char_win_draw_string(mainPtr,pc_rect,"Dust",0,18); + char_win_draw_string(mainPtr,pc_rect,"Dust",0,18,true); break; case 4: - char_win_draw_string(mainPtr,pc_rect,"Stone",0,18); + char_win_draw_string(mainPtr,pc_rect,"Stone",0,18,true); break; } } @@ -552,10 +651,10 @@ void draw_startup_stats() OffsetRect(&pc_rect,5,5); pc_rect.top = pc_rect.bottom - 25; pc_rect.left = pc_rect.right - 300; - char_win_draw_string(mainPtr,pc_rect,"Copyright 1997, All Rights Reserved, v1.0.2",0,18); + char_win_draw_string(mainPtr,pc_rect,"Copyright 1997, All Rights Reserved, v1.0.2",0,18,true); if (registered == FALSE) { pc_rect.left = startup_from[0].left + 6; - char_win_draw_string(mainPtr,pc_rect,"Unregistered copy. To order, select How To Order.",0,18); + char_win_draw_string(mainPtr,pc_rect,"Unregistered copy. To order, select How To Order.",0,18,true); } ForeColor(blackColor); @@ -592,7 +691,7 @@ void draw_start_button(short which_position,short which_button) if (which_position == 3) OffsetRect(&to_rect,-7,0); char_win_draw_string(mainPtr,to_rect, - (char *) button_labels[which_position],1,18); + (char *) button_labels[which_position],1,18,true); ForeColor(blackColor); TextFont(geneva_font_num); TextFace(bold); @@ -688,7 +787,7 @@ void Set_up_win () GetFNum(fn3,&dungeon_font_num); temp_rect.bottom = (STORED_GRAPHICS / 10) * 36; - err = NewGWorld(&storage_gworld, 0 /*8*/,&temp_rect, NIL, NIL, 0); + err = NewGWorld(&storage_gworld, 0 /*8*/,&temp_rect, NULL, NULL, kNativeEndianPixMap); if (err != 0) { SysBeep(2); ExitToShell(); @@ -700,7 +799,7 @@ void Set_up_win () DisposeGWorld(temp_gworld); terrain_screen_gworld = load_pict(705); - err = NewGWorld(&party_template_gworld, 0 /*8*/,&pc_rect, NIL, NIL, 0); + err = NewGWorld(&party_template_gworld, 0 /*8*/,&pc_rect, NULL, NULL, kNativeEndianPixMap); if (err != 0) SysBeep(2); @@ -710,18 +809,22 @@ void Set_up_win () missiles_gworld = load_pict(880); dlogpics_gworld = load_pict(850); - for (i = 0; i < NUM_BUTTONS; i++) - for (j = 0; j < 2; j++) - dlg_buttons_gworld[i][j] = load_pict(2000 + (2 * i) + j); + // possibly not ideal place for this, but... + for (i = 0; i < 10; i++) + monst_gworld[i] = load_pict(1100 + i); + for (i = 0; i < 7; i++) + terrain_gworld[i] = load_pict(800 + i); + anim_gworld = load_pict(820); + talkfaces_gworld = load_pict(860); for (i = 0; i < 7; i++) bw_pats[i] = GetPattern(128 + i * 2); // Create and initialize map gworld - err = NewGWorld(&map_gworld, 0 /*8*/,&map_rect, NIL, NIL, 0); + err = NewGWorld(&map_gworld, 0 /*8*/,&map_rect, NULL, NULL, kNativeEndianPixMap); if (err != 0) { - play_sound(2);play_sound(2);play_sound(2); + play_sound(2,3); ExitToShell(); } else { @@ -824,8 +927,7 @@ void set_gworld_fonts(short font_num) } // redraw_screen does the very first redraw, and any full redraw -void redraw_screen(short mode) -{ +void redraw_screen(){ switch (overall_mode) { case 20: put_background(); @@ -1567,102 +1669,6 @@ void put_graphics_in_template() } } -unsigned short readUShort(unsigned char ** ptr) -{ - unsigned short ret = CFSwapInt16LittleToHost(*(unsigned short*)*ptr); - *ptr += 2; - return ret; -} -unsigned int readUInt(unsigned char **ptr) -{ - unsigned int ret = CFSwapInt32LittleToHost(*(unsigned int*)*ptr); - *ptr += 4; - return ret; -} - - -GWorldPtr load_bmp(unsigned char *data, long length) -{ - - if (length < 54) { - return NULL; // Too short for headers - } - unsigned char * cur = data + 10; - unsigned int offset = readUInt(&cur); - cur+=4; - unsigned int width = readUInt(&cur); - unsigned int height = readUInt(&cur); - cur += 2; - unsigned short bitCount = readUShort(&cur); - cur+=24; - int indexed; - unsigned int colourTable[256]; - int i; - if (bitCount == 8) { - if (length < 54 + 256 * 4) { - return NULL; - } - for (i = 0; i<256; ++i) { - unsigned char blue = *cur++; - unsigned char green = *cur++; - unsigned char red = *cur++; - cur++; - colourTable[i] = (red << 16) + (green << 8) + blue; - } - indexed = TRUE; - } - else if (bitCount == 24) { - indexed = FALSE; - } - else { - return NULL; - } - - int bmppadding = (width * bitCount / 8) % 4; - if (bmppadding != 0) { - bmppadding = 4 - bmppadding; - } - - if (length < offset + height * (bmppadding + width * bitCount / 8)) { - return NULL; - } - - cur = data + offset; - - GWorldPtr newGWorld; - Rect picRext = {0, 0, height, width}; - NewGWorld(&newGWorld,32,&picRext,NULL,NULL,0); - if (newGWorld == NULL) { - return NULL; - } - - PixMapHandle pixMap = GetGWorldPixMap(newGWorld); - LockPixels(pixMap); - unsigned int * picBuf = (unsigned int*) GetPixBaseAddr(pixMap); - int pixrow = ((*pixMap)->rowBytes & 0x3FFF) / 4; - - int j; - for (i = height - 1; i>= 0 ; --i) { - for (j=0; j 0) + if (PSD[306][5] > 0) return; targ.x = q; @@ -2375,7 +2381,7 @@ void boom_space(location where,short mode,short type,short damage,short sound) if ((damage < 10) && (dest_rect.right - dest_rect.left > 19)) text_rect.left += 10; OffsetRect(&text_rect,-4,-5); - char_win_draw_string(mainPtr,text_rect,(char *) dam_str,1,10); + char_win_draw_string(mainPtr,text_rect,(char *) dam_str,1,10,true); TextSize(0); TextFace(0); } @@ -2546,8 +2552,8 @@ void draw_targeting_line(Point where_curs) for (j = 0; j < 9; j++) { store_loc.x = center.x + i - 4; store_loc.y = center.y + j - 4; - if ((a_v(store_loc.x - which_space.x) <= 4) && - (a_v(store_loc.y - which_space.y) <= 4) && + if ((abs(store_loc.x - which_space.x) <= 4) && + (abs(store_loc.y - which_space.y) <= 4) && (current_pat.pattern[store_loc.x - which_space.x + 4][store_loc.y - which_space.y + 4] != 0)) { target_rect.left = 13 + BITMAP_WIDTH * i + 5 + ul.h; target_rect.right = target_rect.left + BITMAP_WIDTH; @@ -2763,4 +2769,4 @@ void HideShowMenuBar( ) LMSetGrayRgn( originalGrayRgn ); } -*/ +*/ \ No newline at end of file diff --git a/osx/blxgraphics.h b/osx/blxgraphics.h index f8b69492..a619c2cb 100644 --- a/osx/blxgraphics.h +++ b/osx/blxgraphics.h @@ -17,7 +17,7 @@ void Set_up_win (); void load_main_screen(); void create_clip_region(); void set_gworld_fonts(short font_num); -void redraw_screen(short mode); +void redraw_screen(); void put_background(); void draw_main_screen(); void refresh_screen(short mode); @@ -30,7 +30,7 @@ void load_area_graphics(); void add_to_wish_list(short which_g); Boolean reserve_graphic_num_in_array(short which_g); void place_graphic_num_in_array(short which_g); -GWorldPtr load_bmp(unsigned char *data, long length); +//GWorldPtr load_bmp(unsigned char *data, long length); void add_one_graphic(short which_g); void add_terrain_to_wish_list(unsigned char ter); void load_outdoor_graphics(); @@ -38,7 +38,7 @@ void add_monst_graphic(unsigned char m,short mode); void load_town_graphics(); void update_pc_graphics(); void put_graphics_in_template(); -GWorldPtr load_pict(short picture_to_get); +//GWorldPtr load_pict(short picture_to_get); void draw_terrain(short mode); void place_trim(short q,short r,location where,unsigned char ter_type); void draw_trim(short q,short r,short which_trim,short which_mode); @@ -65,3 +65,5 @@ void ShowMenuBar( void ); void FlushAndPause(unsigned long ticks); void draw_startup_anim(); +short cd_create_custom_dialog(WindowPtr parent, Str255 strs[6],short pic_num,short buttons[3]); +void init_dialogs(); \ No newline at end of file diff --git a/osx/blxtown_spec.c b/osx/blxtown_spec.c index a10076f5..07d741fc 100644 --- a/osx/blxtown_spec.c +++ b/osx/blxtown_spec.c @@ -12,7 +12,8 @@ #include "text.h" #include "item_data.h" #include "blxtown_spec.h" -#include "Exile.sound.h" +#include "soundtool.h" +#include "mathutil.h" extern short overall_mode; extern party_record_type party; @@ -162,8 +163,8 @@ Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff) r1 = get_ran(1,0,100) + diff; // Nimble? - if (adven[pc_num].traits[TRAIT_NIMBLE] == FALSE) - r1 += 6; // Changed -= to += so that nimble characters are _better_ at disarming traps + if (adven[pc_num].traits[TRAIT_NIMBLE]) + r1 -= 6; if (r1 < trap_odds[skill]) { @@ -270,15 +271,16 @@ void start_split(short a,short b,short noise) { short i; - party.stuff_done[304][0] = 1; - party.stuff_done[304][1] = c_town.p_loc.x; - party.stuff_done[304][2] = c_town.p_loc.y; + party.stuff_done[SDF_IS_PARTY_SPLIT] = 1; + party.stuff_done[SDF_PARTY_SPLIT_X] = c_town.p_loc.x; + party.stuff_done[SDF_PARTY_SPLIT_Y] = c_town.p_loc.y; + party.stuff_done[SDF_PARTY_SPLIT_TOWN] = c_town.town_num; c_town.p_loc.x = a; c_town.p_loc.y = b; for (i = 0; i < 6; i++) - if (i != party.stuff_done[304][3]) + if (i != party.stuff_done[SDF_PARTY_SPLIT_PC]) adven[i].main_status += 10; - current_pc = party.stuff_done[304][3]; + current_pc = party.stuff_done[SDF_PARTY_SPLIT_PC]; update_explored(c_town.p_loc); center = c_town.p_loc; if (noise > 0) diff --git a/osx/combat.c b/osx/combat.c index 0a816729..7502e31b 100644 --- a/osx/combat.c +++ b/osx/combat.c @@ -11,10 +11,12 @@ #include "items.h" #include "party.h" #include "combat.h" -#include "Exile.sound.h" +#include "soundtool.h" #include "town.h" #include "specials.h" #include "blx.g.utils.h" +#include "bldsexil.h" +#include "mathutil.h" extern party_record_type party; extern pc_record_type adven[6]; @@ -1310,8 +1312,8 @@ void do_combat_cast(location target)//// add_string_to_buf(" Demon resisted. "); else { r1 = get_ran(8 + bonus * 2, 1, 11); - if (PSD[4][0] == 3) // anama - r1 += 25; + //if (PSD[4][0] == 3) // anama + // r1 += 25; //play_sound(53); hit_space(cur_monst->m_loc,r1,4,0,current_pc); } diff --git a/osx/consts.h b/osx/consts.h index f42c7b8b..db31313c 100644 --- a/osx/consts.h +++ b/osx/consts.h @@ -17,7 +17,6 @@ #define NUM_OF_PCS 6 #define INVALID_PC NUM_OF_PCS - #define INVALID_TOWN 200 #define NUM_OF_BOATS 30 @@ -33,10 +32,30 @@ #define SFX_RUBBLE 128 /* stuff done flags */ -#define SDF_IS_PARTY_SPLIT 304][0 -#define SDF_PARTY_SPLIT_X 304][1 -#define SDF_PARTY_SPLIT_Y 304][2 -#define SDF_NO_INSTANT_HELP 306][4 // boolean +#define SDF_IS_PARTY_SPLIT 304][0 +#define SDF_PARTY_SPLIT_X 304][1 +#define SDF_PARTY_SPLIT_Y 304][2 +#define SDF_PARTY_SPLIT_PC 304][3 +#define SDF_PARTY_SPLIT_TOWN 304][4 // for future use, hopefully +#define SDF_SKIP_STARTUP 305][4 +#define SDF_LESS_SOUND 305][5 +#define SDF_NO_TARGET_LINE 305][6 +#define SFD_NO_MAPS 306][0 +#define SDF_NO_SOUNDS 306][1 +#define SDF_NO_FRILLS 306][2 +#define SDF_ROOM_DESCS_AGAIN 306][3 +#define SDF_NO_INSTANT_HELP 306][4 // boolean +#define SDF_NO_SHORE_FRILLS 306][5 +#define SDF_GAME_SPEED 306][6 +#define SDF_EASY_MODE 306][7 +#define SDF_LESS_WANDER_ENC 306][8 +#define SDF_NO_TER_ANIM 306][9 +/* + [305] + [4] will be Skip startup screen + [6] is No targeting line (use if getting crashes) + [5] is Fewer sounds (use if getting crashes) + */ /* overall mode; some seem to be missing */ #define MODE_OUTDOORS 0 @@ -161,6 +180,296 @@ #define TRAP_DISEASE 11 #define TRAP_DISEASE_ALL 12 +/* items[i].type a.k.a type of weapon */ +#define ITEM_EDGED 1 +#define ITEM_BASHING 2 +#define ITEM_POLE 3 + +/* items[i].variety a.k.a item type (in editor) */ +#define ITEM_TYPE_NO_ITEM 0 +#define ITEM_TYPE_ONE_HANDED 1 +#define ITEM_TYPE_TWO_HANDED 2 +#define ITEM_TYPE_GOLD 3 +#define ITEM_TYPE_BOW 4 +#define ITEM_TYPE_ARROW 5 +#define ITEM_TYPE_THROWN_MISSILE 6 +#define ITEM_TYPE_POTION 7 // potion/magic item +#define ITEM_TYPE_SCROLL 8 // scroll/magic item +#define ITEM_TYPE_WAND 9 +#define ITEM_TYPE_TOOL 10 +#define ITEM_TYPE_FOOD 11 +#define ITEM_TYPE_SHIELD 12 +#define ITEM_TYPE_ARMOR 13 +#define ITEM_TYPE_HELM 14 +#define ITEM_TYPE_GLOVES 15 +#define ITEM_TYPE_SHIELD_2 16 +/* don't know why a second type of shield is used ; it is actually checked + * in the armor code (item >= 12 and <= 17) + * and you can't equip another (12) shield while wearing it ... I didn't + * find a single item with this property in the bladbase.exs ... */ +#define ITEM_TYPE_BOOTS 17 +#define ITEM_TYPE_RING 18 +#define ITEM_TYPE_NECKLACE 19 +#define ITEM_TYPE_WEAPON_POISON 20 +#define ITEM_TYPE_NON_USE_OBJECT 21 +#define ITEM_TYPE_PANTS 22 +#define ITEM_TYPE_CROSSBOW 23 +#define ITEM_TYPE_BOLTS 24 +#define ITEM_TYPE_MISSILE_NO_AMMO 25 //e.g slings + +/* items[i].ability */ + +/* Weapons Ability */ +#define ITEM_NO_ABILITY 0 +#define ITEM_FLAMING_WEAPON 1 +#define ITEM_DEMON_SLAYER 2 +#define ITEM_UNDEAD_SLAYER 3 +#define ITEM_LIZARD_SLAYER 4 +#define ITEM_GIANT_SLAYER 5 +#define ITEM_MAGE_SLAYER 6 +#define ITEM_PRIEST_SLAYER 7 +#define ITEM_BUG_SLAYER 8 +#define ITEM_ACIDIC_WEAPON 9 +#define ITEM_SOULSUCKER 10 +#define ITEM_DRAIN_MISSILES 11 +#define ITEM_WEAK_WEAPON 12 +#define ITEM_CAUSES_FEAR 13 +#define ITEM_POISONED_WEAPON 14 + +/* General Ability */ +#define ITEM_PROTECTION 30 +#define ITEM_FULL_PROTECTION 31 +#define ITEM_FIRE_PROTECTION 32 +#define ITEM_COLD_PROTECTION 33 +#define ITEM_POISON_PROTECTION 34 +#define ITEM_MAGIC_PROTECTION 35 +#define ITEM_ACID_PROTECTION 36 +#define ITEM_SKILL 37 +#define ITEM_STRENGTH 38 +#define ITEM_DEXTERITY 39 +#define ITEM_INTELLIGENCE 40 +#define ITEM_ACCURACY 41 +#define ITEM_THIEVING 42 +#define ITEM_GIANT_STRENGTH 43 +#define ITEM_LIGHTER_OBJECT 44 +#define ITEM_HEAVIER_OBJECT 45 +#define ITEM_OCCASIONAL_BLESS 46 +#define ITEM_OCCASIONAL_HASTE 47 +#define ITEM_LIFE_SAVING 48 +#define ITEM_PROTECT_FROM_PETRIFY 49 +#define ITEM_REGENERATE 50 +#define ITEM_POISON_AUGMENT 51 +#define ITEM_DISEASE_PARTY 52 +#define ITEM_WILL 53 +#define ITEM_FREE_ACTION 54 +#define ITEM_SPEED 55 +#define ITEM_SLOW_WEARER 56 +#define ITEM_PROTECT_FROM_UNDEAD 57 +#define ITEM_PROTECT_FROM_DEMONS 58 +#define ITEM_PROTECT_FROM_HUMANOIDS 59 +#define ITEM_PROTECT_FROM_REPTILES 60 +#define ITEM_PROTECT_FROM_GIANTS 61 +#define ITEM_PROTECT_FROM_DISEASE 62 + +/* NonSpell Use ; the constant refers to both the positive and negative effect (don't mind the name). */ +#define ITEM_POISON_WEAPON 70 //put poison on weapon +#define ITEM_BLESS_CURSE 71 +#define ITEM_AFFECT_POISON 72 +#define ITEM_HASTE_SLOW 73 +#define ITEM_AFFECT_INVULN 74 +#define ITEM_AFFECT_MAGIC_RES 75 +#define ITEM_AFFECT_WEB 76 +#define ITEM_AFFECT_DISEASE 77 +#define ITEM_AFFECT_SANCTUARY 78 +#define ITEM_AFFECT_DUMBFOUND 79 +#define ITEM_AFFECT_MARTYRS_SHIELD 80 +#define ITEM_AFFECT_SLEEP 81 +#define ITEM_AFFECT_PARALYSIS 82 +#define ITEM_AFFECT_ACID 83 +#define ITEM_BLISS 84 +#define ITEM_AFFECT_EXPERIENCE 85 +#define ITEM_AFFECT_SKILL_POINTS 86 +#define ITEM_AFFECT_HEALTH 87 +#define ITEM_AFFECT_SPELL_POINTS 88 +#define ITEM_DOOM 89 +#define ITEM_LIGHT 90 +#define ITEM_STEALTH 91 +#define ITEM_FIREWALK 92 +#define ITEM_FLYING 93 +#define ITEM_MAJOR_HEALING 94 + +/* Spell Usable */ + +#define ITEM_SPELL_FLAME 110 +#define ITEM_SPELL_FIREBALL 111 +#define ITEM_SPELL_FIRESTORM 112 +#define ITEM_SPELL_KILL 113 +#define ITEM_SPELL_ICE_BOLT 114 +#define ITEM_SPELL_SLOW 115 +#define ITEM_SPELL_SHOCKWAVE 116 +#define ITEM_SPELL_DISPEL_UNDEAD 117 +#define ITEM_SPELL_DISPEL_SPIRIT 118 +#define ITEM_SPELL_SUMMONING 119 +#define ITEM_SPELL_MASS_SUMMONING 120 +#define ITEM_SPELL_ACID_SPRAY 121 +#define ITEM_SPELL_STINKING_CLOUD 122 +#define ITEM_SPELL_SLEEP_FIELD 123 +#define ITEM_SPELL_VENOM 124 +#define ITEM_SPELL_SHOCKSTORM 125 +#define ITEM_SPELL_PARALYSIS 126 +#define ITEM_SPELL_WEB_SPELL 127 +#define ITEM_SPELL_STRENGTHEN_TARGET 128 //wand of carrunos effect +#define ITEM_SPELL_QUICKFIRE 129 +#define ITEM_SPELL_MASS_CHARM 130 +#define ITEM_SPELL_MAGIC_MAP 131 +#define ITEM_SPELL_DISPEL_BARRIER 132 +#define ITEM_SPELL_MAKE_ICE_WALL 133 +#define ITEM_SPELL_CHARM_SPELL 134 +#define ITEM_SPELL_ANTIMAGIC_CLOUD 135 + +/* Reagents */ +#define ITEM_HOLLY 150 // Holly/Toadstool +#define ITEM_COMFREY_ROOT 151 +#define ITEM_GLOWING_NETTLE 152 +#define ITEM_CRYPT_SHROOM 153 // Crypt Shroom/Wormgr. +#define ITEM_ASPTONGUE_MOLD 154 +#define ITEM_EMBER_FLOWERS 155 +#define ITEM_GRAYMOLD 156 +#define ITEM_MANDRAKE 157 +#define ITEM_SAPPHIRE 158 +#define ITEM_SMOKY_CRYSTAL 159 +#define ITEM_RESSURECTION_BALM 160 +#define ITEM_LOCKPICKS 161 + +/* Missiles */ + +#define ITEM_MISSILE_RETURNING 170 +#define ITEM_MISSILE_LIGHTNING 171 +#define ITEM_MISSILE_EXPLODING 172 +#define ITEM_MISSILE_ACID 173 +#define ITEM_MISSILE_SLAY_UNDEAD 174 +#define ITEM_MISSILE_SLAY_DEMON 175 +#define ITEM_MISSILE_HEAL_TARGET 176 + +/* Monsters Stuff */ + +/* Skills Same as PC */ + +/* Monster Type */ + +#define MONSTER_TYPE_HUMAN 0 +#define MONSTER_TYPE_REPTILE 1 +#define MONSTER_TYPE_BEAST 2 +#define MONSTER_TYPE_IMPORTANT 3 +#define MONSTER_TYPE_MAGE 4 +#define MONSTER_TYPE_PRIEST 5 +#define MONSTER_TYPE_HUMANOID 6 +#define MONSTER_TYPE_DEMON 7 +#define MONSTER_TYPE_UNDEAD 8 +#define MONSTER_TYPE_GIANT 9 +#define MONSTER_TYPE_SLIME 10 +#define MONSTER_TYPE_STONE 11 +#define MONSTER_TYPE_BUG 12 +#define MONSTER_TYPE_DRAGON 13 +#define MONSTER_TYPE_MAGICAL 14 + +/* Attack Types */ + +#define MONSTER_ATTACK_SWINGS 0 +#define MONSTER_ATTACK_CLAWS 1 +#define MONSTER_ATTACK_BITES 2 +#define MONSTER_ATTACK_SLIMES 3 +#define MONSTER_ATTACK_PUNCHES 4 +#define MONSTER_ATTACK_STINGS 5 +#define MONSTER_ATTACK_CLUBS 6 +#define MONSTER_ATTACK_BURNS 7 +#define MONSTER_ATTACK_HARMS 8 +#define MONSTER_ATTACK_STABS 9 + +/* Special Ability a.k.a spec_skill */ + +#define MONSTER_NO_SPECIAL_ABILITY 0 +#define MONSTER_THROWS_DARTS 1 +#define MONSTER_SHOOTS_ARROWS 2 +#define MONSTER_THROWS_SPEARS 3 +#define MONSTER_THROWS_ROCKS1 4 //4-24 damages +#define MONSTER_THROWS_ROCKS2 5 //5-30 damages +#define MONSTER_THROWS_ROCKS3 6 //6-36 damages +#define MONSTER_THROWS_RAZORDISKS 7 +#define MONSTER_PETRIFICATION_RAY 8 +#define MONSTER_SP_DRAIN_RAY 9 //spell points drain ray +#define MONSTER_HEAT_RAY 10 +#define MONSTER_INVISIBLE 11 +#define MONSTER_SPLITS 12 +#define MONSTER_MINDLESS 13 +#define MONSTER_BREATHES_STINKING_CLOUDS 14 +#define MONSTER_ICY_TOUCH 15 +#define MONSTER_XP_DRAINING_TOUCH 16 +#define MONSTER_ICY_AND_DRAINING_TOUCH 17 +#define MONSTER_SLOWING_TOUCH 18 +#define MONSTER_SHOOTS_WEB 19 +#define MONSTER_GOOD_ARCHER 20 +#define MONSTER_STEALS_FOOD 21 +#define MONSTER_PERMANENT_MARTYRS_SHIELD 22 +#define MONSTER_PARALYSIS_RAY 23 +#define MONSTER_DUMBFOUNDING_TOUCH 24 +#define MONSTER_DISEASE_TOUCH 25 +#define MONSTER_ABSORB_SPELLS 26 +#define MONSTER_WEB_TOUCH 27 +#define MONSTER_SLEEP_TOUCH 28 +#define MONSTER_PARALYSIS_TOUCH 29 +#define MONSTER_PETRIFICATION_TOUCH 30 +#define MONSTER_ACID_TOUCH 31 +#define MONSTER_BREATHES_SLEEP_CLOUDS 32 +#define MONSTER_ACID_SPIT 33 +#define MONSTER_SHOOTS_SPINES 34 +#define MONSTER_DEATH_TOUCH 35 +#define MONSTER_INVULNERABILITY 36 +#define MONSTER_GUARD 37 + +/* Create Monsters/Fields */ + +#define MONSTER_NO_RADIATE 0 +#define MONSTER_RADIATE_FIRE_FIELDS 1 +#define MONSTER_RADIATE_ICE_FIELDS 2 +#define MONSTER_RADIATE_SHOCK_FIELDS 3 +#define MONSTER_RADIATE_ANTIMAGIC_FIELDS 4 +#define MONSTER_RADIATE_SLEEP_FIELDS 5 +#define MONSTER_RADIATE_STINKING_CLOUDS 6 +//as said 7,8 and 9 are unused +#define MONSTER_SUMMON1 10 //5 percent chance +#define MONSTER_SUMMON2 11 //20 percent chance +#define MONSTER_SUMMON3 12 //50 percent chance +//as said 13 and 14 are unused +#define MONSTER_DEATH_TRIGGERS 15 //death triggers global special + +/* Terrains Specials Properties : scenario.ter_types[i].special */ //complete + +#define TER_SPEC_NONE 0 +#define TER_SPEC_CHANGE_WHEN_STEP_ON 1 +#define TER_SPEC_DOES_FIRE_DAMAGE 2 +#define TER_SPEC_DOES_COLD_DAMAGE 3 +#define TER_SPEC_DOES_MAGIC_DAMAGE 4 +#define TER_SPEC_POISON_LAND 5 +#define TER_SPEC_DISEASED_LAND 6 +#define TER_SPEC_CRUMBLING_TERRAIN 7 +#define TER_SPEC_LOCKABLE_TERRAIN 8 +#define TER_SPEC_UNLOCKABLE_TERRAIN 9 +#define TER_SPEC_UNLOCKABLE_BASHABLE 10 +#define TER_SPEC_IS_A_SIGN 11 +#define TER_SPEC_CALL_LOCAL_SPECIAL 12 +#define TER_SPEC_CALL_SCENARIO_SPECIAL 13 +#define TER_SPEC_IS_A_CONTAINER 14 +#define TER_SPEC_WATERFALL 15 +#define TER_SPEC_CONVEYOR_NORTH 16 +#define TER_SPEC_CONVEYOR_EAST 17 +#define TER_SPEC_CONVEYOR_SOUTH 18 +#define TER_SPEC_CONVEYOR_WEST 19 +#define TER_SPEC_BLOCKED_TO_MONSTERS 20 +#define TER_SPEC_TOWN_ENTRANCE 21 +#define TER_SPEC_CAN_BE_USED 22 +#define TER_SPEC_CALL_SPECIAL_WHEN_USED 23 + //stuff used in blxactions.c //Startup button rects (also used in startup.c) diff --git a/osx/dialogutils.c b/osx/dialogutils.c index 780fb866..d2d5140c 100644 --- a/osx/dialogutils.c +++ b/osx/dialogutils.c @@ -16,11 +16,14 @@ #include "blxtown_spec.h" #include "bldsexil.h" #include "items.h" -#include "Exile.sound.h" +#include "soundtool.h" #include "stdio.h" -#include "dlogtool.h" +#include "dlgtool.h" +#include "dlgconsts.h" #include "newgraph.h" #include "info.dialogs.h" +#include "graphtool.h" +#include "mathutil.h" #define NUM_HINTS 30 #include @@ -44,10 +47,6 @@ extern ControlHandle text_sbar,item_sbar,shop_sbar; extern Boolean modeless_exists[18]; extern DialogPtr modeless_dialogs[18] ; extern town_item_list t_i; - -extern pascal Boolean cd_event_filter(); -extern Boolean dialog_not_toast; - extern Boolean game_run_before; extern ModalFilterUPP main_dialog_UPP; extern scenario_data_type scenario; @@ -144,7 +143,7 @@ void start_shop_mode(short shop_type,short shop_min,short shop_max,short cost_ad OffsetRect(&area_rect, -1 * area_rect.left,-1 * area_rect.top); if (talk_gworld == NULL) - NewGWorld(&talk_gworld, 0 /*8*/,&area_rect, NIL, NIL, 0); + NewGWorld(&talk_gworld, 0 /*8*/,&area_rect, NULL, NULL, kNativeEndianPixMap); store_pre_shop_mode = overall_mode; overall_mode = MODE_SHOPPING; @@ -525,7 +524,7 @@ void start_talk_mode(short m_num,short personality,unsigned char monst_type,shor store_talk_face_pic = store_face_pic; //// area_rect = talk_area_rect; OffsetRect(&area_rect, -1 * area_rect.left,-1 * area_rect.top); - NewGWorld(&talk_gworld, 0 /*8*/,&area_rect, NIL, NIL, 0); + NewGWorld(&talk_gworld, 0 /*8*/,&area_rect, NULL, NULL, kNativeEndianPixMap); // first make sure relevant talk strs are loaded in if (personality / 10 != cur_town_talk_loaded) @@ -576,7 +575,7 @@ void end_talk_mode() put_item_screen(stat_window,0); put_pc_screen(); //refresh_screen(0); - redraw_screen(0); + redraw_screen(); } void handle_talk_event(Point p) @@ -1114,7 +1113,7 @@ long get_text_item_num(short item_num,DialogPtr the_dialog) void sign_event_filter (short item_hit) { - dialog_not_toast = FALSE; + toast_dialog(); } void do_sign(short town_num, short which_sign, short sign_type,location sign_loc) @@ -1133,8 +1132,8 @@ void do_sign(short town_num, short which_sign, short sign_type,location sign_loc store_sign_mode = sign_type; if (terrain_pic[sign_type] < 1000) - csp(1014,3,terrain_pic[sign_type]); - else csp(1014,3,94); + csp(1014,3,terrain_pic[sign_type],PICT_TER_TYPE); + else csp(1014,3,94,PICT_TER_TYPE); if (town_num >= 200) { town_num -= 200; @@ -1146,14 +1145,7 @@ void do_sign(short town_num, short which_sign, short sign_type,location sign_loc } csit(1014,2,(char *) sign_text); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + item_hit = cd_run_dialog(); cd_kill_dialog(1014,0); } @@ -1163,7 +1155,7 @@ void give_reg_info_event_filter (short item_hit) { switch (item_hit) { case 1: - dialog_not_toast = FALSE; + toast_dialog(); break; } } @@ -1177,15 +1169,8 @@ void give_reg_info() make_cursor_sword(); cd_create_dialog_parent_num(1073,0); - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); cd_kill_dialog(1073,0); } @@ -1197,7 +1182,7 @@ void do_registration_event_filter (short item_hit) { Str255 get_text; - cd_retrieve_text_edit_str(1075,(char *) get_text); + //cd_retrieve_text_edit_str(1075,(char *) get_text); dialog_answer = 0; #ifndef EXILE_BIG_GUNS sscanf((char *) get_text,"%hd",&dialog_answer); @@ -1206,7 +1191,7 @@ void do_registration_event_filter (short item_hit) sscanf((char *) get_text,"%d",&dummy); dialog_answer = dummy; #endif - dialog_not_toast = FALSE; + toast_dialog(); } void do_registration() @@ -1220,14 +1205,7 @@ void do_registration() cdsin(1075,7,(short) register_flag); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + item_hit = cd_run_dialog(); cd_kill_dialog(1075,0); @@ -1454,7 +1432,7 @@ void save_prefs() UseResFile(app_res_num); } -Boolean prefs_event_filter (short item_hit) +void prefs_event_filter (short item_hit) { Boolean done_yet = FALSE,did_cancel = FALSE; short i; @@ -1462,12 +1440,12 @@ Boolean prefs_event_filter (short item_hit) switch (item_hit) { case 1: done_yet = TRUE; - dialog_not_toast = FALSE; + toast_dialog(); break; case 2: done_yet = TRUE; - dialog_not_toast = FALSE; + toast_dialog(); did_cancel = TRUE; break; @@ -1505,7 +1483,7 @@ Boolean prefs_event_filter (short item_hit) party.stuff_done[306][7] = cd_get_led(1099,38); party.stuff_done[306][8] = cd_get_led(1099,40); party.stuff_done[306][9] = cd_get_led(1099,43); - party.stuff_done[296][0] = cd_get_led(1099,45); + party.stuff_done[306][5] = cd_get_led(1099,45); if (cd_get_led(1099,32) == 1) PSD[306][6] = 0; if (cd_get_led(1099,34) == 1) @@ -1531,8 +1509,6 @@ Boolean prefs_event_filter (short item_hit) give_delays = party.stuff_done[306][2]; save_prefs(); } - - return FALSE; } void pick_preferences() @@ -1555,7 +1531,7 @@ void pick_preferences() cd_set_led(1099,38,(party.stuff_done[306][7] != 0) ? 1 : 0); cd_set_led(1099,40,(party.stuff_done[306][8] != 0) ? 1 : 0); cd_set_led(1099,43,(party.stuff_done[306][9] != 0) ? 1 : 0); - cd_set_led(1099,45,(party.stuff_done[296][0] != 0) ? 1 : 0); + cd_set_led(1099,45,(party.stuff_done[306][5] != 0) ? 1 : 0); if (PSD[306][6] == 3) cd_set_led(1099,47,1); else cd_set_led(1099,32 + PSD[306][6] * 2,1); @@ -1563,16 +1539,9 @@ void pick_preferences() if (party.help_received[55] == 0) { cd_initial_draw(1099); give_help(55,0,1099); - } - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); cd_kill_dialog(1099,0); adjust_window_mode(); @@ -1591,16 +1560,16 @@ void put_party_stats() cd_set_flag(989,6 + 5 * i,96); cd_activate_item(989,35 + i,1); cd_activate_item(989,42 + i,1); - csp(989,42 + i,800 + adven[i].which_graphic); - } - else { - cd_set_item_text(989,5 + 5 * i,"Empty."); - cd_activate_item(989,7 + 5 * i,0); - cd_activate_item(989,8 + 5 * i,0); - cd_set_flag(989,6 + 5 * i,98); - cd_activate_item(989,35 + i,0); - cd_activate_item(989,42 + i,0); - } + csp(989,42 + i,adven[i].which_graphic,PICT_PC_TYPE); + } + else { + cd_set_item_text(989,5 + 5 * i,"Empty."); + cd_activate_item(989,7 + 5 * i,0); + cd_activate_item(989,8 + 5 * i,0); + cd_set_flag(989,6 + 5 * i,98); + cd_activate_item(989,35 + i,0); + cd_activate_item(989,42 + i,0); + } } draw_startup(0); @@ -1612,7 +1581,7 @@ void edit_party_event_filter (short item_hit) switch (item_hit) { case 1: - dialog_not_toast = FALSE; + toast_dialog(); break; case 41: @@ -1687,15 +1656,9 @@ void edit_party(short can_create,short can_cancel) if (party.help_received[22] == 0) { cd_initial_draw(989); give_help(22,23,989); - } -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); cd_kill_dialog(989,0); @@ -1716,7 +1679,7 @@ void tip_of_day_event_filter (short item_hit) switch (item_hit) { case 1: - dialog_not_toast = FALSE; + toast_dialog(); break; case 5: @@ -1751,15 +1714,8 @@ void tip_of_day() csit(958,3,(char *) place_str); cd_set_led(958,7,give_intro_hint); - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); cd_kill_dialog(958,0); save_prefs(); @@ -1774,22 +1730,22 @@ void put_scen_info() for (i = 0; i < 3; i++) if (scen_headers[store_scen_page_on * 3 + i].flag1 != 0) { - cd_set_pict(947, 6 + i * 3,1600 + scen_headers[store_scen_page_on * 3 + i].intro_pic); + cd_set_pict(947, 6 + i * 3,scen_headers[store_scen_page_on * 3 + i].intro_pic,PICT_SCEN_TYPE); sprintf((char *) place_str, "%s v%d.%d.%d - | Difficulty: %s, Rating: %s |%s |%s", - data_store->scen_header_strs[store_scen_page_on * 3 + i][0], + data_store->scen_header_strs[store_scen_page_on * 3 + i][0].c_str(), (short) scen_headers[store_scen_page_on * 3 + i].ver[0], (short) scen_headers[store_scen_page_on * 3 + i].ver[1], (short) scen_headers[store_scen_page_on * 3 + i].ver[2], difficulty[scen_headers[store_scen_page_on * 3 + i].difficulty], ratings[scen_headers[store_scen_page_on * 3 + i].default_ground], - data_store->scen_header_strs[store_scen_page_on * 3 + i][1], - data_store->scen_header_strs[store_scen_page_on * 3 + i][2]); + data_store->scen_header_strs[store_scen_page_on * 3 + i][1].c_str(), + data_store->scen_header_strs[store_scen_page_on * 3 + i][2].c_str()); csit(947,7 + i * 3,(char *) place_str); cd_activate_item(947,8 + i * 3,1); } else { - cd_set_pict(947, 6 + i * 3,950); + cd_set_pict(947, 6 + i * 3,0,PICT_BLANK_TYPE); csit(947,7 + i * 3,""); cd_activate_item(947,8 + i * 3,0); } @@ -1801,7 +1757,7 @@ void pick_a_scen_event_filter (short item_hit) switch (item_hit) { case 1: dialog_answer = -1; - dialog_not_toast = FALSE; + toast_dialog(); break; case 3: case 4: @@ -1820,7 +1776,7 @@ void pick_a_scen_event_filter (short item_hit) case 8: case 11: case 14: dialog_answer = ((item_hit - 8) / 3) + store_scen_page_on * 3; - dialog_not_toast = FALSE; + toast_dialog(); break; } @@ -1852,15 +1808,9 @@ short pick_a_scen() if (store_num_scen <= 3) { cd_activate_item(947,3,0); cd_activate_item(947,4,0); - } -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); cd_kill_dialog(947,0); return dialog_answer; } @@ -1872,12 +1822,12 @@ void pick_prefab_scen_event_filter (short item_hit) switch (item_hit) { case 1: dialog_answer = -1; - dialog_not_toast = FALSE; + toast_dialog(); break; case 6: case 9: case 12: dialog_answer = ((item_hit - 6) / 3); - dialog_not_toast = FALSE; + toast_dialog(); break; } @@ -1892,15 +1842,8 @@ short pick_prefab_scen() cd_create_dialog_parent_num(869,0); cd_activate_item(869,2,0); - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); cd_kill_dialog(869,0); return dialog_answer; } @@ -1911,7 +1854,7 @@ void give_password_filter (short item_hit) switch (item_hit) { default: - dialog_not_toast = FALSE; + toast_dialog(); break; } @@ -1927,16 +1870,9 @@ Boolean enter_password() CDSN(823,2,0); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &town_strs_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &town_strs_hit); -#endif + town_strs_hit = cd_run_dialog(); - CDGT(823,(char *) temp_str); + CDGT(823,2,(char *) temp_str); i = wd_to_pwd(temp_str); cd_kill_dialog(823,0); diff --git a/osx/dialogutils.h b/osx/dialogutils.h index e87941f0..2edadefa 100644 --- a/osx/dialogutils.h +++ b/osx/dialogutils.h @@ -21,7 +21,7 @@ void do_talk(short personality, unsigned char m_num); void edit_party_event_filter (short item_hit); void put_party_stats(); void edit_party(short can_create,short can_cancel); -Boolean prefs_event_filter (short item_hit); +void prefs_event_filter (short item_hit); void pick_preferences() ; void check_pref_file() ; long open_pref_file(); diff --git a/osx/dlogtool.c b/osx/dlogtool.c deleted file mode 100644 index c6b27bce..00000000 --- a/osx/dlogtool.c +++ /dev/null @@ -1,1867 +0,0 @@ -#include - -#define ND 15 -#define NI 500 -#define NL 100 -#define NUM_DLOG_B 53 - -#include "global.h" -#include "stdio.h" -#include "string.h" -#include "Exile.sound.h" -#include "dlogtool.h" -#include "text.h" -#include "blxgraphics.h" -#include "blx.g.utils.h" -#include "loc_utils.h" - -extern Boolean play_sounds,cursor_shown,dialog_not_toast; -extern WindowPtr mainPtr; -extern Boolean modeless_exists[18]; -extern DialogPtr modeless_dialogs[18]; -extern Rect windRect; - -extern GWorldPtr mixed_gworld, pc_stats_gworld, item_stats_gworld, text_area_gworld; -extern GWorldPtr storage_gworld,terrain_screen_gworld,text_bar_gworld,orig_text_bar_gworld,buttons_gworld; -extern GWorldPtr party_template_gworld,items_gworld,tiny_obj_gworld,fields_gworld; -extern GWorldPtr dlg_buttons_gworld[NUM_BUTTONS][2]; -extern GWorldPtr pcs_gworld,dlogpics_gworld; -extern PixPatHandle bg[14]; -extern short dungeon_font_num,geneva_font_num; -extern unsigned char m_pic_index_x[200]; -extern unsigned char m_pic_index_y[200]; -extern unsigned char m_pic_index[200]; -extern GWorldPtr spec_scen_g; - -short current_key = 0; -short dlg_keys[ND]; -short dlg_types[ND]; -WindowPtr dlgs[ND]; -WindowPtr dlg_parent[ND]; -short dlg_highest_item[ND]; -Boolean dlg_draw_ready[ND]; - -short item_dlg[NI]; -short item_number[NI]; -char item_type[NI]; -Rect item_rect[NI]; -short item_flag[NI]; -char item_active[NI]; -char item_key[NI]; -short item_label[NI]; -short item_label_loc[NI]; - -char text_long_str[10][256]; -char text_short_str[140][35]; -char labels[NL][25]; -Boolean label_taken[NL]; - - -short store_free_slot,store_dlog_num; - -short available_dlog_buttons[NUM_DLOG_B] = {0,63,64,65,1,4,5,8, - 128, - 9, - 10, // 10 - 11,12,13, - 14,15,16,17,29, 51, - 60,61,62, // 20 - 66,69,70, 71,72,73,74,79, - 80,83,86,87,88, 91,92,93,99,100, - 101,102,104, 129,130,131,132,133,134,135,136,137}; -short button_type[150] = {1,1,4,5,1,1,0,0,1,1, - 1,1,1,1,1,1,1,1,8,8, - 9,9,9,1,1,2,1,6,7,1, - 1,12,1,1,2,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,1,1,1,2,1,1,1,2,2, // 50 - 1,1,1,1,1,1,2,3,1,1, - 1,1,1,1,2,2,2,2,2,1, - 1,1,1,1,2,2,1,1,1,2, - 0,1,1,1,14,13,12,12,12,1, - 1,1,1,2,1,2,2,2,2,1, // 100 - 2,2,2,2,2,2,2,2,2,2, - 2,2,2,2,2,2,2,2,1,1, - 1,1,1,1,1,1,1,1,0,0, - 0,0,0,0,0,0,0,0,0,0}; -char *button_strs[150] = {"Done ","Ask"," "," ","Keep", "Cancel","+","-","Buy","Leave", - "Get","1","2","3","4","5","6","Cast"," "," ", - " "," "," ","Buy","Sell","Other Spells","Buy x10"," "," ","Save", - "Race","Train","Items","Spells","Heal Party","1","2","3","4","5", - "6","7","8","9","10","11","12","13","14","15", - /*50*/ "16","Take","Create","Delete","Race/Special","Skill","Name","Graphic","Bash Door","Pick Lock", - "Leave","Steal","Attack","OK","Yes","No","Step In"," ","Record","Climb", - "Flee","Onward","Answer","Drink","Approach","Mage Spells","Priest Spells","Advantages","New Game","Land", - "Under","Restore","Restart","Quit","Save First","Just Quit","Rest","Read","Pull","Alchemy", - "17","Push","Pray","Wait","","","Delete","Graphic","Create","Give", - /*100*/ "Destroy","Pay","Free","Next Tip","Touch", "Select Icon","Create/Edit","Clear Special","Edit Abilities","Choose", - "Go Back","Create New","General","One Shots","Affect PCs","If-Thens","Town Specs","Out Specs","Advanced","Weapon Abil", - "General Abil.","NonSpell Use","Spell Usable","Reagents","Missiles","Abilities","Pick Picture","Animated","Enter","Burn", - "Insert","Remove","Accept","Refuse","Open","Close","Sit","Stand","","", - "18","19","20","Invisible!","","","","","",""}; -short button_left_adj[150] = {2,0,0,0,6,0,0,0,4,5, - 0,0,0,0,0,0,0,4,0,0, - 0,0,0,4,0,5,0,0,0,6, - 6,6,0,0,0,0,0,0,0,0, - 0,0,0,0,6,6,6,6,6,6, - 6,6,0,2,0,0,0,2,3,3, // 50 - 6,6,0,7,5,5,0,0,2,6, - 4,2,0,5,0,4,10,4,0,6, - 6,2,1,6,4,3,6,4,6,4, - 6,6,6,6,0,0,0,2,0,4, - 2,6,6,3,6,7,3,0,0,0, // 100 - 0,5,3,3,3,3,3,4,4,4, - 6,4,4,2,2,3,6,5,6,6, - 0,4,2,2,6,4,6,3,0,0, - 0,0,0,0,0,0,0,0,0,0 - }; -char button_def_key[150] = {0,0,20,21,'k', 24,0,0,0,0, - 'g','1','2','3','4', '5','6',0,0,0, - 0,0,0,0,0,' ',0,22,23,0, - 0,0,0,0,0,'1','2','3','4','5', - '6','7','8','9','a', 'b','c','d','e','f', - 'g',0,0,0,0,0,0,0,0,0, - 0,0,0,0,'y','n',0,'?','r',0, - 0,0,0,0,0,0,0,0,0, 0, - 0,0,0,0,0,0,0,0,0,0, - 'g',0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0 - }; - // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc - // 25-30 ctrl 1-6 31 - return\ - - -void beep() -{ - SysBeep(20); -} - -void cd_init_dialogs() -{ - short i; - - for (i = 0; i < ND; i++) { - dlg_keys[i] = -1; - dlg_types[i] = 0; - dlgs[i] = NULL; - dlg_highest_item[i] = 0; - } - for (i = 0; i < NI; i++) { - item_dlg[i] = -1; - } - for (i = 0; i < NL; i++) { - label_taken[i] = FALSE; - } -} - - -short cd_create_dialog_parent_num(short dlog_num,short parent) -{ - short i; - - if ((parent == 0) || (parent == 1)) - return cd_create_dialog(dlog_num,mainPtr); - i = cd_get_dlg_index(parent); - if (i < 0) - return -1; - return cd_create_dialog(dlog_num,dlgs[i]); - -} - -short cd_create_custom_dialog(WindowPtr parent, - Str255 strs[6],short pic_num,short buttons[3]) -{ - - short i,j,free_slot = -1,free_item = -1,str_width,cur_but_right = 0; - WindowPtr dlg; - short total_len = 0; - - - short cur_item = 1; - short but_items[3] = {-1,-1,-1}; - Rect pic_rect = {8,8,44,44},cur_text_rect = {2,50,0,0}; - short win_width = 100, win_height = 100; - - store_dlog_num = 900; - //store_parent = parent; - for (i = 0; i < ND; i++) { - if ((dlg_keys[i] >= 0) && (dlg_types[i] == 900)) - return -1; - } - for (i = 0; i < ND; i++) { - if (dlg_keys[i] < 0) { - free_slot = i; - i = 500; - } - } - if (free_slot < 0) - return -2; - - // quick check, to make sure there's at least 1 button - if ((buttons[0] < 0) && (buttons[1] < 0) && (buttons[2] < 0)) - buttons[0] = 1; - current_key++; - dlg_keys[free_slot] = current_key; - dlg_types[free_slot] = 900; - dlg_highest_item[free_slot] = 1; - dlg_draw_ready[free_slot] = FALSE; - dlgs[free_slot] = NULL; - - // first, create dummy dlog - store_free_slot = free_slot; - dlg = GetDialogWindow(GetNewDialog (900, NIL, IN_FRONT)); - dlgs[free_slot] = dlg; - if (dlgs[free_slot] == NULL) { - play_sound(3); - return -3; - } - - dlg_parent[free_slot] = parent; - - //process_new_window (dlgs[free_slot]); - // instead of this, custom make items - free_item = -1; - - // first, do 1-3 buttons - for (i = 0; i < 3; i++) - if (buttons[i] >= 0) {// buttons - for (j = 150; j < NI; j++) - if (item_dlg[j] < 0) { - free_item = j; - j = NI + 1; - } - item_dlg[free_item] = store_dlog_num; - item_type[free_item] = (i == 0) ? 1 : 0; - item_number[free_item] = cur_item; - //item_rect[free_item] = get_item_rect(hDlg,i + 1); - - item_flag[free_item] = available_dlog_buttons[buttons[i]]; - item_active[free_item] = 1; - item_label[free_item] = 0; - item_label_loc[free_item] = -1; - item_key[free_item] = button_def_key[available_dlog_buttons[buttons[i]]]; - if (i == 0) - item_key[free_item] = 31; - but_items[i] = free_item; // remember this to set item rect later - cur_item++; - } - // next, the upper left picture (always there) - for (j = 150; j < NI; j++) - if (item_dlg[j] < 0) { - free_item = j; - j = NI + 1; - } - item_dlg[free_item] = store_dlog_num; - item_type[free_item] = 5; - item_number[free_item] = cur_item; - item_rect[free_item] = pic_rect; - - if (pic_num < 0) { - item_flag[free_item] = pic_num * -1; - } - else //if (pic_num < 1000) - item_flag[free_item] = pic_num; -// else item_flag[free_item] = (pic_num % 1000) + 2400; -// if (pic_num >= 2000) -// item_flag[free_item] += 300; - item_active[free_item] = 1; - item_label[free_item] = 0; - item_label_loc[free_item] = -1; - item_key[free_item] = 0; - cur_item++; - - // finally, 0-6 text, first do preprocessing to find out how much room we need - for (i = 0; i < 6; i++) - total_len += string_length((char *) strs[i]); - total_len = total_len * 12; - str_width = ex_sqrt(total_len) + 20; - //print_nums(0,total_len,str_width); - if (str_width < 340) - str_width = 340; - cur_text_rect.right = cur_text_rect.left + str_width; - // finally, 0-6 text, then create the items - for (i = 0; i < 6; i++) - if (strlen((char *) strs[i]) > 0) {// text - for (j = 0; j < 10; j++) - if (item_dlg[j] < 0) { - free_item = j; - j = NI + 1; - } - item_dlg[free_item] = store_dlog_num; - item_type[free_item] = 9; - item_number[free_item] = cur_item; - item_rect[free_item] = cur_text_rect; - item_rect[free_item].bottom = item_rect[free_item].top + - ((string_length((char *) strs[i]) + 60) / str_width) * 12 + 16; - item_rect[free_item].right += 20; - - //print_nums(i,string_length((char *) strs[i]),str_width); - cur_text_rect.top = item_rect[free_item].bottom + 8; - item_flag[free_item] = 0; - item_active[free_item] = 1; - item_label[free_item] = 0; - item_label_loc[free_item] = -1; - item_key[free_item] = 0; - sprintf(text_long_str[free_item],"%s", - (char *) strs[i]); - cur_item++; - } - - dlg_highest_item[free_slot] = cur_item - 1; - - // finally, do button rects - cur_but_right = cur_text_rect.right + 30; - //cur_text_rect.top += 8; - for (i = 0; i < 3; i++) - if (buttons[i] >= 0) { - item_rect[but_items[i]].right = cur_but_right; - item_rect[but_items[i]].top = cur_text_rect.top; - item_rect[but_items[i]].bottom = item_rect[but_items[i]].top + 23; - if (button_type[available_dlog_buttons[buttons[i]]] == 1) - item_rect[but_items[i]].left = item_rect[but_items[i]].right - 63; - else item_rect[but_items[i]].left = item_rect[but_items[i]].right - 110; - cur_but_right = item_rect[but_items[i]].left - 4; - if (i == 0) { - win_width = item_rect[but_items[i]].right + 6; - win_height = item_rect[but_items[i]].bottom + 6; - } - } - - MoveWindow(dlgs[free_slot],(windRect.right - win_width) / 2,(windRect.bottom - win_width) / 2 + 20,FALSE); - SizeWindow(dlgs[free_slot],win_width,win_height,FALSE); - - ShowWindow(dlgs[free_slot]); - SetPort(GetWindowPort(dlgs[free_slot])); - TextFont(geneva_font_num); - TextFace(bold); - TextSize(10); - ForeColor(blackColor); - BackColor(whiteColor); - dialog_not_toast = TRUE; - - return 0; -} - -short cd_create_dialog(short dlog_num,WindowPtr parent) -{ - short i,free_slot = -1; - WindowPtr dlg; - - - store_dlog_num = dlog_num; - //store_parent = parent; - for (i = 0; i < ND; i++) { - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - return -1; - } - for (i = 0; i < ND; i++) { - if (dlg_keys[i] < 0) { - free_slot = i; - i = 500; - } - } - if (free_slot < 0) - return -2; - current_key++; - dlg_keys[free_slot] = current_key; - dlg_types[free_slot] = dlog_num; - dlg_highest_item[free_slot] = 1; - dlg_draw_ready[free_slot] = FALSE; - dlgs[free_slot] = NULL; - - // first, create dummy dlog - store_free_slot = free_slot; - //dlg = CreateDialog(store_hInstance,MAKEINTRESOURCE(dlog_num),0,d_proc); - dlg = GetDialogWindow(GetNewDialog (dlog_num, NIL, IN_FRONT)); - dlgs[free_slot] = dlg; - if (dlgs[free_slot] == NULL) { - play_sound(3); - return -3; - } -// center_window(dlgs[free_slot]); - - dlg_parent[free_slot] = parent; - - process_new_window (dlgs[free_slot]); - - - switch (dlog_num) { -/* case 1010: SetWTitle(dlgs[free_slot],"Training a PC"); break; - case 1014: SetWTitle(dlgs[free_slot],"Reading a Sign"); break; - case 1015: SetWTitle(dlgs[free_slot],"Talking to Someone"); break; - case 1018: SetWTitle(dlgs[free_slot],"Select a PC"); break; - case 1019: SetWTitle(dlgs[free_slot],"In a Shop"); break; - case 1020: SetWTitle(dlgs[free_slot],"In a Shop"); break; - case 1021: SetWTitle(dlgs[free_slot],"Buying Food"); break; - case 1048: SetWTitle(dlgs[free_slot],"Visiting the Healer"); break; - case 1050: SetWTitle(dlgs[free_slot],"Pick PC Graphic"); break; - case 998: SetWTitle(dlgs[free_slot],"Item Info"); break; - case 992: SetWTitle(dlgs[free_slot],"PC Spells"); break; - case 1097: SetWTitle(dlgs[free_slot],"Skills Library"); break; - case 1096: SetWTitle(dlgs[free_slot],"Spells Library"); break; - case 999: SetWTitle(dlgs[free_slot],"Monster Library"); break; - case 997: SetWTitle(dlgs[free_slot],"Help Library"); break; - case 995: SetWTitle(dlgs[free_slot],"Introduction"); break; - case 996: SetWTitle(dlgs[free_slot],"Alchemy"); break; - case 1013: SetWTitle(dlgs[free_slot],"Races/Advantages"); break; - case 1099: SetWTitle(dlgs[free_slot],"Preferences"); break; - case 1098: SetWTitle(dlgs[free_slot],"Casting a Spell"); break; - case 987: SetWTitle(dlgs[free_slot],"Getting Items"); break; - case 989: SetWTitle(dlgs[free_slot],"Create a Party"); break; - case 1047: SetWTitle(dlgs[free_slot],"Do Alchemy"); break;*/ - } - - ShowWindow(dlgs[free_slot]); - SetPort(GetWindowPort(dlgs[free_slot])); - TextFont(geneva_font_num); - TextFace(bold); - TextSize(10); - ForeColor(blackColor); - BackColor(whiteColor); - dialog_not_toast = TRUE; - //DestroyWindow(dlg); //Necesary? Dunno. - -/* if (dlg_parent[free_slot] != NULL) { - EnableWindow(dlg_parent[free_slot],FALSE); - if (dlg_parent[free_slot] == mainPtr) - for (i = 0; i < 18; i++) - if (modeless_exists[i] == TRUE) - EnableWindow(modeless_dialogs[i],FALSE); - } */ - return 0; -} - -void process_new_window (WindowPtr hDlg) { - short i = -1,j,free_slot = -1,free_item = -1,type,flag; - Str255 item_str; - Boolean str_stored = FALSE; - Rect store_rect; - short win_height = 0, win_width = 0; - short the_type; - Handle the_handle = NULL; - Rect small_rect; - short num_items; - short str_offset = 1; - - free_slot = store_free_slot; - num_items = CountDITL(GetDialogFromWindow(hDlg)); - - dlg_highest_item[free_slot] = 0; - - // Now, give the window its items - for (i = 0; i < num_items; i++) { - str_offset = 1; - GetDialogItem( GetDialogFromWindow(hDlg), i + 1, &the_type, &the_handle, &small_rect); - if (the_type % 128 == 8) { - GetDialogItemText(the_handle,item_str); - p2c(item_str); - dlg_highest_item[free_slot]++; - str_stored = FALSE; - if (strlen((char *)item_str) == 0) { - sprintf((char *) item_str, "+"); - type = 3; - flag = 1; - str_stored = TRUE; - } - else if (item_str[0] == '+') { // default is framed text - type = 3; - flag = 1; - str_stored = TRUE; - } - else if (item_str[0] == '*') { - type = 3; - flag = 0; - str_stored = TRUE; - } - else if (item_str[0] == '~') { - type = 7; - flag = 0; - str_stored = TRUE; - } - else if (item_str[0] == '!') { - type = 4; - flag = 0; - str_stored = TRUE; - } - else if (item_str[0] == '=') { - type = 9; - flag = 1; - str_stored = TRUE; - } - else if (((item_str[0] >= 65) && (item_str[0] <= 122)) || (item_str[0] == '"')) { - type = 9; - flag = 0; - str_offset = 0; - str_stored = TRUE; - } - else if ((item_str[0] == '^') || (item_str[0] == '&')) { - type = (item_str[0] == '^') ? 10 : 11; - flag = 1; - if (string_length((char *) item_str) > 55) - flag = 2; - str_stored = TRUE; - } - else { -#ifndef EXILE_BIG_GUNS - sscanf((char *) item_str,"%hd_%hd",&type,&flag); -#endif -#ifdef EXILE_BIG_GUNS - sscanf((char *) item_str,"%hd_%hd",&type,&flag); - //type = typel; flag = flagl; -#endif - } - - free_item = -1; - // find free item - switch (type) { - case 0: case 1: case 2: case 5: case 6: - for (j = 150; j < NI; j++) - if (item_dlg[j] < 0) { - free_item = j; - j = NI + 1; - } - break; - default: - if ((type == 9) || - ((str_stored == TRUE) && (strlen((char *) item_str) > 35))) { - for (j = 0; j < 10; j++) - if (item_dlg[j] < 0) { - free_item = j; - j = NI + 1; - } - } - else { - for (j = 10; j < 140; j++) - if (item_dlg[j] < 0) { - free_item = j; - j = NI + 1; - } - } - break; - } - - if (free_item >= 0) { - item_dlg[free_item] = store_dlog_num; - item_type[free_item] = type; - item_number[free_item] = i + 1; - - item_rect[free_item] = get_item_rect(hDlg,i + 1); - - item_flag[free_item] = flag; - item_active[free_item] = 1; - item_label[free_item] = 0; - item_label_loc[free_item] = -1; - item_key[free_item] = 0; - switch (type) { - case 0: case 1: - if (item_flag[free_item] != 143) { - GetPortBounds(dlg_buttons_gworld[button_type[flag]][0], &store_rect); - item_rect[free_item].right = item_rect[free_item].left + store_rect.right; - item_rect[free_item].bottom = item_rect[free_item].top + store_rect.bottom; - item_key[free_item] = button_def_key[flag]; - if (type == 1) - item_key[free_item] = 31; - } - break; - case 2: - item_rect[free_item].right = item_rect[free_item].left + 14; - item_rect[free_item].bottom = item_rect[free_item].top + 10; - item_key[free_item] = 255; - break; - case 3: case 4: case 7: case 8: case 9: case 10: case 11: - sprintf(((free_item < 10) ? text_long_str[free_item] : text_short_str[free_item - 10]),""); - if (str_stored == TRUE) { - if (free_item < 10) - sprintf(text_long_str[free_item],"%s", - (char *) (item_str + str_offset)); - else - sprintf(text_short_str[free_item - 10],"%-34s", - (char *) (item_str + str_offset)); - } - item_key[free_item] = 255; - if (type >= 10) { - GetPortBounds(dlg_buttons_gworld[1][0], &store_rect); - item_rect[free_item].right = item_rect[free_item].left + store_rect.right; - item_rect[free_item].bottom = item_rect[free_item].top + store_rect.bottom; - if (type == 11) - item_key[free_item] = 31; - } - break; - } - win_height = max(win_height, item_rect[free_item].bottom + 5); - win_width = max(win_width, item_rect[free_item].right + 6); - - } - - } - } - ShortenDITL(GetDialogFromWindow(hDlg),dlg_highest_item[free_slot]); - SizeWindow(hDlg,win_width,win_height,FALSE); - dlg_highest_item[free_slot] = num_items; - } - - -short cd_kill_dialog(short dlog_num,short parent_message) -{ - short i,which_dlg = -1; - - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - which_dlg = i; - if (which_dlg < 0) - return -1; - - for (i = 0; i < NI; i++) - if (item_dlg[i] == dlog_num) { - if (item_label[i] > 0) - label_taken[item_label_loc[i]] = FALSE; - item_dlg[i] = -1; - } - -/* if (dlg_parent[which_dlg] != NULL) { - EnableWindow(dlg_parent[which_dlg],TRUE); - if (dlg_parent[which_dlg] == mainPtr) - for (i = 0; i < 18; i++) - if (modeless_exists[i] == TRUE) - EnableWindow(modeless_dialogs[i],TRUE); - SetFocus(dlg_parent[which_dlg]); - SetWindowPos(dlg_parent[which_dlg],WindowPtr_TOP,0,0,100,100, - SWP_NOMOVE | SWP_NOSIZE); - cd_set_edit_focus(); - } */ -// if (parent_message > 0) -// SendMessage(dlg_parent[which_dlg],WM_COMMAND,parent_message,0); - - DisposeDialog(GetDialogFromWindow(dlgs[which_dlg])); - dlg_keys[which_dlg] = -1; - if (dlg_parent[which_dlg] != NULL) - SetPortWindowPort(dlg_parent[which_dlg]); - dialog_not_toast = TRUE; - return 0; -} - -short cd_process_click(WindowPtr window,Point the_point, short mods,short *item) -{ - short i,which_dlg,dlg_num,item_id; - short dlog_key; - - if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlog_key)) < 0) - return -1; - - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) - if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { - if ((PtInRect(the_point,&item_rect[item_id])) && (item_active[item_id] > 0) - && ((item_type[item_id] < 3) || (item_type[item_id] == 8) - || (item_type[item_id] == 10)|| (item_type[item_id] == 11))) { - *item = i; - if ((mods & 2048) != 0) - *item += 100; - if (item_type[item_id] != 8) - cd_press_button(dlg_num,i); - - return dlg_num; - } - } - return -1; -} - - - -short cd_process_keystroke(WindowPtr window,char char_hit,short *item) -{ - short i,which_dlg,dlg_num,dlg_key,item_id; - - if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlg_key)) < 0) - return -1; - // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc - // 25-30 ctrl 1-6 - - - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) - if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { - if ((item_key[item_id] == char_hit) && (item_active[item_id] > 0) - && ((item_type[item_id] < 3) || (item_type[item_id] == 8) - || (item_type[item_id] == 10) || (item_type[item_id] == 11))) { - *item = i; - if (item_type[item_id] != 8) - cd_press_button(dlg_num,i); - return dlg_num; - } - } - - // kludgy. If you get an escape and is isn't processed, make it an enter - if (char_hit == 24) { - char_hit = 31; - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) - if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { - if ((item_key[item_id] == char_hit) && (item_active[item_id] > 0) - && ((item_type[item_id] < 3) || (item_type[item_id] == 8))) { - *item = i; - if (item_type[item_id] != 8) - cd_press_button(dlg_num,i); - return dlg_num; - } - } - } - return -1; -} - -/* -void cd_init_button(short dlog_num,short item_num, short button_num, short status) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - if (item_type[item_index] > 1) { - beep(); - return; - } - item_flag[item_index] = button_num; - item_active[item_index] = status; - item_rect[item_index].right = item_rect[item_index].left + button_width[button_num]; - item_rect[item_index].bottom = item_rect[item_index].top + button_width[button_num]; - item_key[item_index] = button_def_key[button_num]; - cd_draw_item(dlog_num,item_num); -} -*/ - -void cd_attach_key(short dlog_num,short item_num,char key) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - if ((item_type[item_index] > 2) && (item_type[item_index] != 8)) { - beep(); - return; - } - item_key[item_index] = key; -} - -void csp(short dlog_num, short item_num, short pict_num) -{ - cd_set_pict( dlog_num, item_num, pict_num); -} - -void cd_set_pict(short dlog_num, short item_num, short pict_num) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - if (item_type[item_index] != 5) { - beep(); - return; - } - item_flag[item_index] = pict_num; - if (pict_num == -1) - cd_erase_item(dlog_num,item_num); - else cd_draw_item(dlog_num,item_num); -} - -void cd_activate_item(short dlog_num, short item_num, short status) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - item_active[item_index] = status; - cd_draw_item(dlog_num,item_num); -} - -short cd_get_active(short dlog_num, short item_num) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return -1; - - return item_active[item_index]; -} - - -void cd_get_item_text(short dlog_num, short item_num, char *str) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return ; - if (item_index >= 150) { - beep(); - return; - } - if (item_index < 10) - sprintf(str,"%s",text_long_str[item_index]); - else sprintf(str,"%s",text_short_str[item_index - 10]); -} - -void csit(short dlog_num, short item_num, char *str) -{ -cd_set_item_text( dlog_num, item_num, str); -} - -void cd_retrieve_text_edit_str(short dlog_num, char *str) -{ - short dlg_index,item_index; - short the_type; - Handle the_handle = NULL; - Rect the_rect; - Str255 store_ptr; - - sprintf(str,""); - if (cd_get_indices(dlog_num,3,&dlg_index,&item_index) < 0) - return ; - GetDialogItem(GetDialogFromWindow(dlgs[dlg_index]), 2, &the_type, &the_handle, &the_rect); - GetDialogItemText(the_handle,store_ptr); - p2c(store_ptr); - strcpy(str,(char *) store_ptr); -} - -// NOTE!!! Expects a c string -void cd_set_text_edit_str(short dlog_num, char *str) -{ - short dlg_index,item_index; - short the_type; - Handle the_handle = NULL; - Rect the_rect; - Str255 store_ptr; - - if (cd_get_indices(dlog_num,3,&dlg_index,&item_index) < 0) - return ; - - strcpy((char *) store_ptr,str); - c2p(store_ptr); - GetDialogItem( GetDialogFromWindow(dlgs[dlg_index]), 2, &the_type, &the_handle, &the_rect ); - SetDialogItemText ( the_handle, store_ptr); - -} - - -short cd_retrieve_text_edit_num(short dlog_num, short item_num) -{ - short dlg_index; - short the_type; - Handle the_handle = NULL; - Rect the_rect; - Str255 store_ptr; - long num_given; - - if ((dlg_index = cd_get_dlg_index(dlog_num)) < 0) { - SysBeep(50); return 0; - } - GetDialogItem( GetDialogFromWindow(dlgs[dlg_index]), item_num, &the_type, &the_handle, &the_rect); - GetDialogItemText(the_handle,store_ptr); - StringToNum (store_ptr,&num_given); - return (short) num_given; -} - - -// NOTE!!! Expects a c string -void cd_set_text_edit_num(short dlog_num, short item_num, short num) -{ - short dlg_index; - short the_type; - Handle the_handle = NULL; - Rect the_rect; - Str255 store_ptr; - - if ((dlg_index = cd_get_dlg_index(dlog_num)) < 0) { - SysBeep(50); return ; - } - - sprintf((char *) store_ptr,"%d",num); - c2p(store_ptr); - GetDialogItem( GetDialogFromWindow(dlgs[dlg_index]), item_num, &the_type, &the_handle, &the_rect ); - SetDialogItemText ( the_handle, store_ptr); -} - -void cd_set_item_text(short dlog_num, short item_num, char *str) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return ; - if (item_index >= 150) { - beep(); - return; - } - if (item_index < 10) - sprintf(text_long_str[item_index],"%s",str); - else sprintf(text_short_str[item_index - 10],"%-34s",str); - cd_draw_item( dlog_num,item_num); -} - -void cdsin(short dlog_num, short item_num, short num) -{ - cd_set_item_num( dlog_num, item_num, num); -} - - -void cd_set_item_num(short dlog_num, short item_num, short num) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return ; - if (item_index >= 150) { - beep(); - return; - } - if (item_index < 10) - sprintf(text_long_str[item_index],"%d",num); - else sprintf(text_short_str[item_index - 10],"%d",num); - cd_draw_item( dlog_num,item_num); -} - -void cd_set_led(short dlog_num,short item_num,short state) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - if (item_type[item_index] != 2) { - beep(); - return; - } - item_flag[item_index] = state; - cd_draw_item(dlog_num,item_num); -} - -void cd_set_flag(short dlog_num,short item_num,short flag) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - item_flag[item_index] = flag; - cd_draw_item(dlog_num,item_num); -} - - -short cd_get_led(short dlog_num,short item_num) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return 0; - - if (item_type[item_index] != 2) { - beep(); - return 0; - } - return item_flag[item_index]; -} - - -void cd_text_frame(short dlog_num,short item_num,short frame) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - if (item_index >= 150) { - beep(); - return; - } - item_flag[item_index] = frame; - cd_draw_item(dlog_num,item_num); -} - -void cd_add_label(short dlog_num, short item_num, char *label, short label_flag) -{ - short dlg_index,item_index,label_loc = -1; - short i; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - if (item_label_loc[item_index] < 0) { - item_label[item_index] = label_flag; - for (i = 0; i < 100; i++) - if (label_taken[i] == FALSE) { - label_loc = i; - label_taken[i] = TRUE; - i = 100; - } - if (label_loc < 0) { - beep(); - return; - } - item_label_loc[item_index] = label_loc; - } - else cd_erase_item(dlog_num,item_num + 100); - label_loc = item_label_loc[item_index]; - sprintf((char *) labels[label_loc],"%-24s",label); - if (item_active[item_index] > 0) - cd_draw_item(dlog_num,item_num); -} - -void cd_take_label(short dlog_num, short item_num) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - item_label[item_index] = 0; - label_taken[item_label_loc[item_index]] = FALSE; -} - -void cd_key_label(short dlog_num, short item_num,short loc) -{ - short dlg_index,item_index; - char str[10]; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - sprintf((char *) str," "); - str[0] = item_key[item_index]; - cd_add_label(dlog_num,item_num, str, 7 + loc * 100); -} - -void cd_draw_item(short dlog_num,short item_num) -{ - short dlg_index,item_index,store_label; - RGBColor c[3] = {{0,0,0},{65535,0,0},{0,0,8192}}; - Rect from_rect,to_rect; - GrafPtr old_port; - - - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - if (dlg_draw_ready[dlg_index] == FALSE) - return; - - GetPort(&old_port); - SetPortWindowPort(dlgs[dlg_index]); - - if (item_active[item_index] == 0) { - cd_erase_item(dlog_num,item_num); - cd_erase_item(dlog_num,item_num + 100); - } - else { - switch (item_type[item_index]) { - case 0: case 1: case 10: case 11: - if (item_flag[item_index] == 143) - break; - GetPortBounds(dlg_buttons_gworld[button_type[item_flag[item_index]]][0], &from_rect); - rect_draw_some_item(dlg_buttons_gworld[button_type[item_flag[item_index]]][0],from_rect, - dlg_buttons_gworld[button_type[item_flag[item_index]]][0],item_rect[item_index],0,2); - RGBForeColor(&c[2]); - TextSize(12); - if (item_type[item_index] < 2) - OffsetRect(&item_rect[item_index],-1 * button_left_adj[item_flag[item_index]],0); - if (item_type[item_index] < 2) { - char_win_draw_string(dlgs[dlg_index],item_rect[item_index], - (char *) (button_strs[item_flag[item_index]]),1,8); - } - else { - char_win_draw_string(dlgs[dlg_index],item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),1,8); - } - if (item_type[item_index] < 2) - OffsetRect(&item_rect[item_index],button_left_adj[item_flag[item_index]],0); - TextSize(10); - ForeColor(blackColor); - break; - - case 2: - GetPortBounds(dlg_buttons_gworld[9][0], &from_rect); - switch (item_flag[item_index]) { - case 0: rect_draw_some_item( dlg_buttons_gworld[10][0],from_rect, dlg_buttons_gworld[10][0],item_rect[item_index],0,2); break; - case 1: rect_draw_some_item( dlg_buttons_gworld[9][1],from_rect, dlg_buttons_gworld[9][1],item_rect[item_index],0,2); break; - case 2: rect_draw_some_item( dlg_buttons_gworld[9][0],from_rect, dlg_buttons_gworld[9][0],item_rect[item_index],0,2); break; - } - break; - - case 3: case 4: case 7: case 8: case 9: - cd_erase_item(dlog_num,item_num); - /*if ((item_type[item_index] == 3) || (item_type[item_index] == 9)) - SelectObject(win_dc,small_bold_font); */ - if (item_type[item_index] == 4) - TextFace(0); - if (item_type[item_index] == 7) - TextSize(12); - if (item_flag[item_index] % 10 == 1) - cd_frame_item(dlog_num,item_num,2); - ForeColor(whiteColor); - if ((item_type[item_index] == 8) && (dlog_num == 989)) { - TextFace(0); - TextFont(dungeon_font_num); - TextSize(18); - item_rect[item_index].right -= 4; - ClipRect(&item_rect[item_index]); - item_rect[item_index].right += 4; - - item_rect[item_index].bottom += 12; - } - if (item_flag[item_index] >= 10) { - //SetTextColor(win_dc,PALETTEINDEX(c[1])); - RGBForeColor(&c[1]); - } - if (item_rect[item_index].bottom - item_rect[item_index].top < 20) { - item_rect[item_index].left += 3; - char_win_draw_string(dlgs[dlg_index],item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),3,12); - item_rect[item_index].left -= 3; - } - else { - InsetRect(&item_rect[item_index],4,4); - char_win_draw_string(dlgs[dlg_index],item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),0,(item_type[item_index] == 7) ? 14 : 12); - InsetRect(&item_rect[item_index],-4,-4); - } - if ((item_type[item_index] == 8) && (dlog_num == 989)) { - item_rect[item_index].bottom -= 12; - undo_clip(); - } - TextFont(geneva_font_num); - TextFace(0); - TextFace(bold); - TextSize(10); - ForeColor(blackColor); - break; - - case 5: - if (item_flag[item_index] == -1) - cd_erase_item(dlog_num,item_num); - else draw_dialog_graphic(GetWindowPort(dlgs[dlg_index]), item_rect[item_index], item_flag[item_index], - (item_flag[item_index] >= 3000) ? FALSE : TRUE,0); - break; - } - } - - if (item_label[item_index] != 0) { - store_label = item_label[item_index]; - if (store_label >= 1000) { - store_label -= 1000; - //SelectObject(win_dc,bold_font); - } - else { - TextFace(0); - //SelectObject(win_dc,tiny_font); - } - to_rect = item_rect[item_index]; - switch (store_label / 100) { - case 0: - to_rect.right = to_rect.left; - to_rect.left -= 2 * (store_label % 100); - break; - case 1: - to_rect.bottom = to_rect.top; - to_rect.top -= 2 * (store_label % 100); - break; - case 2: - to_rect.left = to_rect.right; - to_rect.right += 2 * (store_label % 100); - break; - case 3: - to_rect.top = to_rect.bottom; - to_rect.bottom += 2 * (store_label % 100); - break; - } - - if (to_rect.bottom - to_rect.top < 14) { - to_rect.bottom += (14 - (to_rect.bottom - to_rect.top)) / 2 + 1; - to_rect.top -= (14 - (to_rect.bottom - to_rect.top)) / 2 + 1; - } - else OffsetRect(&to_rect, 0,(to_rect.bottom - to_rect.top) / 6); - //cd_erase_rect(dlog_num,to_rect); - if (item_active[item_index] != 0) { - ForeColor(whiteColor); - - char_win_draw_string(dlgs[dlg_index],to_rect, - labels[item_label_loc[item_index]],2,12); - ForeColor(blackColor); - - } - TextFace(bold); - } - - // hook in special stuff. kludgy - if ((dlog_num == 1098) && ((item_num >= 18) && (item_num <= 23))) { - draw_pc_effects(10 + item_num - 18); - } - - SetPort(old_port); - } - -void cd_initial_draw(short dlog_num) -{ - short i,which_dlg = -1; - - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - which_dlg = i; - if (which_dlg < 0) { - return; - } - dlg_draw_ready[which_dlg] = TRUE; - - cd_erase_item(dlog_num, 0); - cd_draw(dlog_num); -} - -void cd_draw(short dlog_num) -{ - short i,which_dlg = -1; - - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - which_dlg = i; - if (which_dlg < 0) - return; - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) { - cd_draw_item(dlog_num,i); - } -} - -void cd_redraw(WindowPtr window) -{ - short which_dlg,dlg_num,dlg_key; - - if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlg_key)) < 0) - return; - dlg_draw_ready[which_dlg] = TRUE; - cd_initial_draw(dlg_num); -} - -void cd_frame_item(short dlog_num, short item_num, short width) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - frame_dlog_rect(GetWindowPort(dlgs[dlg_index]), item_rect[item_index], width); -} - -void cd_erase_item(short dlog_num, short item_num) -// if item_num is 0, nail whole window -// item_num + 100 just erase label -{ - short i,dlg_index,item_index,store_label; - Rect to_fry; - Boolean just_label = FALSE; - GrafPtr old_port; - - - - if (item_num >= 100) { - item_num -= 100; - just_label = TRUE; - } - - if (item_num == 0) { - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - dlg_index = i; - //GetWindowRect(dlgs[dlg_index],&to_fry); - GetWindowPortBounds(dlgs[dlg_index],&to_fry); - //OffsetRect(&to_fry,-1 * to_fry.left,-1 * to_fry.top); - } - else { - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - to_fry = item_rect[item_index]; - if (just_label == TRUE) { - if (item_label[item_index] != 0) { - store_label = item_label[item_index]; - if (store_label >= 1000) - store_label -= 1000; - - switch (store_label / 100) { - case 0: - to_fry.right = to_fry.left; - to_fry.left -= 2 * (store_label % 100); - break; - case 1: - to_fry.bottom = to_fry.top; - to_fry.top -= 2 * (store_label % 100); - break; - case 2: - to_fry.left = to_fry.right; - to_fry.right += 2 * (store_label % 100); - break; - case 3: - to_fry.top = to_fry.bottom; - to_fry.bottom += 2 * (store_label % 100); - break; - } - if ((i = 12 - (to_fry.bottom - to_fry.top)) > 0) { - // adjust rect ... but doesn't work for bold letters - to_fry.bottom += i / 2; - to_fry.bottom++; // extra pixel to get dangly letters - to_fry.top -= i / 2; - } - } - } - InsetRect(&to_fry,-1,-1); - - } - if (dlg_draw_ready[dlg_index] == FALSE) { - return; - } - GetPort(&old_port); - SetPortWindowPort(dlgs[dlg_index]); - FillCRect(&to_fry,bg[5]); - SetPort(old_port); -} - -void cd_erase_rect(short dlog_num,Rect to_fry) -{ - short dlg_index; - GrafPtr old_port; - - if ((dlg_index = cd_get_dlg_index(dlog_num)) < 0) - return; - if (dlg_draw_ready[dlg_index] == FALSE) - return; - - GetPort(&old_port); - SetPortWindowPort(dlgs[dlg_index]); - FillCRect(&to_fry,bg[5]); - SetPort(old_port); -} - -void cd_press_button(short dlog_num, short item_num) -{ - short dlg_index,item_index; - Rect from_rect; - GrafPtr old_port; - RGBColor c[2] = {{0,0,4096},{0,0,8192}}; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - // no press action for redio buttons - if ((item_type[item_index] == 2) || (item_flag[item_index] == 143)) { - play_sound(34); - return; - } - - GetPort(&old_port); - SetPortWindowPort(dlgs[dlg_index]); - - - ForeColor(blackColor); - TextSize(12); - GetPortBounds(dlg_buttons_gworld[button_type[item_flag[item_index]]][0], &from_rect); - rect_draw_some_item(dlg_buttons_gworld[button_type[item_flag[item_index]]][1],from_rect, - dlg_buttons_gworld[button_type[item_flag[item_index]]][1],item_rect[item_index],0,2); - TextFace(bold); - RGBForeColor(&c[0]); - if (item_type[item_index] < 2) { - OffsetRect(&item_rect[item_index],-1 * button_left_adj[item_flag[item_index]],0); - char_win_draw_string(dlgs[dlg_index],item_rect[item_index], - (char *) (button_strs[item_flag[item_index]]),1,8); - OffsetRect(&item_rect[item_index],button_left_adj[item_flag[item_index]],0); - } - else { - char_win_draw_string(dlgs[dlg_index],item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),1,8); - } - - if (play_sounds == TRUE) { - play_sound(37); - FlushAndPause(6); - } - else FlushAndPause(14); - - rect_draw_some_item(dlg_buttons_gworld[button_type[item_flag[item_index]]][0],from_rect, - dlg_buttons_gworld[button_type[item_flag[item_index]]][0],item_rect[item_index],0,2); - - RGBForeColor(&c[1]); - if (item_type[item_index] < 2) { - OffsetRect(&item_rect[item_index],-1 * button_left_adj[item_flag[item_index]],0); - char_win_draw_string(dlgs[dlg_index],item_rect[item_index], - (char *) (button_strs[item_flag[item_index]]),1,8); - OffsetRect(&item_rect[item_index],button_left_adj[item_flag[item_index]],0); - } - else { - char_win_draw_string(dlgs[dlg_index],item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),1,8); - } - TextSize(10); - TextFace(bold); - ForeColor(blackColor); - FlushAndPause(8); - - SetPort(old_port); - } - -// LOW LEVEL - -short cd_get_indices(short dlg_num, short item_num, short *dlg_index, short *item_index) -{ - if ((*dlg_index = cd_get_dlg_index(dlg_num)) < 0) { - return -1; - } - if ((*item_index = cd_get_item_id(dlg_num,item_num)) < 0) { - return -1; - } - return 0; - } - -short cd_get_dlg_index(short dlog_num) -{ - short i; - - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - return i; - return -1; -} - -short cd_find_dlog(WindowPtr window, short *dlg_num, short *dlg_key) -{ - short i; - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlgs[i] == window)) { - *dlg_num = dlg_types[i]; - *dlg_key = dlg_keys[i]; - return i; - } - return -1; -} - -short cd_get_item_id(short dlg_num, short item_num) -{ - short i; - - for (i = 0; i < NI; i++) - if ((item_dlg[i] == dlg_num) && (item_number[i] == item_num)) - return i; - return -1; -} - -// External graphics tools (huh huh huh ... tool ... huh huh huh) - -void center_window(WindowPtr window) -{ -// if this is needed, see adjust_window_mode -} - -Rect get_item_rect(WindowPtr hDlg, short item_num) -{ - short the_type; - Handle the_handle = NULL; - Rect small_rect; - - GetDialogItem( GetDialogFromWindow(hDlg), item_num, &the_type, &the_handle, &small_rect); - - return small_rect; -} - - -void frame_dlog_rect(GrafPtr hDlg, Rect rect, short val) -{ - //COLORREF x = RGB(220,220,200),y = RGB(128,128,128); -// RGBColor lt_gray = {57344,57344,57344},dk_gray = {12287,12287,12287}; - RGBColor lt_gray = {0,20230,40458},dk_gray = {0,20230,40458}; - GrafPtr old_port; - - - GetPort(&old_port); - SetPort(hDlg); - - InsetRect(&rect,-1 * val,-1 * val); - - RGBForeColor(&dk_gray); - MoveTo(rect.left,rect.top); - LineTo(rect.right,rect.top); - RGBForeColor(<_gray); - LineTo(rect.right,rect.bottom); - LineTo(rect.left,rect.bottom); - RGBForeColor(&dk_gray); - LineTo(rect.left,rect.top); - ForeColor(blackColor); - SetPort(old_port); -} - -void draw_dialog_graphic(GrafPtr hDlg, Rect rect, short which_g, Boolean do_frame,short win_or_gworld) -// win_or_gworld: 0 - window 1 - gworld -// 0 - 300 number of terrain graphic -// 400 + x - monster graphic num -// 700 + x dlog graphic -// 800 + x pc graphic -// 900 + x B&W graphic -// 950 null item -// 1000 + x Talking face -// 1100 - item info help -// 1200 - pc screen help -// 1300 - combat ap -// 1400-1402 - button help 1410-1412 - large scen graphics -// 1500 - stat symbols help -// 1600 + x - scen graphics -// 1700 + x - anim graphic -// 1800 + x - items -// 2000 + x - custom graphics up to 2399 -// 2400 + x - custom graphics up to 2799, BUT it's a split graphic ... -// it looks at the size of rect, and places a 32 x 32 or 36 x 36 graphic drawn -// from the custom gworld, depending on the size of rect. half of graphic is -// drawn from one custom slot, and half is drawn from next one. -{ - Rect from2 = {0,0,36,36},tiny_obj_rect = {0,0,18,18}; - Rect from_rect = {0,0,36,28}; - Rect face_from = {0,0,32,32}; - Rect to_rect = {6,6,42,42}; - Rect bw_from = {0,0,120,120}; - Rect small_monst_rect = {0,0,18,14}; - Rect large_scen_from = {0,0,64,64}; - - Rect pc_info_from = {127,0,157,106}; - Rect item_info_from = {0,174,113,312}; - Rect button_help_from = {0,0,125,320}; - Rect combat_ap_from = {0,0,100,275}; - Rect stat_symbols_from = {0,0,94,386}; - - RGBColor store_color; - GWorldPtr from_gworld; - short draw_dest = 2; - short m_start_pic = 0,square_size = 32; - - if (win_or_gworld == 1) - draw_dest = 0; - - if (which_g < 0) - return; - - if (which_g >= 3000) - do_frame = FALSE; - which_g = which_g % 3000; - - if (which_g == 950) { // Empty. Maybe clear space. - if (win_or_gworld == 0) - FillCRect(&rect,bg[5]); - return; - } - GetBackColor(&store_color); - - BackColor(whiteColor); - - switch (which_g / 100) { - case 0: case 1: case 2: // terrain - from_gworld = load_pict(800 + which_g / 50); - which_g = which_g % 50; - from_rect = calc_rect(which_g % 10, which_g / 10); - if (rect.right - rect.left > 28) - InsetRect(&rect,4,0); - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg): from_gworld) - ,rect,0,draw_dest); - DisposeGWorld(from_gworld); - break; - case 3: // animated terrain - which_g -= 300; - from_gworld = load_pict(820); - from_rect = calc_rect(4 * (which_g / 5), which_g % 5); - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,rect,0,draw_dest); - DisposeGWorld(from_gworld); - break; - case 4: case 5: // monster - which_g -= 400; - m_start_pic = m_pic_index[which_g]; - - if ((m_pic_index_x[which_g] == 1) && (m_pic_index_y[which_g] == 1)) { - from_gworld = load_pict(1100 + m_start_pic / 20); - m_start_pic = m_start_pic % 20; - from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); - rect.right = rect.left + 28; rect.bottom = rect.top + 36; - if (win_or_gworld == 0) - PaintRect(&rect); - rect_draw_some_item(from_gworld,from_rect, - (GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg) : from_gworld) - ,rect,1,draw_dest); - DisposeGWorld(from_gworld); - } - if ((m_pic_index_x[which_g] == 2) && (m_pic_index_y[which_g] == 1)) { - rect.right = rect.left + 28; rect.bottom = rect.top + 36; - if (win_or_gworld == 0) - PaintRect(&rect); - from_gworld = load_pict(1100 + m_start_pic / 20); - m_start_pic = m_start_pic % 20; - from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); - OffsetRect(&small_monst_rect,rect.left,rect.top + 7); - if (win_or_gworld == 0) - PaintRect(&small_monst_rect); - rect_draw_some_item(from_gworld,from_rect, - (GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg) : from_gworld) - ,small_monst_rect,1,draw_dest); - DisposeGWorld(from_gworld); - - m_start_pic = m_pic_index[which_g] + 1; - from_gworld = load_pict(1100 + m_start_pic / 20); - m_start_pic = m_start_pic % 20; - from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); - OffsetRect(&small_monst_rect,14,0); - if (win_or_gworld == 0) - PaintRect(&small_monst_rect); - rect_draw_some_item(from_gworld,from_rect, - (GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg) : from_gworld) - ,small_monst_rect,1,draw_dest); - DisposeGWorld(from_gworld); - } - if ((m_pic_index_x[which_g] == 1) && (m_pic_index_y[which_g] == 2)) { - rect.right = rect.left + 28; rect.bottom = rect.top + 36; - if (win_or_gworld == 0) - PaintRect(&rect); - from_gworld = load_pict(1100 + m_start_pic / 20); - m_start_pic = m_start_pic % 20; - from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); - OffsetRect(&small_monst_rect,rect.left + 7,rect.top); - if (win_or_gworld == 0) - PaintRect(&small_monst_rect); - rect_draw_some_item(from_gworld,from_rect, - (GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg) : from_gworld) - ,small_monst_rect,1,draw_dest); - DisposeGWorld(from_gworld); - - m_start_pic = m_pic_index[which_g] + 1; - from_gworld = load_pict(1100 + m_start_pic / 20); - m_start_pic = m_start_pic % 20; - from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); - OffsetRect(&small_monst_rect,0,18); - if (win_or_gworld == 0) - PaintRect(&small_monst_rect); - rect_draw_some_item(from_gworld,from_rect, - (GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg) : from_gworld) - ,small_monst_rect,1,draw_dest); - DisposeGWorld(from_gworld); - } - if ((m_pic_index_x[which_g] == 2) && (m_pic_index_y[which_g] == 2)) { - rect.right = rect.left + 28; rect.bottom = rect.top + 36; - if (win_or_gworld == 0) - PaintRect(&rect); - from_gworld = load_pict(1100 + m_start_pic / 20); - m_start_pic = m_start_pic % 20; - from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); - OffsetRect(&small_monst_rect,rect.left,rect.top); - if (win_or_gworld == 0) - PaintRect(&small_monst_rect); - rect_draw_some_item(from_gworld,from_rect, - (GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg) : from_gworld) - ,small_monst_rect,1,draw_dest); - DisposeGWorld(from_gworld); - - m_start_pic = m_pic_index[which_g] + 1; - from_gworld = load_pict(1100 + m_start_pic / 20); - m_start_pic = m_start_pic % 20; - from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); - OffsetRect(&small_monst_rect,14,0); - if (win_or_gworld == 0) - PaintRect(&small_monst_rect); - rect_draw_some_item(from_gworld,from_rect, - (GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg) : from_gworld) - ,small_monst_rect,1,draw_dest); - DisposeGWorld(from_gworld); - - m_start_pic = m_pic_index[which_g] + 2; - from_gworld = load_pict(1100 + m_start_pic / 20); - m_start_pic = m_start_pic % 20; - from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); - OffsetRect(&small_monst_rect,-14,18); - if (win_or_gworld == 0) - PaintRect(&small_monst_rect); - rect_draw_some_item(from_gworld,from_rect, - (GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg) : from_gworld) - ,small_monst_rect,1,draw_dest); - DisposeGWorld(from_gworld); - - m_start_pic = m_pic_index[which_g] + 3; - from_gworld = load_pict(1100 + m_start_pic / 20); - m_start_pic = m_start_pic % 20; - from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); - OffsetRect(&small_monst_rect,14,0); - if (win_or_gworld == 0) - PaintRect(&small_monst_rect); - rect_draw_some_item(from_gworld,from_rect, - (GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg) : from_gworld) - ,small_monst_rect,1,draw_dest); - DisposeGWorld(from_gworld); - } - break; - case 18: case 19: // item - //print_nums(0,0,which_g); - which_g -= 1800; - to_rect = rect; - if (which_g < 45) { - from_gworld = items_gworld; - from_rect = calc_rect(which_g % 5, which_g / 5); - } - else { - from_gworld = tiny_obj_gworld; - //rect.top += 4; rect.bottom -= 4; - InsetRect(&to_rect,5,9); - from_rect = tiny_obj_rect; - OffsetRect(&from_rect,18 * (which_g % 10), 18 * (which_g / 10)); - } - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,to_rect,1,draw_dest); - break; - case 7: // dialog - which_g -= 700; - from_gworld = dlogpics_gworld; - OffsetRect(&from2,36 * (which_g % 4),36 * (which_g / 4)); - rect_draw_some_item(from_gworld,from2,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,rect,0,draw_dest); - break; - case 8: // PC - if (pcs_gworld != NULL) - from_gworld = pcs_gworld; - else from_gworld = load_pict(902); - which_g -= 800; - from_rect = calc_rect(2 * (which_g / 8), which_g % 8); - PaintRect(&rect); - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,rect,1,draw_dest); - if (pcs_gworld == NULL) - DisposeGWorld(from_gworld); - break; - case 9: // B&W - which_g -= 900; - from_gworld = load_pict(875); - from_rect = bw_from; - OffsetRect(&from_rect,120 * ((which_g) % 3),120 * ((which_g) / 3)); - if (win_or_gworld == 1) - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) hDlg,rect,0,0); - else rect_draw_some_item(from_gworld,from_rect,from_gworld,rect,0,draw_dest); - DisposeGWorld(from_gworld); - break; - case 10: // talk face - which_g -= 1000; - from_gworld = load_pict(860); - from_rect = face_from; - OffsetRect(&from_rect,32 * ((which_g - 1) % 10),32 * ((which_g - 1) / 10)); - if (win_or_gworld == 1) - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) hDlg,rect,0,0); - else rect_draw_some_item(from_gworld,from_rect,from_gworld,rect,0,draw_dest); - DisposeGWorld(from_gworld); - break; - case 11: // item info help - from_rect = item_info_from; - rect.right = rect.left + from_rect.right - from_rect.left; - rect.bottom = rect.top + from_rect.bottom - from_rect.top; - rect_draw_some_item(mixed_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: mixed_gworld) - ,rect,0,draw_dest); - break; - case 12: // item info help - from_rect = pc_info_from; - rect.right = rect.left + pc_info_from.right - pc_info_from.left; - rect.bottom = rect.top + pc_info_from.bottom - pc_info_from.top; - rect_draw_some_item(mixed_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: mixed_gworld) - ,rect,0,draw_dest); - break; - case 14: // button help - which_g -= 1400; - if (which_g >= 10) { - from_gworld = load_pict(900 + which_g); - from_rect = large_scen_from; - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,rect,0,draw_dest); - DisposeGWorld(from_gworld); - break; - } - from_gworld = load_pict(1401); - from_rect = button_help_from; - rect.right = rect.left + from_rect.right; - rect.bottom = rect.top + from_rect.bottom; - OffsetRect(&from_rect,0,125 * which_g); - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,rect,0,draw_dest); - DisposeGWorld(from_gworld); - break; - case 13: // combat ap help - from_gworld = load_pict(1402); - from_rect = combat_ap_from; - rect.right = rect.left + from_rect.right; - rect.bottom = rect.top + from_rect.bottom; - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg): from_gworld) - ,rect,0,draw_dest); - DisposeGWorld(from_gworld); - break; - case 15: // stat symbols help - from_gworld = load_pict(1400); - from_rect = stat_symbols_from; - rect.right = rect.left + from_rect.right; - rect.bottom = rect.top + from_rect.bottom; - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr) (hDlg): from_gworld) - ,rect,0,draw_dest); - DisposeGWorld(from_gworld); - break; - case 16: - which_g -= 1600; - from_gworld = load_pict(851); - from_rect.right = 32; - from_rect.bottom = 32; - OffsetRect(&from_rect,32 * (which_g % 5),32 * (which_g / 5)); - rect.right = rect.left + 32; - rect.bottom = rect.top + 32; - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,rect,0,draw_dest); - DisposeGWorld(from_gworld); - break; - case 17: // dialog - which_g -= 1700; - from_gworld = fields_gworld; - from_rect = calc_rect(which_g % 8, which_g / 8); - if (win_or_gworld == 0) - PaintRect(&rect); - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,rect,0,draw_dest); - break; - case 20: case 21: case 22: case 23: // dialog - which_g -= 2000; - rect.right = rect.left + 28; - rect.bottom = rect.top + 32; - from_gworld = spec_scen_g; - from_rect = get_custom_rect(which_g); - if ((win_or_gworld == 0) && (do_frame == TRUE)) - PaintRect(&rect); - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,rect,1,draw_dest); - break; - case 24: case 25: case 26: case 27: // dialog - which_g -= 2400; - if (rect.right - rect.left >= 36) - square_size = 36; - from_gworld = spec_scen_g; - from_rect = get_custom_rect(which_g); - to_rect = rect; - to_rect.right = to_rect.left + square_size / 2; - to_rect.bottom = to_rect.top + square_size; - from_rect.right = from_rect.left + square_size / 2; - from_rect.bottom = from_rect.top + square_size; - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,to_rect,1,draw_dest); - from_rect = get_custom_rect(which_g + 1); - OffsetRect(&to_rect,square_size / 2,0); - from_rect.right = from_rect.left + square_size / 2; - from_rect.bottom = from_rect.top + square_size; - rect_draw_some_item(from_gworld,from_rect,(GWorldPtr) ((win_or_gworld == 1) ? (GWorldPtr)hDlg: from_gworld) - ,to_rect,1,draw_dest); - break; - } - - if (do_frame == TRUE) { - rect.bottom--; rect.right--; - frame_dlog_rect(hDlg,rect,3); - } - RGBBackColor(&store_color); -} - - - -Rect calc_rect(short i, short j) -{ - Rect base_rect = {0,0,36,28}; - - OffsetRect(&base_rect,i * 28, j * 36); - return base_rect; -} diff --git a/osx/dlogtool.h b/osx/dlogtool.h deleted file mode 100644 index f2234c7b..00000000 --- a/osx/dlogtool.h +++ /dev/null @@ -1,51 +0,0 @@ -void cd_init_dialogs(); -short cd_create_dialog_parent_num(short dlog_num,short parent); -short cd_create_custom_dialog(WindowPtr parent, - Str255 strs[6],short pic_num,short buttons[3]); -short cd_create_dialog(short dlog_num,WindowPtr parent); -void process_new_window (WindowPtr hDlg); -void cd_set_edit_focus(); -short cd_kill_dialog(short dlog_num,short parent_message); -short cd_process_click(WindowPtr window,Point the_point, short mods,short *item); -short cd_process_keystroke(WindowPtr window,char char_hit,short *item); -void cd_init_button(short dlog_num,short item_num, short button_num, short status); -void cd_attach_key(short dlog_num,short item_num,char key); -void csp(short dlog_num, short item_num, short pict_num); -void cd_set_pict(short dlog_num, short item_num, short pict_num); -void cd_activate_item(short dlog_num, short item_num, short status); -short cd_get_active(short dlog_num, short item_num); -void cd_get_item_text(short dlog_num, short item_num, char *str); -void csit(short dlog_num, short item_num, char *str); -void cd_retrieve_text_edit_str(short dlog_num, char *str); -void cd_set_text_edit_str(short dlog_num, char *str); -short cd_retrieve_text_edit_num(short dlog_num, short item_num); -void cd_set_item_text(short dlog_num, short item_num, char *str); -void cd_set_text_edit_num(short dlog_num, short item_num, short num); -void cdsin(short dlog_num, short item_num, short num) ; -void cd_set_item_num(short dlog_num, short item_num, short num); -void cd_set_led(short dlog_num,short item_num,short state); -void cd_set_flag(short dlog_num,short item_num,short flag); -short cd_get_led(short dlog_num,short item_num); -void cd_text_frame(short dlog_num,short item_num,short frame); -void cd_add_label(short dlog_num, short item_num, char *label, short label_flag); -void cd_take_label(short dlog_num, short item_num); -void cd_key_label(short dlog_num, short item_num,short loc); -void cd_draw_item(short dlog_num,short item_num); -void cd_initial_draw(short dlog_num); -void cd_draw(short dlog_num); -void cd_redraw(WindowPtr window); -void cd_frame_item(short dlog_num, short item_num, short width); -void cd_erase_item(short dlog_num, short item_num); -void cd_erase_rect(short dlog_num,Rect to_fry); -void cd_press_button(short dlog_num, short item_num); -short cd_get_indices(short dlg_num, short item_num, short *dlg_index, short *item_index); -short cd_get_dlg_index(short dlog_num); -short cd_find_dlog(WindowPtr window, short *dlg_num, short *dlg_key); -short cd_get_item_id(short dlg_num, short item_num); -void center_window(WindowPtr window); -Rect get_item_rect(WindowPtr hDlg, short item_num); -void frame_dlog_rect(GrafPtr hDlg, Rect rect, short val); -void draw_dialog_graphic(GrafPtr hDlg, Rect rect, short which_g, Boolean do_frame,short win_or_gworld); -Rect calc_rect(short i, short j); -void beep() ; - diff --git a/osx/fields.c b/osx/fields.c index 483f9454..afb74144 100644 --- a/osx/fields.c +++ b/osx/fields.c @@ -1,6 +1,7 @@ #include "global.h" #include "loc_utils.h" #include "fields.h" +#include "mathutil.h" extern current_town_type c_town; extern short overall_mode,which_combat_type,current_pc,town_type; diff --git a/osx/global.c b/osx/global.c deleted file mode 100644 index dd8789ab..00000000 --- a/osx/global.c +++ /dev/null @@ -1,93 +0,0 @@ -#include -#include "global.h" -#include "math.h" - -extern short give_delays; - -short get_ran (short times,short min,short max) -{ - long int store; - short i, to_ret = 0; - - for (i = 1; i < times + 1; i++) { - store = Random(); - to_ret = to_ret + min + (((store + 32767) * (max - min + 1)) / 65536); - } - return to_ret; -} - -Boolean same_point(location p1,location p2) -{ - if ((p1.x == p2.x) & (p1.y == p2.y)) - return TRUE; - else return FALSE; -} - -short move_to_zero(short val) -{ - if (val < 0) - return val + 1; - if (val > 0) - return val - 1; - return val; -} - -short max(short a,short b) -{ - if (a > b) - return a; - else return b; -} - -short min(short a,short b) -{ - if (a < b) - return a; - else return b; -} - -short minmax(short min,short max,short k) -{ - if (k < min) - return min; - if (k > max) - return max; - return k; -} - -short s_pow(short x,short y) -{ - return (short) pow((double) x, (double) y); -} - -short a_v(short x) -{ - if (x < 0) - return (-1 * x); - else return x; -} -short ex_abs(short x) -{ - if (x < 0) - return (-1 * x); - else return x; -} - -void pause(short length) -{ - long len; - unsigned long dummy; - - len = (long) length; - - if (give_delays == 0) - Delay(len, &dummy); -} - -// stuff done legit, i.e. flags are within proper ranges for stuff done flag -Boolean sd_legit(short a, short b) -{ - if ((minmax(0,299,a) == a) && (minmax(0,9,b) == b)) - return TRUE; - return FALSE; -} \ No newline at end of file diff --git a/osx/global.h b/osx/global.h index 610d547d..e524ba1e 100644 --- a/osx/global.h +++ b/osx/global.h @@ -444,14 +444,3 @@ typedef struct { long l[10]; } PrefRecord,*PrefPtr,**PrefHandle; -short s_pow(short x,short y); -short a_v(short x); -short ex_abs(short x); -short get_ran (short times,short min,short max); -Boolean same_point(location p1,location p2); -void pause(short length); -short minmax(short min,short max,short k); -short min(short a,short b); -short max(short a,short b); -short move_to_zero(short val); -Boolean sd_legit(short a, short b); diff --git a/osx/info.dialogs.c b/osx/info.dialogs.c index acacc217..a7c77a21 100644 --- a/osx/info.dialogs.c +++ b/osx/info.dialogs.c @@ -8,15 +8,17 @@ #include "items.h" #include "string.h" #include "monster.h" -#include "dlogtool.h" +#include "dlgtool.h" +#include "dlgconsts.h" #include "party.h" #include "fields.h" #include "loc_utils.h" #include "text.h" -#include "Exile.sound.h" +#include "soundtool.h" #include "info.dialogs.h" #include "blxfileio.h" #include "bldsexil.h" +#include "mathutil.h" short mage_spell_pos = 0,priest_spell_pos = 0,skill_pos = 0; @@ -36,8 +38,6 @@ extern party_record_type party; extern short mage_range[66],priest_range[66]; extern short spell_cost[2][62],cur_town_talk_loaded; extern Boolean in_startup_mode,give_intro_hint; -extern pascal Boolean cd_event_filter(); -extern Boolean dialog_not_toast; extern WindowPtr mainPtr; extern short on_monst_menu[256]; extern big_tr_type t_d; @@ -99,12 +99,12 @@ void put_spell_info() } -Boolean display_spells_event_filter (short item_hit) +void display_spells_event_filter (short item_hit) { short store; switch (item_hit) { case 1: case 8: - dialog_not_toast = FALSE; + toast_dialog(); break; case 9: case 10: @@ -120,9 +120,7 @@ Boolean display_spells_event_filter (short item_hit) else priest_spell_pos = store; put_spell_info(); break; - } - - return FALSE; + } } void display_spells(short mode,short force_spell,short parent_num) //short mode; // 0 - mage 1 - priest @@ -141,19 +139,13 @@ void display_spells(short mode,short force_spell,short parent_num) cd_create_dialog_parent_num(1096,parent_num); - cd_set_pict(1096,18,714 + mode); + cd_set_pict(1096,18,14 + mode,PICT_DLG_TYPE); put_spell_info(); if (mode == 0) csit(1096,3,"Mage Spells"); - else csit(1096,3,"Priest Spells"); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + else csit(1096,3,"Priest Spells"); + + item_hit = cd_run_dialog(); cd_kill_dialog(1096,0); } @@ -178,11 +170,11 @@ void put_skill_info() } -Boolean display_skills_event_filter (short item_hit) +void display_skills_event_filter (short item_hit) { switch (item_hit) { case 1: case 11: - dialog_not_toast = FALSE; + toast_dialog(); break; case 10: case 9: @@ -195,7 +187,6 @@ Boolean display_skills_event_filter (short item_hit) put_skill_info(); break; } - return FALSE; } void display_skills(short force_skill,short parent) @@ -212,15 +203,9 @@ void display_skills(short force_skill,short parent) cd_create_dialog_parent_num(1097,parent); - put_skill_info(); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + put_skill_info(); + + item_hit = cd_run_dialog(); cd_kill_dialog(1097,0); } @@ -238,14 +223,15 @@ void put_pc_graphics() cd_set_item_text(991,69,adven[which_pc_displayed].name); } -Boolean display_pc_event_filter (short item_hit) + +void display_pc_event_filter (short item_hit) { short pc_num; pc_num = which_pc_displayed; switch (item_hit) { case 1: case 65: - dialog_not_toast = FALSE; + toast_dialog(); break; case 66: @@ -266,8 +252,7 @@ Boolean display_pc_event_filter (short item_hit) case 100: break; - } - return FALSE; + } } void display_pc(short pc_num,short mode,short parent) @@ -293,15 +278,9 @@ void display_pc(short pc_num,short mode,short parent) } put_pc_graphics(); - cd_set_pict(991,2,714 + mode); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + cd_set_pict(991,2,14 + mode,PICT_DLG_TYPE); + + item_hit = cd_run_dialog(); cd_kill_dialog(991,0); } @@ -319,10 +298,10 @@ void put_item_info(short pc,short item)//// s_i = store_i; - csp(998,1,950); + csp(998,1,0,PICT_BLANK_TYPE); if (s_i.graphic_num >= 150) - csp(998,1,s_i.graphic_num - 150 + 2000); - else csp(998,1,1800 + s_i.graphic_num); + csp(998,1,s_i.graphic_num - 150,PICT_CUSTOM_TYPE + PICT_ITEM_TYPE); + else csp(998,1,s_i.graphic_num,PICT_ITEM_TYPE); // id? magic? if ((is_magic(store_i) == TRUE) && (is_ident(store_i) == TRUE)) @@ -402,7 +381,7 @@ void put_item_info(short pc,short item)//// } -Boolean display_pc_item_event_filter (short item_hit) +void display_pc_item_event_filter (short item_hit) { short item,pc_num; @@ -411,7 +390,7 @@ Boolean display_pc_item_event_filter (short item_hit) switch (item_hit) { case 1: case 13: - dialog_not_toast = FALSE; + toast_dialog(); break; case 14: @@ -435,7 +414,6 @@ Boolean display_pc_item_event_filter (short item_hit) break; } - return FALSE; } void display_pc_item(short pc_num,short item,item_record_type si,short parent) @@ -474,14 +452,8 @@ void display_pc_item(short pc_num,short item,item_record_type si,short parent) cd_activate_item(998,19,0); put_item_info(pc_num,item); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); cd_kill_dialog(998,0); } @@ -493,11 +465,26 @@ void put_monst_info()//// Str255 str; short abil,i; - if ( store_m->m_d.spec_skill == 11) - cd_set_pict(999,4,400); + if ( store_m->m_d.spec_skill == MONSTER_INVISIBLE) + cd_set_pict(999,4,400,PICT_MONST_TYPE);// should probably be PICT_BLANK_TYPE? else if (store_m->m_d.picture_num < 1000) - cd_set_pict(999,4,400 + store_m->m_d.picture_num); - else cd_set_pict(999,4,2000 + (store_m->m_d.picture_num % 1000)); + cd_set_pict(999,4,store_m->m_d.picture_num,PICT_MONST_TYPE); + else { + short type_g = PICT_CUSTOM_TYPE + PICT_MONST_TYPE; + short size_g = store_m->m_d.picture_num / 1000; + switch(size_g){ + case 2: + type_g += PICT_WIDE_MONSTER; + break; + case 3: + type_g += PICT_TALL_MONSTER; + break; + case 4: + type_g += PICT_WIDE_MONSTER + PICT_TALL_MONSTER; + break; + } + cd_set_pict(999,4,(store_m->m_d.picture_num % 1000), type_g); + } get_m_name((char *) store_text,store_m->number); cd_set_item_text(999,5,store_text); @@ -540,13 +527,13 @@ void put_monst_info()//// } -Boolean display_monst_event_filter (short item_hit) +void display_monst_event_filter (short item_hit) { short i,dummy = 0; switch (item_hit) { case 1: case 3: - dialog_not_toast = FALSE; + toast_dialog(); break; case 28: @@ -576,8 +563,6 @@ Boolean display_monst_event_filter (short item_hit) break; } - - return FALSE; } void display_monst(short array_pos,creature_data_type *which_m,short mode) @@ -633,25 +618,19 @@ void display_monst(short array_pos,creature_data_type *which_m,short mode) cd_add_label(999,26,"Poison Resistant",45); cd_add_label(999,27,"Immune To Poison",45); put_monst_info(); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); cd_kill_dialog(999,0); } -Boolean display_help_event_filter (short item_hit) +void display_help_event_filter (short item_hit) { Str255 get_text; switch (item_hit) { case 1: case 3: - dialog_not_toast = FALSE; + toast_dialog(); break; case 4: case 5: @@ -661,9 +640,7 @@ Boolean display_help_event_filter (short item_hit) get_str (get_text, 25 + store_help_mode, cur_entry); cd_set_item_text(997,7,(char *) get_text); break; - } - - return FALSE; + } } void display_help(short mode,short parent) @@ -686,30 +663,23 @@ void display_help(short mode,short parent) num_entries = (short) get_val; get_str (get_text, 25 + mode, cur_entry); csit( 997,7,(char *) get_text); - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + + item_hit = cd_run_dialog(); cd_kill_dialog(997,0); } -Boolean display_alchemy_event_filter (short item_hit) +void display_alchemy_event_filter (short item_hit) { switch (item_hit) { case 1: case 3: - dialog_not_toast = FALSE; + toast_dialog(); break; } - return FALSE; } void display_alchemy() @@ -728,17 +698,10 @@ void display_alchemy() cd_set_led(996,i + 4,1); else cd_set_led(996,i + 4,0); } - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); cd_kill_dialog(996,0); - dialog_not_toast = TRUE; + untoast_dialog(); } @@ -769,7 +732,7 @@ void pick_race_abil_event_filter(short item_hit) pc = store_pc; switch (item_hit) { case 3: - dialog_not_toast = FALSE; + toast_dialog(); break; case 4: case 5: case 6: if (store_trait_mode == 0) @@ -815,17 +778,10 @@ void pick_race_abil(pc_record_type *pc,short mode,short parent_num) if (mode == 1) csit(1013,19,start_str1); else csit(1013,19,start_str2); - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); cd_kill_dialog(1013,0); - dialog_not_toast = TRUE; + untoast_dialog(); } void display_pc_info() @@ -862,7 +818,7 @@ void display_pc_info() cdsin(1019,71,adven[pc].skill_pts); store = adven[pc].level * get_tnl(&adven[pc]); cdsin(1019,15,store); - csp(1019,7,800 + adven[pc].which_graphic); + csp(1019,7,800 + adven[pc].which_graphic,PICT_PC_TYPE); // Fight bonuses for (i = 0; i < 24; i++) @@ -931,7 +887,7 @@ void give_pc_info_event_filter(short item_hit) pc = store_pc_num; switch (item_hit) { case 1: - dialog_not_toast = FALSE; + toast_dialog(); break; case 2: do @@ -976,14 +932,8 @@ void give_pc_info(short pc_num) csit(1019,17 + i * 2,(char *) str); } display_pc_info(); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); cd_kill_dialog(1019,0); } @@ -994,7 +944,7 @@ void adventure_notes_event_filter (short item_hit) switch (item_hit) { case 1: - dialog_not_toast = FALSE; + toast_dialog(); break; case 7: case 8: @@ -1096,15 +1046,9 @@ void adventure_notes() if (store_num_i <= 3) { cd_activate_item(961,7,0); cd_activate_item(961,8,0); - } -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); cd_kill_dialog(961,0); } @@ -1158,7 +1102,7 @@ void talk_notes_event_filter (short item_hit) { switch (item_hit) { case 1: - dialog_not_toast = FALSE; + toast_dialog(); break; case 10: case 11: @@ -1205,16 +1149,9 @@ void talk_notes() if (store_num_i == 1) { cd_activate_item(960,10,0); cd_activate_item(960,11,0); - } - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); cd_kill_dialog(960,0); } @@ -1226,7 +1163,7 @@ void journal_event_filter (short item_hit) switch (item_hit) { case 1: - dialog_not_toast = FALSE; + toast_dialog(); break; case 7: case 8: @@ -1283,15 +1220,9 @@ void journal() if (store_num_i <= 3) { cd_activate_item(962,7,0); cd_activate_item(962,8,0); - } -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); cd_kill_dialog(962,0); } @@ -1339,8 +1270,8 @@ void give_help(short help1,short help2,short parent_num) if (help2 > 0) get_str(str2,10,help2); if (help2 == 0) - display_strings((char *)str1, "",-1,-1,-1,-1,"Instant Help",57,724, parent_num); - else display_strings((char *)str1,(char *)str2,-1,-1,-1,-1,"Instant Help",57,724, parent_num); + display_strings((char *)str1, "",-1,-1,-1,-1,"Instant Help",57,24,PICT_DLG_TYPE, parent_num); + else display_strings((char *)str1,(char *)str2,-1,-1,-1,-1,"Instant Help",57,24,PICT_DLG_TYPE, parent_num); } @@ -1349,7 +1280,7 @@ void put_spec_item_info (short which_i) display_strings(data_store->scen_strs[60 + 1 + which_i * 2],"", -1,-1,-1,-1, - data_store->scen_strs[60 + which_i * 2],57,1600 + scenario.intro_pic,0); + data_store->scen_strs[60 + which_i * 2],57,scenario.intro_pic,PICT_SCEN_TYPE,0); //get_str(item_name,6,1 + which_i * 2); //display_strings(6,2 + which_i * 2,0,0, //(char *)item_name,-1,702,0); @@ -1362,7 +1293,7 @@ void display_strings_event_filter (short item_hit)//// switch (item_hit) { case 1: - dialog_not_toast = FALSE; + toast_dialog(); break; case 2: play_sound(0); @@ -1404,7 +1335,7 @@ void display_strings_event_filter (short item_hit)//// // 1000 + x scen 2000 + x out 3000 + x town void display_strings(char *text1, char *text2,short str_label_1,short str_label_2,short str_label_1b, short str_label_2b, - char *title,short sound_num,short graphic_num,short parent_num) + char *title,short sound_num,short graphic_num,short graphic_type,short parent_num) { short item_hit; @@ -1429,7 +1360,7 @@ void display_strings(char *text1, char *text2,short str_label_1,short str_label_ store_which_string_dlog++; cd_create_dialog_parent_num(store_which_string_dlog,parent_num); - csp(store_which_string_dlog,store_which_string_dlog,graphic_num); + csp(store_which_string_dlog,store_which_string_dlog,graphic_num,graphic_type); csit(store_which_string_dlog,4,(char *) text1); if (text2 != NULL) { @@ -1437,31 +1368,25 @@ void display_strings(char *text1, char *text2,short str_label_1,short str_label_ } if (strlen(title) > 0) csit(store_which_string_dlog,6,title); - csp(store_which_string_dlog,3,graphic_num); + csp(store_which_string_dlog,3,graphic_num,graphic_type); if (sound_num >= 0) play_sound(sound_num); if ((str_label_1 < 0) && (str_label_2 < 0)) cd_activate_item(store_which_string_dlog,2,0); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); //cd_kill_dialog(store_which_string_dlog,0); final_process_dialog(store_which_string_dlog); } void give_error(char *text1, char *text2,short parent_num) { - display_strings(text1,text2,-1,-1,-1,-1,"Error!",57,716,parent_num); + display_strings(text1,text2,-1,-1,-1,-1,"Error!",57,16,PICT_DLG_TYPE,parent_num); } void display_strings_with_nums(short a1,short a2, short b1, short b2, - char *title,short sound_num,short graphic_num,short parent_num) + char *title,short sound_num,short graphic_num,short graphic_type,short parent_num) { Str255 str1 = "", str2 = ""; @@ -1470,5 +1395,5 @@ void display_strings_with_nums(short a1,short a2, short b1, short b2, if ((b1 > 0) && (b2 > 0)) get_str(str2,b1,b2); display_strings((char *) str1,(char *) str2,-1,-1,-1,-1, - title, sound_num, graphic_num, parent_num); + title, sound_num, graphic_num, graphic_type, parent_num); } \ No newline at end of file diff --git a/osx/info.dialogs.h b/osx/info.dialogs.h index d3876838..57c3d15c 100644 --- a/osx/info.dialogs.h +++ b/osx/info.dialogs.h @@ -1,21 +1,21 @@ void put_spell_info(); -Boolean display_spells_event_filter (short item_hit); +void display_spells_event_filter (short item_hit); void display_spells(short mode,short force_spell,short parent_num); void put_skill_info(); -Boolean display_skills_event_filter (short item_hit); +void display_skills_event_filter (short item_hit); void display_skills(short force_skill,short parent); void put_pc_graphics(); -Boolean display_pc_event_filter (short item_hit); +void display_pc_event_filter (short item_hit); void display_pc(short pc_num,short mode,short parent_num); void put_item_info(short pc,short item); -Boolean display_pc_item_event_filter (short item_hit); +void display_pc_item_event_filter (short item_hit); void display_pc_item(short pc_num,short item,item_record_type si,short parent); void put_monst_info(); -Boolean display_monst_event_filter (short item_hit); +void display_monst_event_filter (short item_hit); void display_monst(short array_pos,creature_data_type *which_m,short mode); -Boolean display_help_event_filter (short item_hit); +void display_help_event_filter (short item_hit); void display_help(short mode,short parent); -Boolean display_alchemy_event_filter (short item_hit); +void display_alchemy_event_filter (short item_hit); void display_alchemy(); void pick_race_abil(pc_record_type *pc,short mode,short parent_num); void pick_race_abil_event_filter(short item_hit); @@ -40,7 +40,7 @@ void put_spec_item_info (short which_i); void display_strings_event_filter (short item_hit); void display_strings(char *text1, char *text2,short str_label_1,short str_label_2,short str_label_1b, short str_label_2b, - char *title,short sound_num,short graphic_num,short parent_num); + char *title,short sound_num,short graphic_num,short graphic_type,short parent_num); void give_error(char *text1, char *text2,short parent_num); void display_strings_with_nums(short a1,short a2, short b1, short b2, - char *title,short sound_num,short graphic_num,short parent_num); + char *title,short sound_num,short graphic_num,short graphic_type,short parent_num); diff --git a/osx/item_data.c b/osx/item_data.c index baa77b94..fb3d26de 100644 --- a/osx/item_data.c +++ b/osx/item_data.c @@ -1,7 +1,8 @@ #include "global.h" #include "item_data.h" -#include "stdio.h" -#include "string.h" +#include +#include +#include "mathutil.h" extern piles_of_stuff_dumping_type *data_store; diff --git a/osx/items.c b/osx/items.c index d22b09cf..e7caf7cb 100644 --- a/osx/items.c +++ b/osx/items.c @@ -5,20 +5,22 @@ #include "blxgraphics.h" #include "text.h" -#include "dlogtool.h" +#include "dlgtool.h" +#include "dlgconsts.h" #include "items.h" #include "party.h" #include "fields.h" #include "loc_utils.h" #include "newgraph.h" -#include "dlogtool.h" #include "item_data.h" #include "info.dialogs.h" -#include "Exile.sound.h" +#include "soundtool.h" #include "stdio.h" #include "string.h" #include "monster.h" #include "bldsexil.h" +#include "graphtool.h" +#include "mathutil.h" extern short stat_window,overall_mode,current_cursor,which_combat_type,current_pc; extern party_record_type party; @@ -40,8 +42,6 @@ extern short town_size[3]; extern short town_type; extern short dialog_answer; -extern pascal Boolean cd_event_filter(); -extern Boolean dialog_not_toast; extern GWorldPtr pcs_gworld; extern ModalFilterUPP main_dialog_UPP; extern scenario_data_type scenario; @@ -904,24 +904,22 @@ void put_item_graphics() for (i = 0; i < 8; i++) { // first, clear whatever item graphic is there - csp(987,20 + i * 4,950); + csp(987,20 + i * 4,0,PICT_BLANK_TYPE); if (item_array[i + first_item_shown] != 200) { // display an item in window item = t_i.items[item_array[i + first_item_shown]]; - sprintf ((char *) message, "%s", (is_ident(item) == TRUE) ? (char *) item.full_name : (char *) item.name); csit(987,21 + i * 4,(char *) message); if (item.graphic_num >= 150) - csp(987,20 + i * 4,3000 + 2000 + item.graphic_num - 150); - else csp(987,20 + i * 4,4800 + item.graphic_num);//// + csp(987,20 + i * 4,/*3000 + 2000 + */item.graphic_num - 150,PICT_CUSTOM_TYPE + PICT_ITEM_TYPE); + else csp(987,20 + i * 4,/*4800 + */item.graphic_num,PICT_ITEM_TYPE); get_item_interesting_string(item,(char *) message); csit(987,22 + i * 4,(char *) message); storage = item_weight(item); sprintf ((char *) message, "Weight: %d",storage); csit(987,53 + i,(char *) message); - - + } else { // erase the spot sprintf ((char *) message, ""); @@ -940,7 +938,7 @@ void put_item_graphics() for (i = 0; i < 6; i++) if (adven[i].main_status == 1) { - csp(987,11 + i,800 + adven[i].which_graphic); + csp(987,11 + i,adven[i].which_graphic,PICT_PC_TYPE); } } @@ -952,7 +950,7 @@ void display_item_event_filter (short item_hit) switch (item_hit) { case 1: - dialog_not_toast = FALSE; + toast_dialog(); break; case 9: if (first_item_shown > 0) @@ -992,13 +990,13 @@ void display_item_event_filter (short item_hit) t_i.items[item_array[item_hit]].item_level = 3000; set_item_flag(&item); give_gold(t_i.items[item_array[item_hit]].item_level,FALSE); - force_play_sound(39); + play_sound(39); // formerly force_play_sound } else if (t_i.items[item_array[item_hit]].variety == 11) { give_food(t_i.items[item_array[item_hit]].item_level,FALSE); set_item_flag(&item); set_item_flag(&t_i.items[item_array[item_hit]]); - force_play_sound(62); + play_sound(62); // formerly force_play_sound } else { if (item_weight(item) > @@ -1010,7 +1008,7 @@ void display_item_event_filter (short item_hit) } set_item_flag(&item); - force_play_sound(0); + play_sound(0); // formerly force_play_sound give_to_pc(current_getting_pc, item, 0);//// } t_i.items[item_array[item_hit]] = return_dummy_item(); @@ -1076,16 +1074,9 @@ short display_item(location from_loc,short pc_num,short mode, Boolean check_cont if (party.help_received[36] == 0) { cd_initial_draw(987); give_help(36,37,987); - } - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); cd_kill_dialog(987,0); DisposeGWorld(pcs_gworld); @@ -1102,7 +1093,7 @@ short display_item(location from_loc,short pc_num,short mode, Boolean check_cont void fancy_choice_dialog_event_filter (short item_hit) { - dialog_not_toast = FALSE; + toast_dialog(); dialog_answer = item_hit; } @@ -1116,14 +1107,8 @@ short custom_choice_dialog(Str255 strs[6],short pic_num,short buttons[3]) //// cd_create_custom_dialog(mainPtr,strs,pic_num, buttons); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); cd_kill_dialog(900,0); //if (parent < 2) { @@ -1144,26 +1129,22 @@ short custom_choice_dialog(Str255 strs[6],short pic_num,short buttons[3]) //// short fancy_choice_dialog(short which_dlog,short parent) // ignore parent in Mac version { - short item_hit,i,store_dialog_answer; + short item_hit,i,store_dialog_answer,err; store_dialog_answer = dialog_answer; make_cursor_sword(); - cd_create_dialog_parent_num(which_dlog,parent); + err = cd_create_dialog_parent_num(which_dlog,parent); + if(err != 0) + printf("Error %i while creating dialog %i.\n",err,which_dlog); if (which_dlog == 1062) { //i = get_ran(1,0,12); //get_str(temp_str,11,10 + i); //csit(1062,10,(char *) temp_str); - } -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); cd_kill_dialog(which_dlog,0); if (parent < 2) { @@ -1182,7 +1163,7 @@ short fancy_choice_dialog(short which_dlog,short parent) void select_pc_event_filter (short item_hit) { - dialog_not_toast = FALSE; + toast_dialog(); if (item_hit == 16) dialog_answer = 6; else dialog_answer = item_hit - 3; @@ -1211,16 +1192,9 @@ short char_select_pc(short active_only,short free_inv_only,char *title) csit(1018,9 + i,adven[i].name); } else cd_activate_item(1018, 9 + i, 0); - } + } -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + item_hit = cd_run_dialog(); cd_kill_dialog(1018,0); BeginUpdate(mainPtr); @@ -1244,7 +1218,7 @@ void get_num_of_items_event_filter (short item_hit) { Str255 get_text; - cd_retrieve_text_edit_str(1012,(char *) get_text); + cd_retrieve_text_edit_str(1012,2,(char *) get_text); dialog_answer = 0; #ifndef EXILE_BIG_GUNS sscanf((char *) get_text,"%hd",&dialog_answer); @@ -1253,7 +1227,7 @@ void get_num_of_items_event_filter (short item_hit) sscanf((char *) get_text,"%d",&dummy); dialog_answer = dummy; #endif - dialog_not_toast = FALSE; + toast_dialog(); } short get_num_of_items(short max_num) @@ -1271,16 +1245,9 @@ short get_num_of_items(short max_num) sprintf((char *) sign_text,"How many? (0-%d) ",max_num); csit(1012,4,(char *)sign_text); sprintf((char *) sign_text,"%d",max_num); - cd_set_text_edit_str(1012,(char *) sign_text); + cd_set_text_edit_str(1012,2,(char *) sign_text); -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + item_hit = cd_run_dialog(); cd_kill_dialog(1012,0); @@ -1353,7 +1320,6 @@ void create_modeless_dialog(short which_dlog) short i,which_d; GDHandle cur_device; - cur_device = GetGDevice(); for (i = 0; i < 18; i++) if (which_dlog == modeless_key[i]) { @@ -1402,7 +1368,7 @@ void place_glands(location where,unsigned char m_type) monst = return_monster_template(m_type); - if ((monst.corpse_item >= 0) && (monst.corpse_item < 400) && (get_ran(1,0,100) < monst.corpse_item_chance)) { + if ((monst.corpse_item >= 0) && (monst.corpse_item < 400) && (get_ran(1,1,100) < monst.corpse_item_chance)) { store_i = get_stored_item(monst.corpse_item); place_item(store_i,where,FALSE); } @@ -1626,8 +1592,8 @@ void refresh_store_items() void get_text_response_event_filter (short item_hit) { - cd_retrieve_text_edit_str(store_dnum,(char *) store_str); - dialog_not_toast = FALSE; + cd_retrieve_text_edit_str(store_dnum,2,(char *) store_str); + toast_dialog(); } void get_text_response(short dlg,Str255 str,short parent_num) @@ -1641,15 +1607,8 @@ void get_text_response(short dlg,Str255 str,short parent_num) store_dnum = dlg; cd_create_dialog_parent_num(dlg,parent_num); - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + item_hit = cd_run_dialog(); for (i = 0; i < 15; i++) if ((str[i] > 64) && (str[i] < 91)) str[i] = str[i] + 32; diff --git a/osx/loc_utils.c b/osx/loc_utils.c index 23d14f37..4619014d 100644 --- a/osx/loc_utils.c +++ b/osx/loc_utils.c @@ -1,11 +1,12 @@ #include -#include "math.h" +#include "mathutil.h" #include "global.h" #include "loc_utils.h" #include "text.h" #include "monster.h" #include "fields.h" +#include "mathutil.h" char terrain_blocked[256]; @@ -45,31 +46,31 @@ void set_terrain_blocked() short dist(location p1,location p2) { - return (short) ex_sqrt((double)((p1.x - p2.x) * (p1.x - p2.x) + - (p1.y - p2.y) * (p1.y - p2.y))); + return s_sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y)); } -short ex_sqrt(short val) -{ - return (short) sqrt((double)(val)); +bool same_point(location p1,location p2){ + if ((p1.x == p2.x) & (p1.y == p2.y)) + return TRUE; + else return FALSE; } short vdist(location p1,location p2) { short i,j; - i = a_v((short) (p1.x - p2.x)); j = a_v((short) (p1.y - p2.y)); + i = abs((short) (p1.x - p2.x)); j = abs((short) (p1.y - p2.y)); return max(i,j); } Boolean adjacent(location p1,location p2) { - if ((a_v((short) (p1.x - p2.x)) <= 1) && (a_v((short) (p1.y - p2.y)) <= 1)) + if ((abs((short) (p1.x - p2.x)) <= 1) && (abs((short) (p1.y - p2.y)) <= 1)) return TRUE; else return FALSE; } Boolean point_onscreen(location center,location check) { - if ((a_v((short) (center.x - check.x)) <=4) && (a_v((short) (center.y - check.y)) <= 4)) + if ((abs((short) (center.x - check.x)) <=4) && (abs((short) (center.y - check.y)) <= 4)) return TRUE; else return FALSE; } @@ -226,7 +227,7 @@ short can_see(location p1,location p2,short mode) dx = p2.x - p1.x; dy = p2.y - p1.y; - if (ex_abs(dy) > ex_abs(dx)) { + if (abs(dy) > abs(dx)) { if (p2.y > p1.y) { for (count = 1; count < dy; count++) { storage = storage + get_obscurity(p1.x + (count * dx) / dy, p1.y + count); @@ -247,7 +248,7 @@ short can_see(location p1,location p2,short mode) } return storage; } - if (ex_abs(dy) <= ex_abs(dx)) { + if (abs(dy) <= abs(dx)) { if (p2.x > p1.x) { for (count = 1; count < dx; count++) { storage = storage + get_obscurity(p1.x + count, p1.y + (count * dy) / dx); diff --git a/osx/loc_utils.h b/osx/loc_utils.h index 69b6e596..5bac5c01 100644 --- a/osx/loc_utils.h +++ b/osx/loc_utils.h @@ -40,3 +40,4 @@ location push_loc(location from_where,location to_where); Boolean spot_impassable(short i,short j); void swap_ter(short i,short j,unsigned char ter1,unsigned char ter2); void alter_space(short i,short j,unsigned char ter); +bool same_point(location p1,location p2); diff --git a/osx/misc/ViewDlog-Info.plist b/osx/misc/ViewDlog-Info.plist new file mode 100644 index 00000000..42d0ed76 --- /dev/null +++ b/osx/misc/ViewDlog-Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.spidweb.ViewDlog_scen + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/osx/misc/dlgconsts.h b/osx/misc/dlgconsts.h new file mode 100644 index 00000000..b283a056 --- /dev/null +++ b/osx/misc/dlgconsts.h @@ -0,0 +1,72 @@ +/* + * dlogconsts.h + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ + +#define NUM_BUTTONS 15 +#define NUM_DLOG_B 53 + +#define ND 15 +#define NI 500 +#define NL 100 + +// These constants are for draw_dialog_graphic() to know where to find the graphic. +#define PICT_OLD_TYPE -1 +#define PICT_BLANK_TYPE 0 +#define PICT_TER_TYPE 1 // 28x36 terrain graphic +#define PICT_TER_ANIM_TYPE 2 +#define PICT_MONST_TYPE 3 +#define PICT_DLG_TYPE 4 // 36x36 dialog graphic +#define PICT_TALK_TYPE 5 // 32x32 facial graphic +#define PICT_SCEN_TYPE 6 // 32x32 scenario icon +#define PICT_ITEM_TYPE 7 // Item graphic (two sizes available) +#define PICT_PC_TYPE 8 // Player character graphic +#define PICT_INFO_HELP_TYPE 9 +#define PICT_PC_HELP_TYPE 10 +#define PICT_HELP_TYPE 11 +#define PICT_COMBAT_AP_TYPE 12 +#define PICT_STAT_TYPE 13 +#define PICT_FIELD_TYPE 14 // A field or an explosion +#define PICT_DLG_LARGE_TYPE 15 +#define PICT_SCEN_LARGE_TYPE 16 +/* The following four are modifiers to be added to the above seven constants + * Usage for PICT_CUSTOM_TYPE: + * PICT_CUSTOM_TYPE + PICT_XXX_TYPE, where XXX is anything valid other than OLD or BLANK. + * PICT_CUSTOM_TYPE + PICT_MONST_TYPE + PICT_WIDE_MONST, for a 2x1 monster + * PICT_CUSTOM_TYPE + PICT_MONST_TYPE + PICT_TALL_MONST, for a 1x2 monster + * PICT_CUSTOM_TYPE + PICT_MONST_TYPE + PICT_TALL_MONST + PICT_WIDE_MONST, for a 2x2 monster + * Notes: + * - PICT_TALL_MONST and PICT_WIDE_MONST only apply to custom monsters - the preset + * monster graphics have these settings hardcoded. + * - Also note that custom scenario graphics are not currently supported. This doesn't really + * matter, though, since if they were they'd be handled like talk (facial) graphics. + * - Custom animated terrain graphics should use PICT_TER_TYPE rather than PICT_TER_ANIM_TYPE. + */ +#define PICT_CUSTOM_TYPE 100 +#define PICT_WIDE_MONSTER 10 +#define PICT_TALL_MONSTER 20 +#define DLG_NEW_PICTURE 20 // Adding this one makes it a DLG_ constant rather than a PICT_ constant +// These constants are the total number of preset graphics of each type. +#define PICT_N_TER 252 // 336 +#define PICT_N_TER_ANIM 13 // 18 +#define PICT_N_MONST 172 +#define PICT_N_DLG 32 // 44 +#define PICT_N_TALK 83 +#define PICT_N_SCEN 29 +#define PICT_N_ITEM 122 + +// These constants are used to create the definition of the dialogs, and +// to parse a dialog resource when displaying it to the screen. +#define DLG_BUTTON_TYPE 0 +#define DLG_DEFAULT_BTN_TYPE 1 +// Not sure what 10 and 11 do, but they may be similar to above two +#define DLG_LED_BUTTON 2 +// 3, 4, 7, 8, 9 are various text objects; not completely sure which is which +#define DLG_TEXT_BOLD 3 +#define DLG_TEXT_PLAIN 4 +#define DLG_TEXT_LARGE 7 +#define DLG_OLD_PICTURE 5 +// And I don't know what 6 is for either \ No newline at end of file diff --git a/osx/misc/dlglowlevel.cpp b/osx/misc/dlglowlevel.cpp new file mode 100644 index 00000000..61ee669f --- /dev/null +++ b/osx/misc/dlglowlevel.cpp @@ -0,0 +1,933 @@ +/* + * dloglowlevel.cpp + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ + +#include +#include + +#include "dlgconsts.h" +#include "dlglowlevel.h" +#include "dlgtool.h" + +#include "soundtool.h" +#include "graphtool.h" +#include "mathutil.h" + +extern m_pic_index_t m_pic_index[200]; +extern PixPatHandle bg[14]; + +extern GWorldPtr dlg_buttons_gworld[NUM_BUTTONS][2]; +extern map dlg_gworlds; + +extern dlg_t dlgs[ND]; +extern dlg_item_t items[NI]; + +extern char text_long_str[10][256]; +extern char text_short_str[140][40]; +extern dlg_label_t labels[NL]; +extern short store_free_slot; +extern short store_dlog_num; + +extern short available_dlog_buttons[NUM_DLOG_B]; +extern btn_t buttons[]; + +void process_new_window (WindowPtr hDlg) { + short i = -1,j,free_slot = -1,free_item = -1,type,flag; + char but_str[30]; + Str255 item_str; + Boolean str_stored = FALSE; + Rect dlg_rect,store_rect; + short win_height = 0, win_width = 0; + short the_type; + Handle the_handle = NULL; + Rect small_rect; + short item_hit,what_talk_field,num_items; + short str_offset = 1; + long typel,flagl; + + free_slot = store_free_slot; + num_items = CountDITL(GetDialogFromWindow(hDlg)); + + dlgs[free_slot].highest_item = 0; + + // Now, give the window its items + for (i = 0; i < num_items; i++) { + str_offset = 1; + GetDialogItem( GetDialogFromWindow(hDlg), i + 1, &the_type, &the_handle, &small_rect); + if (the_type % 128 == 8) { + GetDialogItemText(the_handle,item_str); + p2cstr(item_str); + dlgs[free_slot].highest_item++; + str_stored = FALSE; + if (strlen((char *)item_str) == 0) { + sprintf((char *) item_str, "+"); + type = DLG_TEXT_BOLD; + flag = 1; + str_stored = TRUE; + } + else if (item_str[0] == '+') { // default is framed text + type = DLG_TEXT_BOLD; + flag = 1; + str_stored = TRUE; + } + else if (item_str[0] == '*') { + type = DLG_TEXT_BOLD; + flag = 0; + str_stored = TRUE; + } + else if (item_str[0] == '~') { + type = DLG_TEXT_LARGE; + flag = 0; + str_stored = TRUE; + } + else if (item_str[0] == '!') { + type = DLG_TEXT_PLAIN; + flag = 0; + str_stored = TRUE; + } + else if (item_str[0] == '=') { + type = 9; + flag = 1; + str_stored = TRUE; + } + else if (((item_str[0] >= 65) && (item_str[0] <= 122)) || (item_str[0] == '"')) { + type = 9; + flag = 0; + str_offset = 0; + str_stored = TRUE; + } + else if ((item_str[0] == '^') || (item_str[0] == '&')) { + type = (item_str[0] == '^') ? 10 : 11; + flag = 1; + if (string_length((char *) item_str) > 55) + flag = 2; + str_stored = TRUE; + } + else { +#ifndef EXILE_BIG_GUNS + sscanf((char *) item_str,"%hd_%hd",&type,&flag); +#endif +#ifdef EXILE_BIG_GUNS + sscanf((char *) item_str,"%hd_%hd",&type,&flag); +#endif + } + + free_item = -1; + // find free item + switch (type) { + case DLG_BUTTON_TYPE: case DLG_DEFAULT_BTN_TYPE: case DLG_LED_BUTTON: + case DLG_OLD_PICTURE: case 6: + case DLG_NEW_PICTURE + PICT_TER_TYPE: + case DLG_NEW_PICTURE + PICT_TER_ANIM_TYPE: + case DLG_NEW_PICTURE + PICT_MONST_TYPE: + case DLG_NEW_PICTURE + PICT_DLG_TYPE: + case DLG_NEW_PICTURE + PICT_TALK_TYPE: + case DLG_NEW_PICTURE + PICT_SCEN_TYPE: + case DLG_NEW_PICTURE + PICT_ITEM_TYPE: + case DLG_NEW_PICTURE + PICT_PC_TYPE: + case DLG_NEW_PICTURE + PICT_INFO_HELP_TYPE: + case DLG_NEW_PICTURE + PICT_PC_HELP_TYPE: + case DLG_NEW_PICTURE + PICT_HELP_TYPE: + case DLG_NEW_PICTURE + PICT_COMBAT_AP_TYPE: + case DLG_NEW_PICTURE + PICT_STAT_TYPE: + case DLG_NEW_PICTURE + PICT_FIELD_TYPE: + case DLG_NEW_PICTURE + PICT_DLG_LARGE_TYPE: + case DLG_NEW_PICTURE + PICT_SCEN_LARGE_TYPE: + for (j = 150; j < NI; j++) + if (items[j].dlg < 0) { + free_item = j; + break; + } + break; + default: + if ((type == 9) || ((str_stored == TRUE) && (strlen((char *) item_str) > 35))) { + for (j = 0; j < 10; j++) + if (items[j].dlg < 0) { + free_item = j; + break; + } + } + else { + for (j = 10; j < 140; j++) + if (items[j].dlg < 0) { + free_item = j; + break; + } + } + break; + } + + if (free_item >= 0) { + items[free_item].dlg = store_dlog_num; + items[free_item].type = type; + items[free_item].number = i + 1; + + items[free_item].rect = get_item_rect(hDlg,i + 1); + + items[free_item].flag = flag; + + items[free_item].active = 1; + items[free_item].label = 0; + items[free_item].label_loc = -1; + items[free_item].key = 0; + switch (type) { + case DLG_BUTTON_TYPE: case DLG_DEFAULT_BTN_TYPE: + GetPortBounds(dlg_buttons_gworld[buttons[flag].type][0], &store_rect); + items[free_item].rect.right = items[free_item].rect.left + store_rect.right; + items[free_item].rect.bottom = items[free_item].rect.top + store_rect.bottom; + items[free_item].key = buttons[flag].def_key; + if (type == 1) + items[free_item].key = 31; + break; + case DLG_LED_BUTTON: + items[free_item].rect.right = items[free_item].rect.left + 14; + items[free_item].rect.bottom = items[free_item].rect.top + 10; + items[free_item].key = 255; + break; + case DLG_TEXT_BOLD: case DLG_TEXT_PLAIN: case DLG_TEXT_LARGE: + case 8: case 9: case 10: case 11: + sprintf(((free_item < 10) ? text_long_str[free_item] : text_short_str[free_item - 10]),""); + if (str_stored == TRUE) { + if (free_item < 10) + sprintf(text_long_str[free_item],"%s",(char *) (item_str + str_offset)); + else + sprintf(text_short_str[free_item - 10],"%-39.39s", (char *) (item_str + str_offset)); + } + items[free_item].key = 255; + if (type >= 10) { + GetPortBounds(dlg_buttons_gworld[1][0], &store_rect); + items[free_item].rect.right = items[free_item].rect.left + store_rect.right; + items[free_item].rect.bottom = items[free_item].rect.top + store_rect.bottom; + if (type == 11) + items[free_item].key = 31; + } + break; + case DLG_OLD_PICTURE: + items[free_item].flag2 = PICT_OLD_TYPE; + break; + case DLG_NEW_PICTURE + PICT_TER_TYPE: + items[free_item].flag2 = PICT_TER_TYPE; + break; + case DLG_NEW_PICTURE + PICT_TER_ANIM_TYPE: + items[free_item].flag2 = PICT_TER_ANIM_TYPE; + break; + case DLG_NEW_PICTURE + PICT_MONST_TYPE: + items[free_item].flag2 = PICT_MONST_TYPE; + break; + case DLG_NEW_PICTURE + PICT_DLG_TYPE: + items[free_item].flag2 = PICT_DLG_TYPE; + break; + case DLG_NEW_PICTURE + PICT_TALK_TYPE: + items[free_item].flag2 = PICT_TALK_TYPE; + break; + case DLG_NEW_PICTURE + PICT_SCEN_TYPE: + items[free_item].flag2 = PICT_SCEN_TYPE; + break; + case DLG_NEW_PICTURE + PICT_ITEM_TYPE: + items[free_item].flag2 = PICT_ITEM_TYPE; + break; + } + win_height = max(win_height, items[free_item].rect.bottom + 5); + win_width = max(win_width, items[free_item].rect.right + 6); + } + } + } + ShortenDITL(GetDialogFromWindow(hDlg),dlgs[free_slot].highest_item); + SizeWindow(hDlg,win_width,win_height,FALSE); + dlgs[free_slot].highest_item = num_items; +} + +// LOW LEVEL + +short cd_get_indices(short dlg_num, short item_num, short *dlg_index, short *item_index){ + if ((*dlg_index = cd_get_dlg_index(dlg_num)) < 0) { + return -1; + } + if ((*item_index = cd_get_item_id(dlg_num,item_num)) < 0) { + return -1; + } + return 0; +} + +short cd_get_dlg_index(short dlog_num){ + short i; + + for (i = 0; i < ND; i++) + if ((dlgs[i].key >= 0) && (dlgs[i].type == dlog_num)) + return i; + return -1; +} + +short cd_find_dlog(WindowPtr window, short *dlg_num, short *dlg_key){ + short i; + for (i = 0; i < ND; i++) + if ((dlgs[i].key >= 0) && (dlgs[i].win == window)) { + *dlg_num = dlgs[i].type; + *dlg_key = dlgs[i].key; + return i; + } + return -1; +} + +short cd_get_item_id(short dlg_num, short item_num){ + short i; + + for (i = 0; i < NI; i++) + if ((items[i].dlg == dlg_num) && (items[i].number == item_num)) + return i; + return -1; +} + +Rect get_item_rect(WindowPtr hDlg, short item_num){ + short the_type; + Handle the_handle = NULL; + Rect small_rect; + short item_hit,what_talk_field; + + GetDialogItem( GetDialogFromWindow(hDlg), item_num, &the_type, &the_handle, &small_rect); + + return small_rect; +} + +void frame_dlog_rect(GrafPtr hDlg, Rect rect, short val, short med_or_lt){ + static RGBColor lt_gray = {57344,57344,57344},dk_gray = {12287,12287,12287},med_gray = {24574,24574,24574}; + GrafPtr old_port; + + GetPort(&old_port); + SetPort(hDlg); + + InsetRect(&rect,-1 * val,-1 * val); + + RGBForeColor(&dk_gray); + MoveTo(rect.left,rect.top); + LineTo(rect.right,rect.top); + if (med_or_lt == 'pc') // hDlg == GetWindowPort(mainPtr) // ie for the pc editor only + RGBForeColor(&med_gray); + else RGBForeColor(<_gray); + LineTo(rect.right,rect.bottom); + LineTo(rect.left,rect.bottom); + RGBForeColor(&dk_gray); + LineTo(rect.left,rect.top); + ForeColor(blackColor); + SetPort(old_port); +} + +// win_or_gworld: 0 - window 1 - gworld +// 0 - 300 number of terrain graphic -> PICT_TER_TYPE (1), PICT_TER_ANIM_TYPE (2) +// 400 + x - monster graphic num (uses index from scenario) -> PICT_MONST_TYPE +// 400 is 1st monster from monster index, 401 is 2nd from m. index, and so on +// 700 + x dlog graphic -> PICT_DLG_TYPE +// 800 + x pc graphic -> PICT_PC_TYPE +// 900 + x B&W graphic -> PICT_BW_TYPE +// 950 null item -> 0, PICT_BLANK_TYPE (0) +// 1000 + x Talking face -> PICT_TALK_TYPE +// 1100 - item info help -> PICT_INFO_TYPE +// 1200 - pc screen help -> PICT_PC_HELP_TYPE +// 1300 - combat ap -> PICT_COMBAT_AP_TYPE +// 1400-1402 - button help -> PICT_HELP_TYPE +// 1500 - stat symbols help -> PICT_STAT_TYPE +// 1600 + x - scen graphics -> PICT_SCEN_TYPE +// 1700 + x - anim / field graphic -> PICT_FIELD_TYPE +// 1800 + x item graphic -> PICT_ITEM_TYPE +// 2000 + x - custom graphics up to 2399 +// 2400 + x - custom graphics up to 2799, BUT it's a split graphic ... +// it looks at the size of rect, and places a 32 x 32 or 36 x 36 graphic drawn +// from the custom gworld, depending on the size of rect. half of graphic is +// drawn from one custom slot, and half is drawn from next one. +// PICT_OLD_TYPE (-1) to revert to the old behaviour +GrafPtr hDialog; +short w__gw; +bool fr; +void draw_dialog_graphic(GrafPtr hDlg, Rect rect, short which_g, + short type_g, Boolean do_frame,short win_or_gworld){ + short picnum; + + RGBColor store_color; + GWorldPtr from_gworld, to_gworld; + + if (which_g < 0) + return; + + if (which_g >= 2000) + do_frame = FALSE; + which_g = which_g % 2000; + + if (type_g == PICT_OLD_TYPE) + convert_pict(which_g,type_g,rect); // pass by reference + //printf("Drawing graphic %i of type %i.\n",which_g,type_g); + + if (type_g == PICT_BLANK_TYPE) { // Empty. Maybe clear space. + if (win_or_gworld == 0) { + InsetRect(&rect, -3, -3); + FillCRect(&rect,bg[5]); + } + return; + } + GetBackColor(&store_color); + + BackColor(whiteColor); + + hDialog = hDlg; + w__gw = win_or_gworld; + fr = do_frame; + switch (type_g) { + case PICT_TER_TYPE: // terrain + draw_preset_ter_pic(which_g,rect); + break; + case PICT_TER_ANIM_TYPE: // animated terrain + draw_preset_anim_ter_pic(which_g,rect); + break; + case PICT_MONST_TYPE: // monster ... needs use index small_monst_rect + // There are 4 different ways to draw, depending on size of monster + if ((m_pic_index[which_g].x == 1) && (m_pic_index[which_g].y == 1)) + draw_preset_monst_pic_small(which_g,rect); + else if ((m_pic_index[which_g].x == 2) && (m_pic_index[which_g].y == 1)) + draw_preset_monst_pic_wide(which_g,rect); + else if ((m_pic_index[which_g].x == 1) && (m_pic_index[which_g].y == 2)) + draw_preset_monst_pic_tall(which_g,rect); + else if ((m_pic_index[which_g].x == 2) && (m_pic_index[which_g].y == 2)) + draw_preset_monst_pic_large(which_g,rect); + break; + + case PICT_ITEM_TYPE: // item + draw_preset_item_pic(which_g,rect); + break; + case PICT_DLG_TYPE: // dialog + draw_preset_dlg_pic(which_g,rect); + break; + case PICT_DLG_LARGE_TYPE: + draw_preset_dlg_pic_large(which_g,rect); + break; + case PICT_PC_TYPE: // PC + draw_preset_pc_pic(which_g,rect); + break; + case PICT_TALK_TYPE: // talk face + draw_preset_talk_pic(which_g,rect); + break; + case PICT_INFO_HELP_TYPE: // item info help + draw_item_info_help_pic(rect); + break; + case PICT_PC_HELP_TYPE: // item info help + draw_pc_info_help_pic(rect); + break; + case PICT_HELP_TYPE: // button help + draw_help_pic(which_g,rect); + break; + case PICT_COMBAT_AP_TYPE: // combat ap help + draw_combat_ap_help_pic(rect); + break; + case PICT_STAT_TYPE: // stat symbols help + draw_pc_stat_help_pic(rect); + break; + case PICT_SCEN_TYPE: + draw_preset_scen_pic(which_g,rect); + break; + case PICT_SCEN_LARGE_TYPE: + draw_preset_scen_pic_large(which_g,rect); + break; + case PICT_FIELD_TYPE: // dialog + draw_preset_field_pic(which_g,rect); + break; + case PICT_CUSTOM_TYPE + PICT_TER_TYPE: // dialog + case PICT_CUSTOM_TYPE + PICT_TER_ANIM_TYPE: + case PICT_CUSTOM_TYPE + PICT_MONST_TYPE: + case PICT_CUSTOM_TYPE + PICT_ITEM_TYPE: + case PICT_CUSTOM_TYPE + PICT_PC_TYPE: + case PICT_CUSTOM_TYPE + PICT_FIELD_TYPE: // These are not necessarily all possible... + draw_custom_space_pic(which_g,rect); + break; + case PICT_CUSTOM_TYPE + PICT_MONST_TYPE + PICT_WIDE_MONSTER: + draw_custom_monst_wide_pic(which_g,rect); + break; + case PICT_CUSTOM_TYPE + PICT_MONST_TYPE + PICT_TALL_MONSTER: + draw_custom_monst_tall_pic(which_g,rect); + break; + case PICT_CUSTOM_TYPE + PICT_MONST_TYPE + PICT_WIDE_MONSTER + PICT_TALL_MONSTER: + draw_custom_monst_large_pic(which_g,rect); + break; + case PICT_CUSTOM_TYPE + PICT_DLG_TYPE: // dialog, split + draw_custom_dlg_pic_split(which_g,rect); + break; + case PICT_CUSTOM_TYPE + PICT_TALK_TYPE: // facial graphic, split + case PICT_CUSTOM_TYPE + PICT_SCEN_TYPE: // Not currently possible; not sure it ever will be + draw_custom_talk_pic_split(which_g,rect); + break; + + } + w__gw = 0; + hDialog = NULL; + fr = FALSE; + + if (do_frame == TRUE) { + rect.bottom--; + rect.right--; + frame_dlog_rect(hDlg,rect,3); + } + RGBBackColor(&store_color); +} + +void convert_pict(short& which_g, short& type_g,Rect& rect){ + unsigned short r = which_g / 100; + printf("Parsing old-style graphic %i.\t",which_g); + if (r < 3){ + type_g = PICT_TER_TYPE; + }else if(r == 4){ + type_g = PICT_TER_ANIM_TYPE; + which_g -= 400; + }else if(r < 7){ + type_g = PICT_MONST_TYPE; + which_g -= 700; + }else if(r >= 20 && r <= 23){ + type_g = PICT_CUSTOM_TYPE + PICT_TER_TYPE; + // It may not be a terrain graphic, but it's at least a terrain-sized graphic, so it matters not + which_g -= 2000; + }else if(r >= 24 && r <= 27){ + type_g = PICT_CUSTOM_TYPE; + which_g -= 2400; + if(rect.right - rect.left == 32){ + type_g += PICT_TALK_TYPE; + }else if(rect.right - rect.left == 36){ + type_g += PICT_DLG_TYPE; + }else{ + type_g += PICT_TER_TYPE; // This should never happen + } + }else if(which_g == 950){ + type_g = PICT_BLANK_TYPE; + }else switch(r){ + case 7: + type_g = PICT_DLG_TYPE; + which_g -= 700; + break; + case 10: + type_g = PICT_TALK_TYPE; + which_g -= 1000; + break; + case 11: + type_g = PICT_INFO_HELP_TYPE; + which_g -= 1100; + break; + case 12: + type_g = PICT_PC_HELP_TYPE; + which_g -= 1200; + break; + case 13: + type_g = PICT_COMBAT_AP_TYPE; + which_g -= 1300; + break; + case 14: + if(which_g > 10){ + type_g = PICT_SCEN_LARGE_TYPE; + }else{ + type_g = PICT_HELP_TYPE; + } + which_g -= 1400; + break; + case 15: + type_g = PICT_STAT_TYPE; + which_g -= 1500; + break; + case 16: + type_g = PICT_SCEN_TYPE; + which_g -= 1600; + break; + case 17: + type_g = PICT_FIELD_TYPE; + which_g -= 1700; + case 18: case 19: + type_g = PICT_ITEM_TYPE; + which_g -= 1800; + break; + } + printf("Reduced to type = %i, num = %i\n",type_g,which_g); +} + +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); + which_g = which_g % 50; + Rect from_rect = calc_rect(which_g % 10, which_g / 10); + if (rect.right - rect.left > 28) + InsetRect(&rect,4,0); + rect_draw_some_item(from_gworld,from_rect, to_gworld, rect,0,draw_dest); +} + +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); + 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); + if (rect.right - rect.left > 28) { + InsetRect(&rect,4,0); + rect.right = rect.left + 28; + } + rect_draw_some_item(from_gworld ,from_rect, to_gworld,rect,0,draw_dest); +} + +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); + 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; + if (w__gw == 0) + PaintRect(&rect); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,1,draw_dest); +} + +void draw_preset_monst_pic_wide(short which_g,Rect& rect){ + short draw_dest = (w__gw == 1) ? 0 : 2; + short m_start_pic = m_pic_index[which_g].i; + Rect small_monst_rect = {0,0,18,14}; + rect.right = rect.left + 28; rect.bottom = rect.top + 36; + 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); + 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); + if (w__gw == 0) + PaintRect(&small_monst_rect); + rect_draw_some_item(from_gworld,from_rect,to_gworld,small_monst_rect,1,draw_dest); + m_start_pic = m_pic_index[which_g].i + 1; + from_gworld = dlg_gworlds["monst"][m_start_pic / 20]; + m_start_pic = m_start_pic % 20; + from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); + OffsetRect(&small_monst_rect,14,0); + if (w__gw == 0) + PaintRect(&small_monst_rect); + rect_draw_some_item(from_gworld,from_rect,to_gworld,small_monst_rect,1,draw_dest); +} + +void draw_preset_monst_pic_tall(short which_g,Rect& rect){ + short draw_dest = (w__gw == 1) ? 0 : 2; + short m_start_pic = m_pic_index[which_g].i; + Rect small_monst_rect = {0,0,18,14}; + rect.right = rect.left + 28; rect.bottom = rect.top + 36; + 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); + 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); + if (w__gw == 0) + PaintRect(&small_monst_rect); + rect_draw_some_item(from_gworld,from_rect,to_gworld,small_monst_rect,1,draw_dest); + m_start_pic = m_pic_index[which_g].i + 1; + from_gworld = dlg_gworlds["monst"][m_start_pic / 20]; + m_start_pic = m_start_pic % 20; + from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); + OffsetRect(&small_monst_rect,0,18); + if (w__gw == 0) + PaintRect(&small_monst_rect); + rect_draw_some_item(from_gworld,from_rect,to_gworld,small_monst_rect,1,draw_dest); +} + +void draw_preset_monst_pic_large(short which_g,Rect& rect){ + short draw_dest = (w__gw == 1) ? 0 : 2; + short m_start_pic = m_pic_index[which_g].i; + Rect small_monst_rect = {0,0,18,14}; + rect.right = rect.left + 28; rect.bottom = rect.top + 36; + 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); + 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); + if (w__gw == 0) + PaintRect(&small_monst_rect); + rect_draw_some_item(from_gworld,from_rect,to_gworld,small_monst_rect,1,draw_dest); + m_start_pic = m_pic_index[which_g].i + 1; + from_gworld = dlg_gworlds["monst"][m_start_pic / 20]; + m_start_pic = m_start_pic % 20; + from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); + OffsetRect(&small_monst_rect,14,0); + if (w__gw == 0) + PaintRect(&small_monst_rect); + rect_draw_some_item(from_gworld,from_rect,to_gworld,small_monst_rect,1,draw_dest); + m_start_pic = m_pic_index[which_g].i + 2; + from_gworld = dlg_gworlds["monst"][m_start_pic / 20]; + m_start_pic = m_start_pic % 20; + from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); + OffsetRect(&small_monst_rect,-14,18); + if (w__gw == 0) + PaintRect(&small_monst_rect); + rect_draw_some_item(from_gworld,from_rect,to_gworld,small_monst_rect,1,draw_dest); + m_start_pic = m_pic_index[which_g].i + 3; + from_gworld = dlg_gworlds["monst"][m_start_pic / 20]; + m_start_pic = m_start_pic % 20; + from_rect = calc_rect(2 * (m_start_pic / 10), m_start_pic % 10); + OffsetRect(&small_monst_rect,14,0); + if (w__gw == 0) + PaintRect(&small_monst_rect); + rect_draw_some_item(from_gworld,from_rect,to_gworld,small_monst_rect,1,draw_dest); +} + +void draw_preset_item_pic(short which_g,Rect& rect){ // item + short draw_dest = (w__gw == 1) ? 0 : 2; + rect.right = rect.left + 28; rect.bottom = rect.top + 36; + Rect to_rect = rect; + if (w__gw == 0) + PaintRect(&rect); + GWorldPtr from_gworld; + Rect from_rect = {0,0,18,18}; + if (which_g < 45) { + from_gworld = *dlg_gworlds["items"]; + from_rect = calc_rect(which_g % 5, which_g / 5); + } + else { + from_gworld = *dlg_gworlds["tiny-obj"]; + //rect.top += 4; rect.bottom -= 4; + 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); + 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); + 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); +} + +void draw_preset_pc_pic(short which_g,Rect& rect){ // PC + short draw_dest = (w__gw == 1) ? 0 : 2; + GWorldPtr from_gworld; + 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); + //which_g -= 800; + Rect from_rect = calc_rect(2 * (which_g / 8), which_g % 8); + PaintRect(&rect); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,1,draw_dest); + if (*dlg_gworlds["pc"] == NULL) + DisposeGWorld(from_gworld); +} + +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); + 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); +} + +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}; + 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); +} + +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"]); + 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); +} + +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); + Rect from_rect = {0,0,64,64}; + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,0,draw_dest); + DisposeGWorld(from_gworld); +} + +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); + Rect from_rect = {0,0,125,320}; + rect.right = rect.left + from_rect.right; + rect.bottom = rect.top + from_rect.bottom; + OffsetRect(&from_rect,0,125 * which_g); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,0,draw_dest); + DisposeGWorld(from_gworld); +} + +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); + Rect from_rect = {0,0,100,275}; + rect.right = rect.left + from_rect.right; + rect.bottom = rect.top + from_rect.bottom; + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,0,draw_dest); + DisposeGWorld(from_gworld); +} + +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); + Rect from_rect = {0,0,94,386}; + rect.right = rect.left + from_rect.right; + rect.bottom = rect.top + from_rect.bottom; + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,0,draw_dest); + DisposeGWorld(from_gworld); +} + +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); + Rect from_rect = {0,0,32,32}; + OffsetRect(&from_rect,32 * (which_g % 5),32 * (which_g / 5)); + rect.right = rect.left + 32; + rect.bottom = rect.top + 32; + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,0,draw_dest); + DisposeGWorld(from_gworld); +} + +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); + Rect from_rect = calc_rect(which_g % 8, which_g / 8); + if (w__gw == 0) + PaintRect(&rect); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,0,draw_dest); +} + +void draw_custom_space_pic(short which_g,Rect& rect){ + short draw_dest = (w__gw == 1) ? 0 : 2; + printf("Drawing graphic %i as a custom space pic.\n",which_g); + 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); + Rect from_rect = get_custom_rect(which_g); + if ((w__gw == 0) && (fr == TRUE)) + PaintRect(&rect); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,1,draw_dest); +} + +void draw_custom_monst_wide_pic(short which_g,Rect& rect){ + short draw_dest = (w__gw == 1) ? 0 : 2; + rect.right = rect.left + 28; + rect.bottom = rect.top + 32; + if ((w__gw == 0) && (fr == TRUE)) + PaintRect(&rect); + rect.right = rect.left + 14; + rect.bottom = rect.top + 16; + OffsetRect(&rect,0,7); + GWorldPtr from_gworld = *dlg_gworlds["custom"]; + GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + Rect from_rect = get_custom_rect(which_g); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,1,draw_dest); + OffsetRect(&rect,14,0); + from_rect = get_custom_rect(which_g+1); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,1,draw_dest); +} + +void draw_custom_monst_tall_pic(short which_g,Rect& rect){ + short draw_dest = (w__gw == 1) ? 0 : 2; + rect.right = rect.left + 28; + rect.bottom = rect.top + 32; + if ((w__gw == 0) && (fr == TRUE)) + PaintRect(&rect); + rect.right = rect.left + 14; + rect.bottom = rect.top + 16; + OffsetRect(&rect,8,0); + GWorldPtr from_gworld = *dlg_gworlds["custom"]; + GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + Rect from_rect = get_custom_rect(which_g); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,1,draw_dest); + OffsetRect(&rect,0,16); + from_rect = get_custom_rect(which_g+1); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,1,draw_dest); +} + +void draw_custom_monst_large_pic(short which_g,Rect& rect){ + short draw_dest = (w__gw == 1) ? 0 : 2; + rect.right = rect.left + 28; + rect.bottom = rect.top + 32; + if ((w__gw == 0) && (fr == TRUE)) + PaintRect(&rect); + rect.right = rect.left + 14; + rect.bottom = rect.top + 16; + GWorldPtr from_gworld = *dlg_gworlds["custom"]; + GWorldPtr to_gworld = (GWorldPtr) ((w__gw == 1) ? (GWorldPtr)hDialog: from_gworld); + Rect from_rect = get_custom_rect(which_g); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,1,draw_dest); + OffsetRect(&rect,14,0); + from_rect = get_custom_rect(which_g+1); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,1,draw_dest); + OffsetRect(&rect,-14,16); + from_rect = get_custom_rect(which_g+2); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,1,draw_dest); + OffsetRect(&rect,14,0); + from_rect = get_custom_rect(which_g+3); + rect_draw_some_item(from_gworld,from_rect,to_gworld,rect,1,draw_dest); +} + +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); + Rect from_rect = get_custom_rect(which_g); + Rect to_rect = rect; + to_rect.right = to_rect.left + 18; + to_rect.bottom = to_rect.top + 36; + from_rect.right = from_rect.left + 18; + from_rect.bottom = from_rect.top + 36; + rect_draw_some_item(from_gworld,from_rect,to_gworld,to_rect,1,draw_dest); + from_rect = get_custom_rect(which_g + 1); + OffsetRect(&to_rect,18,0); + from_rect.right = from_rect.left + 18; + from_rect.bottom = from_rect.top + 36; + rect_draw_some_item(from_gworld,from_rect,to_gworld,to_rect,1,draw_dest); +} + +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); + Rect from_rect = get_custom_rect(which_g); + Rect to_rect = rect; + to_rect.right = to_rect.left + 16; + to_rect.bottom = to_rect.top + 32; + from_rect.right = from_rect.left + 16; + from_rect.bottom = from_rect.top + 32; + rect_draw_some_item(from_gworld,from_rect,to_gworld,to_rect,1,draw_dest); + from_rect = get_custom_rect(which_g + 1); + OffsetRect(&to_rect,16,0); + from_rect.right = from_rect.left + 16; + from_rect.bottom = from_rect.top + 32; + rect_draw_some_item(from_gworld,from_rect,to_gworld,to_rect,1,draw_dest); +} + +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); + 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); +} \ No newline at end of file diff --git a/osx/misc/dlglowlevel.h b/osx/misc/dlglowlevel.h new file mode 100644 index 00000000..41c63d1b --- /dev/null +++ b/osx/misc/dlglowlevel.h @@ -0,0 +1,44 @@ +/* + * dloglowlevel.h + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ + +#define IN_FRONT (WindowPtr)-1L + +void process_new_window (WindowPtr hDlg); +short cd_get_indices(short dlg_num, short item_num, short *dlg_index, short *item_index); +short cd_get_dlg_index(short dlog_num); +short cd_find_dlog(WindowPtr window, short *dlg_num, short *dlg_key); +short cd_get_item_id(short dlg_num, short item_num); +Rect get_item_rect(WindowPtr hDlg, short item_num); +void frame_dlog_rect(GrafPtr hDlg, Rect rect, short val, short med_or_lt = 0); +void draw_dialog_graphic(GrafPtr hDlg, Rect rect, short which_g, short type_g, Boolean do_frame,short win_or_gworld); +void convert_pict(short& which_g, short& type_g,Rect& rect); +void draw_preset_ter_pic(short which_g,Rect& rect); +void draw_preset_anim_ter_pic(short which_g,Rect& rect); +void draw_preset_monst_pic_small(short which_g,Rect& rect); +void draw_preset_monst_pic_wide(short which_g,Rect& rect); +void draw_preset_monst_pic_tall(short which_g,Rect& rect); +void draw_preset_monst_pic_large(short which_g,Rect& rect); +void draw_preset_item_pic(short which_g,Rect& rect); +void draw_preset_dlg_pic(short which_g,Rect& rect); +void draw_preset_pc_pic(short which_g,Rect& rect); +void draw_preset_talk_pic(short which_g,Rect& rect); +void draw_item_info_help_pic(Rect& rect); +void draw_pc_info_help_pic(Rect& rect); +void draw_help_pic(short which_g,Rect& rect); +void draw_combat_ap_help_pic(Rect& rect); +void draw_pc_stat_help_pic(Rect& rect); +void draw_preset_scen_pic(short which_g,Rect& rect); +void draw_preset_field_pic(short which_g,Rect& rect); +void draw_custom_space_pic(short which_g,Rect& rect); +void draw_custom_monst_wide_pic(short which_g,Rect& rect); +void draw_custom_monst_tall_pic(short which_g,Rect& rect); +void draw_custom_monst_large_pic(short which_g,Rect& rect); +void draw_custom_dlg_pic_split(short which_g,Rect& rect); +void draw_custom_talk_pic_split(short which_g,Rect& rect); +void draw_preset_scen_pic_large(short which_g,Rect& rect); +void draw_preset_dlg_pic_large(short which_g,Rect& rect); \ No newline at end of file diff --git a/osx/misc/dlgtool.cpp b/osx/misc/dlgtool.cpp new file mode 100644 index 00000000..fb00fe90 --- /dev/null +++ b/osx/misc/dlgtool.cpp @@ -0,0 +1,1424 @@ +/* + * dlogtool.cpp + * BoE + * + * Created by Celtic Minstrel on 15/04/09. + * + */ + +#include +#include +#include +using std::vector; +//#include + +#include "dlgconsts.h" +#include "dlgtool.h" +#include "dlglowlevel.h" + +#include "soundtool.h" +#include "graphtool.h" +#include "mathutil.h" + +extern void (*redraw_screen)(); +extern bool play_sounds, cursor_shown; +extern WindowPtr mainPtr; +extern bool modeless_exists[18]; +extern DialogPtr modeless_dialogs[18]; +extern m_pic_index_t m_pic_index[200]; + +extern PixPatHandle bg[14]; +extern short geneva_font_num, sword_curs; + +GWorldPtr dlg_buttons_gworld[NUM_BUTTONS][2]; +map dlg_gworlds; + +short current_key = 0; +dlg_t dlgs[ND]; +dlg_item_t items[NI]; + +char text_long_str[10][256]; +char text_short_str[140][40]; +dlg_label_t labels[NL]; +short store_free_slot; +short store_dlog_num; +bool dlg_not_toast; + +#ifdef EXILE_BIG_GUNS +main_dialog_UPP = NewModalFilterProc(cd_event_filter); +#endif +vector event_filters; + +short available_dlog_buttons[NUM_DLOG_B] = { // This array is a list of indices into the following array. + 0, 63, 64, 65, 1, 4, 5, 8, 128,9, + 10, 11, 12, 13, 14, 15, 16, 17, 29, 51, + 60, 61, 62, 66, 69, 70, 71, 72, 73, 74, + 79, 80, 83, 86, 87, 88, 91, 92, 93, 99, + 100,101,102,104,129,130,131,132,133,134, + 135,136,137 +}; +btn_t buttons[] = { + {DLG_BTN_DONE, " ", 2, 0}, // Formerly DLG_BTN_REG with "Done " as the string + {DLG_BTN_REG, "Ask", 0, 0}, + {DLG_BTN_LEFT, " ", 0, DLG_KEY_LEFT}, + {DLG_BTN_RIGHT, " ", 0, DLG_KEY_RIGHT}, + {DLG_BTN_REG, "Keep", 6, 'k'}, + {DLG_BTN_REG, "Cancel", 0, DLG_KEY_ESC}, + {DLG_BTN_SM, "+", 0, 0}, + {DLG_BTN_SM, "-", 0, 0}, + {DLG_BTN_REG, "Buy", 4, 0}, + {DLG_BTN_REG, "Leave", 5, 0}, + //10 + {DLG_BTN_REG, "Get", 0, 'g'}, + {DLG_BTN_REG, "1", 0, '1'}, + {DLG_BTN_REG, "2", 0, '2'}, + {DLG_BTN_REG, "3", 0, '3'}, + {DLG_BTN_REG, "4", 0, '4'}, + {DLG_BTN_REG, "5", 0, '5'}, + {DLG_BTN_REG, "6", 0, '6'}, + {DLG_BTN_REG, "Cast", 4, 0}, + {DLG_BTN_LED1, " ", 0, 0}, + {DLG_BTN_LED1, " ", 0, 0}, + //20 + {DLG_BTN_LED2, " ", 0, 0}, + {DLG_BTN_LED2, " ", 0, 0}, + {DLG_BTN_LED2, " ", 0, 0}, + {DLG_BTN_REG, "Buy", 4, 0}, + {DLG_BTN_REG, "Sell", 0, 0}, + {DLG_BTN_LG, "Other Spells", 5, ' '}, + {DLG_BTN_REG, "Buy x10", 0, 0}, + {DLG_BTN_UP, " ", 0, DLG_KEY_UP}, + {DLG_BTN_DOWN, " ", 0, DLG_KEY_DOWN}, + {DLG_BTN_REG, "Save", 6, 0}, + //30 + {DLG_BTN_REG, "Race", 6, 0}, + {DLG_BTN_TALL, "Train", 6, 0}, + {DLG_BTN_REG, "Items", 0, 0}, + {DLG_BTN_REG, "Spells", 0, 0}, + {DLG_BTN_LG, "Heal Party", 0, 0}, + {DLG_BTN_SM, "1", 0, '1'}, + {DLG_BTN_SM, "2", 0, '2'}, + {DLG_BTN_SM, "3", 0, '3'}, + {DLG_BTN_SM, "4", 0, '4'}, + {DLG_BTN_SM, "5", 0, '5'}, + //40 + {DLG_BTN_SM, "6", 0, '6'}, + {DLG_BTN_SM, "7", 0, '7'}, + {DLG_BTN_SM, "8", 0, '8'}, + {DLG_BTN_SM, "9", 0, '9'}, + {DLG_BTN_SM, "10", 6, 'a'}, + {DLG_BTN_SM, "11", 6, 'b'}, + {DLG_BTN_SM, "12", 6, 'c'}, + {DLG_BTN_SM, "13", 6, 'd'}, + {DLG_BTN_SM, "14", 6, 'e'}, + {DLG_BTN_SM, "15", 6, 'f'}, + //50 + {DLG_BTN_SM, "16", 6, 'g'}, + {DLG_BTN_REG, "Take", 6, 0}, + {DLG_BTN_REG, "Create", 0, 0}, + {DLG_BTN_REG, "Delete", 2, 0}, + {DLG_BTN_LG, "Race/Special", 0, 0}, + {DLG_BTN_REG, "Skill", 0, 0}, + {DLG_BTN_REG, "Name", 0, 0}, + {DLG_BTN_REG, "Graphic", 2, 0}, + {DLG_BTN_LG, "Bash Door", 3, 0}, + {DLG_BTN_LG, "Pick Lock", 3, 0}, + //60 + {DLG_BTN_REG, "Leave", 6, 0}, + {DLG_BTN_REG, "Steal", 6, 0}, + {DLG_BTN_REG, "Attack", 0, 0}, + {DLG_BTN_REG, "OK", 7, 0}, + {DLG_BTN_REG, "Yes", 5, 'y'}, + {DLG_BTN_REG, "No", 5, 'n'}, + {DLG_BTN_LG, "Step In", 0, 0}, + {DLG_BTN_HELP, " ", 0, '?'}, + {DLG_BTN_REG, "Record", 2, 'r'}, + {DLG_BTN_REG, "Climb", 6, 0}, + //70 + {DLG_BTN_REG, "Flee", 4, 0}, + {DLG_BTN_REG, "Onward", 2, 0}, + {DLG_BTN_REG, "Answer", 0, 0}, + {DLG_BTN_REG, "Drink", 5, 0}, + {DLG_BTN_LG, "Approach", 0, 0}, + {DLG_BTN_LG, "Mage Spells", 4, 0}, + {DLG_BTN_LG, "Priest Spells", 10, 0}, + {DLG_BTN_LG, "Advantages", 4, 0}, + {DLG_BTN_LG, "New Game", 0, 0}, + {DLG_BTN_REG, "Land", 6, 0}, + //80 + {DLG_BTN_REG, "Under", 6, 0}, + {DLG_BTN_REG, "Restore", 2, 0}, + {DLG_BTN_REG, "Restart", 1, 0}, + {DLG_BTN_REG, "Quit", 6, 0}, + {DLG_BTN_LG, "Save First", 4, 0}, + {DLG_BTN_LG, "Just Quit", 3, 0}, + {DLG_BTN_REG, "Rest", 6, 0}, + {DLG_BTN_REG, "Read", 4, 0}, + {DLG_BTN_REG, "Pull", 6, 0}, + {DLG_BTN_LG, "Alchemy", 4, 0}, + //90 + {DLG_BTN_SM, "17", 6, 'g'}, + {DLG_BTN_REG, "Push", 6, 0}, + {DLG_BTN_REG, "Pray", 6, 0}, + {DLG_BTN_REG, "Wait", 6, 0}, + {DLG_BTN_PUSH, "", 0, 0}, + {DLG_BTN_TRAIT, "", 0, 0}, + {DLG_BTN_TALL, "Delete", 0, 0}, + {DLG_BTN_TALL, "Graphic", 2, 0}, + {DLG_BTN_TALL, "Create", 0, 0}, + {DLG_BTN_REG, "Give", 4, 0}, + //100 + {DLG_BTN_REG, "Destroy", 2, 0}, + {DLG_BTN_REG, "Pay", 6, 0}, + {DLG_BTN_REG, "Free", 6, 0}, + {DLG_BTN_LG, "Next Tip", 3, 0}, + {DLG_BTN_REG, "Touch", 6, 0}, + {DLG_BTN_LG, "Select Icon", 7, 0}, + {DLG_BTN_LG, "Create/Edit", 3, 0}, + {DLG_BTN_LG, "Clear Special", 0, 0}, + {DLG_BTN_LG, "Edit Abilities", 0, 0}, + {DLG_BTN_REG, "Choose", 0, 0}, + //110 + {DLG_BTN_LG, "Go Back", 0, 0}, + {DLG_BTN_LG, "Create New", 5, 0}, + {DLG_BTN_LG, "General", 3, 0}, + {DLG_BTN_LG, "One Shots", 3, 0}, + {DLG_BTN_LG, "Affect PCs", 3, 0}, + {DLG_BTN_LG, "If-Thens", 3, 0}, + {DLG_BTN_LG, "Town Specs", 3, 0}, + {DLG_BTN_LG, "Out Specs", 4, 0}, + {DLG_BTN_LG, "Advanced", 4, 0}, + {DLG_BTN_LG, "Weapon Abil", 4, 0}, + //120 + {DLG_BTN_LG, "General Abil.", 6, 0}, + {DLG_BTN_LG, "NonSpell Use", 4, 0}, + {DLG_BTN_LG, "Spell Usable", 4, 0}, + {DLG_BTN_LG, "Reagents", 2, 0}, + {DLG_BTN_LG, "Missiles", 2, 0}, + {DLG_BTN_LG, "Abilities", 3, 0}, + {DLG_BTN_LG, "Pick Picture", 6, 0}, + {DLG_BTN_LG, "Animated", 5, 0}, + {DLG_BTN_REG, "Enter", 6, 0}, + {DLG_BTN_REG, "Burn", 6, 0}, + //130 + {DLG_BTN_REG, "Insert", 0, 0}, + {DLG_BTN_REG, "Remove", 4, 0}, + {DLG_BTN_REG, "Accept", 2, 0}, + {DLG_BTN_REG, "Refuse", 2, 0}, + {DLG_BTN_REG, "Open", 6, 0}, + {DLG_BTN_REG, "Close", 4, 0}, + {DLG_BTN_REG, "Sit", 6, 0}, + {DLG_BTN_REG, "Stand", 3, 0}, + {DLG_BTN_SM, "", 0, 0}, + {DLG_BTN_SM, "", 0, 0}, + //140 + {DLG_BTN_SM, "18", 0, 0}, + {DLG_BTN_SM, "19", 0, 0}, + {DLG_BTN_SM, "20", 0, 0}, + {DLG_BTN_SM, "Invisible!", 0, 0}, + {DLG_BTN_SM, "", 0, 0}, + {DLG_BTN_SM, "", 0, 0}, + {DLG_BTN_SM, "", 0, 0}, + {DLG_BTN_SM, "", 0, 0}, + {DLG_BTN_SM, "", 0, 0}, + {DLG_BTN_SM, "", 0, 0}, + //150 + {DLG_BTN_LG, "Open File", 7, 0}, + {DLG_BTN_SM, " ", 0, 0}, + }; +// specials ... 20 - <- 21 - -> 22 up 23 down 24 esc +// 25-30 ctrl 1-6 31 - return\ + +void cd_init_dialogs(INIT_PARAMS){ + short i,j; + + for (i = 0; i < ND; i++) { + dlgs[i].key = -1; + dlgs[i].type = 0; + dlgs[i].win = NULL; + dlgs[i].highest_item = 0; + } + for (i = 0; i < NI; i++) { + items[i].dlg = -1; + } + for (i = 0; i < NL; i++) { + labels[i].taken = FALSE; + } + for (i = 0; i < NUM_BUTTONS; i++){ + for (j = 0; j < 2; j++) + dlg_buttons_gworld[i][j] = load_pict(2000 + (2 * i) + j); + } + //dlg_gworlds.swap(gw); + //copy(gw.begin(), gw.end(), dlg_gworlds.begin()) + //dlg_gworlds = gw; + //for(map::iterator it = gw.begin(); it != gw.end(); it++){ + // printf("Copying gworld %s...\n",it->first); + // dlg_gworlds[it->first] = it->second; + //} + dlg_gworlds["anim"] = g1; + dlg_gworlds["talkfaces"] = g2; + dlg_gworlds["items"] = g3; + dlg_gworlds["tiny-obj"] = g4; + dlg_gworlds["pc"] = g5; + dlg_gworlds["dlog"] = g6; + dlg_gworlds["monst"] = g7; + dlg_gworlds["ter"] = g8; + dlg_gworlds["small-ter"] = g9; + dlg_gworlds["fields"] = g10; + dlg_gworlds["pc-stats"] = g11; + dlg_gworlds["item-stats"] = g12; + dlg_gworlds["text-area"] = g13; + dlg_gworlds["storage"] = g14; + dlg_gworlds["ter-scr"] = g15; + dlg_gworlds["text_bar"] = g16; + dlg_gworlds["orig-text-bar"] = g17; + dlg_gworlds["buttons"] = g18; + dlg_gworlds["party-tmpl"] = g19; + dlg_gworlds["mixed"] = g20; + dlg_gworlds["custom"] = g21; + event_filters.push_back(dlg_filters(0,NULL)); // default event filter placeholder +} + + +short cd_create_dialog_parent_num(short dlog_num,short parent){ + short i; + + if ((parent == 0) || (parent == 1)) + return cd_create_dialog(dlog_num,mainPtr); + i = cd_get_dlg_index(parent); + if (i < 0) + return -1; + return cd_create_dialog(dlog_num,dlgs[i].win); + +} + +short cd_create_dialog(short dlog_num,WindowPtr parent){ + short i,j,free_slot = -1,free_item = -1; + WindowPtr dlg; + + char item_str[256]; + short type,flag; + + store_dlog_num = dlog_num; + for (i = 0; i < ND; i++) { + if ((dlgs[i].key >= 0) && (dlgs[i].type == dlog_num)) + return -1; + } + for (i = 0; i < ND; i++) { + if (dlgs[i].key < 0) { + free_slot = i; + break; + } + } + if (free_slot < 0) + return -2; + current_key++; + dlgs[free_slot].key = current_key; + dlgs[free_slot].type = dlog_num; + dlgs[free_slot].highest_item = 1; + dlgs[free_slot].draw_ready = false; + dlgs[free_slot].win = NULL; + + // first, create dummy dlog + store_free_slot = free_slot; + dlgs[free_slot].win = GetDialogWindow(GetNewDialog (dlog_num, NULL, IN_FRONT)); + if (dlgs[free_slot].win == NULL) { + play_sound(3); + return -3; + } + + dlgs[free_slot].parent = parent; + + process_new_window (dlgs[free_slot].win); + ShowWindow(dlgs[free_slot].win); + SetPortWindowPort(dlgs[free_slot].win); + ForeColor(blackColor); + BackColor(whiteColor); + untoast_dialog(); + set_cursor(sword_curs); + + return 0; +} + +short cd_kill_dialog(short dlog_num,short parent_message){ + short i,which_dlg = -1; + + for (i = 0; i < ND; i++) + if ((dlgs[i].key >= 0) && (dlgs[i].type == dlog_num)) + which_dlg = i; + if (which_dlg < 0) + return -1; + + for (i = 0; i < NI; i++) + if (items[i].dlg == dlog_num) { + if (items[i].label > 0) + labels[items[i].label_loc].taken = FALSE; + items[i].dlg = -1; + } + + DisposeDialog(GetDialogFromWindow(dlgs[which_dlg].win)); + dlgs[which_dlg].key = -1; + if (dlgs[which_dlg].parent != NULL) + SetPortWindowPort( dlgs[which_dlg].parent); + if (FrontWindow() != mainPtr) + redraw_screen(); + untoast_dialog(); + return 0; +} + +short cd_process_click(WindowPtr window,Point the_point, short mods,short *item){ + short i,which_dlg,dlg_num,item_id; + short dlog_key; + + if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlog_key)) < 0) + return -1; + + for (i = 0; i < dlgs[which_dlg].highest_item + 1; i++) + if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { + if ((PtInRect(the_point,&items[item_id].rect)) && (items[item_id].active > 0) + && ((items[item_id].type < 3) || (items[item_id].type == 8) + || (items[item_id].type == 10)|| (items[item_id].type == 11))) { + *item = i; + if ((mods & 2048) != 0) + *item += 100; + if (items[item_id].type != 8) + cd_press_button(dlg_num,i); + return dlg_num; + } + } + return -1; +} + +short cd_process_keystroke(WindowPtr window,char char_hit,short *item){ + short i,which_dlg,dlg_num,dlg_key,item_id; + + if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlg_key)) < 0) + return -1; + // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc + // 25-30 ctrl 1-6 + + + for (i = 0; i < dlgs[which_dlg].highest_item + 1; i++){ + if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { + if ((items[item_id].key == char_hit) && (items[item_id].active > 0) + && ((items[item_id].type < 3) || (items[item_id].type == 8) + || (items[item_id].type == 10) || (items[item_id].type == 11))) { + *item = i; + if (items[item_id].type != 8) + cd_press_button(dlg_num,i); + return dlg_num; + } + } + } + + // kludgy. If you get an escape and is isn't processed, make it an enter + if (char_hit == 24) { + char_hit = 31; + for (i = 0; i < dlgs[which_dlg].highest_item + 1; i++){ + if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { + if ((items[item_id].key == char_hit) && (items[item_id].active > 0) + && ((items[item_id].type < 3) || (items[item_id].type == 8))) { + *item = i; + if (items[item_id].type != 8) + cd_press_button(dlg_num,i); + return dlg_num; + } + } + } + } + return -1; +} + +void cd_attach_key(short dlog_num,short item_num,char key){ + short dlg_index,item_index; + + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + + if ((items[item_index].type > 2) && (items[item_index].type != 8)) { + SysBeep(20); + return; + } + items[item_index].key = key; +} + +void csp(short dlog_num, short item_num, short pict_num, short pict_type){ + cd_set_pict( dlog_num, item_num, pict_num, pict_type); +} + +void cd_set_pict(short dlog_num, short item_num, short pict_num, short pict_type){ + short dlg_index,item_index; + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + if (items[item_index].type < DLG_NEW_PICTURE && items[item_index].type != 5) { + SysBeep(20); + return; + } + items[item_index].flag = pict_num; + items[item_index].flag2 = pict_type; + if (pict_num == -1) + cd_erase_item(dlog_num,item_num); + else cd_draw_item(dlog_num,item_num); +} + +void cd_activate_item(short dlog_num, short item_num, short status){ + short dlg_index,item_index; + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + + items[item_index].active = status; + cd_draw_item(dlog_num,item_num); +} + +short cd_get_active(short dlog_num, short item_num){ + short dlg_index,item_index; + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return -1; + + return items[item_index].active; +} + +void cd_get_item_text(short dlog_num, short item_num, char *str){ + short dlg_index,item_index; + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return ; + if (item_index >= 150) { + SysBeep(20); + return; + } + if (item_index < 10) + sprintf(str,"%s",text_long_str[item_index]); + else sprintf(str,"%s",text_short_str[item_index - 10]); +} + +void csit(short dlog_num, short item_num, char *str){ + cd_set_item_text( dlog_num, item_num, str); +} + +void cd_set_item_text(short dlog_num, short item_num, char *str){ + short dlg_index,item_index; + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return ; + if (item_index >= 150) { + SysBeep(20); + return; + } + if (item_index < 10) + sprintf(text_long_str[item_index],"%s",str); + else sprintf(text_short_str[item_index - 10],"%-39.39s",str); + cd_draw_item( dlog_num,item_num); +} + +void cd_retrieve_text_edit_str(short dlog_num, short item_num, char *str){ + short dlg_index,item_index; + short the_type; + Handle the_handle = NULL; + Rect the_rect; + Str255 store_ptr; + + sprintf(str,""); + dlg_index = cd_get_dlg_index(dlog_num); + if (dlg_index < 0) { + SysBeep(50); return ; + } + GetDialogItem(GetDialogFromWindow(dlgs[dlg_index].win), item_num, &the_type, &the_handle, &the_rect); + GetDialogItemText(the_handle,store_ptr); + p2cstr(store_ptr); + strcpy(str,(char *) store_ptr); +} + +short cd_retrieve_text_edit_num(short dlog_num, short item_num){ + short dlg_index,item_index; + short the_type; + Handle the_handle = NULL; + Rect the_rect; + Str255 store_ptr; + long num_given; + + dlg_index = cd_get_dlg_index(dlog_num); + if (dlg_index < 0) { + SysBeep(50); return -1; + } + GetDialogItem(GetDialogFromWindow( dlgs[dlg_index].win), item_num, &the_type, &the_handle, &the_rect); + GetDialogItemText(the_handle,store_ptr); + StringToNum (store_ptr,&num_given); + return (short) num_given; +} + +// NOTE!!! Expects a c string +void cd_set_text_edit_str(short dlog_num, short item_num, char *str){ + short dlg_index,item_index; + short the_type; + Handle the_handle = NULL; + Rect the_rect; + Str255 store_ptr; + + dlg_index = cd_get_dlg_index(dlog_num); + if (dlg_index < 0) { + SysBeep(50); return ; + } + strcpy((char *) store_ptr,str); + c2pstr((char*) store_ptr); + GetDialogItem(GetDialogFromWindow( dlgs[dlg_index].win), item_num, &the_type, &the_handle, &the_rect ); + SetDialogItemText ( the_handle, store_ptr); +} + +void cd_set_text_edit_num(short dlog_num, short item_num, short num){ + short dlg_index,item_index; + short the_type; + Handle the_handle = NULL; + Rect the_rect; + Str255 store_ptr; + + dlg_index = cd_get_dlg_index(dlog_num); + if (dlg_index < 0) { + SysBeep(50); + return; + } + + sprintf((char *) store_ptr,"%d",num); + c2pstr((char*) store_ptr); + GetDialogItem( GetDialogFromWindow(dlgs[dlg_index].win), item_num, &the_type, &the_handle, &the_rect ); + SetDialogItemText ( the_handle, store_ptr); +} + +void cdsin(short dlog_num, short item_num, short num) { + cd_set_item_num( dlog_num, item_num, num); +} + + +void cd_set_item_num(short dlog_num, short item_num, short num){ + short dlg_index,item_index; + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return ; + if (item_index >= 150) { + SysBeep(20); + return; + } + if (item_index < 10) + sprintf(text_long_str[item_index],"%d",num); + else sprintf(text_short_str[item_index - 10],"%d",num); + cd_draw_item( dlog_num,item_num); +} + +void cd_set_led(short dlog_num,short item_num,short state){ + short dlg_index,item_index; + + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + + if (items[item_index].type != 2) { + SysBeep(20); + return; + } + items[item_index].flag = state; + cd_draw_item(dlog_num,item_num); +} + +// Use when checking for events ... if item hit matches item num, this led was +// hit, and flip it to other thing. +void cd_flip_led(short dlog_num,short item_num,short item_hit){ + if (item_hit != item_num) + return; + if (cd_get_led(dlog_num,item_num) > 0) + cd_set_led(dlog_num,item_num,0); + else cd_set_led(dlog_num,item_num,1); +} + +void cd_set_led_range(short dlog_num,short first_led,short last_led,short which_to_set){ + short i; + + for (i = first_led; i <= last_led; i++) { + if (i - first_led == which_to_set) + cd_set_led(dlog_num,i,1); + else cd_set_led(dlog_num,i,0); + } +} + +// Use when someone presses something in the range, to light up the right button +// Also has an error check ... if which_to_set is outside range, do nothing +void cd_hit_led_range(short dlog_num,short first_led,short last_led,short which_to_set){ + short i; + + if ((which_to_set < first_led) || (which_to_set > last_led)) + return; + for (i = first_led; i <= last_led; i++) { + if (i == which_to_set) + cd_set_led(dlog_num,i,1); + else cd_set_led(dlog_num,i,0); + } +} + +short cd_get_led_range(short dlog_num,short first_led,short last_led){ + short i; + + for (i = first_led; i <= last_led; i++) { + if (cd_get_led(dlog_num,i) == 1) + return i - first_led; + } + return 0; +} + +void cd_set_flag(short dlog_num,short item_num,short flag){ + short dlg_index,item_index; + + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + + items[item_index].flag = flag; + cd_draw_item(dlog_num,item_num); +} + +short cd_get_led(short dlog_num,short item_num){ + short dlg_index,item_index; + + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return 0; + + if (items[item_index].type != 2) { + SysBeep(20); + return 0; + } + return items[item_index].flag; +} + +void cd_text_frame(short dlog_num,short item_num,short frame){ + short dlg_index,item_index; + + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + + if (item_index >= 150) { + SysBeep(20); + return; + } + items[item_index].flag = frame; + cd_draw_item(dlog_num,item_num); +} + +void cd_add_label(short dlog_num, short item_num, char *label, short label_flag){ + short dlg_index,item_index,label_loc = -1; + short i; + + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + + if (items[item_index].label_loc < 0) { + items[item_index].label = label_flag; + for (i = 0; i < 100; i++) + if (labels[i].taken == FALSE) { + label_loc = i; + labels[i].taken = TRUE; + i = 100; + } + if (label_loc < 0) { + SysBeep(20); + return; + } + items[item_index].label_loc = label_loc; + } + else cd_erase_item(dlog_num,item_num + 100); + label_loc = items[item_index].label_loc; + sprintf((char *) labels[label_loc].str,"%-24s",label); + if (items[item_index].active > 0) + cd_draw_item(dlog_num,item_num); +} + +void cd_take_label(short dlog_num, short item_num){ + short dlg_index,item_index; + + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + items[item_index].label = 0; + labels[items[item_index].label_loc].taken = FALSE; +} + +void cd_key_label(short dlog_num, short item_num,short loc){ + short dlg_index,item_index; + char str[10]; + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + sprintf((char *) str," "); + str[0] = items[item_index].key; + cd_add_label(dlog_num,item_num, str, 7 + loc * 100); +} + +void cd_draw_item(short dlog_num,short item_num){ + short dlg_index,item_index,store_label; + RGBColor c[3] = {{0,0,0},{65535,0,0},{0,0,8192}}; + Rect from_rect,to_rect; + GrafPtr old_port; + //printf("In cd_draw_item(%i,%i)\n",dlog_num,item_num); + if (dlgs[dlg_index].draw_ready == FALSE) + return; + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + printf("Drawing item %i of type %i\n",item_num,items[item_index].type); + GetPort(&old_port); + SetPortWindowPort(dlgs[dlg_index].win); + TextFont(geneva_font_num); + TextFace(bold); + TextSize(10); + + if (items[item_index].active == 0) { + cd_erase_item(dlog_num,item_num); + cd_erase_item(dlog_num,item_num + 100); + } + else { + switch (items[item_index].type) { + case DLG_BUTTON_TYPE: case DLG_DEFAULT_BTN_TYPE: case 10: case 11: + 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); + RGBForeColor(&c[2]); + TextSize(12); + if (items[item_index].type < 2) + OffsetRect(&items[item_index].rect,-1 * buttons[items[item_index].flag].left_adj,0); + if (items[item_index].type < 2) { + char_win_draw_string(dlgs[dlg_index].win,items[item_index].rect, + (char *) (buttons[items[item_index].flag].str),1,8,false); + } + else { + char_win_draw_string(dlgs[dlg_index].win,items[item_index].rect, + (char *) ((item_index < 10) ? text_long_str[item_index] : + text_short_str[item_index - 10]),1,8,false); + } + if (items[item_index].type < 2) + OffsetRect(&items[item_index].rect,buttons[items[item_index].flag].left_adj,0); + TextSize(10); + ForeColor(blackColor); + break; + + case DLG_LED_BUTTON: + GetPortBounds(dlg_buttons_gworld[9][0], &from_rect); + switch (items[item_index].flag) { + case 0: + rect_draw_some_item(dlg_buttons_gworld[10][0], + from_rect, 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], + 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], + items[item_index].rect,0,2); + break; + } + break; + + case DLG_TEXT_BOLD: case DLG_TEXT_PLAIN: case DLG_TEXT_LARGE: case 8: case 9: + printf("Drawing text.\n"); + cd_erase_item(dlog_num,item_num); + TextFont(geneva_font_num); + TextFace(0); + TextFace(bold); + TextSize(10); + ForeColor(blackColor); + if (items[item_index].type == DLG_TEXT_PLAIN) + TextFace(0); + if (items[item_index].type == DLG_TEXT_LARGE) + TextSize(12); + ForeColor(blackColor); + if (items[item_index].flag % 10 == 1) + cd_frame_item(dlog_num,item_num,2); + + if (items[item_index].flag >= 10) { + RGBForeColor(&c[1]); + }printf("Testing 1...\n"); + printf("Rect is top = %i, left = %i, bottom = %i, right = %i\n",items[item_index].rect.top,items[item_index].rect.left,items[item_index].rect.bottom,items[item_index].rect.right); + if (items[item_index].rect.bottom - items[item_index].rect.top < 20) { + items[item_index].rect.left += 3; + char_win_draw_string(dlgs[dlg_index].win,items[item_index].rect, + (char *) ((item_index < 10) ? text_long_str[item_index] : + text_short_str[item_index - 10]),3,12,false); + items[item_index].rect.left -= 3; + } + else { + InsetRect(&items[item_index].rect,4,4); + char_win_draw_string(dlgs[dlg_index].win,items[item_index].rect, + (char *) ((item_index < 10) ? text_long_str[item_index] : + text_short_str[item_index - 10]),0,(items[item_index].type == 7) ? 14 : 12,false); + InsetRect(&items[item_index].rect,-4,-4); + }printf("Texting 2...\n"); + if ((items[item_index].type == 8) && (dlog_num == 989)) { + items[item_index].rect.bottom -= 12; + //undo_clip(); // This function does absolutely nothing! + } + break; + + case DLG_OLD_PICTURE: + if (items[item_index].flag == -1) + cd_erase_item(dlog_num,item_num); + else if (items[item_index].flag == 0) + draw_dialog_graphic(GetWindowPort(dlgs[dlg_index].win), items[item_index].rect, 0, + PICT_BLANK_TYPE, (items[item_index].flag >= 2000) ? FALSE : TRUE,0); + else draw_dialog_graphic(GetWindowPort(dlgs[dlg_index].win), items[item_index].rect, items[item_index].flag, + items[item_index].flag2, (items[item_index].flag >= 2000) ? FALSE : TRUE,0); + break; + default: // DLG_NEW_PICTURE + if(items[item_index].type < 20) break; + if (items[item_index].flag == -1) + cd_erase_item(dlog_num,item_num); + else draw_dialog_graphic(GetWindowPort(dlgs[dlg_index].win), items[item_index].rect, items[item_index].flag, + items[item_index].type - DLG_NEW_PICTURE, (items[item_index].flag >= 2000) ? FALSE : TRUE,0); + break; + } + }printf("Item %i drawn.\n",item_num); + + if (items[item_index].label != 0) { + store_label = items[item_index].label; + if (store_label >= 1000) { + store_label -= 1000; + } + else { + TextFace(0); + } + to_rect = items[item_index].rect; + switch (store_label / 100) { + case 0: + to_rect.right = to_rect.left; + to_rect.left -= 2 * (store_label % 100); + break; + case 1: + to_rect.bottom = to_rect.top; + to_rect.top -= 2 * (store_label % 100); + break; + case 2: + to_rect.left = to_rect.right; + to_rect.right += 2 * (store_label % 100); + break; + case 3: + to_rect.top = to_rect.bottom; + to_rect.bottom += 2 * (store_label % 100); + break; + } + + if (to_rect.bottom - to_rect.top < 14) { + to_rect.bottom += (14 - (to_rect.bottom - to_rect.top)) / 2 + 1; + to_rect.top -= (14 - (to_rect.bottom - to_rect.top)) / 2 + 1; + } + else OffsetRect(&to_rect, 0,(to_rect.bottom - to_rect.top) / 6); + if (items[item_index].active != 0) { + char_win_draw_string(dlgs[dlg_index].win,to_rect, + labels[items[item_index].label_loc].str,2,12,false); + + } + TextFace(bold); + } + + TextFont(0); + TextFace(0); + TextSize(12); + SetPort(old_port);printf("Hello World\n"); +} + +void cd_initial_draw(short dlog_num){ + short i,which_dlg = -1; + + for (i = 0; i < ND; i++) + if ((dlgs[i].key >= 0) && (dlgs[i].type == dlog_num)) + which_dlg = i; + if (which_dlg < 0) { + return; + } + dlgs[which_dlg].draw_ready = TRUE; + + cd_erase_item(dlog_num, 0); + cd_draw(dlog_num); +} + +void cd_draw(short dlog_num){ + short i,which_dlg = -1; + + for (i = 0; i < ND; i++) + if ((dlgs[i].key >= 0) && (dlgs[i].type == dlog_num)) + which_dlg = i; + if (which_dlg < 0) + return; + for (i = 0; i < dlgs[which_dlg].highest_item + 1; i++) { + cd_draw_item(dlog_num,i); + } +} + +void cd_redraw(WindowPtr window){ + short which_dlg,dlg_num,dlg_key; + + if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlg_key)) < 0) + return; + dlgs[which_dlg].draw_ready = TRUE; + cd_initial_draw(dlg_num); +} + +void cd_frame_item(short dlog_num, short item_num, short width){ + short dlg_index,item_index; + + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + frame_dlog_rect(GetWindowPort(dlgs[dlg_index].win), items[item_index].rect, width); +} + +void cd_erase_item(short dlog_num, short item_num, Boolean just_label){ + // if item_num is 0, nail whole window + // item_num + 100 just erase label + short i,dlg_index,item_index,store_label; + Rect to_fry; + GrafPtr old_port; + + if (item_num >= 100) { + item_num -= 100; + just_label = TRUE; + } + + if (item_num == 0) { + for (i = 0; i < ND; i++) + if ((dlgs[i].key >= 0) && (dlgs[i].type == dlog_num)) + dlg_index = i; + //GetWindowRect(dlgs[dlg_index],&to_fry); + GetWindowPortBounds(dlgs[dlg_index].win,&to_fry); + //OffsetRect(&to_fry,-1 * to_fry.left,-1 * to_fry.top); + } + else { + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + to_fry = items[item_index].rect; + if (just_label == TRUE) { + if (items[item_index].label != 0) { + store_label = items[item_index].label; + if (store_label >= 1000) + store_label -= 1000; + + switch (store_label / 100) { + case 0: + to_fry.right = to_fry.left; + to_fry.left -= 2 * (store_label % 100); + break; + case 1: + to_fry.bottom = to_fry.top; + to_fry.top -= 2 * (store_label % 100); + break; + case 2: + to_fry.left = to_fry.right; + to_fry.right += 2 * (store_label % 100); + break; + case 3: + to_fry.top = to_fry.bottom; + to_fry.bottom += 2 * (store_label % 100); + break; + } + if ((i = 12 - (to_fry.bottom - to_fry.top)) > 0) { + // adjust rect ... but doesn't work for bold letters + to_fry.bottom += i / 2; + to_fry.bottom++; // extra pixel to get dangly letters + to_fry.top -= i / 2; + } + } + } + InsetRect(&to_fry,-1,-1); + + } + if (dlgs[dlg_index].draw_ready == FALSE) { + return; + } + GetPort(&old_port); + SetPortWindowPort(dlgs[dlg_index].win); + FillCRect(&to_fry,bg[5]); + SetPort(old_port); +} + +void cd_erase_rect(short dlog_num,Rect to_fry){ + short i,dlg_index,item_index,store_label; + GrafPtr old_port; + + if ((dlg_index = cd_get_dlg_index(dlog_num)) < 0) + return; + if (dlgs[dlg_index].draw_ready == FALSE) + return; + + GetPort(&old_port); + SetPortWindowPort(dlgs[dlg_index].win); + FillCRect(&to_fry,bg[5]); + SetPort(old_port); +} + +void cd_press_button(short dlog_num, short item_num){ + short dlg_index,item_index; + unsigned long dummy; + Rect from_rect,to_rect,x = {0,0,55,55}; + GrafPtr old_port; + RGBColor c[2] = {{0,0,4096},{0,0,8192}}; + + if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) + return; + // no press action for redio buttons + if (items[item_index].type == 2) { + play_sound(34); + return; + } + + GetPort(&old_port); + SetPortWindowPort(dlgs[dlg_index].win); + TextFont(geneva_font_num); + TextFace(bold); + TextSize(10); + + ForeColor(blackColor); + 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); + TextFace(bold); + RGBForeColor(&c[0]); + if (items[item_index].type < 2) { + OffsetRect(&items[item_index].rect,-1 * buttons[items[item_index].flag].left_adj,0); + char_win_draw_string(dlgs[dlg_index].win,items[item_index].rect, + (char *) (buttons[items[item_index].flag].str),1,8,false); + OffsetRect(&items[item_index].rect,buttons[items[item_index].flag].left_adj,0); + } + else { + char_win_draw_string(dlgs[dlg_index].win,items[item_index].rect, + (char *) ((item_index < 10) ? text_long_str[item_index] : + text_short_str[item_index - 10]),1,8,false); + } + + if (play_sounds == TRUE) { + play_sound(37); + Delay(6,&dummy); + } + 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); + + RGBForeColor(&c[1]); + if (items[item_index].type < 2) { + OffsetRect(&items[item_index].rect,-1 * buttons[items[item_index].flag].left_adj,0); + char_win_draw_string(dlgs[dlg_index].win,items[item_index].rect, + (char *) (buttons[items[item_index].flag].str),1,8,false); + OffsetRect(&items[item_index].rect,buttons[items[item_index].flag].left_adj,0); + } + else { + char_win_draw_string(dlgs[dlg_index].win,items[item_index].rect, + (char *) ((item_index < 10) ? text_long_str[item_index] : + text_short_str[item_index - 10]),1,8,false); + } + + TextFont(0); + TextFace(0); + TextSize(12); + ForeColor(blackColor); + Delay(8,&dummy); + + SetPort(old_port); +} + +bool dialog_not_toast(){ + return dlg_not_toast; +} + +void toast_dialog(){ + dlg_not_toast = false; +} + +void untoast_dialog(){ + dlg_not_toast = true; +} + +short cd_run_dialog(){ + short item_hit; +#ifndef EXILE_BIG_GUNS + while (dialog_not_toast()) + ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); +#endif +#ifdef EXILE_BIG_GUNS + while (dialog_not_toast()) + ModalDialog(main_dialog_UPP, &item_hit); +#endif + return item_hit; +} + +void cd_register_event_filter(short dlg_id, dlg_filter_t filter){ + event_filters.push_back(dlg_filters(dlg_id,filter)); +} + +void cd_register_default_event_filter(dlg_filter_t filter){ + event_filters[0] = dlg_filters(0,filter); +} + +pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit){ + char chr,chr2; + short wind_hit,item_hit; + Point the_point; + WindowRef w; + RgnHandle rgn; + + dummy_item_hit = 0; + + switch (event->what) { + case updateEvt: + w = GetDialogWindow(hDlg); + rgn = NewRgn(); + GetWindowRegion(w,kWindowUpdateRgn,rgn); + if (EmptyRgn(rgn) == TRUE) { + DisposeRgn(rgn); + return TRUE; + } + DisposeRgn(rgn); + BeginUpdate(w); + cd_redraw(w); + EndUpdate(w); + DrawDialog(hDlg); + return FALSE; + break; + + case keyDown: + chr = event->message & charCodeMask; + chr2 = (char) ((event->message & keyCodeMask) >> 8); + switch (chr2) { + case 126: chr = 22; break; + case 124: chr = 21; break; + case 123: chr = 20; break; + case 125: chr = 23; break; + case 53: chr = 24; break; + case 36: chr = 31; break; + case 76: chr = 31; break; + } + // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc + // 25-30 ctrl 1-6 31 - return + + wind_hit = cd_process_keystroke(GetDialogWindow(hDlg),chr,&item_hit); + break; + + case mouseDown: + the_point = event->where; + GlobalToLocal(&the_point); + wind_hit = cd_process_click(GetDialogWindow(hDlg),the_point, event->modifiers,&item_hit); + break; + + default: wind_hit = -1; break; + } + bool handled = false; + for(int i = 1; i < event_filters.size(); i++){ + if(event_filters[i].id == wind_hit){ + event_filters[i].callback(item_hit); + handled = true; + } + } + if(!handled) + event_filters[0].callback(item_hit); +// switch (wind_hit) { +// case -1: break; +// case 823: give_password_filter(item_hit); break; +// case 869: pick_prefab_scen_event_filter(item_hit); break; +// case 947: pick_a_scen_event_filter(item_hit); break; +// case 958: tip_of_day_event_filter(item_hit); break; +// case 960: talk_notes_event_filter(item_hit); break; +// case 961: adventure_notes_event_filter(item_hit); break; +// case 962: journal_event_filter(item_hit); break; +// case 970: case 971: case 972: case 973: display_strings_event_filter(item_hit); break; +// case 987: display_item_event_filter(item_hit); break; +// case 988: pick_trapped_monst_event_filter(item_hit); break; +// case 989: edit_party_event_filter(item_hit); break; +// case 991: display_pc_event_filter(item_hit); break; +// case 996: display_alchemy_event_filter(item_hit); break; +// case 997: display_help_event_filter(item_hit); break; +// case 998: display_pc_item_event_filter(item_hit); break; +// case 999: display_monst_event_filter(item_hit); break; +// case 1010: spend_xp_event_filter (item_hit); break; +// case 1012: get_num_of_items_event_filter (item_hit); break; +// case 1013: pick_race_abil_event_filter (item_hit); break; +// case 1014: sign_event_filter (item_hit); break; +// case 1017: case 873: get_text_response_event_filter (item_hit); break; +// case 1018: select_pc_event_filter (item_hit); break; +// case 1019: give_pc_info_event_filter(item_hit); break; +// case 1047: alch_choice_event_filter(item_hit); break; +// case 1050: pc_graphic_event_filter(item_hit); break; +// case 1051: pc_name_event_filter(item_hit); break; +// case 1073: give_reg_info_event_filter (item_hit); break; +// case 1075: do_registration_event_filter (item_hit); break; +// case 1096: display_spells_event_filter (item_hit); break; +// case 1097: display_skills_event_filter (item_hit); break; +// case 1098: pick_spell_event_filter (item_hit); break; +// case 1099: prefs_event_filter (item_hit); break; +// default: fancy_choice_dialog_event_filter (item_hit); break; +// } + + if (wind_hit == -1) + return FALSE; + else return TRUE; +} + +short cd_create_custom_dialog(WindowPtr parent, Str255 strs[6],short pic_num,short btns[3]){ + + short i,j,free_slot = -1,free_item = -1,str_width,cur_but_right = 0; + WindowPtr dlg; + short total_len = 0; + + + short cur_item = 1; + short but_items[3] = {-1,-1,-1}; + Rect pic_rect = {8,8,44,44},cur_text_rect = {2,50,0,0}; + short win_width = 100, win_height = 100; + + store_dlog_num = 900; + //store_parent = parent; + for (i = 0; i < ND; i++) { + if ((dlgs[i].key >= 0) && (dlgs[i].type == 900)) + return -1; + } + for (i = 0; i < ND; i++) { + if (dlgs[i].key < 0) { + free_slot = i; + i = 500; + } + } + if (free_slot < 0) + return -2; + + // quick check, to make sure there's at least 1 button + if ((btns[0] < 0) && (btns[1] < 0) && (btns[2] < 0)) + btns[0] = 1; + current_key++; + dlgs[free_slot].key = current_key; + dlgs[free_slot].type = 900; + dlgs[free_slot].highest_item = 1; + dlgs[free_slot].draw_ready = FALSE; + dlgs[free_slot].win = NULL; + + // first, create dummy dlog + store_free_slot = free_slot; + dlg = GetDialogWindow(GetNewDialog (900, NULL, IN_FRONT)); + dlgs[free_slot].win = dlg; + if (dlgs[free_slot].win == NULL) { + play_sound(3); + return -3; + } + + dlgs[free_slot].parent = parent; + + //process_new_window (dlgs[free_slot]); + // instead of this, custom make items + free_item = -1; + + // first, do 1-3 buttons + for (i = 0; i < 3; i++) + if (btns[i] >= 0) {// buttons + for (j = 150; j < NI; j++) + if (items[j].dlg < 0) { + free_item = j; + j = NI + 1; + } + items[free_item].dlg = store_dlog_num; + items[free_item].type = (i == 0) ? 1 : 0; + items[free_item].number = cur_item; + //items[free_item].rect = get_item_rect(hDlg,i + 1); + + items[free_item].flag = available_dlog_buttons[btns[i]]; + items[free_item].active = 1; + items[free_item].label = 0; + items[free_item].label_loc = -1; + items[free_item].key = buttons[available_dlog_buttons[btns[i]]].def_key; + if (i == 0) + items[free_item].key = 31; + but_items[i] = free_item; // remember this to set item rect later + cur_item++; + } + // next, the upper left picture (always there) + for (j = 150; j < NI; j++) + if (items[j].dlg < 0) { + free_item = j; + j = NI + 1; + } + items[free_item].dlg = store_dlog_num; + items[free_item].type = 5; + items[free_item].number = cur_item; + items[free_item].rect = pic_rect; + + if (pic_num < 0) { + items[free_item].flag = pic_num * -1; + } + else //if (pic_num < 1000) + items[free_item].flag = pic_num; + // else items[free_item].flag = (pic_num % 1000) + 2400; + // if (pic_num >= 2000) + // items[free_item].flag += 300; + items[free_item].active = 1; + items[free_item].label = 0; + items[free_item].label_loc = -1; + items[free_item].key = 0; + cur_item++; + + // finally, 0-6 text, first do preprocessing to find out how much room we need + for (i = 0; i < 6; i++) + total_len += string_length((char *) strs[i]); + total_len = total_len * 12; + str_width = s_sqrt(total_len) + 20; + //print_nums(0,total_len,str_width); + if (str_width < 340) + str_width = 340; + cur_text_rect.right = cur_text_rect.left + str_width; + // finally, 0-6 text, then create the items + for (i = 0; i < 6; i++) + if (strlen((char *) strs[i]) > 0) {// text + for (j = 0; j < 10; j++) + if (items[j].dlg < 0) { + free_item = j; + j = NI + 1; + } + items[free_item].dlg = store_dlog_num; + items[free_item].type = 9; + items[free_item].number = cur_item; + items[free_item].rect = cur_text_rect; + items[free_item].rect.bottom = items[free_item].rect.top + + ((string_length((char *) strs[i]) + 60) / str_width) * 12 + 16; + items[free_item].rect.right += 20; + + //print_nums(i,string_length((char *) strs[i]),str_width); + cur_text_rect.top = items[free_item].rect.bottom + 8; + items[free_item].flag = 0; + items[free_item].active = 1; + items[free_item].label = 0; + items[free_item].label_loc = -1; + items[free_item].key = 0; + sprintf(text_long_str[free_item],"%s", + (char *) strs[i]); + cur_item++; + } + + dlgs[free_slot].highest_item = cur_item - 1; + + // finally, do button rects + cur_but_right = cur_text_rect.right + 30; + //cur_text_rect.top += 8; + for (i = 0; i < 3; i++) + if (btns[i] >= 0) { + items[but_items[i]].rect.right = cur_but_right; + items[but_items[i]].rect.top = cur_text_rect.top; + items[but_items[i]].rect.bottom = items[but_items[i]].rect.top + 23; + if (buttons[available_dlog_buttons[btns[i]]].type == 1) + items[but_items[i]].rect.left = items[but_items[i]].rect.right - 63; + else items[but_items[i]].rect.left = items[but_items[i]].rect.right - 110; + cur_but_right = items[but_items[i]].rect.left - 4; + if (i == 0) { + win_width = items[but_items[i]].rect.right + 6; + win_height = items[but_items[i]].rect.bottom + 6; + } + } + + //MoveWindow(dlgs[free_slot].win,(windRect.right - win_width) / 2,(windRect.bottom - win_width) / 2 + 20,FALSE); + SizeWindow(dlgs[free_slot].win,win_width,win_height,FALSE); + + ShowWindow(dlgs[free_slot].win); + SetPort(GetWindowPort(dlgs[free_slot].win)); + TextFont(geneva_font_num); + TextFace(bold); + TextSize(10); + ForeColor(blackColor); + BackColor(whiteColor); + untoast_dialog(); + + return 0; +} diff --git a/osx/misc/dlgtool.h b/osx/misc/dlgtool.h new file mode 100644 index 00000000..9744df26 --- /dev/null +++ b/osx/misc/dlgtool.h @@ -0,0 +1,163 @@ +/* + * dlogtool.h + * BoE + * + * Created by Celtic Minstrel on 15/04/09. + * + */ + +struct m_pic_index_t { + unsigned char i, x, y; +}; + +struct dlg_t { + short key; + short type; + WindowPtr win; + WindowPtr parent; + short highest_item; + bool draw_ready; +}; + +struct dlg_item_t { + short dlg; + short number; + char type; + Rect rect; + short flag; + char active; + char key; + short label; + short label_loc; + short flag2; +}; + +struct dlg_label_t { + char str[25]; + bool taken; +}; + +/*struct dlg_gw_store_t{ + GWorldPtr anim; + GWorldPtr talkfaces; + GWorldPtr items; + GWorldPtr tiny_obj; + GWorldPtr pc; + GWorldPtr dlogpics; + unsigned int num_monst_gw; + GWorldPtr* monst;//[10]; + unsigned int num_ter_gw; + GWorldPtr* terrain;//[7]; + GWorldPtr small_ter; + GWorldPtr fields; + GWorldPtr pc_stats; + GWorldPtr item_stats; + GWorldPtr text_area; + GWorldPtr storage; + GWorldPtr terrain_screen; + GWorldPtr text_bar; + GWorldPtr orig_text_bar; + GWorldPtr buttons; + GWorldPtr party_template; + GWorldPtr mixed; + GWorldPtr* custom; +};*/ + +typedef void (*dlg_filter_t)(short); +struct dlg_filters{ + dlg_filters(int n,dlg_filter_t f) : id(n), callback(f) {} + short id; + dlg_filter_t callback; +}; + +#define DLG_KEY_LEFT 20 +#define DLG_KEY_RIGHT 21 +#define DLG_KEY_UP 22 +#define DLG_KEY_DOWN 23 +#define DLG_KEY_ESC 24 +#define DLG_KEY_CTRL1 25 +#define DLG_KEY_CTRL2 26 +#define DLG_KEY_CTRL3 27 +#define DLG_KEY_CTRL4 28 +#define DLG_KEY_CTRL5 29 +#define DLG_KEY_CTRL6 30 +#define DLG_KEY_RETURN 31 + +#define DLG_BTN_SM 0 // 23x23 (PICT id 2000 / 2001) +#define DLG_BTN_REG 1 // 63x23 (PICT id 2002 / 2003) +#define DLG_BTN_LG 2 // 102x23 (PICT id 2004 / 2005) +#define DLG_BTN_HELP 3 // 16x13 (PICT id 2006 / 2007) white bubble w/ ? mark +#define DLG_BTN_LEFT 4 // 63x23 (PICT id 2008 / 2009) with left arrow +#define DLG_BTN_RIGHT 5 // 63x23 (PICT id 2010 / 2011) with right arrow +#define DLG_BTN_UP 6 // 63x23 (PICT id 2012 / 2013) with up arrow +#define DLG_BTN_DOWN 7 // 63x23 (PICT id 2014 / 2015) with down arrow +#define DLG_BTN_LED1 8 // 6x6 (PICT id 2016 / 2017) +#define DLG_BTN_LED2 9 // 14x10 (PICT id 2018 / 2019) +#define DLG_BTN_LED3 10 // 14x10 (PICT id 2020 / 2021) +#define DLG_BTN_DONE 11 // 63x23 (PICT id 2022 / 2023) says "Done" +#define DLG_BTN_TALL 12 // 63x40 (PICT id 2024 / 2025) +#define DLG_BTN_TRAIT 13 // 63x40 (PICT id 2026 / 2027) says "Race Good/Bad Traits" +#define DLG_BTN_PUSH 14 // 30x30 (PICT id 2028 / 2029) red round button + +struct btn_t { + short type; + char* str; + short left_adj; + char def_key; +}; + +#include +#include +using std::map; +using std::string; + +typedef GWorldPtr* gw; +#define INIT_PARAMS gw g1, gw g2, gw g3, gw g4, gw g5, gw g6, gw g7, gw g8, gw g9, gw g10, \ + gw g11, gw g12, gw g13, gw g14, gw g15, gw g16, gw g17, gw g18, gw g19, gw g20, gw g21 + +void cd_init_dialogs(INIT_PARAMS); +short cd_create_dialog_parent_num(short dlog_num,short parent); +short cd_create_dialog(short dlog_num,WindowPtr parent); +short cd_kill_dialog(short dlog_num,short parent_message); +short cd_process_keystroke(WindowPtr window,char char_hit,short *item); +short cd_process_click(WindowPtr window,Point the_point, short mods,short *item); +void cd_attach_key(short dlog_num,short item_num,char key); +void csp(short dlog_num, short item_num, short pict_num, short pict_type); +void cd_set_pict(short dlog_num, short item_num, short pict_num, short pict_type); +void cd_activate_item(short dlog_num, short item_num, short status); +short cd_get_active(short dlog_num, short item_num); +void cd_get_item_text(short dlog_num, short item_num, char *str); +void csit(short dlog_num, short item_num, char *str); +void cd_set_item_text(short dlog_num, short item_num, char *str); +void cd_retrieve_text_edit_str(short dlog_num, short item_num, char *str); +short cd_retrieve_text_edit_num(short dlog_num, short item_num); +void cd_set_text_edit_str(short dlog_num, short item_num, char *str); +void cd_set_text_edit_num(short dlog_num, short item_num, short num); +void cdsin(short dlog_num, short item_num, short num); +void cd_set_item_num(short dlog_num, short item_num, short num); +void cd_set_led(short dlog_num,short item_num,short state); +void cd_flip_led(short dlog_num,short item_num,short item_hit); +void cd_set_led_range(short dlog_num,short first_led,short last_led,short which_to_set); +void cd_hit_led_range(short dlog_num,short first_led,short last_led,short which_to_set); +short cd_get_led_range(short dlog_num,short first_led,short last_led); +void cd_set_flag(short dlog_num,short item_num,short flag); +short cd_get_led(short dlog_num,short item_num); +void cd_text_frame(short dlog_num,short item_num,short frame); +void cd_add_label(short dlog_num, short item_num, char *label, short label_flag); +void cd_take_label(short dlog_num, short item_num); +void cd_key_label(short dlog_num, short item_num,short loc); +void cd_draw_item(short dlog_num,short item_num); +void cd_initial_draw(short dlog_num); +void cd_draw(short dlog_num); +void cd_redraw(WindowPtr window); +void cd_frame_item(short dlog_num, short item_num, short width); +void cd_erase_item(short dlog_num, short item_num, Boolean just_label = FALSE); +void cd_erase_rect(short dlog_num,Rect to_fry); +void cd_press_button(short dlog_num, short item_num); +bool dialog_not_toast(); +void toast_dialog(); +void untoast_dialog(); +pascal Boolean cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit); +short cd_run_dialog(); +void cd_register_event_filter(short id, dlg_filter_t filter); +void cd_register_default_event_filter(dlg_filter_t filter); \ No newline at end of file diff --git a/osx/misc/graphtool.cpp b/osx/misc/graphtool.cpp new file mode 100644 index 00000000..7e958a82 --- /dev/null +++ b/osx/misc/graphtool.cpp @@ -0,0 +1,707 @@ +/* + * graphtool.cpp + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ + +#include "graphtool.h" + +//CursHandle arrow_curs[3][3], sword_curs, boot_curs, key_curs, target_curs,talk_curs,look_curs; +short arrow_curs[3][3] = { + {8, 9, 10}, + {11,12,13}, + {14,15,16}, +}; +short sword_curs = 17, boot_curs = 18, drop_curs = 19, target_curs = 20; +short talk_curs = 21, key_curs = 22, look_curs = 23, current_cursor = 0; +CursHandle cursors[24] = { + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +}; +void (*redraw_screen)(); +Point offset; + +void init_graph_tool(void (*redraw_callback)(), Point p){ + redraw_screen = redraw_callback; + int i,j; + if (cursors[0] == NULL) { + for (i = 0; i < 8; i++) + cursors[i] = GetCursor(130 + i); + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) + cursors[arrow_curs[i][j]] = GetCursor(100 + (i - 1) + 10 * (j - 1)); + cursors[sword_curs] = GetCursor(120); + cursors[boot_curs] = GetCursor(121); + cursors[drop_curs] = GetCursor(122); + cursors[target_curs] = GetCursor(124); + cursors[talk_curs] = GetCursor(126); + cursors[key_curs] = GetCursor(127); + cursors[look_curs] = GetCursor(129); + set_cursor(sword_curs); + current_cursor = sword_curs; + } + offset = p; +} + +unsigned short readUShort(unsigned char ** ptr){ + unsigned short ret = CFSwapInt16LittleToHost(*(unsigned short*)*ptr); + *ptr += 2; + return ret; +} + +unsigned int readUInt(unsigned char **ptr){ + unsigned int ret = CFSwapInt32LittleToHost(*(unsigned int*)*ptr); + *ptr += 4; + return ret; +} + +GWorldPtr load_pict(int picture_to_get) +{ + PicHandle current_pic_handle; + Rect pic_rect; + short pic_wd,pic_hgt; + GWorldPtr myGWorld; + CGrafPtr origPort; + GDHandle origDev; + QDErr check_error; + PixMapHandle offPMHandle; + char good; + printf("Loading PICT id %i...\n",picture_to_get); + current_pic_handle = GetPicture (picture_to_get); + if(ResError() != noErr){ + SysBeep(50); + exit(1); + } + QDGetPictureBounds(current_pic_handle, &pic_rect); + pic_wd = pic_rect.right - pic_rect.left; + pic_hgt = pic_rect.bottom - pic_rect.top; + //printf("%i\t%i\n",pic_wd,pic_hgt); + GetGWorld (&origPort, &origDev); + check_error = NewGWorld (&myGWorld, 0, &pic_rect, NULL, NULL, kNativeEndianPixMap); + if (check_error != noErr) { + SysBeep(50); + printf("Error %i in load_pict()\n",check_error); + ExitToShell(); + } + + SetGWorld(myGWorld, NULL); + + offPMHandle = GetGWorldPixMap (myGWorld); + good = LockPixels (offPMHandle); + if (good == FALSE) { + SysBeep(50); + } + SetRect (&pic_rect, 0, 0, pic_wd, pic_hgt); + DrawPicture (current_pic_handle, &pic_rect); + SetGWorld (origPort, origDev); + UnlockPixels (offPMHandle); + ReleaseResource ((Handle) current_pic_handle); + + return myGWorld; +} + +GWorldPtr load_bmp(unsigned char *data, long length){ + + if (length < 54) { + return NULL; // Too short for headers + } + unsigned char * cur = data + 10; + unsigned int offset = readUInt(&cur); + cur+=4; + unsigned int width = readUInt(&cur); + unsigned int height = readUInt(&cur); + cur += 2; + unsigned short bitCount = readUShort(&cur); + cur+=24; + int indexed; + unsigned int colourTable[256]; + int i; + if (bitCount == 8) { + if (length < 54 + 256 * 4) { + return NULL; + } + for (i = 0; i<256; ++i) { + unsigned char blue = *cur++; + unsigned char green = *cur++; + unsigned char red = *cur++; + cur++; + colourTable[i] = (red << 16) + (green << 8) + blue; + } + indexed = TRUE; + } + else if (bitCount == 24) { + indexed = FALSE; + } + else { + return NULL; + } + + int bmppadding = (width * bitCount / 8) % 4; + if (bmppadding != 0) { + bmppadding = 4 - bmppadding; + } + + if (length < offset + height * (bmppadding + width * bitCount / 8)) { + return NULL; + } + + cur = data + offset; + + GWorldPtr newGWorld; + Rect picRext = {0, 0, height, width}; + NewGWorld(&newGWorld,32,&picRext,NULL,NULL,kNativeEndianPixMap); + if (newGWorld == NULL) { + return NULL; + } + + PixMapHandle pixMap = GetGWorldPixMap(newGWorld); + LockPixels(pixMap); + unsigned int * picBuf = (unsigned int*) GetPixBaseAddr(pixMap); + int pixrow = ((*pixMap)->rowBytes & 0x3FFF) / 4; + + int j; + for (i = height - 1; i>= 0 ; --i) { + for (j=0; j total_width) && (i <= str_len)) + total_width = text_len[i]; + if ((mode == 0) && (total_width < dest_rect.right - dest_rect.left)) + mode = 2; + for (i = 0; i < 257; i++) + if ((i <= str_len) && (c_str[i] == '|') && (mode == 2)) + mode = 0; + + switch (mode) { + case 0: + MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); + for (i = 0;text_len[i] != text_len[i + 1], i < str_len;i++) { + if (((text_len[i] - text_len[last_line_break] > (dest_rect.right - dest_rect.left - 6)) + && (last_word_break > last_line_break)) || (c_str[i] == '|')) { + if (c_str[i] == '|') { + c_str[i] = ' '; + force_skip = TRUE; + } + sprintf((char *)str_to_draw,"%s",(char *)null_s); + strncpy ((char *) str_to_draw,(char *) c_str + last_line_break,(size_t) (last_word_break - last_line_break - 1)); + //sprintf((char *)str_to_draw2," %s",str_to_draw); + //str_to_draw2[0] = (char) strlen((char *)str_to_draw); + //DrawString(str_to_draw2); + c2pstr((char*)str_to_draw); + DrawString(str_to_draw); + on_what_line++; + MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); + last_line_break = last_word_break; + if (force_skip == TRUE) { + force_skip = FALSE; + i++; + last_line_break++; + last_word_break++; + } + } + if (c_str[i] == ' ') + last_word_break = i + 1; + if (on_what_line == LINES_IN_TEXT_WIN - 1) + i = 10000; + } + + if (i - last_line_break > 1) { + strcpy((char *)str_to_draw,(char *)null_s); + strncpy ((char *) str_to_draw,(char *) c_str + last_line_break,(size_t) (i - last_line_break)); + sprintf((char *)str_to_draw2," %s",str_to_draw); + //if (strlen((char *) str_to_draw2) > 3) { + // str_to_draw2[0] = (char) strlen((char *)str_to_draw); + // DrawString(str_to_draw2); + //} + if(strlen((char*)str_to_draw) > 2){ + c2pstr((char*)str_to_draw); + DrawString(str_to_draw); + } + } + break; + case 1: + MoveTo((dest_rect.right + dest_rect.left) / 2 - (4 * total_width) / 9 + adjust_x, + (dest_rect.bottom + dest_rect.top - line_height) / 2 + 9 + adjust_y); + DrawString(p_str); + break; + case 2: + MoveTo(dest_rect.left + 1 + adjust_x, + dest_rect.top + 1 + adjust_y + 9); + DrawString(p_str); + break; + case 3: + MoveTo(dest_rect.left + 1 + adjust_x, + dest_rect.top + 1 + adjust_y + 9 + (dest_rect.bottom - dest_rect.top) / 6); + DrawString(p_str); + break; + } + //SetClip(current_clip); + //DisposeRgn(current_clip); + SetPort(old_port); +} + +short string_length(char *str){ // Why not just use strlen? + short text_len[257]; + short total_width = 0,i,len; + Str255 p_str; + + for (i = 0; i < 257; i++) + text_len[i]= 0; + + strcpy((char *) p_str,str); + c2pstr((char*) p_str); + MeasureText(256,p_str,text_len); + len = strlen((char *)str); + + for (i = 0; i < 257; i++) + if ((text_len[i] > total_width) && (i <= len)) + total_width = text_len[i]; + return total_width; +} + +/*OSStatus flip_pict(OSType domain, OSType type, short id, void *ptr, UInt32 size, Boolean isNative, void *refcon){ + //PicHandle + PicPtr toFlip = (PicPtr) ptr; + + if(!isNative){ + printf("PICT %i Before: %i\t",id,toFlip->picFrame.bottom - toFlip->picFrame.top); + toFlip->picSize = Endian16_Swap(toFlip->picSize); + toFlip->picFrame.top = Endian16_Swap(toFlip->picFrame.top); + toFlip->picFrame.left = Endian16_Swap(toFlip->picFrame.left); + toFlip->picFrame.bottom = Endian16_Swap(toFlip->picFrame.bottom); + toFlip->picFrame.right = Endian16_Swap(toFlip->picFrame.right); + printf("After: %i\n",toFlip->picFrame.bottom - toFlip->picFrame.top); + } + + return noErr; +} +*/ +/* +void draw_terrain(){ + short q,r,x,y,i,small_i; + location which_pt,where_draw; + Rect draw_rect,clipping_rect = {8,8,332,260}; + unsigned char t_to_draw; + Rect source_rect,tiny_to,tiny_to_base = {37,29,44,36},tiny_from,from_rect,to_rect; + Rect boat_rect[4] = {{0,0,36,28}, {0,28,36,56},{0,56,36,84},{0,84,36,112}}; + + if (overall_mode >= 60) + return; + + OffsetRect(&boat_rect[0],61,0); + + if (cur_viewing_mode == 0) { + SetPort( ter_draw_gworld); + FillCRect(&terrain_rect,bg[6]); + FrameRect(&terrain_rect); + SetPortWindowPort(mainPtr); + for (q = 0; q < 9; q++) + for (r = 0; r < 9; r++) + { + where_draw.x = q; where_draw.y = r; + if (editing_town == TRUE) { + t_to_draw = t_d.terrain[cen_x + q - 4][cen_y + r - 4]; + } + else { + if (cen_x + q - 4 == -1) + t_to_draw = borders[3][cen_y + r - 4]; + else if (cen_x + q - 4 == 48) + t_to_draw = borders[1][cen_y + r - 4]; + else if (cen_y + r - 4 == -1) + t_to_draw = borders[0][cen_x + q - 4]; + else if (cen_y + r - 4 == 48) + t_to_draw = borders[2][cen_x + q - 4]; + else t_to_draw = current_terrain.terrain[cen_x + q - 4][cen_y + r - 4]; + } + draw_one_terrain_spot(q,r,t_to_draw); + which_pt.x = cen_x + q - 4; + which_pt.y =cen_y + r - 4; + + tiny_to = tiny_to_base; + OffsetRect(&tiny_to,28 * q, 36 * r); + + // draw start icon, if starting point + if ((editing_town == TRUE) && + (cur_town == scenario.which_town_start) && (scenario.where_start.x == cen_x + q - 4) + && (scenario.where_start.y == cen_y + r - 4)) { + from_rect = start_button_from; + to_rect = tiny_to; + to_rect.left -= 14; + rect_draw_some_item(editor_mixed,from_rect,ter_draw_gworld,to_rect,0,0); + OffsetRect(&tiny_to,0,-7); + } + if ((editing_town == FALSE) + && (scenario.out_sec_start.x == cur_out.x) + && (scenario.out_sec_start.y == cur_out.y) + && (scenario.out_start.x == cen_x + q - 4) + && (scenario.out_start.y == cen_y + r - 4)) { + from_rect = start_button_from; + to_rect = tiny_to; + to_rect.left -= 14; + rect_draw_some_item(editor_mixed,from_rect,ter_draw_gworld,to_rect,0,0); + OffsetRect(&tiny_to,0,-7); + } + small_i = small_icons[scenario.ter_types[t_to_draw].special]; + if ((small_i == 30) && (scenario.ter_types[t_to_draw].flag2 >= 5)) + small_i = 31; + if ((small_i == 31) && (scenario.ter_types[t_to_draw].flag2 == 10)) + small_i = 32; + tiny_from = base_small_button_from; + OffsetRect(&tiny_from,7 * (small_i % 10),7 * (small_i / 10)); + if (small_i > 0) { + rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); + OffsetRect(&tiny_to,0,-7); + } + + if (is_special(cen_x + q - 4,cen_y + r - 4) == TRUE) { + tiny_from = base_small_button_from; + OffsetRect(&tiny_from,7 * (7),7 * (0)); + rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); + OffsetRect(&tiny_to,0,-7); + } + if ((t_to_draw == 7) || (t_to_draw == 10) || (t_to_draw == 13) || (t_to_draw == 16)) { + tiny_from = base_small_button_from; + OffsetRect(&tiny_from,7 * (3),7 * (2)); + rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); + OffsetRect(&tiny_to,0,-7); + } + //if (is_s_d(cen_x + q - 4,cen_y + r - 4) == TRUE) { + // } + if (editing_town == FALSE) { + for (i = 0; i < 4; i++) + if ((cen_x + q - 4 == current_terrain.wandering_locs[i].x) && + (cen_y + r - 4 == current_terrain.wandering_locs[i].y)) { + tiny_from = base_small_button_from; + OffsetRect(&tiny_from,7 * (2),7 * (1)); + rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); + OffsetRect(&tiny_to,0,-7); + i = 4; + } + + } + + if (editing_town == TRUE) { + for (i = 0; i < 30; i++) { + if ((scenario.scen_boats[i].which_town == cur_town) && + (scenario.scen_boats[i].boat_loc.x == cen_x + q - 4) && + (scenario.scen_boats[i].boat_loc.y == cen_y + r - 4)) + Draw_Some_Item(mixed_gworld,boat_rect[0],ter_draw_gworld,where_draw,1,0); + + } + for (i = 0; i < 30; i++) { + source_rect = boat_rect[0]; + OffsetRect(&source_rect,0,74); + OffsetRect(&source_rect,56,36); + if ((scenario.scen_horses[i].which_town == cur_town) && + (scenario.scen_horses[i].horse_loc.x == cen_x + q - 4) && + (scenario.scen_horses[i].horse_loc.y == cen_y + r - 4)) + Draw_Some_Item(mixed_gworld,source_rect,ter_draw_gworld,where_draw,1,0); + + } + for (i = 0; i < 4; i++) + if ((cen_x + q - 4 == town.start_locs[i].x) && + (cen_y + r - 4 == town.start_locs[i].y)) { + tiny_from = base_small_button_from; + OffsetRect(&tiny_from,7 * (6 + i),7 * (1)); + rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); + OffsetRect(&tiny_to,0,-7); + } + for (i = 0; i < 4; i++) + if ((cen_x + q - 4 == town.wandering_locs[i].x) && + (cen_y + r - 4 == town.wandering_locs[i].y)) { + tiny_from = base_small_button_from; + OffsetRect(&tiny_from,7 * (2),7 * (1)); + rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); + OffsetRect(&tiny_to,0,-7); + i = 4; + } + if (is_web(cen_x + q - 4,cen_y + r - 4) == TRUE) { + from_rect = calc_rect(5,0); + Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); + } + if (is_crate(cen_x + q - 4,cen_y + r - 4) == TRUE) { + from_rect = calc_rect(6,0); + Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); + } + if (is_barrel(cen_x + q - 4,cen_y + r - 4) == TRUE) { + from_rect = calc_rect(7,0); + Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); + } + if (is_fire_barrier(cen_x + q - 4,cen_y + r - 4) == TRUE) { + from_rect = calc_rect(0,2); + Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); + } + if (is_quickfire(cen_x + q - 4,cen_y + r - 4) == TRUE) { + from_rect = calc_rect(7,1); + Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); + } + if (is_force_barrier(cen_x + q - 4,cen_y + r - 4) == TRUE) { + from_rect = calc_rect(2,2); + Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); + } + for (i = 0; i < 8; i++) + if (is_sfx(cen_x + q - 4,cen_y + r - 4,i)) { + from_rect = calc_rect(i,3); + Draw_Some_Item(field_gworld,from_rect,ter_draw_gworld,where_draw,1,0); + } + for (x = 0; x < 64; x++) + if ((cen_x + q - 4 == town.preset_items[x].item_loc.x) && + (cen_y + r - 4 == town.preset_items[x].item_loc.y) && (town.preset_items[x].item_code >= 0)) { + } + for (x = 0; x < 60; x++) + if ((cen_x + q - 4 == t_d.creatures[x].start_loc.x) && + (cen_y + r - 4 == t_d.creatures[x].start_loc.y) && (t_d.creatures[x].number != 0)) { + } + + } + } + if (editing_town == TRUE) { + draw_monsts(); + draw_items(); + } + + SetPort( ter_draw_gworld); + ClipRect(&clipping_rect); + + if (editing_town == TRUE) { + // draw info rects + for (i = 0; i < 16; i++) + if (t_d.room_rect[i].left > 0) { + draw_rect.left = 22 + 28 * (t_d.room_rect[i].left - cen_x + 4); + draw_rect.right = 22 + 28 * (t_d.room_rect[i].right - cen_x + 4); + draw_rect.top = 24 + 36 * (t_d.room_rect[i].top - cen_y + 4); + draw_rect.bottom = 24 + 36 * (t_d.room_rect[i].bottom - cen_y + 4); + ForeColor(redColor); + FrameRect(&draw_rect); + ForeColor(blackColor); + } + // draw border rect + draw_rect.left = 21 + 28 * (town.in_town_rect.left - cen_x + 4); + draw_rect.right = 21 + 28 * (town.in_town_rect.right - cen_x + 4); + draw_rect.top = 25 + 36 * (town.in_town_rect.top - cen_y + 4); + draw_rect.bottom = 25 + 36 * (town.in_town_rect.bottom - cen_y + 4); + ForeColor(whiteColor); + FrameRect(&draw_rect); + ForeColor(blackColor); + } + if (editing_town == FALSE) { + // draw info rects + for (i = 0; i < 8; i++) + if (current_terrain.info_rect[i].left > 0) { + draw_rect.left = 22 + 28 * (current_terrain.info_rect[i].left - cen_x + 4); + draw_rect.right = 22 + 28 * (current_terrain.info_rect[i].right - cen_x + 4); + draw_rect.top = 24 + 36 * (current_terrain.info_rect[i].top - cen_y + 4); + draw_rect.bottom = 24 + 36 * (current_terrain.info_rect[i].bottom - cen_y + 4); + ForeColor(redColor); + FrameRect(&draw_rect); + ForeColor(blackColor); + } + } + ClipRect(&terrain_rect); + SetPortWindowPort(mainPtr); + + small_any_drawn = FALSE; + //if (cur_viewing_mode == 0) + // draw_frames(); + } + + if (cur_viewing_mode == 1) { + SetPort( ter_draw_gworld); + if (small_any_drawn == FALSE) { + FillCRect(&terrain_rect,bg[6]); + FrameRect(&terrain_rect); + } + for (q = 0; q < ((editing_town == TRUE) ? max_dim[town_type] : 48); q++) + for (r = 0; r < ((editing_town == TRUE) ? max_dim[town_type] : 48); r++) { + t_to_draw = (editing_town == TRUE) ? t_d.terrain[q][r] : + current_terrain.terrain[q][r]; + if ((small_what_drawn[q][r] != t_to_draw) || (small_any_drawn == FALSE)) { + draw_one_tiny_terrain_spot(q,r,t_to_draw); + small_what_drawn[q][r] = t_to_draw; + } + } + SetPortWindowPort(mainPtr); + small_any_drawn = TRUE; + } + + //draw_cur_string(); + place_location(); + + //to_rect = world_screen; + //OffsetRect(&to_rect,TER_RECT_UL_X,TER_RECT_UL_Y); + rect_draw_some_item(ter_draw_gworld,terrain_rect,ter_draw_gworld,world_screen,0,1); +}*/ + +Rect calc_rect(short i, short j){ + Rect base_rect = {0,0,36,28}; + + OffsetRect(&base_rect,i * 28, j * 36); + return base_rect; +} + +Rect get_custom_rect (short which_rect){ + Rect store_rect = {0,0,36,28}; + + OffsetRect(&store_rect,28 * (which_rect % 10),36 * (which_rect / 10)); + return store_rect; +} \ No newline at end of file diff --git a/osx/misc/graphtool.h b/osx/misc/graphtool.h new file mode 100644 index 00000000..b1c89cdd --- /dev/null +++ b/osx/misc/graphtool.h @@ -0,0 +1,24 @@ +/* + * graphtool.h + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ +#define LINES_IN_TEXT_WIN 11 + +void init_graph_tool(void (*redraw_callback)(),Point p); +GWorldPtr load_pict(int picture_to_get); +GWorldPtr load_bmp(unsigned char *data, long length); +void set_cursor(short which_curs); +void restore_cursor(); +void rect_draw_some_item (GWorldPtr src_gworld,Rect src_rect,GWorldPtr targ_gworld,Rect targ_rect, + char masked,short main_win); +void char_win_draw_string(WindowPtr dest_window,Rect dest_rect,char *str,short mode,short line_height,bool main_win); +void char_port_draw_string(GrafPtr dest_window,Rect dest_rect,char *str,short mode,short line_height,bool main_win); +void win_draw_string(GrafPtr dest_window,Rect dest_rect,Str255 str,short mode,short line_height,bool main_win); +short string_length(char *str); +//OSStatus flip_pict(OSType domain, OSType type, short id, void *ptr, UInt32 size, Boolean isNative, void *refcon); +//void draw_terrain(); +Rect calc_rect(short i, short j); +Rect get_custom_rect (short which_rect); \ No newline at end of file diff --git a/osx/misc/mathutil.cpp b/osx/misc/mathutil.cpp new file mode 100644 index 00000000..451b7373 --- /dev/null +++ b/osx/misc/mathutil.cpp @@ -0,0 +1,58 @@ +/* + * mathutil.cpp + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ + +#include "mathutil.h" +#include + +short get_ran (short times,short min,short max){ + long int store; + short i, to_ret = 0; + + for (i = 1; i < times + 1; i++) { + store = rand(); + to_ret += min + (((store + 32767) * (max - min + 1)) / 65536); + } + return to_ret; +} + +short s_pow(short x,short y){ + return (short) pow((double) x, (double) y); +} + +short s_sqrt(short val) +{ + return (short) sqrt((double)(val)); +} + +short max(short a,short b){ + if (a > b) + return a; + else return b; +} + +short min(short a,short b){ + if (a < b) + return a; + else return b; +} + +short minmax(short min,short max,short k){ + if (k < min) + return min; + if (k > max) + return max; + return k; +} + +short move_to_zero(short val){ + if (val < 0) + return val + 1; + if (val > 0) + return val - 1; + return val; +} \ No newline at end of file diff --git a/osx/misc/mathutil.h b/osx/misc/mathutil.h new file mode 100644 index 00000000..1dc30e78 --- /dev/null +++ b/osx/misc/mathutil.h @@ -0,0 +1,15 @@ +/* + * mathutil.h + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ + +short get_ran (short times,short min,short max); +short s_pow(short x,short y); +short s_sqrt(short val); +short max(short a,short b); +short min(short a,short b); +short minmax(short min,short max,short k); +short move_to_zero(short val); \ No newline at end of file diff --git a/osx/misc/soundtool.cpp b/osx/misc/soundtool.cpp new file mode 100644 index 00000000..9dab4068 --- /dev/null +++ b/osx/misc/soundtool.cpp @@ -0,0 +1,204 @@ +/* + * soundtool.cpp + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ + +#include "soundtool.h" + +Handle sound_handles[NUM_SOUNDS]; +bool play_sounds = true; +short last_played = 10000; + +bool always_asynch[100] = { + false,false,false,false,false, + false,true,false,false,false, + false,false,false,false,false, // 10 + false,false,false,false,false, + false,false,false,false,true, // 20 + true,false,false,false,false, + false,false,false,false,true, // 30 + false,false,true,false,true, + false,true,true,true,true, // 40 + true,true,true,true,true, + true,false,false,false,false, // 50 + true,false,false,false,false, + false,true,false,false,false, // 60 + false,false,false,false,false, + false,false,false,false,false, // 70 + false,true,true,true,true, + true,true,true,true,false, // 80 + true,false,false,false,false, + false,true,false,false,false, // 90 + false,false,false,false,false +}; +bool load_when_play[100] = { + 0,0,1,1,1,1,0,1,1,1, + 0,0,0,1,0,1,1,1,1,1, + 1,1,1,1,1,1,1,0,1,1, + 1,1,1,1,0,1,1,0,1,1, + 1,1,1,1,1,1,1,0,0,0, + 0,1,1,1,1,0,1,1,1,1, + 1,0,1,1,1,1,1,1,1,0, + 0,0,0,0,0,0,1,1,1,1, + 1,1,1,1,1,0,0,0,0,0, + 1,1,1,1,1,1,1,1,1,0 +}; + +short sound_delay[100] = { + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,25,25,0,0,0,0, + 0,0,0,0,8,0,0,8,0,0, + 0,0,0,10,20,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,13,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0 +}; +//Allocate SndChannelPtr chan[4] as a global variable. +//Allocate char numchannel = 3; (This gives 4 channels, = 2 gives 3 etc... +//Allocate char channel; This is just used as a counter so each sound is played by the next +//channel in line. You can have up to 4 sounds playing at once. + +SndChannelPtr chan[4]; +char numchannel = 3; +char channel; +short snd_played[4] = {-1,-1,-1,-1}; + +void init_snd_tool(){ +} + +Boolean sound_going(short which_s) { + short i; + + for (i = 0; i < 4; i++) + if (snd_played[i] == which_s) + return TRUE; + return FALSE; +} + +pascal void snd_channel_callback(SndChannelPtr theChannel,SndCommand* theCommand) { + long theA5; + short channel = -1,i,which_sound; + +#ifndef EXILE_BIG_GUNS + theA5 = SetA5(theCommand->param2); +#endif + + for (i = 0; i < 4; i++) + if (chan[i] == theChannel) + channel = i; + which_sound = snd_played[channel]; + snd_played[channel] = -1; + //if (in_startup_mode == FALSE) + // print_num(0,snd_played[channel],channel); + if ((sound_going(which_sound) == FALSE) && (load_when_play[which_sound] == TRUE)) { + HUnlock(sound_handles[which_sound]); + //if (in_startup_mode == FALSE) + // print_num(99,snd_played[channel],channel); + } + +#ifndef EXILE_BIG_GUNS + theA5 = SetA5(theA5); +#endif +} + +void load_sounds(){ + short i,t; + SndCallBackUPP callback; + + for (i = 0; i < NUM_SOUNDS; i++) { + if (!load_when_play[i]) { + sound_handles[i] = GetResource('snd ', 20000 + i); + } + } + + callback = NewSndCallBackUPP(snd_channel_callback); + + for(t=0;t<4;t++){ // setup 4 sound channels + SndNewChannel(&chan[t], sampledSynth, initMono + initNoDrop, callback); + chan[t]->qLength = 128; + } + +} + +void play_sound(short which, short how_many_times){ // if < 0, play asynch + if (!play_sounds) return; + Handle sndhandle; + unsigned long dummy; + OSErr err; + SndCommand theCommand; + + if (abs(which) > NUM_SOUNDS) { + //char msg[50]; + /*s*/printf(/*msg,*/"Error: Sound #%i does not exist.\n",abs(which)); + //give_error(msg,"",0); + return; + } + + channel++; + + if (channel > numchannel) channel = 0; + + if (!sound_going(abs(which)) && load_when_play[abs(which)]) + sndhandle = GetResource('snd ',20000 + abs(which)); + else sndhandle = sound_handles[abs(which)]; + + if (which > 0) + if (always_asynch[which]) + which *= -1; + + if (sndhandle != NULL) + { + HLock(sndhandle); + + if (which < 0) err = SndPlay(chan[channel],(SndListHandle) sndhandle,true); // Normal SndPlay + else { + err = SndPlay(chan[channel],(SndListHandle) sndhandle,false); + } + if (err != 0) { + printf("Sound error.\n"); + //add_string_to_buf("Sound Error. Error codes:"); + //print_nums(channel,which,err); + //add_string_to_buf("Your system could not play a sound."); + //add_string_to_buf("Make sure editor isn't running."); + //add_string_to_buf("Turn off sounds if necessary."); + } + HUnlock(sndhandle); + snd_played[channel] = abs(which); + theCommand.cmd = callBackCmd; + theCommand.param1 = 0; +#ifndef EXILE_BIG_GUNS + theCommand.param2 = SetCurrentA5(); +#endif +#ifdef EXILE_BIG_GUNS + theCommand.param2 = 0; +#endif + SndDoCommand(chan[channel],&theCommand,TRUE); + } + else SysBeep(20); + if (which < 0) + Delay(sound_delay[-1 * which],&dummy); + if(how_many_times > 1) + play_sound(which, how_many_times - 1); +} + +void one_sound(short which){ + if (which == last_played) + return; + play_sound(which); + last_played = which; +} + +void clear_sound_memory(){ + last_played = 100; +} + +void flip_sound() +{ + play_sounds = (play_sounds == TRUE) ? FALSE : TRUE; +} diff --git a/osx/misc/soundtool.h b/osx/misc/soundtool.h new file mode 100644 index 00000000..077b0564 --- /dev/null +++ b/osx/misc/soundtool.h @@ -0,0 +1,16 @@ +/* + * soundtool.h + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ + +#define NUM_SOUNDS 99 + +void init_snd_tool(); +void load_sounds(); +void play_sound(short which, short how_many_times = 1); +void one_sound(short which); +void clear_sound_memory(); +void flip_sound(); \ No newline at end of file diff --git a/osx/misc/viewdlog.cpp b/osx/misc/viewdlog.cpp new file mode 100644 index 00000000..a07f98da --- /dev/null +++ b/osx/misc/viewdlog.cpp @@ -0,0 +1,9 @@ +/* + * viewdlog.cpp + * Editor + * + * Created by Seanachi Clappison Dillon on 15/04/09. + * Copyright 2009 __MyCompanyName__. All rights reserved. + * + */ + diff --git a/osx/monster.c b/osx/monster.c index d5f23c15..d7c844d7 100644 --- a/osx/monster.c +++ b/osx/monster.c @@ -8,9 +8,12 @@ #include "text.h" #include "specials.h" #include "items.h" -#include "Exile.sound.h" +#include "soundtool.h" #include "blxgraphics.h" #include "newgraph.h" +#include "dlgconsts.h" +#include "bldsexil.h" +#include "mathutil.h" extern current_town_type c_town; extern party_record_type party; @@ -246,6 +249,25 @@ short get_monst_picnum(unsigned char monst) return scenario.scen_monsters[monst].picture_num; } +short get_monst_pictype(unsigned char monst) +{ + short type = PICT_MONST_TYPE; + short n = scenario.scen_monsters[monst].picture_num; + if (n >= 1000) type += PICT_CUSTOM_TYPE; + switch(n / 1000){ + case 2: + type += PICT_WIDE_MONSTER; + break; + case 3: + type += PICT_TALL_MONSTER; + break; + case 4: + type += PICT_WIDE_MONSTER + PICT_TALL_MONSTER; + break; + } + return type; +} + void get_monst_dims(unsigned char monst,short *width, short *height) { diff --git a/osx/monster.h b/osx/monster.h index 50ece8fb..5c651ff8 100644 --- a/osx/monster.h +++ b/osx/monster.h @@ -8,6 +8,7 @@ short is_null_wand_entry(wandering_type wand_entry); short is_null_out_wand_entry(out_wandering_type wand_entry); location get_monst_head(short m_num); short get_monst_picnum(unsigned char monst); +short get_monst_pictype(unsigned char monst); void get_monst_dims(unsigned char monst,short *width, short *height); void set_up_monst(short mode,unsigned char m_num); void do_monsters(); diff --git a/osx/newgraph.c b/osx/newgraph.c index b00b7925..7003abce 100644 --- a/osx/newgraph.c +++ b/osx/newgraph.c @@ -7,14 +7,18 @@ #include "blxgraphics.h" #include "blx.g.utils.h" #include "monster.h" -#include "dlogtool.h" +#include "dlgtool.h" #include "newgraph.h" #include "blxfileio.h" #include "item_data.h" #include "loc_utils.h" #include "fields.h" #include "text.h" -#include "Exile.sound.h" +#include "soundtool.h" +#include "dlglowlevel.h" +#include "dlgconsts.h" +#include "mathutil.h" +#include "graphtool.h" short monsters_faces[190] = {0,1,2,3,4,5,6,7,8,9, 10,0,12,11,11,12,13,13,2,11, @@ -449,7 +453,7 @@ void do_missile_anim(short num_steps,location missile_origin,short sound_num) // create and clip temporary anim template GetPortBounds(terrain_screen_gworld,&temp_rect); - NewGWorld(&temp_gworld, 0 /*8*/,&temp_rect, NIL, NIL, 0); + NewGWorld(&temp_gworld, 0 /*8*/,&temp_rect, NULL, NULL, kNativeEndianPixMap); SetPort(temp_gworld); active_area_rect = temp_rect; InsetRect(&active_area_rect,13,13); @@ -638,7 +642,7 @@ void do_explosion_anim(short sound_num,short special_draw) // create and clip temporary anim template GetPortBounds(terrain_screen_gworld,&temp_rect); - NewGWorld(&temp_gworld, 0 /*8*/,&temp_rect, NIL, NIL, 0); + NewGWorld(&temp_gworld, 0 /*8*/,&temp_rect, NULL, NULL, kNativeEndianPixMap); SetPort(temp_gworld); TextFont(geneva_font_num); TextFace(bold); @@ -705,7 +709,7 @@ void do_explosion_anim(short sound_num,short special_draw) sprintf(str,"%d",store_booms[i].val_to_place); SetPort(temp_gworld); ForeColor(whiteColor); - char_port_draw_string(temp_gworld,text_rect,str,1,12); + char_port_draw_string(temp_gworld,text_rect,str,1,12,false); ForeColor(blackColor); SetPort(GetWindowPort(mainPtr)); } @@ -808,19 +812,19 @@ char *cost_strs[] = {"Extremely Cheap","Very Reasonable","Pretty Average","Somew if (draw_mode == 0) { SetPort(GetWindowPort(mainPtr)); i = faces[store_shop_type]; - draw_dialog_graphic( talk_gworld, face_rect, 1000 + i, FALSE,1); + draw_dialog_graphic( talk_gworld, face_rect, i, PICT_TALK_TYPE, FALSE,1); SetPort( talk_gworld); - } + } // Place name of store and shopper name RGBForeColor(&c[3]); dest_rect = title_rect; OffsetRect(&dest_rect,1,1); - char_port_draw_string(talk_gworld,dest_rect,store_store_name,2,18); + char_port_draw_string(talk_gworld,dest_rect,store_store_name,2,18,false); OffsetRect(&dest_rect,-1,-1); RGBForeColor(&c[4]); - char_port_draw_string( talk_gworld,dest_rect,store_store_name,2,18); + char_port_draw_string( talk_gworld,dest_rect,store_store_name,2,18,false); TextFont(geneva_font_num); TextSize(12); @@ -835,7 +839,7 @@ char *cost_strs[] = {"Extremely Cheap","Very Reasonable","Pretty Average","Somew case 4: sprintf(cur_name,"Buying Food.");break; default:sprintf(cur_name,"Shopping for %s.",adven[current_pc].name); break; } - char_port_draw_string( talk_gworld,shopper_name,cur_name,2,18); + char_port_draw_string( talk_gworld,shopper_name,cur_name,2,18,false); // Place help and done buttons ForeColor(blackColor); @@ -863,13 +867,13 @@ char *cost_strs[] = {"Extremely Cheap","Very Reasonable","Pretty Average","Somew case 0: case 1: case 2: case 3: case 4: base_item = get_stored_item(what_chosen); base_item.item_properties = base_item.item_properties | 1; - draw_dialog_graphic( talk_gworld, shopping_rects[i][2],1800 + base_item.graphic_num, FALSE,1); + draw_dialog_graphic( talk_gworld, shopping_rects[i][2],base_item.graphic_num,PICT_ITEM_TYPE, FALSE,1); strcpy(cur_name,base_item.full_name); get_item_interesting_string(base_item,cur_info_str); break; case 5: base_item = store_alchemy(what_chosen - 500); - draw_dialog_graphic( talk_gworld, shopping_rects[i][2],1853, FALSE,1);//// all graphic nums + draw_dialog_graphic( talk_gworld, shopping_rects[i][2],53,PICT_ITEM_TYPE, FALSE,1);//// all graphic nums strcpy(cur_name,base_item.full_name); sprintf(cur_info_str,""); break; @@ -881,20 +885,20 @@ char *cost_strs[] = {"Extremely Cheap","Very Reasonable","Pretty Average","Somew break; case 7: what_chosen -= 700; - draw_dialog_graphic( talk_gworld, shopping_rects[i][2],1899, FALSE,1); + draw_dialog_graphic( talk_gworld, shopping_rects[i][2],99,PICT_ITEM_TYPE, FALSE,1); strcpy(cur_name,heal_types[what_chosen]); sprintf(cur_info_str,""); break; case 8: base_item = store_mage_spells(what_chosen - 800 - 30); - draw_dialog_graphic( talk_gworld, shopping_rects[i][2],1800 + base_item.graphic_num, FALSE,1); + draw_dialog_graphic( talk_gworld, shopping_rects[i][2],base_item.graphic_num,PICT_ITEM_TYPE, FALSE,1); strcpy(cur_name,base_item.full_name); sprintf(cur_info_str,""); break; case 9: base_item = store_priest_spells(what_chosen - 900 - 30); - draw_dialog_graphic( talk_gworld, shopping_rects[i][2],1800 + base_item.graphic_num, FALSE,1); + draw_dialog_graphic( talk_gworld, shopping_rects[i][2],base_item.graphic_num,PICT_ITEM_TYPE, FALSE,1); strcpy(cur_name,base_item.full_name); sprintf(cur_info_str,""); break; @@ -903,7 +907,7 @@ char *cost_strs[] = {"Extremely Cheap","Very Reasonable","Pretty Average","Somew what_magic_shop_item = what_chosen % 1000; base_item = party.magic_store_items[what_magic_shop][what_magic_shop_item]; base_item.item_properties = base_item.item_properties | 1; - draw_dialog_graphic( talk_gworld, shopping_rects[i][2],1800 + base_item.graphic_num, FALSE,1); + draw_dialog_graphic( talk_gworld, shopping_rects[i][2],base_item.graphic_num,PICT_ITEM_TYPE, FALSE,1); strcpy(cur_name,base_item.full_name); get_item_interesting_string(base_item,cur_info_str); break; @@ -913,11 +917,11 @@ char *cost_strs[] = {"Extremely Cheap","Very Reasonable","Pretty Average","Somew // 0 - whole area, 1 - active area 2 - graphic 3 - item name // 4 - item cost 5 - item extra str 6 - item help button TextSize(12); - char_port_draw_string( talk_gworld,shopping_rects[i][3],cur_name,0,12); + char_port_draw_string( talk_gworld,shopping_rects[i][3],cur_name,0,12,false); sprintf(cur_name,"Cost: %d",cur_cost); - char_port_draw_string( talk_gworld,shopping_rects[i][4],cur_name,0,12); + char_port_draw_string( talk_gworld,shopping_rects[i][4],cur_name,0,12,false); TextSize(10); - char_port_draw_string( talk_gworld,shopping_rects[i][5],cur_info_str,0,12); + char_port_draw_string( talk_gworld,shopping_rects[i][5],cur_info_str,0,12,false); if ((store_shop_type != 3) && (store_shop_type != 4)) rect_draw_some_item(mixed_gworld,item_info_from,talk_gworld,shopping_rects[i][6],1 - draw_mode,0); @@ -927,11 +931,11 @@ char *cost_strs[] = {"Extremely Cheap","Very Reasonable","Pretty Average","Somew TextSize(12); sprintf(cur_name,"Prices here are %s.",cost_strs[store_cost_mult]); TextSize(10); - char_port_draw_string( talk_gworld,bottom_help_rects[0],cur_name,0,12); - char_port_draw_string( talk_gworld,bottom_help_rects[1],"Click on item name (or type 'a'-'h') to buy.",0,12); - char_port_draw_string( talk_gworld,bottom_help_rects[2],"Hit done button (or Esc.) to quit.",0,12); + char_port_draw_string( talk_gworld,bottom_help_rects[0],cur_name,0,12,false); + char_port_draw_string( talk_gworld,bottom_help_rects[1],"Click on item name (or type 'a'-'h') to buy.",0,12,false); + char_port_draw_string( talk_gworld,bottom_help_rects[2],"Hit done button (or Esc.) to quit.",0,12,false); if ((store_shop_type != 3) && (store_shop_type != 4)) - char_port_draw_string( talk_gworld,bottom_help_rects[3],"'I' button brings up description.",0,12); + char_port_draw_string( talk_gworld,bottom_help_rects[3],"'I' button brings up description.",0,12,false); ForeColor(blackColor); @@ -1130,24 +1134,24 @@ void place_talk_str(char *str_to_place,char *str_to_place2,short color,Rect c_re if (store_talk_face_pic >= 0) face_to_draw = store_talk_face_pic; if (store_talk_face_pic >= 1000) { - draw_dialog_graphic( talk_gworld, face_rect, 2400 + store_talk_face_pic - 1000, FALSE,1); + draw_dialog_graphic( talk_gworld, face_rect, store_talk_face_pic, PICT_CUSTOM_TYPE + PICT_TALK_TYPE, FALSE,1); } else { i = get_monst_picnum(store_monst_type); if (face_to_draw <= 0) - draw_dialog_graphic( talk_gworld, face_rect, 400 + i, FALSE,1); - else draw_dialog_graphic( talk_gworld, face_rect, 1000 + face_to_draw, FALSE,1); - } + draw_dialog_graphic(talk_gworld, face_rect, i, get_monst_pictype(store_monst_type), FALSE,1); + else draw_dialog_graphic(talk_gworld, face_rect, face_to_draw, PICT_MONST_TYPE, FALSE,1); + } SetPort( talk_gworld); } // Place name oftalkee RGBForeColor(&c[3]); dest_rect = title_rect; OffsetRect(&dest_rect,1,1); - char_port_draw_string( talk_gworld,dest_rect,title_string,2,18); + char_port_draw_string( talk_gworld,dest_rect,title_string,2,18,false); OffsetRect(&dest_rect,-1,-1); RGBForeColor(&c[4]); - char_port_draw_string( talk_gworld,dest_rect,title_string,2,18); + char_port_draw_string( talk_gworld,dest_rect,title_string,2,18,false); // Place buttons at bottom. if (color == 0) @@ -1156,7 +1160,7 @@ void place_talk_str(char *str_to_place,char *str_to_place2,short color,Rect c_re for (i = 0; i < 9; i++) if ((talk_end_forced == false) || (i == 6) || (i == 5)) { OffsetRect(&preset_words[i].word_rect,0,8); - char_port_draw_string( talk_gworld,preset_words[i].word_rect,preset_words[i].word,2,18); + char_port_draw_string( talk_gworld,preset_words[i].word_rect,preset_words[i].word,2,18,false); OffsetRect(&preset_words[i].word_rect,0,-8); } // Place bulk of what said. Save words. @@ -1171,7 +1175,7 @@ void place_talk_str(char *str_to_place,char *str_to_place2,short color,Rect c_re } strcpy((char *) str,str_to_place); strcpy((char *) p_str,str_to_place); - c2p(p_str); + c2pstr((char*)p_str); for (i = 0; i < 257; i++) text_len[i]= 0; MeasureText(256,p_str,text_len); @@ -1269,7 +1273,7 @@ void place_talk_str(char *str_to_place,char *str_to_place2,short color,Rect c_re strcpy((char *) str,str_to_place2); strcpy((char *) p_str,str_to_place2); - c2p(p_str); + c2pstr((char*)p_str); for (i = 0; i < 257; i++) text_len[i]= 0; MeasureText(256,p_str,text_len); diff --git a/osx/party.c b/osx/party.c index ce0148ec..3f743393 100644 --- a/osx/party.c +++ b/osx/party.c @@ -14,14 +14,17 @@ #include "string.h" #include "party.h" #include "monster.h" -#include "dlogtool.h" +#include "dlgtool.h" +#include "dlgconsts.h" #include "town.h" #include "combat.h" #include "loc_utils.h" #include "fields.h" #include "text.h" -#include "Exile.sound.h" +#include "soundtool.h" #include "bldsexil.h" +#include "graphtool.h" +#include "mathutil.h" short skill_cost[20] = {3,3,3,2,2,2, 1,2,2,6, 5, 1,2,4,2,1, 4,2,5,0}; @@ -127,8 +130,6 @@ extern stored_town_maps_type maps; extern stored_outdoor_maps_type o_maps; extern short current_ground,dialog_answer; extern short on_spell_menu[2][62]; -extern pascal Boolean cd_event_filter(); -extern Boolean dialog_not_toast; extern short mage_need_select[62]; extern short priest_need_select[62]; extern short pc_marked_damage[6]; @@ -490,7 +491,7 @@ void put_party_in_scen() overall_mode = MODE_TOWN; load_area_graphics(); create_clip_region(); - redraw_screen(0); + redraw_screen(); set_stat_window(0); adjust_spell_menus(); adjust_monst_menu(); @@ -1166,7 +1167,7 @@ void do_xp_draw() update_gold_skills(); } -Boolean spend_xp_event_filter (short item_hit) +void spend_xp_event_filter (short item_hit) { short mode,pc_num; Boolean talk_done = FALSE; @@ -1293,16 +1294,16 @@ Boolean spend_xp_event_filter (short item_hit) if (item_hit >= 100) { item_hit -= 100; if ((item_hit == 3) || (item_hit == 4)) { - display_strings_with_nums(10,63,0,0,"About Health",57,724,1010); - } - else if ((item_hit == 5) || (item_hit == 6)){ - display_strings_with_nums(10,64,0,0,"About Spell Points",57,724,1010); - } - else { - which_skill = (item_hit - 7) / 2; - display_skills(which_skill,1010); - } + display_strings_with_nums(10,63,0,0,"About Health",57,24,PICT_DLG_TYPE,1010); } + else if ((item_hit == 5) || (item_hit == 6)){ + display_strings_with_nums(10,64,0,0,"About Spell Points",57,24,PICT_DLG_TYPE,1010); + } + else { + which_skill = (item_hit - 7) / 2; + display_skills(which_skill,1010); + } + } else { which_skill = (item_hit - 7) / 2; @@ -1341,9 +1342,8 @@ Boolean spend_xp_event_filter (short item_hit) store_train_pc = pc_num; if (talk_done == TRUE) { - dialog_not_toast = FALSE; + toast_dialog(); } - return FALSE; } void update_gold_skills() { @@ -1380,16 +1380,9 @@ Boolean spend_xp(short pc_num, short mode, short parent) if (party.help_received[10] == 0) { cd_initial_draw(1010); give_help(10,11,1010); - } - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); cd_kill_dialog(1010,0); @@ -1430,7 +1423,7 @@ Boolean poison_weapon( short pc_num, short how_much,short safe) add_string_to_buf(" You poison your weapon. "); r1 = get_ran(1,0,100); // Nimble? - if (adven[pc_num].traits[3] == FALSE) + if (adven[pc_num].traits[TRAIT_NIMBLE]) r1 -= 6; if ((r1 > p_chance[adven[pc_num].skills[17]]) && (safe == 0)) { add_string_to_buf(" Poison put on badly. "); @@ -1888,7 +1881,7 @@ void do_priest_spell(short pc_num,short spell_num) //// // overall_mode = MODE_OUTDOORS; // center = party.p_loc; // update_explored(party.p_loc); - redraw_screen(0); + redraw_screen(); break; case 1: case 20: case 39: case 2: case 11: case 27: case 28: case 36: case 19: case 24: @@ -2207,7 +2200,7 @@ void cast_town_spell(location where) //// for (loc.x = 0; loc.x < town_size[town_type]; loc.x++) for (loc.y = 0; loc.y < town_size[town_type]; loc.y++) if ((dist(where,loc) <= 2) && (can_see(where,loc,2) < 5) && - ((a_v(loc.x - where.x) < 2) || (a_v(loc.y - where.y) < 2))) + ((abs(loc.x - where.x) < 2) || (abs(loc.y - where.y) < 2))) make_antimagic(loc.x,loc.y); break; @@ -2733,7 +2726,7 @@ void pick_spell_event_filter (short item_hit) if ((store_spell_target == 6) && (cd_get_active(1098,10 + pc_casting) == 1)) { cd_set_item_text(1098,36,choose_target); draw_spell_info(); - force_play_sound(45); + play_sound(45); // formerly force_play_sound } else if (cd_get_active(1098,10 + pc_casting) == 0) { store_spell_target = 6; @@ -2751,7 +2744,7 @@ void pick_spell_event_filter (short item_hit) if (store_situation == 0) store_last_cast_mage = pc_casting; else store_last_cast_priest = pc_casting; - dialog_not_toast = FALSE; + toast_dialog(); dialog_answer = 70; return; } @@ -2762,21 +2755,21 @@ void pick_spell_event_filter (short item_hit) store_mage = store_mage_store; store_priest = store_priest_store; store_spell_target = store_store_target ; - dialog_not_toast = FALSE; + toast_dialog(); dialog_answer = 70; return; } if ((store_situation == 0) && (mage_need_select[store_mage] == 0)) { store_last_cast_mage = pc_casting; pc_last_cast[store_situation][pc_casting] = store_mage; - dialog_not_toast = FALSE; + toast_dialog(); dialog_answer = store_mage; return; } if ((store_situation == 1) && (priest_need_select[store_priest] == 0)) { store_last_cast_priest = pc_casting; pc_last_cast[store_situation][pc_casting] = store_priest; - dialog_not_toast = FALSE; + toast_dialog(); dialog_answer = store_priest; return; } @@ -2785,7 +2778,7 @@ void pick_spell_event_filter (short item_hit) store_mage = store_mage_store; store_priest = store_priest_store; store_spell_target = store_store_target ; - dialog_not_toast = FALSE; + toast_dialog(); give_help(39,0,1098); dialog_answer = 70; return; @@ -2795,7 +2788,7 @@ void pick_spell_event_filter (short item_hit) store_last_cast_mage = pc_casting; else store_last_cast_priest = pc_casting; pc_last_cast[store_situation][pc_casting] = ((store_situation == 0) ? store_mage : store_priest); - dialog_not_toast = FALSE; + toast_dialog(); dialog_answer = item_hit; } @@ -2890,7 +2883,7 @@ short pick_spell(short pc_num,short type,short situation) // 70 - no spell OW s make_cursor_sword(); cd_create_dialog(1098,mainPtr); - cd_set_pict(1098,2,714 + type); + cd_set_pict(1098,2,14 + type,PICT_DLG_TYPE); for (i = 37; i < 75; i++) { cd_add_label(1098,i,"",55); if (i > 62) @@ -2920,16 +2913,9 @@ short pick_spell(short pc_num,short type,short situation) // 70 - no spell OW s if (party.help_received[7] == 0) { cd_initial_draw(1098); give_help(7,8,1098); - } - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); final_process_dialog(1098); @@ -3061,7 +3047,7 @@ void alch_choice_event_filter (short item_hit) item_hit = (item_hit - 9) / 2; dialog_answer = item_hit; } - dialog_not_toast = FALSE; + toast_dialog(); } @@ -3087,15 +3073,9 @@ short alch_choice(short pc_num) if (party.help_received[20] == 0) { cd_initial_draw(1047); give_help(20,21,1047); - } -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); final_process_dialog(1047); return dialog_answer; @@ -3108,9 +3088,9 @@ void pc_graphic_event_filter (short item_hit) adven[store_graphic_pc_num].which_graphic = store_pc_graphic; update_pc_graphics(); if (store_graphic_mode == 0) - dialog_not_toast = FALSE; + toast_dialog(); else { - dialog_not_toast = FALSE; + toast_dialog(); dialog_answer = TRUE; } break; @@ -3120,10 +3100,10 @@ void pc_graphic_event_filter (short item_hit) if (store_graphic_mode == 0) { if (adven[store_graphic_pc_num].main_status < 0) adven[store_graphic_pc_num].main_status = 0; - dialog_not_toast = FALSE; + toast_dialog(); } else { - dialog_not_toast = FALSE; + toast_dialog(); dialog_answer = TRUE; } break; @@ -3157,20 +3137,14 @@ Boolean pick_pc_graphic(short pc_num,short mode,short parent_num) cd_create_dialog_parent_num(1050,parent_num); for (i = 41; i < 77; i++) - csp(1050,i,800 + i - 41); + csp(1050,i, i - 41, PICT_PC_TYPE); for (i = 5; i < 41; i++) { if (store_pc_graphic + 5 == i) cd_set_led(1050,i,1); else cd_set_led(1050,i,0); - } -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + } + + item_hit = cd_run_dialog(); cd_kill_dialog(1050,0); if (munch_pc_graphic == TRUE) { @@ -3184,13 +3158,13 @@ void pc_name_event_filter (short item_hit) { Str255 get_text; - cd_retrieve_text_edit_str(1051,(char *) get_text); + cd_retrieve_text_edit_str(1051,2,(char *) get_text); if ((get_text[0] < 33) || (get_text[0] > 126)) { csit(1051,6,"Must begin with a letter."); } else { sprintf((char *) adven[store_train_pc].name,"%.18s",(char *) get_text); - dialog_not_toast = FALSE; + toast_dialog(); } } @@ -3207,15 +3181,9 @@ Boolean pick_pc_name(short pc_num,short parent_num) make_cursor_sword(); cd_create_dialog_parent_num(1051,parent_num); - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + + item_hit = cd_run_dialog(); cd_kill_dialog(1051,0); @@ -3224,7 +3192,7 @@ Boolean pick_pc_name(short pc_num,short parent_num) void pick_trapped_monst_event_filter (short item_hit) { - dialog_not_toast = FALSE; + toast_dialog(); dialog_answer = item_hit; } @@ -3249,15 +3217,9 @@ unsigned char pick_trapped_monst() get_monst = return_monster_template((unsigned char)(party.imprisoned_monst[i])); cdsin(988,4 + 3 * i,get_monst.level); } - -#ifndef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog((ModalFilterProcPtr) cd_event_filter, &item_hit); -#endif -#ifdef EXILE_BIG_GUNS - while (dialog_not_toast) - ModalDialog(main_dialog_UPP, &item_hit); -#endif + + + item_hit = cd_run_dialog(); cd_kill_dialog(988,0); if (dialog_answer == 1) diff --git a/osx/party.h b/osx/party.h index 032696a0..55d43bc2 100644 --- a/osx/party.h +++ b/osx/party.h @@ -23,7 +23,7 @@ void award_party_xp(short amt); void award_xp(short pc_num,short amt); void drain_pc(short which_pc,short how_much); void do_xp_keep(short pc_num,short mode); -Boolean spend_xp_event_filter (short item_hit); +void spend_xp_event_filter (short item_hit); void do_xp_draw(); void draw_xp_skills(); Boolean spend_xp(short pc_num, short mode, short parent); diff --git a/osx/specials.c b/osx/specials.c index 2acc6358..6705ef85 100644 --- a/osx/specials.c +++ b/osx/specials.c @@ -13,13 +13,16 @@ #include "monster.h" #include "loc_utils.h" #include "fields.h" -#include "Exile.sound.h" +#include "soundtool.h" #include "blxtown_spec.h" #include "blxgraphics.h" #include "blxfileio.h" #include "specials.h" #include "newgraph.h" #include "dialogutils.h" +#include "dlgconsts.h" +#include "mathutil.h" +#include "bldsexil.h" extern WindowPtr mainPtr; extern short overall_mode; @@ -319,7 +322,7 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho break; if (party.in_boat >= 0) return TRUE; - one_sound(17); + //one_sound(17); if (mode < 2) { for (i = 0; i < 6; i++) if (adven[i].main_status == 1) @@ -2194,7 +2197,7 @@ void affect_spec(short which_mode,special_node_type cur_node,short cur_spec_type break; } for (i = 0; i < 6; i++) - if (((pc < 0) || (pc == i)) && (get_ran(1,0,100) < spec.pic)) + if (((pc < 0) || (pc == i)) && (get_ran(1,1,100) < spec.pic)) adven[i].skills[spec.ex2a] = minmax(0, skill_max[spec.ex2a], adven[i].skills[spec.ex2a] + spec.ex1a * ((spec.ex1b != 0) ? -1: 1)); break; @@ -2469,20 +2472,30 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty break; case 171: set_terrain(l,spec.ex2a); + if(scenario.ter_types[spec.ex2a].special >= 16 && scenario.ter_types[spec.ex2a].special <=19) + belt_present = TRUE; *redraw = TRUE; draw_map(modeless_dialogs[5],10); break; case 172: - if (coord_to_ter(spec.ex1a,spec.ex1b) == spec.ex2a) + if (coord_to_ter(spec.ex1a,spec.ex1b) == spec.ex2a){ set_terrain(l,spec.ex2b); - else if (coord_to_ter(spec.ex1a,spec.ex1b) == spec.ex2b) + if(scenario.ter_types[spec.ex2a].special >= 16 && scenario.ter_types[spec.ex2a].special <=19) + belt_present = TRUE; + } + else if (coord_to_ter(spec.ex1a,spec.ex1b) == spec.ex2b){ set_terrain(l,spec.ex2a); + if(scenario.ter_types[spec.ex2a].special >= 16 && scenario.ter_types[spec.ex2a].special <=19) + belt_present = TRUE; + } *redraw = 1; draw_map(modeless_dialogs[5],10); break; case 173: ter = coord_to_ter(spec.ex1a,spec.ex1b); set_terrain(l,scenario.ter_types[ter].trans_to_what); + if(scenario.ter_types[spec.ex2a].special >= 16 && scenario.ter_types[spec.ex2a].special <=19) + belt_present = TRUE; *redraw = 1; draw_map(modeless_dialogs[5],10); break; @@ -2498,8 +2511,8 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty *a = 1; if ((which_mode == 7) || (spec.ex2a == 0)) teleport_party(spec.ex1a,spec.ex1b,1); - else teleport_party(spec.ex1a,spec.ex1b,0); - } + else teleport_party(spec.ex1a,spec.ex1b,0); + } *redraw = 1; break; case 175: @@ -2737,7 +2750,7 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty if (which_mode < 3) *a = 1; if (r1 != 6) { - party.stuff_done[304][3] = r1; + party.stuff_done[SDF_PARTY_SPLIT_PC] = r1; *next_spec = -1; start_split(spec.ex1a,spec.ex1b,spec.ex2a); } @@ -2770,8 +2783,7 @@ void townmode_spec(short which_mode,special_node_type cur_node,short cur_spec_ty } void rect_spec(short which_mode,special_node_type cur_node,short cur_spec_type, - short *next_spec,short *next_spec_type,short *a,short *b,short *redraw) -{ + short *next_spec,short *next_spec_type,short *a,short *b,short *redraw){ Boolean check_mess = TRUE; short i,j,k; special_node_type spec; @@ -2790,22 +2802,61 @@ void rect_spec(short which_mode,special_node_type cur_node,short cur_spec_type, l.x = i; l.y = j; switch (cur_node.type) { - case 200: if (get_ran(1,0,100) <= spec.sd1 ) make_fire_wall(i,j); break; - case 201: if (get_ran(1,0,100) <= spec.sd1 ) make_force_wall(i,j); break; - case 202: if (get_ran(1,0,100) <= spec.sd1 ) make_ice_wall(i,j); break; - case 203: if (get_ran(1,0,100) <= spec.sd1 ) make_blade_wall(i,j); break; - case 204: if (get_ran(1,0,100) <= spec.sd1 ) make_scloud(i,j); break; - case 205: if (get_ran(1,0,100) <= spec.sd1 ) make_sleep_cloud(i,j); break; - case 206: if (get_ran(1,0,100) <= spec.sd1 ) make_quickfire(i,j); break; - case 207: if (get_ran(1,0,100) <= spec.sd1 ) make_fire_barrier(i,j); break; - case 208: if (get_ran(1,0,100) <= spec.sd1 ) make_force_barrier(i,j); break; - case 209: if (spec.sd1 == 0) dispel_fields(i,j,1); else dispel_fields(i,j,2);break; - case 210: if (get_ran(1,0,100) <= spec.sd1 ) make_sfx(i,j,spec.sd2 + 1); break; - case 211: if (get_ran(1,0,100) <= spec.sd1 ) { - if (spec.sd2 == 0) make_web(i,j); - if (spec.sd2 == 1) make_barrel(i,j); - if (spec.sd2 == 2) make_crate(i,j); - } break; + case 200: + if (get_ran(1,1,100) <= spec.sd1 ) + make_fire_wall(i,j); + break; + case 201: + if (get_ran(1,1,100) <= spec.sd1 ) + make_force_wall(i,j); + break; + case 202: + if (get_ran(1,1,100) <= spec.sd1 ) + make_ice_wall(i,j); + break; + case 203: + if (get_ran(1,1,100) <= spec.sd1 ) + make_blade_wall(i,j); + break; + case 204: + if (get_ran(1,1,100) <= spec.sd1 ) + make_scloud(i,j); + break; + case 205: + if (get_ran(1,1,100) <= spec.sd1 ) + make_sleep_cloud(i,j); + break; + case 206: + if (get_ran(1,1,100) <= spec.sd1 ) + make_quickfire(i,j); + break; + case 207: + if (get_ran(1,1,100) <= spec.sd1 ) + make_fire_barrier(i,j); + break; + case 208: + if (get_ran(1,1,100) <= spec.sd1 ) + make_force_barrier(i,j); + break; + case 209: + if (spec.sd1 == 0) + dispel_fields(i,j,1); + else dispel_fields(i,j,2); + break; + case 210: + if (get_ran(1,1,100) <= spec.sd1 ) + make_sfx(i,j,spec.sd2 + 1); + break; + case 211: + if (get_ran(1,1,100) <= spec.sd1 ) { + if (spec.sd2 == 0) + make_web(i,j); + if (spec.sd2 == 1) + make_barrel(i,j); + if (spec.sd2 == 2) + make_crate(i,j); + } + break; case 212: for (k = 0; k < NUM_TOWN_ITEMS; k++) if ((t_i.items[k].variety > 0) && (same_point(t_i.items[k].item_loc,l) == TRUE)) { @@ -2820,37 +2871,67 @@ void rect_spec(short which_mode,special_node_type cur_node,short cur_spec_type, } break; case 214: - if (get_ran(1,0,100) <= spec.sd2) set_terrain(l,spec.sd1); + if (get_ran(1,1,100) <= spec.sd2){ + set_terrain(l,spec.sd1); + if(scenario.ter_types[spec.sd1].special >= 16 && scenario.ter_types[spec.sd1].special <=19) + belt_present = TRUE; + *redraw = TRUE; + draw_map(modeless_dialogs[5],10); + } break; case 215: - if (coord_to_ter(i,j) == spec.sd1) set_terrain(l,spec.sd2); - else if (coord_to_ter(i,j) == spec.sd2) set_terrain(l,spec.sd1); + if (coord_to_ter(i,j) == spec.sd1){ + set_terrain(l,spec.sd2); + if(scenario.ter_types[spec.sd2].special >= 16 && scenario.ter_types[spec.sd2].special <=19) + belt_present = TRUE; + *redraw = TRUE; + draw_map(modeless_dialogs[5],10); + } + else if (coord_to_ter(i,j) == spec.sd2){ + set_terrain(l,spec.sd1); + if(scenario.ter_types[spec.sd1].special >= 16 && scenario.ter_types[spec.sd1].special <=19) + belt_present = TRUE; + *redraw = TRUE; + draw_map(modeless_dialogs[5],10); + } break; case 216: ter = coord_to_ter(i,j); set_terrain(l,scenario.ter_types[ter].trans_to_what); + if(scenario.ter_types[scenario.ter_types[ter].trans_to_what].special >= 16 && scenario.ter_types[scenario.ter_types[ter].trans_to_what].special <=19) + belt_present = TRUE; + *redraw = TRUE; + draw_map(modeless_dialogs[5],10); break; case 217: ter = coord_to_ter(i,j); - if (scenario.ter_types[ter].special == 8) + if (scenario.ter_types[ter].special == 8){ set_terrain(l,scenario.ter_types[ter].flag1); + if(scenario.ter_types[scenario.ter_types[ter].trans_to_what].special >= 16 && scenario.ter_types[scenario.ter_types[ter].trans_to_what].special <=19) + belt_present = TRUE; + *redraw = TRUE; + draw_map(modeless_dialogs[5],10); + } break; case 218: ter = coord_to_ter(i,j); - if ((scenario.ter_types[ter].special == 9) || (scenario.ter_types[ter].special == 10)) + if ((scenario.ter_types[ter].special == 9) || (scenario.ter_types[ter].special == 10)){ set_terrain(l,scenario.ter_types[ter].flag1); + if(scenario.ter_types[scenario.ter_types[ter].trans_to_what].special >= 16 && scenario.ter_types[scenario.ter_types[ter].trans_to_what].special <=19) + belt_present = TRUE; + *redraw = TRUE; + draw_map(modeless_dialogs[5],10); break; - + } } } if (check_mess == TRUE) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); - } + } } void outdoor_spec(short which_mode,special_node_type cur_node,short cur_spec_type, - short *next_spec,short *next_spec_type,short *a,short *b,short *redraw) -{ + short *next_spec,short *next_spec_type,short *a,short *b,short *redraw){ Boolean check_mess = FALSE; Str255 str1 = "",str2 = ""; special_node_type spec; @@ -2950,7 +3031,7 @@ void handle_message(short which_mode,short cur_type,short mess1,short mess2,shor scenario.out_width * (party.outdoor_corner.y + party.i_w_c.y) : c_town.town_num; } display_strings((char *) str1, (char *) str2,label1,label2, label1b,label2b, - "",57,1600 + scenario.intro_pic,0); + "",57,scenario.intro_pic,PICT_SCEN_TYPE,0); } void get_strs(char *str1,char *str2,short cur_type,short which_str1,short which_str2) diff --git a/osx/startup.c b/osx/startup.c index b3dc0a29..bea7d559 100644 --- a/osx/startup.c +++ b/osx/startup.c @@ -13,7 +13,7 @@ //#include "sound.h" #include "startup.h" #include "party.h" -#include "Exile.sound.h" +#include "soundtool.h" #include using std::vector; diff --git a/osx/text.c b/osx/text.c index 14cc78e3..a392b241 100644 --- a/osx/text.c +++ b/osx/text.c @@ -9,7 +9,9 @@ #include "string.h" #include "loc_utils.h" #include "fields.h" -#include "Exile.sound.h" +#include "mathutil.h" +#include "graphtool.h" +//#include "soundtool.h" char *m_mage_sp[] = {"Spark","Minor Haste","Strength","Flame Cloud","Flame", @@ -137,14 +139,14 @@ void put_pc_screen() // Put food, gold, day sprintf((char *) to_draw, "%d", (short) party.gold); win_draw_string( pc_stats_gworld,small_erase_rects[1], - to_draw,0,10); + to_draw,0,10,false); sprintf((char *) to_draw, "%d", (short) party.food); win_draw_string( pc_stats_gworld,small_erase_rects[0], - to_draw,0,10); + to_draw,0,10,false); i = calc_day(); sprintf((char *) to_draw, "%d", i); win_draw_string( pc_stats_gworld,small_erase_rects[2], - to_draw,0,10); + to_draw,0,10,false); ForeColor(blackColor); for (i = 0; i < 6; i++) { @@ -158,7 +160,7 @@ void put_pc_screen() sprintf((char *) to_draw, "%d. %-20s ", i + 1, (char *) adven[i].name); win_draw_string( pc_stats_gworld,pc_buttons[i][0], - to_draw,0,10); + to_draw,0,10,false); TextFace(0); TextFace(bold); ForeColor(blackColor); @@ -172,13 +174,13 @@ void put_pc_screen() else ForeColor(redColor); sprintf((char *) to_draw, "%-3d ",adven[i].cur_health); win_draw_string( pc_stats_gworld,pc_buttons[i][1], - to_draw,0,10); + to_draw,0,10,false); if (adven[i].cur_sp == adven[i].max_sp) ForeColor(blueColor); else ForeColor(magentaColor); sprintf((char *) to_draw, "%-3d ",adven[i].cur_sp); win_draw_string( pc_stats_gworld,pc_buttons[i][2], - to_draw,0,10); + to_draw,0,10,false); ForeColor(blackColor); draw_pc_effects(i); break; @@ -206,7 +208,7 @@ void put_pc_screen() } if (adven[i].main_status != 1) win_draw_string( pc_stats_gworld,to_draw_rect, - to_draw,0,10); + to_draw,0,10,false); // Now put trade and info buttons //rect_draw_some_item(mixed_gworld,info_from,pc_stats_gworld,pc_buttons[i][3],1,0); @@ -296,14 +298,14 @@ void put_item_screen(short screen_num,short suppress_buttons) ForeColor(whiteColor); sprintf((char *) to_draw, "Special items:"); win_draw_string( item_stats_gworld,upper_frame_rect, - to_draw,0,10); + to_draw,0,10,false); ForeColor(blackColor); for (i = 0; i < 8; i++) { i_num = i + item_offset; if (spec_item_array[i_num] >= 0) { // 2nd condition above is quite kludgy, in case it gets here with array all 0's strcpy((char *) to_draw,data_store->scen_strs[60 + spec_item_array[i_num] * 2]); - win_draw_string( item_stats_gworld,item_buttons[i][0],to_draw,0,10); + win_draw_string( item_stats_gworld,item_buttons[i][0],to_draw,0,10,false); place_item_button(3,i,4,0); if ((scenario.special_items[spec_item_array[i_num]] % 10 == 1) @@ -322,14 +324,14 @@ void put_item_screen(short screen_num,short suppress_buttons) sprintf((char *) to_draw, "%s inventory:", (char *) adven[pc].name); win_draw_string( item_stats_gworld,upper_frame_rect, - to_draw,0,10); + to_draw,0,10,false); ForeColor(blackColor); for (i = 0; i < 8; i++) { i_num = i + item_offset; sprintf((char *) to_draw, "%d.",i_num + 1); win_draw_string( item_stats_gworld,item_buttons[i][0], - to_draw,0,10); + to_draw,0,10,false); dest_rect = item_buttons[i][0]; dest_rect.left += 36; @@ -358,7 +360,7 @@ void put_item_screen(short screen_num,short suppress_buttons) else sprintf((char *) to_draw, "%s",adven[pc].items[i_num].full_name); } dest_rect.left -= 2; - win_draw_string( item_stats_gworld,dest_rect,to_draw,0,10); + win_draw_string( item_stats_gworld,dest_rect,to_draw,0,10,false); TextFace(0); TextFace(bold); ForeColor(blackColor); @@ -484,7 +486,7 @@ void place_buy_button(short position,short pc_num,short item_num) if (val_to_place >= 10000) TextFace(0); char_port_draw_string( item_stats_gworld,item_buttons[position][5], - store_str,2,10); + store_str,2,10,false); TextFace(bold); } } @@ -541,13 +543,13 @@ void place_item_button(short which_button_to_put,short which_slot,short which_bu item_stats_gworld, to_rect, 1, 0); } } -Rect get_custom_rect (short which_rect) //// -{ - Rect store_rect = {0,0,36,28}; - - OffsetRect(&store_rect,28 * (which_rect % 10),36 * (which_rect / 10)); - return store_rect; -} +//Rect get_custom_rect (short which_rect) //// +//{ +// Rect store_rect = {0,0,36,28}; +// +// OffsetRect(&store_rect,28 * (which_rect % 10),36 * (which_rect / 10)); +// return store_rect; +//} void place_item_bottom_buttons() { Rect pc_from_rect = {0,0,36,28},but_from_rect = {85,36,101,54},to_rect; @@ -1451,69 +1453,69 @@ const BitMap * store_dest; } -void rect_draw_some_item (GWorldPtr src_gworld, Rect src_rect, GWorldPtr targ_gworld, -Rect targ_rect, char masked, short main_win) -// masked; // if 10 - make AddOver -// main_win; // if 2, drawing onto dialog -{ - PixMapHandle test1, test2; - const BitMap * store_dest; - GrafPtr cur_port; - RGBColor store_color; - - GetPort(&cur_port); - if (src_gworld == NULL) { - if (main_win == 0) { - SetPort ( targ_gworld); - PaintRect(&targ_rect); - SetPort (cur_port); - } - else PaintRect(&targ_rect); - return; - } - if (main_win == 2) { - GetBackColor(&store_color); - BackColor(whiteColor); - } - - store_dest = GetPortBitMapForCopyBits(cur_port); - - test1 = GetPortPixMap(src_gworld); - - if (main_win == 1) - OffsetRect(&targ_rect,ul.h,ul.v); - - LockPixels(test1); - if (main_win == 0) { - test2 = GetPortPixMap(targ_gworld); - LockPixels(test2); - if (masked == 1) - CopyBits ( (BitMap *) *test1 , - (BitMap *) *test2 , - &src_rect, &targ_rect, - transparent , NULL); - else CopyBits ( (BitMap *) *test1 , - (BitMap *) *test2 , - &src_rect, &targ_rect, - (masked == 10) ? addOver : 0, NULL); - UnlockPixels(test2); - } - else { - if (masked == 1) - CopyBits ( (BitMap *) *test1 , - store_dest , - &src_rect, &targ_rect, - transparent , NULL); - else CopyBits ( (BitMap *) *test1 , - store_dest , - &src_rect, &targ_rect, - (masked == 10) ? addOver : 0, NULL); - } - UnlockPixels(test1); - if (main_win == 2) - RGBBackColor(&store_color); - SetPort(cur_port); -} +//void rect_draw_some_item (GWorldPtr src_gworld, Rect src_rect, GWorldPtr targ_gworld, +//Rect targ_rect, char masked, short main_win) +//// masked; // if 10 - make AddOver +//// main_win; // if 2, drawing onto dialog +//{ +// PixMapHandle test1, test2; +// const BitMap * store_dest; +// GrafPtr cur_port; +// RGBColor store_color; +// +// GetPort(&cur_port); +// if (src_gworld == NULL) { +// if (main_win == 0) { +// SetPort ( targ_gworld); +// PaintRect(&targ_rect); +// SetPort (cur_port); +// } +// else PaintRect(&targ_rect); +// return; +// } +// if (main_win == 2) { +// GetBackColor(&store_color); +// BackColor(whiteColor); +// } +// +// store_dest = GetPortBitMapForCopyBits(cur_port); +// +// test1 = GetPortPixMap(src_gworld); +// +// if (main_win == 1) +// OffsetRect(&targ_rect,ul.h,ul.v); +// +// LockPixels(test1); +// if (main_win == 0) { +// test2 = GetPortPixMap(targ_gworld); +// LockPixels(test2); +// if (masked == 1) +// CopyBits ( (BitMap *) *test1 , +// (BitMap *) *test2 , +// &src_rect, &targ_rect, +// transparent , NULL); +// else CopyBits ( (BitMap *) *test1 , +// (BitMap *) *test2 , +// &src_rect, &targ_rect, +// (masked == 10) ? addOver : 0, NULL); +// UnlockPixels(test2); +// } +// else { +// if (masked == 1) +// CopyBits ( (BitMap *) *test1 , +// store_dest , +// &src_rect, &targ_rect, +// transparent , NULL); +// else CopyBits ( (BitMap *) *test1 , +// store_dest , +// &src_rect, &targ_rect, +// (masked == 10) ? addOver : 0, NULL); +// } +// UnlockPixels(test1); +// if (main_win == 2) +// RGBBackColor(&store_color); +// SetPort(cur_port); +//} Rect coord_to_rect(short i,short j) { @@ -1535,186 +1537,164 @@ void make_cursor_sword() HUnlock((Handle) sword_curs); } -void c2p(Str255 str) -{ - Str255 str2; - short len; - - len = strlen((char *) str); - strcpy((char *) str2,(char *) str); - str[0] = (unsigned char) len; - strncpy((char *) (str + 1), (char *) str2,len); -} - -void p2c(Str255 str) -{ - Str255 str2; - short len; - - len = (short) str[0]; - strncpy((char *) str2,(char *) (str + 1), len); - str2[len] = 0; - strcpy((char *) str,(char *) str2); -} - void get_str(Str255 str,short i, short j) { GetIndString(str, i, j); - p2c(str); + p2cstr(str); } -short string_length(char *str) -{ - short text_len[257]; - short total_width = 0,i,len; - Str255 p_str; - - for (i = 0; i < 257; i++) - text_len[i]= 0; - - strcpy((char *) p_str,str); - c2p(p_str); - MeasureText(256,p_str,text_len); - len = strlen((char *)str); - - for (i = 0; i < 257; i++) - if ((text_len[i] > total_width) && (i <= len)) - total_width = text_len[i]; - return total_width; -} +//short string_length(char *str) +//{ +// short text_len[257]; +// short total_width = 0,i,len; +// Str255 p_str; +// +// for (i = 0; i < 257; i++) +// text_len[i]= 0; +// +// strcpy((char *) p_str,str); +// c2pstr(p_str); +// MeasureText(256,p_str,text_len); +// len = strlen((char *)str); +// +// for (i = 0; i < 257; i++) +// if ((text_len[i] > total_width) && (i <= len)) +// total_width = text_len[i]; +// return total_width; +//} -void char_win_draw_string(WindowPtr dest_window,Rect dest_rect,char *str,short mode,short line_height) -{ - char_port_draw_string(GetWindowPort(dest_window), dest_rect, str, mode, line_height); -} - - -void char_port_draw_string(GrafPtr dest_window,Rect dest_rect,char *str,short mode,short line_height) -{ - Str255 store_s; - - strcpy((char *) store_s,str); - win_draw_string( dest_window, dest_rect,store_s, mode, line_height); - -} +//void char_win_draw_string(WindowPtr dest_window,Rect dest_rect,char *str,short mode,short line_height) +//{ +// char_port_draw_string(GetWindowPort(dest_window), dest_rect, str, mode, line_height); +//} +// +// +//void char_port_draw_string(GrafPtr dest_window,Rect dest_rect,char *str,short mode,short line_height) +//{ +// Str255 store_s; +// +// strcpy((char *) store_s,str); +// win_draw_string( dest_window, dest_rect,store_s, mode, line_height); +// +//} // mode: 0 - align up and left, 1 - center on one line // str is a c string, 256 characters // uses current font -void win_draw_string(GrafPtr dest_window,Rect dest_rect,Str255 str,short mode,short line_height) -{ - GrafPtr old_port; - Str255 p_str,str_to_draw,str_to_draw2,c_str; - Str255 null_s = " "; - short str_len,i; - short last_line_break = 0,last_word_break = 0,on_what_line = 0; - short text_len[257]; - short total_width = 0; - Boolean force_skip = FALSE; - RgnHandle current_clip; - short adjust_x = 0,adjust_y = 0; - - if (dest_window == GetWindowPort(mainPtr)) { - adjust_x = ul.h; adjust_y = ul.v; - } - strcpy((char *) p_str,(char *) str); - strcpy((char *) c_str,(char *) str); - c2p(p_str); - for (i = 0; i < 257; i++) - text_len[i]= 0; - MeasureText(256,p_str,text_len); - str_len = (short) strlen((char *)str); - if (str_len == 0) { - return; - } - - GetPort(&old_port); - SetPort(dest_window); - - //FrameRect(&dest_rect); - - current_clip = NewRgn(); - GetClip(current_clip); - - dest_rect.bottom += 5; - //ClipRect(&dest_rect); - dest_rect.bottom -= 5; - - - for (i = 0; i < 257; i++) - if ((text_len[i] > total_width) && (i <= str_len)) - total_width = text_len[i]; - if ((mode == 0) && (total_width < dest_rect.right - dest_rect.left)) - mode = 2; - for (i = 0; i < 257; i++) - if ((i <= str_len) && (c_str[i] == '|') && (mode == 2)) - mode = 0; - - - switch (mode) { - case 0: - MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); - for (i = 0;text_len[i] != text_len[i + 1], i < str_len;i++) { - if (((text_len[i] - text_len[last_line_break] > (dest_rect.right - dest_rect.left - 6)) - && (last_word_break > last_line_break)) || (c_str[i] == '|')) { - if (c_str[i] == '|') { - c_str[i] = ' '; - force_skip = TRUE; - last_word_break = i + 1; - } - sprintf((char *)str_to_draw,"%s",(char *)null_s); - strncpy ((char *) str_to_draw,(char *) c_str + last_line_break,(size_t) (last_word_break - last_line_break - 1)); - sprintf((char *)str_to_draw2," %s",str_to_draw); - str_to_draw2[0] = (char) strlen((char *)str_to_draw); - DrawString(str_to_draw2); - on_what_line++; - MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); - last_line_break = last_word_break; - if (force_skip == TRUE) { - force_skip = FALSE; - i++; - //last_line_break++; - //last_word_break++; - } - } - if (c_str[i] == ' ') - last_word_break = i + 1; - if (on_what_line == LINES_IN_TEXT_WIN - 1) - i = 10000; - } - - if (i - last_line_break > 1) { - strcpy((char *)str_to_draw,(char *)null_s); - strncpy ((char *) str_to_draw,(char *) c_str + last_line_break,(size_t) (i - last_line_break)); - sprintf((char *)str_to_draw2," %s",str_to_draw); - if (strlen((char *) str_to_draw2) > 3) { - str_to_draw2[0] = (char) strlen((char *)str_to_draw); - DrawString(str_to_draw2); - } - } - break; - case 1: - MoveTo((dest_rect.right + dest_rect.left) / 2 - (4 * total_width) / 9 + adjust_x, - (dest_rect.bottom + dest_rect.top - line_height) / 2 + 9 + adjust_y); - DrawText(p_str,1,p_str[0]); - //DrawString(p_str); - break; - case 2: - MoveTo(dest_rect.left + 1 + adjust_x, - dest_rect.top + 1 + adjust_y + 9); - DrawString(p_str); - break; - case 3: - MoveTo(dest_rect.left + 1 + adjust_x, - dest_rect.top + 1 + adjust_y + 9 + (dest_rect.bottom - dest_rect.top) / 6); - DrawString(p_str); - break; - } - SetClip(current_clip); - DisposeRgn(current_clip); - SetPort(old_port); -} +//void win_draw_string(GrafPtr dest_window,Rect dest_rect,Str255 str,short mode,short line_height) +//{ +// GrafPtr old_port; +// Str255 p_str,str_to_draw,str_to_draw2,c_str; +// Str255 null_s = " "; +// short str_len,i; +// short last_line_break = 0,last_word_break = 0,on_what_line = 0; +// short text_len[257]; +// short total_width = 0; +// Boolean force_skip = FALSE; +// RgnHandle current_clip; +// short adjust_x = 0,adjust_y = 0; +// +// if (dest_window == GetWindowPort(mainPtr)) { +// adjust_x = ul.h; adjust_y = ul.v; +// } +// strcpy((char *) p_str,(char *) str); +// strcpy((char *) c_str,(char *) str); +// c2pstr(p_str); +// for (i = 0; i < 257; i++) +// text_len[i]= 0; +// MeasureText(256,p_str,text_len); +// str_len = (short) strlen((char *)str); +// if (str_len == 0) { +// return; +// } +// +// GetPort(&old_port); +// SetPort(dest_window); +// +// //FrameRect(&dest_rect); +// +// current_clip = NewRgn(); +// GetClip(current_clip); +// +// dest_rect.bottom += 5; +// //ClipRect(&dest_rect); +// dest_rect.bottom -= 5; +// +// +// for (i = 0; i < 257; i++) +// if ((text_len[i] > total_width) && (i <= str_len)) +// total_width = text_len[i]; +// if ((mode == 0) && (total_width < dest_rect.right - dest_rect.left)) +// mode = 2; +// for (i = 0; i < 257; i++) +// if ((i <= str_len) && (c_str[i] == '|') && (mode == 2)) +// mode = 0; +// +// +// switch (mode) { +// case 0: +// MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); +// for (i = 0;text_len[i] != text_len[i + 1], i < str_len;i++) { +// if (((text_len[i] - text_len[last_line_break] > (dest_rect.right - dest_rect.left - 6)) +// && (last_word_break > last_line_break)) || (c_str[i] == '|')) { +// if (c_str[i] == '|') { +// c_str[i] = ' '; +// force_skip = TRUE; +// last_word_break = i + 1; +// } +// sprintf((char *)str_to_draw,"%s",(char *)null_s); +// strncpy ((char *) str_to_draw,(char *) c_str + last_line_break,(size_t) (last_word_break - last_line_break - 1)); +// sprintf((char *)str_to_draw2," %s",str_to_draw); +// str_to_draw2[0] = (char) strlen((char *)str_to_draw); +// DrawString(str_to_draw2); +// on_what_line++; +// MoveTo(dest_rect.left + 1 + adjust_x, dest_rect.top + 1 + line_height * on_what_line + adjust_y + 9); +// last_line_break = last_word_break; +// if (force_skip == TRUE) { +// force_skip = FALSE; +// i++; +// //last_line_break++; +// //last_word_break++; +// } +// } +// if (c_str[i] == ' ') +// last_word_break = i + 1; +// if (on_what_line == LINES_IN_TEXT_WIN - 1) +// i = 10000; +// } +// +// if (i - last_line_break > 1) { +// strcpy((char *)str_to_draw,(char *)null_s); +// strncpy ((char *) str_to_draw,(char *) c_str + last_line_break,(size_t) (i - last_line_break)); +// sprintf((char *)str_to_draw2," %s",str_to_draw); +// if (strlen((char *) str_to_draw2) > 3) { +// str_to_draw2[0] = (char) strlen((char *)str_to_draw); +// DrawString(str_to_draw2); +// } +// } +// break; +// case 1: +// MoveTo((dest_rect.right + dest_rect.left) / 2 - (4 * total_width) / 9 + adjust_x, +// (dest_rect.bottom + dest_rect.top - line_height) / 2 + 9 + adjust_y); +// DrawText(p_str,1,p_str[0]); +// //DrawString(p_str); +// break; +// case 2: +// MoveTo(dest_rect.left + 1 + adjust_x, +// dest_rect.top + 1 + adjust_y + 9); +// DrawString(p_str); +// break; +// case 3: +// MoveTo(dest_rect.left + 1 + adjust_x, +// dest_rect.top + 1 + adjust_y + 9 + (dest_rect.bottom - dest_rect.top) / 6); +// DrawString(p_str); +// break; +// } +// SetClip(current_clip); +// DisposeRgn(current_clip); +// SetPort(old_port); +//} short calc_day() { diff --git a/osx/text.h b/osx/text.h index b6842aab..ea789ffb 100644 --- a/osx/text.h +++ b/osx/text.h @@ -40,19 +40,14 @@ void through_sending(); void Display_String(Str255 str); Rect coord_to_rect(short i,short j); void make_cursor_sword() ; -void c2p(Str255 str) ; -void p2c(Str255 str); void get_str(Str255 str,short i, short j); void drawstring(char * str); short string_length(char *str); -void char_win_draw_string(WindowPtr dest_window,Rect dest_rect,char *str,short mode,short line_height); -void char_port_draw_string(GrafPtr dest_window,Rect dest_rect,char *str,short mode,short line_height); -void win_draw_string(GrafPtr dest_window,Rect dest_rect,Str255 str,short mode,short line_height); short calc_day(); Boolean day_reached(unsigned char which_day, unsigned char which_event); void display_string(char *str); 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); +//void rect_draw_some_item (GWorldPtr src_gworld, Rect src_rect, GWorldPtr targ_gworld, Rect targ_rect, char masked, short main_win); Boolean is_ident(item_record_type item); Boolean is_magic(item_record_type item); Boolean is_contained(item_record_type item); diff --git a/osx/town.c b/osx/town.c index 7312e5c9..c3d959d4 100644 --- a/osx/town.c +++ b/osx/town.c @@ -14,12 +14,17 @@ #include "combat.h" #include "party.h" #include "text.h" -#include "Exile.sound.h" +#include "soundtool.h" #include "fields.h" #include "loc_utils.h" -#include "dlogtool.h" +#include "dlgtool.h" #include "specials.h" #include "info.dialogs.h" +#include "dlglowlevel.h" +#include "dlgconsts.h" +#include "mathutil.h" +#include "bldsexil.h" +#include "graphtool.h" extern current_town_type c_town; extern party_record_type party; @@ -34,7 +39,6 @@ extern outdoor_record_type outdoors[2][2]; extern unsigned char misc_i[64][64]; extern short store_current_pc,current_ground; extern pascal Boolean cd_event_filter(); -extern Boolean dialog_not_toast; extern short dungeon_font_num,geneva_font_num; extern short store_pre_shop_mode,store_pre_talk_mode; extern location monster_targs[T_M]; @@ -65,7 +69,7 @@ extern scenario_data_type scenario; extern piles_of_stuff_dumping_type *data_store; extern GWorldPtr spec_scen_g; Boolean need_map_full_refresh = TRUE,forcing_map_button_redraw = FALSE; -GWorldPtr map_gworld,tiny_map_graphics = NULL; +extern GWorldPtr map_gworld,tiny_map_graphics; RGBColor parchment = {65535,65535,52428}; PixPatHandle map_pat[25]; PixPatHandle bg[14]; @@ -293,8 +297,8 @@ void start_town_mode(short which_town, short entry_dir) } } - if (monsters_loaded == FALSE) { - for (i = 0; i < T_M; i++) + if (!monsters_loaded) { + for (i = 0; i < T_M; i++){ if (t_d.creatures[i].number == 0) { c_town.monst.dudes[i].active = 0; c_town.monst.dudes[i].number = 0; @@ -320,13 +324,13 @@ void start_town_mode(short which_town, short entry_dir) // Now, if necessary, fry the monster. switch (c_town.monst.dudes[i].monst_start.time_flag) { case 1: - if (day_reached(c_town.monst.dudes[i].monst_start.monster_time, - c_town.monst.dudes[i].monst_start.time_code) == FALSE) + if (!day_reached(c_town.monst.dudes[i].monst_start.monster_time, + c_town.monst.dudes[i].monst_start.time_code)) c_town.monst.dudes[i].active = 0; break; case 2: if (day_reached(c_town.monst.dudes[i].monst_start.monster_time, - c_town.monst.dudes[i].monst_start.time_code) == TRUE) + c_town.monst.dudes[i].monst_start.time_code)) c_town.monst.dudes[i].active = 0; break; case 3: @@ -349,15 +353,15 @@ void start_town_mode(short which_town, short entry_dir) break; case 8: - if (calc_day() > party.key_times[c_town.monst.dudes[i].monst_start.time_code]) + if (calc_day() >= party.key_times[c_town.monst.dudes[i].monst_start.time_code]) c_town.monst.dudes[i].active = 0; break; case 9: if (c_town.town.town_chop_time > 0) - if (day_reached(c_town.town.town_chop_time,c_town.town.town_chop_key) == TRUE) { + if (day_reached(c_town.town.town_chop_time,c_town.town.town_chop_key)) { c_town.monst.dudes[i].active += 10; break; - } + } c_town.monst.dudes[i].active = 0; break; case 0: @@ -368,6 +372,7 @@ void start_town_mode(short which_town, short entry_dir) break; } } + } } // Now munch all large monsters that are misplaced @@ -425,8 +430,6 @@ void start_town_mode(short which_town, short entry_dir) loc.x = j; loc.y = k; if (is_door(loc) == TRUE) misc_i[j][k] = misc_i[j][k] & 3; - - // Set up field booleans if (is_web(j,k) == TRUE) web = TRUE; if (is_crate(j,k) == TRUE) @@ -565,7 +568,7 @@ void start_town_mode(short which_town, short entry_dir) } // Place correct graphics - redraw_screen(0); + redraw_screen(); clear_map(); @@ -698,7 +701,7 @@ location end_town_mode(short switching_level,location destination) // returns n update_explored(to_return); - redraw_screen(0); + redraw_screen(); } @@ -1130,7 +1133,7 @@ void pick_lock(location where,short pc_num) - 5 * adven[pc_num].skills[15] - adven[pc_num].items[which_item].ability_strength * 7; // Nimble? - if (adven[pc_num].traits[3] == FALSE) + if (adven[pc_num].traits[TRAIT_NIMBLE]) r1 -= 8; if (pc_has_abil_equip(pc_num,42) < 24) @@ -1470,7 +1473,7 @@ pascal void draw_map (DialogPtr the_dialog, short the_item) SetPort(GetDialogPort(the_dialog)); FillCRect(&map_bar_rect,bg[4]); char_port_draw_string( GetDialogPort(modeless_dialogs[5]), - map_bar_rect,"No map here.",0,12); + map_bar_rect,"No map here.",0,12,false); draw_pcs = FALSE; SetPort( map_gworld); } @@ -1610,10 +1613,10 @@ pascal void draw_map (DialogPtr the_dialog, short the_item) GetPortBounds(GetDialogPort(the_dialog),&the_rect); FillCRect(&the_rect,bg[4]); draw_dialog_graphic( GetDialogPort(the_dialog), dlogpicrect, - 721, FALSE,0); + 21, PICT_DLG_TYPE, FALSE,0); ForeColor(whiteColor); char_port_draw_string( GetDialogPort(modeless_dialogs[5]), - map_title_rect,"Your map: (Hit Escape to close.)",0,12); + map_title_rect,"Your map: (Hit Escape to close.)",0,12,false); ForeColor(blackColor); /*SetPort( the_dialog);