#include "ssgwin32.exe.h" MODULE_DATA MODULE_DATA_0044802c; pointer[5] key_xxxxx_array; undefined4 __TLS_index; undefined4 __TLS_index4; HANDLE __hInstance; dword[2] saveStackTop; dword saveStackBase; undefined4 __DestructorCountPtr; undefined DAT_0044bbd4; undefined __exceptStaticBuffP; dword __CPPexceptionList; undefined __DebuggerHookData; dword __debuggerWatchingP; dword __debuggerHookDataP; undefined4 key_xxxxx_top_handler; short DAT_00448074; pointer ptr_on_key_down; undefined key_xxxxx_handler; undefined2 key_xxxxx_idx; ushort DAT_0044807e; short DAT_00448080; ne_rsrc_state[16] ne_rsrc_states; undefined4 main_hwnd; string s_Shell_TrayWnd_004480b4; undefined4 dwPlatformId; string s_TLCSSG_00448092; string s_Gizmos_&_Gadgets!_CD_00448099; undefined MainWndProc; tagRECT desktop_rect; undefined4 instance; dword DWORD_0044ceb0; dword mouse_xbase; dword mouse_ybase; dword mouse_ymovebase; word WORD_0044cec4; undefined destroy_window; short is_active; pointer ptr_paint_func; pointer ptr_on_mouse_down; pointer ptr_on_mouse_up; pointer ptr_on_activate; pointer ptr_on_deactivate; pointer ptr_wm_char_filter; pointer ptr_wm_initmenu; pointer ptr_wm_menuselect; pointer ptr_on_sysmenu_about; pointer ptr_on_wmcommand; dword mouse_x; undefined2 got_wm_destroy; pointer ptr_on_close; dword mouse_y; undefined2 mouse_is_down; dword entered_char; undefined2 need_reset_gfx_base_pos; short down_key; undefined2 repost_mouse_downup; pointer ptr_on_pump_messages_448120; pointer ptr_on_pump_messages_448124; short DAT_0044808c; undefined DAT_00448088; undefined4 num_sys_cursors; cursor_info[10] sys_cursors; pointer ptr_gfxish_save_rect; pointer ptr_gfxish_copy_block; pointer ptr_gfxish_line_h; pointer ptr_gfxish_line_v; pointer ptr_gfxish_set_px; pointer ptr_gfxish_edi_calc_y; pointer ptr_gfxish_decode_xxx; pointer ptr_gfxish_fill_rect; pointer ptr_gfxish_draw_sprite_normal; pointer ptr_gfxish_draw_sprite_flipped; pointer ptr_gfxish_copy_dest_to_otherbuf; pointer ptr_gfxish_copy_otherbuf_to_dest; pointer ptr_gfxish_copy_between_bufs; undefined LAB_0040256f; undefined LAB_004025c1; undefined LAB_00402606; undefined LAB_00402654; undefined LAB_00402698; undefined mul_by_512_edi; undefined LAB_004026db; undefined mul_by_512_esi; undefined calc_383_minus_arg_all_times_512_edi; undefined LAB_0040274c; undefined LAB_004027af; undefined LAB_0040280e; undefined calc_383_minus_arg_all_times_512_esi; undefined LAB_00402984; undefined LAB_00402b11; undefined LAB_00402c8a; undefined LAB_00402e4c; undefined LAB_00402ea4; undefined LAB_00402efa; pointer ptr_gfxish_esi_calc_y; short gfxish_stride; TerminatedCString s_AO_Runtime_Error_:_%d_00448152; linked_list_head *anim_engine_avail_drawn_images; linked_list_head *anim_engine_drawn_images_list; anim_engine_drawn_image[100] anim_engine_drawn_image_ARRAY_0044cf2c; gfx_rect drawn_images_specific_rect; word draw_sprite_rect_xstart; word draw_sprite_rect_xend; word draw_sprite_rect_ystart; word draw_sprite_rect_yend; short DAT_00448140; anim_engine_cb[10] anim_engine_cb_ARRAY_0044dd54; gfx_rect gfx_rect_0044ddfe; linked_list_head *aseq_file_list; linked_list_head *anim_state_xxx_list; linked_list_head *anim_state_xxx_list_list; linked_list_head *anim_engine_before_cbs; linked_list_head *anim_engine_after_cbs; undefined2 anim_time_secs_mul; dword aseq; undefined2 resource_already_loaded; undefined2 aseq_something_idx; undefined anim_state_xxx_list_sort; dword anim_t; pointer anim_engine_global_cb; undefined anim_engine_drawn_images_compare; pointer anim_engine_custom_command_handler; item_package[60] item_package_ARRAY_0044de58; undefined *PTR_ints_0044ae18; area_parts_hdr *loaded_area_parts; save_file_main *save_file_big; undefined2 loaded_screen_idx; undefined2 area_num_screens; undefined2 bgm_midi_idx; word[15] area_idx_array; dword area; area_screen *[16] loaded_area_screens; undefined2 num_initial_bananas_on_map; undefined2 num_bananas_on_map; undefined4 area_related_ints; undefined4 loaded_area; undefined2 cur_screen_is_loaded; area_screen loaded_screen; part_chunk *loaded_parts; undefined2 race_lost; dword[4] DWORD_ARRAY_0044837c; dword[4] DWORD_ARRAY_0044838c; dword[4] DWORD_ARRAY_0044839c; dword[4] DWORD_ARRAY_004483ac; dword[15] race_02_base_max_speed; dword[4] DWORD_ARRAY_004483bc; dword[4] DWORD_ARRAY_004483cc; dword[4] DWORD_ARRAY_004483dc; dword[4] DWORD_ARRAY_004483ec; dword[4] DWORD_ARRAY_004483fc; dword[4] DWORD_ARRAY_0044840c; dword[4] DWORD_ARRAY_0044841c; dword[4] DWORD_ARRAY_0044842c; dword[4] DWORD_ARRAY_0044843c; dword[4] DWORD_ARRAY_0044844c; word[15] area_02_race_player_race_rsrc; undefined2 area_02_race_state; undefined2 DAT_004520e4; word[15] area_02_race_opponent_race_rsrc; race_02_struct[2] area_02_race_data; short[15] race_02_extra_laps; short *area_02_race_ints; undefined4 opponent_parts; short[15] filtered_parts_array; dword race; undefined2 status_bar_flags; short[3] area_02_race_bgm_idx; word[15] area_02_race_bg_aseq; word[15] area_02_race_player_aseq_base; word[15] area_02_race_opponent_aseq; short DAT_00449c66; uint DAT_0044e8a8; xxxfunc_funcset xxxfunc_funcset_00448a28; xxxfunc_funcset xxxfunc_funcset_00448a34; undefined2 DAT_004484b8; aseq_anim_state_struct *[3] status_bar_digits_and_stuff_aseqs; short DAT_0044b95e; gfx_rect *gfx_163_68_rect; aseq_anim_state_struct *[6] status_bar_aseqs; short DAT_004484ba; short *ints_200; undefined4 status_bar_text; undefined2 status_bar_held_part_idx_in_part_file; undefined2 DAT_004484ba; undefined2 DAT_0044e970; undefined2 DAT_0044e972; actor_struct[12] actors; part_chunk *status_bar_first_part; part_chunk *status_bar_last_part; undefined2 DAT_0044e974; undefined4 DAT_0044e978; aseq_anim_state_struct *DAT_0044e97c; undefined2 DAT_004484b4; short DAT_004484b4; short DAT_004520e4; undefined4 *DAT_0044e978; undefined4 *DAT_0044e97c; undefined FUN_00434ec0; int *DAT_0044e980; undefined2 mouse_region_hit_dx; undefined2 mouse_region_hit_dy; undefined2 mouse_region_hit_x; undefined2 mouse_region_hit_y; pointer mouse_downup_global_handler; linked_list_head *mouse_region_list_down; linked_list_head *mouse_region_list_up; undefined2 mouse_region_new_idx; undefined mouse_down_handler; undefined mouse_up_handler; undefined2 mouse_region_is_set_up; undefined2 mouse_region_stash_idx; pointer[7] mouse_region_stash; undefined4 mouse_region_default_sort_key; undefined mouse_region_sort_func; actor_N_process_struct1 *[43] chimp_rand_behavior_table; actor_N_process_struct2 *[43] chimp_actions_table; short[16] chimps_on_screen; short *eseq_4504_6_w_tables; short *eseq_4504_6_h_tables; short *eseq_4505_7_w_tables; short *eseq_4505_7_h_tables; pointer eseq_4504_6; pointer eseq_4505_7; undefined4 actors_N_parts_list; undefined actors_N_process_cb; undefined chimp_after_transition_screens; undefined chimp_prepare_transition_screens; undefined chimp_action_10_pick_up_item; eseq_chunk *[43] eseq_4504_6_a; eseq_chunk *[129] eseq_4505_7_a; short *[15] chimp_placement_data_per_area; short DAT_0044ff2c; byte *DAT_0044eca4; byte *DAT_0044eca8; string s_1st_-_00448a6a; string s_2nd_-_00448a70; short DAT_0044eca0; short DAT_0044ec9e; save_file_main *DAT_0044eca4; undefined *PTR_s_Morty_00448a24; save_file_main *DAT_0044eca8; undefined2 DAT_00448080; undefined4 *DAT_0044ecb4; undefined4 *DAT_0044ecb8; undefined4 *DAT_0044ecac; undefined4 *DAT_0044ecb0; uint DAT_0044ecbc; undefined4 DAT_0044ecc4; undefined DAT_0044ecc0; undefined2 DAT_0044ecd4; dword ints; short *ints_4100; undefined2 zzz_ddlt_state; undefined FUN_00408c40; int *DAT_0044ecac; int *DAT_0044ecb0; int *DAT_0044ecb4; int *DAT_0044ecb8; int DAT_0044ecc4; ushort DAT_0044ecc8; undefined4 DAT_0044ecb0; undefined4 DAT_0044ecac; short DAT_0044ec9c; xxxfunc_funcset xxxfunc_funcset_00448a40; xxxfunc_funcset beat_game_cutscene; undefined2 DAT_00449c66; xxxfunc_funcset switch_to_correct_race_funcset; xxxfunc_funcset enter_building_funcset; xxxfunc_funcset into_warehouse_modeswitch_funcset; xxxfunc_funcset save_loaded_parking_lot_funcs; short DAT_0044ecd4; dword ddlt; undefined2 DAT_0044ecea; undefined2 zzz_ddlt_int_idx; undefined2 zzz_ddlt_go_state_5; short *zzz_ints_4103_4; short *zzz_ddlt; undefined4 zzz_ddlt_2; undefined4 zzz_ddlt_state_2_time; short DAT_0044ecea; undefined2 beat_game_voice_idx; xxxfunc_funcset beat_game_cutscene_2; undefined4 zzz_ddlt_state_4_time; undefined2 DAT_0044ecf4; byte *DAT_0044ecf8; undefined2 DAT_0044ecf6; undefined *PTR_text_0044ae14; undefined4 DAT_0044ecf8; short DAT_0044ecf6; short DAT_0044ecf4; int DAT_0044ecf8; xxxfunc_funcset exit_game_funcset; short[11] player_other_entity_col_checks; short[11] banana_other_entity_col_checks; short[2] chimp_other_entity_col_checks; puzzle_cust_type_struct[8] puzzle_cust_types_state; word[8] WORD_ARRAY_00448ad4; short[8] total_puzzles_of_type; mouse_region *puzzle_cust_ok_region; undefined puzzle_cust_click_handler; undefined2 puzzle_cust_cancel_x; undefined2 puzzle_cust_cancel_y; aseq_anim_state_struct *puzzle_cust_cancel_anim; mouse_region *puzzle_cust_cancel_region; undefined2 puzzle_cust_ok_x; undefined2 puzzle_cust_ok_y; aseq_anim_state_struct *puzzle_cust_ok_anim; undefined2 DAT_00448ac0; undefined2 puzzle_cust_state; word[8] puzzle_cust_types_ypos; short DAT_00448ac2; dword DWORD_0044ed04; ushort DAT_0044ed08; pointer on_deactivate_xtra_cb; undefined DAT_0044ed02; undefined2 DAT_00448ac2; puzzle_cust_struct *the_puzzle_cust_struct; undefined puzzle_cust_key_handler; aseq_anim_state_struct *puzzle_cust_bg; undefined2 disable_exiting_because_dialog_xxx; byte *DAT_00448af8; TerminatedCString s_^0_00448afc; undefined dialog_proc; undefined2 *DAT_00448af8; undefined2 DAT_0044ed9c; undefined2 DAT_0044eda6; undefined2 DAT_0044eda8; undefined2 DAT_0044edb2; undefined4 DAT_00448af8; undefined DAT_0044eda2; ushort DAT_0044ed9c; ushort DAT_00448b14; undefined2 DAT_00448b02; string s_Package_EMPTY_00449410; word god_mode; actor_key_flag_struct *[72] player_keyboard_handlers; undefined2 actors_switch_game_mode; undefined2 go_through_locked_door; pointer[4] eseq_4500_3; pointer[4] PTR_ARRAY_004492e0; undefined player_action_10_pick_up_item; undefined actor_0_eseq_29_hit_by_chimp_cb; undefined actor_0_process_cb; undefined actor_1_process_cb_null; undefined player_after_transition_screen; eseq_chunk *[69] eseq_4501_a; undefined player_prepare_transition_screen; eseq_chunk *[69] eseq_4500_a; undefined banana_after_transition_screen; eseq_chunk *[5] eseq_4503_a; eseq_chunk *[5] eseq_4502_a; string s_Alert_00449420; string s_Fatal_00449426; undefined FUN_00412d4b; undefined DAT_0044f012; undefined4 battery_wire_spool_1_aseq; short DAT_0044946a; undefined4 elec_ui_bg_aseq; undefined4 battery_ui_hint_aseq; short[15] wave_load_list; undefined4 elec_ui_go_back_aseq; aseq_anim_state_struct *[6] battery_puzzle_cursor_aseq; aseq_cursor_struct *[6] battery_puzzle_cursor_aseq_more; aseq_anim_state_struct *[4] battery_puzzle_things_aseq; undefined FUN_0041055b; undefined2 puzzle_idx; undefined4 battery_wire_spool_0_aseq; undefined FUN_00412af9; aseq_cursor_struct *[4] battery_puzzle_things_aseq_more; undefined4 battery_wire_spool_0_aseq_more; undefined2 DAT_0044946a; undefined2 DAT_004514ae; int DAT_0044f00c; short DAT_004514c2; short DAT_004514b0; dword text; ushort DAT_004514b0; short DAT_004514bc; short DAT_0044f014; short DAT_00449470; short DAT_0044f030; undefined2 DAT_0044f018; undefined2 DAT_0044f01a; undefined2 DAT_004514c4; xxxfunc_funcset puzzle_choosing_funcset_xxx; int *DAT_0044f6d8; int *DAT_0044f6dc; struct_unk_2[5] struct_unk_2_ARRAY_0044942c; undefined2[5] null_ARRAY_0044f020; struct_unk_1[16] struct_unk_1_ARRAY_0044f556; mouse_region *[5] PTR_ARRAY_0044f698; aseq_anim_state_struct *[5] PTR_ARRAY_0044f9ac; undefined FUN_0040c185; undefined null_ARRAY_0044f020; ushort DAT_0044f016; short DAT_0044f02e; short DAT_0044f02c; undefined2 DAT_004514f6; short DAT_0044f032; short DAT_0044f034; short DAT_0044f01a; short DAT_0044f018; short DAT_0044946c; short DAT_0044946e; undefined2 DAT_00449470; undefined4 DAT_004514b4; undefined2 DAT_004514be; undefined2 DAT_004514c0; undefined SHORT_ARRAY_004514ce; undefined SHORT_ARRAY_004514ec; undefined2 DAT_004514bc; undefined DAT_004514c6; struct_elec_unk_0x1a[16][3] struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076; struct_unk_0[50] struct_unk_0_ARRAY_0044f87a; short DAT_0044f6e8; undefined2 DAT_0044f6ea; undefined2 DAT_0044f6e8; undefined2 DAT_0044f056; undefined2 DAT_0044f036; undefined2 DAT_0044f030; word DAT_0044f030; short DAT_0044f02a; undefined DAT_0044f01c; undefined DAT_0044f01e; undefined2 DAT_0044f016; undefined FUN_00412bcd; short DAT_004514c0; short[4] SHORT_ARRAY_004514ec; undefined2 *DAT_0044f00c; short DAT_0044f010; undefined2 DAT_0044f014; undefined2 DAT_0044fd58; undefined2 DAT_0044fd60; undefined4 DAT_0044fbd2; undefined4 DAT_0044fbd6; undefined4 DAT_0044fbdc; aseq_anim_state_struct *energy_pencil_0_aseq; undefined4 DAT_0044fbe0; aseq_anim_state_struct *energy_eraser_aseq; undefined2 DAT_0044fbda; undefined2 DAT_0044fbe4; undefined SHORT_ARRAY_0044fbea; aseq_anim_state_struct *energy_bg_aseq; undefined2 DAT_0044fd5a; aseq_anim_state_struct *energy_dot_aseq; undefined2 DAT_0044fd5c; aseq_anim_state_struct *energy_hand_aseq; aseq_anim_state_struct *energy_pencil_1_aseq; aseq_cursor_struct *energy_hand_cursor; aseq_cursor_struct *energy_eraser_cursor; aseq_cursor_struct *energy_pencil_cursor_0; aseq_cursor_struct *energy_pencil_cursor_00; undefined FUN_004167ac; undefined FUN_00416e98; undefined FUN_00416f16; cursor_override_region *PTR_0044fd3c; energy_lhs[4] energy_lhs; undefined2 DAT_004494b4; energy_rhs[4] energy_rhs; aseq_anim_state_struct *energy_pencil_write_aseq; aseq_anim_state_struct *energy_check_aseq; aseq_anim_state_struct *energy_go_back_aseq; aseq_anim_state_struct *energy_hint_aseq; aseq_anim_state_struct *[4] energy_rhs_anim_aseq; aseq_anim_state_struct *[4] energy_lhs_circles_aseq; aseq_anim_state_struct *[4] energy_rhs_circles_aseq; short DAT_0044fd58; ushort DAT_004514c4; undefined2 DAT_0044fd5e; short DAT_0044fca4; short DAT_0044fca2; undefined2 DAT_0044fbc6; short DAT_004494b4; short DAT_0044fbc8; short DAT_0044949c; short DAT_0044949e; short DAT_0044fbc4; short DAT_0044fbc2; short[4] SHORT_ARRAY_004494a0; undefined2 energy_matches_left_to_use; undefined2 DAT_0044fa32; short[4] SHORT_ARRAY_0044fbea; undefined2 energy_puzzle_state; TerminatedCString s_Congratulations!_You_solved_the_p_004494c4; undefined2 energy_num_matches; string s_Match_the_energy_forms_with_the_p_00449674; string s_Then_check_your_answer._004496c8; pointer energy_puzzle_types; short DAT_004494aa; mouse_region *[4] energy_lhs_circles_mouse; mouse_region *[4] energy_rhs_circles_mouse; ushort DAT_0044fa30; short DAT_0044fbda; undefined2 DAT_0044949e; undefined DAT_0044fbd2; undefined SHORT_ARRAY_004494a0; undefined2 DAT_0044949c; undefined FUN_00416c5b; undefined DAT_0044fbcc; undefined DAT_0044fbce; undefined DAT_0044fbd0; undefined DAT_0044fbca; undefined2 DAT_0044fca2; undefined2 DAT_0044fca4; short DAT_0044fbc6; short DAT_0044fd60; short DAT_0044fd5c; short DAT_0044fd5a; short DAT_0044fd64; short DAT_0044fd62; undefined DAT_0044fbe6; undefined DAT_0044fbe8; undefined2 DAT_0044fa2c; undefined2 DAT_0044fa2e; undefined DAT_0044fbe4; undefined DAT_0044fbe0; undefined DAT_0044fbd6; undefined2 DAT_0044fbc4; undefined FUN_00417590; short DAT_0044fd5e; short DAT_004496f4; undefined key_down_handler_buffered; undefined2 key_buffer_rptr; undefined2 key_buffer_wptr; short DAT_004496f6; word[32] key_buffer; undefined *PTR_s_rb_004496f8; char[256] windows_dir; undefined2 DAT_0044fe5c; int DAT_0044fdf0; undefined FUN_0041bc1d; undefined2 force_puzzle_cleared; aseq_anim_state_struct *force_hand_cur_aseq; aseq_cursor_struct *force_hand_cur; undefined FUN_0041bcba; undefined FUN_00418583; int DAT_0044fe58; undefined2 DAT_004498d8; short DAT_0044fe5c; short DAT_0044fdf6; point[8] force_puzzle_glowing_hole_pos; short DAT_0044fdee; short DAT_0044fdfe; short DAT_004498e0; short force_puzzle_glowing_hole_slot; int *DAT_0044fe28; short DAT_004498d8; short DAT_0044fdec; short DAT_0044fdea; point[17] point_ARRAY_004497e8; point[8] point_ARRAY_0044982c; point[8] point_ARRAY_0044986c; point[3][4] point_ARRAY_ARRAY_0044988c; undefined2 force_puzzle_incline_base_idx; short force_puzzle_computed_distance; aseq_anim_state_struct *force_puzzle_glowing_hole_aseq; aseq_anim_state_struct *force_puzzle_selected_ball_aseq; aseq_anim_state_struct *force_puzzle_apply_remove_stuff_aseq; word force_puzzle_state; aseq_anim_state_struct *force_puzzle_go_back_aseq; short force_puzzle_gravity_idx; aseq_anim_state_struct *force_puzzle_gravity_aseq; short[4] force_puzzle_ball_enabled; aseq_anim_state_struct *force_puzzle_hint_aseq; short force_puzzle_allow_oil; short force_puzzle_allow_sand; aseq_anim_state_struct *force_puzzle_incline_aseq; aseq_anim_state_struct *force_puzzle_plunger_aseq; aseq_anim_state_struct *[4] force_puzzle_balls_sidebar_aseq; aseq_anim_state_struct *force_puzzle_oil_aseq; aseq_anim_state_struct *force_puzzle_sand_aseq; aseq_anim_state_struct *force_puzzle_rag_aseq; aseq_anim_state_struct *force_puzzle_brush_aseq; point[4] force_puzzle_balls_sidebar_pos; point[18] force_puzzle_incline_pos; aseq_anim_state_struct *force_puzzle_bg_aseq; short force_puzzle_incline_idx; short force_puzzle_selected_ball_idx; short force_puzzle_plunger_force; short SHORT_004498be; undefined2 DAT_0044fdfe; undefined2 DAT_0044fdf6; undefined2 DAT_004498e0; short force_puzzle_required_ball; undefined2 DAT_0044fe00; short force_puzzle_required_gravity; short force_puzzle_required_friction; undefined2 DAT_0044fdfc; undefined2 force_puzzle_friction_type; mouse_region *mouse_region_gravity_norm; point[4] force_puzzle_balls_sidebar_mouse_pos; mouse_region *mouse_region_gravity_high; short DAT_0044fdfc; mouse_region *[4] force_puzzle_balls_sidebar_mouse_region; mouse_region *PTR_0044fddc; mouse_region *PTR_0044fde0; mouse_region *PTR_0044fde4; int *DAT_0044fdd8; mouse_region *force_oil_mouse_region; mouse_region *force_rag_mouse_region; mouse_region *force_sand_mouse_region; mouse_region *force_brush_mouse_region; mouse_region *mouse_region_gravity_low; undefined4 *DAT_0044fe54; point[6] force_puzzle_apply_remove_pos; int *DAT_0044fe54; short[4] force_puzzle_ball_modifier; short[3] force_puzzle_friction_modifier; short[4] force_puzzle_gravity_modifier; short[3] force_puzzle_incline_modifier; short[29] force_puzzle_distances; word DAT_0044fdea; word DAT_0044fdec; undefined2 DAT_0044fdee; undefined2 *DAT_0044fe58; undefined2 disable_hints; string s_ssgwin.dat_00449908; TerminatedCString s_rb_00449918; TerminatedCString s_w+b_0044991b; TerminatedCString s_r+b_0044991f; undefined4 ssgwin_dat_file; string s_ReadDatFile_Error_00449923; short DAT_00449914; short DAT_00449c4a; short DAT_00449916; string s_Writing_Empty_Name_(Bad)_00449935; undefined2 selected_file_idx; int[7] score_thresholds; undefined2 DAT_0044ff28; short DAT_00449ad4; undefined4 aseq_15005_gear_hint; aseq_anim_state_struct *aseq_15009_gear_go_back; aseq_anim_state_struct *gear_aseq_14011_hand; aseq_anim_state_struct *aseq_14012_small_gear; aseq_anim_state_struct *aseq_14007_big_gear; aseq_anim_state_struct *aseq_14010_px; aseq_cursor_struct *aseq_14012_small_gear_cursor; aseq_cursor_struct *aseq_14007_big_gear_cursor; undefined FUN_0041d620; aseq_cursor_struct *aseq_14010_px_cursor; aseq_cursor_struct *gear_aseq_14011_hand_cursor; undefined FUN_0041fef3; undefined FUN_0042012f; int DAT_0044fe84; dword gear; undefined2 DAT_00449ad4; undefined2 gear_mouse_y; undefined2 gear_puzzle_state; short DAT_0044ff28; short DAT_0044febc; undefined2 gear_mouse_x; undefined *PTR_s_Normal_00449be4; int *DAT_0044ff10; int *DAT_0044ff00; int *DAT_0044ff04; int *DAT_0044ff0c; int *DAT_0044ff08; gear_puzzle_related_xxx_struct[2] gear_puzzle_related_xxx_struct_ARRAY_0044fe94; undefined gear_puzzle_mouse_handler; mouse_region *gear_puzzle_crank_mouse_region; mouse_region *[2] gear_lhs_mouse_regions; short[2] gear_lhs_xpos; gear_more_data *loaded_gear_more_data; short[2] gear_lhs_ypos; short[2] gear_puzzle_gears_in_sidebar; short DAT_0044fec0; word DAT_0044fe7a; undefined2 gear_cranking_start_mouse_x; undefined2 gear_cranking_start_mouse_y; short DAT_0044ff18; short DAT_0044ff1a; word DAT_0044fe70; short DAT_0044fe66; short DAT_0044fe64; short DAT_0044fe6c; short DAT_0044fe68; short DAT_0044fe6a; short DAT_0044fe6e; undefined2 gear_obj0_x; undefined2 gear_obj0_y; undefined2 gears_clash; undefined2 gear_puzzle_num_objs; short[6] SHORT_ARRAY_00449abc; short[2] SHORT_ARRAY_00449ac8; short[2] SHORT_ARRAY_00449acc; undefined2 DAT_004514c2; short DAT_0044fe7a; word[2] gear_xpos; word[2] gear_ypos; pointer[6][11] gear_interaction_table; word DAT_0044fec0; short[2][2] SHORT_ARRAY_ARRAY_004499dc; short[2][2][5][5] gear_interact_dist_table; undefined4 loaded_gear; short[2] gear_num_anims; dword loaded_gear_2; aseq_anim_state_struct *gear_bg; undefined2 *DAT_0044fe84; undefined2 DAT_0044febc; undefined2 game_exited; short *wave_ints_xxxxxxxxx; undefined2 DAT_00449c4a; short[6] SHORT_ARRAY_00449c58; undefined2 DAT_00449c4c; xxxfunc_funcset warehouse_platforming_funcset; xxxfunc_funcset workshop_funcset; xxxfunc_funcset pre_puzzle_choosing_funcset; xxxfunc_funcset get_parts_on_vehicle_funcset; undefined2 go_race; short DAT_00449c3c; ushort DAT_0044a77c; string s_Yes,_we_have_no_bananas_00449e03; string s_Hang_on_tight..._00449e1b; string s_Up,_up,_and_awaaaay!!_00449e2c; string s_God_Mode_On_00449e42; string s_God_Mode_Off_00449e4e; string s_Beam_me_up_Sid!_00449e5b; word cheatkeys; undefined2 cheat_pick_a_puzzle; undefined process_cheats; undefined2 DAT_0044ff32; undefined status_bar_put_down_held; undefined4 last_key_time; short DAT_0044ff32; xxxfunc_funcset from_warehouse_modeswitch_funcset; undefined2 aseq_4508_skip_draw_happened; xxxfunc_funcset race_1_funcset; xxxfunc_funcset race_02_funcset; TerminatedCString s_to_go_Back_00449e6b; undefined4 DAT_0044ff38; xxxfunc_funcset *DAT_0044ff38; xxxfunc_funcset xxxfunc_funcset_00449d0c; xxxfunc_funcset file_select_related_funcset_maybe; short DAT_0044ff3c; short DAT_0044ff3e; undefined nullsub; undefined2 DAT_0044ff3c; string s_About_Gizmos_&&_Gadgets!_CD_00449e78; undefined on_wmcommand_handler; undefined exit_game_handler; xxxfunc_funcset default_funcset; undefined on_activate_handler; undefined on_deactivate_handler; undefined char_filter_xxx; pointer[20] dat_file_names; undefined set_cursor_wait_arrow; undefined tear_down_lots_of_stuff; string s_WING32.DLL_0044a6b4; pointer WinGCreateBitmap; pointer WinGGetDIBPointer; pointer WinGGetDIBColorTable; pointer WinGSetDIBColorTable; pointer WinGBitBlt; pointer WinGStretchBlt; undefined2 gfx_render_mode; HMODULE h_wing32; pointer WinGCreateDC; pointer WinGRecommendDIBFormat; undefined2 paint_intersect_x; undefined2 paint_intersect_y; undefined2 paint_intersect_w; undefined2 paint_intersect_h; undefined2 paint_off_x; undefined2 paint_off_y; undefined4 hdc; gfx_fb_struct[2] gfxish_fbs; undefined2 bitmap_iusage; BITMAPINFO *bitmap_info; undefined1 DAT_004502c0; undefined2 paint_w; undefined2 paint_h; HPALETTE paint_palette; undefined4 chosen_blit_function; string s_gr_not_initialized!_0044a6bf; undefined2 gfxish_num_framebuffers; undefined wing_bitblt_wrap; ushort gr_is_initialized; undefined stretchdibits_wrap; undefined other_paint_func; undefined2 gfxish_is_init; undefined fill_light_grey; undefined2 DAT_0044ff4e; undefined2 num_colors; undefined2 bits_per_px; undefined2 h_px; undefined2 v_px; undefined2 num_planes; byte[24][32] gfx_invalidate_array; undefined2 gfxish_has_paint; string s_Uh_oh!_0044a6d3; short DAT_00449ea4; short DAT_00449ea6; string s_Uh_oh!_0044a6da; undefined4 DAT_00449eac; string s_Set_Palette_Entries_failed_0044a6e1; dword rrgb; short DAT_004502be; undefined2 DAT_004502be; short DAT_004502bc; undefined1 DAT_004505bd; undefined1 DAT_004505be; undefined1 DAT_004505bf; undefined1 DAT_004502c1; undefined1 DAT_004502c2; undefined4 DAT_0044a2b0; byte DAT_004502c0; byte DAT_004502c1; byte DAT_004502c2; byte DAT_004505bd; byte DAT_004505be; byte DAT_004505bf; undefined1 DAT_004502c3; undefined *DAT_00449e98; undefined2 DAT_0044ffa8; undefined2 DAT_0044ffaa; undefined2 gfxish_selected_fb; undefined4 gfxish_dest; undefined4 gfxish_otherbuf; undefined4 DAT_00449e98; undefined2 help_nextprev_thing; aseq_anim_state_struct *help_left_button_anim; aseq_anim_state_struct *help_right_button_anim; short DAT_0045209e; short DAT_004520a0; undefined DAT_0045209c; short DAT_00452096; short DAT_00452094; undefined4 help_hdr_string; help_page_struct *help_cur_page; short DAT_0045209a; aseq_anim_state_struct *help_next_page_anim; short DAT_00452098; aseq_anim_state_struct *help_prev_page_anim; undefined DAT_004505f4; aseq_anim_state_struct *help_done_anim; undefined help_next_page_button_click; undefined help_done_button_click; short help_pressed_key; dword DWORD_00450614; undefined DAT_00450608; dword help; word help_idx; undefined2 help_num_entries; undefined4 help_linked_list; undefined help_key_handler; gfx_rect dialog_related_rect_xxx; undefined2 DAT_0045077c; int *DAT_0045076c; short DAT_0044a73a; undefined4 *DAT_00450774; undefined4 *DAT_00450764; undefined4 *DAT_00450778; undefined4 *DAT_00450760; int DAT_00450768; undefined FUN_004238b1; undefined FUN_00424da0; undefined FUN_00424e82; short DAT_0045075a; char[50] s__00450728; undefined2 selected_jigsaw_piece; int DAT_0045075c; int *DAT_00450760; undefined2 DAT_0044a73a; short DAT_0045077c; short DAT_0045077e; undefined2 jigsaw_state; jigsaw_piece[10] jigsaw_pieces; int *DAT_00450770; int *DAT_00450778; int *DAT_00450774; int *DAT_00450764; undefined2 jigsaw_num_pieces; mouse_region *PTR_00450724; mouse_region *[10] PTR_ARRAY_004506fc; short DAT_0044a73c; undefined2 DAT_0044a73c; short DAT_0044a738; undefined4 *DAT_00450770; word DAT_0045061a; undefined2 *DAT_0045075c; undefined4 DAT_00450768; undefined2 DAT_0045077e; short DAT_00448b02; undefined2 go_idle_flag; dword eseq; short[5] eseq_loop_counts_list; short player_iframe_blink_frame; undefined2 DAT_0044a794; aseq_anim_state_struct *aseq_4508_invisible_px; undefined aseq_4508_skip_draw_cb; short DAT_0044a794; short DAT_0044a77c; short DAT_0044a77e; undefined2 DAT_0044a7a4; undefined2 DAT_00451192; int *DAT_0045115c; short DAT_0044a8ce; undefined4 *DAT_0045116c; undefined4 *DAT_00451170; undefined4 *DAT_004510e0; int DAT_004510e4; int DAT_00451154; undefined4 *DAT_00451120; aseq_anim_state_struct *[12] PTR_ARRAY_004510f0; aseq_cursor_struct *[12] PTR_ARRAY_00451124; cordcode *cordcode_list; undefined FUN_00426811; undefined FUN_0042b7ce; undefined FUN_0042b8a7; int DAT_004510d4; int *DAT_004510e0; undefined2 DAT_0044a8ce; int *DAT_00451120; short DAT_00451192; short DAT_004510e8; short DAT_0044a8d0; short DAT_004510d8; short DAT_004510da; short DAT_004510dc; short DAT_004510de; short DAT_00451190; undefined2 DAT_004510ea; undefined2 DAT_004510ec; int *DAT_00451170; undefined2 DAT_0044a8d0; int *DAT_00451184; int *DAT_00451188; int *DAT_0045118c; undefined2[3][2] null_ARRAY_ARRAY_0044a7a8; undefined2[3] null_ARRAY_0044a8c8; aseq_anim_state_struct *[3] PTR_ARRAY_00451160; undefined FUN_00426a87; undefined4 DAT_00451178; short DAT_004510cc; int *DAT_0045116c; undefined2[3][2] null_ARRAY_ARRAY_0044a7b4; undefined2 DAT_004510cc; undefined2[40][4] null_ARRAY_ARRAY_00450f84; char[30][3] CHAR_ARRAY_ARRAY_0044a84d; char[30] CHAR_ARRAY_0044a8a9; undefined2 DAT_004510d0; aseq_cursor_struct *DAT_00451158; short DAT_004510d0; int DAT_00451158; short DAT_004510ea; short DAT_004510ec; undefined2 DAT_00451190; undefined2 DAT_004510de; undefined2 DAT_004510dc; undefined DAT_0044a7c0; undefined DAT_0044a7c1; string s_D:cordcode.c_0044a8fa; TerminatedCString s_a+_0044a907; string s_case_%d:_0044a90a; string s_ii[%d].type_=_%d;_0044a91a; string s_ii[%d].rot_=_%d;_0044a936; string s_ii[%d].x_=_%d;_0044a952; string s_ii[%d].y_=_%d;_0044a96e; string s_break;_0044a98b; undefined2 *DAT_004510d4; undefined4 DAT_004510e4; undefined2 DAT_004510e8; short DAT_0044a9b6; linked_list_head *menu_structs; HMENU main_win_menu; short DAT_0044a9b4; undefined LAB_0042b8ec; undefined2 DAT_0044a9b4; undefined2 has_custom_cursor; undefined2 clip_cursor_is_enabled; aseq_cursor_struct aseq_cursor; gfx_rect xxx_bugged_clip_cursor; gfx_rect orig_clip_cursor; short DAT_0044a9c8; undefined2 sys_cursor_is_hidden; aseq_cursor_struct *aseq_cursor_ptr; undefined2 cursor_override_regions_num; cursor_override_region *cursor_override_regions; undefined custom_cursor_main_cb; undefined2 unset_custom_cursor_saved; undefined4 saved_custom_cursor_regions; TerminatedCString s_to_go_Back_0044a9d6; xxxfunc_funcset help_funcset; undefined2 menus_are_set_up; undefined options_sound_and_music; undefined options_voice; undefined file_start_another_game; undefined help_about_the_game; undefined file_go_to_tech_center; undefined options_puzzle_customization; undefined help_moving_around; undefined help_building_vehicles; undefined help_finding_paths; undefined help_solving_puzzles; undefined help_challenge_races; undefined help_educational_focus; undefined on_sys_about; undefined options_new_player_hints; short[2] system_menu_xxx_enable_array; short[3] file_menu_xxx_enable_array; short[4] options_menu_xxx_enable_array; short[7] help_menu_xxx_enable_array; linked_list_head *tracked_heap_blocks_used; linked_list_head *tracked_heap_blocks_free; tracked_heap_block *tracked_heap_blocks_ents; undefined2 DAT_00451228; new_player_hint_struct[5] new_player_hint_struct_ARRAY_00451230; linked_list_head *new_player_hint_list; undefined FUN_0042d20c; undefined *PTR_s_New_Player_Hint_0044a9e8; undefined *PTR_s_Press_to_continue._0044a9ec; undefined2 DAT_0044aa46; undefined2 DAT_0044aa44; short DAT_0044aa46; int DAT_004512b8; undefined2 DAT_004512c0; aseq_anim_state_struct *aseq_1601; undefined custom_anim_command_handler; aseq_anim_state_struct *aseq_1602; undefined FUN_0042d579; title_screen_anim_xxx *title_screen_anim_batch; aseq_anim_state_struct *[4] aseq_1678_4; char *string_0x80; short DAT_0044aa44; short DAT_004512c0; uint DAT_004512b8; xxxfunc_funcset xxxfunc_funcset_0044aa6c; xxxfunc_funcset xxxfunc_funcset_0044aa84; xxxfunc_funcset xxxfunc_funcset_0044aa48; undefined2 DAT_004512bc; xxxfunc_funcset xxxfunc_funcset_0044aa90; byte *DAT_004512c4; undefined4 DAT_004512c8; short DAT_004512be; int DAT_004512c4; ushort DAT_004512c0; ushort *DAT_004512c8; xxxfunc_funcset xxxfunc_funcset_0044aa9c; xxxfunc_funcset xxxfunc_funcset_0044aa54; xxxfunc_funcset xxxfunc_funcset_0044aa60; dword part; short parts_related_array_idx; short[60] parts_related_array; int[3] INT_ARRAY_0044aafc; int[4] INT_ARRAY_0044ab08; int[2] INT_ARRAY_0044ab18; int[4] INT_ARRAY_0044ab20; int[4] INT_ARRAY_0044ab30; int[3] INT_ARRAY_0044ab40; int[4] INT_ARRAY_0044ab4c; int[4] INT_ARRAY_0044ab5c; int[4] INT_ARRAY_0044ab6c; int[4] INT_ARRAY_0044ab7c; int[4] INT_ARRAY_0044ab8c; int[8] INT_ARRAY_0044ab9c; int[4] INT_ARRAY_0044abbc; int[4] INT_ARRAY_0044abcc; int[4] INT_ARRAY_0044abdc; int[4] INT_ARRAY_0044abec; int[4] INT_ARRAY_0044abfc; int[4] INT_ARRAY_0044ac0c; int[4] INT_ARRAY_0044ac1c; int[4] INT_ARRAY_0044ac2c; int[4] INT_ARRAY_0044ac3c; int[4] INT_ARRAY_0044ac4c; int[4] INT_ARRAY_0044ac5c; int[4] INT_ARRAY_0044ac6c; int[4] INT_ARRAY_0044ac7c; int[4] INT_ARRAY_0044ac8c; int[4] INT_ARRAY_0044ac9c; int[4] INT_ARRAY_0044acac; int[4] INT_ARRAY_0044acbc; int[4] INT_ARRAY_0044accc; int[4] INT_ARRAY_0044acdc; int[4] INT_ARRAY_0044acec; int[5] race_1_base_minmax_speed; undefined2 DAT_0045143e; undefined2 DAT_0044ad10; int DAT_00451398; undefined2 DAT_00451440; word DAT_00451382; undefined2 DAT_00451380; word[5] WORD_ARRAY_0044aac0; word[5] WORD_ARRAY_0044aaca; undefined2 race_1_state; aseq_anim_state_struct *race_1_lvl_1_launch_plane_aseq_0; aseq_anim_state_struct *race_1_lvl_1_launch_plane_aseq_1; undefined2 race_1_lvl_1_launch_plane_step; undefined4 loaded_rdat; undefined2 race_1_level; undefined4 race_1_rdat_bg_parallax_0_pos; undefined4 race_1_rdat_bg_parallax_1_pos; short *race_1_lvl_1_launch_plane_race_data_0; word[5] race_1_veh_aseq_base_idx_player; short *race_1_lvl_1_launch_plane_race_data_1; word[5] race_1_veh_aseq_idx_morty; rdat_chunk *loaded_rdat_thing0; word[5] race_idx_array_0; rdat_chunk *loaded_rdat_thing1; word[5] race_idx_array_1; race_1_struct race_1_state_player; race_1_struct race_1_state_morty; dword rdat; short DAT_0044ad10; short DAT_00451380; undefined2 DAT_0044aab2; short DAT_00451382; undefined4 race_rdat_delay_1s; undefined2 race_1_lvl_1_launch_plane_x; undefined2 race_1_lvl_1_launch_plane_y; short DAT_0044ad3c; undefined2 DAT_00451468; undefined2 DAT_0044ad38; int DAT_00451464; undefined DAT_00451470; ushort DAT_00451474; short DAT_0045144e; short DAT_0045144c; short DAT_00451456; short DAT_00451458; undefined DAT_00451454; undefined DAT_0045146a; int *DAT_0045147c; ushort DAT_0044ad3a; int *DAT_00451480; undefined2 DAT_0044ad3c; short DAT_0045146c; undefined DAT_00451444; short[11] SHORT_ARRAY_004514ce; undefined FUN_0042fb68; undefined2 DAT_0045146c; string s_Puzzle_Hint_0044ad3e; undefined DAT_0044ad4a; undefined DAT_00451446; undefined DAT_00451448; undefined DAT_0045144a; ushort DAT_0045144c; short DAT_00451450; undefined DAT_00451452; undefined DAT_0045145a; undefined DAT_0045145c; undefined DAT_0045145e; undefined DAT_00451460; undefined DAT_00451462; undefined2 DAT_004514fa; undefined4 *DAT_0045153c; short DAT_0044ad4c; short DAT_004514ae; int *DAT_00451538; short[8] total_puzzles_of_type_; undefined2 puzzle_type; int *DAT_0045153c; short DAT_004514fa; xxxfunc_funcset force_puzzle_funcset; xxxfunc_funcset gear_puzzle_funcs; xxxfunc_funcset energy_puzzle_funcset; xxxfunc_funcset magnet_puzzle_funcset; xxxfunc_funcset jigsaw_puzzle_funcset; xxxfunc_funcset balance_puzzle_funcset; xxxfunc_funcset simple_machines_puzzle_funcset; xxxfunc_funcset electricity_puzzle_funcset; int *DAT_00451528; int *DAT_0045152c; undefined2 DAT_0044ada8; undefined4 DAT_004514fc; undefined DAT_0044ad98; short[3] three_possible_puzzles; undefined2 DAT_0044adbe; short DAT_0044adbe; TerminatedCString s_Congratulations!_You_solved_the_p_0044ad4e; short DAT_00451484; byte *DAT_004514b4; aseq_anim_state_struct *[6] score_digits_aseqs; aseq_anim_state_struct *aseq_score_label_19501; word[6][2] score_digit_pos; TerminatedCString s_.exe_0044af3d; char[260] cddrive; undefined2 resources_list_inited; linked_list_head *resource_items_list; linked_list_head *resources_list; undefined DAT_00451560; balance_weight_pos[6] balance_weight_pos_ARRAY_0044af5c; mouse_region *[6] PTR_ARRAY_004515d4; mouse_region *[5] PTR_ARRAY_004515ec; undefined2[6] balance_num_weights_in_sidebar; undefined2 balance_puzzle_is_beat; balance_item[10][3] balance_items; undefined2 balance_tilt_maybe; point[11][10] balance_weight_pos; aseq_anim_state_struct *balance_go_back; undefined2 DAT_00451618; int DAT_00451564; aseq_anim_state_struct *balance_hint; undefined4 balance_bg; aseq_anim_state_struct *[12] balance_puzzle_weights_on_the_balance_aseq; aseq_anim_state_struct *[6] balance_blue_weight_aseq_for_cursor; aseq_cursor_struct *[6] balance_blue_weight_cursors; short[6] balance_weights_widths; undefined FUN_00434706; undefined FUN_00434734; undefined FUN_004347b2; aseq_anim_state_struct *balance_hand_aseq; aseq_cursor_struct *balance_hand_cursor; aseq_anim_state_struct *balance_rotating_beam; int DAT_004516a0; aseq_anim_state_struct *[6] balance_puzzle_blue_weights_aseq; short DAT_00451618; short DAT_0044af58; short DAT_00451568; short DAT_0045156e; undefined2 balance_selected_weight; short DAT_0045156a; undefined2 balance_puzzle_state; short DAT_0044af5a; undefined2 DAT_0045156a; undefined balance_position_all_weights_wrap; undefined2 DAT_0044af58; short[5] balance_num_items_on_slot; undefined2 DAT_0045156e; undefined2 DAT_0044af5a; short DAT_00451570; undefined2 DAT_00451568; undefined2 *DAT_004516a0; aseq_anim_state_struct *[5] file_select_scroll_widget_aseq; short DAT_0045171c; undefined2 mouse_unk_0x6_idx; short DAT_00451718; mouse_unk_0x6_struct[100] mouse_unk_0x6_struct_ARRAY_0045171e; word DAT_004516e8; word DAT_004516ea; short DAT_0044b1c8; file_select_0x12_struct[3] file_select_0x12_struct_ARRAY_0044b1ca; undefined2 DAT_00449914; undefined2 DAT_00449916; save_file_beginning *save_file; short DAT_004516f6; undefined2 DAT_00451702; undefined1 DAT_00451704; undefined *rankings_array; short DAT_0044b210; undefined file_select_0x12_struct_ARRAY_0044b1ca; undefined DAT_0044b200; short DAT_004516e8; short DAT_004516ea; undefined2 DAT_004516f4; undefined DAT_004516f8; undefined DAT_004516fc; short DAT_00451700; undefined2 DAT_004516f6; undefined DAT_0044b214; undefined DAT_0044b21c; undefined DAT_0044b210; undefined2 DAT_00451716; undefined FUN_00434e19; undefined FUN_004361d2; short DAT_00451716; TerminatedCString s_to_go_Back_0044b230; string s_SM_(Wave)_:_%s_0044b3a9; HWND sound_window; sound_playing_struct[5] playing_sounds; undefined2 sound_type; sound_struct *currently_playing_midi; undefined2 max_waves; undefined2 num_sound_pauses; byte[8] fmt_chunk_hdr; undefined4 waves_list; undefined4 wavemix_session; pointer WaveMixActivate; string s_WAVEMIX.DLL_0044b3c1; string s_WaveMixConfigureInit_0044b3cd; string s_WaveMixActivate_0044b3e2; string s_WaveMixOpenWave_0044b3f2; string s_WaveMixFlushChannel_0044b402; string s_WaveMixOpenChannel_0044b416; string s_WaveMixCloseChannel_0044b429; string s_WaveMixFreeWave_0044b43d; string s_WaveMixCloseSession_0044b44d; string s_WaveMixPlay_0044b461; string s_WaveMixPump_0044b46d; pointer WaveMixConfigureInit; pointer WaveMixOpenWave; HMODULE wavemix; pointer WaveMixFlushChannel; pointer WaveMixOpenChannel; pointer WaveMixCloseChannel; pointer WaveMixFreeWave; pointer WaveMixCloseSession; pointer WaveMixPlay; pointer WaveMixPump; string s_DSOUND.DLL_0044b479; string s_DirectSoundCreate_0044b484; pointer DirectSoundCreate; HMODULE dsound; short DAT_0045197e; undefined2 DAT_00451986; ushort DAT_0045197c; pointer dsound_obj; undefined *PTR_s_SoundWindow_0044b2b4; undefined SoundWndProc; undefined DAT_0044b496; string s_SetCooperativeLevel_failed_0044b497; word sfx_enabled; word bgm_enabled; word voices_enabled; undefined DAT_0045197c; undefined *PTR_wave_0044ae1c; MMIOINFO MMIOINFO_004519f0; string s_Error_with_WaveMixOpenWave_0044b4b2; undefined2 midi_type; ushort DAT_0044b24a; undefined2 midi_current; undefined2 DAT_0044b24a; short DAT_0044b24a; string s_CreateSoundBuffer_failed_0044b4cd; string s_Play_failed_0044b4e6; HWAVEOUT hwaveout; TerminatedCString midi_path; ushort DAT_0044b2ac; ushort *DAT_00451a90; undefined2 DAT_00451a94; int DAT_00451a90; short DAT_00451a94; undefined2 DAT_0044b2ac; short DAT_0044b2ac; short DAT_0044b2a4; undefined2 DAT_0044b244; undefined *PTR_s_midimap.cfg_0044b2c0; string s_\system\_0044b4fe; string s_\system32\_0044b507; string s_ADLIB_0044b512; string s_AD_LIB_0044b518; string s_MVI_PRO_0044b51f; TerminatedCString s_BAS_0044b527; TerminatedCString s_BASE_0044b52b; string s_THUNDER_BOARD_0044b530; undefined2 DAT_0044b2a4; TerminatedCString s_\_0044b53e; undefined4 DAT_00451a90; string s_Problem_with_WaveMix_:_Convertin_0044b540; undefined2 DAT_00451e80; undefined2 DAT_00451e7e; int *DAT_00451ec8; undefined4 *DAT_00451ef4; short DAT_0044b706; undefined4 *DAT_00451ef8; undefined4 *DAT_00451efc; undefined4 *DAT_00451f00; aseq_anim_state_struct *[8] simple_machine_icon_cur_aseqs; aseq_cursor_struct *[8] simple_machine_icon_curs; aseq_anim_state_struct *[9] simple_machine_hand_cur_aseqs; aseq_cursor_struct *[9] simple_machine_hand_curs; undefined FUN_00439440; undefined FUN_0043be57; undefined FUN_0043c05f; undefined2 DAT_0044b706; int DAT_00451a98; short DAT_00451e7e; short DAT_00451e80; int *DAT_00451ef4; short DAT_00451bae; short DAT_0044b6e4; undefined2 simple_machine_start_x; short DAT_00451bb0; undefined2 simple_machine_start_y; simple_machines_answer[10] simple_machines_answer; simple_machine_type_info[8] simple_machine_type_info_ARRAY_0044b62c; short simple_machine_mouse_x; simple_machine_state_struct[10] simple_machine_state_struct_ARRAY_00451ac8; short simple_machine_mouse_y; undefined2 simple_machines_state; int *DAT_00451aa4; int *DAT_00451aa0; gfx_rect[8] gfx_rect_ARRAY_0044b6a4; mouse_region *[8] PTR_ARRAY_00451aa8; char[8] simple_machine_instances; string s_File_too_large_0044c4ca; aseq_anim_state_struct *[8] simple_machine_icon_aseq; string s_No_space_left_on_device_0044c4d9; undefined2 cur_selected_simple_machine; aseq_cursor_struct *cur_simple_machine_icon_cur; undefined2 DAT_0044b6e4; undefined2 DAT_00451bae; int *DAT_00451efc; aseq_anim_state_struct *simple_machine_grey; aseq_anim_state_struct *simple_machine_colored; int *DAT_00451f00; int *DAT_00451ef8; point[8] point_ARRAY_0044b57c; word *DAT_00451a98; short DAT_00451a9c; simple_machine_mouse_shape_region_info[9] simple_machine_mouse_shape_region_info_ARRAY_0044b59c; undefined *DAT_0044b744; undefined2 xxxfunc_thing0_idx; undefined2 xxxfunc_disable; undefined2 xxxfunc_is_shifting; xxxfunc_funcset * *xxxfunc_thing0; xxxfunc_funcset * *xxxfunc_thing1; xxxfunc_funcset * *xxxfunc_thing2; undefined2 xxxfunc_is_set_up; undefined dialog_proc_2; undefined *PTR_s_Graphics_0044b758; undefined *PTR_s__0044b760; undefined *PTR_s_CDDrive_0044b750; undefined *PTR_s_MIDIPath_0044b754; undefined *PTR_s_Gizmos_&_Gadgets!_CD_0044b74c; TerminatedCString s_\_0044b796; string s_ssgwincd.ini_0044b798; string s_Sound_0044b7a5; TerminatedCString s__0044b7ab; string s_midi\_0044b7ac; string s_MIDIType_0044b7b2; string s_CheatKeys_0044b7bb; TerminatedCString s_\_0044b7c5; TerminatedCString s__0044b7c7; TerminatedCString s_\_0044b7c8; string s_ssgwincd.ini_0044b7ca; string s_wavemix_0044b7da; ushort DAT_0044b878; short DAT_0044b878; short DAT_0044b898; undefined2 DAT_0044b878; parking_lot_cursor_struct[8] parking_lot_cursor_struct_ARRAY_0044b7e6; pointer[4] PTR_ARRAY_0044b868; undefined2 show_beat_the_game; short[15] parking_lot_decorations; aseq_anim_state_struct *[4] parking_lot_cursors; aseq_cursor_struct *[4] parking_lot_cursors_more; undefined FUN_0043c734; ushort DAT_00452094; undefined2 dlg_bot_txt_h; undefined DAT_004520a2; undefined2 dlg_bot_txt_x; undefined2 dlg_bot_txt_y; undefined2 dlg_bot_txt_w; dialog_state_struct *current_dialog; undefined2 dialog_state; short dialog_ret_value; undefined2 dialog_handlers_active; int DAT_004520b8; ushort DAT_004520bc; undefined dialog_keyboard_handler; short DAT_004520b4; pointer[2] PTR_ARRAY_0044b8bc; TerminatedCString s_Press_to_continue._0044b8c4; undefined4 DAT_0044b8b4; undefined *DAT_0044b8b4; undefined2 DAT_004520c8; undefined4 DAT_004520cc; string s_Oh_boy!_0044b8e4; undefined2 time_xxx_secs_mul_maybe; undefined2 time_begin_period_called; dword time_base; undefined4 paused_time; int DAT_004520d4; uint DAT_004520d4; undefined4 nfnt_list; undefined2 default_nfnt; ushort DAT_004520e0; dword nfnt; string s_Font_%d_not_loaded_0044b8f7; short DAT_0044b8ee; short DAT_004520dc; ushort DAT_004520e2; short DAT_0044b8ec; undefined2 DAT_004520dc; short DAT_0044b8f0; undefined2 DAT_0044b8f0; undefined2 DAT_0044b8ee; short DAT_004514f6; short *workshop_waves_2000; ushort DAT_00452184; aseq_anim_state_struct *workshop_racetrack_aseq; aseq_anim_state_struct *workshop_race_light_red; aseq_anim_state_struct *workshop_race_light_green; aseq_anim_state_struct *workshop_blueprint_expand_aseq; aseq_anim_state_struct *workshop_speak_button_aseq; undefined2 are_voices_enabled_for_workshop; undefined2 workshop_conveyor_num_slots; short DAT_0044b926; ushort DAT_0044b922; int *DAT_00452118; part_chunk *workshop_currently_held_part; undefined2 DAT_00452180; undefined2 DAT_0044b922; part_chunk *workshop_conveyor_cur_part_b; part_chunk *workshop_conveyor_cur_part_a; short DAT_0044b922; short DAT_00452180; undefined4 workshop_veh_parts_list; undefined workshop_veh_parts_sort; workshop_veh_parts_struct *workshop_veh_parts_structs; short DAT_004521d6; aseq_anim_state_struct *workshop_upper_belt_surface_aseq; aseq_anim_state_struct *workshop_lower_belt_surface_aseq; aseq_anim_state_struct *workshop_upper_belt_rollers_aseq; aseq_anim_state_struct *workshop_lower_belt_rollers_aseq; undefined2 DAT_004521ae; undefined2 workshop_periodic_state; undefined2 blue_word1_calc; undefined2 blue_objects_count; undefined4 blue_name; undefined4 blue_object_explanations; undefined4 blue_aseq; undefined4 blue_aseq_related_xxx; undefined4 blue_tooltip_text; undefined4 blue_another_data; undefined2 blue_another_count; undefined4 blue_wave_idxs; undefined4 blue_loaded; dword blue; undefined2 blue_word0_calc; undefined2 DAT_0044b960; short DAT_00452112; undefined2 DAT_0044b910; undefined4 blue_done_aseq; undefined2 DAT_0044b95c; undefined *PTR_s_Level-_0044b964; word[15] blue_idx_list; aseq_anim_state_struct *workshop_blueprint_bg_aseq; short DAT_004521d4; undefined2 DAT_004521d6; undefined2 workshop_conveyor_idx; part_chunk *[20] workshop_conveyor_parts; undefined2 workshop_conveyor_num_slots_minus_1; undefined2 DAT_0044b926; undefined2 DAT_0044b95e; undefined2 DAT_00452184; aseq_anim_state_struct *building_name_aseq; undefined4 sector_aseq; undefined2 DAT_004521d4; aseq_anim_state_struct *workshop_green_tube_anim; short[5] trophy_xpos; short[3] trophy_ypos; undefined FUN_0043f47a; undefined workshop_key_handler; short DAT_0044b95c; ushort DAT_0044b910; short DAT_004521ae; undefined2 *DAT_0045210c; undefined2 DAT_00452110; ushort DAT_00452112; short DAT_00452110; ushort *DAT_0045210c; short DAT_0044b960; int *DAT_00452108; word[15] blue_bg_aseq_idx_list; string s__0044bab8; undefined freeExceptMem; undefined DAT_004521e4; undefined DAT_004521e8; string s_**BCCxh1_0044bac1; pointer PTR_@typeinfo@$bdtr$qv_0044bad8; undefined @$xt$p8typeinfo; undefined DAT_004521ec; undefined @$xt$10Bad_typeid; undefined DAT_004521ed; undefined @$xt$8Bad_cast; undefined _ExceptionHandler; int __debuggerDisableTerminateCallback; string s___GetExceptDLLinfo_0044bc3c; byte _isDll; undefined @terminate$qv; undefined @unexpected$qv; CRITICAL_SECTION dbgDataCS; undefined4 dbgCSInitialized; int DAT_0044bc50; string s_Stack_Overflow!_0044bc54; pointer _HandlerPtr; pointer _UserHandlerPtr; undefined ExcHandler; undefined __DefHandler; undefined4 _ExcRegPtr; FILE[50] _streams; uint _nfile; undefined _xfflush; pointer _exitbuf; undefined *PTR_fmode_0044c1e4; undefined _xfclose; pointer _exitfopen; dword[50] _openfd; undefined FUN_00443600; undefined1 DAT_004523ac; TerminatedCString s_TMP_0044c1e8; TerminatedCString s_.$$$_0044c1ec; undefined temp_dir; undefined FUN_00443dd8; string s_Filename_too_long_0044c648; string s_(null)_0044c670; uint DAT_0044c6e0; undefined4 _ostype; int errno; HANDLE[50] _handles; undefined *PTR_LAB_0044c6dc; undefined FUN_00444cec; int _doserrno; int _sys_nerr; byte[299] _dosErrorToSV; char[256] char_info; undefined DAT_0044c91c; undefined *PTR_FUN_0044c920; dword _default87; string s_printf_:_floating_point_formats_n_0044c92c; undefined *PTR__matherr_0044c988; undefined *PTR__matherrl_0044c98c; undefined4 rand_state; undefined4 rand_state_2; dword _smalloc_threshold; pointer _linktable; undefined *PTR_DAT_0044c9cc; pointer _firstHeap; pointer _lastHeap; dword avail; undefined4 __allocated; dword _virt_heap_size; dword _virt_chunk_size; dword _virt_chunk_size2; dword _virt_chunk_free; dword _virt_chunk_free2; undefined *PTR_DAT_0044c9c4; undefined4 DAT_0044c9c0; int *DAT_0044c9d8; undefined4 DAT_0044c9d8; undefined4 heap_size; undefined threadHasWnd; undefined DAT_0044c9e8; undefined DAT_0044c9eb; byte _isWindows; undefined4 _messagefile; char[24] timestamp_buf; string s_kernel32.dll_0044ca14; string s_GetProcAddress_0044ca21; string s_Abnormal_program_termination_0044ca3c; undefined4[32] teardown_func_array; undefined4 teardown_func_idx; pointer _exitopen; pointer _tenviron; pointer _tenvcopy; int _tenvsize; undefined4 _osenv; string s_Could_not_allocate_memory_for_en_0044ca70; char * *_C0environ; int[10] IxGen; pointer[10] Dispatch; undefined controlc; byte HandlerPtrSet; byte[10] ExplicitVal; int _exe_table_ntables; MODULE_DATA *[2] _exe_table_table; int _isWindows; undefined4 _oscmd; int _C0argc; char * *_C0argv; undefined _dll_table; uint DAT_0044ccd4; undefined DAT_0044ccd0; undefined *PTR_DAT_0044ccc8; undefined *PTR_DAT_0044cccc; undefined1 UNK_0044ccdb; undefined1 UNK_0044ccdc; undefined4 DAT_0044cbac; undefined4 DAT_0044cbb0; int UNK_0044cbbc; int DAT_0044ccd4; undefined DAT_0044cba4; void __stdcall entry(void) { dword *pdVar1; int iVar2; undefined **ppuVar3; undefined2 in_FS; MODULE_DATA *pMVar4; __TLS_index4 = __TLS_index << 2; ppuVar3 = key_xxxxx_array; for (iVar2 = 0x578c; iVar2 != 0; iVar2 = iVar2 + -1) { *(undefined1 *)ppuVar3 = 0; ppuVar3 = (undefined **)((int)ppuVar3 + 1); } pdVar1 = (dword *)segment(in_FS,4); saveStackBase = *pdVar1; saveStackTop[0] = *(dword *)(saveStackBase - 8); saveStackTop[1] = *(dword *)(saveStackBase - 4); __DestructorCountPtr = saveStackBase - 4; _ExceptInit(0); pMVar4 = &MODULE_DATA_0044802c; __hInstance = GetModuleHandleA((LPCSTR)0x0); _startup((int)pMVar4); return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __cdecl __GetExceptDLLinfo(undefined4 *param_1) { int in_FS_OFFSET; // 0x1074 1 __GetExceptDLLinfo ___exceptStaticBuffP = *(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x30; __debuggerWatchingP = (dword)&DAT_0044bbd4; __debuggerHookDataP = (dword)&__DebuggerHookData; *param_1 = 0x82727349; param_1[1] = &__CPPexceptionList; return; } void __stdcall pump_messages_and_get_key_(void) { pump_messages_and_get_key(); return; } void __cdecl key_xxxxx_handler(short param_1) { if (param_1 < 0x100) { key_down_handler_buffered(param_1); if (key_xxxxx_top_handler != (code *)0x0) { (*key_xxxxx_top_handler)(); } } return; } void __cdecl key_xxxxx_set(undefined *param_1) { if (DAT_00448074 == 0) { ptr_on_key_down = key_xxxxx_handler; DAT_00448074 = 1; } key_xxxxx_array[key_xxxxx_idx] = param_1; key_xxxxx_top_handler = param_1; return; } void __stdcall key_xxxxx_clear(void) { key_xxxxx_array[key_xxxxx_idx] = (undefined *)0x0; key_xxxxx_top_handler = 0; return; } void __stdcall key_xxxxx_inc(void) { key_xxxxx_idx = key_xxxxx_idx + 1; key_xxxxx_array[key_xxxxx_idx] = (undefined *)0x0; key_xxxxx_top_handler = 0; return; } void __stdcall key_xxxxx_pop(void) { key_xxxxx_idx = key_xxxxx_idx + -1; key_xxxxx_top_handler = key_xxxxx_array[key_xxxxx_idx]; return; } void __cdecl int_to_dec_with_commas(uint param_1,char *param_2) { int iVar1; int iVar2; int iVar3; char local_2c [20]; char local_18 [20]; itoa(param_1,local_2c,10); iVar3 = 0; iVar2 = 0; iVar1 = strlen(local_2c); switch(iVar1) { case 7: local_18[0] = local_2c[0]; iVar3 = 1; local_18[1] = 0x2c; iVar2 = 2; case 6: local_18[iVar2] = local_2c[iVar3]; iVar3 = iVar3 + 1; iVar2 = iVar2 + 1; case 5: local_18[iVar2] = local_2c[iVar3]; iVar3 = iVar3 + 1; iVar2 = iVar2 + 1; case 4: local_18[iVar2] = local_2c[iVar3]; iVar3 = iVar3 + 1; local_18[iVar2 + 1] = ','; iVar2 = iVar2 + 2; case 3: local_18[iVar2] = local_2c[iVar3]; iVar3 = iVar3 + 1; iVar2 = iVar2 + 1; case 2: local_18[iVar2] = local_2c[iVar3]; iVar3 = iVar3 + 1; iVar2 = iVar2 + 1; case 1: local_18[iVar2] = local_2c[iVar3]; iVar2 = iVar2 + 1; default: local_18[iVar2] = '\0'; strcpy(param_2,local_18); return; } } void __cdecl FUN_00401206(ushort param_1,short param_2,byte *param_3) { FUN_0043e4a1(param_1,param_2,param_3); return; } void __cdecl FUN_00401220(ushort param_1,short param_2,byte *param_3) { byte bVar1; short sVar2; undefined4 uVar3; undefined4 uVar4; ushort uVar5; sVar2 = FUN_0043e4d6(); DAT_0044807e = 0x404; uVar3 = nfnt_get_max_height(-1); uVar5 = param_1; while( true ) { bVar1 = *param_3; param_3 = param_3 + 1; if (bVar1 == 0) break; if ((bVar1 == 10) || (bVar1 == 0xd)) { param_2 = param_2 + (short)uVar3 + sVar2; uVar5 = param_1; } else if ((bVar1 == 0x7c) && (DAT_00448080 != 0)) { DAT_0044807e = FUN_0043e1b5(DAT_0044807e); } else { uVar4 = FUN_0043dc8c(-1,bVar1,uVar5,param_2 + (short)uVar3,0xffff); uVar5 = uVar5 + (short)uVar4; } } return; } void __cdecl get_mouse_xy_relative_(short *param_1,undefined2 *param_2) { undefined4 local_8; get_mouse_xy_relative((short *)&local_8); *param_1 = (short)local_8; *param_2 = local_8._2_2_; return; } void __stdcall toggle_all_sounds(void) { bool bVar1; short sVar2; sVar2 = are_sfx_enabled(); if (sVar2 != 0) { sVar2 = is_bgm_enabled(); if (sVar2 != 0) { sVar2 = are_voices_enabled(); if (sVar2 != 0) { bVar1 = true; goto LAB_0040130b; } } } bVar1 = false; LAB_0040130b: if (bVar1) { set_sfx_enabled(0); set_bgm_enabled(0); set_voices_enabled(0); return; } set_sfx_enabled(1); set_bgm_enabled(1); set_voices_enabled(1); return; } void __cdecl ne_rsrc_close(int param_1) { ushort uVar1; if (param_1 != 0) { uVar1 = (ushort)param_1 & 0x7f; if (ne_rsrc_states[(short)uVar1].hfile != (HANDLE)0x0) { CloseHandle(ne_rsrc_states[(short)uVar1].hfile); ne_rsrc_states[(short)uVar1].hfile = (HANDLE)0x0; } if (ne_rsrc_states[(short)uVar1].hglobal != (HGLOBAL)0x0) { GlobalUnlock(ne_rsrc_states[(short)uVar1].hglobal); GlobalFree(ne_rsrc_states[(short)uVar1].hglobal); ne_rsrc_states[(short)uVar1].hglobal = (HGLOBAL)0x0; } } return; } uint __cdecl ne_rsrc_load_dat_real(LPCSTR param_1) { uint uVar1; BOOL BVar2; int iVar3; int iVar4; undefined2 *puVar5; short sVar6; ushort uVar7; short *psVar8; undefined1 local_68 [36]; ushort local_44; short local_42; ushort local_2c; undefined1 local_28 [6]; undefined4 local_22; DWORD local_1c; DWORD local_18; ushort local_12; undefined2 *local_10; HGLOBAL local_c; HANDLE local_8; sVar6 = 0; do { if (ne_rsrc_states[sVar6].hfile == (HANDLE)0x0) break; sVar6 = sVar6 + 1; } while (sVar6 < 30); if (sVar6 < 30) { local_8 = CreateFileA(param_1,0x80000000,1,(LPSECURITY_ATTRIBUTES)0x0,3,0x80,(HANDLE)0x0); if (local_8 == (HANDLE)0xffffffff) { uVar1 = 0; } else { local_c = (HGLOBAL)0x0; BVar2 = ReadFile(local_8,local_68,0x40,&local_18,(LPOVERLAPPED)0x0); if (BVar2 != 0) { local_12 = local_2c; SetFilePointer(local_8,(uint)local_2c,(PLONG)0x0,0); BVar2 = ReadFile(local_8,local_68,0x40,&local_18,(LPOVERLAPPED)0x0); if (BVar2 != 0) { uVar7 = local_42 - local_44; local_c = GlobalAlloc(0,(uint)uVar7); if (local_c != (HGLOBAL)0x0) { local_10 = GlobalLock(local_c); SetFilePointer(local_8,(uint)local_12 + (uint)local_44,(PLONG)0x0,0); BVar2 = ReadFile(local_8,local_10,(uint)uVar7,&local_18,(LPOVERLAPPED)0x0); if (BVar2 != 0) { uVar7 = local_10[1]; if ((uVar7 & 0x8000) == 0) { *(undefined4 *)(local_10 + 3) = 0; for (iVar3 = 0; iVar3 < *(char *)((int)local_10 + (uint)uVar7); iVar3 = iVar3 + 1) { *(undefined1 *)((int)local_10 + iVar3 + 6) = *(undefined1 *)((int)local_10 + iVar3 + uVar7 + 1); } local_12 = 10; puVar5 = local_10 + 5; for (iVar3 = 0; iVar3 < (int)(uint)(ushort)local_10[2]; iVar3 = iVar3 + 1) { puVar5[3] = puVar5[3] & 0x7fff; puVar5 = puVar5 + 6; } } else { local_12 = 0x16; local_1c = (uint)(ushort)local_10[5] << ((byte)*local_10 & 0x1f); do { psVar8 = (short *)((uint)local_12 + (int)local_10); if (*psVar8 == 0) break; local_1c = SetFilePointer(local_8,local_1c,(PLONG)0x0,0); BVar2 = ReadFile(local_8,local_28,0xc,&local_18,(LPOVERLAPPED)0x0); if (BVar2 != 0) { *(undefined4 *)(psVar8 + 2) = local_22; local_12 = local_12 + 8; iVar4 = (uint)local_12 + (int)local_10; for (iVar3 = 0; iVar3 < (int)(uint)(ushort)psVar8[1]; iVar3 = iVar3 + 1) { *(ushort *)(iVar4 + 6) = *(ushort *)(iVar4 + 6) & 0x7fff; *(undefined4 *)(iVar4 + 8) = local_22; iVar4 = iVar4 + 0xc; local_12 = local_12 + 0xc; local_1c = local_1c + (0xc - (uint)(local_22._3_1_ == '\0')); } } } while (psVar8[1] != 0); } } GlobalUnlock(local_c); } } } ne_rsrc_states[sVar6].hfile = local_8; ne_rsrc_states[sVar6].hglobal = local_c; uVar1 = (int)sVar6 | 0x80; } } else { uVar1 = 0; } return uVar1; } uint __cdecl ne_rsrc_find(int param_1,short param_2,int *param_3) { ushort uVar1; LPVOID pvVar2; int iVar3; int iVar4; short *psVar5; short sVar6; ushort uVar7; uint uVar8; if (param_1 != 0) { iVar4 = *param_3; uVar1 = (ushort)param_1 & 0x7f; pvVar2 = GlobalLock(ne_rsrc_states[(short)uVar1].hglobal); if ((*(ushort *)((int)pvVar2 + 2) & 0x8000) == 0) { if (*(int *)((int)pvVar2 + 6) == iVar4) { uVar7 = 10; iVar4 = (int)pvVar2 + 10; for (sVar6 = 0; (int)sVar6 < (int)(uint)*(ushort *)((int)pvVar2 + 4); sVar6 = sVar6 + 1) { if (*(short *)(iVar4 + 6) == param_2) { GlobalUnlock(ne_rsrc_states[(short)uVar1].hglobal); return (uint)uVar7; } iVar4 = iVar4 + 0xc; uVar7 = uVar7 + 0xc; } } } else { uVar8 = 0x16; do { psVar5 = (short *)(uVar8 + (int)pvVar2); if (*psVar5 == 0) break; uVar7 = (short)uVar8 + 8; uVar8 = (uint)uVar7; if (*(int *)(psVar5 + 2) == iVar4) { iVar3 = uVar8 + (int)pvVar2; for (sVar6 = 0; (int)sVar6 < (int)(uint)(ushort)psVar5[1]; sVar6 = sVar6 + 1) { if (*(short *)(iVar3 + 6) == param_2) { GlobalUnlock(ne_rsrc_states[(short)uVar1].hglobal); return uVar8; } iVar3 = iVar3 + 0xc; uVar8 = (uint)(ushort)((short)uVar8 + 0xc); } } else { uVar8 = (uint)(ushort)(uVar7 + psVar5[1] * 0xc); } } while (psVar5[1] != 0); } GlobalUnlock(ne_rsrc_states[(short)uVar1].hglobal); } return 0; } HGLOBAL __cdecl ne_rsrc_load(int param_1,ushort param_2) { undefined2 uVar1; ushort uVar2; undefined2 *puVar3; HGLOBAL hMem; BOOL BVar4; ushort uVar5; SIZE_T dwBytes; DWORD local_c; LPVOID local_8; if (param_1 == 0) { hMem = (HGLOBAL)0x0; } else { uVar5 = (ushort)param_1 & 0x7f; puVar3 = GlobalLock(ne_rsrc_states[(short)uVar5].hglobal); uVar1 = *puVar3; uVar2 = *(ushort *)((int)puVar3 + (uint)param_2); dwBytes = (uint)((ushort *)((int)puVar3 + (uint)param_2))[1] << ((byte)*puVar3 & 0x1f); hMem = GlobalAlloc(0,dwBytes); if (hMem != (HGLOBAL)0x0) { local_8 = GlobalLock(hMem); SetFilePointer(ne_rsrc_states[(short)uVar5].hfile,(uint)uVar2 << ((byte)uVar1 & 0x1f), (PLONG)0x0,0); BVar4 = ReadFile(ne_rsrc_states[(short)uVar5].hfile,local_8,dwBytes,&local_c,(LPOVERLAPPED)0x0 ); GlobalUnlock(hMem); if (BVar4 == 0) { GlobalFree(hMem); hMem = (HGLOBAL)0x0; } } GlobalUnlock(ne_rsrc_states[(short)uVar5].hglobal); } return hMem; } LPVOID __cdecl wrapped_globallock(HGLOBAL param_1) { LPVOID pvVar1; if (param_1 != (HGLOBAL)0x0) { pvVar1 = GlobalLock(param_1); return pvVar1; } return (LPVOID)0x0; } BOOL __cdecl wrapped_globalunlock(HGLOBAL param_1) { BOOL BVar1; if (param_1 != (HGLOBAL)0x0) { BVar1 = GlobalUnlock(param_1); return BVar1; } return 0; } undefined4 __cdecl wrapped_globalfree(HGLOBAL param_1) { if (param_1 != (HGLOBAL)0x0) { GlobalFree(param_1); } return 0; } int __cdecl ne_rsrc_set_xxx_pos(int param_1,ushort param_2) { undefined2 *puVar1; ushort uVar2; if (param_1 != 0) { uVar2 = (ushort)param_1 & 0x7f; puVar1 = GlobalLock(ne_rsrc_states[(short)uVar2].hglobal); ne_rsrc_states[(short)uVar2]._xxx_file_pos = (uint)*(ushort *)((int)puVar1 + (uint)param_2) << ((byte)*puVar1 & 0x1f); GlobalUnlock(ne_rsrc_states[(short)uVar2].hglobal); } return param_1; } undefined4 __cdecl retarg(undefined4 param_1) { return param_1; } DWORD __cdecl ne_rsrc_read(int param_1,LPVOID param_2,DWORD param_3) { BOOL BVar1; ushort uVar2; DWORD local_8; if (param_1 != 0) { uVar2 = (ushort)param_1 & 0x7f; SetFilePointer(ne_rsrc_states[(short)uVar2].hfile,ne_rsrc_states[(short)uVar2]._xxx_file_pos, (PLONG)0x0,0); BVar1 = ReadFile(ne_rsrc_states[(short)uVar2].hfile,param_2,param_3,&local_8,(LPOVERLAPPED)0x0); if ((short)BVar1 == 0) { param_3 = 0; } ne_rsrc_states[(short)uVar2]._xxx_file_pos = ne_rsrc_states[(short)uVar2]._xxx_file_pos + local_8; } return param_3; } undefined4 __cdecl more_precise_div_xxx(int param_1,int param_2) { return (int)(CONCAT44(param_1 >> 0x10,param_1 << 0x10) / (longlong)param_2); } DWORD __stdcall timeGetTime(void) { DWORD DVar1; DVar1 = timeGetTime(); return DVar1; } void __cdecl FUN_00401962(short param_1,short param_2,ushort param_3) { HBRUSH hbr; HDC hDC; RECT local_14; hbr = CreateSolidBrush(param_3 | 0x1000000); hDC = GetDC(main_hwnd); local_14.left = (LONG)param_1; local_14.top = (LONG)param_2; local_14.right = param_1 + 0x14; local_14.bottom = param_2 + 0x14; FillRect(hDC,&local_14,hbr); ReleaseDC(main_hwnd,hDC); DeleteObject(hbr); return; } void __cdecl win9x_hideshow_traywnd(short param_1) { HWND hWnd; if (dwPlatformId == 1) { hWnd = FindWindowA(s_Shell_TrayWnd_004480b4,(LPCSTR)0x0); ShowWindow(hWnd,(uint)(param_1 != 0)); } return; } ATOM __stdcall create_window(void) { ATOM AVar1; WNDCLASSEXA local_34; local_34.lpszClassName = s_TLCSSG_00448092; local_34.lpszMenuName = (LPCSTR)0x100; local_34.style = 0x1040; local_34.hInstance = instance; local_34.lpfnWndProc = MainWndProc; local_34.hCursor = (HCURSOR)0x0; local_34.hIcon = LoadIconA(instance,(LPCSTR)0x80); local_34.hbrBackground = GetStockObject(1); local_34.cbClsExtra = 0; local_34.cbWndExtra = 0; local_34.cbSize = 0x30; if (dwPlatformId == 2) { local_34.hIconSm = (HICON)0x0; } else { local_34.hIconSm = LoadIconA(instance,(LPCSTR)0x81); } AVar1 = RegisterClassExA(&local_34); win9x_hideshow_traywnd(0); if (AVar1 != 0) { main_hwnd = CreateWindowExA(0,s_TLCSSG_00448092,s_Gizmos___Gadgets__CD_00448099,0xca0000, desktop_rect.left,desktop_rect.top,desktop_rect.right, desktop_rect.bottom,(HWND)0x0,(HMENU)0x0,instance,(LPVOID)0x0); if (main_hwnd == (HWND)0x0) { AVar1 = 0; } else { ShowWindow(main_hwnd,1); UpdateWindow(main_hwnd); } } return AVar1; } void __stdcall destroy_window(void) { win9x_hideshow_traywnd(1); if (main_hwnd != (HWND)0x0) { DestroyWindow(main_hwnd); UnregisterClassA(s_TLCSSG_00448092,instance); main_hwnd = (HWND)0x0; } return; } void __stdcall set_gfx_base_pos_xxx(void) { int iVar1; int iVar2; int iVar3; int iVar4; int cy; uint uVar5; UINT uFlags; iVar1 = GetSystemMetrics(SM_CYCAPTION); iVar2 = GetSystemMetrics(SM_CYMENU); GetSystemMetrics(SM_CYSCREEN); iVar3 = GetSystemMetrics(0); iVar4 = GetSystemMetrics(SM_CYSCREEN); uFlags = 6; cy = GetSystemMetrics(SM_CYSCREEN); SetWindowPos(main_hwnd,(HWND)0x0,0,0,(int)(short)iVar3,cy,uFlags); uVar5 = (int)(short)iVar3 - 0x200; iVar3 = (int)uVar5 >> 1; if (iVar3 < 0) { iVar3 = iVar3 + (uint)((uVar5 & 1) != 0); } mouse_xbase = iVar3 + desktop_rect.left; uVar5 = (int)(short)(((short)iVar4 - (short)iVar2) - (short)iVar1) - 0x180; iVar1 = (int)uVar5 >> 1; if (iVar1 < 0) { iVar1 = iVar1 + (uint)((uVar5 & 1) != 0); } mouse_ybase = iVar1 + desktop_rect.top; mouse_ymovebase = mouse_ymovebase + 0x1ff; DWORD_0044ceb0 = mouse_ybase + 0x17f; set_paint_offs((undefined2)mouse_xbase,(undefined2)mouse_ybase); return; } undefined4 __stdcall WinMain(undefined4 param_1,int param_2) { ATOM AVar1; HWND pHVar2; undefined4 uVar3; BOOL BVar4; short sVar5; tagRECT *lpRect; tagMSG local_b4; _OSVERSIONINFOA local_98; if ((param_2 == 0) && (pHVar2 = FindWindowA(s_TLCSSG_00448092,(LPCSTR)0x0), pHVar2 != (HWND)0x0)) { IsIconic(pHVar2); ShowWindow(pHVar2,9); SetForegroundWindow(pHVar2); return 0; } local_98.dwOSVersionInfoSize = 0x94; GetVersionExA(&local_98); dwPlatformId = local_98.dwPlatformId; instance = param_1; lpRect = &desktop_rect; pHVar2 = GetDesktopWindow(); GetWindowRect(pHVar2,lpRect); sVar5 = (short)desktop_rect.bottom - (short)desktop_rect.top; AVar1 = create_window(); if (AVar1 != 0) { WORD_0044cec4 = sVar5 - ((short)desktop_rect.bottom - (short)desktop_rect.top); atexit(destroy_window); uVar3 = load_and_set_up_stuff(); if ((short)uVar3 != 0) { is_active = 1; do { do { xxxfunc_run(); xxx_periodic_loop(); BVar4 = PeekMessageA(&local_b4,(HWND)0x0,0,0,1); } while (BVar4 == 0); TranslateMessage(&local_b4); DispatchMessageA(&local_b4); } while( true ); } } destroy_window(); return 0; } void __cdecl wrap_paint(HWND param_1) { tagPAINTSTRUCT local_44; BeginPaint(param_1,&local_44); (*(code *)ptr_paint_func)(); EndPaint(param_1,&local_44); return; } LRESULT __stdcall MainWndProc(HWND param_1,UINT param_2,uint param_3,uint param_4) { ushort uVar1; short sVar2; HMENU hMenu; uint uVar3; LRESULT LVar4; UINT uEnable; tagPOINT local_18; tagPOINT local_10; BOOL local_8; // 0x1d4c 2 MainWndProc local_8 = IsIconic(param_1); if ((int)param_2 < 0x102) { if (param_2 != 0x101) { if ((int)param_2 < 0x15) { if (param_2 == 0x14) { return 1; } switch(param_2) { case 1: PostMessageA(param_1,WM_USER,0,0); break; case 2: PostQuitMessage(0); got_wm_destroy = 0xffff; return 0; case 6: if (((param_3 != 0) && ((short)(param_4 >> 0x10) == 0)) && (is_active == 0)) { is_active = 1; win9x_hideshow_traywnd(0); gfxish_invalidate_rect((short *)0x0); (*(code *)ptr_on_activate)(); need_reset_gfx_base_pos = 1; InvalidateRect(main_hwnd,(RECT *)0x0,0); } break; case 0xf: if (need_reset_gfx_base_pos != 0) { need_reset_gfx_base_pos = 0; set_gfx_base_pos_xxx(); } wrap_paint(param_1); break; case 0x10: (*(code *)ptr_on_close)(); return 0; case 0x11: if (local_8 != 0) { ShowWindow(param_1,9); } SetForegroundWindow(param_1); sVar2 = (*(code *)ptr_on_close)(); return (int)sVar2; } } else if ((int)param_2 < WM_DISPLAYCHANGE + 1) { if (param_2 != WM_DISPLAYCHANGE) { if (param_2 == WM_ACTIVATEAPP) { if (param_3 == 0) { if (is_active != 0) { win9x_hideshow_traywnd(1); (*(code *)ptr_on_deactivate)(); } is_active = 0; } } else if (param_2 == 0x47) { return 0; } } } else if ((param_2 != 0x86) && (param_2 == 0x100)) { GetAsyncKeyState(VK_SHIFT); down_key = 0; if ((param_4 & 0x40000000) == 0) { if ((0x20 < param_3) && (param_3 < 0x29)) { down_key = (short)param_3; (*(code *)ptr_on_key_down)(); return 0; } if ((0x6f < param_3) && (param_3 < 0x88)) { down_key = (short)param_3; (*(code *)ptr_on_key_down)(); return 0; } } } } } else if ((int)param_2 < 0x118) { if (param_2 != 0x117) { if ((int)param_2 < WM_SYSCOMMAND + 1) { if (param_2 == WM_SYSCOMMAND) { uVar3 = param_3 & 0xfff0; if (uVar3 == 2000) { (*(code *)ptr_on_sysmenu_about)(); return 0; } if (uVar3 == 0xf010) { if (local_8 == 0) { return 0; } } else if (uVar3 == 0xf060) { (*(code *)ptr_on_close)(); return 0; } } else if (param_2 == WM_CHAR) { uVar1 = GetAsyncKeyState(VK_CONTROL); if (((uVar1 & 0x8000) != 0) && (sVar2 = (*(code *)ptr_wm_char_filter)(), sVar2 != 0)) { return 0; } entered_char = param_3; down_key = 0; (*(code *)ptr_on_key_down)(); } else if (param_2 == 0x111) { (*(code *)ptr_on_wmcommand)(); } } else { if (param_2 == WM_VSCROLL) { return 0; } if (param_2 == 0x116) { hMenu = GetSystemMenu(param_1,0); uEnable = 0; if (local_8 == 0) { uEnable = 3; } EnableMenuItem(hMenu,SC_MOVE,uEnable); if (local_8 == 0) { (*(code *)ptr_wm_initmenu)(); } } } } } else if ((int)param_2 < WM_LBUTTONDOWN + 1) { if (param_2 == WM_LBUTTONDOWN) { if (repost_mouse_downup != 0) { PostMessageA(param_1,WM_LBUTTONDOWN,param_3,param_4); return 0; } GetCursorPos(&local_10); ScreenToClient(param_1,&local_10); mouse_x = local_10.x - mouse_xbase; mouse_y = local_10.y - mouse_ybase; down_key = -0x8000; (*(code *)ptr_on_mouse_down)(); mouse_is_down = 1; } else if (param_2 == WM_MENUSELECT) { if (((param_4 == 0) && ((short)(param_3 >> 0x10) == -1)) && (local_8 == 0)) { (*(code *)ptr_wm_menuselect)(); } } else if (param_2 == 0x200) { mouse_x = (param_4 & 0xffff) - mouse_xbase; mouse_y = (param_4 >> 0x10) - mouse_ymovebase; return 0; } } else if (param_2 == WM_LBUTTONUP) { if (mouse_is_down != 0) { if (repost_mouse_downup != 0) { PostMessageA(param_1,WM_LBUTTONUP,param_3,param_4); return 0; } GetCursorPos(&local_18); ScreenToClient(param_1,&local_18); mouse_x = local_18.x - mouse_xbase; mouse_y = local_18.y - mouse_ybase; down_key = -0x8000; (*(code *)ptr_on_mouse_up)(); mouse_is_down = 0; } } else if (param_2 == 0x400) { if (local_8 == 0) { SetActiveWindow(param_1); } else { ShowWindow(param_1,9); } } LVar4 = DefWindowProcA(param_1,param_2,param_3,param_4); return LVar4; } int __stdcall pump_some_messages(void) { BOOL BVar1; int iVar2; short sVar3; tagMSG local_20; iVar2 = 0; sVar3 = 50; do { BVar1 = PeekMessageA(&local_20,(HWND)0x0,0,0,1); if (BVar1 == 0) { sVar3 = 0; } else { iVar2 = iVar2 + 1; TranslateMessage(&local_20); DispatchMessageA(&local_20); sVar3 = sVar3 + -1; } } while ((is_active == 0) || (sVar3 != 0)); if ((short)iVar2 == 0) { (*(code *)ptr_on_pump_messages_448120)(); } (*(code *)ptr_on_pump_messages_448124)(); return iVar2; } short __stdcall FUN_00402321(void) { BOOL BVar1; HWND pHVar2; tagMSG local_20; down_key = 0; do { BVar1 = PeekMessageA(&local_20,(HWND)0x0,0,0,1); if (BVar1 != 0) { TranslateMessage(&local_20); DispatchMessageA(&local_20); } BVar1 = IsIconic(main_hwnd); if (BVar1 == 0) { pHVar2 = GetActiveWindow(); if (pHVar2 != main_hwnd) goto LAB_00402373; } else { LAB_00402373: DAT_0044808c = 4; } if ((DAT_0044808c < 1) || (DAT_0044808c = DAT_0044808c + -1, got_wm_destroy == -1)) { return down_key; } } while( true ); } void __stdcall nullishsub(void) { return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __stdcall FUN_004023a6(void) { _DAT_00448088 = 1; return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __stdcall FUN_004023b0(void) { _DAT_00448088 = 0; return; } int __cdecl load_cached_cursor(ushort param_1) { HCURSOR pHVar1; short sVar2; int iVar3; iVar3 = 0; while( true ) { sVar2 = (short)iVar3; if (num_sys_cursors <= sVar2) { if (sVar2 != 10) { sys_cursors[sVar2].idx = param_1; pHVar1 = LoadCursorA(instance,(LPCSTR)(uint)param_1); sys_cursors[sVar2].hcursor = pHVar1; num_sys_cursors = num_sys_cursors + 1; } return iVar3; } if (param_1 == sys_cursors[sVar2].idx) break; iVar3 = iVar3 + 1; } return iVar3; } void __cdecl set_cursor(ushort param_1) { HCURSOR pHVar1; int iVar2; if (param_1 == 0xffff) { pHVar1 = LoadCursorA((HINSTANCE)0x0,(LPCSTR)IDC_WAIT); SetCursor(pHVar1); return; } if (param_1 == 0) { pHVar1 = LoadCursorA((HINSTANCE)0x0,(LPCSTR)IDC_ARROW); SetCursor(pHVar1); return; } iVar2 = load_cached_cursor(param_1); SetCursor(sys_cursors[(short)iVar2].hcursor); return; } void __stdcall destroy_cursors(void) { short sVar1; set_cursor(0); for (sVar1 = 0; sVar1 < num_sys_cursors; sVar1 = sVar1 + 1) { DestroyCursor(sys_cursors[sVar1].hcursor); } num_sys_cursors = 0; return; } void __cdecl add_system_menu_2000(LPCSTR param_1) { HMENU hMenu; hMenu = GetSystemMenu(main_hwnd,0); InsertMenuA(hMenu,0,MF_BYPOSITION,2048,(LPCSTR)0x0); InsertMenuA(hMenu,0,MF_BYPOSITION,2000,param_1); return; } void __cdecl wrapped_loadstring(short param_1,LPSTR param_2,short param_3) { LoadStringA(instance,(int)param_1,param_2,(int)param_3); return; } int mul_by_512_edi(int param_1) { return param_1 << 9; } // WARNING: Unknown calling convention -- yet parameter storage is locked int mul_by_512_esi(int param_1,int param_2) { return param_1 << 9; } int calc_383_minus_arg_all_times_512_edi(short param_1) { return (uint)(ushort)(0x17f - param_1) << 9; } // WARNING: Unknown calling convention -- yet parameter storage is locked int calc_383_minus_arg_all_times_512_esi(short param_1,int param_2) { return (uint)(ushort)(0x17f - param_1) << 9; } void __stdcall gfxish_save_rect(undefined2 *param_1,undefined2 *param_2) { undefined2 uVar1; undefined2 uVar2; undefined2 uVar3; uVar1 = param_1[1]; uVar2 = param_1[2]; uVar3 = param_1[3]; *param_2 = *param_1; param_2[1] = uVar1; param_2[2] = uVar2; param_2[3] = uVar3; // WARNING: Could not recover jumptable at 0x00402569. Too many branches // WARNING: Treating indirect jump as call (*(code *)ptr_gfxish_save_rect)(); return; } void __stdcall gfxish_copy_block(void) { // WARNING: Could not recover jumptable at 0x004025bb. Too many branches // WARNING: Treating indirect jump as call (*(code *)ptr_gfxish_copy_block)(); return; } void __stdcall gfxish_line_h(void) { // WARNING: Could not recover jumptable at 0x0040264e. Too many branches // WARNING: Treating indirect jump as call (*(code *)ptr_gfxish_line_h)(); return; } void __stdcall gfxish_line_v(void) { // WARNING: Could not recover jumptable at 0x00402692. Too many branches // WARNING: Treating indirect jump as call (*(code *)ptr_gfxish_line_v)(); return; } void __stdcall gfxish_set_px(void) { // WARNING: Could not recover jumptable at 0x004026d5. Too many branches // WARNING: Treating indirect jump as call (*(code *)ptr_gfxish_set_px)(); return; } void __stdcall broken_gfxish_get_px(word x,word y) { (*(code *)ptr_gfxish_edi_calc_y)(y); return; } void gfxish_decode_xxx(undefined4 param_1,undefined4 param_2,undefined4 param_3,int param_4) { // WARNING: Could not recover jumptable at 0x00402746. Too many branches // WARNING: Treating indirect jump as call (*(code *)ptr_gfxish_decode_xxx)(param_1,*(undefined2 *)(param_4 + 4)); return; } void __stdcall gfxish_fill_rect(void) { // WARNING: Could not recover jumptable at 0x004027a9. Too many branches // WARNING: Treating indirect jump as call (*(code *)ptr_gfxish_fill_rect)(); return; } void __stdcall gfxish_draw_sprite_normal(void) { // WARNING: Could not recover jumptable at 0x004027fe. Too many branches // WARNING: Treating indirect jump as call (*(code *)ptr_gfxish_draw_sprite_normal)(); return; } void __stdcall gfxish_draw_sprite_flipped(void) { // WARNING: Could not recover jumptable at 0x00402b03. Too many branches // WARNING: Treating indirect jump as call (*(code *)ptr_gfxish_draw_sprite_flipped)(); return; } void asm_copy_gfxish_memory(undefined4 param_1,short param_2,uint param_3) { uint uVar1; short unaff_BX; undefined2 *unaff_ESI; undefined2 *puVar2; undefined2 *unaff_EDI; undefined2 *puVar3; do { puVar2 = unaff_ESI; puVar3 = unaff_EDI; for (uVar1 = param_3 >> 1; uVar1 != 0; uVar1 = uVar1 - 1) { *puVar3 = *puVar2; puVar2 = puVar2 + 1; puVar3 = puVar3 + 1; } if ((param_3 & 1) != 0) { *(undefined1 *)puVar3 = *(undefined1 *)puVar2; } unaff_EDI = (undefined2 *)((int)unaff_EDI + (int)unaff_BX); unaff_ESI = (undefined2 *)((int)unaff_ESI + (int)unaff_BX); param_2 = param_2 + -1; } while (param_2 != 0); return; } void asm_copy_gfxish_memory_backwards(undefined4 param_1,short param_2,int param_3) { int iVar1; short unaff_BX; undefined1 *unaff_ESI; undefined1 *puVar2; undefined1 *unaff_EDI; undefined1 *puVar3; iVar1 = param_3; puVar3 = unaff_EDI; puVar2 = unaff_ESI; do { for (; iVar1 != 0; iVar1 = iVar1 + -1) { *unaff_EDI = *unaff_ESI; unaff_ESI = unaff_ESI + -1; unaff_EDI = unaff_EDI + -1; } unaff_EDI = puVar3 + unaff_BX; unaff_ESI = puVar2 + unaff_BX; param_2 = param_2 + -1; iVar1 = param_3; puVar3 = unaff_EDI; puVar2 = unaff_ESI; } while (param_2 != 0); return; } void __stdcall gfxish_copy_dest_to_otherbuf(void) { // WARNING: Could not recover jumptable at 0x00402e46. Too many branches // WARNING: Treating indirect jump as call (*(code *)ptr_gfxish_copy_dest_to_otherbuf)(); return; } void __stdcall gfxish_copy_otherbuf_to_dest(void) { // WARNING: Could not recover jumptable at 0x00402e9e. Too many branches // WARNING: Treating indirect jump as call (*(code *)ptr_gfxish_copy_otherbuf_to_dest)(); return; } void __stdcall gfxish_copy_between_bufs(word backwards,gfx_rect *destbuf_rect,gfx_rect *otherbuf_rect) { // WARNING: Could not recover jumptable at 0x00402ef4. Too many branches // WARNING: Treating indirect jump as call (*(code *)ptr_gfxish_copy_between_bufs)(); return; } undefined4 gfxish_setup_pointers (undefined4 param_1,undefined4 param_2,undefined4 param_3,short param_4,short param_5) { if ((param_4 == 1) || (param_5 != -1)) { gfxish_stride = -0x200; ptr_gfxish_draw_sprite_normal = &gfxish_draw_sprite_normal_bottom_up; ptr_gfxish_draw_sprite_flipped = &gfxish_draw_sprite_flipped_bottom_up; ptr_gfxish_edi_calc_y = calc_383_minus_arg_all_times_512_edi; ptr_gfxish_esi_calc_y = calc_383_minus_arg_all_times_512_esi; ptr_gfxish_copy_block = &gfxish_copy_block_bottom_up; } else { gfxish_stride = 0x200; ptr_gfxish_draw_sprite_normal = &gfxish_draw_sprite_normal_top_down; ptr_gfxish_draw_sprite_flipped = &gfxish_draw_sprite_flipped_top_down; ptr_gfxish_edi_calc_y = mul_by_512_edi; ptr_gfxish_esi_calc_y = mul_by_512_esi; ptr_gfxish_copy_block = &gfxish_copy_block_top_down; } ptr_gfxish_fill_rect = &gfxish_fill_rect_real; ptr_gfxish_line_h = &gfxish_line_h_real; ptr_gfxish_line_v = &gfxish_line_v_real; ptr_gfxish_set_px = &gfxish_set_px_real; ptr_gfxish_save_rect = &gfxish_save_rect_real; ptr_gfxish_copy_dest_to_otherbuf = &gfxish_copy_dest_to_otherbuf_real; ptr_gfxish_copy_otherbuf_to_dest = &gfxish_copy_otherbuf_to_dest_real; ptr_gfxish_copy_between_bufs = &gfxish_copy_between_bufs_real; ptr_gfxish_decode_xxx = &gfxish_decode_xxx_real; return param_1; } void __cdecl fill_light_grey(HDC param_1,RECT *param_2) { HBRUSH hbr; hbr = GetStockObject(1); FillRect(param_1,param_2,hbr); return; } void __stdcall nullishsub(void) { return; } void __stdcall nullishsub(void) { return; } void __stdcall nullsub(void) { return; } undefined4 __stdcall ret0(void) { return 0; } void __stdcall ao_runtime_error(void) { fatal_message(s_AO_Runtime_Error____d_00448152); return; } short __cdecl anim_state_xxx_list_sort(int param_1,int param_2) { return *(short *)(param_2 + 0xc) - *(short *)(param_1 + 0xc); } short __cdecl anim_engine_drawn_images_compare(int param_1,int param_2) { return *(short *)(param_2 + 10) - *(short *)(param_1 + 10); } undefined4 __cdecl test_intersect_rect(short *param_1,short *param_2) { undefined4 uVar1; if (((((short)(*param_2 + param_2[2] + -1) < *param_1) || ((short)(*param_1 + param_1[2] + -1) < *param_2)) || ((short)(param_2[1] + param_2[3] + -1) < param_1[1])) || ((short)(param_1[1] + param_1[3] + -1) < param_2[1])) { uVar1 = 0; } else { uVar1 = CONCAT22((short)((uint)param_1 >> 0x10),1); } return uVar1; } // b0 = intersects // b1 = lr_adjusted // b2 = tb_adjusted uint __cdecl intersect_rects(short *param_1,short *param_2) { short sVar1; int iVar2; uint uVar3; int iVar4; int iVar5; int iVar6; int iVar7; short sVar8; int iVar9; int iVar10; int local_8; uVar3 = 0; iVar4 = (int)*param_1; iVar5 = iVar4 + param_1[2] + -1; iVar6 = (int)param_1[1]; iVar7 = iVar6 + param_1[3] + -1; iVar2 = (int)*param_2; local_8 = iVar2 + param_2[2] + -1; iVar9 = (int)param_2[1]; iVar10 = iVar9 + param_2[3] + -1; if ((((iVar4 <= local_8) && (iVar2 <= iVar5)) && (iVar6 <= iVar10)) && (iVar9 <= iVar7)) { uVar3 = 1; sVar1 = *param_2; if (iVar2 < iVar4) { uVar3 = 3; sVar1 = *param_1; } if (iVar5 < local_8) { uVar3 = uVar3 | 2; local_8 = iVar5; } sVar8 = param_2[1]; if (iVar9 <= iVar6) { uVar3 = uVar3 | 4; sVar8 = param_1[1]; } if (iVar7 <= iVar10) { uVar3 = uVar3 | 4; iVar10 = iVar7; } if ((uVar3 & 6) != 0) { *param_2 = sVar1; param_2[1] = sVar8; param_2[2] = ((short)local_8 - sVar1) + 1; param_2[3] = ((short)iVar10 - sVar8) + 1; } } return uVar3; } int * __stdcall anim_engine_get_new_drawn_image_obj(void) { int *piVar1; piVar1 = (int *)deref_next_if_not_null(&anim_engine_avail_drawn_images->next); if (piVar1 == (int *)0x0) { ao_runtime_error(); } linked_list_unlink((int *)anim_engine_avail_drawn_images,piVar1); return piVar1; } void __cdecl anim_engine_return_drawn_img_obj(int *param_1) { param_1[8] = 0; linked_list_unlink((int *)anim_engine_drawn_images_list,param_1); linked_list_insert((int *)anim_engine_avail_drawn_images,param_1,0xffff); return; } void __cdecl anim_drawn_img_offset_xy(short param_1,short param_2,short param_3) { word *pwVar1; anim_engine_drawn_image_ARRAY_0044cf2c[param_1].rect.x = anim_engine_drawn_image_ARRAY_0044cf2c[param_1].rect.x + param_2; pwVar1 = &anim_engine_drawn_image_ARRAY_0044cf2c[param_1].rect.y; *pwVar1 = *pwVar1 + param_3; return; } void __cdecl anim_engine_xxx_boop_drawn_images_for_state(int param_1) { short sVar1; int iVar2; undefined4 uVar3; undefined4 *puVar4; short *psVar5; undefined4 local_2c [3]; ushort local_20; short local_1e [11]; short local_8; short local_6; local_8 = 0; psVar5 = *(short **)(param_1 + 0x6a); for (local_6 = 0; local_6 < *(short *)(param_1 + 0x58); local_6 = local_6 + 1) { sVar1 = *psVar5; memcpy(local_2c,(undefined4 *)(anim_engine_drawn_image_ARRAY_0044cf2c + sVar1),0x24); if (((local_20 & 0x10) == 0) && ((local_20 & 0x106) != 0)) { gfxish_copy_otherbuf_to_dest(); gfxish_invalidate_rect(local_1e); for (iVar2 = deref_prev((int)local_2c); iVar2 != 0; iVar2 = deref_prev(iVar2)) { uVar3 = test_intersect_rect(local_1e,(short *)(iVar2 + 0xe)); if ((short)uVar3 != 0) { *(ushort *)(iVar2 + 0xc) = *(ushort *)(iVar2 + 0xc) | 0x40; } } for (puVar4 = (undefined4 *)deref_next(local_2c); puVar4 != (undefined4 *)0x0; puVar4 = (undefined4 *)deref_next(puVar4)) { uVar3 = test_intersect_rect(local_1e,(short *)((int)puVar4 + 0xe)); if ((short)uVar3 != 0) { *(ushort *)(puVar4 + 3) = *(ushort *)(puVar4 + 3) | 0x40; } } } if ((local_20 & 0xa) != 0) { anim_engine_return_drawn_img_obj((int *)(anim_engine_drawn_image_ARRAY_0044cf2c + sVar1)); local_8 = local_8 + 1; } psVar5 = psVar5 + 1; } *(short *)(param_1 + 0x58) = *(short *)(param_1 + 0x58) - local_8; return; } void __stdcall anim_drawn_images_draw_all(void) { ushort uVar1; linked_list_head *plVar2; undefined4 *puVar3; undefined4 uVar4; linked_list_head *plVar5; undefined4 extraout_EDX; undefined4 extraout_EDX_00; undefined4 extraout_EDX_01; linked_list_head *plVar6; plVar5 = anim_engine_drawn_images_list; plVar2 = (linked_list_head *)deref_next_if_not_null(&anim_engine_drawn_images_list->next); uVar4 = extraout_EDX; while (plVar6 = plVar2, plVar6 != (linked_list_head *)0x0) { uVar1 = *(ushort *)&plVar6[1].prev; if ((uVar1 & 0x45) != 0) { if ((uVar1 & 0x200) != 0) { draw_sprite_rect_xend = (drawn_images_specific_rect.x + drawn_images_specific_rect.w) - 1; draw_sprite_rect_yend = (drawn_images_specific_rect.y + drawn_images_specific_rect.h) - 1; draw_sprite_rect_xstart = drawn_images_specific_rect.x; draw_sprite_rect_ystart = drawn_images_specific_rect.y; } if (*(int *)((int)&plVar6[2].prev + 2) != 0) { if ((uVar1 & 5) != 0) { plVar5 = (linked_list_head *)((int)&plVar6[1].prev + 2); gfxish_invalidate_rect((short *)plVar5); uVar4 = extraout_EDX_00; } if ((uVar1 & 0x400) != 0) { plVar2 = plVar6[4].next; (*(code *)plVar2[6].next)(plVar2,uVar4,plVar5,plVar2); } if ((uVar1 & 0xa0) == 0) { gfxish_draw_sprite_normal(); } else if ((uVar1 & 0xa0) == 0x20) { gfxish_draw_sprite_bounds_checked (*(short *)((int)&plVar6[3].next + 2),*(short *)&plVar6[3].prev, *(int *)((int)&plVar6[2].prev + 2)); } else if ((uVar1 & 0xa0) == 0x80) { gfxish_draw_sprite_flipped(); } if ((uVar1 & 8) != 0) { set_gfxish_dest_other(); if ((uVar1 & 0xa0) == 0) { gfxish_draw_sprite_normal(); } else if (((uVar1 & 0xa0) != 0x20) && ((uVar1 & 0xa0) == 0x80)) { gfxish_draw_sprite_flipped(); } set_gfxish_dest(); } } if ((uVar1 & 0x800) != 0) { (**(code **)((int)&plVar6[4].next[6].prev + 2))(); } if ((uVar1 & 0x10) == 0) { for (puVar3 = (undefined4 *)deref_next(&plVar6->next); puVar3 != (undefined4 *)0x0; puVar3 = (undefined4 *)deref_next(puVar3)) { uVar4 = test_intersect_rect((short *)((int)&plVar6[1].prev + 2), (short *)((int)puVar3 + 0xe)); if ((short)uVar4 != 0) { *(ushort *)(puVar3 + 3) = *(ushort *)(puVar3 + 3) | 0x40; } } } if ((uVar1 & 0x200) != 0) { draw_sprite_rect_ystart = 0; draw_sprite_rect_xstart = 0; draw_sprite_rect_xend = 0x1ff; draw_sprite_rect_yend = 0x17f; } *(ushort *)&plVar6[1].prev = *(ushort *)&plVar6[1].prev & 0xffba; } plVar2 = (linked_list_head *)deref_next(&plVar6->next); plVar5 = plVar6; uVar4 = extraout_EDX_01; } return; } undefined4 __stdcall xxx_periodic_loop(void) { undefined4 uVar1; inc_repost_mouse_downup(); anim_engine_important_core(); uVar1 = gfxish_do_a_paint(); dec_clear_repost_mouse_downup(1); return uVar1; } void __stdcall FUN_004035a0(void) { if (repost_mouse_downup == 0) { inc_repost_mouse_downup(); dec_clear_repost_mouse_downup(0); } return; } void __stdcall anim_engine_init_lots_of_heaps(void) { word *pwVar1; word wVar2; anim_engine_drawn_image *paVar3; if (DAT_00448140 == 0) { aseq_file_list = (linked_list_head *)alloc_linked_list_marker(); anim_state_xxx_list_list = (linked_list_head *)alloc_linked_list_marker(); anim_engine_drawn_images_list = (linked_list_head *)alloc_linked_list_marker(); anim_engine_avail_drawn_images = (linked_list_head *)alloc_linked_list_marker(); anim_state_xxx_list = (linked_list_head *)alloc_linked_list_marker(); anim_engine_before_cbs = (linked_list_head *)alloc_linked_list_marker(); anim_engine_after_cbs = (linked_list_head *)alloc_linked_list_marker(); wVar2 = 0; pwVar1 = &anim_engine_cb_ARRAY_0044dd54[0].idx; do { *pwVar1 = wVar2; pwVar1[1] = 0; wVar2 = wVar2 + 1; pwVar1 = pwVar1 + 8; } while ((short)wVar2 < 10); paVar3 = anim_engine_drawn_image_ARRAY_0044cf2c; wVar2 = 0; do { paVar3->idx = wVar2; paVar3->flags = 0; linked_list_insert((int *)anim_engine_avail_drawn_images,(undefined4 *)paVar3,0xffff); paVar3 = paVar3 + 1; wVar2 = wVar2 + 1; } while ((short)wVar2 < 100); anim_time_secs_mul = time_get_secs_mul(); set_rect((short *)&gfx_rect_0044ddfe,draw_sprite_rect_xstart,draw_sprite_rect_ystart, draw_sprite_rect_xend,draw_sprite_rect_yend); set_specific_gfx_rect (draw_sprite_rect_xstart,draw_sprite_rect_ystart,draw_sprite_rect_xend, draw_sprite_rect_yend); repost_mouse_downup = 0; DAT_00448140 = 1; } return; } void __stdcall anim_engine_tear_down_lots_of_heaps(void) { undefined4 *puVar1; undefined4 *puVar2; int *piVar3; if (DAT_00448140 != 0) { inc_repost_mouse_downup(); puVar1 = (undefined4 *)deref_next_if_not_null(&anim_state_xxx_list_list->next); while (puVar1 != (undefined4 *)0x0) { puVar2 = (undefined4 *)deref_next(puVar1); free_tracked_heap_block_(puVar1[2]); free_tracked_heap_block((int)puVar1); puVar1 = puVar2; } piVar3 = (int *)deref_next_if_not_null(&anim_state_xxx_list->next); while (piVar3 != (int *)0x0) { free_aseq(piVar3); piVar3 = (int *)deref_next_if_not_null(&anim_state_xxx_list->next); } free_tracked_heap_block_((int)anim_state_xxx_list_list); free_tracked_heap_block_((int)anim_engine_avail_drawn_images); free_tracked_heap_block_((int)anim_engine_drawn_images_list); free_tracked_heap_block_((int)anim_state_xxx_list); free_tracked_heap_block_((int)aseq_file_list); free_tracked_heap_block_((int)anim_engine_before_cbs); free_tracked_heap_block_((int)anim_engine_after_cbs); DAT_00448140 = 0; } return; } void __cdecl anim_change_to_xxx(int *param_1,short param_2) { bool bVar1; bVar1 = *(short *)((int)param_1 + 0x1a) != 0; if (bVar1) { anim_state_xxx_list_remove(param_1); } aseq_select_anim((int)param_1,param_2); if (bVar1) { aseq_anim_reset_and_play(param_1); } return; } void __cdecl aseq_select_anim(int param_1,short param_2) { int iVar1; if ((param_1 != 0) && (iVar1 = *(int *)(param_1 + 0x26), iVar1 != 0)) { if (param_2 < 0) { if (*(int *)(param_1 + 0x70) != 0) { *(undefined2 *)(param_1 + 0xe) = 0xffff; *(undefined4 *)(param_1 + 0x2a) = *(undefined4 *)(param_1 + 0x70); *(undefined2 *)(param_1 + 0x10) = 0; return; } } else if (param_2 < *(short *)(iVar1 + 8)) { *(short *)(param_1 + 0xe) = param_2; *(undefined4 *)(param_1 + 0x2a) = *(undefined4 *)(*(int *)(iVar1 + 0x1a) + param_2 * 4); *(undefined2 *)(param_1 + 0x10) = 0; } } return; } void __cdecl aseq_load_first_frame(int param_1) { short sVar1; undefined4 uVar2; short *psVar3; psVar3 = *(short **)(param_1 + 0x2a); while( true ) { sVar1 = psVar3[2]; if ((-1 < sVar1) || (sVar1 == -1)) break; if (sVar1 == -6) { if (*psVar3 != -0x8000) { *(short *)(param_1 + 8) = *psVar3; } if (psVar3[1] != -0x8000) { *(short *)(param_1 + 10) = psVar3[1]; } sVar1 = psVar3[3]; *(short *)(param_1 + 0xc) = sVar1; if (sVar1 < 0) { *(undefined2 *)(param_1 + 0xc) = 0; } } psVar3 = psVar3 + 4; } if (-1 < psVar3[2]) { *(short *)(param_1 + 0x3a) = *(short *)(param_1 + 8) + *psVar3; *(short *)(param_1 + 0x3c) = *(short *)(param_1 + 10) + psVar3[1]; uVar2 = aseq_get_img_w(param_1,psVar3[2]); *(short *)(param_1 + 0x3e) = (short)uVar2; uVar2 = aseq_get_img_h(param_1,psVar3[2]); *(short *)(param_1 + 0x40) = (short)uVar2; } return; } undefined4 * __cdecl load_aseq(short param_1) { short sVar1; bool bVar2; undefined4 *puVar3; undefined4 *puVar4; uint uVar5; int iVar6; undefined1 *puVar7; short *psVar8; short sVar9; uint local_c; puVar3 = (undefined4 *)load_resource_item_0(param_1,(int *)&aseq); if (resource_already_loaded == 0) { puVar4 = (undefined4 *)alloc_tracked_heap_block(0x32); memcpy(puVar4 + 2,puVar3,10); bVar2 = 0xfe < *(short *)(puVar4 + 3); if (bVar2) { endian_swap_words((undefined1 *)(puVar4 + 2),5); } puVar7 = (undefined1 *)((int)puVar3 + 10); if (bVar2) { endian_swap_dwords(puVar7,*(short *)((int)puVar4 + 10)); } *(undefined1 **)((int)puVar4 + 0x16) = puVar7; *(undefined1 **)((int)puVar4 + 0x1a) = puVar7 + *(short *)((int)puVar4 + 10) * 4; psVar8 = (short *)(puVar7 + *(short *)((int)puVar4 + 10) * 4 + *(short *)(puVar4 + 2) * 4); for (sVar9 = 0; sVar9 < *(short *)(puVar4 + 2); sVar9 = sVar9 + 1) { if (bVar2) { endian_swap_one_word((undefined1 *)psVar8); } sVar1 = *psVar8; psVar8 = psVar8 + 1; *(short **)(*(int *)((int)puVar4 + 0x1a) + sVar9 * 4) = psVar8; if (bVar2) { endian_swap_words((undefined1 *)psVar8,sVar1 << 2); } psVar8 = psVar8 + sVar1 * 4; } *(short **)((int)puVar4 + 0x12) = psVar8; *(short *)((int)puVar4 + 0x22) = param_1; linked_list_insert((int *)aseq_file_list,puVar4,0xffff); local_c = 0; for (sVar9 = 0; sVar9 < *(short *)((int)puVar4 + 10); sVar9 = sVar9 + 1) { puVar7 = (undefined1 *) (*(int *)(*(int *)((int)puVar4 + 0x16) + sVar9 * 4) + *(int *)((int)puVar4 + 0x12)); if (bVar2) { endian_swap_words(puVar7,3); } uVar5 = (int)*(short *)(puVar7 + 2) * (int)*(short *)(puVar7 + 4); if (local_c <= uVar5 && uVar5 - local_c != 0) { local_c = uVar5; } } puVar4[9] = local_c + 8; } else { for (puVar4 = (undefined4 *)deref_next_if_not_null(&aseq_file_list->next); (uint)*(ushort *)((int)puVar4 + 0x22) != (int)param_1; puVar4 = (undefined4 *)deref_next(puVar4)) { } } puVar3 = (undefined4 *)alloc_tracked_heap_block(0x78); memset(puVar3,0,0x78); *(undefined2 *)(puVar3 + 6) = 1; *(short *)((int)puVar3 + 0x42) = param_1; *(undefined4 **)((int)puVar3 + 0x26) = puVar4; aseq_select_anim((int)puVar3,0); if ((puVar4 == (undefined4 *)0x0) || (*(short *)(puVar4 + 4) < 9)) { *(undefined2 *)((int)puVar3 + 0x56) = 0; *(int *)((int)puVar3 + 0x6a) = (int)puVar3 + 0x5a; } else { *(undefined2 *)((int)puVar3 + 0x56) = 1; iVar6 = alloc_tracked_heap_block(*(short *)(puVar4 + 4) * 2); *(int *)((int)puVar3 + 0x6a) = iVar6; } *(undefined2 *)((int)puVar3 + 0x12) = 0; if (*(short *)(puVar4 + 3) != 0) { *(short *)((int)puVar3 + 0x12) = anim_time_secs_mul / *(short *)(puVar4 + 3); } *(short *)(puVar3 + 8) = aseq_something_idx; aseq_something_idx = aseq_something_idx + 1; aseq_load_first_frame((int)puVar3); return puVar3; } undefined4 __cdecl free_aseq(int *param_1) { if (param_1 != (int *)0x0) { if (*(short *)((int)param_1 + 0x1a) != 0) { anim_state_xxx_list_remove(param_1); } free_resource_item_with_idx_fourcc(*(short *)((int)param_1 + 0x42),(undefined1 *)&aseq); if (*(short *)((int)param_1 + 0x56) != 0) { free_tracked_heap_block(*(int *)((int)param_1 + 0x6a)); } if (resource_already_loaded == 0) { linked_list_unlink((int *)aseq_file_list,*(int **)((int)param_1 + 0x26)); free_tracked_heap_block(*(int *)((int)param_1 + 0x26)); } aseq_anim_state_free_cmd_18_22_buf((int)param_1); free_tracked_heap_block((int)param_1); } return 0; } undefined4 __cdecl anim_state_xxx_list_free_by_rsrc_idx(short param_1) { bool bVar1; int *piVar2; bVar1 = false; piVar2 = (int *)deref_next_if_not_null(&anim_state_xxx_list->next); while ((piVar2 != (int *)0x0 && (!bVar1))) { if (param_1 == *(short *)((int)piVar2 + 0x42)) { free_aseq(piVar2); bVar1 = true; } piVar2 = (int *)deref_next(&anim_state_xxx_list->next); } return 0; } void __cdecl anim_state_xxx_list_insert_4(undefined4 *param_1) { if ((param_1 != (undefined4 *)0x0) && (*(short *)((int)param_1 + 0x1a) == 0)) { aseq_load_first_frame((int)param_1); *(undefined2 *)(param_1 + 6) = 4; param_1[5] = 0; *(undefined2 *)(param_1 + 7) = 0; *(undefined2 *)(param_1 + 4) = 0; *(undefined2 *)((int)param_1 + 0x1e) = 0; linked_list_insert_sorted((int *)anim_state_xxx_list,param_1,anim_state_xxx_list_sort); *(undefined2 *)((int)param_1 + 0x1a) = 1; } return; } void __cdecl aseq_anim_reset_and_play(undefined4 *param_1) { short sVar1; short *psVar2; short sVar3; if (param_1 != (undefined4 *)0x0) { if (*(short *)((int)param_1 + 0x1a) == 0) { anim_state_xxx_list_insert_4(param_1); } else { sVar1 = *(short *)(param_1 + 0x16); psVar2 = *(short **)((int)param_1 + 0x6a); sVar3 = 0; if (0 < sVar1) { do { anim_engine_drawn_image_ARRAY_0044cf2c[*psVar2].flags = anim_engine_drawn_image_ARRAY_0044cf2c[*psVar2].flags | 2; psVar2 = psVar2 + 1; sVar3 = sVar3 + 1; } while (sVar3 < sVar1); } *(undefined2 *)(param_1 + 6) = 4; param_1[5] = 0; *(undefined2 *)(param_1 + 7) = 0; } } return; } void __cdecl anim_state_xxx_list_insert_8004(undefined4 *param_1) { if ((param_1 != (undefined4 *)0x0) && (*(short *)((int)param_1 + 0x1a) == 0)) { aseq_load_first_frame((int)param_1); *(undefined2 *)(param_1 + 6) = 0x8004; param_1[5] = 0; *(undefined2 *)(param_1 + 7) = 0; *(undefined2 *)(param_1 + 4) = 0; *(undefined2 *)((int)param_1 + 0x1e) = 0; linked_list_insert_sorted((int *)anim_state_xxx_list,param_1,anim_state_xxx_list_sort); *(undefined2 *)((int)param_1 + 0x1a) = 1; } return; } void __cdecl anim_state_xxx_list_insert_shorter(undefined4 *param_1,int param_2) { if (*(short *)((int)param_1 + 0x1a) == 0) { aseq_load_first_frame((int)param_1); *(undefined2 *)(param_1 + 6) = 4; param_1[5] = anim_t + param_2; linked_list_insert_sorted((int *)anim_state_xxx_list,param_1,anim_state_xxx_list_sort); *(undefined2 *)((int)param_1 + 0x1a) = 1; } return; } void __cdecl anim_state_xxx_list_remove(int *param_1) { short sVar1; short sVar2; short *psVar3; if ((param_1 != (int *)0x0) && (*(short *)((int)param_1 + 0x1a) != 0)) { *(undefined2 *)(param_1 + 6) = 1; linked_list_unlink((int *)anim_state_xxx_list,param_1); *(undefined2 *)((int)param_1 + 0x1a) = 0; psVar3 = *(short **)((int)param_1 + 0x6a); if ((*(byte *)((int)param_1 + 0x4e) & 2) == 0) { for (sVar2 = 0; sVar2 < (short)param_1[0x16]; sVar2 = sVar2 + 1) { anim_engine_drawn_image_ARRAY_0044cf2c[*psVar3].flags = 2; psVar3 = psVar3 + 1; } anim_engine_xxx_boop_drawn_images_for_state((int)param_1); } else { for (sVar2 = 0; sVar2 < (short)param_1[0x16]; sVar2 = sVar2 + 1) { sVar1 = *psVar3; psVar3 = psVar3 + 1; anim_engine_return_drawn_img_obj((int *)(anim_engine_drawn_image_ARRAY_0044cf2c + sVar1)); } *(undefined2 *)(param_1 + 0x16) = 0; } } return; } short __cdecl anim_state_change_xxx_list_sort_key(int *param_1,short param_2) { short sVar1; short unaff_SI; sVar1 = (short)param_1[3]; if ((param_2 != sVar1) && (*(short *)(param_1 + 3) = param_2, unaff_SI = sVar1, *(short *)((int)param_1 + 0x1a) != 0)) { linked_list_unlink((int *)anim_state_xxx_list,param_1); linked_list_insert_sorted((int *)anim_state_xxx_list,param_1,anim_state_xxx_list_sort); } return unaff_SI; } void __cdecl aseq_anim_flags_make_2(int param_1) { if (param_1 != 0) { *(undefined2 *)(param_1 + 0x18) = 2; *(undefined2 *)(param_1 + 0x10) = 0; *(undefined2 *)(param_1 + 0x1c) = 0; *(undefined2 *)(param_1 + 0x1e) = 0; } return; } void __stdcall anim_engine_important_core(void) { short sVar1; short sVar2; int iVar3; ulonglong uVar4; int *piVar5; bool bVar6; ushort uVar7; short sVar8; short sVar9; uint uVar10; int *piVar11; int iVar12; short *psVar13; int iVar14; uint uVar15; undefined4 *puVar16; short sVar17; short *psVar18; short sStack_48; short sStack_46; short sStack_28; short sStack_26; undefined2 uStack_24; undefined2 uStack_22; gfx_rect *pgStack_20; ushort uStack_1c; short sStack_1a; ushort uStack_16; ushort uStack_14; if (anim_engine_global_cb != (undefined *)0x0) { (*(code *)anim_engine_global_cb)(); } uVar10 = get_time_ms(); anim_t = uVar10; piVar11 = (int *)deref_next_if_not_null(&anim_state_xxx_list->next); joined_r0x00403e37: do { piVar5 = piVar11; if (piVar5 == (int *)0x0) { for (puVar16 = (undefined4 *)deref_next_if_not_null(&anim_engine_before_cbs->next); puVar16 != (undefined4 *)0x0; puVar16 = (undefined4 *)deref_next(puVar16)) { (*(code *)puVar16[2])(); } anim_drawn_images_draw_all(); if (anim_engine_global_cb != (undefined *)0x0) { (*(code *)anim_engine_global_cb)(); } for (puVar16 = (undefined4 *)deref_next_if_not_null(&anim_engine_after_cbs->next); puVar16 != (undefined4 *)0x0; puVar16 = (undefined4 *)deref_next(puVar16)) { (*(code *)puVar16[2])(); } return; } piVar11 = (int *)deref_next(piVar5); uVar15 = piVar5[5]; } while (uVar10 < uVar15); if (uVar15 == 0) { piVar5[5] = uVar10; uVar15 = uVar10; } piVar5[0x1d] = uVar10; piVar5[5] = *(ushort *)((int)piVar5 + 0x12) + uVar10; if ((short)piVar5[0x15] == 0) { iVar12 = 0; } else { uVar4 = (ulonglong)(uVar10 - uVar15) / (ulonglong)(uint)*(ushort *)((int)piVar5 + 0x12); iVar12 = (int)uVar4; piVar5[5] = *(ushort *)((int)piVar5 + 0x12) + uVar10; if ((short)uVar4 != 0) { iVar12 = 1; } } bVar6 = true; xxx_boop_and_next_cmd: if ((*(byte *)(piVar5 + 6) & 4) != 0) { if (bVar6) { anim_engine_xxx_boop_drawn_images_for_state((int)piVar5); bVar6 = false; } sStack_46 = 1; psVar18 = *(short **)((int)piVar5 + 0x2a); sVar17 = (short)piVar5[4]; iVar3 = *(int *)((int)piVar5 + 0x26); do_next_cmd: iVar14 = (int)sVar17; sVar8 = psVar18[iVar14 * 4 + 2]; if (-1 < sVar8) { *(short *)(piVar5 + 4) = sVar17; *(undefined2 *)(piVar5 + 0x16) = 0; sStack_1a = (short)piVar5[6]; if (*(short *)((int)piVar5 + 0x6e) == 0) { pgStack_20 = &gfx_rect_0044ddfe; } else { pgStack_20 = &drawn_images_specific_rect; } sStack_48 = 0; psVar18 = psVar18 + sVar17 * 4 + 2; if (0 < sStack_46) { do { uStack_1c = 0; iVar12 = *(int *)(*(int *)(iVar3 + 0x16) + *psVar18 * 4); *(int *)((int)piVar5 + 0x22) = iVar12; iVar12 = *(int *)(*(int *)((int)piVar5 + 0x26) + 0x12) + iVar12; sVar8 = (short)piVar5[2] + psVar18[-2]; sVar9 = *(short *)((int)piVar5 + 10) + psVar18[-1]; uStack_24 = *(undefined2 *)(iVar12 + 2); uStack_22 = *(undefined2 *)(iVar12 + 4); sStack_28 = sVar8; sStack_26 = sVar9; uVar15 = intersect_rects((short *)pgStack_20,&sStack_28); uStack_16 = (ushort)uVar15; if (uStack_16 != 0) { memcpy((undefined4 *)((int)piVar5 + 0x3a),(undefined4 *)&sStack_28,8); if ((*(byte *)(psVar18 + 1) & 1) != 0) { // flipped uStack_1c = uStack_1c | 0x80; } piVar11 = anim_engine_get_new_drawn_image_obj(); if (piVar11 != (int *)0x0) { *(int *)((int)piVar11 + 0x16) = iVar12; *(short *)((int)piVar11 + 0x1a) = sVar8; *(short *)(piVar11 + 7) = sVar9; memcpy((undefined4 *)((int)piVar11 + 0xe),(undefined4 *)&sStack_28,8); *(short *)((int)piVar11 + 10) = (short)piVar5[3]; if (*(short *)((int)piVar5 + 0x6e) != 0) { uStack_1c = uStack_1c | 0x200; } if (piVar5[0xc] != 0) { uStack_1c = uStack_1c | 0x400; } if (*(int *)((int)piVar5 + 0x36) != 0) { uStack_1c = uStack_1c | 0x800; } uVar7 = uStack_1c | 1; if ((uStack_16 & 2) != 0) { uVar7 = uStack_1c | 0x21; } uStack_1c = uVar7; if (((int)sStack_1a & 0x8010U) == 0) { uStack_1c = uStack_1c | 2; } if ((short)piVar5[0x12] != 0) { uStack_1c = uStack_1c & 0xfffd | 8; if ((short)piVar5[0x12] == 1) { set_gfxish_dest_other(); gfxish_save_rect(&sStack_28,(undefined2 *)piVar5[0x14]); set_gfxish_dest(); } *(undefined2 *)(piVar5 + 0x12) = 0; } if ((*(byte *)((int)piVar5 + 0x4e) & 1) != 0) { uStack_1c = uStack_1c | 0x10; } *(ushort *)(piVar11 + 3) = uStack_1c; piVar11[8] = (int)piVar5; linked_list_insert_sorted ((int *)anim_engine_drawn_images_list,piVar11, anim_engine_drawn_images_compare); *(short *)(*(int *)((int)piVar5 + 0x6a) + sStack_48 * 2) = (short)piVar11[2]; *(short *)(piVar5 + 0x16) = (short)piVar5[0x16] + 1; } } sVar17 = sVar17 + 1; psVar18 = psVar18 + 4; sStack_48 = sStack_48 + 1; } while (sStack_48 < sStack_46); } if ((*(byte *)((int)piVar5 + 0x19) & 0x80) != 0) { *(undefined2 *)(piVar5 + 6) = 2; } do_next_anim_and_reset_idx: *(short *)(piVar5 + 4) = sVar17; goto do_next_anim; } sVar9 = psVar18[iVar14 * 4]; sVar1 = psVar18[iVar14 * 4 + 1]; sVar2 = psVar18[iVar14 * 4 + 3]; switch(sVar8) { case -0x16: if (sVar9 == 0) { *(undefined2 *)(piVar5 + 0x12) = 2; } else { *(undefined2 *)(piVar5 + 0x12) = 1; aseq_anim_state_alloc_cmd_18_22_buf((int)piVar5); } sVar17 = sVar17 + 1; iVar12 = 0; break; case -0x15: if (sVar1 == sVar9) { iVar12 = 0; } else { uVar15 = rand(); iVar12 = (int)uVar15 % ((int)sVar1 - (int)sVar9); } piVar5[5] = piVar5[5] + iVar12 + sVar9; sVar17 = sVar17 + 1; goto do_next_anim_and_reset_idx; case -0x14: *(short *)((int)piVar5 + 0x1e) = *(short *)((int)piVar5 + 0x1e) + -1; if (*(short *)((int)piVar5 + 0x1e) == 0) { sVar17 = sVar17 + 1; } else { sVar17 = *(short *)((int)piVar5 + 0x46); } break; case -0x13: *(short *)((int)piVar5 + 0x1e) = sVar9; sVar17 = sVar17 + 1; break; case -0x12: if (piVar5[0x14] == 0) { ao_runtime_error(); } else { set_gfxish_dest_other(); gfxish_copy_block(); set_gfxish_dest(); if (sVar9 != 0) { aseq_anim_state_free_cmd_18_22_buf((int)piVar5); } } sVar17 = sVar17 + 1; break; case -0x11: *(short *)(*(int *)((int)piVar5 + 0x4a) + 8) = (short)piVar5[2] + sVar9; *(short *)(*(int *)((int)piVar5 + 0x4a) + 10) = *(short *)((int)piVar5 + 10) + sVar1; aseq_anim_get_flags(*(int *)((int)piVar5 + 0x4a)); sVar17 = sVar17 + 1; break; case -0x10: aseq_anim_flags_make_2(*(int *)((int)piVar5 + 0x4a)); sVar17 = sVar17 + 1; break; case -0xf: sVar17 = sVar17 + 1; break; case -0xe: anim_state_xxx_list_remove(*(int **)((int)piVar5 + 0x4a)); sVar17 = sVar17 + 1; break; case -0xd: aseq_anim_reset_and_play(*(undefined4 **)((int)piVar5 + 0x4a)); sVar17 = sVar17 + 1; break; case -0xc: if (*(short *)((int)piVar5 + 0x2e) != 0) { (*(code *)piVar5[0xc])(); } sVar17 = sVar17 + 1; goto do_next_anim_and_reset_idx; case -0xb: sVar17 = sVar9; // goto break; case -10: // change anim iVar12 = 0; if (sVar9 == 1) { if (*(short *)(iVar3 + 8) == 0) { sVar17 = 0; } else { uVar15 = rand(); sVar17 = (short)((int)uVar15 % (int)*(short *)(iVar3 + 8)); } aseq_select_anim((int)piVar5,sVar17); goto xxx_boop_and_next_cmd; } if (sVar9 == 2) { sStack_48 = *(short *)((int)piVar5 + 0xe) + 1; if (sStack_48 == *(short *)(iVar3 + 8)) { sStack_48 = 0; } aseq_select_anim((int)piVar5,sStack_48); goto xxx_boop_and_next_cmd; } if (sVar9 == 3) { aseq_select_anim((int)piVar5,sVar1); goto xxx_boop_and_next_cmd; } if (sVar9 == 4) goto cmd_10_subcmd_4; break; case -9: // inc def y *(short *)((int)piVar5 + 10) = *(short *)((int)piVar5 + 10) + sVar9; sVar17 = sVar17 + 1; break; case -8: // inc def x *(short *)(piVar5 + 2) = (short)piVar5[2] + sVar9; sVar17 = sVar17 + 1; break; case -7: // set label *(short *)(piVar5 + 0x11) = sVar9; *(short *)((int)piVar5 + 0x46) = sVar17 + 1; sVar17 = sVar17 + 1; break; case -6: // set default coords if (sVar9 != -0x8000) { *(short *)(piVar5 + 2) = sVar9; } if (sVar1 != -0x8000) { *(short *)((int)piVar5 + 10) = sVar1; } sVar17 = sVar17 + 1; break; case -5: // jump label? if (sVar9 == (short)piVar5[0x11]) { sVar17 = *(short *)((int)piVar5 + 0x46); } else { sStack_48 = 0; for (psVar13 = psVar18; psVar13[2] != -1; psVar13 = psVar13 + 4) { if ((psVar13[2] == -7) || (*psVar13 == sVar9)) { sVar17 = sStack_48; } sStack_48 = sStack_48 + 1; } } break; case -4: *(undefined2 *)(piVar5 + 6) = 0x10; iVar12 = 0; sVar17 = sVar17 + 1; break; case -3: sVar17 = sVar17 + 1; sStack_46 = sVar9; // jump rel break; case -2: *(short *)(piVar5 + 7) = (short)piVar5[7] + 1; sVar17 = 0; break; case -1: // end? *(undefined2 *)(piVar5 + 6) = 1; *(undefined2 *)(piVar5 + 7) = 1; aseq_anim_flags_make_2((int)piVar5); anim_state_xxx_list_remove(piVar5); goto joined_r0x00403e37; default: if (sVar8 < -499) { uStack_14 = 0; if ((anim_engine_custom_command_handler != (undefined *)0x0) && (uStack_14 = (*(code *)anim_engine_custom_command_handler)(), (uStack_14 & 1) != 0)) { sVar17 = (short)piVar5[4]; } if (uStack_14 == 0) { sVar17 = sVar17 + 1; } } } if ((short)iVar12 != 0) { sVar17 = sVar17 + sStack_46; iVar12 = iVar12 + -1; } goto do_next_cmd; } do_next_anim: piVar11 = (int *)deref_next(piVar5); goto joined_r0x00403e37; cmd_10_subcmd_4: if (sVar2 == 0) { sVar17 = 0; } else { uVar15 = rand(); sVar17 = (short)((int)uVar15 % (int)sVar2); } aseq_select_anim((int)piVar5,sVar17 + sVar1); goto xxx_boop_and_next_cmd; } undefined4 __cdecl aseq_get_img_w(int param_1,short param_2) { int iVar1; iVar1 = *(int *)(*(int *)(param_1 + 0x26) + 0x12); return CONCAT22((short)((uint)iVar1 >> 0x10), *(undefined2 *) (iVar1 + 2 + *(int *)(*(int *)(*(int *)(param_1 + 0x26) + 0x16) + param_2 * 4))); } undefined4 __cdecl aseq_get_img_h(int param_1,short param_2) { int iVar1; iVar1 = *(int *)(*(int *)(param_1 + 0x26) + 0x12); return CONCAT22((short)((uint)iVar1 >> 0x10), *(undefined2 *) (iVar1 + 4 + *(int *)(*(int *)(*(int *)(param_1 + 0x26) + 0x16) + param_2 * 4))); } short __cdecl FUN_004045b0(int param_1) { short *psVar1; ushort uVar2; uVar2 = *(ushort *)(param_1 + 0x10); for (psVar1 = (short *)(*(int *)(param_1 + 0x2a) + 4 + (uint)uVar2 * 8); *psVar1 < 0; psVar1 = psVar1 + 4) { uVar2 = uVar2 + 1; } return *(short *)(*(int *)(param_1 + 0x2a) + (uint)uVar2 * 8) + *(short *)(param_1 + 8); } short __cdecl FUN_004045e4(int param_1) { short *psVar1; ushort uVar2; uVar2 = *(ushort *)(param_1 + 0x10); for (psVar1 = (short *)(*(int *)(param_1 + 0x2a) + 4 + (uint)uVar2 * 8); *psVar1 < 0; psVar1 = psVar1 + 4) { uVar2 = uVar2 + 1; } return *(short *)(*(int *)(param_1 + 0x2a) + 2 + (uint)uVar2 * 8) + *(short *)(param_1 + 10); } undefined2 __cdecl anim_get_draw_order(int param_1) { return *(undefined2 *)(param_1 + 0xc); } void __cdecl anim_engine_set_custom_command_handler(undefined *param_1) { anim_engine_custom_command_handler = param_1; return; } void __stdcall anim_state_xxx_new_list(void) { undefined4 *puVar1; puVar1 = (undefined4 *)alloc_tracked_heap_block(0xc); puVar1[2] = anim_state_xxx_list; linked_list_insert((int *)anim_state_xxx_list_list,puVar1,0); anim_state_xxx_list = (linked_list_head *)alloc_linked_list_marker(); return; } void __stdcall anim_state_xxx_restore_list(void) { int *piVar1; undefined4 *puVar2; for (piVar1 = (int *)deref_next_if_not_null(&anim_state_xxx_list->next); piVar1 != (int *)0x0; piVar1 = (int *)deref_next(piVar1)) { anim_state_xxx_list_remove(piVar1); } free_tracked_heap_block_((int)anim_state_xxx_list); piVar1 = (int *)deref_next_if_not_null(&anim_state_xxx_list_list->next); linked_list_unlink((int *)anim_state_xxx_list_list,piVar1); anim_state_xxx_list = (linked_list_head *)piVar1[2]; free_tracked_heap_block((int)piVar1); for (puVar2 = (undefined4 *)deref_next_if_not_null(&anim_state_xxx_list->next); puVar2 != (undefined4 *)0x0; puVar2 = (undefined4 *)deref_next(puVar2)) { aseq_anim_mark_all_drawn_invalidated((int)puVar2); } return; } void __cdecl FUN_004046ec(int param_1,int param_2) { *(int *)(param_1 + 0x4a) = param_2; *(int *)(param_2 + 0x4a) = param_1; return; } void __cdecl FUN_00404700(int param_1) { *(undefined4 *)(*(int *)(param_1 + 0x4a) + 0x4a) = 0; *(undefined4 *)(param_1 + 0x4a) = 0; return; } void __cdecl aseq_anim_state_alloc_cmd_18_22_buf(int param_1) { int iVar1; if (*(int *)(param_1 + 0x50) == 0) { iVar1 = alloc_tracked_heap_block(*(uint *)(*(int *)(param_1 + 0x26) + 0x24)); *(int *)(param_1 + 0x50) = iVar1; } return; } void __cdecl aseq_anim_state_free_cmd_18_22_buf(int param_1) { if (*(int *)(param_1 + 0x50) != 0) { free_tracked_heap_block(*(int *)(param_1 + 0x50)); *(undefined4 *)(param_1 + 0x50) = 0; } return; } void __cdecl aseq_set_pos_order(int param_1,short param_2,short param_3,short param_4) { short sVar1; short sVar2; short *psVar3; short local_8; short local_6; if (param_1 != 0) { local_6 = 0; if (param_2 != -0x8000) { local_6 = param_2 - *(short *)(param_1 + 8); *(short *)(param_1 + 8) = param_2; *(short *)(param_1 + 0x3a) = param_2; } local_8 = 0; if (param_3 != -0x8000) { local_8 = param_3 - *(short *)(param_1 + 10); *(short *)(param_1 + 10) = param_3; *(short *)(param_1 + 0x3c) = param_3; } if (param_4 != -0x8000) { *(short *)(param_1 + 0xc) = param_4; } if ((*(short *)(param_1 + 0x18) == 2) || (*(short *)(param_1 + 0x18) == 0x10)) { psVar3 = *(short **)(param_1 + 0x6a); for (sVar2 = 0; sVar2 < *(short *)(param_1 + 0x58); sVar2 = sVar2 + 1) { anim_engine_drawn_image_ARRAY_0044cf2c[*psVar3].flags = anim_engine_drawn_image_ARRAY_0044cf2c[*psVar3].flags | 4; psVar3 = psVar3 + 1; } anim_engine_xxx_boop_drawn_images_for_state(param_1); psVar3 = *(short **)(param_1 + 0x6a); for (sVar2 = 0; sVar2 < *(short *)(param_1 + 0x58); sVar2 = sVar2 + 1) { sVar1 = *psVar3; psVar3 = psVar3 + 1; anim_drawn_img_offset_xy(sVar1,local_6,local_8); } } } return; } void __stdcall inc_repost_mouse_downup(void) { repost_mouse_downup = repost_mouse_downup + 1; return; } void __cdecl dec_clear_repost_mouse_downup(short param_1) { if (param_1 != 0) { repost_mouse_downup = 0; return; } if (0 < repost_mouse_downup) { repost_mouse_downup = repost_mouse_downup + -1; } return; } void __cdecl aseq_anim_override_timing(int param_1,short param_2,short param_3) { if (-1 < param_2) { *(short *)(param_1 + 0x12) = anim_time_secs_mul / param_2; } if (-1 < param_3) { *(short *)(param_1 + 0x54) = param_3; } return; } void __cdecl set_rect(short *param_1,short param_2,short param_3,short param_4,short param_5) { if (-1 < param_2) { *param_1 = param_2; } if (-1 < param_4) { param_1[2] = (param_4 - *param_1) + 1; } if (-1 < param_3) { param_1[1] = param_3; } if (-1 < param_5) { param_1[3] = (param_5 - param_1[1]) + 1; } return; } void __cdecl set_specific_gfx_rect(short param_1,short param_2,short param_3,short param_4) { set_rect((short *)&drawn_images_specific_rect,param_1,param_2,param_3,param_4); return; } void __cdecl aseq_anim_state_set_which_rect_xxx(int param_1,undefined2 param_2) { if (param_1 != 0) { *(undefined2 *)(param_1 + 0x6e) = param_2; } return; } void __cdecl aseq_anim_set_cmd_0x400_handler(int param_1,undefined4 param_2,undefined2 param_3) { if (param_1 != 0) { *(undefined2 *)(param_1 + 0x2e) = param_3; *(undefined4 *)(param_1 + 0x30) = param_2; } return; } void __cdecl anim_set_flags_0x800_handler(int param_1,int param_2,undefined2 param_3) { short *psVar1; short sVar2; if (param_1 != 0) { psVar1 = (short *)(param_1 + 0x5a); for (sVar2 = 0; sVar2 < *(short *)(param_1 + 0x58); sVar2 = sVar2 + 1) { if (param_2 == 0) { anim_engine_drawn_image_ARRAY_0044cf2c[*psVar1].flags = anim_engine_drawn_image_ARRAY_0044cf2c[*psVar1].flags & 0xf7ff; } else { anim_engine_drawn_image_ARRAY_0044cf2c[*psVar1].flags = anim_engine_drawn_image_ARRAY_0044cf2c[*psVar1].flags | 0x800; } psVar1 = psVar1 + 1; } *(undefined2 *)(param_1 + 0x34) = param_3; *(int *)(param_1 + 0x36) = param_2; } return; } undefined2 __cdecl aseq_draw_gfx_and_xxx(int param_1,short param_2,short param_3,short param_4,byte param_5) { gfx_rect *pgVar1; uint uVar2; undefined4 *puVar3; undefined4 uVar4; int iVar5; short local_10; short local_e; undefined2 local_c; undefined2 local_a; ushort local_8; undefined2 local_6; local_6 = 0; if ((param_1 != 0) && (iVar5 = *(int *)(param_1 + 0x26), param_4 < *(short *)(iVar5 + 10))) { iVar5 = *(int *)(*(int *)(iVar5 + 0x16) + param_4 * 4) + *(int *)(iVar5 + 0x12); if (param_2 == -0x8000) { param_2 = *(short *)(param_1 + 8); } if (param_3 == -0x8000) { param_3 = *(short *)(param_1 + 10); } local_c = *(undefined2 *)(iVar5 + 2); local_a = *(undefined2 *)(iVar5 + 4); if (*(short *)(param_1 + 0x6e) == 0) { pgVar1 = &gfx_rect_0044ddfe; } else { pgVar1 = &drawn_images_specific_rect; } local_10 = param_2; local_e = param_3; uVar2 = intersect_rects((short *)pgVar1,&local_10); local_8 = (ushort)uVar2; if (local_8 != 0) { local_6 = 1; if ((uVar2 & 2) == 0) { if ((param_5 & 1) == 0) { gfxish_draw_sprite_normal(); } else { gfxish_draw_sprite_flipped(); } } else { gfxish_draw_sprite_bounds_checked(param_2,param_3,iVar5); } gfxish_invalidate_rect(&local_10); if ((param_5 & 2) != 0) { set_gfxish_dest_other(); if ((local_8 & 2) == 0) { if ((param_5 & 1) == 0) { gfxish_draw_sprite_normal(); } else { gfxish_draw_sprite_flipped(); } } else { gfxish_draw_sprite_bounds_checked(param_2,param_3,iVar5); } set_gfxish_dest(); } } if ((param_5 & 4) == 0) { for (puVar3 = (undefined4 *)deref_next_if_not_null(&anim_engine_drawn_images_list->next); puVar3 != (undefined4 *)0x0; puVar3 = (undefined4 *)deref_next(puVar3)) { uVar4 = test_intersect_rect(&local_10,(short *)((int)puVar3 + 0xe)); if ((short)uVar4 != 0) { *(ushort *)(puVar3 + 3) = *(ushort *)(puVar3 + 3) | 0x40; } } } } return local_6; } void __cdecl aseq_draw_to_both_fbs(int param_1,short param_2,short param_3,short param_4) { aseq_draw_gfx_and_xxx(param_1,param_2,param_3,param_4,2); return; } void __cdecl aseq_anim_set_img_and_flags(int param_1,short param_2,short param_3,undefined2 param_4) { int iVar1; int iVar2; iVar1 = *(int *)(param_1 + 0x2a); iVar2 = (int)param_2; if ((-1 < *(short *)(iVar1 + 4 + iVar2 * 8)) && (param_3 < *(short *)(*(int *)(param_1 + 0x26) + 10))) { *(short *)(iVar1 + 4 + iVar2 * 8) = param_3; *(undefined2 *)(iVar1 + 6 + iVar2 * 8) = param_4; } return; } void __cdecl FUN_00404b50(int param_1,short *param_2,short *param_3,short param_4) { int iVar1; short *psVar2; undefined4 in_ECX; undefined4 extraout_ECX; undefined1 *puVar3; int iVar4; int iVar5; undefined1 local_104 [256]; iVar4 = 0; puVar3 = local_104; do { *puVar3 = (char)iVar4; iVar4 = iVar4 + 1; puVar3 = puVar3 + 1; } while (iVar4 < 0x100); for (; *param_3 != -1; param_3 = param_3 + 1) { in_ECX = CONCAT31((int3)((uint)in_ECX >> 8),(char)*param_3); local_104[*param_2] = (char)*param_3; param_2 = param_2 + 1; } iVar4 = *(int *)(*(int *)(param_1 + 0x26) + 0x12); if (param_4 == -1) { for (iVar5 = 0; iVar5 < *(short *)(*(int *)(param_1 + 0x26) + 10); iVar5 = iVar5 + 1) { iVar1 = *(int *)(*(int *)(*(int *)(param_1 + 0x26) + 0x16) + iVar5 * 4) + iVar4; gfxish_decode_xxx(iVar1,local_104,in_ECX,iVar1); in_ECX = extraout_ECX; } psVar2 = (short *)(param_1 + 0x5a); for (iVar4 = 0; iVar4 < *(short *)(param_1 + 0x58); iVar4 = iVar4 + 1) { anim_engine_drawn_image_ARRAY_0044cf2c[*psVar2].flags = anim_engine_drawn_image_ARRAY_0044cf2c[*psVar2].flags | 4; psVar2 = psVar2 + 1; } } else if (param_4 < *(short *)(*(int *)(param_1 + 0x26) + 10)) { iVar5 = *(int *)(*(int *)(param_1 + 0x26) + 0x16); gfxish_decode_xxx(iVar5,(int)param_4,in_ECX,iVar4 + *(int *)(iVar5 + param_4 * 4)); } return; } void __cdecl aseq_anim_mark_all_drawn_invalidated(int param_1) { short *psVar1; short sVar2; if (param_1 != 0) { psVar1 = *(short **)(param_1 + 0x6a); for (sVar2 = 0; sVar2 < *(short *)(param_1 + 0x58); sVar2 = sVar2 + 1) { anim_engine_drawn_image_ARRAY_0044cf2c[*psVar1].flags = anim_engine_drawn_image_ARRAY_0044cf2c[*psVar1].flags | 4; psVar1 = psVar1 + 1; } } return; } void __stdcall anim_engine_drawn_images_mark_all_0x40(void) { undefined4 *puVar1; for (puVar1 = (undefined4 *)deref_next_if_not_null(&anim_engine_drawn_images_list->next); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { *(ushort *)(puVar1 + 3) = *(ushort *)(puVar1 + 3) | 0x40; } return; } void __cdecl anim_engine_set_cb(undefined *param_1) { anim_engine_global_cb = param_1; return; } undefined2 __cdecl FUN_00404c80(int param_1) { short sVar1; short *psVar2; if (param_1 != 0) { *(undefined2 *)(param_1 + 0x18) = 0x10; psVar2 = *(short **)(param_1 + 0x6a); for (sVar1 = 0; sVar1 < *(short *)(param_1 + 0x58); sVar1 = sVar1 + 1) { anim_engine_drawn_image_ARRAY_0044cf2c[*psVar2].flags = anim_engine_drawn_image_ARRAY_0044cf2c[*psVar2].flags & 0xfffd; psVar2 = psVar2 + 1; } } return *(undefined2 *)(param_1 + 0x10); } int __cdecl aseq_anim_get_some_rect(int param_1) { int iVar1; if (param_1 == 0) { iVar1 = 0; } else { iVar1 = param_1 + 0x3a; } return iVar1; } undefined2 __cdecl aseq_anim_get_flags(int param_1) { undefined2 uVar1; if (param_1 == 0) { uVar1 = 1; } else { uVar1 = *(undefined2 *)(param_1 + 0x18); } return uVar1; } uint __cdecl anim_engine_add_cb(undefined *param_1,short param_2) { ushort uVar1; uint uVar2; linked_list_head *plVar3; word *pwVar4; uint unaff_EBX; undefined2 uVar5; anim_engine_cb *unaff_ESI; uVar2 = (uint)(param_2 != 1); pwVar4 = &anim_engine_cb_ARRAY_0044dd54[uVar2].inuse; if ((param_2 != 1) < 10) { do { if (*pwVar4 == 0) { unaff_ESI = anim_engine_cb_ARRAY_0044dd54 + uVar2; unaff_EBX = uVar2; break; } uVar1 = (short)uVar2 + 2; uVar2 = (uint)uVar1; pwVar4 = pwVar4 + 0x10; } while (uVar1 < 10); } uVar5 = (undefined2)(unaff_EBX >> 0x10); if (param_2 == 1) { plVar3 = anim_engine_before_cbs; if ((unaff_EBX & 1) != 0) { unaff_EBX = CONCAT22(uVar5,aseq_something_idx); aseq_something_idx = aseq_something_idx + 1; } } else { plVar3 = anim_engine_after_cbs; if ((unaff_EBX & 1) == 0) { unaff_EBX = CONCAT22(uVar5,aseq_something_idx); aseq_something_idx = aseq_something_idx + 1; } } unaff_ESI->idx = (word)unaff_EBX; unaff_ESI->p = param_1; linked_list_insert((int *)plVar3,(undefined4 *)unaff_ESI,0xffff); return unaff_EBX; } void __cdecl anim_engine_remove_cb(ushort param_1) { int *piVar1; linked_list_head *plVar2; plVar2 = anim_engine_before_cbs; if ((param_1 & 1) != 0) { plVar2 = anim_engine_after_cbs; } piVar1 = (int *)deref_next_if_not_null(&plVar2->next); while( true ) { if (piVar1 == (int *)0x0) { return; } if ((uint)*(ushort *)(piVar1 + 3) == (int)(short)param_1) break; piVar1 = (int *)deref_next(piVar1); } *(undefined2 *)((int)piVar1 + 0xe) = 0; linked_list_unlink((int *)plVar2,piVar1); return; } undefined4 __cdecl anim_xxx_hit_test(short param_1,short param_2) { int iVar1; undefined4 uVar2; short sVar3; short local_c; short local_a; undefined2 local_8; undefined2 local_6; local_c = param_1; local_a = param_2; local_8 = 1; local_6 = 1; for (iVar1 = deref_prev_if_not_null((int)anim_engine_drawn_images_list); iVar1 != 0; iVar1 = deref_prev(iVar1)) { uVar2 = test_intersect_rect(&local_c,(short *)(iVar1 + 0xe)); if ((short)uVar2 != 0) { sVar3 = param_1 - *(short *)(iVar1 + 0xe); if ((*(byte *)(iVar1 + 0xc) & 0x80) != 0) { sVar3 = *(short *)(iVar1 + 0x12) - sVar3; } sVar3 = gfx_data_probably_hit_test (sVar3,param_2 - *(short *)(iVar1 + 0x10),*(int *)(iVar1 + 0x16)); if (sVar3 != 0) break; } } if (iVar1 == 0) { uVar2 = 0; } else { uVar2 = *(undefined4 *)(iVar1 + 0x20); } return uVar2; } void __stdcall nullsub(void) { return; } void __cdecl anim_engine_test_drawn_imgs_intersects_xxx(short *param_1) { undefined4 *puVar1; undefined4 uVar2; gfxish_copy_otherbuf_to_dest(); gfxish_invalidate_rect(param_1); for (puVar1 = (undefined4 *)deref_next_if_not_null(&anim_engine_drawn_images_list->next); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { uVar2 = test_intersect_rect(param_1,(short *)((int)puVar1 + 0xe)); if ((short)uVar2 != 0) { *(ushort *)(puVar1 + 3) = *(ushort *)(puVar1 + 3) | 0x40; } } return; } undefined4 __cdecl rect_y_to_ylevel_front(int param_1) { short sVar1; undefined2 uVar2; sVar1 = *(short *)(param_1 + 2); uVar2 = (undefined2)((uint)param_1 >> 0x10); if (sVar1 < 0x36) { return 0; } if (sVar1 < 0x68) { return CONCAT22(uVar2,1); } if (sVar1 < 0x9a) { return CONCAT22(uVar2,2); } if (sVar1 < 0xcc) { return CONCAT22(uVar2,3); } if (sVar1 < 0xfe) { return CONCAT22(uVar2,4); } return CONCAT22(uVar2,5); } undefined4 __cdecl rect_y_to_ylevel_back(int param_1) { undefined2 uVar1; uVar1 = (undefined2)((uint)param_1 >> 0x10); if (*(short *)(param_1 + 2) < 0x59) { return 0; } if (*(short *)(param_1 + 2) < 0xbd) { return CONCAT22(uVar1,1); } return CONCAT22(uVar1,2); } void __stdcall make_avail_all_item_packages(void) { short sVar1; sVar1 = 0; do { item_package_ARRAY_0044de58[sVar1].available = 1; sVar1 = sVar1 + 1; } while (sVar1 < 0x3c); return; } void __stdcall load_area(void) { word wVar1; short sVar2; linked_list_head *plVar3; area_screen *paVar4; area_screen *paVar5; short local_6; wVar1 = save_file_big->building_idx; if (wVar1 == 0) { bgm_midi_idx = 6012; } else if (wVar1 == 1) { bgm_midi_idx = 6000; } else if (wVar1 == 2) { bgm_midi_idx = 6010; } load_midi(bgm_midi_idx); loaded_area = (short *)load_resource_item_0(area_idx_array[save_file_big->area],(int *)&area); area_num_screens = *loaded_area; paVar5 = (area_screen *)(loaded_area + 1); make_avail_all_item_packages(); area_related_ints = (short *)load_resource_item_0(save_file_big->area + 1410,(int *)PTR_ints_0044ae18); shuffle_parts_related_array(*area_related_ints); num_initial_bananas_on_map = *area_related_ints - loaded_area_parts->num_parts; num_bananas_on_map = num_initial_bananas_on_map; memset(loaded_area_screens,0,0x40); for (local_6 = 0; local_6 < area_num_screens; local_6 = local_6 + 1) { loaded_area_screens[local_6] = paVar5; paVar4 = paVar5 + 1; sVar2 = 3; do { wVar1 = paVar5->non_animated_obj_count[sVar2]; if (wVar1 != 0) { paVar5->non_animated_objs[sVar2] = (area_screen_non_animated_obj *)paVar4; paVar4 = (area_screen *)(paVar4->non_animated_obj_count + (short)wVar1 * 0x10 + -1); } sVar2 = sVar2 + -1; } while (-1 < sVar2); sVar2 = 0; do { wVar1 = paVar5->animated_obj_count[sVar2]; if (wVar1 != 0) { paVar5->animated_objs[sVar2] = (area_screen_animated_obj *)paVar4; paVar4 = (area_screen *)(paVar4->non_animated_obj_count + (short)wVar1 * 0x14 + -1); } sVar2 = sVar2 + 1; } while (sVar2 < 4); sVar2 = 0; do { wVar1 = paVar5->num_obstacles[sVar2]; if (wVar1 != 0) { paVar5->obstacles[sVar2] = (area_screen_obstacle *)paVar4; paVar4 = (area_screen *)(paVar4->non_animated_obj_count + (short)wVar1 * 5 + -1); } sVar2 = sVar2 + 1; } while (sVar2 < 6); sVar2 = 0; do { wVar1 = paVar5->num_trampoline_l_locs[sVar2]; if (wVar1 != 0) { paVar5->trampoline_l_locs[sVar2] = (area_screen_trampoline_jump_loc *)paVar4; paVar4 = (area_screen *)(paVar4->non_animated_obj_count + (short)wVar1 * 5 + -1); } sVar2 = sVar2 + 1; } while (sVar2 < 6); sVar2 = 0; do { wVar1 = paVar5->num_trampoline_r_locs[sVar2]; if (wVar1 != 0) { paVar5->trampoline_r_locs[sVar2] = (area_screen_trampoline_jump_loc *)paVar4; paVar4 = (area_screen *)(paVar4->non_animated_obj_count + (short)wVar1 * 5 + -1); } sVar2 = sVar2 + 1; } while (sVar2 < 6); if (local_6 != 0) { plVar3 = (linked_list_head *)alloc_linked_list_marker(); paVar5->item_package_list = plVar3; wVar1 = area_related_ints[local_6]; paVar5->num_items = wVar1; if (wVar1 != 0) { paVar5->num_items = 0; place_items_randomly((byte *)paVar5,area_related_ints[local_6],-1); } } paVar5 = paVar4; } loaded_screen_idx = 0; return; } void __stdcall free_area(void) { short sVar1; for (sVar1 = 1; sVar1 < area_num_screens; sVar1 = sVar1 + 1) { free_tracked_heap_block_((int)loaded_area_screens[sVar1]->item_package_list); } free_resource_item_with_data(area_related_ints); free_resource_item_with_data(loaded_area); if (bgm_midi_idx != -1) { free_midi(bgm_midi_idx); bgm_midi_idx = -1; } return; } void __cdecl load_screen(short param_1) { aseq_anim_state_struct *paVar1; undefined4 *puVar2; undefined4 *puVar3; undefined4 uVar4; area_screen_non_animated_obj *paVar5; area_screen_animated_obj *paVar6; short sVar7; short sVar8; memcpy((undefined4 *)&loaded_screen,(undefined4 *)loaded_area_screens[param_1],0x120); loaded_screen_idx = param_1; cur_screen_is_loaded = 1; sVar7 = 3; do { paVar5 = loaded_screen.non_animated_objs[sVar7]; for (sVar8 = 0; sVar8 < (short)loaded_screen.non_animated_obj_count[sVar7]; sVar8 = sVar8 + 1) { paVar1 = (aseq_anim_state_struct *)load_aseq(paVar5->aseq_idx); paVar5->anim_state = paVar1; aseq_set_pos_order((int)paVar5->anim_state,(paVar5->gfx_rect).x,(paVar5->gfx_rect).y,sVar7); aseq_draw_gfx_and_xxx ((int)paVar5->anim_state,-0x8000,-0x8000,0,(paVar5->gfx_flags & 2) != 0 | 6); paVar5 = paVar5 + 1; } paVar5 = loaded_screen.non_animated_objs[sVar7]; for (sVar8 = 0; sVar8 < (short)loaded_screen.non_animated_obj_count[sVar7]; sVar8 = sVar8 + 1) { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)paVar5->anim_state); paVar5->anim_state = paVar1; paVar5 = paVar5 + 1; } paVar6 = loaded_screen.animated_objs[sVar7]; for (sVar8 = 0; sVar8 < (short)loaded_screen.animated_obj_count[sVar7]; sVar8 = sVar8 + 1) { paVar1 = (aseq_anim_state_struct *)load_aseq(paVar6->aseq_idx); paVar6->anim_state = paVar1; aseq_set_pos_order((int)paVar6->anim_state,(paVar6->gfx_rect).x,(paVar6->gfx_rect).y,sVar7); anim_state_xxx_list_insert_4((undefined4 *)paVar6->anim_state); if ((paVar6->gfx_flags & 2) != 0) { aseq_select_anim((int)paVar6->anim_state,1); } paVar6 = paVar6 + 1; } sVar7 = sVar7 + -1; } while (-1 < sVar7); puVar2 = (undefined4 *) deref_next_if_not_null(&loaded_area_screens[loaded_screen_idx]->item_package_list->next); for (sVar7 = 0; sVar7 < (short)loaded_screen.num_items; sVar7 = sVar7 + 1) { puVar3 = load_aseq(*(short *)((int)puVar2 + 0x1a)); *(undefined4 **)((int)puVar2 + 0x16) = puVar3; aseq_set_pos_order(*(int *)((int)puVar2 + 0x16),*(short *)(puVar2 + 3), *(short *)((int)puVar2 + 0xe),0x32); anim_state_xxx_list_insert_4(*(undefined4 **)((int)puVar2 + 0x16)); puVar2 = (undefined4 *)deref_next(puVar2); } if (param_1 == 0) { midi_stop(bgm_midi_idx); } else { uVar4 = midi_is_playing(bgm_midi_idx); if ((short)uVar4 == 0) { midi_stop_and_play(bgm_midi_idx,1); } } return; } void __stdcall free_cur_screen_aseq(void) { aseq_anim_state_struct *paVar1; undefined4 *puVar2; undefined4 uVar3; short sVar4; short sVar5; area_screen_animated_obj *paVar6; area_screen_non_animated_obj *paVar7; if (cur_screen_is_loaded != 0) { sVar5 = 0; do { paVar6 = loaded_screen.animated_objs[sVar5]; for (sVar4 = 0; sVar4 < (short)loaded_screen.animated_obj_count[sVar5]; sVar4 = sVar4 + 1) { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)paVar6->anim_state); paVar6->anim_state = paVar1; paVar6 = paVar6 + 1; } paVar7 = loaded_screen.non_animated_objs[sVar5]; for (sVar4 = 0; sVar4 < (short)loaded_screen.non_animated_obj_count[sVar5]; sVar4 = sVar4 + 1) { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)paVar7->anim_state); paVar7->anim_state = paVar1; paVar7 = paVar7 + 1; } sVar5 = sVar5 + 1; } while (sVar5 < 4); puVar2 = (undefined4 *) deref_next_if_not_null (&loaded_area_screens[loaded_screen_idx]->item_package_list->next); for (sVar5 = 0; sVar5 < (short)loaded_screen.num_items; sVar5 = sVar5 + 1) { uVar3 = free_aseq(*(int **)((int)puVar2 + 0x16)); *(undefined4 *)((int)puVar2 + 0x16) = uVar3; puVar2 = (undefined4 *)deref_next(puVar2); } cur_screen_is_loaded = 0; } return; } void __cdecl screen_non_animated_warp_find_xxxxx(short param_1,short param_2) { area_screen_non_animated_obj *paVar1; short sVar2; area_screen *paVar3; if (param_1 < 0) { paVar3 = &loaded_screen; } else { paVar3 = loaded_area_screens[param_1]; } paVar1 = paVar3->non_animated_objs[0]; sVar2 = 0; if (0 < (short)paVar3->non_animated_obj_count[0]) { do { if (((6 < (short)paVar1->type) && ((short)paVar1->type < 0xc)) && ((int)(uint)paVar1->new_screen >> 6 == (int)(param_2 >> 6))) { return; } paVar1 = paVar1 + 1; sVar2 = sVar2 + 1; } while (sVar2 < (short)paVar3->non_animated_obj_count[0]); } return; } undefined4 __cdecl area_screen_type(short param_1) { return CONCAT22((short)((uint)loaded_area_screens[param_1] >> 0x10), loaded_area_screens[param_1]->type); } uint __cdecl area_screen_type_b0(short param_1) { return CONCAT22((short)((uint)loaded_area_screens[param_1] >> 0x10), loaded_area_screens[param_1]->type) & 0xffff0001; } void __stdcall nullsub(void) { return; } void __stdcall nullsub(void) { return; } void __stdcall nullsub(void) { return; } void __stdcall nullsub(void) { return; } void __stdcall find_avail_item_package(void) { item_package *piVar1; for (piVar1 = item_package_ARRAY_0044de58; piVar1->available != 1; piVar1 = piVar1 + 1) { } return; } undefined4 __cdecl place_items_randomly(byte *param_1,short param_2,short param_3) { short sVar1; bool bVar2; byte bVar3; undefined2 extraout_var_02; undefined3 extraout_var; undefined3 extraout_var_00; undefined3 extraout_var_01; int iVar4; undefined4 uVar5; undefined2 extraout_var_03; undefined2 uVar6; short sVar7; short local_f4; short local_f2; short local_f0; undefined2 local_ee; undefined2 local_ec; undefined4 local_ea; short local_e4 [90]; short *local_30; undefined2 local_2a; short *local_28; undefined4 *local_24; undefined4 *local_20; short local_1c; undefined2 local_1a; short local_18; undefined2 local_16; short local_14; short local_12; short local_10; short local_e; short local_c; short local_a; short local_8; short local_6; local_6 = 0; local_2a = 1; if ((*param_1 & 1) == 0) { local_8 = 3; local_c = 24; local_e = 7; local_10 = 88; local_12 = 100; local_14 = 3146; local_16 = 0x20; local_18 = 64; local_1a = 0x18; } else { local_8 = 6; local_c = 16; local_e = 15; local_10 = 52; local_12 = 50; local_14 = 3015; local_16 = 0x10; local_18 = 32; local_1a = 0xd; } local_8 = local_8 * local_e; rand_shuffle_array(local_8,local_e4); local_a = 0; uVar6 = extraout_var_02; if (0 < param_2) { do { local_20 = (undefined4 *)find_avail_item_package(); local_1c = 0; while (local_1c == 0) { local_ec = 0; local_ea = 0; local_f2 = (local_e4[local_6] / local_e) * local_12 + local_10; local_f4 = (local_e4[local_6] % local_e) * local_18 + local_c; local_6 = local_6 + 1; if (local_8 <= local_6) { return 0; } local_f0 = local_18; local_ee = local_1a; bVar2 = false; sVar1 = *(short *)(param_1 + 0x9e); local_24 = (undefined4 *)deref_next_if_not_null(*(undefined4 **)(param_1 + 0xa0)); for (sVar7 = 0; (!bVar2 && (sVar7 < sVar1)); sVar7 = sVar7 + 1) { bVar3 = yet_another_intersect_rect(&local_f4,(short *)(local_24 + 3)); if ((short)CONCAT31(extraout_var,bVar3) != 0) { bVar2 = true; } local_24 = (undefined4 *)deref_next(local_24); } local_30 = *(short **)(param_1 + 0x7e); sVar1 = *(short *)(param_1 + 2); for (sVar7 = 0; (!bVar2 && (sVar7 < sVar1)); sVar7 = sVar7 + 1) { if ((3 < local_30[8]) && (bVar3 = yet_another_intersect_rect(&local_f4,local_30), (short)CONCAT31(extraout_var_00,bVar3) != 0)) { bVar2 = true; } local_30 = local_30 + 0x10; } sVar1 = *(short *)(param_1 + 10); local_28 = *(short **)(param_1 + 0x8e); for (sVar7 = 0; (!bVar2 && (sVar7 < sVar1)); sVar7 = sVar7 + 1) { bVar3 = yet_another_intersect_rect(&local_f4,local_28); if ((short)CONCAT31(extraout_var_01,bVar3) != 0) { bVar2 = true; } local_28 = local_28 + 0x14; } if (!bVar2) { local_1c = 1; } } iVar4 = (int)local_18 >> 1; if (iVar4 < 0) { iVar4 = iVar4 + (uint)(((int)local_18 & 1U) != 0); } local_f4 = local_f4 + (short)iVar4; local_f0 = local_16; local_ea = 0; local_30 = (short *)(local_20 + 3); memcpy((undefined4 *)local_30,(undefined4 *)&local_f4,0xe); local_30[7] = local_14; if (param_3 == 1000) { local_30[9] = 1000; } else if (param_3 == -1) { uVar5 = get_parts_related_array_item(); local_30[9] = (short)uVar5; } else { local_30[9] = param_3; if ((loaded_parts[param_3].state_flags & 0x4000) != 0) { local_30[7] = local_30[7] + 1; } } local_30[10] = 0; memcpy((undefined4 *)(local_30 + 0xb),(undefined4 *)&local_f4,10); local_30[0xf] = 0x800; *(short *)(param_1 + 0x9e) = *(short *)(param_1 + 0x9e) + 1; *(undefined2 *)(local_20 + 2) = 0; linked_list_insert(*(int **)(param_1 + 0xa0),local_20,0xffff); local_a = local_a + 1; uVar6 = extraout_var_03; } while (local_a < param_2); } return CONCAT22(uVar6,local_2a); } void __cdecl remove_item_from_screen(short param_1,int *param_2) { word *pwVar1; area_screen *paVar2; undefined4 uVar3; paVar2 = loaded_area_screens[param_1]; *(undefined2 *)(param_2 + 2) = 1; pwVar1 = &paVar2->num_items; *pwVar1 = *pwVar1 - 1; if (param_1 == loaded_screen_idx) { uVar3 = free_aseq(*(int **)((int)param_2 + 0x16)); *(undefined4 *)((int)param_2 + 0x16) = uVar3; loaded_screen.num_items = loaded_screen.num_items - 1; } linked_list_unlink((int *)paVar2->item_package_list,param_2); return; } void __cdecl place_item_on_area(short param_1,short param_2,short param_3,short param_4,short param_5) { area_screen *paVar1; undefined4 *puVar2; undefined4 *puVar3; short local_14; short local_12; undefined2 local_10; undefined2 local_e; undefined2 local_c; short local_6; paVar1 = loaded_area_screens[param_1]; puVar2 = (undefined4 *)find_avail_item_package(); local_c = 0; local_14 = param_2; if ((paVar1->type & 1) == 0) { if (2 < param_3) { param_3 = param_3 + -3; } local_12 = param_3 * 100 + 0x58; local_10 = 0x14; local_e = 0xd; local_6 = 0xc4a; } else { local_12 = param_3 * 0x32 + 0x34; local_10 = 10; local_e = 7; local_6 = 0xbc7; } if ((param_4 != 1000) && ((loaded_parts[param_4].state_flags & 0x4000) != 0)) { local_6 = local_6 + 1; } memcpy(puVar2 + 3,(undefined4 *)&local_14,0xe); *(short *)((int)puVar2 + 0x1a) = local_6; *(short *)((int)puVar2 + 0x1e) = param_4; *(undefined2 *)(puVar2 + 8) = 0; memcpy((undefined4 *)((int)puVar2 + 0x22),(undefined4 *)&local_14,10); *(undefined2 *)((int)puVar2 + 0x2a) = 0x800; if (param_5 == 0) { paVar1->num_items = paVar1->num_items + 1; if (param_1 == loaded_screen_idx) { loaded_screen.num_items = loaded_screen.num_items + 1; puVar3 = load_aseq(*(short *)((int)puVar2 + 0x1a)); *(undefined4 **)((int)puVar2 + 0x16) = puVar3; aseq_set_pos_order(*(int *)((int)puVar2 + 0x16),local_14,local_12,0x14); anim_state_xxx_list_insert_4(*(undefined4 **)((int)puVar2 + 0x16)); } } *(undefined2 *)(puVar2 + 2) = 0; linked_list_insert((int *)paVar1->item_package_list,puVar2,0xffff); return; } area_screen * __cdecl actor_get_screen(int param_1) { return loaded_area_screens[*(short *)(param_1 + 0x1a)]; } void __cdecl place_item_randomly_on_random_screen(short param_1) { bool bVar1; uint uVar2; undefined4 uVar3; short sVar4; bVar1 = false; while (!bVar1) { do { if (area_num_screens == 1) { sVar4 = 0; } else { uVar2 = rand(); sVar4 = (short)((int)uVar2 % (area_num_screens + -1)); } sVar4 = sVar4 + 1; } while ((sVar4 == loaded_screen_idx) || (*(short *)(area_related_ints + sVar4 * 2) == 0)); uVar3 = place_items_randomly((byte *)loaded_area_screens[sVar4],1,param_1); if ((short)uVar3 != 0) { bVar1 = true; } } return; } void __cdecl write_doors_items(undefined1 *param_1,short *param_2) { area_screen *paVar1; short sVar2; short sVar3; area_screen_non_animated_obj *paVar4; int iVar5; undefined4 *puVar6; short sVar8; short local_6; undefined4 uVar7; local_6 = 0; do { paVar1 = loaded_area_screens[local_6]; if (paVar1 != (area_screen *)0x0) { paVar4 = paVar1->non_animated_objs[0]; for (sVar2 = 0; sVar2 < (short)paVar1->non_animated_obj_count[0]; sVar2 = sVar2 + 1) { if (paVar4->type == 7) { *param_1 = 7; param_1 = param_1 + 1; } if (paVar4->type == 9) { *param_1 = 9; param_1 = param_1 + 1; } paVar4 = paVar4 + 1; } iVar5 = linked_list_sz(&paVar1->item_package_list->next); sVar2 = (short)iVar5; *param_2 = sVar2; param_2 = param_2 + 1; sVar8 = 0; puVar6 = (undefined4 *)deref_next_if_not_null(&paVar1->item_package_list->next); if (0 < sVar2) { do { *param_2 = *(short *)(puVar6 + 3); if ((paVar1->type & 1) == 0) { uVar7 = rect_y_to_ylevel_back((int)(puVar6 + 3)); sVar3 = (short)uVar7; } else { uVar7 = rect_y_to_ylevel_front((int)(puVar6 + 3)); sVar3 = (short)uVar7; } param_2[1] = sVar3; param_2[2] = *(short *)((int)puVar6 + 0x1e); param_2 = param_2 + 3; puVar6 = (undefined4 *)deref_next(puVar6); sVar8 = sVar8 + 1; } while (sVar8 < sVar2); } } local_6 = local_6 + 1; } while (local_6 < 0x10); return; } void __cdecl parse_save_stuff_on_map(char *param_1,ushort *param_2) { ushort uVar1; word wVar2; area_screen *paVar3; area_screen_non_animated_obj *paVar4; short sVar5; short sVar6; short local_6; make_avail_all_item_packages(); num_bananas_on_map = 0; local_6 = 0; do { paVar3 = loaded_area_screens[local_6]; if (paVar3 != (area_screen *)0x0) { uVar1 = paVar3->type; paVar4 = paVar3->non_animated_objs[0]; for (sVar6 = 0; sVar6 < (short)paVar3->non_animated_obj_count[0]; sVar6 = sVar6 + 1) { if ((paVar4->type == 7) || (paVar4->type == 9)) { paVar4->type = (short)*param_1; param_1 = param_1 + 1; if (paVar4->type == 9) { (paVar4->coll_rect).s = 4; if ((uVar1 & 1) == 0) { sVar5 = 3110; } else { sVar5 = 3008; } paVar4->aseq_idx = sVar5; } } paVar4 = paVar4 + 1; } linked_list_head_zero(&paVar3->item_package_list->next); wVar2 = *param_2; paVar3->num_items = wVar2; param_2 = param_2 + 1; sVar6 = 0; if (0 < (short)wVar2) { do { place_item_on_area(local_6,*param_2,param_2[1],param_2[2],1); if (param_2[2] == 1000) { num_bananas_on_map = num_bananas_on_map + 1; } param_2 = param_2 + 3; sVar6 = sVar6 + 1; } while (sVar6 < (short)wVar2); } } local_6 = local_6 + 1; } while (local_6 < 0x10); return; } int __cdecl area_screen_thing0_0_idx(short param_1,short param_2) { if (param_2 == -1) { return 0; } return (int)(loaded_area_screens[param_1]->non_animated_objs[0] + param_2); } int __cdecl area_screen_thing1_0_idx(short param_1,short param_2) { return (int)(loaded_area_screens[param_1]->animated_objs[0] + param_2); } void __cdecl get_area_screen_list_idx(short param_1,ushort param_2) { linked_list_index(&loaded_area_screens[param_1]->item_package_list->next,param_2); return; } void __stdcall unlock_all_doors(void) { ushort uVar1; area_screen *paVar2; area_screen_non_animated_obj *paVar3; short sVar4; short sVar5; short sVar6; sVar5 = 0; do { paVar2 = loaded_area_screens[sVar5]; if (paVar2 != (area_screen *)0x0) { uVar1 = paVar2->type; paVar3 = paVar2->non_animated_objs[0]; for (sVar4 = 0; sVar4 < (short)paVar2->non_animated_obj_count[0]; sVar4 = sVar4 + 1) { if (paVar3->type == 7) { paVar3->type = 9; (paVar3->coll_rect).s = 4; if ((uVar1 & 1) == 0) { sVar6 = 0xc26; } else { sVar6 = 0xbc0; } paVar3->aseq_idx = sVar6; } paVar3 = paVar3 + 1; } } sVar5 = sVar5 + 1; } while (sVar5 < 0x10); return; } void __cdecl race_02_twiddle_step_count(int param_1) { if (*(short *)(param_1 + 0x1c) == 0) { *(int *)(param_1 + 0x12) = *(int *)(param_1 + 0x12) + *(int *)(param_1 + 0x36); if (*(int *)(param_1 + 0x26) < *(int *)(param_1 + 0x12)) { *(undefined4 *)(param_1 + 0x12) = *(undefined4 *)(param_1 + 0x26); } } else { if (*(int *)(param_1 + 0x22) < *(int *)(param_1 + 0x12)) { *(int *)(param_1 + 0x12) = *(int *)(param_1 + 0x12) + -0x3333; return; } *(int *)(param_1 + 0x12) = *(int *)(param_1 + 0x12) + *(int *)(param_1 + 0x32); if (*(int *)(param_1 + 0x22) < *(int *)(param_1 + 0x12)) { *(undefined4 *)(param_1 + 0x12) = *(undefined4 *)(param_1 + 0x22); return; } } return; } undefined4 __cdecl race_02_process_path(ushort *param_1) { ushort uVar1; bool bVar2; undefined4 in_ECX; undefined4 uVar3; ushort local_6; bVar2 = false; uVar3 = 0; while (!bVar2) { param_1[0xb] = param_1[0xb] + 1; uVar1 = *(ushort *)(*(int *)(param_1 + 0xc) + (short)param_1[0xb] * 6); switch(*(undefined2 *)(*(int *)(param_1 + 0xc) + 4 + (short)param_1[0xb] * 6)) { case 0xfff1: param_1[1] = uVar1; break; case 0xfff2: stop_playing_wave_by_id_type1(uVar1); break; case 0xfff3: local_6 = (ushort)((uint)in_ECX >> 0x10); play_wave_flag1(uVar1,local_6 & 0xff,(short)(char)((uint)in_ECX >> 0x18)); break; default: bVar2 = true; break; case 0xfffb: if (param_1[0x10] != 0) { param_1[0x10] = param_1[0x10] - 1; } param_1[0xb] = 0; break; case 0xfffc: param_1[0xe] = 0; break; case 0xfffd: param_1[0xe] = 1; break; case 0xfffe: if (param_1[0x10] == 0) { param_1[0xf] = 1; race_lost = race_lost | *param_1; uVar3 = 1; } } } return uVar3; } void __cdecl race_02_calc_parts_result(int param_1,short *param_2) { word wVar1; int iVar2; dword dVar3; dword local_1c; int local_18; int local_14; dword local_10; dword local_c; word local_8; word local_6; dVar3 = 0; local_10 = race_02_base_max_speed[save_file_big->area]; local_14 = 0; local_18 = 0; local_c = local_10; do { if (*param_2 == -1) { switch(save_file_big->area) { case 0: local_14 = 0x4ccd; break; case 1: local_18 = more_precise_div_xxx(local_1c,dVar3); local_18 = local_14 + local_18; local_14 = local_18; break; case 2: local_10 = local_c; local_18 = more_precise_div_xxx(local_1c,dVar3); local_18 = local_14 + local_18; local_14 = local_18; break; case 3: local_18 = more_precise_div_xxx(local_1c,dVar3); local_18 = local_14 + local_18; local_14 = local_18; break; case 4: local_10 = local_c; local_18 = more_precise_div_xxx(local_1c,dVar3); local_18 = local_14 + local_18; local_14 = local_18; break; case 10: local_18 = local_14; break; case 0xb: case 0xc: case 0xd: case 0xe: if ((short)local_8 < (short)local_6) { local_1c = DWORD_ARRAY_004483cc[(short)local_8]; } else { local_1c = DWORD_ARRAY_004483cc[(short)local_6]; } if (dVar3 != 0) { iVar2 = more_precise_div_xxx(local_1c,dVar3); local_14 = local_14 + iVar2; } local_18 = local_14; } *(int *)(param_1 + 0x32) = local_18; *(int *)(param_1 + 0x36) = local_14; *(dword *)(param_1 + 0x26) = local_c; if ((int)local_c < (int)local_10) { *(dword *)(param_1 + 0x22) = local_c; } else { *(dword *)(param_1 + 0x22) = local_10; } *(undefined2 *)(param_1 + 0x1c) = 0; return; } wVar1 = loaded_parts[*param_2].perf; switch(loaded_parts[*param_2].slot) { case 1: case 0x35: local_c = local_c - DWORD_ARRAY_004483ac[(short)wVar1]; break; case 3: local_10 = DWORD_ARRAY_0044837c[(short)wVar1]; break; case 4: case 0x34: local_14 = local_14 + DWORD_ARRAY_004483ec[(short)wVar1]; break; case 5: dVar3 = DWORD_ARRAY_004483fc[(short)wVar1]; break; case 6: case 0x39: local_6 = wVar1; break; case 7: case 0x38: local_8 = wVar1; break; case 8: local_c = local_c - DWORD_ARRAY_0044840c[(short)wVar1]; break; case 9: local_c = local_c - DWORD_ARRAY_004483dc[(short)wVar1]; local_1c = DWORD_ARRAY_004483bc[(short)wVar1]; break; case 0x30: local_14 = local_14 + DWORD_ARRAY_0044841c[(short)wVar1]; break; case 0x32: local_c = local_c - DWORD_ARRAY_0044842c[(short)wVar1]; break; case 0x33: local_14 = local_14 + DWORD_ARRAY_0044843c[(short)wVar1]; local_c = local_c - DWORD_ARRAY_0044844c[(short)wVar1]; break; case 0x37: local_14 = local_14 + DWORD_ARRAY_0044839c[(short)wVar1]; case 0: local_c = local_c - DWORD_ARRAY_0044838c[(short)wVar1]; break; case 0x3a: local_8 = wVar1; } param_2 = param_2 + 1; } while( true ); } void __stdcall race_02_on_load(void) { short sVar1; short sVar2; int *piVar3; nullishsub(); area_02_race_data[0].race_winner_determiner = 1; area_02_race_data[1].race_winner_determiner = 2; area_02_race_data[0].finished_cmd2 = 0; area_02_race_data[1].finished_cmd2 = 0; area_02_race_data[0].speed_fine = 0; area_02_race_data[0].race_data_idx_pos = 0; area_02_race_data[1].speed_fine = 0; area_02_race_data[1].race_data_idx_pos = 0; area_02_race_data[0].laps_counter = race_02_extra_laps[save_file_big->area]; race_lost = 0; area_02_race_data[1].laps_counter = area_02_race_data[0].laps_counter; load_midi(area_02_race_bgm_idx[(short)save_file_big->building_idx]); midi_stop_and_play(area_02_race_bgm_idx[(short)save_file_big->building_idx],1); area_02_race_ints = (short *)load_wave_by_ints(3300); sVar1 = save_file_big->area; piVar3 = load_aseq(area_02_race_bg_aseq[sVar1]); aseq_draw_to_both_fbs((int)piVar3,0,0,0); free_aseq(piVar3); sVar2 = 3300; if (sVar1 != 0) { sVar2 = 0xce5; } load_rrgb_1(sVar2); area_02_race_data[0].race_rsrc = (short *)load_resource_item_0(area_02_race_player_race_rsrc[sVar1],(int *)&race); area_02_race_data[1].race_rsrc = (short *)load_resource_item_0(area_02_race_opponent_race_rsrc[sVar1],(int *)&race); area_02_race_data[0].anim_state = (aseq_anim_state_struct *) load_aseq((short)save_file_big->vehicle_colors_shapes[save_file_big->area] + area_02_race_player_aseq_base[sVar1]); area_02_race_data[1].anim_state = (aseq_anim_state_struct *)load_aseq(area_02_race_opponent_aseq[sVar1]); race_02_calc_parts_result(0x44e8ae,filtered_parts_array); race_02_calc_parts_result(0x44e8ec,opponent_parts); area_02_race_data[0].draw_order = 6; area_02_race_data[1].draw_order = 5; aseq_set_pos_order((int)area_02_race_data[1].anim_state,*area_02_race_data[1].race_rsrc, area_02_race_data[1].race_rsrc[1],5); aseq_anim_set_img_and_flags ((int)area_02_race_data[1].anim_state,0, area_02_race_data[1].race_rsrc[area_02_race_data[1].race_data_idx_pos * 3 + 2],0); anim_state_xxx_list_insert_8004((undefined4 *)area_02_race_data[1].anim_state); aseq_set_pos_order((int)area_02_race_data[0].anim_state,*area_02_race_data[0].race_rsrc, area_02_race_data[0].race_rsrc[1],area_02_race_data[1].draw_order); aseq_anim_set_img_and_flags ((int)area_02_race_data[0].anim_state,0, area_02_race_data[0].race_rsrc[area_02_race_data[0].race_data_idx_pos * 3 + 2],0); anim_state_xxx_list_insert_8004((undefined4 *)area_02_race_data[0].anim_state); area_02_race_state = 0; DAT_004520e4 = 1; FUN_00422170(); status_bar_flags = status_bar_flags | 0x20; return; } void __stdcall race_02_on_remove(void) { nullishsub(); area_02_race_data[0].anim_state = (aseq_anim_state_struct *)free_aseq((int *)area_02_race_data[0].anim_state); area_02_race_data[1].anim_state = (aseq_anim_state_struct *)free_aseq((int *)area_02_race_data[1].anim_state); free_resource_item_with_data((int)area_02_race_data[0].race_rsrc); free_resource_item_with_data((int)area_02_race_data[1].race_rsrc); free_midi(area_02_race_bgm_idx[(short)save_file_big->building_idx]); area_02_race_ints = (short *)free_waves_from_list((int)area_02_race_ints); FUN_0042211c(); return; } void __stdcall race_02_twiddle_0(void) { int iVar1; undefined4 uVar2; short sVar3; race_02_twiddle_step_count(0x44e8ae); iVar1 = area_02_race_data[0].speed_fine; if (area_02_race_data[0].finished_cmd2 == 0) { for (sVar3 = 0; sVar3 < (short)((uint)iVar1 >> 0x10); sVar3 = sVar3 + 1) { uVar2 = race_02_process_path(&area_02_race_data[0].race_winner_determiner); if ((short)uVar2 != 0) break; } } aseq_set_pos_order((int)area_02_race_data[0].anim_state, area_02_race_data[0].race_rsrc[area_02_race_data[0].race_data_idx_pos * 3], area_02_race_data[0].race_rsrc[area_02_race_data[0].race_data_idx_pos * 3 + 1], area_02_race_data[0].draw_order); aseq_anim_set_img_and_flags ((int)area_02_race_data[0].anim_state,0, area_02_race_data[0].race_rsrc[area_02_race_data[0].race_data_idx_pos * 3 + 2],0); return; } void __stdcall race_02_twiddle_1(void) { int iVar1; undefined4 uVar2; short sVar3; race_02_twiddle_step_count(0x44e8ec); iVar1 = area_02_race_data[1].speed_fine; if (area_02_race_data[1].finished_cmd2 == 0) { for (sVar3 = 0; sVar3 < (short)((uint)iVar1 >> 0x10); sVar3 = sVar3 + 1) { uVar2 = race_02_process_path(&area_02_race_data[1].race_winner_determiner); if ((short)uVar2 != 0) break; } } aseq_set_pos_order((int)area_02_race_data[1].anim_state, area_02_race_data[1].race_rsrc[area_02_race_data[1].race_data_idx_pos * 3], area_02_race_data[1].race_rsrc[area_02_race_data[1].race_data_idx_pos * 3 + 1], area_02_race_data[1].draw_order); aseq_anim_set_img_and_flags ((int)area_02_race_data[1].anim_state,0, area_02_race_data[1].race_rsrc[area_02_race_data[1].race_data_idx_pos * 3 + 2],0); return; } uint __stdcall race_02_on_periodic(void) { int iVar1; xxxfunc_funcset *pxVar2; uint uVar3; draw_status_bar(0); iVar1 = (int)area_02_race_state; if (iVar1 == 0) { iVar1 = get_time_ms(); uVar3 = time_get_secs_count(1); DAT_0044e8a8 = iVar1 + uVar3; area_02_race_state = 1; return uVar3; } if (iVar1 == 1) { uVar3 = get_time_ms(); if (DAT_0044e8a8 < uVar3) { area_02_race_state = 2; aseq_anim_reset_and_play((undefined4 *)area_02_race_data[0].anim_state); aseq_anim_reset_and_play((undefined4 *)area_02_race_data[1].anim_state); anim_set_flags_0x800_handler((int)area_02_race_data[0].anim_state,0x40649e,0); uVar3 = anim_set_flags_0x800_handler((int)area_02_race_data[1].anim_state,0x406526,0); return uVar3; } } else { if (iVar1 - 2U != 0) { return iVar1 - 2U; } if ((area_02_race_data[0].finished_cmd2 == 0) && (area_02_race_data[1].finished_cmd2 == 0)) { uVar3 = 2; if (area_02_race_data[0].race_data_idx_pos < area_02_race_data[1].race_data_idx_pos) { return 3; } } else { if (race_lost == 1) { race_lost = 0; } else if (race_lost == 2) { race_lost = 1; } else if (race_lost == 3) { if (area_02_race_data[0].speed_fine < area_02_race_data[1].speed_fine) { race_lost = 1; } else { race_lost = 0; } } area_02_race_state = 3; if ((DAT_00449c66 == 0) && (race_lost == 0)) { save_file_big->num_built_vehicles[(short)save_file_big->building_idx] = save_file_big->num_built_vehicles[(short)save_file_big->building_idx] + 1; save_file_big->total_built_vehicles = save_file_big->total_built_vehicles + 1; } if (DAT_00449c66 == 0) { pxVar2 = &xxxfunc_funcset_00448a28; } else { pxVar2 = &xxxfunc_funcset_00448a34; } uVar3 = xxxfunc_set(pxVar2); } } return uVar3; } void __cdecl draw_fancy_number(short param_1,short param_2,uint param_3,short param_4,short param_5) { uint uVar1; uint uVar2; short sVar3; uVar2 = *(uint *)(&DAT_004484b8 + param_4 * 2); sVar3 = 0; if (0 < param_4) { do { uVar1 = param_3 / uVar2; param_3 = param_3 % uVar2; aseq_draw_gfx_and_xxx ((int)status_bar_digits_and_stuff_aseqs[param_5],param_1,param_2,(short)uVar1,6); param_1 = param_1 + 0x12; uVar2 = uVar2 / 10; sVar3 = sVar3 + 1; } while (sVar3 < param_4); } return; } void __stdcall FUN_00406796(void) { gfxish_fill_rect_wrap(0,0x13c,0x200,0x44,900); gfxish_fill_rect_wrap(0,0x13c,0x200,2,0x17); gfxish_copy_dest_to_otherbuf_wrap(); return; } void __stdcall FUN_004067e4(void) { if (DAT_0044b95e == 0) { gfxish_fill_rect_wrap(0x15d,0x13c,0xa3,0x44,900); gfxish_fill_rect_wrap(0x15d,0x13c,0xa3,2,0x17); return; } gfxish_fill_rect_wrap(0x15d,0x13c,0xa3,0x44,0); gfxish_fill_rect_wrap(0x15e,0x13d,0xa1,0x42,0xfff); return; } void __stdcall gfx_get_163_68_rect(void) { uint uVar1; undefined2 local_c; undefined2 local_a; undefined2 local_8; undefined2 local_6; local_c = 349; local_a = 316; local_8 = 163; local_6 = 68; uVar1 = gfxish_calc_sz(0xa3,0x44); gfx_163_68_rect = (gfx_rect *)alloc_tracked_heap_block(uVar1); gfxish_save_rect(&local_c,(undefined2 *)gfx_163_68_rect); return; } void __stdcall gfx_restore_163_68_rect(void) { gfxish_copy_block(); gfxish_invalidate_rect((short *)gfx_163_68_rect); free_tracked_heap_block((int)gfx_163_68_rect); gfx_163_68_rect = (gfx_rect *)0x0; return; } void __stdcall FUN_004068e6(void) { gfxish_fill_rect_wrap(0x20,0x13c,0xfc,0x44,900); gfxish_copy_dest_to_otherbuf_wrap(); return; } void __cdecl FUN_0040691c(short *param_1) { gfxish_fill_rect_wrap(*param_1,param_1[1],param_1[2],param_1[3],900); return; } void __cdecl FUN_00406944(uint param_1) { if ((param_1 & 4) != 0) { aseq_draw_gfx_and_xxx((int)status_bar_aseqs[0],-0x8000,-0x8000,0,6); } if ((param_1 & 2) != 0) { aseq_draw_gfx_and_xxx((int)status_bar_aseqs[1],-0x8000,-0x8000,0,6); } if ((param_1 & 1) != 0) { aseq_draw_gfx_and_xxx((int)status_bar_aseqs[2],-0x8000,-0x8000,0,6); } return; } void __stdcall status_bar_part_put_down(void) { FUN_004072ac(); status_bar_flags = status_bar_flags | 0x8000; return; } void __cdecl status_bar_part_pick_up(int param_1) { int iVar1; part_chunk *ppVar2; undefined4 *puVar3; int *piVar4; undefined2 uVar5; ppVar2 = loaded_parts; if (DAT_004484ba == 0) { iVar1 = *(int *)(param_1 + 0x1e); if (((int)(short)loaded_parts[iVar1].state_flags & 0x8000U) == 0) { mouse_region_remove_by_filter_key(200); status_bar_held_part_idx_in_part_file = ppVar2[iVar1].idx_in_file; anim_state_xxx_list_remove((int *)ppVar2[iVar1].rect_and_anim_for_status_bar.anim); puVar3 = (undefined4 *) aseq_setup_as_cursor ((int)ppVar2[iVar1].rect_and_anim_for_status_bar.anim, (short)ppVar2[iVar1].rect_and_anim_for_status_bar.rect.w >> 1, (short)ppVar2[iVar1].rect_and_anim_for_status_bar.rect.h >> 1); set_custom_cursor(puVar3); uVar5 = 0xc9; piVar4 = mouse_region_new_up(0,0x13c,0x200,0x44,0xf,0x4069b1); mouse_region_set_filter_key((int)piVar4,uVar5); if (loaded_screen_idx != 0) { uVar5 = 0xc9; piVar4 = mouse_region_new_up(0x132,0x14a,0x23,0x2e,0x14,0x4072cf); mouse_region_set_filter_key((int)piVar4,uVar5); } clip_cursor_enable(0,0x13c,0x1ff,0x43); play_wave_flag1(ints_200[2],5,0); } status_bar_flags = status_bar_flags | 0x10; status_bar_text = ppVar2[iVar1].text; } return; } int __cdecl part_find_pair_or_next_xxx(undefined4 *param_1) { part_chunk *ppVar1; if (*(short *)(param_1 + 7) == -1) { ppVar1 = (part_chunk *)part_find_next_skipping_second___(param_1); if (ppVar1 == (part_chunk *)0x0) { part_find_prev_skipping_second___((int)param_1); } } else { ppVar1 = loaded_parts + ((int)*(short *)(param_1 + 7) & 0x7fff); } return (int)ppVar1; } void __stdcall status_bar_load_xxx(void) { aseq_anim_state_struct *paVar1; short sVar2; ints_200 = (short *)load_wave_by_ints(200); sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *)load_aseq(sVar2 + 1800); status_bar_aseqs[sVar2] = paVar1; sVar2 = sVar2 + 1; } while (sVar2 < 5); paVar1 = (aseq_anim_state_struct *)load_aseq(1804); status_bar_aseqs[sVar2] = paVar1; aseq_set_pos_order((int)status_bar_aseqs[0],0x15d,0x13d,10); aseq_set_pos_order((int)status_bar_aseqs[1],0x15d,0x153,10); aseq_set_pos_order((int)status_bar_aseqs[2],0x15d,0x168,10); aseq_set_pos_order((int)status_bar_aseqs[3],0x132,0x14a,10); aseq_set_pos_order((int)status_bar_aseqs[4],3,0x14c,10); aseq_select_anim((int)status_bar_aseqs[5],1); aseq_set_pos_order((int)status_bar_aseqs[5],0x11d,0x14c,10); sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *)load_aseq(sVar2 + 1806); status_bar_digits_and_stuff_aseqs[sVar2] = paVar1; sVar2 = sVar2 + 1; } while (sVar2 < 3); DAT_004484ba = 0; DAT_0044e970 = 0; DAT_0044e972 = 0; return; } void __stdcall FUN_00406c24(void) { aseq_anim_state_struct *paVar1; short sVar2; free_waves_from_list((int)ints_200); sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)status_bar_aseqs[sVar2]); status_bar_aseqs[sVar2] = paVar1; sVar2 = sVar2 + 1; } while (sVar2 < 6); sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)status_bar_digits_and_stuff_aseqs[sVar2]); status_bar_digits_and_stuff_aseqs[sVar2] = paVar1; sVar2 = sVar2 + 1; } while (sVar2 < 3); return; } void __cdecl FUN_00406c7b(undefined2 param_1) { undefined2 extraout_var; DAT_004484ba = 0; FUN_00406796(); FUN_00406944(CONCAT22(extraout_var,param_1)); gfxish_copy_dest_to_otherbuf_wrap(); return; } void __stdcall draw_status_bar_numbers(void) { draw_fancy_number(0x1db,0x13d,(uint)(save_file_big->basic_stats).parts_needed,2,1); draw_fancy_number(0x1c9,0x153,(uint)(save_file_big->basic_stats).bananas,3,0); draw_fancy_number(0x193,0x168,(save_file_big->player_entry).score,6,2); return; } void __cdecl status_bar_position_parts(undefined4 *param_1,short param_2) { bool bVar1; part_chunk *ppVar2; undefined4 *puVar3; part_chunk *ppVar4; uint uVar5; word wVar6; int iVar7; if (-1 < *(short *)(param_1 + 7)) { param_1 = (undefined4 *)(loaded_parts + *(short *)(param_1 + 7)); } (((part_chunk *)param_1)->rect_and_anim_for_status_bar).rect.x = 0; wVar6 = (((part_chunk *)param_1)->rect_and_anim_for_status_bar).rect.w; if (param_2 == 2) { iVar7 = 0; } else { iVar7 = part_find_prev_skipping_second___((int)param_1); } if (param_2 == 1) { puVar3 = (undefined4 *)0x0; } else { puVar3 = (undefined4 *)part_find_next_skipping_second___(param_1); } if ((iVar7 == 0) && (puVar3 == (undefined4 *)0x0)) { bVar1 = true; } else { bVar1 = false; } while (!bVar1) { if (iVar7 != 0) { if ((int)*(short *)(iVar7 + 0x3e) + (int)(short)wVar6 < 0xf8) { *(undefined2 *)(iVar7 + 0x3a) = 0; wVar6 = wVar6 + *(short *)(iVar7 + 0x3e) + 6; } else { *(undefined2 *)(iVar7 + 0x3a) = 0xffff; if (*(short *)(iVar7 + 0x1c) != -1) { loaded_parts[(int)*(short *)(iVar7 + 0x1c) & 0x7fff].rect_and_anim_for_status_bar.rect.x = 0xffff; } } iVar7 = part_find_prev_skipping_second___(iVar7); } if (puVar3 != (undefined4 *)0x0) { if ((int)*(short *)((int)puVar3 + 0x3e) + (int)(short)wVar6 < 0xf8) { *(undefined2 *)((int)puVar3 + 0x3a) = 0; wVar6 = wVar6 + *(short *)((int)puVar3 + 0x3e) + 6; } else { *(undefined2 *)((int)puVar3 + 0x3a) = 0xffff; if (*(short *)(puVar3 + 7) != -1) { loaded_parts[(int)*(short *)(puVar3 + 7) & 0x7fff].rect_and_anim_for_status_bar.rect.x = 0xffff; } } puVar3 = (undefined4 *)part_find_next_skipping_second___(puVar3); } if ((iVar7 == 0) && (puVar3 == (undefined4 *)0x0)) { bVar1 = true; } else { bVar1 = false; } } wVar6 = 0x20; status_bar_first_part = (part_chunk *)0x0; status_bar_last_part = (part_chunk *)0x0; for (ppVar4 = (part_chunk *)deref_next_if_not_null(&(actors[0].parts_linked_list)->next); ppVar4 != (part_chunk *)0x0; ppVar4 = (part_chunk *)part_find_next_skipping_second___((undefined4 *)ppVar4)) { if ((ppVar4->rect_and_anim_for_status_bar).rect.x == 0) { (ppVar4->rect_and_anim_for_status_bar).rect.x = wVar6; (ppVar4->rect_and_anim_for_status_bar).rect.y = 0x143; ppVar2 = loaded_parts; if (status_bar_first_part == (part_chunk *)0x0) { status_bar_first_part = ppVar4; } status_bar_last_part = ppVar4; if ((ppVar4->idx_other_part_of_same_slot != 0xffff) && ((ppVar4->idx_other_part_of_same_slot & 0x8000) != 0)) { uVar5 = (int)(short)ppVar4->idx_other_part_of_same_slot & 0x7fff; loaded_parts[uVar5].rect_and_anim_for_status_bar.rect.x = wVar6; ppVar2[uVar5].rect_and_anim_for_status_bar.rect.y = 0x161; } wVar6 = wVar6 + (ppVar4->rect_and_anim_for_status_bar).rect.w + 6; } } return; } void __stdcall status_bar_remove_all_parts(void) { undefined4 *puVar1; for (puVar1 = (undefined4 *)deref_next_if_not_null(&(actors[0].parts_linked_list)->next); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { anim_state_xxx_list_remove((int *)puVar1[0x11]); } return; } void __stdcall status_bar_put_in_parts(void) { undefined4 *puVar1; int *piVar2; undefined2 uVar3; puVar1 = (undefined4 *)deref_next_if_not_null(&(actors[0].parts_linked_list)->next); gfxish_fill_rect_wrap(0x20,0x13e,0xfc,0x42,900); DAT_004484b8 = 0; DAT_0044e974 = 0; for (; puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { if (*(short *)((int)puVar1 + 0x3a) != -1) { aseq_set_pos_order(puVar1[0x11],*(short *)((int)puVar1 + 0x3a),*(short *)(puVar1 + 0xf),0x32); anim_state_xxx_list_insert_4((undefined4 *)puVar1[0x11]); piVar2 = mouse_region_new_from_rect_up((short *)((int)puVar1 + 0x3a),0xf,0x4069c4); mouse_region_set_filter_key((int)piVar2,200); mouse_region_set_extra_data((int)piVar2,(int)*(short *)(puVar1 + 0x18)); } } anim_state_xxx_list_insert_4((undefined4 *)status_bar_aseqs[3]); anim_state_xxx_list_insert_4((undefined4 *)status_bar_aseqs[4]); anim_state_xxx_list_insert_4((undefined4 *)status_bar_aseqs[5]); uVar3 = 200; piVar2 = mouse_region_new_up(3,0x14c,0x13,0x2c,10,0x407212); mouse_region_set_filter_key((int)piVar2,uVar3); uVar3 = 200; piVar2 = mouse_region_new_up(0x11d,0x14c,0x13,0x2c,10,0x4071b2); mouse_region_set_filter_key((int)piVar2,uVar3); return; } void __cdecl FUN_0040701b(short param_1,short param_2) { undefined4 *puVar1; undefined4 uVar2; puVar1 = (undefined4 *)deref_next_if_not_null(&(actors[0].parts_linked_list)->next); uVar2 = part_get_slot(param_1); for (; (short)uVar2 != *(short *)(puVar1 + 2); puVar1 = (undefined4 *)deref_next(puVar1)) { } if (*(short *)((int)puVar1 + 0x3a) == -1) { mouse_region_remove_by_filter_key(200); status_bar_position_parts(puVar1,0); status_bar_flags = status_bar_flags | 1; } status_bar_flags = status_bar_flags | 0x40; DAT_0044e978 = puVar1[0x11]; DAT_0044e97c = (aseq_anim_state_struct *)0x0; if (param_2 != 0) { DAT_0044e97c = loaded_parts[(int)*(short *)(puVar1 + 7) & 0x7fff].rect_and_anim_for_status_bar. anim; } return; } void __cdecl status_bar_set_text_flags_0x10(undefined4 param_1) { status_bar_text = param_1; status_bar_flags = status_bar_flags | 0x10; return; } void __cdecl FUN_004070c3(short param_1) { undefined4 *puVar1; undefined4 uVar2; puVar1 = (undefined4 *)deref_prev_if_not_null((int)actors[0].parts_linked_list); mouse_region_remove_by_filter_key(200); *(undefined2 *)((int)puVar1 + 0x42) = 0; puVar1[0x11] = loaded_parts[param_1].anim_for_status_bar; uVar2 = aseq_get_img_w((int)loaded_parts[param_1].anim_for_status_bar,*(short *)(puVar1 + 4)); *(short *)((int)puVar1 + 0x3e) = (short)uVar2; uVar2 = aseq_get_img_h((int)loaded_parts[param_1].anim_for_status_bar,*(short *)(puVar1 + 4)); *(short *)(puVar1 + 0x10) = (short)uVar2; *(undefined2 *)((int)puVar1 + 0x3a) = 0xffff; status_bar_set_text_flags_0x10(*(undefined4 *)((int)puVar1 + 0x5a)); status_bar_position_parts(puVar1,0); return; } void __cdecl part_clear_status_and_find_xxxx(short param_1) { status_bar_remove_all_parts(); part_find_pair_or_next_xxx((undefined4 *)(loaded_parts + param_1)); return; } void __cdecl status_bar_remove_mouse_and_position_xxx(undefined4 *param_1) { if (DAT_0044b95e == 0) { status_bar_flags = status_bar_flags | 0x8000; } mouse_region_remove_by_filter_key(200); if (param_1 != (undefined4 *)0x0) { status_bar_position_parts(param_1,0); } return; } void __stdcall status_bar_right_arrow(void) { undefined4 *puVar1; if ((status_bar_first_part != (part_chunk *)0x0) && (DAT_004484ba < 1)) { puVar1 = (undefined4 *)part_find_prev_skipping_second___((int)status_bar_first_part); if (puVar1 != (undefined4 *)0x0) { play_wave_flag1(ints_200[4],5,0); mouse_region_remove_by_filter_key(200); status_bar_position_parts(puVar1,2); status_bar_flags = status_bar_flags | 1; } } return; } void __stdcall status_bar_left_arrow(void) { undefined4 *puVar1; if ((status_bar_last_part != (part_chunk *)0x0) && (DAT_004484ba < 1)) { puVar1 = (undefined4 *)part_find_next_skipping_second___((undefined4 *)status_bar_last_part); if (puVar1 != (undefined4 *)0x0) { play_wave_flag1(ints_200[4],5,0); mouse_region_remove_by_filter_key(200); status_bar_position_parts(puVar1,1); status_bar_flags = status_bar_flags | 1; } } return; } void __stdcall FUN_00407272(void) { DAT_004484b4 = 0; FUN_004067e4(); FUN_0043e1b5(0); FUN_0043e266(-1,0x15e,0x13f,0xa1,status_bar_text); return; } void __stdcall FUN_004072ac(void) { free_cur_cursor(); clip_cursor_disable(); mouse_region_remove_by_filter_key(0xc9); status_bar_held_part_idx_in_part_file = 0xffff; return; } void __stdcall status_bar_part_put_in_recycling(void) { word *pwVar1; undefined4 *puVar2; undefined4 uVar3; int iVar4; mouse_region_remove_by_filter_key(200); mouse_region_remove_by_filter_key(201); puVar2 = (undefined4 *) part_find_pair_or_next_xxx ((undefined4 *)(loaded_parts + status_bar_held_part_idx_in_part_file)); uVar3 = part_get_is_not_decoration(status_bar_held_part_idx_in_part_file); iVar4 = actor_take_part(0,status_bar_held_part_idx_in_part_file,1); free_cur_cursor(); clip_cursor_disable(); loaded_parts[status_bar_held_part_idx_in_part_file].state_flags = loaded_parts[status_bar_held_part_idx_in_part_file].state_flags | 0x4000; place_item_randomly_on_random_screen(status_bar_held_part_idx_in_part_file); status_bar_held_part_idx_in_part_file = 0xffff; if (puVar2 != (undefined4 *)0x0) { status_bar_position_parts(puVar2,0); } DAT_004520e4 = 1; if (((short)iVar4 == 0) && ((short)uVar3 != 0)) { pwVar1 = &(save_file_big->basic_stats).parts_needed; *pwVar1 = *pwVar1 + 1; } status_bar_flags = status_bar_flags | 0x8000; play_wave_flag1(ints_200[1],5,0); enqueue_new_player_hint(6,0,0); return; } void __cdecl draw_status_bar(ushort param_1) { short sVar1; bool bVar2; status_bar_flags = status_bar_flags & ~param_1; if ((DAT_004484b4 == 0) && (DAT_004520e4 != 0)) { DAT_004484b4 = 1; if (status_bar_held_part_idx_in_part_file != -1) { FUN_004072ac(); status_bar_flags = status_bar_flags | 1; } FUN_00406944(7); draw_status_bar_numbers(); } DAT_004520e4 = 0; if (status_bar_flags != 0) { if ((status_bar_flags & 0x8000) != 0) { DAT_004484ba = 0; status_bar_remove_all_parts(); mouse_region_remove_by_filter_key(200); FUN_00406796(); FUN_00406944(7); draw_status_bar_numbers(); status_bar_put_in_parts(); status_bar_flags = 0; } if ((status_bar_flags & 0x20) != 0) { status_bar_remove_all_parts(); mouse_region_remove_by_filter_key(200); FUN_00406944(7); draw_status_bar_numbers(); status_bar_flags = 0; } if ((status_bar_flags & 0x4000) != 0) { FUN_00406796(); FUN_00406944(1); status_bar_flags = 4; } bVar2 = (status_bar_flags & 1) != 0; if (bVar2) { status_bar_remove_all_parts(); status_bar_put_in_parts(); status_bar_flags = status_bar_flags & 0xfffe; } if ((status_bar_flags & 0x40) != 0) { if (DAT_004484ba == 0) { if ((!bVar2) && (sVar1 = aseq_anim_get_flags((int)DAT_0044e978), sVar1 == 0x10)) { aseq_anim_reset_and_play(DAT_0044e978); aseq_anim_reset_and_play(DAT_0044e97c); DAT_004484ba = 1; } } else if ((DAT_004484ba == 1) && (sVar1 = aseq_anim_get_flags((int)DAT_0044e978), sVar1 == 0x10)) { DAT_004484ba = 0; status_bar_flags = status_bar_flags & 0xffbf; } } if ((status_bar_flags & 8) != 0) { play_wave_flag1(ints_200[3],5,0); draw_fancy_number(0x1c9,0x153,(uint)(save_file_big->basic_stats).bananas,3,0); status_bar_flags = status_bar_flags & 0xfff7; } if ((status_bar_flags & 0x10) != 0) { FUN_00407272(); status_bar_flags = status_bar_flags & 0xffef; } if ((status_bar_flags & 2) != 0) { draw_fancy_number(0x1db,0x13d,(uint)(save_file_big->basic_stats).parts_needed,2,1); status_bar_flags = status_bar_flags & 0xfffd; } if ((status_bar_flags & 4) != 0) { draw_fancy_number(0x193,0x168,(save_file_big->player_entry).score,6,2); play_wave_flag1(*ints_200,5,0); status_bar_flags = status_bar_flags & 0xfffb; } } return; } void __cdecl increment_and_redraw_score(short param_1) { increment_score(param_1,1); draw_fancy_number(0x193,0x168,(save_file_big->player_entry).score,6,2); gfxish_do_a_paint(); return; } void __stdcall status_bar_put_down_held(void) { if (-1 < status_bar_held_part_idx_in_part_file) { status_bar_part_put_down(); draw_status_bar(0); } return; } void __stdcall nullsub(void) { return; } void __stdcall nullsub(void) { return; } void __stdcall nullsub(void) { return; } void __cdecl FUN_0040763b(short param_1,short param_2,short *param_3) { undefined4 *puVar1; puVar1 = load_aseq(*param_3); *(undefined4 **)(param_3 + 8) = puVar1; param_3[2] = 1; param_3[3] = 0; aseq_set_pos_order(*(int *)(param_3 + 8),param_1,param_2,5); return; } void __cdecl FUN_00407670(int param_1) { undefined4 uVar1; uVar1 = free_aseq(*(int **)(param_1 + 0x10)); *(undefined4 *)(param_1 + 0x10) = uVar1; return; } void __cdecl FUN_00407686(int param_1) { short sVar1; anim_state_xxx_list_remove(*(int **)(param_1 + 0x10)); sVar1 = 0; if (*(int *)(param_1 + 4) == 0) { sVar1 = 2; } aseq_select_anim(*(int *)(param_1 + 0x10),sVar1); anim_state_xxx_list_insert_4(*(undefined4 **)(param_1 + 0x10)); return; } void __stdcall nullsub(void) { return; } void __cdecl FUN_004076be(int param_1) { int iVar1; short sVar2; short sVar3; undefined4 uVar4; int *piVar5; short sVar6; short sVar7; short sVar8; code *pcVar9; iVar1 = *(int *)(param_1 + 0x10); uVar4 = aseq_get_img_w(iVar1,0); sVar6 = (short)uVar4; uVar4 = aseq_get_img_h(iVar1,0); sVar7 = (short)uVar4; pcVar9 = FUN_00434ec0; sVar8 = 5; sVar2 = FUN_004045e4(iVar1); sVar3 = FUN_004045b0(iVar1); piVar5 = mouse_region_new_up(sVar3,sVar2,sVar6,sVar7,sVar8,(uint)pcVar9); *(int **)(param_1 + 0x14) = piVar5; mouse_region_set_extra_data(*(int *)(param_1 + 0x14),*(undefined4 *)(param_1 + 0xc)); if (*(int *)(param_1 + 8) == 0) { *(undefined4 *)(param_1 + 0x18) = 0; } return; } void __cdecl FUN_0040772e(int param_1) { if (*(int *)(param_1 + 0x14) != 0) { mouse_region_delete_from_2(*(int **)(param_1 + 0x14)); *(undefined4 *)(param_1 + 0x14) = 0; } if (*(int *)(param_1 + 0x18) != 0) { *(undefined4 *)(param_1 + 0x18) = 0; } return; } void __cdecl FUN_00407757(int param_1) { anim_state_xxx_list_remove(*(int **)(param_1 + 0x10)); aseq_select_anim(*(int *)(param_1 + 0x10),1); anim_state_xxx_list_insert_4(*(undefined4 **)(param_1 + 0x10)); DAT_0044e980 = mouse_region_new_down(0,0,0x200,0x180,4,0x434ec0); mouse_region_set_extra_data((int)DAT_0044e980,*(undefined4 *)(param_1 + 0xc)); return; } void __cdecl FUN_004077b3(int param_1) { mouse_region_delete_from_3(DAT_0044e980); anim_state_xxx_list_remove(*(int **)(param_1 + 0x10)); aseq_select_anim(*(int *)(param_1 + 0x10),0); anim_state_xxx_list_insert_4(*(undefined4 **)(param_1 + 0x10)); return; } void __cdecl mouse_downup_handler(short param_1,short param_2,undefined4 *param_3) { short sVar1; short sVar2; bool bVar3; undefined4 *puVar4; int iVar5; short sVar6; short local_c; short local_a; short local_8; short local_6; local_c = 0; local_a = 0; mouse_cursor_get_dx_dy(&local_a,&local_c); sVar6 = param_1 + local_a; sVar1 = param_2 + local_c; bVar3 = false; puVar4 = (undefined4 *)deref_next_if_not_null(param_3); while( true ) { if (puVar4 == (undefined4 *)0x0) { return; } local_6 = *(short *)((int)puVar4 + 10); local_8 = *(short *)(puVar4 + 3); sVar2 = *(short *)((int)puVar4 + 0x1a); if (sVar2 == 0) { if ((((local_6 <= sVar6) && (sVar6 < *(short *)((int)puVar4 + 0xe))) && (local_8 <= sVar1)) && (sVar1 < *(short *)(puVar4 + 4))) { bVar3 = true; } } else if (sVar2 == 1) { iVar5 = (int)*(short *)((int)puVar4 + 0xe) - (int)local_6; if ((uint)(((int)sVar6 - (int)local_6) * ((int)sVar6 - (int)local_6) + ((int)sVar1 - (int)local_8) * ((int)sVar1 - (int)local_8)) < (uint)(iVar5 * iVar5)) { bVar3 = true; } } else if ((sVar2 == 2) && (iVar5 = anim_xxx_hit_test(sVar6,sVar1), iVar5 != 0)) { bVar3 = true; } if (bVar3) break; puVar4 = (undefined4 *)deref_next(puVar4); } mouse_region_hit_dx = sVar6 - local_6; mouse_region_hit_dy = sVar1 - local_8; mouse_region_hit_x = sVar6; mouse_region_hit_y = sVar1; if (mouse_downup_global_handler != (undefined *)0x0) { (*(code *)mouse_downup_global_handler)(); } if (*(int *)((int)puVar4 + 0x12) != 0) { (**(code **)((int)puVar4 + 0x12))(); return; } key_down_handler_buffered(*(undefined2 *)((int)puVar4 + 0x22)); return; } void __cdecl mouse_down_handler(short param_1,short param_2) { mouse_downup_handler(param_1,param_2,&mouse_region_list_down->next); return; } void __cdecl mouse_up_handler(short param_1,short param_2) { mouse_downup_handler(param_1,param_2,&mouse_region_list_up->next); return; } void __stdcall mouse_region_setup(void) { if (mouse_region_is_set_up == 0) { mouse_region_is_set_up = 1; mouse_region_stash_idx = 0; mouse_region_new_idx = 0; mouse_region_list_up = (linked_list_head *)alloc_linked_list_marker(); mouse_region_list_down = (linked_list_head *)alloc_linked_list_marker(); mouse_region_stash[6] = (undefined *)alloc_linked_list_marker(); ptr_on_mouse_down = mouse_down_handler; ptr_on_mouse_up = mouse_up_handler; } return; } void __stdcall mouse_region_teardown(void) { if (mouse_region_is_set_up != 0) { mouse_region_delete_all_lists(); free_tracked_heap_block_((int)mouse_region_list_up); free_tracked_heap_block_((int)mouse_region_list_down); free_tracked_heap_block_((int)mouse_region_stash[6]); mouse_region_is_set_up = 0; } return; } short __cdecl mouse_region_sort_func(int param_1,int param_2) { return *(short *)(param_1 + 0x18) - *(short *)(param_2 + 0x18); } undefined4 * __cdecl mouse_region_new_1(short param_1,short param_2,short param_3,short param_4,short param_5, uint param_6) { undefined2 uVar1; undefined4 *puVar2; puVar2 = (undefined4 *)alloc_tracked_heap_block(0x26); *(ushort *)((int)puVar2 + 0x1a) = (ushort)(param_4 == 0); *(short *)((int)puVar2 + 10) = param_1; *(short *)(puVar2 + 3) = param_2; *(short *)((int)puVar2 + 0xe) = param_1 + param_3; *(short *)(puVar2 + 4) = param_2 + param_4; if (param_5 == -1) { *(undefined2 *)(puVar2 + 6) = (undefined2)mouse_region_default_sort_key; mouse_region_default_sort_key = mouse_region_default_sort_key + 1; } else { *(short *)(puVar2 + 6) = param_5; } if ((param_6 & 0xffff0000) == 0) { *(short *)((int)puVar2 + 0x22) = (short)param_6; *(undefined4 *)((int)puVar2 + 0x12) = 0; } else { *(undefined2 *)((int)puVar2 + 0x22) = 0; *(uint *)((int)puVar2 + 0x12) = param_6; } *(undefined2 *)(puVar2 + 2) = 0; *(short *)((int)puVar2 + 0x16) = mouse_region_new_idx; mouse_region_new_idx = mouse_region_new_idx + 1; *(undefined2 *)(puVar2 + 7) = 0; *(undefined4 *)((int)puVar2 + 0x1e) = 0; uVar1 = FUN_00426191(); *(undefined2 *)(puVar2 + 9) = uVar1; linked_list_insert((int *)mouse_region_stash[6],puVar2,0xffff); return puVar2; } void __cdecl mouse_region_move_1_to_up(int *param_1) { if ((param_1 != (int *)0x0) && ((short)param_1[2] == 0)) { *(undefined2 *)(param_1 + 2) = 1; linked_list_unlink((int *)mouse_region_stash[6],param_1); linked_list_insert_sorted((int *)mouse_region_list_up,param_1,mouse_region_sort_func); } return; } void __cdecl mouse_region_move_1_to_down(int *param_1) { if ((param_1 != (int *)0x0) && ((short)param_1[2] == 0)) { *(undefined2 *)(param_1 + 2) = 1; linked_list_unlink((int *)mouse_region_stash[6],param_1); linked_list_insert_sorted((int *)mouse_region_list_down,param_1,mouse_region_sort_func); } return; } void __cdecl mouse_region_move_up_to_1(int *param_1) { if ((param_1 != (int *)0x0) && ((short)param_1[2] != 0)) { *(undefined2 *)(param_1 + 2) = 0; linked_list_unlink((int *)mouse_region_list_up,param_1); linked_list_insert((int *)mouse_region_stash[6],param_1,0xffff); } return; } void __cdecl mouse_region_move_down_to_1(int *param_1) { if ((param_1 != (int *)0x0) && ((short)param_1[2] != 0)) { *(undefined2 *)(param_1 + 2) = 0; linked_list_unlink((int *)mouse_region_list_down,param_1); linked_list_insert((int *)mouse_region_stash[6],param_1,0xffff); } return; } void __cdecl mouse_region_delete_from_1(int *param_1) { if (param_1 != (int *)0x0) { linked_list_unlink((int *)mouse_region_stash[6],param_1); free_tracked_heap_block((int)param_1); } return; } void __cdecl mouse_region_delete_from_2(int *param_1) { if (param_1 != (int *)0x0) { mouse_region_move_up_to_1(param_1); mouse_region_delete_from_1(param_1); } return; } void __cdecl mouse_region_delete_from_3(int *param_1) { if (param_1 != (int *)0x0) { mouse_region_move_down_to_1(param_1); mouse_region_delete_from_1(param_1); } return; } int * __cdecl mouse_region_new_up(short param_1,short param_2,short param_3,short param_4,short param_5, uint param_6) { int *piVar1; piVar1 = mouse_region_new_1(param_1,param_2,param_3,param_4,param_5,param_6); mouse_region_move_1_to_up(piVar1); return piVar1; } int * __cdecl mouse_region_new_down (short param_1,short param_2,short param_3,short param_4,short param_5,uint param_6) { int *piVar1; piVar1 = mouse_region_new_1(param_1,param_2,param_3,param_4,param_5,param_6); mouse_region_move_1_to_down(piVar1); return piVar1; } int * __cdecl mouse_region_new_from_rect_up(short *param_1,short param_2,uint param_3) { int *piVar1; piVar1 = mouse_region_new_1(*param_1,param_1[1],param_1[2],param_1[3],param_2,param_3); mouse_region_move_1_to_up(piVar1); return piVar1; } int * __cdecl mouse_region_new_from_rect_down(short *param_1,short param_2,uint param_3) { int *piVar1; piVar1 = mouse_region_new_1(*param_1,param_1[1],param_1[2],param_1[3],param_2,param_3); mouse_region_move_1_to_down(piVar1); return piVar1; } void __stdcall mouse_region_stash_lists(void) { mouse_region_stash[mouse_region_stash_idx] = (undefined *)mouse_region_list_up; mouse_region_stash_idx = mouse_region_stash_idx + 1; mouse_region_stash[mouse_region_stash_idx] = (undefined *)mouse_region_list_down; mouse_region_stash_idx = mouse_region_stash_idx + 1; mouse_region_list_up = (linked_list_head *)alloc_linked_list_marker(); mouse_region_list_down = (linked_list_head *)alloc_linked_list_marker(); return; } void __stdcall mouse_region_delete_all_lists(void) { int *piVar1; int *piVar2; piVar1 = (int *)deref_next_if_not_null(&mouse_region_list_up->next); while (piVar1 != (int *)0x0) { piVar2 = (int *)deref_next(piVar1); mouse_region_delete_from_2(piVar1); piVar1 = piVar2; } piVar1 = (int *)deref_next_if_not_null(&mouse_region_list_down->next); while (piVar1 != (int *)0x0) { piVar2 = (int *)deref_next(piVar1); mouse_region_delete_from_3(piVar1); piVar1 = piVar2; } mouse_region_new_idx = 0; mouse_region_default_sort_key = 0; return; } void __stdcall mouse_region_unstash_list(void) { short sVar1; mouse_region_delete_all_lists(); free_tracked_heap_block_((int)mouse_region_list_up); free_tracked_heap_block_((int)mouse_region_list_down); sVar1 = mouse_region_stash_idx; mouse_region_stash_idx = mouse_region_stash_idx + -1; mouse_region_list_down = (linked_list_head *)mouse_region_stash[mouse_region_stash_idx]; mouse_region_stash_idx = sVar1 + -2; mouse_region_list_up = (linked_list_head *)mouse_region_stash[mouse_region_stash_idx]; return; } void __cdecl mouse_region_new_up_whole_screen(uint param_1) { mouse_region_new_up(0,0,0x200,0x180,0,param_1); return; } void __cdecl FUN_00407e7f(uint param_1) { mouse_region_new_down(0,0,0x200,0x180,0,param_1); return; } void __stdcall mouse_region_draw_boxes(void) { undefined4 *puVar1; for (puVar1 = (undefined4 *)deref_next_if_not_null(&mouse_region_list_up->next); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { gfx_draw_box(*(short *)((int)puVar1 + 10),*(short *)(puVar1 + 3), (*(short *)((int)puVar1 + 0xe) - *(short *)((int)puVar1 + 10)) + -1, (*(short *)(puVar1 + 4) - *(short *)(puVar1 + 3)) + -1,*(ushort *)(puVar1 + 6)); } gfxish_do_a_paint(); return; } void __cdecl mouse_region_draw_one_box(int param_1,ushort param_2) { gfx_draw_box(*(short *)(param_1 + 10),*(short *)(param_1 + 0xc), (*(short *)(param_1 + 0xe) - *(short *)(param_1 + 10)) + -1, (*(short *)(param_1 + 0x10) - *(short *)(param_1 + 0xc)) + -1,param_2); gfxish_do_a_paint(); return; } void __cdecl FUN_00407f7d(int param_1,undefined2 param_2,undefined2 param_3) { short sVar1; short sVar2; sVar1 = *(short *)(param_1 + 10); sVar2 = *(short *)(param_1 + 0xc); *(undefined2 *)(param_1 + 10) = param_2; *(undefined2 *)(param_1 + 0xc) = param_3; *(short *)(param_1 + 0xe) = (*(short *)(param_1 + 0xe) - sVar1) + *(short *)(param_1 + 10); *(short *)(param_1 + 0x10) = (*(short *)(param_1 + 0x10) - sVar2) + *(short *)(param_1 + 0xc); return; } void __cdecl mouse_up_change_prio(int *param_1,undefined2 param_2) { linked_list_unlink((int *)mouse_region_list_up,param_1); *(undefined2 *)(param_1 + 6) = param_2; linked_list_insert_sorted((int *)mouse_region_list_up,param_1,mouse_region_sort_func); return; } void __cdecl FUN_00407fec(int param_1,short param_2,short param_3,short param_4,short param_5) { if (param_1 != 0) { *(short *)(param_1 + 10) = param_2; *(short *)(param_1 + 0xc) = param_3; *(short *)(param_1 + 0xe) = param_2 + param_4; *(short *)(param_1 + 0x10) = param_3 + param_5; } return; } void __cdecl mouse_region_set_filter_key(int param_1,undefined2 param_2) { *(undefined2 *)(param_1 + 0x1c) = param_2; return; } void __cdecl mouse_region_set_extra_data(int param_1,undefined4 param_2) { *(undefined4 *)(param_1 + 0x1e) = param_2; return; } void __cdecl FUN_00408034(int param_1,uint param_2) { if (param_1 != 0) { if ((param_2 & 0xffff0000) == 0) { *(short *)(param_1 + 0x22) = (short)param_2; *(undefined4 *)(param_1 + 0x12) = 0; return; } *(undefined2 *)(param_1 + 0x22) = 0; *(uint *)(param_1 + 0x12) = param_2; } return; } void __cdecl mouse_region_remove_by_filter_key(short param_1) { int *piVar1; int *piVar2; piVar2 = (int *)deref_next_if_not_null(&mouse_region_list_up->next); while (piVar1 = piVar2, piVar1 != (int *)0x0) { piVar2 = (int *)deref_next(piVar1); if (param_1 == (short)piVar1[7]) { mouse_region_delete_from_2(piVar1); } } piVar2 = (int *)deref_next_if_not_null(&mouse_region_list_down->next); while (piVar1 = piVar2, piVar1 != (int *)0x0) { piVar2 = (int *)deref_next(piVar1); if (param_1 == (short)piVar1[7]) { mouse_region_delete_from_3(piVar1); } } return; } void __cdecl mouse_set_downup_global_handler(undefined *param_1) { mouse_downup_global_handler = param_1; return; } void __cdecl mouse_region_xxxx_callback(int param_1,short param_2) { linked_list_head *plVar1; linked_list_head *plVar2; linked_list_head *plVar3; plVar1 = mouse_region_list_down; if (param_2 != 0) { plVar1 = mouse_region_list_up; } plVar2 = (linked_list_head *)deref_next_if_not_null(&plVar1->next); while( true ) { plVar3 = plVar2; if (plVar3 == (linked_list_head *)0x0) { return; } if (param_1 == *(int *)((int)&plVar3[3].prev + 2)) break; plVar2 = (linked_list_head *)deref_next(&plVar3->next); plVar1 = plVar3; } mouse_region_hit_dx = *(undefined2 *)((int)&plVar3[1].next + 2); mouse_region_hit_dy = *(undefined2 *)&plVar3[1].prev; if (*(int *)((int)&plVar3[2].next + 2) == 0) { return; } (**(code **)((int)&plVar3[2].next + 2))(plVar3,mouse_region_hit_dy,plVar1,plVar3); return; } void __cdecl mouse_region_new_for_anim(int param_1,uint param_2,short param_3) { short sVar1; short *psVar2; undefined4 *puVar3; undefined2 uVar4; psVar2 = (short *)aseq_anim_get_some_rect(param_1); sVar1 = anim_get_draw_order(param_1); puVar3 = mouse_region_new_1(*psVar2,psVar2[1],psVar2[2],psVar2[3],sVar1,param_2); uVar4 = 2; if (param_3 == 0) { uVar4 = 0; } *(undefined2 *)((int)puVar3 + 0x1a) = uVar4; return; } int * __cdecl mouse_region_new_for_anim_wrapped(int param_1,short param_2,short param_3,uint param_4) { int *piVar1; piVar1 = (int *)mouse_region_new_for_anim(param_1,param_4,param_3); if (param_2 == 0) { mouse_region_move_1_to_down(piVar1); } else { mouse_region_move_1_to_up(piVar1); } return piVar1; } void __cdecl mouse_region_delete_multiple_xxx(short param_1) { int *piVar1; int *piVar2; piVar2 = (int *)deref_next_if_not_null(&mouse_region_list_up->next); while (piVar1 = piVar2, piVar1 != (int *)0x0) { piVar2 = (int *)deref_next(piVar1); if (param_1 <= (short)piVar1[9]) { mouse_region_delete_from_2(piVar1); } } piVar2 = (int *)deref_next_if_not_null(&mouse_region_list_down->next); while (piVar1 = piVar2, piVar1 != (int *)0x0) { piVar2 = (int *)deref_next(piVar1); if (param_1 <= (short)piVar1[9]) { mouse_region_delete_from_3(piVar1); } } piVar2 = (int *)deref_next_if_not_null((undefined4 *)mouse_region_stash[6]); while (piVar1 = piVar2, piVar1 != (int *)0x0) { piVar2 = (int *)deref_next(piVar1); if (param_1 <= (short)piVar1[9]) { linked_list_unlink((int *)mouse_region_stash[6],piVar1); free_tracked_heap_block((int)piVar1); } } return; } void __cdecl chimp_action_10_pick_up_item(actor_struct *param_1) { int *piVar1; int iVar2; piVar1 = (int *)get_area_screen_list_idx ((param_1->saved).screen_idx,(param_1->saved).cur_item_pkg_idx); if ((short)piVar1[2] != 1) { if (*(short *)((int)piVar1 + 0x1e) == 1000) { remove_item_from_screen((param_1->saved).screen_idx,piVar1); place_item_randomly_on_random_screen(1000); } else { iVar2 = actor_count_held_parts(param_1->actor_idx); if ((short)iVar2 == 0) { actor_give_part(param_1->actor_idx,*(short *)((int)piVar1 + 0x1e)); remove_item_from_screen((param_1->saved).screen_idx,piVar1); } } } return; } void __cdecl actor_drop_part_in_world(short param_1) { int iVar1; undefined4 *puVar2; iVar1 = (int)param_1; puVar2 = actor_parts_find_held_by(&(actors[iVar1].parts_linked_list)->next,param_1,0); if (puVar2 != (undefined4 *)0x0) { actor_take_part(param_1,*(short *)(puVar2 + 0x18),1); place_item_on_area(actors[iVar1].saved.screen_idx,actors[iVar1].saved.x,actors[iVar1].saved.y2, *(short *)(puVar2 + 0x18),0); } return; } undefined4 __cdecl actors_N_process_cb(short param_1) { short *psVar1; word wVar2; word wVar3; actor_N_process_struct1 *paVar4; bool bVar5; bool bVar6; bool bVar7; ushort uVar8; int iVar9; undefined4 *puVar10; int iVar11; undefined2 extraout_var; uint uVar12; undefined2 uVar13; actor_N_process_struct1 *paVar14; actor_N_process_struct2 *paVar15; word local_14; short local_10 [2]; short local_c; short local_6; iVar9 = (int)param_1; paVar15 = (actor_N_process_struct2 *)0x0; bVar6 = false; local_14 = 0xffff; bVar7 = false; wVar2 = actors[param_1].collision_flags; if (-1 < actors[iVar9].saved.chimp_state_21_timer) { psVar1 = &actors[iVar9].saved.chimp_state_21_timer; *psVar1 = *psVar1 + -1; } paVar4 = chimp_rand_behavior_table[(short)actors[iVar9].saved.cur_state]; puVar10 = (undefined4 *)0x0; actors[iVar9].field43_0x96 = 0; actors[iVar9].xxx_chimp_coll_flags = 0; if (paVar4 != (actor_N_process_struct1 *)0x0) { iVar11 = paVar4->dx + 2; if (iVar11 == 0) { local_14 = actors[iVar9].saved.cur_state; puVar10 = (undefined4 *)0x0; } else { local_14 = paVar4->new_state; wVar3 = paVar4->count_or_probability; puVar10 = (undefined4 *)CONCAT22((short)((uint)iVar11 >> 0x10),wVar3); for (local_6 = 0; (paVar14 = paVar4 + 1, !bVar6 && (puVar10 = (undefined4 *)CONCAT22((short)((uint)puVar10 >> 0x10),local_6), local_6 < (short)wVar3)); local_6 = local_6 + 1) { bVar5 = false; puVar10 = memcpy((undefined4 *)local_10,(undefined4 *)(actors + iVar9),10); if (paVar4[1].coll_mask == 4) { iVar11 = (int)local_c >> 1; if (iVar11 < 0) { iVar11 = iVar11 + (uint)(((int)local_c & 1U) != 0); } local_10[0] = (short)iVar11 + local_10[0] + -2; puVar10 = (undefined4 *)CONCAT22((short)((uint)iVar11 >> 0x10),local_10[0]); local_c = 4; if (actors[iVar9].saved.chimp_state_21_timer < 0) goto LAB_00408421; } else { LAB_00408421: if (paVar14->dx == -1) { bVar5 = true; } else { if (actors[param_1].xxx_obstacle_col_direction_related < 0) { local_10[0] = local_10[0] - paVar14->dx; } else { local_c = local_c + paVar14->dx; } uVar8 = zzzchimp_do_extra_coll_checks(param_1,local_10); puVar10 = (undefined4 *)(CONCAT22(extraout_var,uVar8) & (int)(short)paVar4[1].coll_mask) ; if ((puVar10 != (undefined4 *)0x0) && (paVar4[1].xxx_disable_rand == 0)) { bVar5 = true; } } if (bVar5) { uVar12 = rand(); puVar10 = (undefined4 *)(int)(short)paVar4[1].count_or_probability; if ((int)uVar12 % 1000 < (int)puVar10) { local_14 = paVar4[1].new_state; puVar10 = (undefined4 *) CONCAT22((short)paVar4[1].count_or_probability >> 0xf,local_14); bVar6 = true; } } } paVar4 = paVar14; } } } if (local_14 == 28) { get_area_screen_list_idx(actors[iVar9].saved.screen_idx,actors[iVar9].saved.cur_item_pkg_idx); puVar10 = (undefined4 *)linked_list_sz(&(actors[iVar9].parts_linked_list)->next); if ((short)puVar10 != 0) { local_14 = 2; } } if (local_14 == 29) { get_area_screen_list_idx(actors[iVar9].saved.screen_idx,actors[iVar9].saved.cur_item_pkg_idx); puVar10 = (undefined4 *)linked_list_sz(&(actors[iVar9].parts_linked_list)->next); if ((short)puVar10 != 0) { local_14 = 3; } } if (local_14 != 0xffff) { puVar10 = (undefined4 *)(int)(short)local_14; paVar15 = chimp_actions_table[(int)puVar10]; } uVar13 = (undefined2)((uint)puVar10 >> 0x10); if (paVar15 != (actor_N_process_struct2 *)0x0) { for (; (uVar13 = (undefined2)((uint)puVar10 >> 0x10), !bVar7 && (paVar15->expected != 0xffffffff)); paVar15 = paVar15 + 1) { puVar10 = (undefined4 *)(~paVar15->mask & (int)(short)wVar2 << 0x10); if ((puVar10 == (undefined4 *)paVar15->expected) || (paVar15->expected == 0)) { bVar7 = true; local_14 = paVar15->new_state; puVar10 = (undefined4 *)CONCAT22((short)((uint)puVar10 >> 0x10),local_14); } } } if ((local_14 == 2) && (actors[iVar9].saved.process_thing2_result < 0)) { local_14 = 10; } if ((local_14 == 3) && (0 < actors[iVar9].saved.process_thing2_result)) { local_14 = 11; } actors[iVar9].xxx_chimp_coll_flags = actors[iVar9].collision_flags; return CONCAT22(uVar13,local_14); } void __cdecl chimp_after_transition_screens(short param_1) { word wVar1; short sVar2; bool bVar3; short sVar4; int iVar5; uint uVar6; int iVar7; short *psVar8; short sVar9; iVar5 = (int)param_1; bVar3 = (short)save_file_big->level_in_building < 3; chimps_on_screen[(short)actors[iVar5].saved.screen_idx] = chimps_on_screen[(short)actors[iVar5].saved.screen_idx] + 1; uVar6 = area_screen_type_b0(actors[iVar5].saved.screen_idx); actor_xxx_eseq_select(param_1,(short)uVar6); if (actors[iVar5].saved.new_state_after_reload_1 != -1) { wVar1 = actors[iVar5].saved.new_state_after_reload_1; if (wVar1 == 21) { iVar7 = time_get_secs_count(5); actors[iVar5].saved.chimp_state_21_timer = (short)iVar7; } actors[iVar5].saved.new_state_after_reload_1 = -1; actors[iVar5].field7_0x10 = 0; actors[iVar5].saved.cur_state = wVar1; actor_go_to_state(param_1,wVar1); actors[iVar5].saved.eseq_step = 0; if (((wVar1 == 0x15) || (wVar1 == 0x18)) || (wVar1 == 0x19)) { iVar7 = area_screen_thing0_0_idx (actors[iVar5].saved.prev_screen_idx, actors[iVar5].saved.idx_of_up_warp_related); psVar8 = (short *)screen_non_animated_warp_find_xxxxx (actors[iVar5].saved.screen_idx,*(short *)(iVar7 + 0x12)); if ((short)uVar6 == 0) { if (bVar3) { sVar4 = 0x10; sVar9 = 0x23; } else { sVar4 = 0x10; sVar9 = 0x1b; } } else if (bVar3) { sVar4 = 6; sVar9 = 0xc; } else { sVar4 = 6; sVar9 = 10; } sVar2 = *psVar8; actors[iVar5].saved.x = sVar4 + sVar2; actors[iVar5].rect.x = sVar4 + sVar2; sVar4 = psVar8[1]; actors[iVar5].saved.y = sVar9 + sVar4; actors[iVar5].rect.y = sVar9 + sVar4; } } return; } void __cdecl chimp_prepare_transition_screens(short param_1) { short sVar1; ushort uVar2; undefined2 uVar3; undefined2 uVar4; int iVar5; int iVar6; uint in_ECX; int iVar7; undefined4 local_8; iVar5 = (int)param_1; iVar6 = area_screen_thing0_0_idx (actors[iVar5].saved.screen_idx,actors[iVar5].saved.idx_of_up_warp_related); sVar1 = *(short *)(iVar6 + 0x10); iVar7 = (int)sVar1; if (iVar7 == 6) { uVar3 = *(undefined2 *)(iVar6 + 0x12); actors[param_1].saved.eseq_step = 0; uVar4 = 0x23; if (actors[param_1].xxx_obstacle_col_direction_related < 0) { uVar4 = 0x22; } local_8 = CONCAT22(uVar4,uVar3); } else if (iVar7 == 9) { uVar2 = *(ushort *)(iVar6 + 0x12); actors[param_1].saved.eseq_step = 0; local_8 = CONCAT22(0x15,uVar2 & 0xf); } else { local_8 = in_ECX; if (iVar7 - 10U < 2) { uVar3 = *(undefined2 *)(iVar6 + 0x12); actors[param_1].saved.eseq_step = 0; uVar4 = 0x19; if (sVar1 != 10) { uVar4 = 0x18; } local_8 = CONCAT22(uVar4,uVar3) & 0xffff000f; } } actors[iVar5].field43_0x96 = 0; actors[iVar5].xxx_chimp_coll_flags = 0; actors[iVar5].saved.new_state_after_reload_0 = local_8._2_2_; actors[iVar5].saved.new_state_after_reload_1 = local_8._2_2_; chimps_on_screen[(short)actors[iVar5].saved.screen_idx] = chimps_on_screen[(short)actors[iVar5].saved.screen_idx] + -1; actors[iVar5].saved.prev_screen_idx = actors[iVar5].saved.screen_idx; actors[iVar5].saved.screen_idx = (word)local_8; return; } void __stdcall load_eseq_4504_7(void) { bool bVar1; short sVar2; bVar1 = (short)save_file_big->level_in_building < 3; if (eseq_4504_6 == (undefined *)0x0) { sVar2 = 4504; if (bVar1) { sVar2 = 0x119a; } eseq_4504_6 = (undefined *)load_eseq(sVar2,0x44e9ec,&eseq_4504_6_w_tables,&eseq_4504_6_h_tables) ; } if (eseq_4505_7 == (undefined *)0x0) { sVar2 = 4505; if (bVar1) { sVar2 = 0x119b; } eseq_4505_7 = (undefined *)load_eseq(sVar2,0x44ea98,&eseq_4505_7_w_tables,&eseq_4505_7_h_tables) ; } sVar2 = 2; do { actors[sVar2].eseq_w_tables[0] = eseq_4505_7_w_tables; actors[sVar2].eseq_w_tables[1] = eseq_4504_6_w_tables; actors[sVar2].eseq_h_tables[0] = eseq_4505_7_h_tables; actors[sVar2].eseq_h_tables[1] = eseq_4504_6_h_tables; sVar2 = sVar2 + 1; } while (sVar2 < 0xc); return; } void __stdcall free_eseq_4504_7(void) { if (eseq_4504_6 != (undefined *)0x0) { free_resource_item_with_data((int)eseq_4504_6); eseq_4504_6 = (undefined *)0x0; } if (eseq_4505_7 != (undefined *)0x0) { free_resource_item_with_data((int)eseq_4505_7); eseq_4505_7 = (undefined *)0x0; } return; } void __stdcall setup_actors_N(void) { word wVar1; word wVar2; short sVar3; actors_N_parts_list = (linked_list_head *)alloc_linked_list_marker(); wVar1 = save_file_big->level_in_building; load_eseq_4504_7(); wVar2 = 2; do { actors[(short)wVar2].actor_idx = wVar2; actors[(short)wVar2].field7_0x10 = 0; actors[(short)wVar2].saved.player_iframes = 0; actors[(short)wVar2].cmd_24_related_state = 2; actors[(short)wVar2].eseq_action_10_cb = chimp_action_10_pick_up_item; actors[(short)wVar2].saved.process_thing2_en = 1; actors[(short)wVar2].saved.collide_entity_checks_en = 1; actors[(short)wVar2].parts_linked_list = actors_N_parts_list; actors[(short)wVar2].xxx_eseq_a_0 = eseq_4504_6_a; actors[(short)wVar2].xxx_eseq_a_1 = eseq_4505_7_a; sVar3 = 4506; if ((short)wVar1 < 3) { sVar3 = 0x1198; } actors[(short)wVar2].aseq_idx_base = sVar3; actors[(short)wVar2].eseq_w_tables[0] = eseq_4505_7_w_tables; actors[(short)wVar2].eseq_w_tables[1] = eseq_4504_6_w_tables; actors[(short)wVar2].eseq_h_tables[0] = eseq_4505_7_h_tables; actors[(short)wVar2].eseq_h_tables[1] = eseq_4504_6_h_tables; actors[(short)wVar2].eseq_action_11_cb_a = chimp_prepare_transition_screens; actors[(short)wVar2].saved.new_state_after_reload_0 = -1; actors[(short)wVar2].aseq_idx_cur = -1; actors[(short)wVar2].saved.new_state_after_reload_1 = -1; actors[(short)wVar2].eseq_action_11_cb_b = chimp_after_transition_screens; actors[(short)wVar2].field40_0x90 = (undefined *)0x0; actors[(short)wVar2].process_cb = actors_N_process_cb; actors[(short)wVar2].saved.chimp_state_21_timer = -1; actors[(short)wVar2].eseq_action_29_cb = (undefined *)0x0; wVar2 = wVar2 + 1; } while ((short)wVar2 < 0xc); return; } void __stdcall FUN_00408a73(void) { free_eseq_4504_7(); free_tracked_heap_block_(actors_N_parts_list); return; } void __stdcall randomly_place_chimps(void) { short sVar1; int iVar2; uint uVar3; uint uVar4; uint uVar5; int iVar6; short sVar7; short *psVar8; short local_e; short local_c; iVar6 = 0x4508d4; sVar1 = *chimp_placement_data_per_area[save_file_big->area]; psVar8 = chimp_placement_data_per_area[save_file_big->area] + 1; if (DAT_0044ff2c == 2) { iVar2 = (int)*psVar8 >> 1; if (iVar2 < 0) { iVar2 = iVar2 + (uint)(((int)*psVar8 & 1U) != 0); } *psVar8 = (short)iVar2; } memset((undefined4 *)chimps_on_screen,0,0x20); sVar7 = 2; do { if (sVar7 + -2 < (int)sVar1) { *(ushort *)(iVar6 + 0x2a) = (ushort)(save_file_big->chimps_enabled == 0); *(undefined2 *)(iVar6 + 0x48) = 0; *(undefined2 *)(iVar6 + 0x22) = 0; *(undefined2 *)(iVar6 + 0x70) = 0; *(undefined4 *)(iVar6 + 0x96) = 0; *(undefined2 *)(iVar6 + 0x6e) = 0xffff; *(undefined2 *)(iVar6 + 0x3c) = 0xffff; chimps_on_screen[*psVar8] = chimps_on_screen[*psVar8] + 1; *(short *)(iVar6 + 0x1a) = *psVar8; psVar8 = psVar8 + 1; uVar3 = area_screen_type(*(short *)(iVar6 + 0x1a)); uVar4 = area_screen_type_b0(*(short *)(iVar6 + 0x1a)); if (*(short *)(iVar6 + 0x9a) == 4506) { local_c = 0x1b; local_e = 0x2e; } else { local_c = 0x1d; local_e = 0x36; } if ((short)uVar4 == 0) { uVar5 = rand(); *(short *)(iVar6 + 0x1c) = (short)((int)uVar5 % 3); *(short *)(iVar6 + 0x16) = *(short *)(iVar6 + 0x1c) * 100 + local_e; if ((uVar3 & 2) != 0) { *(short *)(iVar6 + 0x1c) = *(short *)(iVar6 + 0x1c) + 3; } } else { uVar3 = rand(); *(short *)(iVar6 + 0x1c) = (short)((int)uVar3 % 6); *(short *)(iVar6 + 0x16) = *(short *)(iVar6 + 0x1c) * 0x32 + local_c; } *(undefined2 *)(iVar6 + 0x1e) = 0xffff; *(undefined2 *)(iVar6 + 0x18) = 0; uVar3 = rand(); if ((int)uVar3 % 100 < 0x32) { *(undefined2 *)(iVar6 + 0x14) = 0x10; *(undefined4 *)(iVar6 + 0x96) = 2; } else { *(undefined2 *)(iVar6 + 0x14) = 0x1e0; *(undefined4 *)(iVar6 + 0x96) = 1; } actor_xxx_eseq_select(sVar7,(short)uVar4); } else { *(undefined2 *)(iVar6 + 0x2a) = 1; } iVar6 = iVar6 + 0xa8; sVar7 = sVar7 + 1; } while (sVar7 < 0xc); return; } void __stdcall FUN_00408c40(void) { FUN_0043e1b5(0xfff); FUN_00401206(8,0x3d,(byte *)s_1st___00448a6a); FUN_00401206(8,0x4d,(byte *)s_2nd___00448a70); FUN_0043e1b5(0xafa); FUN_00401206(0x40,0x3d,DAT_0044eca4); FUN_0043e1b5(0x9f9); FUN_00401206(0x40,0x4d,DAT_0044eca8); return; } void __stdcall FUN_00408cac(void) { bool bVar1; int *piVar2; int *piVar3; bVar1 = false; DAT_0044eca0 = 0; DAT_0044ec9e = 0; load_rrgb_1(4100); piVar2 = load_aseq(4102); aseq_draw_gfx_and_xxx((int)piVar2,0,0,0,6); free_aseq(piVar2); piVar2 = load_aseq(4104); if (race_lost == 0) { DAT_0044eca4 = save_file_big; DAT_0044eca8 = (save_file_main *)PTR_s_Morty_00448a24; if ((short)save_file_big->num_built_vehicles[(short)save_file_big->building_idx] < 4) { DAT_0044ec9e = 1; } if (save_file_big->total_built_vehicles == 0xf) { DAT_0044ec9e = 0; bVar1 = true; } } else { DAT_0044eca4 = (save_file_main *)PTR_s_Morty_00448a24; DAT_0044eca8 = save_file_big; DAT_0044eca0 = 1; } if (DAT_0044ec9e == 0) { aseq_draw_gfx_and_xxx((int)piVar2,0x78,0x8c,0,6); piVar3 = load_aseq(0x100a); aseq_draw_gfx_and_xxx((int)piVar3,0x7e,0x6f,0,6); free_aseq(piVar3); } if (DAT_0044eca0 == 0) { aseq_draw_gfx_and_xxx((int)piVar2,0xde,0x8c,0,6); piVar3 = load_aseq(0x100b); aseq_draw_gfx_and_xxx((int)piVar3,0xe5,0x6f,0,6); free_aseq(piVar3); } if (bVar1) { aseq_draw_gfx_and_xxx((int)piVar2,0x145,0x8c,0,6); piVar3 = load_aseq(0x100c); aseq_draw_gfx_and_xxx((int)piVar3,0x14b,0x6f,0,6); free_aseq(piVar3); piVar3 = load_aseq(0x1009); aseq_draw_gfx_and_xxx((int)piVar3,8,0x9d,0,6); free_aseq(piVar3); gfx_get_163_68_rect(); } free_aseq(piVar2); FUN_00408c40(); status_bar_flags = status_bar_flags | 0x20; draw_status_bar(0); return; } void __stdcall show_won_the_race_dialog(void) { short sVar1; sVar1 = get_rank_for_score((save_file_big->player_entry).score); if (sVar1 < 7) { DAT_00448080 = 1; show_dialog_wait_continue_with_ids(sVar1 + 0x1004,0xffff); DAT_00448080 = 0; } return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __stdcall FUN_00408ed1(void) { int iVar1; short sVar2; nullishsub(); ints_4100 = (short *)load_wave_by_ints(4100); FUN_00408cac(); DAT_0044ecb4 = load_aseq(4111); DAT_0044ecb8 = load_aseq(save_file_big->level_in_building + 0x1010); if (race_lost == 0) { sVar2 = 0x1788; DAT_0044ecac = load_aseq(4101); DAT_0044ecb0 = load_aseq(4109); iVar1 = load_resource_item_0(4102,(int *)&ints); DAT_0044ecbc = *(short *)(iVar1 + -2 + (short)save_file_big->total_built_vehicles * 2) * 1000; DAT_0044ecc4 = 0x32; _DAT_0044ecc0 = DAT_0044ecbc / 0x32; free_resource_item_with_idx_fourcc(0x1006,(undefined1 *)&ints); } else { sVar2 = 0x1786; DAT_0044ecac = load_aseq(4110); DAT_0044ecb0 = load_aseq(4100); DAT_0044ecc4 = 0; } aseq_set_pos_order((int)DAT_0044ecac,-0x8000,-0x8000,10); load_midi(sVar2); midi_stop_and_play(sVar2,0); anim_state_xxx_list_insert_4(DAT_0044ecac); anim_state_xxx_list_insert_4(DAT_0044ecb0); zzz_ddlt_state = 0; DAT_0044ecd4 = 0; FUN_0043d7c1(FUN_00408c40); FUN_00422170(); return; } void __stdcall FUN_00409040(void) { FUN_0043d7c1(0); ints_4100 = (short *)free_waves_from_list((int)ints_4100); FUN_004371de(); DAT_0044ecac = (int *)free_aseq(DAT_0044ecac); DAT_0044ecb0 = (int *)free_aseq(DAT_0044ecb0); DAT_0044ecb4 = (int *)free_aseq(DAT_0044ecb4); DAT_0044ecb8 = (int *)free_aseq(DAT_0044ecb8); return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __stdcall FUN_004090a7(void) { short sVar1; uint uVar2; int iVar3; undefined4 *puVar4; int *piVar5; process_new_player_hints(); if (DAT_0044ecc4 != 0) { DAT_0044ecc4 = DAT_0044ecc4 + -1; (save_file_big->player_entry).score = (save_file_big->player_entry).score + _DAT_0044ecc0; status_bar_flags = status_bar_flags | 4; draw_status_bar(0xfffb); } switch(zzz_ddlt_state) { case 0: sVar1 = aseq_anim_get_flags((int)DAT_0044ecac); if (sVar1 == 0x10) { anim_state_xxx_list_insert_4(DAT_0044ecb4); anim_state_xxx_list_insert_4(DAT_0044ecb8); zzz_ddlt_state = 1; } break; case 1: sVar1 = aseq_anim_get_flags((int)DAT_0044ecb4); if (sVar1 == 1) { uVar2 = rand(); if ((int)uVar2 % 100 < 0x32) { if (race_lost == 0) { uVar2 = rand(); DAT_0044ecc8 = (short)((int)uVar2 % 10) + 0x1011; sVar1 = 0x1017; piVar5 = (int *)&DAT_0044ecac; DAT_0044ec9c = 0; } else { uVar2 = rand(); uVar2 = uVar2 & 0x80000001; if ((int)uVar2 < 0) { uVar2 = (uVar2 - 1 | 0xfffffffe) + 1; } DAT_0044ecc8 = (short)uVar2 + 0x1027; sVar1 = 0x1018; piVar5 = (int *)&DAT_0044ecac; DAT_0044ec9c = 0; } } else { piVar5 = (int *)&DAT_0044ecb0; if (race_lost == 0) { uVar2 = rand(); DAT_0044ecc8 = (short)((int)uVar2 % 0xc) + 0x101b; sVar1 = 0x1019; DAT_0044ec9c = 0; } else { uVar2 = rand(); DAT_0044ecc8 = (short)((int)uVar2 % 9) + 0x1008; sVar1 = 0x1017; DAT_0044ec9c = 2; } } iVar3 = free_aseq((int *)*piVar5); *piVar5 = iVar3; puVar4 = load_aseq(sVar1); *piVar5 = (int)puVar4; aseq_select_anim(*piVar5,DAT_0044ec9c); aseq_anim_reset_and_play((undefined4 *)*piVar5); zzz_ddlt_state = 4; load_wave_flag_2(DAT_0044ecc8); play_wave_flag2(DAT_0044ecc8); } break; case 2: if (race_lost == 0) { show_won_the_race_dialog(); } else { new_player_hint(0xc); } if (save_file_big->total_built_vehicles == 0xf) { xxxfunc_set(&beat_game_cutscene); } else { xxxfunc_set(&xxxfunc_funcset_00448a40); } break; case 3: sVar1 = wave_is_playing_(DAT_0044ecc8); if (sVar1 == 0) { aseq_draw_gfx_and_xxx((int)DAT_0044ecb0,-0x8000,-0x8000,0,6); DAT_0044ecb0 = (int *)free_aseq(DAT_0044ecb0); free_wave_flag_2(DAT_0044ecc8); } break; case 4: sVar1 = wave_is_playing_(DAT_0044ecc8); if (sVar1 == 0) { aseq_draw_gfx_and_xxx((int)DAT_0044ecb0,-0x8000,-0x8000,0,6); aseq_draw_gfx_and_xxx((int)DAT_0044ecac,*(short *)((int)DAT_0044ecac + 0x3a),-0x8000,0,6); DAT_0044ecac = (int *)free_aseq(DAT_0044ecac); DAT_0044ecb0 = (int *)free_aseq(DAT_0044ecb0); free_wave_flag_2(DAT_0044ecc8); zzz_ddlt_state = 2; } } return; } void __stdcall FUN_004093b9(void) { FUN_00408cac(); FUN_00422170(); xxxfunc_set(&xxxfunc_funcset_00448a40); return; } void __stdcall FUN_004093d3(void) { DAT_00449c66 = 1; xxxfunc_set(&switch_to_correct_race_funcset); return; } void __stdcall FUN_004093ec(void) { if (DAT_0044ec9e != 0) { DAT_0044ecd4 = 1; xxxfunc_set(&enter_building_funcset); } return; } void __stdcall FUN_0040940f(void) { if (DAT_0044eca0 != 0) { xxxfunc_set(&into_warehouse_modeswitch_funcset); } return; } void __stdcall FUN_00409429(void) { DAT_0044ecd4 = 1; xxxfunc_set(&save_loaded_parking_lot_funcs); return; } void __stdcall FUN_00409442(void) { undefined4 uVar1; save_file_big->xxx[(short)save_file_big->building_idx] = (ushort)(race_lost != 0); uVar1 = exit_game_handler(); DAT_0044ecd4 = (short)uVar1; return; } void __stdcall FUN_00409474(void) { mouse_region_new_up(8,0x9d,0x2e,0x34,5,0x4093d3); mouse_region_new_up(0x7a,0x6c,0x36,0x81,5,0x4093ec); mouse_region_new_up(0xe0,0x6c,0x36,0x81,5,0x40940f); mouse_region_new_up(0x146,0x6c,0x36,0x81,5,0x409429); mouse_region_new_up(0x1c2,0x77,0x35,0x86,5,0x409442); FUN_0043d7c1(FUN_00408c40); return; } void __stdcall FUN_0040950f(void) { mouse_region_delete_all_lists(); if (DAT_0044ecd4 != 0) { if (race_lost == 0) { save_file_big->xxx[(short)save_file_big->building_idx] = 0; write_save_big_xxx(); } FUN_00420c4c(); } FUN_0042211c(); restore_enable_menus(0xff,0xffff,0); FUN_0043d7c1(0); return; } void __cdecl load_ddlt(short param_1) { load_resource_item_0(param_1,(int *)&ddlt); return; } void __stdcall beat_game_cutscene_onload(void) { short sVar1; short sVar2; int *piVar3; nullishsub(); ints_4100 = (short *)load_wave_by_ints(4101); load_midi(6018); midi_stop_and_play(6018,1); gfxish_uninvalidate_all(); sVar2 = 4103; piVar3 = (int *)PTR_ints_0044ae18; sVar1 = are_voices_enabled(); if (sVar1 == 0) { sVar2 = 0x1008; } zzz_ints_4103_4 = (short *)load_resource_item_0(sVar2,piVar3); zzz_ddlt = (short *)load_ddlt(*zzz_ints_4103_4); zzz_ddlt_int_idx = 0; zzz_ddlt_go_state_5 = 0; DAT_0044ecea = 0; zzz_ddlt_state = 0; zzz_ddlt_2 = zzz_ddlt; disable_menus(0xff,0xffff,0); return; } void __stdcall beat_game_cutscene_onremove(void) { free_resource_item_with_data((int)zzz_ints_4103_4); ints_4100 = (short *)free_waves_from_list((int)ints_4100); free_midi(0x1782); save_file_big->xxx[(short)save_file_big->building_idx] = 0; FUN_0042211c(); write_save_big_xxx(); nullishsub(); return; } void __stdcall beat_game_cutscene_on_periodic(void) { ushort uVar1; short *psVar2; bool bVar3; short sVar4; undefined4 uVar5; undefined3 extraout_var; undefined3 extraout_var_00; int iVar6; int iVar7; sVar4 = time_get_secs_mul(); iVar7 = (int)sVar4; if (iVar7 < 0) { iVar7 = iVar7 + 7; } are_voices_enabled(); switch(zzz_ddlt_state) { case 0: gfx_restore_163_68_rect(); zzz_ddlt_state = 1; break; case 1: zzz_ddlt_int_idx = zzz_ddlt_int_idx + 1; zzz_ddlt_state_4_time = get_new_time_ms(iVar7 >> 3); psVar2 = zzz_ddlt; uVar1 = *zzz_ddlt; zzz_ddlt = zzz_ddlt + 2; if ((uVar1 & 1) != 0) { zzz_ddlt = psVar2 + 3; uVar5 = gfxish_set_invalidate((undefined4 *)zzz_ddlt); zzz_ddlt = (short *)((int)zzz_ddlt + (int)(short)uVar5); gfxish_draw_sprite_normal(); } zzz_ddlt_state = 4; while ((sVar4 = zzz_ddlt_int_idx, zzz_ddlt_go_state_5 == 0 && (zzz_ints_4103_4[zzz_ddlt_int_idx] < 0))) { zzz_ddlt_int_idx = zzz_ddlt_int_idx + 1; switch(zzz_ints_4103_4[sVar4]) { case -9: beat_game_voice_idx = zzz_ints_4103_4[zzz_ddlt_int_idx]; zzz_ddlt_int_idx = sVar4 + 2; load_wave_flag_2(beat_game_voice_idx); play_wave_flag2(beat_game_voice_idx); zzz_ddlt_state = 3; break; case -7: iVar7 = (int)zzz_ddlt_int_idx; zzz_ddlt_int_idx = sVar4 + 2; iVar6 = (int)zzz_ddlt_int_idx; zzz_ddlt_int_idx = sVar4 + 3; play_wave_flag1(ints_4100[zzz_ints_4103_4[iVar7]],zzz_ints_4103_4[iVar6],1); break; case -4: iVar7 = (int)zzz_ddlt_int_idx; zzz_ddlt_int_idx = sVar4 + 2; stop_playing_wave_by_id_type1(ints_4100[zzz_ints_4103_4[iVar7]]); break; case -3: iVar7 = (int)zzz_ddlt_int_idx; zzz_ddlt_int_idx = sVar4 + 2; iVar6 = (int)zzz_ddlt_int_idx; zzz_ddlt_int_idx = sVar4 + 3; play_wave_flag1(ints_4100[zzz_ints_4103_4[iVar7]],zzz_ints_4103_4[iVar6],0); break; case -2: iVar7 = time_get_secs_count(0xf); zzz_ddlt_state_2_time = get_new_time_ms(iVar7); zzz_ddlt_state = 2; break; case -1: zzz_ddlt_go_state_5 = 1; zzz_ddlt_int_idx = 0; } } free_resource_item_with_data((int)zzz_ddlt_2); if (zzz_ddlt_int_idx != 0) { zzz_ddlt = (short *)load_ddlt(zzz_ints_4103_4[zzz_ddlt_int_idx]); zzz_ddlt_2 = zzz_ddlt; } break; case 2: bVar3 = time_not_yet_reached_ms(zzz_ddlt_state_2_time); if ((short)CONCAT31(extraout_var_00,bVar3) != 0) { zzz_ddlt_state = 4; } break; case 3: sVar4 = wave_is_playing_(beat_game_voice_idx); if (sVar4 == 0) { free_wave_flag_2(beat_game_voice_idx); zzz_ddlt_state = 4; } break; case 4: bVar3 = time_not_yet_reached_ms(zzz_ddlt_state_4_time); if ((short)CONCAT31(extraout_var,bVar3) != 0) { zzz_ddlt_state = 5; if (zzz_ddlt_go_state_5 == 0) { zzz_ddlt_state = 1; } DAT_0044ecea = DAT_0044ecea + 1; } break; case 5: xxxfunc_set(&beat_game_cutscene_2); } return; } void __stdcall FUN_004099d9(void) { DAT_0044ecf4 = 1; return; } void __cdecl FUN_004099e3(short *param_1) { short sVar1; uint uVar2; int iVar3; int iVar4; undefined4 local_8; sVar1 = param_1[3]; FUN_0043e3fb(-1,DAT_0044ecf8,(short *)((int)&local_8 + 2),(short *)&local_8); uVar2 = (int)(short)(sVar1 + -0x17) - (int)(short)local_8; iVar3 = (int)uVar2 >> 1; if (iVar3 < 0) { iVar3 = iVar3 + (uint)((uVar2 & 1) != 0); } iVar4 = (int)param_1[2] - (int)local_8._2_2_ >> 1; if (iVar4 < 0) { iVar4 = iVar4 + (uint)(((int)param_1[2] - (int)local_8._2_2_ & 1U) != 0); } FUN_00401220((short)iVar4 + *param_1,(short)iVar3 + param_1[1],DAT_0044ecf8); return; } void __stdcall beat_game_cutscene_2_on_load(void) { short sVar1; int *piVar2; load_rrgb_1(4101); piVar2 = load_aseq(4117); aseq_draw_gfx_and_xxx((int)piVar2,0,0,0,6); free_aseq(piVar2); FUN_0043e1b5(0xfff); FUN_0043dbb3(-1,(byte *)save_file_big,0x59,0xca,0xffff); FUN_0043e1b5(0); DAT_0044ecac = load_aseq(4118); aseq_set_pos_order((int)DAT_0044ecac,0xb2,0x6c,5); aseq_select_anim((int)DAT_0044ecac,1); anim_state_xxx_list_insert_4(DAT_0044ecac); mouse_region_new_up_whole_screen(0x4099d9); DAT_0044ecf4 = 0; sVar1 = are_voices_enabled(); if (sVar1 == 0) { DAT_0044ecac = load_aseq(0x101a); anim_set_flags_0x800_handler((int)DAT_0044ecac,0x4099e3,0); DAT_0044ecf8 = load_resource_item_0(0x100b,(int *)PTR_text_0044ae14); DAT_0044ecf6 = 0; aseq_anim_reset_and_play(DAT_0044ecac); } else { load_wave_flag_2(0x1004); play_wave_flag2(0x1004); DAT_0044ecf6 = 1; } FUN_00422170(); return; } void __stdcall nullsub(void) { return; } void __stdcall beat_game_cutscene_2_on_periodic(void) { short sVar1; if (DAT_0044ecf6 == 0) { if (DAT_0044ecf4 != 0) { DAT_0044ecac = (int *)free_aseq(DAT_0044ecac); free_resource_item_with_data(DAT_0044ecf8); xxxfunc_set(&exit_game_funcset); } } else { sVar1 = wave_is_playing_(0x1004); if ((sVar1 == 0) && (DAT_0044ecf4 != 0)) { free_wave_flag_2(0x1004); xxxfunc_set(&exit_game_funcset); return; } } return; } byte __stdcall yet_another_intersect_rect(short *param_1,short *param_2) { short sVar1; short sVar2; short sVar3; short sVar4; byte bVar5; bVar5 = 0; sVar1 = *param_1; sVar2 = param_1[1]; sVar3 = *param_2; sVar4 = param_2[1]; if ((((sVar1 < (short)(sVar3 + param_2[2])) && (sVar3 < (short)(sVar1 + param_1[2]))) && (sVar2 < (short)(sVar4 + param_2[3]))) && (sVar4 < (short)(sVar2 + param_1[3]))) { bVar5 = sVar1 < sVar3; if ((short)(sVar3 + param_2[2]) < (short)(sVar1 + param_1[2])) { bVar5 = bVar5 | 2; } if (sVar2 < sVar4) { bVar5 = bVar5 | 4; } if ((short)(sVar4 + param_2[3]) < (short)(sVar2 + param_1[3])) { bVar5 = bVar5 | 8; } if (bVar5 == 0) { bVar5 = 0xf; } } return bVar5; } undefined4 __cdecl actor_process_obstacle_related(short param_1,short *param_2,short param_3) { short sVar1; bool bVar2; byte bVar3; word wVar4; int iVar5; byte *pbVar6; undefined3 extraout_var; ushort uVar7; short *psVar8; short sVar9; short local_1e; ushort local_8; bVar2 = false; iVar5 = (int)param_1; pbVar6 = (byte *)actor_get_screen((int)(actors + iVar5)); local_8 = 0; if (actors[iVar5].saved.process_thing2_result == 0) { local_1e = actors[iVar5].xxx_eseq_a_selected[(short)actors[iVar5].saved.cur_state]->bbb; } else { local_1e = actors[iVar5].saved.process_thing2_result; } wVar4 = actors[iVar5].saved.y2; if (((*pbVar6 & 1) == 0) && (2 < (short)wVar4)) { wVar4 = wVar4 - 3; } psVar8 = *(short **)(pbVar6 + (short)wVar4 * 4 + 0x1e); sVar1 = *(short *)(pbVar6 + (short)wVar4 * 2 + 0x12); sVar9 = 0; while ((sVar9 < sVar1 && (!bVar2))) { bVar3 = yet_another_intersect_rect(param_2,psVar8); uVar7 = (ushort)CONCAT31(extraout_var,bVar3); if (uVar7 != 0) { uVar7 = uVar7 & 3; switch(uVar7) { case 1: if (param_3 == 1) { actors[iVar5].xxx_obstacle_col_intermed_x = *psVar8; bVar2 = true; } else { actors[iVar5].xxx_obstacle_col_intermed_x = *psVar8; bVar2 = true; } break; case 2: uVar7 = 2; if (param_3 == -1) { actors[iVar5].xxx_obstacle_col_intermed_x = *psVar8 + psVar8[2] + -1; bVar2 = true; } else { actors[iVar5].xxx_obstacle_col_intermed_x = *psVar8; bVar2 = true; } break; case 3: if (local_1e < 0) { uVar7 = 2; actors[iVar5].xxx_obstacle_col_intermed_x = *psVar8 + psVar8[2] + -1; bVar2 = true; } else { uVar7 = 1; actors[iVar5].xxx_obstacle_col_intermed_x = *psVar8; bVar2 = true; } } local_8 = local_8 | uVar7; } psVar8 = psVar8 + 5; sVar9 = sVar9 + 1; } actors[iVar5].xxx_obstacle_col_intersect_flags = local_8; return CONCAT22((short)((uint)(actors + iVar5) >> 0x10),local_8); } ushort __cdecl zzzchimp_do_extra_coll_checks(short param_1,short *param_2) { word wVar1; ushort uVar2; byte bVar3; word wVar4; int iVar5; undefined4 *puVar6; undefined3 extraout_var; undefined3 extraout_var_00; word wVar7; short sVar8; short *local_1c; short local_18 [4]; ushort local_10; ushort local_e; area_screen *local_c; actor_struct *local_8; iVar5 = (int)param_1; local_8 = actors + iVar5; local_c = loaded_area_screens[(short)actors[iVar5].saved.screen_idx]; local_e = 0; wVar4 = actors[iVar5].saved.y2; if (((local_c->type & 1) == 0) && (2 < (short)wVar4)) { wVar4 = wVar4 - 3; } wVar1 = local_c->coll_by_ylevel_counts[(short)wVar4]; wVar4 = local_c->coll_by_ylevel_idxs[(short)wVar4]; puVar6 = (undefined4 *)deref_next_if_not_null(&local_c->item_package_list->next); wVar7 = 0; do { if ((short)local_c->num_items <= (short)wVar7) { LAB_00409f20: local_1c = local_c->coll_by_ylevel + (short)wVar4; sVar8 = 0; if (0 < (short)wVar1) { do { uVar2 = *local_1c; if ((uVar2 & 0x8000) == 0) { if ((uVar2 & 0x4000) == 0) { memcpy((undefined4 *)local_18, (undefined4 *) &local_c->non_animated_objs[uVar2 & 3][(int)(uVar2 & 0x3fff) >> 2].coll_rect,10 ); } else { memcpy((undefined4 *)local_18, (undefined4 *) &local_c->animated_objs[uVar2 & 3][(int)(uVar2 & 0x3fff) >> 2].coll_rect,10); } bVar3 = yet_another_intersect_rect(local_18,param_2); if (((short)CONCAT31(extraout_var_00,bVar3) != 0) && (local_e = local_e | local_10, (local_10 & 0x780) != 0)) { (local_8->saved).idx_of_ladder_related = (word)((int)(uVar2 & 0x3fff) >> 2); } } local_1c = local_1c + 1; sVar8 = sVar8 + 1; } while (sVar8 < (short)wVar1); } return local_e; } bVar3 = yet_another_intersect_rect((short *)(puVar6 + 3),param_2); if ((short)CONCAT31(extraout_var,bVar3) != 0) { local_8->collision_flags = 0x800; local_e = 0x800; (local_8->saved).cur_item_pkg_idx = wVar7; goto LAB_00409f20; } wVar7 = wVar7 + 1; puVar6 = (undefined4 *)deref_next(puVar6); } while( true ); } void __cdecl zzzactor_collide_intersect_stuff(short param_1) { area_screen *paVar1; byte bVar2; word wVar3; ushort uVar4; short sVar5; int iVar6; undefined4 *puVar7; undefined3 extraout_var; undefined3 extraout_var_00; undefined3 extraout_var_01; short *psVar8; actor_struct *paVar9; short sVar10; short *local_20; short local_18 [4]; ushort local_10; area_screen_non_animated_obj *local_c; word local_8; word local_6; iVar6 = (int)param_1; paVar9 = actors + iVar6; paVar1 = loaded_area_screens[(short)actors[iVar6].saved.screen_idx]; wVar3 = actors[iVar6].saved.y2; if (((paVar1->type & 1) == 0) && (2 < (short)wVar3)) { wVar3 = wVar3 - 3; } local_6 = paVar1->coll_by_ylevel_counts[(short)wVar3]; local_8 = paVar1->coll_by_ylevel_idxs[(short)wVar3]; actors[iVar6].collision_flags = 0; puVar7 = (undefined4 *)deref_next_if_not_null(&paVar1->item_package_list->next); for (wVar3 = 0; (short)wVar3 < (short)paVar1->num_items; wVar3 = wVar3 + 1) { local_c = (area_screen_non_animated_obj *)(puVar7 + 3); bVar2 = yet_another_intersect_rect((short *)local_c,(short *)paVar9); if ((short)CONCAT31(extraout_var,bVar2) != 0) { actors[iVar6].collision_flags = actors[iVar6].collision_flags | 0x800; actors[iVar6].saved.cur_item_pkg_idx = wVar3; break; } puVar7 = (undefined4 *)deref_next(puVar7); } if (actors[iVar6].saved.collide_entity_checks_en != 0) { if (param_1 == 0) { psVar8 = player_other_entity_col_checks; } else if (param_1 == 1) { psVar8 = banana_other_entity_col_checks; } else { psVar8 = chimp_other_entity_col_checks; } for (; *psVar8 != -1; psVar8 = psVar8 + 1) { sVar10 = *psVar8; if ((((actors[sVar10].saved.disable == 0) && (actors[sVar10].saved.collide_entity_checks_en != 0)) && (actors[sVar10].saved.screen_idx == actors[iVar6].saved.screen_idx)) && ((actors[sVar10].saved.y2 == actors[iVar6].saved.y2 && (bVar2 = yet_another_intersect_rect((short *)paVar9,(short *)(actors + sVar10)), (short)CONCAT31(extraout_var_00,bVar2) != 0)))) { uVar4 = 0x1000; if (-1 < actors[sVar10].xxx_obstacle_col_direction_related) { uVar4 = 0x2000; } actors[iVar6].collision_flags = actors[iVar6].collision_flags | uVar4; actors[iVar6].collided_with_actor_idx = actors[sVar10].actor_idx; break; } } } local_20 = paVar1->coll_by_ylevel + (short)local_8; sVar10 = 0; if (0 < (short)local_6) { do { uVar4 = *local_20; if ((uVar4 & 0x8000) == 0) { if ((uVar4 & 0x4000) == 0) { local_c = paVar1->non_animated_objs[uVar4 & 3] + ((int)(uVar4 & 0x3fff) >> 2); memcpy((undefined4 *)local_18,(undefined4 *)&local_c->coll_rect,10); } else { memcpy((undefined4 *)local_18, (undefined4 *) &paVar1->animated_objs[uVar4 & 3][(int)(uVar4 & 0x3fff) >> 2].coll_rect,10); } bVar2 = yet_another_intersect_rect(local_18,(short *)paVar9); sVar5 = (short)CONCAT31(extraout_var_01,bVar2); if (sVar5 != 0) { actors[iVar6].collision_flags = actors[iVar6].collision_flags | local_10; if ((local_10 & 0x4c) != 0) { actors[iVar6].saved.idx_of_up_warp_related = (word)((int)(uVar4 & 0x3fff) >> 2); return; } if ((local_10 & 0x30) != 0) { actors[iVar6].saved.idx_of_up_warp_related = (word)((int)(uVar4 & 0x3fff) >> 2); return; } if ((local_10 & 0x780) != 0) { actors[iVar6].saved.idx_of_ladder_related = (word)((int)(uVar4 & 0x3fff) >> 2); return; } if ((local_10 & 1) != 0) { actors[iVar6].saved.idx_of_hole_related = (word)((int)(uVar4 & 0x3fff) >> 2); if ((sVar5 != 2) || (actors[iVar6].xxx_obstacle_col_direction_related != -1)) { if (sVar5 != 1) { return; } if (actors[iVar6].xxx_obstacle_col_direction_related != 1) { return; } } actors[iVar6].collision_flags = actors[iVar6].collision_flags & 1; return; } if ((local_10 & 2) != 0) { wVar3 = (word)((int)(uVar4 & 0x3fff) >> 2); actors[iVar6].saved.idx_of_up_warp_related = wVar3; actors[iVar6].saved.idx_of_hole_related = wVar3; return; } } } local_20 = local_20 + 1; sVar10 = sVar10 + 1; } while (sVar10 < (short)local_6); } return; } void __cdecl FUN_0040a328(ushort param_1,short param_2,undefined4 param_3,ushort param_4) { byte local_18 [20]; FUN_0043e1b5(param_4); sprintf(local_18); FUN_00401206(param_1,param_2,local_18); return; } int __cdecl num_puzzles_of_type_completed(short param_1) { short sVar1; int iVar2; iVar2 = 0; sVar1 = 0; do { if (save_file_big->puzzles[param_1].completed[sVar1] != 0) { iVar2 = iVar2 + 1; } sVar1 = sVar1 + 1; } while (sVar1 < 43); return iVar2; } void __stdcall puzzle_cust_set_gfx_enable_state(void) { short sVar1; sVar1 = 0; do { anim_state_xxx_list_remove((int *)puzzle_cust_types_state[sVar1].anim_state); if (((puzzle_cust_types_state[sVar1].state == 1) || (puzzle_cust_types_state[sVar1].state == 2)) || (puzzle_cust_types_state[sVar1].state == 4)) { aseq_select_anim((int)puzzle_cust_types_state[sVar1].anim_state,0); anim_state_xxx_list_insert_4((undefined4 *)puzzle_cust_types_state[sVar1].anim_state); } else { aseq_select_anim((int)puzzle_cust_types_state[sVar1].anim_state,1); anim_state_xxx_list_insert_4((undefined4 *)puzzle_cust_types_state[sVar1].anim_state); } sVar1 = sVar1 + 1; } while (sVar1 < 8); return; } void __stdcall puzzle_cust_draw_text(void) { int iVar1; short sVar2; ushort uVar3; sVar2 = 0; do { if ((int)(short)puzzle_cust_types_state[sVar2].state - 1U < 4) { uVar3 = 0x81c; } else { uVar3 = 0; } FUN_0040a328(0xf6,WORD_ARRAY_00448ad4[sVar2],CONCAT22(sVar2 >> 0xf,total_puzzles_of_type[sVar2]) ,uVar3); iVar1 = num_puzzles_of_type_completed(sVar2); FUN_0040a328(0x164,WORD_ARRAY_00448ad4[sVar2],iVar1,uVar3); sVar2 = sVar2 + 1; } while (sVar2 < 8); return; } void __stdcall puzzle_cust_finalize_settings(void) { short sVar1; sVar1 = 0; do { save_file_big->puzzles[sVar1].enable_state = puzzle_cust_types_state[sVar1].state; sVar1 = sVar1 + 1; } while (sVar1 < 8); return; } void __stdcall puzzle_cust_make_mouse_handlers(void) { short sVar1; mouse_region *pmVar3; short sVar4; short sVar5; code *pcVar6; undefined4 uVar2; sVar4 = 0; do { if (puzzle_cust_types_state[sVar4].state != 2) { pcVar6 = puzzle_cust_click_handler; sVar5 = 0xcd; uVar2 = aseq_get_img_h((int)puzzle_cust_types_state[sVar4].anim_state,0); sVar1 = (short)uVar2; uVar2 = aseq_get_img_w((int)puzzle_cust_types_state[sVar4].anim_state,0); pmVar3 = (mouse_region *) mouse_region_new_up(puzzle_cust_types_state[sVar4].x,puzzle_cust_types_state[sVar4].y ,(short)uVar2,sVar1,sVar5,(uint)pcVar6); puzzle_cust_types_state[sVar4].mouse_region = pmVar3; (puzzle_cust_types_state[sVar4].mouse_region)->extra_data = (int)sVar4; } sVar4 = sVar4 + 1; } while (sVar4 < 8); pcVar6 = puzzle_cust_click_handler; sVar1 = 0xcd; uVar2 = aseq_get_img_h((int)puzzle_cust_cancel_anim,0); sVar4 = (short)uVar2; uVar2 = aseq_get_img_w((int)puzzle_cust_cancel_anim,0); puzzle_cust_cancel_region = (mouse_region *) mouse_region_new_up(puzzle_cust_cancel_x,puzzle_cust_cancel_y,(short)uVar2,sVar4,sVar1, (uint)pcVar6); puzzle_cust_cancel_region->extra_data = 8; pcVar6 = puzzle_cust_click_handler; sVar1 = 0xcd; uVar2 = aseq_get_img_h((int)puzzle_cust_ok_anim,0); sVar4 = (short)uVar2; uVar2 = aseq_get_img_w((int)puzzle_cust_ok_anim,0); puzzle_cust_ok_region = (mouse_region *) mouse_region_new_up(puzzle_cust_ok_x,puzzle_cust_ok_y,(short)uVar2,sVar4,sVar1,(uint)pcVar6); puzzle_cust_ok_region->extra_data = 9; return; } void __cdecl puzzle_cust_click_handler(int param_1) { uint uVar1; undefined4 uVar2; uVar1 = *(uint *)(param_1 + 0x1e); if (uVar1 < 8) { uVar2 = puzzle_cust_toggle_type(*(short *)(param_1 + 0x1e)); if ((short)uVar2 != 0) { puzzle_cust_set_gfx_enable_state(); puzzle_cust_draw_text(); return; } } else { if (uVar1 == 8) { anim_state_xxx_list_insert_4((undefined4 *)puzzle_cust_cancel_anim); xxx_periodic_loop(); puzzle_cust_state = 5; DAT_00448ac0 = 0; return; } if (uVar1 != 9) { return; } anim_state_xxx_list_insert_4((undefined4 *)puzzle_cust_ok_anim); xxx_periodic_loop(); puzzle_cust_finalize_settings(); puzzle_cust_state = 5; DAT_00448ac0 = 0; } return; } void __stdcall puzzle_cust_load_images(void) { aseq_anim_state_struct *paVar1; short sVar2; sVar2 = 0; do { puzzle_cust_types_state[sVar2].x = 0x11; puzzle_cust_types_state[sVar2].y = puzzle_cust_types_ypos[sVar2]; paVar1 = (aseq_anim_state_struct *)load_aseq(sVar2 + 19001); puzzle_cust_types_state[sVar2].anim_state = paVar1; puzzle_cust_types_state[sVar2].state = save_file_big->puzzles[sVar2].enable_state; aseq_set_pos_order((int)puzzle_cust_types_state[sVar2].anim_state, puzzle_cust_types_state[sVar2].x,puzzle_cust_types_state[sVar2].y,0xcd); (puzzle_cust_types_state[sVar2].anim_state)->removal_related = 1; sVar2 = sVar2 + 1; } while (sVar2 < 8); puzzle_cust_cancel_x = 0x1a8; puzzle_cust_cancel_y = 0x152; puzzle_cust_cancel_anim = (aseq_anim_state_struct *)load_aseq(19010); aseq_set_pos_order((int)puzzle_cust_cancel_anim,puzzle_cust_cancel_x,puzzle_cust_cancel_y,0xcd); puzzle_cust_cancel_anim->removal_related = 1; puzzle_cust_ok_x = 0x1a8; puzzle_cust_ok_y = 0x128; puzzle_cust_ok_anim = (aseq_anim_state_struct *)load_aseq(19009); aseq_set_pos_order((int)puzzle_cust_ok_anim,puzzle_cust_ok_x,puzzle_cust_ok_y,0xcd); puzzle_cust_ok_anim->removal_related = 1; return; } void __stdcall free_puzzle_cust_aseqs(void) { short sVar1; sVar1 = 0; do { free_aseq((int *)puzzle_cust_types_state[sVar1].anim_state); sVar1 = sVar1 + 1; } while (sVar1 < 8); free_aseq((int *)puzzle_cust_cancel_anim); free_aseq((int *)puzzle_cust_ok_anim); return; } void __stdcall puzzle_cust_key_handler(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if (DAT_00448ac2 != 0) { if ((sVar1 != VK_RETURN) && (sVar1 != 0x1b)) { return; } puzzle_cust_state = 5; DAT_00448ac0 = 0; } return; } void __stdcall FUN_0040a8b9(void) { puzzle_cust_draw_text(); return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address undefined2 __cdecl run_puzzle_cust_dialog(short *param_1) { short sVar1; bool bVar2; word wVar3; short sVar4; undefined4 uVar5; undefined4 uVar6; BOOL BVar7; uint uVar8; int iVar9; tagMSG local_20; bVar2 = false; disable_exiting_because_dialog_xxx = 1; if (on_deactivate_xtra_cb != (undefined *)0x0) { (*(code *)on_deactivate_xtra_cb)(); } anim_state_xxx_new_list(); mouse_region_stash_lists(); DWORD_0044ed04 = get_time_ms(); disable_menus(0xff,0xffff,0); key_xxxxx_inc(); stop_playing_all_waves(); midi_pause_current(); DAT_0044ed08 = FUN_0043e1b5(0); key_xxxxx_set(puzzle_cust_key_handler); the_puzzle_cust_struct = (puzzle_cust_struct *)param_1; DAT_00448ac0 = 0xffff; save_unset_custom_cursor(); xxx_periodic_loop(); puzzle_cust_bg = (aseq_anim_state_struct *)load_aseq(the_puzzle_cust_struct->bg_aseq_idx); uVar5 = aseq_get_img_w((int)puzzle_cust_bg,0); the_puzzle_cust_struct->bg_w = (word)uVar5; uVar6 = aseq_get_img_h((int)puzzle_cust_bg,0); wVar3 = (word)uVar6; the_puzzle_cust_struct->bg_h = wVar3; _DAT_0044ed02 = wVar3 - 4; if (the_puzzle_cust_struct->xish == -1) { uVar8 = 0x200 - (int)(short)(word)uVar5; iVar9 = (int)uVar8 >> 1; if (iVar9 < 0) { iVar9 = iVar9 + (uint)((uVar8 & 1) != 0); } the_puzzle_cust_struct->xish = (short)iVar9; } sVar4 = the_puzzle_cust_struct->xish; if (the_puzzle_cust_struct->yish == -1) { iVar9 = (int)(0x180U - (int)(short)wVar3) >> 1; if (iVar9 < 0) { iVar9 = iVar9 + (uint)((0x180U - (int)(short)wVar3 & 1) != 0); } the_puzzle_cust_struct->yish = (short)iVar9; } sVar1 = the_puzzle_cust_struct->yish; puzzle_cust_bg->removal_related = 1; aseq_set_pos_order((int)puzzle_cust_bg,sVar4,sVar1,200); anim_state_xxx_list_insert_4((undefined4 *)puzzle_cust_bg); anim_set_flags_0x800_handler((int)puzzle_cust_bg,0x40a8b9,1); puzzle_cust_load_images(); puzzle_cust_set_gfx_enable_state(); puzzle_cust_draw_text(); puzzle_cust_state = 3; disable_exiting_because_dialog_xxx = 1; DAT_00448ac2 = 1; FUN_00422170(); puzzle_cust_make_mouse_handlers(); while (!bVar2) { xxx_periodic_loop(); BVar7 = PeekMessageA(&local_20,(HWND)0x0,0,0,1); if (BVar7 != 0) { TranslateMessage(&local_20); DispatchMessageA(&local_20); } if (puzzle_cust_state != 3) { if (puzzle_cust_state == 4) { sVar4 = aseq_anim_get_flags((int)the_puzzle_cust_struct->xxx_anim_state); if ((sVar4 == 0x10) && (sVar4 = aseq_anim_get_flags((int)the_puzzle_cust_struct->yyy_anim_state), sVar4 == 0x10) ) { bVar2 = true; } } else if (puzzle_cust_state == 5) { bVar2 = true; } } } puzzle_cust_bg = (aseq_anim_state_struct *)free_aseq((int *)puzzle_cust_bg); restore_cursor_override_regions(); FUN_0043e1b5(DAT_0044ed08); key_xxxxx_pop(); free_puzzle_cust_aseqs(); anim_state_xxx_restore_list(); mouse_region_unstash_list(); restore_enable_menus(0xff,0xffff,0); restart_current_midi(0); the_puzzle_cust_struct = (puzzle_cust_struct *)0x0; disable_exiting_because_dialog_xxx = 0; return DAT_00448ac0; } void __stdcall new_puzzle_cust_struct(void) { int iVar1; iVar1 = alloc_tracked_heap_block(0x3e); *(undefined2 *)(iVar1 + 2) = 0xffff; *(undefined2 *)(iVar1 + 4) = 0xffff; *(undefined2 *)(iVar1 + 0xc) = 0; *(undefined2 *)(iVar1 + 0x12) = 0; *(undefined2 *)(iVar1 + 0x14) = 0; *(undefined4 *)(iVar1 + 0x2a) = 0; *(undefined4 *)(iVar1 + 0x22) = 0; *(undefined4 *)(iVar1 + 0x26) = 0; *(undefined4 *)(iVar1 + 0x1e) = 0; *(undefined2 *)(iVar1 + 0x32) = 0; *(undefined2 *)(iVar1 + 10) = 0; *(undefined4 *)(iVar1 + 0x3a) = 0; *(undefined4 *)(iVar1 + 0x36) = 0; return; } void __stdcall options_puzzle_customization_(void) { short *psVar1; psVar1 = (short *)new_puzzle_cust_struct(); FUN_00421ea4(0); FUN_0042211c(); load_rrgb_1(19000); *psVar1 = 19000; psVar1[5] = 2; run_puzzle_cust_dialog(psVar1); free_tracked_heap_block((int)psVar1); FUN_0042211c(); FUN_00421ea4(1); FUN_00422170(); gfxish_copy_otherbuf_to_dest_and_invalidate(0,0,0x200,0x180); gfxish_invalidate_rect_wrap(0,0,0x200,0x180); FUN_0043d7ce(); return; } undefined4 __cdecl puzzle_cust_toggle_type(short param_1) { short sVar1; undefined4 uVar2; int iVar3; short sVar4; sVar4 = 0; sVar1 = 0; do { if (((puzzle_cust_types_state[sVar1].state == 0) || (puzzle_cust_types_state[sVar1].state == 3)) && (param_1 != sVar1)) { sVar4 = sVar4 + 1; } sVar1 = sVar1 + 1; } while (sVar1 < 8); if (sVar4 == 0) { uVar2 = 0; } else { iVar3 = (int)(short)puzzle_cust_types_state[param_1].state; if (iVar3 == 0) { iVar3 = param_1 * 7; puzzle_cust_types_state[param_1].state = 1; } else if (iVar3 == 1) { iVar3 = param_1 * 7; puzzle_cust_types_state[param_1].state = 0; } else if (iVar3 == 3) { iVar3 = param_1 * 7; puzzle_cust_types_state[param_1].state = 4; } else { iVar3 = iVar3 + -4; if (iVar3 == 0) { iVar3 = param_1 * 7; puzzle_cust_types_state[param_1].state = 3; } } uVar2 = CONCAT22((short)((uint)iVar3 >> 0x10),1); } return uVar2; } undefined4 __stdcall dialog_proc(HWND param_1,short param_2,ushort param_3) { bool bVar1; short sVar2; short sVar3; uint uVar4; int iVar5; CHAR local_64 [80]; tagRECT local_14; if (param_2 == 2) { if (*(short *)(DAT_00448af8 + 0x16) == 0) { return 0; } } else { if (param_2 == 0x47) { return 0; } if (param_2 == 0x110) { GetWindowRect(param_1,&local_14); if (*(short *)(DAT_00448af8 + 10) == -1) { uVar4 = 0x200 - (int)(short)(((short)local_14.right - (short)local_14.left) + 1); iVar5 = (int)uVar4 >> 1; if (iVar5 < 0) { iVar5 = iVar5 + (uint)((uVar4 & 1) != 0); } sVar3 = (short)iVar5; } else { sVar3 = *(short *)(DAT_00448af8 + 10); } if (*(short *)(DAT_00448af8 + 0xc) == -1) { uVar4 = 0x180 - (int)(short)(((short)local_14.bottom - (short)local_14.top) + 1); iVar5 = (int)uVar4 >> 1; if (iVar5 < 0) { iVar5 = iVar5 + (uint)((uVar4 & 1) != 0); } sVar2 = (short)iVar5; } else { sVar2 = *(short *)(DAT_00448af8 + 0xc); } SetWindowPos(param_1,(HWND)0x0,(int)(short)(sVar3 + (short)mouse_xbase), (int)(short)(sVar2 + (short)mouse_ybase),0,0,5); if ((*DAT_00448af8 & 1) != 0) { bVar1 = false; sVar3 = 1; while (!bVar1) { GetDlgItemTextA(param_1,(int)sVar3,local_64,3); iVar5 = strcmp2(local_64,s__0_00448afc); if (iVar5 == 0) { SetDlgItemTextA(param_1,(int)sVar3,*(LPCSTR *)(DAT_00448af8 + 6)); bVar1 = true; } sVar3 = sVar3 + 1; } } return 1; } if (param_2 == 0x111) { if (param_3 == 1) { EndDialog(param_1,1); return 1; } if (param_3 == 2) { EndDialog(param_1,0); return 1; } if ((ushort)(param_3 - 3) < 3) { EndDialog(param_1,(uint)param_3); return 1; } } } return 0; } void __cdecl open_dialog_box(ushort param_1) { DialogBoxParamA(instance,(LPCSTR)(uint)param_1,main_hwnd,dialog_proc,0); return; } void __cdecl open_dialog_box_wrapped_xxx(ushort param_1) { DAT_00448af8 = &DAT_0044ed9c; if ((DAT_0044ed9c & 2) == 0) { DAT_0044eda6 = 0xffff; } if ((DAT_0044ed9c & 4) == 0) { DAT_0044eda8 = 0xffff; } if ((DAT_0044ed9c & 8) == 0) { DAT_0044edb2 = 0xffff; } open_dialog_box(param_1); DAT_0044ed9c = 0; return; } void __cdecl FUN_0040aed0(undefined4 param_1) { DAT_00448af8 = param_1; return; } void __stdcall nullsub(void) { return; } void __stdcall nullsub(void) { return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __cdecl FUN_0040aee7(undefined4 param_1) { _DAT_0044eda2 = param_1; DAT_0044ed9c = DAT_0044ed9c | 1; return; } void __cdecl FUN_0040aefc(undefined2 param_1,undefined2 param_2) { DAT_0044eda6 = param_1; DAT_0044eda8 = param_2; DAT_0044ed9c = DAT_0044ed9c | 6; return; } void __cdecl open_dialog_box_wrapped_yyy(ushort param_1,undefined2 param_2) { DAT_0044edb2 = param_2; DAT_0044ed9c = DAT_0044ed9c | 8; open_dialog_box_wrapped_xxx(param_1); return; } void __cdecl player_action_10_pick_up_item(actor_struct *param_1) { word *pwVar1; bool bVar2; short sVar3; int *piVar4; undefined4 uVar5; int iVar6; undefined3 extraout_var; short *psVar7; short local_8; short local_6; piVar4 = (int *)get_area_screen_list_idx (actors[0].saved.screen_idx,actors[0].saved.cur_item_pkg_idx); if ((short)piVar4[2] == 1) { alert_message(s_Package_EMPTY_00449410); } else if (*(short *)((int)piVar4 + 0x1e) == 1000) { give_bananas(5); remove_item_from_screen((param_1->saved).screen_idx,piVar4); num_bananas_on_map = num_bananas_on_map + -1; sVar3 = are_voices_enabled(); if (sVar3 != 0) { FUN_0040b21a(1); DAT_00448b14 = 0x1fa8; load_wave_flag_2(0x1fa8); DAT_00448b14 = DAT_00448b14 | 0x8000; } } else { psVar7 = &local_8; uVar5 = part_get_slot(*(short *)((int)piVar4 + 0x1e)); iVar6 = part_linked_list_find_given_slot(¶m_1->parts_linked_list->next,(short)uVar5,psVar7); if ((short)iVar6 == 2) { FUN_0040701b(*(short *)((int)piVar4 + 0x1e),1); enqueue_new_player_hint(4,0,0); } else { uVar5 = part_get_is_not_decoration(*(short *)((int)piVar4 + 0x1e)); local_6 = (short)uVar5; bVar2 = actor_give_part(0,*(short *)((int)piVar4 + 0x1e)); local_8 = (short)CONCAT31(extraout_var,bVar2); FUN_004070c3(*(short *)((int)piVar4 + 0x1e)); DAT_00448b02 = 1; remove_item_from_screen((param_1->saved).screen_idx,piVar4); status_bar_flags = status_bar_flags | 1; if ((local_8 == 0) && (local_6 != 0)) { pwVar1 = &(save_file_big->basic_stats).parts_needed; *pwVar1 = *pwVar1 - 1; } sVar3 = 7; if (local_6 == 0) { sVar3 = 1; } enqueue_new_player_hint(sVar3,0,0); if ((save_file_big->basic_stats).parts_needed == 0) { enqueue_new_player_hint(0xd,0,0); } sVar3 = are_voices_enabled(); if (sVar3 != 0) { iVar6 = part_get_chunk_by_file_idx(*(short *)((int)piVar4 + 0x1e)); FUN_0040b21a(1); DAT_00448b14 = *(ushort *)(iVar6 + 0x16); load_wave_flag_2(DAT_00448b14); DAT_00448b14 = DAT_00448b14 | 0x8000; } if ((loaded_parts[*(ushort *)((int)piVar4 + 0x1e)].state_flags & 0x4000) == 0) { increment_score(0x14,0); } } } return; } void __cdecl actor_0_eseq_29_hit_by_chimp_cb(int param_1) { word *pwVar1; short sVar2; short sVar3; int iVar4; uint uVar5; undefined4 *puVar6; undefined4 uVar7; ushort uVar8; short sVar9; short local_6; sVar2 = *(short *)(param_1 + 0x6e); status_bar_put_down_held(); actors[0].saved.player_iframes = 0x96; iVar4 = linked_list_sz(*(undefined4 **)(param_1 + 0x72)); sVar9 = (short)iVar4; if (sVar9 != 0) { if (sVar9 == 0) { uVar8 = 0; } else { uVar5 = rand(); uVar8 = (ushort)((int)uVar5 % (int)sVar9); } puVar6 = actor_parts_find_held_by(*(undefined4 **)(param_1 + 0x72),0,uVar8); if (puVar6 != (undefined4 *)0x0) { sVar9 = *(short *)(puVar6 + 0x18); uVar7 = part_get_slot(sVar9); iVar4 = part_linked_list_find_given_slot(actors_N_parts_list,(short)uVar7,&local_6); if ((short)iVar4 == 2) { sVar3 = actor_parts_find_by_slot(actors_N_parts_list,(short)uVar7); actor_take_part(sVar2,sVar3,0); place_item_randomly_on_random_screen(sVar3); } uVar7 = part_get_is_not_decoration(sVar9); puVar6 = (undefined4 *)part_clear_status_and_find_xxxx(sVar9); iVar4 = actor_take_part(0,sVar9,1); local_6 = (short)iVar4; actor_give_part(sVar2,sVar9); status_bar_remove_mouse_and_position_xxx(puVar6); if ((local_6 == 0) && ((short)uVar7 != 0)) { pwVar1 = &(save_file_big->basic_stats).parts_needed; *pwVar1 = *pwVar1 + 1; } } } return; } void __cdecl FUN_0040b21a(short param_1) { ushort uVar1; short sVar2; ushort uVar3; if (DAT_00448b14 != 0xffff) { uVar1 = DAT_00448b14 & 0x8000; uVar3 = DAT_00448b14 & 0x7fff; if (param_1 != 0) { uVar3 = DAT_00448b14 & 0x7fff; DAT_00448b14 = DAT_00448b14 & 0x7fff; stop_playing_wave_by_id_type2(uVar3); uVar1 = 0; uVar3 = DAT_00448b14; } DAT_00448b14 = uVar3; if (uVar1 != 0) { play_wave_flag2(DAT_00448b14); return; } if (DAT_00448b14 != 0) { sVar2 = wave_is_playing_(DAT_00448b14); if (sVar2 == 0) { free_wave_flag_2(DAT_00448b14); DAT_00448b14 = 0xffff; } } } return; } undefined4 __stdcall actor_0_process_cb(void) { short sVar1; bool bVar2; area_screen_trampoline_jump_loc *paVar3; short sVar4; undefined4 uVar5; undefined2 uVar6; actor_key_flag_struct *paVar7; uint local_c; bVar2 = false; uVar5 = 0xffffffff; local_c = get_keys_and_coll_actor0(); FUN_0040b21a(0); if (actors[0].saved.player_iframes != 0) { actors[0].saved.player_iframes = actors[0].saved.player_iframes - 1; local_c = local_c & 0xcfffffff; } if (god_mode != 0) { local_c = local_c & 0xcfffffff; } if ((save_file_big->basic_stats).bananas == 0) { local_c = local_c & 0xffffffdf; } paVar7 = player_keyboard_handlers[(short)actors[0].saved.cur_state]; if (paVar7 != (actor_key_flag_struct *)0x0) { for (; (!bVar2 && (paVar7->expected != 0xffffffff)); paVar7 = paVar7 + 1) { if ((paVar7->expected == (~paVar7->mask & local_c)) || (paVar7->expected == 0)) { bVar2 = true; sVar1 = paVar7->eseq; uVar6 = (undefined2)((uint)uVar5 >> 0x10); uVar5 = CONCAT22(uVar6,sVar1); if ((sVar1 < 0xc) || (0xf < sVar1)) { if ((sVar1 == 0x10) || (sVar1 == 0x11)) { paVar3 = loaded_screen.trampoline_r_locs[(short)actors[0].saved.y2]; for (sVar4 = 0; sVar4 < (short)loaded_screen.num_trampoline_r_locs[(short)actors[0].saved.y2]; sVar4 = sVar4 + 1) { if (((sVar1 == paVar3->match_eseq) && ((short)actors[0].rect.x < (short)(paVar3->x + paVar3->w))) && (paVar3->x < (short)(actors[0].rect.x + actors[0].rect.w))) { uVar5 = CONCAT22(uVar6,paVar3->new_eseq); actors[0].saved.idx_of_ladder_related = paVar3->trampoline_idx; break; } paVar3 = paVar3 + 1; } } } else { paVar3 = loaded_screen.trampoline_l_locs[(short)actors[0].saved.y2]; for (sVar4 = 0; sVar4 < (short)loaded_screen.num_trampoline_l_locs[(short)actors[0].saved.y2]; sVar4 = sVar4 + 1) { if (((sVar1 == paVar3->match_eseq) && ((short)actors[0].rect.x < (short)(paVar3->x + paVar3->w))) && (paVar3->x < (short)(actors[0].rect.x + actors[0].rect.w))) { uVar5 = CONCAT22(uVar6,paVar3->new_eseq); actors[0].saved.idx_of_ladder_related = paVar3->trampoline_idx; break; } paVar3 = paVar3 + 1; } } } } } return uVar5; } undefined2 __stdcall actor_1_process_cb_null(void) { return 0xffff; } void __stdcall player_after_transition_screen(void) { short sVar1; uint uVar2; int iVar3; short *psVar4; short sVar5; short sVar6; uVar2 = area_screen_type_b0(actors[0].saved.screen_idx); actors_switch_game_mode = 0; actor_xxx_eseq_select(0,(short)uVar2); sVar1 = actors[0].saved.new_state_after_reload_1; actors[0].field7_0x10 = 0; actors[1].saved.screen_idx = actors[0].saved.screen_idx; if (actors[0].saved.new_state_after_reload_1 != -1) { actors[0].saved.new_state_after_reload_1 = -1; actors[0].saved.cur_state = sVar1; actor_go_to_state(0,sVar1); actors[0].saved.eseq_step = 0; if (((sVar1 == 0x21) || (sVar1 == 0x2c)) || (sVar1 == 0x2d)) { iVar3 = area_screen_thing0_0_idx (actors[0].saved.prev_screen_idx,actors[0].saved.idx_of_up_warp_related); psVar4 = (short *)screen_non_animated_warp_find_xxxxx (actors[0].saved.screen_idx,*(short *)(iVar3 + 0x12)); if ((short)uVar2 == 0) { sVar6 = 0x10; sVar5 = 0x1c; } else { sVar6 = 5; sVar5 = 0xb; } actors[0].rect.x = sVar6 + *psVar4; actors[0].rect.y = sVar5 + psVar4[1]; actors[0].saved.x = actors[0].rect.x; actors[0].saved.y = actors[0].rect.y; } if (sVar1 == 0x35) { actors[0].saved.y2 = 5; } } return; } void __stdcall player_prepare_transition_screen(void) { int iVar1; short unaff_SI; word unaff_DI; iVar1 = area_screen_thing0_0_idx (actors[0].saved.screen_idx,actors[0].saved.idx_of_up_warp_related); FUN_0040b21a(1); if (iVar1 == 0) { unaff_DI = (save_file_big->basic_stats).building_sector; unaff_SI = 0x35; } else { go_through_locked_door = 0; switch(*(short *)(iVar1 + 0x10)) { case 6: unaff_DI = *(word *)(iVar1 + 0x12); unaff_SI = 41; if (actors[0].xxx_obstacle_col_direction_related < 1) { unaff_SI = 0x28; } break; case 7: (save_file_big->basic_stats).go_through_door_hint_flag = 1; unaff_SI = 33; go_through_locked_door = 1; unaff_DI = loaded_screen_idx; break; case 8: (save_file_big->basic_stats).building_sector = actors[0].saved.screen_idx; unaff_DI = 0; unaff_SI = 0; break; case 9: (save_file_big->basic_stats).go_through_door_hint_flag = 1; unaff_DI = *(ushort *)(iVar1 + 0x12) & 0xf; unaff_SI = 33; break; case 10: case 0xb: unaff_DI = *(ushort *)(iVar1 + 0x12) & 0xf; unaff_SI = 45; if (*(short *)(iVar1 + 0x10) != 10) { unaff_SI = 0x2c; } } } actors[0].saved.new_state_after_reload_0 = unaff_SI; actors[0].saved.prev_screen_idx = actors[0].saved.screen_idx; actors[0].saved.screen_idx = unaff_DI; actors[0].saved.new_state_after_reload_1 = unaff_SI; return; } void __stdcall load_eseq_4500_3(void) { short *local_14; short *local_10; short *local_c; short *local_8; if (eseq_4500_3[0] == (undefined *)0x0) { eseq_4500_3[0] = (undefined *)load_eseq(4500,0x44eed0,&local_8,&local_c); actors[0].eseq_w_tables[1] = local_8; actors[0].eseq_h_tables[1] = local_c; } if (eseq_4500_3[1] == (undefined *)0x0) { eseq_4500_3[1] = (undefined *)load_eseq(4501,0x44edbc,&local_10,&local_14); actors[0].eseq_w_tables[0] = local_10; actors[0].eseq_h_tables[0] = local_14; } if (eseq_4500_3[2] == (undefined *)0x0) { eseq_4500_3[2] = (undefined *)load_eseq(4502,0x44eff8,&local_8,&local_c); actors[1].eseq_w_tables[1] = local_8; actors[1].eseq_h_tables[1] = local_c; } if (eseq_4500_3[3] == (undefined *)0x0) { eseq_4500_3[3] = (undefined *)load_eseq(4503,0x44efe4,&local_10,&local_14); actors[1].eseq_w_tables[0] = local_10; actors[1].eseq_h_tables[0] = local_14; } return; } void __stdcall free_eseq_4500_3(void) { short sVar1; sVar1 = 0; do { if (eseq_4500_3[sVar1] != (undefined *)0x0) { free_resource_item_with_data((int)eseq_4500_3[sVar1]); eseq_4500_3[sVar1] = (undefined *)0x0; } sVar1 = sVar1 + 1; } while (sVar1 < 4); return; } void __stdcall banana_after_transition_screen(void) { uint uVar1; uVar1 = area_screen_type_b0(actors[1].saved.screen_idx); actor_xxx_eseq_select(1,(short)uVar1); actors[1].field7_0x10 = 0; return; } void __stdcall set_up_actors_01(void) { actors[0].actor_idx = 0; actors[0].saved.disable = 0; actors[0].field7_0x10 = 0; actors[0].saved.screen_idx = 0; actors[0].cmd_24_related_state = 2; actors[0].eseq_action_10_cb = player_action_10_pick_up_item; actors[0].saved.process_thing2_en = 1; actors[0].saved.collide_entity_checks_en = 1; actors[0].parts_linked_list = (linked_list_head *)alloc_linked_list_marker(); actors[0].xxx_eseq_a_0 = eseq_4500_a; actors[0].xxx_eseq_a_1 = eseq_4501_a; actors[0].eseq_action_11_cb_a = player_prepare_transition_screen; actors[0].saved.new_state_after_reload_0 = -1; actors[0].aseq_idx_cur = -1; actors[0].saved.new_state_after_reload_1 = 0; actors[0].eseq_action_11_cb_b = player_after_transition_screen; actors[0].saved.process_thing2_result = 0; actors[0].field40_0x90 = (undefined *)player_keyboard_handlers; actors[0].process_cb = actor_0_process_cb; actors[0].aseq_idx_base = 4500; actors[0].eseq_action_29_cb = actor_0_eseq_29_hit_by_chimp_cb; actor_xxx_eseq_select(0,0); actors[1].saved.disable = 1; actors[1].actor_idx = 1; actors[1].field7_0x10 = 0; actors[1].cmd_24_related_state = 2; actors[1].aseq_idx_cur = -1; actors[1].aseq_idx_base = 4502; actors[1].saved.new_state_after_reload_0 = -1; actors[1].saved.new_state_after_reload_1 = -1; actors[1].eseq_action_10_cb = (undefined *)0x0; actors[1].saved.process_thing2_en = 1; actors[1].saved.collide_entity_checks_en = 1; actors[1].parts_linked_list = (linked_list_head *)0x0; actors[1].xxx_eseq_a_0 = eseq_4502_a; actors[1].xxx_eseq_a_1 = eseq_4503_a; actors[1].eseq_action_11_cb_a = (undefined *)0x0; actors[1].eseq_action_11_cb_b = banana_after_transition_screen; actors[1].saved.process_thing2_result = 0; actors[1].field40_0x90 = (undefined *)PTR_ARRAY_004492e0; actors[1].process_cb = actor_1_process_cb_null; actors[1].eseq_action_29_cb = (undefined *)0x0; return; } void __cdecl xxx_maybe_throw_banana(short param_1,short param_2) { word *pwVar1; uint uVar2; short sVar3; if ((save_file_big->basic_stats).bananas != 0) { actors[1].saved.disable = 0; actors[1].rect.x = actors[0].saved.x + param_2; actors[1].saved.y = actors[0].saved.y; actors[1].saved.y2 = actors[0].saved.y2; actors[1].saved.new_state_after_reload_0 = -1; actors[1].saved.new_state_after_reload_1 = -1; actors[1].saved.screen_idx = actors[0].saved.screen_idx; actors[1].saved.eseq_step = 0; actors[1].field7_0x10 = 0; actors[1].collision_flags = 0; actors[1].saved.process_thing2_result = 0; actors[1].saved.prev_state = 0xffff; actors[1].saved.w13 = -1; actors[1].saved.collide_entity_checks_en = 1; actors[1].saved.x = actors[1].rect.x; uVar2 = area_screen_type_b0(actors[0].saved.screen_idx); actor_xxx_eseq_select(1,(short)uVar2); actor_go_to_state(1,param_1); pwVar1 = &(save_file_big->basic_stats).bananas; *pwVar1 = *pwVar1 - 1; status_bar_flags = status_bar_flags | 8; if (((save_file_big->basic_stats).bananas == 0) && (num_bananas_on_map == 0)) { for (sVar3 = 0; sVar3 < num_initial_bananas_on_map; sVar3 = sVar3 + 1) { place_item_randomly_on_random_screen(1000); } num_bananas_on_map = num_initial_bananas_on_map; } } return; } void __stdcall actor_01_reset_xxx(void) { DAT_00448b02 = 0; actors[0].saved.y2 = 0; actors[0].saved.player_iframes = 0; actors[0].saved.prev_screen_idx = 0xffff; actors[0].saved.screen_idx = 0; actors[1].saved.disable = 1; actors[0].held_parts = 0; actors[0].collision_flags = 0; linked_list_head_zero(&(actors[0].parts_linked_list)->next); return; } void __cdecl alert_message(char *param_1) { CHAR local_1f8 [500]; vsprintf(local_1f8,param_1,(uint *)&stack0x00000008); MessageBoxA((HWND)0x0,local_1f8,s_Alert_00449420,0x30); return; } void __cdecl draw_msg_to_main_window(short param_1,short param_2,char *param_3) { HDC hdc; int c; char local_1f8 [500]; vsprintf(local_1f8,param_3,(uint *)&stack0x00000010); hdc = GetDC(main_hwnd); c = strlen(local_1f8); TextOutA(hdc,(int)param_1,(int)param_2,local_1f8,c); ReleaseDC(main_hwnd,hdc); return; } void __cdecl fatal_message(char *param_1) { CHAR local_1f8 [500]; vsprintf(local_1f8,param_1,(uint *)&stack0x00000008); MessageBoxA((HWND)0x0,local_1f8,s_Fatal_00449426,0x30); exit(1); return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __stdcall electricity_puzzle_on_load(void) { aseq_anim_state_struct *paVar1; aseq_cursor_struct *paVar2; short sVar3; _DAT_0044f012 = 0; wave_load_list[0] = 0x1f73; wave_load_list[1] = 0x4a54; wave_load_list[2] = 0x1f9a; wave_load_list[3] = 0x1f9b; wave_load_list[4] = 0x4a74; wave_load_list[5] = 0x1f5c; wave_load_list[6] = 0x4a77; wave_load_list[7] = -1; load_waves_from_list(0x451486); FUN_0043d7c1(FUN_00412af9); load_and_draw_score(); load_rrgb_1(10000); elec_ui_bg_aseq = load_aseq(10000); aseq_draw_to_both_fbs((int)elec_ui_bg_aseq,0,0,0); free_aseq(elec_ui_bg_aseq); electricity_load_puzzle(puzzle_idx); FUN_00430e33(DAT_0044946a); FUN_0040beff(); FUN_004104cc(); FUN_00412104(1); FUN_00430e33(DAT_0044946a); key_xxxxx_set(FUN_0041055b); elec_ui_go_back_aseq = load_aseq(15009); aseq_set_pos_order((int)elec_ui_go_back_aseq,0x18e,0x143,10); sVar3 = 0; do { paVar1 = (aseq_anim_state_struct *)load_aseq(sVar3 + 10013); battery_puzzle_cursor_aseq[sVar3] = paVar1; paVar2 = (aseq_cursor_struct *)aseq_setup_as_cursor((int)battery_puzzle_cursor_aseq[sVar3],0,0); battery_puzzle_cursor_aseq_more[sVar3] = paVar2; battery_puzzle_cursor_aseq_more[sVar3]->enable_clip_cursor = 0; sVar3 = sVar3 + 1; } while (sVar3 < 6); sVar3 = 0; do { paVar1 = (aseq_anim_state_struct *)load_aseq(sVar3 + 10003); battery_puzzle_things_aseq[sVar3] = paVar1; paVar2 = (aseq_cursor_struct *)aseq_setup_as_cursor((int)battery_puzzle_things_aseq[sVar3],0,0); battery_puzzle_things_aseq_more[sVar3] = paVar2; sVar3 = sVar3 + 1; } while (sVar3 < 4); battery_wire_spool_0_aseq = load_aseq(10007); battery_wire_spool_0_aseq_more = aseq_setup_as_cursor((int)battery_wire_spool_0_aseq,0x37,0xf); battery_wire_spool_1_aseq = load_aseq(10010); battery_wire_spool_1_aseq = aseq_setup_as_cursor((int)battery_wire_spool_1_aseq,0x37,0xf); battery_ui_hint_aseq = load_aseq(15005); aseq_set_pos_order((int)battery_ui_hint_aseq,0x2a,0x19,1); FUN_00412c17(1); on_deactivate_xtra_cb = FUN_00412d4b; FUN_00422170(); return; } void __stdcall electricity_puzzle_on_remove(void) { aseq_anim_state_struct *paVar1; short sVar2; on_deactivate_xtra_cb = (undefined *)0x0; FUN_00430ef4(0x451486); FUN_0043d7c1(0); FUN_00431029(); DAT_004514ae = DAT_0044946a; sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)battery_puzzle_cursor_aseq[sVar2]); battery_puzzle_cursor_aseq[sVar2] = paVar1; aseq_free_cursor((int)battery_puzzle_cursor_aseq_more[sVar2]); paVar1 = (aseq_anim_state_struct *)free_aseq((int *)battery_puzzle_things_aseq[sVar2]); battery_puzzle_things_aseq[sVar2] = paVar1; aseq_free_cursor((int)battery_puzzle_things_aseq_more[sVar2]); sVar2 = sVar2 + 1; } while (sVar2 < 6); free_tracked_heap_block(DAT_0044f00c); set_cursor_override_regions(0,0); mouse_region_delete_all_lists(); FUN_0041057c(); key_xxxxx_clear(); free_resource_item_with_idx_fourcc(DAT_004514c2,(undefined1 *)&text); FUN_0042211c(); if (DAT_004514b0 != 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; } return; } void __stdcall electricity_puzzle_on_periodic(void) { short sVar1; get_mouse_xy_relative_(&DAT_0044f018,&DAT_0044f01a); new_player_hint(0xf); sVar1 = wave_is_playing_(DAT_004514b0); if (sVar1 == 0) { if (DAT_004514b0 != 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; } if (DAT_004514bc != 0) { DAT_004514bc = DAT_004514bc + -1; DAT_004514b0 = (&DAT_004514c4)[DAT_004514bc]; load_wave_flag_2(DAT_004514b0); play_wave_flag2(DAT_004514b0); } } if (DAT_0044f014 != 0) { DAT_0044f014 = 0; FUN_0040beff(); FUN_00412bae(); } if (DAT_00449470 == 2) { if (DAT_0044f030 == 4) { FUN_00411df1(); return; } } else if (DAT_00449470 == 4) { xxxfunc_set(&puzzle_choosing_funcset_xxx); } else if (DAT_00449470 == 5) { return; } return; } void __stdcall FUN_0040bed6(void) { anim_state_xxx_list_insert_4(elec_ui_go_back_aseq); xxx_periodic_loop(); if (DAT_00449470 != 3) { DAT_00449470 = 4; } return; } void __stdcall FUN_0040beff(void) { bool bVar1; bool bVar2; short sVar3; mouse_region *pmVar5; short sVar6; short sVar7; code *pcVar8; undefined4 uVar4; mouse_region_delete_all_lists(); DAT_0044f6d8 = mouse_region_new_up(10,0x80,0x7c,0xb5,1,0x40c185); *(undefined4 *)((int)DAT_0044f6d8 + 0x1e) = 1000; DAT_0044f6dc = mouse_region_new_up(0x9a,0x24,0x15a,0x104,1,0x40c185); *(undefined4 *)((int)DAT_0044f6dc + 0x1e) = 0x3e9; mouse_region_new_up(0x18e,0x144,0x1f5,0x165,5,0x40bed6); mouse_region_new_up(0x29,0x1b,0x3a,0x1e,5,0x4129d4); sVar6 = 0; do { if (0 < (short)null_ARRAY_0044f020[sVar6]) { pcVar8 = FUN_0040c185; sVar7 = 5; uVar4 = aseq_get_img_h((int)PTR_ARRAY_0044f9ac[sVar6],0); sVar3 = (short)uVar4; uVar4 = aseq_get_img_w((int)PTR_ARRAY_0044f9ac[sVar6],0); pmVar5 = (mouse_region *) mouse_region_new_up(struct_unk_2_ARRAY_0044942c[sVar6].field0_0x0, struct_unk_2_ARRAY_0044942c[sVar6].field1_0x2,(short)uVar4,sVar3, sVar7,(uint)pcVar8); PTR_ARRAY_0044f698[sVar6] = pmVar5; PTR_ARRAY_0044f698[sVar6]->extra_data = (int)sVar6; } sVar6 = sVar6 + 1; } while (sVar6 < 5); sVar6 = 0; do { if ((struct_unk_1_ARRAY_0044f556[sVar6].field3_0x6 == 1) && (struct_unk_1_ARRAY_0044f556[sVar6].field5_0xa == 0)) { bVar1 = true; } else { bVar1 = false; } if ((struct_unk_1_ARRAY_0044f556[sVar6].field0_0x0 == 2) && (struct_unk_1_ARRAY_0044f556[sVar6].field3_0x6 == 1)) { bVar2 = true; } else { bVar2 = false; } if (bVar1 || bVar2) { pcVar8 = FUN_0040c185; sVar7 = 5; uVar4 = aseq_get_img_h((int)struct_unk_1_ARRAY_0044f556[sVar6].anim_state,0); sVar3 = (short)uVar4; uVar4 = aseq_get_img_w((int)struct_unk_1_ARRAY_0044f556[sVar6].anim_state,0); pmVar5 = (mouse_region *) mouse_region_new_up(struct_unk_1_ARRAY_0044f556[sVar6].field1_0x2, struct_unk_1_ARRAY_0044f556[sVar6].field2_0x4,(short)uVar4,sVar3, sVar7,(uint)pcVar8); struct_unk_1_ARRAY_0044f556[sVar6].mouse_region = pmVar5; (struct_unk_1_ARRAY_0044f556[sVar6].mouse_region)->extra_data = (int)sVar6 + 2000; } sVar6 = sVar6 + 1; } while (sVar6 < 0x10); if (DAT_0044946a != 0) { mouse_region_new_up(10,300,0x14e,0x50,0x19,0x40c128); } return; } void __stdcall FUN_0040c128(void) { if (DAT_00449470 == 5) { null_ARRAY_0044f020[4] = null_ARRAY_0044f020[4] + 1; anim_engine_remove_cb(DAT_0044f016); *(undefined2 *)(DAT_0044f02c * 0x4e + 0x44f088 + DAT_0044f02e * 0x1a) = 99; FUN_00412d3e(); } DAT_004514f6 = 1; DAT_00449470 = 4; return; } uint __cdecl FUN_0040c185(int param_1) { short sVar1; int iVar2; uint uVar3; undefined4 uVar4; undefined2 extraout_var; uint uVar5; undefined2 extraout_var_00; undefined2 extraout_var_01; iVar2 = (int)DAT_00449470; if (iVar2 == 0) { uVar5 = *(uint *)(param_1 + 0x1e); if (uVar5 < 5) { uVar5 = FUN_0041183c(*(short *)(param_1 + 0x1e)); return uVar5; } if (uVar5 == 0x3e9) { FUN_00411160(); sVar1 = FUN_00412788(); uVar3 = CONCAT22(extraout_var_01,sVar1); if ((sVar1 != 0) && (DAT_0044946a == 0)) { solved_the_puzzle(0x4a77); inc_score_by_400(); FUN_0040beff(); DAT_00449470 = 0; uVar5 = FUN_00412d3e(); return uVar5; } } else { uVar3 = uVar5 - 0x7e0; if (uVar5 - 2000 < 0x10) { if ((*(short *)(*(int *)(param_1 + 0x1e) * 0x14 + 0x445916) != 2) || (uVar4 = FUN_004115e3(*(short *)(param_1 + 0x1e) + -2000,DAT_0044f018,DAT_0044f01a), (short)uVar4 == 0)) { uVar5 = FUN_004116cf(*(short *)(param_1 + 0x1e) + -2000); return uVar5; } sVar1 = FUN_00412788(); if ((sVar1 != 0) && (DAT_0044946a == 0)) { DAT_0044946a = 1; solved_the_puzzle(0x4a77); inc_score_by_400(); FUN_0040beff(); uVar5 = FUN_00412d3e(); return uVar5; } if (*(short *)(*(int *)(param_1 + 0x1e) * 0x14 + 0x44591e) == 0) { uVar5 = play_wave_flag1(0x1f9b,5,0); return uVar5; } uVar5 = play_wave_flag1(0x1f9a,5,0); return uVar5; } } } else if (iVar2 == 2) { uVar5 = *(uint *)(param_1 + 0x1e); if ((uVar5 < 5) || (uVar5 == 1000)) { clear_cursor_override_regions(); DAT_00449470 = 0; sVar1 = null_ARRAY_0044f020[DAT_0044f030]; null_ARRAY_0044f020[DAT_0044f030] = null_ARRAY_0044f020[DAT_0044f030] + 1; if (sVar1 == 0) { anim_state_xxx_list_insert_8004((undefined4 *)PTR_ARRAY_0044f9ac[DAT_0044f030]); } FUN_0040beff(); FUN_004104cc(); DAT_0044f030 = 99; uVar5 = FUN_00412d3e(); return uVar5; } if ((uVar5 == 0x3e9) || (uVar3 = uVar5 - 0x7e0, uVar5 - 2000 < 0x10)) { if (DAT_0044f030 == 4) { uVar5 = FUN_004128fa(); return uVar5; } if (DAT_0044f030 != 99) { uVar5 = FUN_004118bd(); return uVar5; } FUN_00411160(); sVar1 = FUN_00412788(); uVar3 = CONCAT22(extraout_var_00,sVar1); if ((sVar1 != 0) && (DAT_0044946a == 0)) { solved_the_puzzle(0x4a77); inc_score_by_400(); FUN_0040beff(); DAT_00449470 = 0; uVar5 = FUN_00412d3e(); DAT_0044946a = 1; return uVar5; } } } else { uVar3 = iVar2 - 5; if (uVar3 == 0) { if ((*(int *)(param_1 + 0x1e) == 0x3e9) || (*(int *)(param_1 + 0x1e) - 2000U < 0x10)) { anim_engine_remove_cb(DAT_0044f016); uVar4 = FUN_00411f53(); if ((short)uVar4 == 0) { clear_cursor_override_regions(); *(undefined2 *)(DAT_0044f02c * 0x4e + 0x44f088 + DAT_0044f02e * 0x1a) = 99; null_ARRAY_0044f020[4] = null_ARRAY_0044f020[4] + 1; DAT_00449470 = 0; FUN_00412104(1); FUN_004104cc(); FUN_0040beff(); FUN_00412104(1); FUN_00412d3e(); DAT_0044f030 = 99; } else if ((DAT_0044f032 == DAT_0044f02c) && (DAT_0044f034 == DAT_0044f02e)) { *(undefined2 *)(DAT_0044f02c * 0x4e + 0x44f088 + DAT_0044f02e * 0x1a) = 99; FUN_00412104(1); FUN_0040beff(); FUN_004104cc(); } else if (*(short *)(DAT_0044f02c * 0x4e + 0x44f088 + DAT_0044f02e * 0x1a) == 99) { clear_cursor_override_regions(); FUN_00412104(1); *(short *)(DAT_0044f02c * 0x4e + 0x44f088 + DAT_0044f02e * 0x1a) = DAT_0044f032; *(short *)(DAT_0044f02c * 0x4e + 0x44f08a + DAT_0044f02e * 0x1a) = DAT_0044f034; *(undefined2 *)(DAT_0044f02c * 0x4e + 0x44f08c + DAT_0044f02e * 0x1a) = 0; *(short *)(DAT_0044f032 * 0x4e + 0x44f088 + DAT_0044f034 * 0x1a) = DAT_0044f02c; *(short *)(DAT_0044f032 * 0x4e + 0x44f08a + DAT_0044f034 * 0x1a) = DAT_0044f02e; *(undefined2 *)(DAT_0044f032 * 0x4e + 0x44f08c + DAT_0044f034 * 0x1a) = 1; DAT_00449470 = 0; FUN_0040beff(); DAT_0044f030 = 99; play_wave_flag1(0x4a74,5,0); FUN_004104cc(); FUN_00412104(1); FUN_00412d3e(); } else { FUN_00412104(1); } } sVar1 = FUN_00412788(); uVar3 = CONCAT22(extraout_var,sVar1); if ((sVar1 != 0) && (DAT_0044946a == 0)) { DAT_00449470 = 0; DAT_0044946a = 1; solved_the_puzzle(0x4a77); FUN_00412d3e(); inc_score_by_400(); uVar5 = FUN_0040beff(); return uVar5; } } } return uVar3; } void __cdecl FUN_0040c65c(short param_1,short param_2,short param_3,short param_4) { if (param_1 < param_3) { is_256_color(); FUN_0040c836(param_1,param_2 + -1,param_3); is_256_color(); FUN_0040c836(param_1,param_2,param_3); is_256_color(); FUN_0040c836(param_1,param_2 + 1,param_3); } else if (param_3 < param_1) { is_256_color(); FUN_0040c836(param_3,param_2 + -1,param_1); is_256_color(); FUN_0040c836(param_3,param_2,param_1); is_256_color(); FUN_0040c836(param_3,param_2 + 1,param_1); } if (param_2 < param_4) { is_256_color(); FUN_0040c8b5(param_3 + -1,param_2,param_4); is_256_color(); FUN_0040c8b5(param_3,param_2,param_4 + 1); is_256_color(); FUN_0040c8b5(param_3 + 1,param_2,param_4 + 1); } else if (param_4 < param_2) { is_256_color(); FUN_0040c8b5(param_3 + -1,param_4,param_2); is_256_color(); FUN_0040c8b5(param_3,param_4,param_2 + 1); is_256_color(); FUN_0040c8b5(param_3 + 1,param_4,param_2 + 1); } return; } void __cdecl FUN_0040c836(short param_1,undefined2 param_2,short param_3) { short sVar1; short sVar2; short sVar3; sVar1 = param_3; if (param_3 < param_1) { sVar1 = param_1; param_1 = param_3; } sVar2 = param_1 + -1; sVar3 = 0; if (0 < (short)(sVar1 - param_1)) { do { sVar2 = sVar2 + 1; gfxish_set_px_wrapped(sVar2,param_2); sVar3 = sVar3 + 1; } while (sVar3 < (short)(sVar1 - param_1)); } gfxish_invalidate_rect_wrap(param_1,param_2,(sVar1 - param_1) + 1,1); return; } void __cdecl FUN_0040c8b5(short param_1,short param_2,short param_3) { short sVar1; short sVar2; short sVar3; undefined2 local_a; undefined2 local_8; if (param_3 < param_2) { local_8 = param_3; local_a = param_2; } else { local_8 = param_2; local_a = param_3; } if (param_2 < param_3) { sVar3 = param_3 - param_2; } else { sVar3 = param_2 - param_3; } sVar1 = param_2 + -1; sVar2 = 0; if (0 < sVar3) { do { sVar1 = sVar1 + 1; gfxish_set_px_wrapped(param_1,sVar1); sVar2 = sVar2 + 1; } while (sVar2 < sVar3); } gfxish_invalidate_rect_wrap(param_1,local_8,1,(local_a - local_8) + 1); return; } void __cdecl FUN_0040c93b(short param_1,short param_2) { if (DAT_0044946c < param_1) { gfxish_copy_otherbuf_to_dest_and_invalidate (DAT_0044946c,DAT_0044946e + -1,(param_1 - DAT_0044946c) + 1,3); gfxish_invalidate_rect_wrap(DAT_0044946c,DAT_0044946e + -1,(param_1 - DAT_0044946c) + 1,3); } else if (param_1 < DAT_0044946c) { gfxish_copy_otherbuf_to_dest_and_invalidate (param_1,DAT_0044946e + -1,(DAT_0044946c - param_1) + 1,3); gfxish_invalidate_rect_wrap(param_1,DAT_0044946e + -1,(DAT_0044946c - param_1) + 1,3); } if (DAT_0044946e < param_2) { gfxish_copy_otherbuf_to_dest_and_invalidate (param_1 + -1,DAT_0044946e,3,(param_2 - DAT_0044946e) + 1); gfxish_invalidate_rect_wrap(param_1 + -1,DAT_0044946e,3,(param_2 - DAT_0044946e) + 1); } else if (param_2 < DAT_0044946e) { gfxish_copy_otherbuf_to_dest_and_invalidate(param_1 + -1,param_2,3,(DAT_0044946e - param_2) + 1) ; gfxish_invalidate_rect_wrap(param_1 + -1,param_2,3,(DAT_0044946e - param_2) + 1); } return; } void __cdecl FUN_0040ca43(short param_1,short param_2) { if (DAT_0044946c < param_1) { is_256_color(); FUN_0040c836(DAT_0044946c,DAT_0044946e + -1,param_1); is_256_color(); FUN_0040c836(DAT_0044946c,DAT_0044946e,param_1); is_256_color(); FUN_0040c836(DAT_0044946c,DAT_0044946e + 1,param_1); } else if (param_1 < DAT_0044946c) { is_256_color(); FUN_0040c836(param_1,DAT_0044946e + -1,DAT_0044946c); is_256_color(); FUN_0040c836(param_1,DAT_0044946e,DAT_0044946c); is_256_color(); FUN_0040c836(param_1,DAT_0044946e + 1,DAT_0044946c); } if (DAT_0044946e < param_2) { is_256_color(); FUN_0040c8b5(param_1 + -1,DAT_0044946e,param_2); is_256_color(); FUN_0040c8b5(param_1,DAT_0044946e + 1,param_2); is_256_color(); FUN_0040c8b5(param_1 + 1,DAT_0044946e + 1,param_2); } else if (param_2 < DAT_0044946e) { is_256_color(); FUN_0040c8b5(param_1 + -1,param_2,DAT_0044946e); is_256_color(); FUN_0040c8b5(param_1,param_2,DAT_0044946e + 1); is_256_color(); FUN_0040c8b5(param_1 + 1,param_2,DAT_0044946e + 1); } return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __stdcall electricity_load_puzzle(short param_1) { aseq_anim_state_struct *paVar1; short sVar2; DAT_0044946a = 0; DAT_00449470 = 0; memset((undefined4 *)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076,0xff,0x4e0); memset((undefined4 *)struct_unk_1_ARRAY_0044f556,0xff,0x140); if (0x28 < param_1) { param_1 = 1; } sVar2 = 0; do { null_ARRAY_0044f020[sVar2] = 0; paVar1 = (aseq_anim_state_struct *)load_aseq(sVar2 + 10003); PTR_ARRAY_0044f9ac[sVar2] = paVar1; sVar2 = sVar2 + 1; } while (sVar2 < 5); sVar2 = 0; do { struct_unk_1_ARRAY_0044f556[sVar2].field3_0x6 = 0; struct_unk_1_ARRAY_0044f556[sVar2].anim_state = (aseq_anim_state_struct *)0x0; struct_unk_1_ARRAY_0044f556[sVar2].field4_0x8 = 0; struct_unk_1_ARRAY_0044f556[sVar2].field5_0xa = 0; sVar2 = sVar2 + 1; } while (sVar2 < 0x10); sVar2 = 0; do { struct_unk_0_ARRAY_0044f87a[sVar2].field0_0x0 = 1; paVar1 = (aseq_anim_state_struct *)load_aseq(10011); struct_unk_0_ARRAY_0044f87a[sVar2].anim_state = paVar1; sVar2 = sVar2 + 1; } while (sVar2 < 0x32); switch(param_1) { case 1: DAT_004514c2 = 10000; DAT_004514c4 = 10000; DAT_004514bc = 1; DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2726; SHORT_ARRAY_004514ce[1] = 0x2727; SHORT_ARRAY_004514ce[2] = 0x2728; SHORT_ARRAY_004514ce[3] = 0x2729; SHORT_ARRAY_004514ce[4] = 0x272a; SHORT_ARRAY_004514ce[5] = 0x272b; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x2724; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x37; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xfe; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x92; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; null_ARRAY_0044f020[4] = 1; break; case 2: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x275b; SHORT_ARRAY_004514ce[1] = 0x275c; SHORT_ARRAY_004514ce[2] = 0x275d; SHORT_ARRAY_004514ce[3] = 0x275e; SHORT_ARRAY_004514ce[4] = 0x275f; SHORT_ARRAY_004514ce[5] = 0x2760; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x2736; DAT_004514c2 = 0x2720; DAT_004514c4 = 0x271f; DAT_004514bc = 1; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x37; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 0; FUN_00412296(1,0); struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xfe; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x92; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 1; null_ARRAY_0044f020[4] = 1; break; case 3: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x275b; SHORT_ARRAY_004514ce[1] = 0x275c; SHORT_ARRAY_004514ce[2] = 0x275d; SHORT_ARRAY_004514ce[3] = 0x275e; SHORT_ARRAY_004514ce[4] = 0x275f; SHORT_ARRAY_004514ce[5] = 0x2760; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x2736; DAT_004514c2 = 0x2720; DAT_004514bc = 1; DAT_004514c4 = 0x271f; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xca; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x32; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 0; FUN_00412296(1,0); struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0x18e; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x98; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 1; null_ARRAY_0044f020[4] = 1; break; case 4: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2726; SHORT_ARRAY_004514ce[1] = 0x2727; SHORT_ARRAY_004514ce[2] = 0x2728; SHORT_ARRAY_004514ce[3] = 0x2729; SHORT_ARRAY_004514ce[4] = 0x272a; SHORT_ARRAY_004514ce[5] = 0x272b; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x2724; DAT_004514c2 = 10000; DAT_004514bc = 1; DAT_004514c4 = 10000; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x37; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xfe; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x92; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); null_ARRAY_0044f020[4] = 2; break; case 5: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2761; SHORT_ARRAY_004514ce[1] = 0x2762; SHORT_ARRAY_004514ce[2] = 0x2729; SHORT_ARRAY_004514ce[3] = 0x272a; SHORT_ARRAY_004514ce[4] = 0x272b; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x273c; DAT_004514c2 = 10000; DAT_004514bc = 1; DAT_004514c4 = 10000; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x37; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); null_ARRAY_0044f020[4] = 2; null_ARRAY_0044f020[0] = 1; break; case 6: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2768; SHORT_ARRAY_004514ce[1] = 0x2769; SHORT_ARRAY_004514ce[2] = 0x2729; SHORT_ARRAY_004514ce[3] = 0x272a; SHORT_ARRAY_004514ce[4] = 0x272b; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x2725; DAT_004514c2 = 10000; DAT_004514bc = 1; DAT_004514c4 = 10000; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xfe; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x92; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); null_ARRAY_0044f020[1] = 1; null_ARRAY_0044f020[4] = 2; break; case 7: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2770; SHORT_ARRAY_004514ce[1] = 0x2771; SHORT_ARRAY_004514ce[2] = 0x2772; SHORT_ARRAY_004514ce[3] = 0x2773; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x2726; DAT_004514c2 = 0x2711; DAT_004514bc = 1; DAT_004514c4 = 0x2725; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x37; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xfe; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x92; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x1b0; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0x8e; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field11_0x16 = 0; null_ARRAY_0044f020[4] = 1; break; case 8: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2770; SHORT_ARRAY_004514ce[1] = 0x2771; SHORT_ARRAY_004514ce[2] = 0x2772; SHORT_ARRAY_004514ce[3] = 0x2773; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x2726; DAT_004514c2 = 0x2711; DAT_004514bc = 1; DAT_004514c4 = 0x2725; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xdc; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x3c; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0x184; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x92; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x123; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0x8e; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field11_0x16 = 1; null_ARRAY_0044f020[4] = 2; break; case 9: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2770; SHORT_ARRAY_004514ce[1] = 0x2771; SHORT_ARRAY_004514ce[2] = 0x2772; SHORT_ARRAY_004514ce[3] = 0x2773; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x2726; DAT_004514c2 = 0x2711; DAT_004514bc = 1; DAT_004514c4 = 0x2725; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x184; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x37; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xd6; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x92; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x139; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0x8e; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); null_ARRAY_0044f020[4] = 3; break; case 10: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2770; SHORT_ARRAY_004514ce[1] = 0x2771; SHORT_ARRAY_004514ce[2] = 0x2772; SHORT_ARRAY_004514ce[3] = 0x2773; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x2726; DAT_004514c2 = 0x2711; DAT_004514bc = 1; DAT_004514c4 = 0x2725; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x37; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xfe; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x92; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; null_ARRAY_0044f020[4] = 2; null_ARRAY_0044f020[2] = 1; break; case 0xb: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2770; SHORT_ARRAY_004514ce[1] = 0x2771; SHORT_ARRAY_004514ce[2] = 0x2772; SHORT_ARRAY_004514ce[3] = 0x2773; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x2726; DAT_004514c2 = 0x2711; DAT_004514bc = 1; DAT_004514c4 = 0x2725; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x37; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); null_ARRAY_0044f020[4] = 3; null_ARRAY_0044f020[2] = 1; null_ARRAY_0044f020[0] = 1; break; case 0xc: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2770; SHORT_ARRAY_004514ce[1] = 0x2771; SHORT_ARRAY_004514ce[2] = 0x2772; SHORT_ARRAY_004514ce[3] = 0x2773; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x2726; DAT_004514c2 = 0x2711; DAT_004514bc = 1; DAT_004514c4 = 0x2725; null_ARRAY_0044f020[4] = 3; null_ARRAY_0044f020[2] = 1; null_ARRAY_0044f020[0] = 1; null_ARRAY_0044f020[1] = 1; break; case 0xd: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x272c; SHORT_ARRAY_004514ce[1] = 0x272d; SHORT_ARRAY_004514ce[2] = 0x272e; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x2727; DAT_004514c2 = 0x2712; DAT_004514bc = 1; DAT_004514c4 = 0x2711; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xd2; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x28; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0x138; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x88; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x1ab; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0x90; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field11_0x16 = 1; null_ARRAY_0044f020[4] = 1; break; case 0xe: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2766; SHORT_ARRAY_004514ce[1] = 0x2767; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x2737; DAT_004514c2 = 0x2722; DAT_004514bc = 1; DAT_004514c4 = 0x2722; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xdc; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x38; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 3; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xd0; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x85; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 3; null_ARRAY_0044f020[4] = 2; null_ARRAY_0044f020[2] = 1; break; case 0xf: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2766; SHORT_ARRAY_004514ce[1] = 0x2767; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x273d; DAT_004514c2 = 0x2734; DAT_004514bc = 1; DAT_004514c4 = 0x2774; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x182; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x28; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(0,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 3; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0x182; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x91; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(1,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 3; null_ARRAY_0044f020[4] = 3; null_ARRAY_0044f020[0] = 1; null_ARRAY_0044f020[1] = 1; break; case 0x10: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x272c; SHORT_ARRAY_004514ce[1] = 0x2757; SHORT_ARRAY_004514ce[2] = 0x2758; SHORT_ARRAY_004514ce[3] = 0x2759; SHORT_ARRAY_004514ce[4] = 0x275a; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x2735; DAT_004514c2 = 0x2722; DAT_004514bc = 1; DAT_004514c4 = 0x2722; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xb4; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x3b; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 3; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xb4; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0xa4; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 3; null_ARRAY_0044f020[4] = 3; null_ARRAY_0044f020[2] = 1; null_ARRAY_0044f020[1] = 1; break; case 0x11: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x272c; SHORT_ARRAY_004514ce[1] = 0x2757; SHORT_ARRAY_004514ce[2] = 0x2758; SHORT_ARRAY_004514ce[3] = 0x2759; SHORT_ARRAY_004514ce[4] = 0x275a; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x2735; DAT_004514c2 = 0x271f; DAT_004514bc = 1; DAT_004514c4 = 0x271e; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xe6; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x45; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xb4; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0xac; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x139; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0x8e; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); null_ARRAY_0044f020[4] = 3; null_ARRAY_0044f020[1] = 1; break; case 0x12: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2730; SHORT_ARRAY_004514ce[1] = 0x2731; SHORT_ARRAY_004514ce[2] = 0x2732; SHORT_ARRAY_004514ce[3] = 0x2733; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x2728; DAT_004514c2 = 0x2713; DAT_004514bc = 1; DAT_004514c4 = 0x2712; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xb4; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x3b; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xb4; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0xac; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x19d; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0x48; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_unk_1_ARRAY_0044f556[3].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[3].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[3].field1_0x2 = 0x139; struct_unk_1_ARRAY_0044f556[3].field2_0x4 = 0x79; struct_unk_1_ARRAY_0044f556[3].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[3].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(3,1); null_ARRAY_0044f020[4] = 3; break; case 0x13: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x272c; SHORT_ARRAY_004514ce[1] = 0x2757; SHORT_ARRAY_004514ce[2] = 0x2758; SHORT_ARRAY_004514ce[3] = 0x2759; SHORT_ARRAY_004514ce[4] = 0x275a; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x2735; DAT_004514c2 = 0x271f; DAT_004514bc = 1; DAT_004514c4 = 0x271e; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x15e; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x31; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0x17c; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0xa2; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0xaf; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0x48; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[3].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[3].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[3].field1_0x2 = 0x139; struct_unk_1_ARRAY_0044f556[3].field2_0x4 = 0x79; struct_unk_1_ARRAY_0044f556[3].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[3].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(3,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field11_0x16 = 0; null_ARRAY_0044f020[4] = 2; break; case 0x14: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x272f; SHORT_ARRAY_004514ce[1] = 0x2730; SHORT_ARRAY_004514ce[2] = 0x2731; SHORT_ARRAY_004514ce[3] = 0x2732; SHORT_ARRAY_004514ce[4] = 0x2733; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x2739; DAT_004514c2 = 0x2714; DAT_004514bc = 1; DAT_004514c4 = 0x2713; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x18e; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x4c; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xc2; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0xaa; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x126; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0x6a; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field11_0x16 = 1; null_ARRAY_0044f020[4] = 1; null_ARRAY_0044f020[0] = 1; break; case 0x15: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2734; SHORT_ARRAY_004514ce[1] = 0x2735; SHORT_ARRAY_004514ce[2] = 0x2736; SHORT_ARRAY_004514ce[3] = 0x2737; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x2729; DAT_004514c2 = 0x2714; DAT_004514bc = 1; DAT_004514c4 = 0x2713; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xb8; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x71; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xf3; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x32; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x19d; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0xa0; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[3].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[3].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[3].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[3].field2_0x4 = 0x4d; struct_unk_1_ARRAY_0044f556[3].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[3].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(3,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field11_0x16 = 1; break; case 0x16: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2738; SHORT_ARRAY_004514ce[1] = 0x2739; SHORT_ARRAY_004514ce[2] = 0x273a; SHORT_ARRAY_004514ce[3] = 0x273b; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x272a; DAT_004514c2 = 0x2715; DAT_004514bc = 1; DAT_004514c4 = 0x2714; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x4c; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xb8; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0xa0; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x1a8; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0xaa; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field11_0x16 = 1; null_ARRAY_0044f020[4] = 1; null_ARRAY_0044f020[1] = 1; break; case 0x17: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2738; SHORT_ARRAY_004514ce[1] = 0x2739; SHORT_ARRAY_004514ce[2] = 0x273a; SHORT_ARRAY_004514ce[3] = 0x273b; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x272a; DAT_004514c2 = 0x2716; DAT_004514bc = 1; DAT_004514c4 = 0x2715; null_ARRAY_0044f020[4] = 4; null_ARRAY_0044f020[1] = 2; null_ARRAY_0044f020[0] = 1; null_ARRAY_0044f020[2] = 1; break; case 0x18: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x273c; SHORT_ARRAY_004514ce[1] = 0x273d; SHORT_ARRAY_004514ce[2] = 0x273e; SHORT_ARRAY_004514ce[3] = 0x273f; SHORT_ARRAY_004514ce[4] = 0x2740; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x272b; DAT_004514c2 = 0x2717; DAT_004514bc = 1; DAT_004514c4 = 0x2716; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x4c; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(0,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xb8; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0xa0; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x1a8; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0xaa; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field11_0x16 = 1; null_ARRAY_0044f020[4] = 2; null_ARRAY_0044f020[1] = 1; null_ARRAY_0044f020[0] = 1; break; case 0x19: DAT_004514c2 = 0x2722; DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2766; SHORT_ARRAY_004514ce[1] = 0x2767; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x2737; DAT_004514bc = 1; DAT_004514c4 = 0x2722; null_ARRAY_0044f020[4] = 2; null_ARRAY_0044f020[1] = 1; null_ARRAY_0044f020[0] = 1; null_ARRAY_0044f020[2] = 1; break; case 0x1a: DAT_004514c2 = 0x2734; DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2766; SHORT_ARRAY_004514ce[1] = 0x2767; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x273d; DAT_004514bc = 1; DAT_004514c4 = 0x2774; null_ARRAY_0044f020[4] = 3; null_ARRAY_0044f020[1] = 1; null_ARRAY_0044f020[0] = 1; null_ARRAY_0044f020[2] = 2; break; case 0x1b: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2766; SHORT_ARRAY_004514ce[1] = 0x2767; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x2737; DAT_004514c2 = 0x2719; DAT_004514bc = 1; DAT_004514c4 = 0x2718; null_ARRAY_0044f020[4] = 3; null_ARRAY_0044f020[1] = 1; null_ARRAY_0044f020[0] = 2; null_ARRAY_0044f020[2] = 1; break; case 0x1c: DAT_004514c2 = 0x2734; DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2766; SHORT_ARRAY_004514ce[1] = 0x2767; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x273d; DAT_004514bc = 1; DAT_004514c4 = 0x2774; null_ARRAY_0044f020[4] = 2; null_ARRAY_0044f020[1] = 1; null_ARRAY_0044f020[0] = 1; null_ARRAY_0044f020[2] = 2; break; case 0x1d: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2766; SHORT_ARRAY_004514ce[1] = 0x2767; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x2737; DAT_004514c2 = 0x2719; DAT_004514bc = 1; DAT_004514c4 = 0x2718; null_ARRAY_0044f020[4] = 2; null_ARRAY_0044f020[1] = 1; null_ARRAY_0044f020[0] = 2; null_ARRAY_0044f020[2] = 1; break; case 0x1e: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2757; SHORT_ARRAY_004514ce[1] = 0x2758; SHORT_ARRAY_004514ce[2] = 0x2776; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x2738; DAT_004514c2 = 0x273a; DAT_004514bc = 1; DAT_004514c4 = 0x2775; null_ARRAY_0044f020[4] = 3; null_ARRAY_0044f020[1] = 1; null_ARRAY_0044f020[0] = 2; null_ARRAY_0044f020[2] = 2; break; case 0x1f: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x273c; SHORT_ARRAY_004514ce[1] = 0x273d; SHORT_ARRAY_004514ce[2] = 0x273e; SHORT_ARRAY_004514ce[3] = 0x273f; SHORT_ARRAY_004514ce[4] = 0x2740; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x272b; DAT_004514c2 = 0x2717; DAT_004514bc = 1; DAT_004514c4 = 0x2716; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xa0; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0xa0; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xf3; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x9b; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(1,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 4; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x19d; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0xa0; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field9_0x12 = 4; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[3].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[3].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[3].field1_0x2 = 0xbe; struct_unk_1_ARRAY_0044f556[3].field2_0x4 = 0x3c; struct_unk_1_ARRAY_0044f556[3].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[3].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(3,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[4].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[4].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[4].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[4].field2_0x4 = 0x3c; struct_unk_1_ARRAY_0044f556[4].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[4].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(4,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field11_0x16 = 1; break; case 0x20: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2741; SHORT_ARRAY_004514ce[1] = 0x2742; SHORT_ARRAY_004514ce[2] = 0x2743; SHORT_ARRAY_004514ce[3] = 0x2744; SHORT_ARRAY_004514ce[4] = 0x2745; SHORT_ARRAY_004514ce[5] = 0x2746; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x272c; DAT_004514c2 = 0x2718; DAT_004514bc = 1; DAT_004514c4 = 0x2717; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xa0; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0xa5; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 3; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xcd; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x77; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2716); FUN_00412296(1,3); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 4; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x19d; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0xa0; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_unk_1_ARRAY_0044f556[3].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[3].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[3].field1_0x2 = 0xe1; struct_unk_1_ARRAY_0044f556[3].field2_0x4 = 0x25; struct_unk_1_ARRAY_0044f556[3].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[3].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(3,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field9_0x12 = 5; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[4].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[4].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[4].field1_0x2 = 0x14c; struct_unk_1_ARRAY_0044f556[4].field2_0x4 = 0x25; struct_unk_1_ARRAY_0044f556[4].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[4].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(4,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field9_0x12 = 5; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[5].field0_0x0 = 3; struct_unk_1_ARRAY_0044f556[5].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[5].field1_0x2 = 0x13b; struct_unk_1_ARRAY_0044f556[5].field2_0x4 = 0x7d; struct_unk_1_ARRAY_0044f556[5].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[5].anim_state = (aseq_anim_state_struct *)load_aseq(0x2716); FUN_00412296(5,3); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][0].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][1].field9_0x12 = 4; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][1].field11_0x16 = 1; null_ARRAY_0044f020[4] = 3; break; case 0x21: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2747; SHORT_ARRAY_004514ce[1] = 0x2748; SHORT_ARRAY_004514ce[2] = 0x2749; SHORT_ARRAY_004514ce[3] = 0x274a; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x272d; DAT_004514c2 = 0x2719; DAT_004514bc = 1; DAT_004514c4 = 0x2718; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xa0; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x6e; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 5; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 3; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xdc; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x2b; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2716); FUN_00412296(1,3); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x19d; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0xa0; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_unk_1_ARRAY_0044f556[3].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[3].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[3].field1_0x2 = 0x104; struct_unk_1_ARRAY_0044f556[3].field2_0x4 = 0x78; struct_unk_1_ARRAY_0044f556[3].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[3].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(3,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field9_0x12 = 5; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[4].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[4].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[4].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[4].field2_0x4 = 0x25; struct_unk_1_ARRAY_0044f556[4].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[4].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(4,1); struct_unk_1_ARRAY_0044f556[5].field0_0x0 = 3; struct_unk_1_ARRAY_0044f556[5].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[5].field1_0x2 = 0xdc; struct_unk_1_ARRAY_0044f556[5].field2_0x4 = 0xd7; struct_unk_1_ARRAY_0044f556[5].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[5].anim_state = (aseq_anim_state_struct *)load_aseq(0x2716); FUN_00412296(5,3); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][1].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][1].field11_0x16 = 0; null_ARRAY_0044f020[4] = 3; break; case 0x22: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2757; SHORT_ARRAY_004514ce[1] = 0x2758; SHORT_ARRAY_004514ce[2] = 0x2776; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x2738; DAT_004514c2 = 0x271a; DAT_004514bc = 1; DAT_004514c4 = 0x2719; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xa0; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0x6e; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 5; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 3; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xdc; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x2d; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2716); FUN_00412296(1,3); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][2].field9_0x12 = 6; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][2].field10_0x14 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][2].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x19d; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0xa0; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field9_0x12 = 5; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field10_0x14 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[3].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[3].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[3].field1_0x2 = 0x104; struct_unk_1_ARRAY_0044f556[3].field2_0x4 = 0x78; struct_unk_1_ARRAY_0044f556[3].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[3].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(3,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[4].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[4].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[4].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[4].field2_0x4 = 0x25; struct_unk_1_ARRAY_0044f556[4].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[4].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(4,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field9_0x12 = 6; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[5].field0_0x0 = 3; struct_unk_1_ARRAY_0044f556[5].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[5].field1_0x2 = 0xdc; struct_unk_1_ARRAY_0044f556[5].field2_0x4 = 0xd7; struct_unk_1_ARRAY_0044f556[5].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[5].anim_state = (aseq_anim_state_struct *)load_aseq(0x2716); FUN_00412296(5,3); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][2].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][2].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][2].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[6].field0_0x0 = 3; struct_unk_1_ARRAY_0044f556[6].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[6].field1_0x2 = 0x140; struct_unk_1_ARRAY_0044f556[6].field2_0x4 = 0x78; struct_unk_1_ARRAY_0044f556[6].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[6].anim_state = (aseq_anim_state_struct *)load_aseq(0x2716); FUN_00412296(6,3); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[6][0].field9_0x12 = 4; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[6][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[6][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[6][2].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[6][2].field10_0x14 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[6][2].field11_0x16 = 1; null_ARRAY_0044f020[1] = 1; null_ARRAY_0044f020[3] = 1; null_ARRAY_0044f020[4] = 6; break; case 0x23: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x274f; SHORT_ARRAY_004514ce[1] = 0x2750; SHORT_ARRAY_004514ce[2] = 0x2745; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x272f; DAT_004514c2 = 0x271b; DAT_004514bc = 1; DAT_004514c4 = 0x271a; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x10e; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0xa5; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 3; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 300; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0x5f; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2716); FUN_00412296(1,3); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 4; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][2].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][2].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][2].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x19d; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0xa0; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field9_0x12 = 4; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[3].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[3].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[3].field1_0x2 = 0xbe; struct_unk_1_ARRAY_0044f556[3].field2_0x4 = 0x25; struct_unk_1_ARRAY_0044f556[3].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[3].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(3,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[4].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[4].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[4].field1_0x2 = 0x15b; struct_unk_1_ARRAY_0044f556[4].field2_0x4 = 0x25; struct_unk_1_ARRAY_0044f556[4].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[4].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(4,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field11_0x16 = 1; null_ARRAY_0044f020[3] = 1; null_ARRAY_0044f020[4] = 2; break; case 0x24: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2752; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x2730; DAT_004514c2 = 0x271c; DAT_004514bc = 1; DAT_004514c4 = 0x271b; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0xaa; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 100; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 3; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xe6; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0xd2; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2716); FUN_00412296(1,3); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 4; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][2].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][2].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][2].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x140; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0xa0; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field10_0x14 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field10_0x14 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[3].field0_0x0 = 3; struct_unk_1_ARRAY_0044f556[3].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[3].field1_0x2 = 300; struct_unk_1_ARRAY_0044f556[3].field2_0x4 = 0x5f; struct_unk_1_ARRAY_0044f556[3].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[3].anim_state = (aseq_anim_state_struct *)load_aseq(0x2716); FUN_00412296(3,3); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field9_0x12 = 4; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][2].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][2].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][2].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[4].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[4].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[4].field1_0x2 = 0x197; struct_unk_1_ARRAY_0044f556[4].field2_0x4 = 0x25; struct_unk_1_ARRAY_0044f556[4].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[4].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(4,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field11_0x16 = 0; break; case 0x25: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2753; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x2731; DAT_004514c2 = 0x271d; DAT_004514bc = 1; DAT_004514c4 = 0x271c; struct_unk_1_ARRAY_0044f556[0].field0_0x0 = 0; struct_unk_1_ARRAY_0044f556[0].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[0].field1_0x2 = 0x96; struct_unk_1_ARRAY_0044f556[0].field2_0x4 = 0xa0; struct_unk_1_ARRAY_0044f556[0].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[0].anim_state = (aseq_anim_state_struct *)load_aseq(0x2713); FUN_00412296(0,0); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[0][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[1].field0_0x0 = 3; struct_unk_1_ARRAY_0044f556[1].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[1].field1_0x2 = 0xdc; struct_unk_1_ARRAY_0044f556[1].field2_0x4 = 0xaa; struct_unk_1_ARRAY_0044f556[1].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[1].anim_state = (aseq_anim_state_struct *)load_aseq(0x2716); FUN_00412296(1,3); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field9_0x12 = 4; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][1].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][2].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][2].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[1][2].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[2].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[2].field1_0x2 = 0x104; struct_unk_1_ARRAY_0044f556[2].field2_0x4 = 0xa0; struct_unk_1_ARRAY_0044f556[2].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[2].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(2,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field9_0x12 = 5; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field10_0x14 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field10_0x14 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[2][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[3].field0_0x0 = 2; struct_unk_1_ARRAY_0044f556[3].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[3].field1_0x2 = 400; struct_unk_1_ARRAY_0044f556[3].field2_0x4 = 0xaa; struct_unk_1_ARRAY_0044f556[3].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[3].anim_state = (aseq_anim_state_struct *)load_aseq(0x2715); FUN_00412296(3,2); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field9_0x12 = 6; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field9_0x12 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[3][1].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[4].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[4].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[4].field1_0x2 = 0xf0; struct_unk_1_ARRAY_0044f556[4].field2_0x4 = 0x25; struct_unk_1_ARRAY_0044f556[4].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[4].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(4,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field9_0x12 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][0].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field9_0x12 = 5; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[4][1].field11_0x16 = 1; struct_unk_1_ARRAY_0044f556[5].field0_0x0 = 3; struct_unk_1_ARRAY_0044f556[5].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[5].field1_0x2 = 0x140; struct_unk_1_ARRAY_0044f556[5].field2_0x4 = 100; struct_unk_1_ARRAY_0044f556[5].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[5].anim_state = (aseq_anim_state_struct *)load_aseq(0x2716); FUN_00412296(5,3); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][0].field9_0x12 = 4; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][1].field9_0x12 = 6; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][1].field11_0x16 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][2].field9_0x12 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][2].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[5][2].field11_0x16 = 0; struct_unk_1_ARRAY_0044f556[6].field0_0x0 = 1; struct_unk_1_ARRAY_0044f556[6].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[6].field1_0x2 = 0x186; struct_unk_1_ARRAY_0044f556[6].field2_0x4 = 0x25; struct_unk_1_ARRAY_0044f556[6].field5_0xa = 1; struct_unk_1_ARRAY_0044f556[6].anim_state = (aseq_anim_state_struct *)load_aseq(0x2714); FUN_00412296(6,1); struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[6][0].field9_0x12 = 5; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[6][0].field10_0x14 = 1; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[6][0].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[6][1].field9_0x12 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[6][1].field10_0x14 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[6][1].field11_0x16 = 1; break; case 0x26: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2754; SHORT_ARRAY_004514ce[1] = 0x2755; SHORT_ARRAY_004514ce[2] = 0x2756; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x2732; DAT_004514c2 = 0x271e; DAT_004514bc = 1; DAT_004514c4 = 0x271d; null_ARRAY_0044f020[4] = 9; null_ARRAY_0044f020[1] = 2; null_ARRAY_0044f020[0] = 3; null_ARRAY_0044f020[2] = 1; null_ARRAY_0044f020[3] = 2; break; case 0x27: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2754; SHORT_ARRAY_004514ce[1] = 0x2755; SHORT_ARRAY_004514ce[2] = 0x276f; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x2733; DAT_004514c2 = 0x2721; DAT_004514bc = 2; _DAT_004514c6 = 0x2720; DAT_004514c4 = 0x2721; null_ARRAY_0044f020[4] = 0xe; null_ARRAY_0044f020[2] = 2; null_ARRAY_0044f020[1] = 2; null_ARRAY_0044f020[0] = 3; null_ARRAY_0044f020[3] = 4; break; case 0x28: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x2754; SHORT_ARRAY_004514ce[1] = 0x2755; SHORT_ARRAY_004514ce[2] = 0x276f; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x2733; DAT_004514c2 = 0x2723; DAT_004514bc = 2; _DAT_004514c6 = 0x2723; DAT_004514c4 = 0x2724; null_ARRAY_0044f020[4] = 0x14; null_ARRAY_0044f020[1] = 3; null_ARRAY_0044f020[0] = 3; null_ARRAY_0044f020[2] = 2; null_ARRAY_0044f020[3] = 8; } DAT_004514b4 = load_resource_item_0(DAT_004514c2,(int *)&text); return; } void __stdcall FUN_00410427(void) { ushort uVar1; short sVar2; short sVar3; byte local_10 [12]; load_nfnt(15000); sVar3 = 0; do { if (0 < (short)null_ARRAY_0044f020[sVar3]) { uVar1 = struct_unk_2_ARRAY_0044942c[sVar3].field2_0x4; sVar2 = struct_unk_2_ARRAY_0044942c[sVar3].field3_0x6; sprintf(local_10); FUN_0043dc0b(15000,local_10,uVar1,sVar2,0); } sVar3 = sVar3 + 1; } while (sVar3 < 5); gfxish_invalidate_rect_wrap(10,0x80,0x7c,0xb5); free_nfnt(15000); return; } void __stdcall FUN_004104cc(void) { short sVar1; short sVar2; short sVar3; gfxish_copy_otherbuf_to_dest_and_invalidate(10,0x80,0x7c,0xb5); sVar3 = 0; do { if (0 < (short)null_ARRAY_0044f020[sVar3]) { sVar1 = struct_unk_2_ARRAY_0044942c[sVar3].field0_0x0; sVar2 = struct_unk_2_ARRAY_0044942c[sVar3].field1_0x2; anim_state_xxx_list_remove((int *)PTR_ARRAY_0044f9ac[sVar3]); anim_state_xxx_list_insert_8004((undefined4 *)PTR_ARRAY_0044f9ac[sVar3]); aseq_set_pos_order((int)PTR_ARRAY_0044f9ac[sVar3],sVar1,sVar2,5); } sVar3 = sVar3 + 1; } while (sVar3 < 5); FUN_00410427(); return; } void __stdcall FUN_0041055b(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if ((sVar1 == 0xd) && (DAT_0044946a != 0)) { FUN_0040c128(); } return; } void __stdcall FUN_0041057c(void) { short sVar1; sVar1 = 0; do { free_aseq((int *)struct_unk_0_ARRAY_0044f87a[sVar1].anim_state); sVar1 = sVar1 + 1; } while (sVar1 < 0x32); sVar1 = 0; do { if (struct_unk_1_ARRAY_0044f556[sVar1].field3_0x6 == 1) { free_aseq((int *)struct_unk_1_ARRAY_0044f556[sVar1].anim_state); } sVar1 = sVar1 + 1; } while (sVar1 < 0x10); sVar1 = 0; do { free_aseq((int *)PTR_ARRAY_0044f9ac[sVar1]); sVar1 = sVar1 + 1; } while (sVar1 < 5); free_aseq(battery_ui_hint_aseq); free_aseq(elec_ui_go_back_aseq); return; } undefined4 __cdecl FUN_004105fe(short param_1,int param_2,short param_3) { int iVar1; iVar1 = 0; if (0 < param_3) { do { if (param_1 == *(short *)(param_2 + (short)iVar1 * 2)) { return CONCAT22((short)((uint)iVar1 >> 0x10),1); } iVar1 = iVar1 + 1; } while ((short)iVar1 < param_3); } return 0; } undefined4 __cdecl FUN_0041062e(short param_1,int param_2,short param_3,short param_4,int param_5) { bool bVar1; short sVar2; undefined4 in_EAX; undefined4 uVar3; bVar1 = false; if (param_1 == 99) { uVar3 = CONCAT22((short)((uint)in_EAX >> 0x10),1); } else { sVar2 = 0; if (0 < param_3) { do { if (param_1 == *(short *)(param_2 + sVar2 * 2)) { bVar1 = true; break; } sVar2 = sVar2 + 1; } while (sVar2 < param_3); } if ((bVar1) && (*(short *)(param_5 + -2 + param_3 * 2) != param_4)) { uVar3 = CONCAT22(param_3 >> 0xf,1); } else { uVar3 = 0; } } return uVar3; } undefined4 __cdecl FUN_0041068a(int param_1,short param_2) { int iVar1; short sVar2; sVar2 = 0; do { if (DAT_0044f6e8 <= sVar2) { return 0; } iVar1 = 0; if (0 < param_2) { do { if (*(short *)(param_1 + (short)iVar1 * 2) != (&DAT_0044f6ea)[sVar2 * 0x14 + (int)(short)iVar1]) break; iVar1 = iVar1 + 1; } while ((short)iVar1 < param_2); } if (param_2 <= (short)iVar1) { return CONCAT22((short)((uint)iVar1 >> 0x10),1); } sVar2 = sVar2 + 1; } while( true ); } void __cdecl FUN_004106e0(int param_1,short param_2,undefined2 param_3) { short sVar1; sVar1 = 0; if (0 < param_2) { do { (&DAT_0044f6ea)[DAT_0044f6e8 * 0x14 + (int)sVar1] = *(undefined2 *)(param_1 + sVar1 * 2); sVar1 = sVar1 + 1; } while (sVar1 < param_2); } (&DAT_0044f6ea)[DAT_0044f6e8 * 0x14 + (int)sVar1] = param_3; DAT_0044f6e8 = DAT_0044f6e8 + 1; return; } undefined2 __cdecl FUN_0041073d(short param_1) { short sVar1; ushort uVar2; bool bVar3; short sVar4; undefined4 uVar5; bool bVar6; short sVar7; uint uVar8; short sVar9; bool bVar10; short local_64 [19]; short sStack_3e; undefined4 local_3c [11]; undefined2 local_e; short local_c; short local_a; short local_8; short local_6; local_8 = 0; if ((struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field9_0x12 == 99) || (struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field9_0x12 == 99)) { local_e = 0; } else { DAT_0044f6e8 = 0; memset((undefined4 *)&DAT_0044f6ea,0xff,400); while (local_8 == 0) { memset((undefined4 *)local_64,0xff,0x28); memset(local_3c,0xff,0x28); local_64[0] = struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field9_0x12; local_3c[0]._0_2_ = struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field10_0x14; uVar8 = (uint)(ushort)local_3c[0]; sVar4 = 1; local_6 = 0; sVar7 = local_64[0]; while (local_6 == 0) { do { do { uVar8 = (int)(short)((short)uVar8 + 1) % 3; sVar9 = (short)uVar8; uVar5 = FUN_0041062e(*(short *)(sVar7 * 0x4e + 0x44f088 + sVar9 * 0x1a),(int)local_64, sVar4,sVar9,(int)local_3c); } while ((short)uVar5 != 0); local_a = 0; if (*(short *)(sVar7 * 0x4e + 0x44f088 + sVar9 * 0x1a) == param_1) { if (*(short *)(sVar7 * 0x4e + 0x44f08a + sVar9 * 0x1a) == 0) { local_6 = 1; local_8 = 1; } else { uVar5 = FUN_0041068a((int)local_64,sVar4); if ((short)uVar5 == 0) { FUN_004106e0((int)local_64,sVar4,param_1); local_6 = 1; } else { local_a = 1; } } } } while (local_a != 0); if (((sVar4 < 1) || (sVar7 != local_64[sVar4 + -1])) || (sVar9 != *(short *)((int)local_3c + sVar4 * 2 + -2))) { sVar1 = *(short *)(sVar7 * 0x4e + 0x44f088 + sVar9 * 0x1a); uVar2 = *(ushort *)(sVar7 * 0x4e + 0x44f08a + sVar9 * 0x1a); uVar8 = (uint)uVar2; uVar5 = FUN_004105fe(sVar1,(int)local_64,sVar4); sVar7 = sVar1; if ((short)uVar5 == 0) { local_64[sVar4] = sVar1; *(ushort *)((int)local_3c + sVar4 * 2) = uVar2; sVar4 = sVar4 + 1; } } else { sVar1 = *(short *)(sVar7 * 0x4e + 0x44f088 + sVar9 * 0x1a); uVar8 = (uint)*(ushort *)(sVar7 * 0x4e + 0x44f08a + sVar9 * 0x1a); sVar4 = sVar4 + -1; local_64[sVar4] = 0; *(undefined2 *)((int)local_3c + sVar4 * 2) = 0; sVar7 = sVar1; } } } local_e = 0; for (sVar7 = 0; sVar7 < DAT_0044f6e8; sVar7 = sVar7 + 1) { bVar6 = false; bVar3 = false; bVar10 = false; local_c = 0; sVar4 = 0; while ((&DAT_0044f6ea)[sVar7 * 0x14 + (int)sVar4] != param_1) { if (struct_unk_1_ARRAY_0044f556[(short)(&DAT_0044f6ea)[sVar7 * 0x14 + (int)sVar4]]. field0_0x0 == 1) { bVar3 = true; } else if (struct_unk_1_ARRAY_0044f556[(short)(&DAT_0044f6ea)[sVar7 * 0x14 + (int)sVar4]]. field0_0x0 == 0) { bVar3 = true; local_c = local_c + 1; } else if ((struct_unk_1_ARRAY_0044f556[(short)(&DAT_0044f6ea)[sVar7 * 0x14 + (int)sVar4]]. field0_0x0 == 2) && (struct_unk_1_ARRAY_0044f556[(short)(&DAT_0044f6ea)[sVar7 * 0x14 + (int)sVar4]]. field4_0x8 == 0)) { bVar6 = true; } if ((struct_unk_1_ARRAY_0044f556[(short)(&DAT_0044f6ea)[sVar7 * 0x14 + (int)sVar4]]. field0_0x0 != 3) && (struct_unk_1_ARRAY_0044f556[(short)(&DAT_0044f6ea)[sVar7 * 0x14 + (int)sVar4]]. field0_0x0 != 0)) { bVar10 = true; } sVar4 = sVar4 + 1; } if ((!bVar3) && (!bVar6)) { local_e = 1; } if ((!bVar10) && (0 < local_c)) { bVar3 = false; sVar4 = 0; bVar6 = false; while ((&DAT_0044f6ea)[sVar7 * 0x14 + (int)sVar4] != param_1) { bVar10 = bVar6; if (struct_unk_1_ARRAY_0044f556[(short)(&DAT_0044f6ea)[sVar7 * 0x14 + (int)sVar4]]. field0_0x0 == 0) { if (sVar4 == 0) { bVar10 = struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076 [(short)(&DAT_0044f6ea)[sVar7 * 0x14]][0].field9_0x12 == param_1; } else { bVar10 = struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076 [(short)(&DAT_0044f6ea)[sVar7 * 0x14 + (int)sVar4]][0].field9_0x12 == (&DAT_0044f6e8)[sVar7 * 0x14 + (int)sVar4]; } if (bVar10 != bVar6) { bVar3 = true; } } sVar4 = sVar4 + 1; bVar6 = bVar10; } if (!bVar3) { local_e = 1; } } } } return local_e; } void __stdcall FUN_00410bca(void) { undefined2 uVar1; short sVar2; sVar2 = 0; do { if ((struct_unk_1_ARRAY_0044f556[sVar2].field3_0x6 != 0) && (struct_unk_1_ARRAY_0044f556[sVar2].field0_0x0 == 0)) { uVar1 = FUN_0041073d(sVar2); (&DAT_0044f056)[sVar2] = uVar1; } sVar2 = sVar2 + 1; } while (sVar2 < 0x10); return; } undefined4 __cdecl FUN_00410c0e(short param_1) { short sVar1; ushort uVar2; bool bVar3; bool bVar4; bool bVar5; short sVar6; undefined4 uVar7; short sVar8; uint uVar9; short sVar10; bool bVar11; short local_68 [19]; short sStack_42; undefined4 local_40 [10]; short local_16; ushort local_14; short local_10; short local_c; short local_a; short local_8; short local_6; local_8 = 0; if ((struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field9_0x12 == 99) || (struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field9_0x12 == 99)) { uVar7 = 0; } else { FUN_00410bca(); DAT_0044f6e8 = 0; memset((undefined4 *)&DAT_0044f6ea,0xff,400); while (local_8 == 0) { memset((undefined4 *)local_68,0xff,0x28); memset(local_40,0xff,0x28); local_68[0] = struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field9_0x12; local_40[0]._0_2_ = struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field10_0x14; uVar9 = (uint)(ushort)local_40[0]; sVar6 = 1; local_6 = 0; sVar8 = local_68[0]; while (local_6 == 0) { do { do { uVar9 = (int)(short)((short)uVar9 + 1) % 3; sVar10 = (short)uVar9; uVar7 = FUN_0041062e(*(short *)(sVar8 * 0x4e + 0x44f088 + sVar10 * 0x1a),(int)local_68, sVar6,sVar10,(int)local_40); } while ((short)uVar7 != 0); local_a = 0; if (*(short *)(sVar8 * 0x4e + 0x44f088 + sVar10 * 0x1a) == param_1) { if (*(short *)(sVar8 * 0x4e + 0x44f08a + sVar10 * 0x1a) == 0) { local_6 = 1; local_8 = 1; } else { uVar7 = FUN_0041068a((int)local_68,sVar6); if ((short)uVar7 == 0) { FUN_004106e0((int)local_68,sVar6,param_1); local_6 = 1; } else { local_a = 1; } } } } while (local_a != 0); if (((sVar6 < 1) || (sVar8 != local_68[sVar6 + -1])) || (sVar10 != *(short *)((int)local_40 + sVar6 * 2 + -2))) { sVar1 = *(short *)(sVar8 * 0x4e + 0x44f088 + sVar10 * 0x1a); uVar2 = *(ushort *)(sVar8 * 0x4e + 0x44f08a + sVar10 * 0x1a); uVar9 = (uint)uVar2; uVar7 = FUN_004105fe(sVar1,(int)local_68,sVar6); sVar8 = sVar1; if ((short)uVar7 == 0) { local_68[sVar6] = sVar1; *(ushort *)((int)local_40 + sVar6 * 2) = uVar2; sVar6 = sVar6 + 1; } } else { sVar1 = *(short *)(sVar8 * 0x4e + 0x44f088 + sVar10 * 0x1a); uVar9 = (uint)*(ushort *)(sVar8 * 0x4e + 0x44f08a + sVar10 * 0x1a); sVar6 = sVar6 + -1; local_68[sVar6] = 0; *(undefined2 *)((int)local_40 + sVar6 * 2) = 0; sVar8 = sVar1; } } } local_10 = 0; local_c = 0; local_16 = 0; memset((undefined4 *)&DAT_0044f036,0,0x20); (&DAT_0044f036)[param_1] = 1; for (sVar8 = 0; sVar8 < DAT_0044f6e8; sVar8 = sVar8 + 1) { bVar4 = false; bVar5 = false; bVar3 = false; sVar6 = 0; while ((&DAT_0044f6ea)[sVar8 * 0x14 + (int)sVar6] != param_1) { if ((&DAT_0044f036)[(short)(&DAT_0044f6ea)[sVar8 * 0x14 + (int)sVar6]] == 0) { (&DAT_0044f036)[(short)(&DAT_0044f6ea)[sVar8 * 0x14 + (int)sVar6]] = 1; } if ((struct_unk_1_ARRAY_0044f556[(short)(&DAT_0044f6ea)[sVar8 * 0x14 + (int)sVar6]]. field0_0x0 == 0) && ((&DAT_0044f056)[(short)(&DAT_0044f6ea)[sVar8 * 0x14 + (int)sVar6]] == 0)) { bVar4 = true; if (sVar6 == 0) { bVar11 = struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[(short)(&DAT_0044f6ea)[sVar8 * 0x14]] [0].field9_0x12 != param_1; } else { bVar11 = struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076 [(short)(&DAT_0044f6ea)[sVar8 * 0x14 + (int)sVar6]][0].field9_0x12 != (&DAT_0044f6e8)[sVar8 * 0x14 + (int)sVar6]; } if (local_16 == 0) { local_16 = 1; local_14 = (ushort)bVar11; } else if (bVar11 != local_14) { local_10 = 1; } } else if ((struct_unk_1_ARRAY_0044f556[(short)(&DAT_0044f6ea)[sVar8 * 0x14 + (int)sVar6]]. field0_0x0 == 2) && (struct_unk_1_ARRAY_0044f556[(short)(&DAT_0044f6ea)[sVar8 * 0x14 + (int)sVar6]]. field4_0x8 == 0)) { bVar3 = true; } else if (struct_unk_1_ARRAY_0044f556[(short)(&DAT_0044f6ea)[sVar8 * 0x14 + (int)sVar6]]. field0_0x0 == 1) { bVar5 = true; } sVar6 = sVar6 + 1; } if (!bVar3) { if (bVar4) { local_c = 1; } else if (!bVar5) { local_10 = 1; } } } if ((local_10 == 0) && (local_c != 0)) { uVar7 = 1; } else { uVar7 = 0; } } return uVar7; } void __cdecl FUN_004110ae(short param_1,short param_2) { aseq_anim_state_struct *paVar1; if (param_2 != 0) { free_aseq((int *)struct_unk_1_ARRAY_0044f556[param_1].anim_state); paVar1 = (aseq_anim_state_struct *)load_aseq(0x2718); struct_unk_1_ARRAY_0044f556[param_1].anim_state = paVar1; anim_state_xxx_list_insert_8004((undefined4 *)struct_unk_1_ARRAY_0044f556[param_1].anim_state); aseq_set_pos_order((int)struct_unk_1_ARRAY_0044f556[param_1].anim_state, struct_unk_1_ARRAY_0044f556[param_1].field1_0x2, struct_unk_1_ARRAY_0044f556[param_1].field2_0x4,10); return; } free_aseq((int *)struct_unk_1_ARRAY_0044f556[param_1].anim_state); paVar1 = (aseq_anim_state_struct *)load_aseq(0x2714); struct_unk_1_ARRAY_0044f556[param_1].anim_state = paVar1; return; } void __stdcall FUN_00411160(void) { undefined4 uVar1; short sVar2; short sVar3; sVar2 = 0; do { if (struct_unk_1_ARRAY_0044f556[sVar2].field3_0x6 != 0) { sVar3 = 0; do { if (((struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2][sVar3].field9_0x12 != 99) && (struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2][sVar3].field11_0x16 != 0)) && (uVar1 = FUN_004112e3(DAT_0044f018,DAT_0044f01a, struct_unk_1_ARRAY_0044f556[sVar2].field1_0x2 + struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2][sVar3].field4_0x8, struct_unk_1_ARRAY_0044f556[sVar2].field2_0x4 + struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2][sVar3].field5_0xa, *(short *)((short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2] [sVar3].field9_0x12 * 0x4e + 0x44f07e + (short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2] [sVar3].field10_0x14 * 0x1a) + struct_unk_1_ARRAY_0044f556 [(short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2][sVar3]. field9_0x12].field1_0x2, *(short *)((short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2] [sVar3].field9_0x12 * 0x4e + 0x44f080 + (short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2] [sVar3].field10_0x14 * 0x1a) + struct_unk_1_ARRAY_0044f556 [(short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2][sVar3]. field9_0x12].field2_0x4), (short)uVar1 != 0)) { *(undefined2 *) ((short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2][sVar3].field9_0x12 * 0x4e + 0x44f088 + (short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2][sVar3].field10_0x14 * 0x1a) = 99; *(undefined2 *) ((short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2][sVar3].field9_0x12 * 0x4e + 0x44f08c + (short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2][sVar3].field10_0x14 * 0x1a) = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar2][sVar3].field9_0x12 = 99; play_wave_flag1(0x4a74,5,0); clear_cursor_override_regions(); set_custom_cursor(battery_wire_spool_0_aseq_more); DAT_0044f030 = 4; DAT_00449470 = 2; FUN_00412104(1); return; } sVar3 = sVar3 + 1; } while (sVar3 < 3); } sVar2 = sVar2 + 1; if (0xf < sVar2) { return; } } while( true ); } undefined4 __cdecl FUN_004112e3(short param_1,short param_2,short param_3,short param_4,short param_5,short param_6) { undefined4 uVar1; if (param_3 < param_5) { uVar1 = FUN_004120bd(param_1,param_2,param_3,param_4 + -1,(param_5 - param_3) + -1,3); if ((short)uVar1 != 0) { return CONCAT22((short)((uint)uVar1 >> 0x10),1); } } else if ((param_5 < param_3) && (uVar1 = FUN_004120bd(param_1,param_2,param_5,param_4 + -1,param_3 - param_5,3), (short)uVar1 != 0)) { return CONCAT22((short)((uint)uVar1 >> 0x10),1); } if (param_4 < param_6) { uVar1 = FUN_004120bd(param_1,param_2,param_5 + -1,param_4,3,param_6 - param_4); if ((short)uVar1 != 0) { return CONCAT22((short)((uint)uVar1 >> 0x10),1); } } else if ((param_6 < param_4) && (uVar1 = FUN_004120bd(param_1,param_2,param_5 + -1,param_6,3,param_4 - param_6), (short)uVar1 != 0)) { return CONCAT22((short)((uint)uVar1 >> 0x10),1); } return 0; } void __cdecl FUN_004113cc(short param_1) { int iVar1; short sVar2; short sVar3; struct_elec_unk_0x1a *psVar4; undefined4 *puVar5; undefined4 local_20 [2]; short local_18; short local_16; short local_e; short local_c; short local_a; if (param_1 != 0) { FUN_004115b0(); } sVar3 = 0; do { if (struct_unk_1_ARRAY_0044f556[sVar3].field3_0x6 != 0) { sVar2 = 0; do { psVar4 = struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar3] + sVar2; puVar5 = local_20; for (iVar1 = 6; iVar1 != 0; iVar1 = iVar1 + -1) { *puVar5 = *(undefined4 *)psVar4; psVar4 = (struct_elec_unk_0x1a *)&psVar4->field2_0x4; puVar5 = puVar5 + 1; } *(undefined2 *)puVar5 = psVar4->field0_0x0; if ((local_e != 99) && (local_a != 0)) { if (local_a == 1) { FUN_0040c65c(struct_unk_1_ARRAY_0044f556[sVar3].field1_0x2 + local_18, struct_unk_1_ARRAY_0044f556[sVar3].field2_0x4 + local_16, *(short *)(local_e * 0x4e + 0x44f07e + local_c * 0x1a) + struct_unk_1_ARRAY_0044f556[local_e].field1_0x2, *(short *)(local_e * 0x4e + 0x44f080 + local_c * 0x1a) + struct_unk_1_ARRAY_0044f556[local_e].field2_0x4); } if (param_1 != 0) { FUN_004114fd(local_e,local_c); FUN_004114fd(sVar3,sVar2); } } sVar2 = sVar2 + 1; } while (sVar2 < 3); } sVar3 = sVar3 + 1; } while (sVar3 < 0x10); return; } void __cdecl FUN_004114fd(short param_1,short param_2) { short sVar1; word wVar2; short sVar3; word wVar4; short sVar5; sVar5 = 0; do { if (struct_unk_0_ARRAY_0044f87a[sVar5].field0_0x0 != 0) { struct_unk_0_ARRAY_0044f87a[sVar5].field0_0x0 = 0; break; } sVar5 = sVar5 + 1; } while (sVar5 < 0x32); sVar1 = *(short *)(param_1 * 0x4e + 0x44f082 + param_2 * 0x1a); wVar2 = struct_unk_1_ARRAY_0044f556[param_1].field1_0x2; sVar3 = *(short *)(param_1 * 0x4e + 0x44f084 + param_2 * 0x1a); wVar4 = struct_unk_1_ARRAY_0044f556[param_1].field2_0x4; anim_state_xxx_list_insert_8004((undefined4 *)struct_unk_0_ARRAY_0044f87a[sVar5].anim_state); aseq_set_pos_order((int)struct_unk_0_ARRAY_0044f87a[sVar5].anim_state,sVar1 + wVar2,sVar3 + wVar4, 0xf); return; } void __stdcall FUN_004115b0(void) { short sVar1; sVar1 = 0; do { anim_state_xxx_list_remove((int *)struct_unk_0_ARRAY_0044f87a[sVar1].anim_state); struct_unk_0_ARRAY_0044f87a[sVar1].field0_0x0 = 1; sVar1 = sVar1 + 1; } while (sVar1 < 0x32); return; } undefined4 __cdecl FUN_004115e3(short param_1,short param_2,short param_3) { undefined4 uVar1; aseq_anim_state_struct *paVar2; undefined2 extraout_var; uVar1 = FUN_004120bd(param_2,param_3,struct_unk_1_ARRAY_0044f556[param_1].field1_0x2 + 0xb, struct_unk_1_ARRAY_0044f556[param_1].field2_0x4 + 0x26,0x10,0x1e); if ((short)uVar1 == 0) { uVar1 = 0; } else { if (struct_unk_1_ARRAY_0044f556[param_1].field4_0x8 == 0) { free_aseq((int *)struct_unk_1_ARRAY_0044f556[param_1].anim_state); paVar2 = (aseq_anim_state_struct *)load_aseq(0x2719); struct_unk_1_ARRAY_0044f556[param_1].anim_state = paVar2; struct_unk_1_ARRAY_0044f556[param_1].field4_0x8 = 1; } else { free_aseq((int *)struct_unk_1_ARRAY_0044f556[param_1].anim_state); paVar2 = (aseq_anim_state_struct *)load_aseq(0x2715); struct_unk_1_ARRAY_0044f556[param_1].anim_state = paVar2; struct_unk_1_ARRAY_0044f556[param_1].field4_0x8 = 0; } FUN_00412104(1); uVar1 = CONCAT22(extraout_var,1); } return uVar1; } void __cdecl FUN_004116cf(short param_1) { int iVar1; short sVar2; if (struct_unk_1_ARRAY_0044f556[param_1].field5_0xa == 0) { sVar2 = 0; do { iVar1 = (int)param_1; if (struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[iVar1][sVar2].field9_0x12 != 99) { if ((struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[iVar1][sVar2].field11_0x16 != 3) && (*(short *)((short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[iVar1][sVar2].field9_0x12 * 0x4e + 0x44f08c + (short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[iVar1][sVar2].field10_0x14 * 0x1a) != 3)) { null_ARRAY_0044f020[4] = null_ARRAY_0044f020[4] + 1; } *(undefined2 *) ((short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[iVar1][sVar2].field9_0x12 * 0x4e + 0x44f08c + (short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[iVar1][sVar2].field10_0x14 * 0x1a) = 0; *(undefined2 *) ((short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[iVar1][sVar2].field9_0x12 * 0x4e + 0x44f088 + (short)struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[iVar1][sVar2].field10_0x14 * 0x1a) = 99; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[iVar1][sVar2].field11_0x16 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[iVar1][sVar2].field9_0x12 = 99; } sVar2 = sVar2 + 1; } while (sVar2 < 3); struct_unk_1_ARRAY_0044f556[param_1].field3_0x6 = 0; if (struct_unk_1_ARRAY_0044f556[param_1].field0_0x0 == 2) { struct_unk_1_ARRAY_0044f556[param_1].field4_0x8 = 0; } if (struct_unk_1_ARRAY_0044f556[param_1].field0_0x0 == 1) { struct_unk_1_ARRAY_0044f556[param_1].field4_0x8 = 0; } free_aseq((int *)struct_unk_1_ARRAY_0044f556[param_1].anim_state); DAT_00449470 = 2; clear_cursor_override_regions(); DAT_0044f030 = struct_unk_1_ARRAY_0044f556[param_1].field0_0x0; set_custom_cursor((undefined4 *)battery_puzzle_things_aseq_more[(short)DAT_0044f030]); play_wave_flag1(0x1f73,5,0); FUN_00412104(1); FUN_004104cc(); FUN_00410427(); } return; } void __cdecl FUN_0041183c(short param_1) { int iVar1; DAT_0044f030 = param_1; DAT_00449470 = 2; clear_cursor_override_regions(); set_custom_cursor((undefined4 *)battery_puzzle_things_aseq_more[DAT_0044f030]); iVar1 = (int)DAT_0044f030; null_ARRAY_0044f020[iVar1] = null_ARRAY_0044f020[iVar1] + -1; if (null_ARRAY_0044f020[iVar1] == 0) { anim_state_xxx_list_remove((int *)PTR_ARRAY_0044f9ac[DAT_0044f030]); } FUN_0040beff(); FUN_004104cc(); FUN_00410427(); play_wave_flag1(0x1f73,5,0); return; } void __stdcall FUN_004118bd(void) { short sVar1; short sVar2; undefined4 uVar3; undefined4 uVar4; undefined4 uVar5; undefined4 uVar6; short sVar7; sVar2 = DAT_0044f01a; sVar1 = DAT_0044f018; uVar3 = aseq_get_img_w((int)PTR_ARRAY_0044f9ac[DAT_0044f030],0); uVar4 = aseq_get_img_h((int)PTR_ARRAY_0044f9ac[DAT_0044f030],0); if ((((0x99 < sVar1) && ((int)sVar1 + (int)(short)uVar3 < 499)) && (0x25 < sVar2)) && ((int)sVar2 + (int)(short)uVar4 < 0x127)) { sVar7 = 0; do { if (struct_unk_1_ARRAY_0044f556[sVar7].field3_0x6 != 0) { uVar5 = aseq_get_img_w((int)struct_unk_1_ARRAY_0044f556[sVar7].anim_state,0); uVar6 = aseq_get_img_h((int)struct_unk_1_ARRAY_0044f556[sVar7].anim_state,0); uVar5 = FUN_00411c81(sVar1,sVar2 + 7,(short)uVar3,(short)uVar4 + -0xe, struct_unk_1_ARRAY_0044f556[sVar7].field1_0x2, struct_unk_1_ARRAY_0044f556[sVar7].field2_0x4 + 7,(short)uVar5, (short)uVar6 + -0xe); if ((short)uVar5 != 0) { return; } } sVar7 = sVar7 + 1; } while (sVar7 < 0x10); DAT_00449470 = 0; FUN_00412203(sVar1,sVar2); FUN_00412104(1); play_wave_flag1(0x4a74,5,0); DAT_0044f030 = 99; FUN_0040beff(); FUN_00412d3e(); } return; } void __cdecl FUN_00411a37(short param_1) { undefined4 uVar1; short sVar2; short sVar3; short local_6; local_6 = 0; do { if (*(short *)(param_1 * 0x4e + 0x44f088 + local_6 * 0x1a) == 99) { sVar2 = 0; do { if ((struct_unk_1_ARRAY_0044f556[sVar2].field3_0x6 != 0) && (param_1 != sVar2)) { sVar3 = 0; do { if (*(short *)(sVar2 * 0x4e + 0x44f088 + sVar3 * 0x1a) == 99) { uVar1 = FUN_00411c81(*(short *)(sVar2 * 0x4e + 0x44f07e + sVar3 * 0x1a) + struct_unk_1_ARRAY_0044f556[sVar2].field1_0x2 + -2, *(short *)(sVar2 * 0x4e + 0x44f080 + sVar3 * 0x1a) + struct_unk_1_ARRAY_0044f556[sVar2].field2_0x4,3, *(short *)(sVar2 * 0x4e + 0x44f086 + sVar3 * 0x1a), *(short *)(param_1 * 0x4e + 0x44f07e + local_6 * 0x1a) + struct_unk_1_ARRAY_0044f556[param_1].field1_0x2 + -2, *(short *)(param_1 * 0x4e + 0x44f080 + local_6 * 0x1a) + struct_unk_1_ARRAY_0044f556[param_1].field2_0x4,3, *(short *)(param_1 * 0x4e + 0x44f086 + local_6 * 0x1a)); if ((short)uVar1 != 0) { *(short *)(param_1 * 0x4e + 0x44f088 + local_6 * 0x1a) = sVar2; *(short *)(param_1 * 0x4e + 0x44f08a + local_6 * 0x1a) = sVar3; *(undefined2 *)(param_1 * 0x4e + 0x44f08c + local_6 * 0x1a) = 3; *(short *)(sVar2 * 0x4e + 0x44f088 + sVar3 * 0x1a) = param_1; *(short *)(sVar2 * 0x4e + 0x44f08a + sVar3 * 0x1a) = local_6; *(undefined2 *)(sVar2 * 0x4e + 0x44f08c + sVar3 * 0x1a) = 0; } } sVar3 = sVar3 + 1; } while (sVar3 < 3); } sVar2 = sVar2 + 1; } while (sVar2 < 0x10); } local_6 = local_6 + 1; } while (local_6 < 3); return; } undefined4 __cdecl FUN_00411c81(short param_1,short param_2,short param_3,short param_4,short param_5,short param_6, short param_7,short param_8) { bool bVar1; bool bVar2; int iVar3; undefined4 uVar4; bVar1 = false; if (param_7 < param_3) { if ((param_1 <= param_5) && ((int)param_5 < (int)param_1 + (int)param_3)) { bVar1 = true; } if (((int)param_1 < (int)param_5 + (int)param_7) && ((int)param_5 + (int)param_7 <= (int)param_1 + (int)param_3)) { bVar1 = true; } } else { if ((param_5 <= param_1) && ((int)param_1 < (int)param_5 + (int)param_7)) { bVar1 = true; } if (((int)param_5 < (int)param_1 + (int)param_3) && ((int)param_1 + (int)param_3 <= (int)param_5 + (int)param_7)) { bVar1 = true; } } bVar2 = false; if (param_8 < param_4) { if ((param_2 <= param_6) && ((int)param_6 < (int)param_2 + (int)param_4)) { bVar2 = true; } iVar3 = (int)param_6 + (int)param_8; if ((param_2 < iVar3) && (iVar3 = (int)param_6 + (int)param_8, iVar3 <= (int)param_2 + (int)param_4)) { bVar2 = true; } } else { if ((param_6 <= param_2) && ((int)param_2 < (int)param_6 + (int)param_8)) { bVar2 = true; } iVar3 = (int)param_2 + (int)param_4; if ((param_6 < iVar3) && (iVar3 = (int)param_2 + (int)param_4, iVar3 <= (int)param_6 + (int)param_8)) { bVar2 = true; } } if ((bVar1) && (bVar2)) { uVar4 = CONCAT22((short)((uint)iVar3 >> 0x10),1); } else { uVar4 = 0; } return uVar4; } void __stdcall FUN_00411df1(void) { word wVar1; undefined2 uVar2; undefined4 uVar3; int iVar4; short sVar5; short sVar6; struct_elec_unk_0x1a *psVar7; short *psVar8; short local_24 [9]; short local_12; short local_a; short local_8; word local_6; local_8 = DAT_0044f018 + 0x37; local_a = DAT_0044f01a + 0xf; sVar6 = 0; do { if (struct_unk_1_ARRAY_0044f556[sVar6].field3_0x6 != 0) { wVar1 = struct_unk_1_ARRAY_0044f556[sVar6].field1_0x2; local_6 = struct_unk_1_ARRAY_0044f556[sVar6].field2_0x4; sVar5 = 0; do { psVar7 = struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar6] + sVar5; psVar8 = local_24; for (iVar4 = 6; iVar4 != 0; iVar4 = iVar4 + -1) { uVar2 = psVar7->field1_0x2; psVar8[0] = psVar7->field0_0x0; psVar8[1] = uVar2; psVar7 = (struct_elec_unk_0x1a *)&psVar7->field2_0x4; psVar8 = psVar8 + 2; } *psVar8 = psVar7->field0_0x0; uVar3 = FUN_004120bd(local_8,local_a,local_24[0] + wVar1,local_6 + local_24[1],local_24[2], local_24[3]); if ((short)uVar3 != 0) { if (DAT_0044f02a != 0) { return; } if (local_12 != 99) { return; } set_custom_cursor(battery_wire_spool_1_aseq); DAT_0044f02a = 1; if (DAT_00449470 != 5) { DAT_0044f02a = 1; return; } clip_cursor_enable(100,0x24,399,300); return; } sVar5 = sVar5 + 1; } while (sVar5 < 3); } sVar6 = sVar6 + 1; if (0xf < sVar6) { if (DAT_0044f02a != 0) { set_custom_cursor(battery_wire_spool_0_aseq_more); DAT_0044f02a = 0; if (DAT_00449470 == 5) { clip_cursor_enable(100,0x24,399,300); } } return; } } while( true ); } undefined4 __stdcall FUN_00411f53(void) { word wVar1; undefined2 uVar2; undefined4 uVar3; int iVar4; short sVar5; short sVar6; struct_elec_unk_0x1a *psVar7; short *psVar8; short local_24 [13]; short local_a; short local_8; word local_6; local_8 = DAT_0044f018 + 0x37; local_a = DAT_0044f01a + 0xf; sVar5 = 0; do { if ((struct_unk_1_ARRAY_0044f556[sVar5].field3_0x6 != 0) && (sVar5 != DAT_0044f02c)) { wVar1 = struct_unk_1_ARRAY_0044f556[sVar5].field1_0x2; local_6 = struct_unk_1_ARRAY_0044f556[sVar5].field2_0x4; sVar6 = 0; do { psVar7 = struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[sVar5] + sVar6; psVar8 = local_24; for (iVar4 = 6; iVar4 != 0; iVar4 = iVar4 + -1) { uVar2 = psVar7->field1_0x2; psVar8[0] = psVar7->field0_0x0; psVar8[1] = uVar2; psVar7 = (struct_elec_unk_0x1a *)&psVar7->field2_0x4; psVar8 = psVar8 + 2; } *psVar8 = psVar7->field0_0x0; uVar3 = FUN_004120bd(local_8,local_a,local_24[0] + wVar1,local_6 + local_24[1],local_24[2], local_24[3]); if (((short)uVar3 != 0) && (*(short *)(sVar5 * 0x4e + 0x44f088 + sVar6 * 0x1a) == 99)) { DAT_0044946c = *(short *)(sVar5 * 0x4e + 0x44f07e + sVar6 * 0x1a) + struct_unk_1_ARRAY_0044f556[sVar5].field1_0x2; DAT_0044946e = *(short *)(sVar5 * 0x4e + 0x44f080 + sVar6 * 0x1a) + struct_unk_1_ARRAY_0044f556[sVar5].field2_0x4; DAT_0044f02c = sVar5; DAT_0044f02e = sVar6; return CONCAT22((short)((uint)(sVar6 * 0xd) >> 0x10),1); } sVar6 = sVar6 + 1; } while (sVar6 < 3); } sVar5 = sVar5 + 1; if (0xf < sVar5) { return 0; } } while( true ); } undefined4 __cdecl FUN_004120bd(short param_1,short param_2,short param_3,short param_4,short param_5,short param_6) { if ((((param_3 <= param_1) && ((int)param_1 < (int)param_3 + (int)param_5)) && (param_4 <= param_2)) && ((int)param_2 < (int)param_4 + (int)param_6)) { return CONCAT22((short)((uint)((int)param_4 + (int)param_6) >> 0x10),1); } return 0; } void __cdecl FUN_00412104(short param_1) { undefined4 uVar1; short sVar2; gfxish_copy_otherbuf_to_dest_and_invalidate(0x9a,0x24,0x15a,0x104); if (param_1 == 0) { sVar2 = 0; do { if (struct_unk_1_ARRAY_0044f556[sVar2].field3_0x6 != 0) { aseq_anim_mark_all_drawn_invalidated((int)struct_unk_1_ARRAY_0044f556[sVar2].anim_state); } sVar2 = sVar2 + 1; } while (sVar2 < 0x10); } else { sVar2 = 0; do { if (struct_unk_1_ARRAY_0044f556[sVar2].field3_0x6 != 0) { if (struct_unk_1_ARRAY_0044f556[sVar2].field0_0x0 == 1) { uVar1 = FUN_00410c0e(sVar2); FUN_004110ae(sVar2,(short)uVar1); } anim_state_xxx_list_remove((int *)struct_unk_1_ARRAY_0044f556[sVar2].anim_state); anim_state_xxx_list_insert_8004((undefined4 *)struct_unk_1_ARRAY_0044f556[sVar2].anim_state) ; aseq_set_pos_order((int)struct_unk_1_ARRAY_0044f556[sVar2].anim_state, struct_unk_1_ARRAY_0044f556[sVar2].field1_0x2, struct_unk_1_ARRAY_0044f556[sVar2].field2_0x4,10); } sVar2 = sVar2 + 1; } while (sVar2 < 0x10); } FUN_004113cc(param_1); gfxish_invalidate_rect_wrap(0x9a,0x24,0x15a,0x104); return; } void __cdecl FUN_00412203(word param_1,word param_2) { aseq_anim_state_struct *paVar1; short sVar2; sVar2 = 0; do { if (struct_unk_1_ARRAY_0044f556[sVar2].field3_0x6 == 0) break; sVar2 = sVar2 + 1; } while (sVar2 < 0x10); struct_unk_1_ARRAY_0044f556[sVar2].field0_0x0 = DAT_0044f030; struct_unk_1_ARRAY_0044f556[sVar2].field3_0x6 = 1; struct_unk_1_ARRAY_0044f556[sVar2].field1_0x2 = param_1; struct_unk_1_ARRAY_0044f556[sVar2].field2_0x4 = param_2; paVar1 = (aseq_anim_state_struct *)load_aseq(DAT_0044f030 + 0x2713); struct_unk_1_ARRAY_0044f556[sVar2].anim_state = paVar1; FUN_00412296(sVar2,DAT_0044f030); FUN_00411a37(sVar2); return; } void __cdecl FUN_00412296(short param_1,short param_2) { short sVar1; sVar1 = 0; do { *(undefined2 *)(param_1 * 0x4e + 0x44f088 + sVar1 * 0x1a) = 99; *(undefined2 *)(param_1 * 0x4e + 0x44f08a + sVar1 * 0x1a) = 99; *(undefined2 *)(param_1 * 0x4e + 0x44f08e + sVar1 * 0x1a) = 0; *(undefined2 *)(param_1 * 0x4e + 0x44f08c + sVar1 * 0x1a) = 1; sVar1 = sVar1 + 1; } while (sVar1 < 3); if (param_2 == 0) { struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field0_0x0 = 0xe; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field1_0x2 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field2_0x4 = 0xd; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field3_0x6 = 0x13; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field4_0x8 = 0x16; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field5_0xa = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field6_0xc = 0x10; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field7_0xe = 0xffff; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field8_0x10 = 0xc; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field0_0x0 = 0xe; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field1_0x2 = 0x66; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field2_0x4 = 0xd; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field3_0x6 = 0x13; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field4_0x8 = 0x16; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field5_0xa = 0x73; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field6_0xc = 0x10; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field7_0xe = 0x68; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field8_0x10 = 0xfff4; } else if (param_2 == 1) { struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field0_0x0 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field1_0x2 = 0x45; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field2_0x4 = 0xd; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field3_0x6 = 0x14; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field4_0x8 = 8; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field5_0xa = 0x54; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field6_0xc = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field7_0xe = 0x47; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field8_0x10 = 0xfff4; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field0_0x0 = 0xb; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field1_0x2 = 0x40; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field2_0x4 = 0xd; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field3_0x6 = 0x14; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field4_0x8 = 0x13; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field5_0xa = 0x4b; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field6_0xc = 0xd; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field7_0xe = 0x3f; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field8_0x10 = 0xfff4; } else if (param_2 == 2) { struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field0_0x0 = 8; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field1_0x2 = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field2_0x4 = 0xe; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field3_0x6 = 0x17; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field4_0x8 = 0x12; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field5_0xa = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field6_0xc = 0xb; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field7_0xe = 0xfffc; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field8_0x10 = 0xc; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field0_0x0 = 8; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field1_0x2 = 0x5c; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field2_0x4 = 0x10; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field3_0x6 = 0x17; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field4_0x8 = 0x12; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field5_0xa = 0x6d; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field6_0xc = 0xb; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field7_0xe = 0x62; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field8_0x10 = 0xfff4; } else if (param_2 == 3) { struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field0_0x0 = 0xfffd; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field1_0x2 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field2_0x4 = 0xd; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field3_0x6 = 0xf; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field4_0x8 = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field5_0xa = 0; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field6_0xc = 0xfffe; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field7_0xe = 0xfffe; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][0].field8_0x10 = 0xc; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field0_0x0 = 10; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field1_0x2 = 0xc; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field2_0x4 = 0xd; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field3_0x6 = 0xf; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field4_0x8 = 0x12; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field5_0xa = 10; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field6_0xc = 0xb; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field7_0xe = 8; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][1].field8_0x10 = 0xc; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][2].field0_0x0 = 2; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][2].field1_0x2 = 0x32; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][2].field2_0x4 = 0xd; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][2].field3_0x6 = 0xf; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][2].field4_0x8 = 10; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][2].field5_0xa = 0x3b; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][2].field6_0xc = 3; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][2].field7_0xe = 0x30; struct_elec_unk_0x1a_ARRAY_ARRAY_0044f076[param_1][2].field8_0x10 = 0xfff4; } return; } undefined4 __stdcall FUN_00412752(void) { int iVar1; short sVar2; sVar2 = 0; do { iVar1 = sVar2 * 5; if (struct_unk_1_ARRAY_0044f556[sVar2].field0_0x0 == 1) { iVar1 = FUN_00410c0e(sVar2); if ((short)iVar1 == 0) { return 0; } } sVar2 = sVar2 + 1; } while (sVar2 < 0x10); return CONCAT22((short)((uint)iVar1 >> 0x10),1); } short __stdcall FUN_00412788(void) { undefined4 uVar1; short sVar2; short sVar3; short asStack_10014 [32762]; short asStack_14 [6]; short local_8; short local_6; local_6 = 0; local_8 = 0; sVar3 = 0; if (((null_ARRAY_0044f020[1] == 0) && (null_ARRAY_0044f020[2] == 0)) && (null_ARRAY_0044f020[0] == 0)) { uVar1 = FUN_00412752(); if ((short)uVar1 == 0) { local_8 = 0; } else { sVar2 = 0; do { if ((struct_unk_1_ARRAY_0044f556[sVar2].field0_0x0 == 0) && (struct_unk_1_ARRAY_0044f556[sVar2].field3_0x6 != 0)) { if ((&DAT_0044f036)[sVar2] == 0) { return 0; } } else if (struct_unk_1_ARRAY_0044f556[sVar2].field0_0x0 == 2) { if ((&DAT_0044f036)[sVar2] == 0) { return 0; } if (struct_unk_1_ARRAY_0044f556[sVar2].field4_0x8 == 0) { return 0; } local_6 = 1; struct_unk_1_ARRAY_0044f556[sVar2].field4_0x8 = 0; uVar1 = FUN_00412752(); if ((short)uVar1 == 0) { local_8 = 1; } struct_unk_1_ARRAY_0044f556[sVar2].field4_0x8 = 1; asStack_14[sVar3] = sVar2; sVar3 = sVar3 + 1; } sVar2 = sVar2 + 1; } while (sVar2 < 0x10); if ((1 < sVar3) && (local_8 == 0)) { sVar2 = 0; if (0 < sVar3) { do { struct_unk_1_ARRAY_0044f556[asStack_14[sVar2]].field4_0x8 = 0; sVar2 = sVar2 + 1; } while (sVar2 < sVar3); } uVar1 = FUN_00412752(); if ((short)uVar1 == 0) { local_8 = 1; } sVar2 = 0; if (0 < sVar3) { do { struct_unk_1_ARRAY_0044f556[asStack_14[sVar2]].field4_0x8 = 1; sVar2 = sVar2 + 1; } while (sVar2 < sVar3); } } if (local_6 == 0) { local_8 = 1; } } } else { local_8 = 0; } return local_8; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __stdcall FUN_004128fa(void) { undefined4 uVar1; uint uVar2; DAT_0044f02c = 99; uVar1 = FUN_00411f53(); if (((short)uVar1 != 0) && (*(short *)(DAT_0044f02c * 0x4e + 0x44f088 + DAT_0044f02e * 0x1a) == 99)) { clip_cursor_enable(100,0x24,399,300); DAT_0044f032 = DAT_0044f02c; DAT_0044f034 = DAT_0044f02e; _DAT_0044f01c = DAT_0044f018; _DAT_0044f01e = DAT_0044f01a; play_wave_flag1(0x4a74,5,0); FUN_00412104(1); FUN_004114fd(DAT_0044f02c,DAT_0044f02e); DAT_00449470 = 5; uVar2 = anim_engine_add_cb(FUN_00412bcd,1); DAT_0044f016 = (undefined2)uVar2; xxx_periodic_loop(); } return; } void __stdcall FUN_004129d4(void) { uint uVar1; char *pcVar2; short sVar3; char *apcStackY_20400 [32762]; char *local_400 [5]; char local_3ec [1000]; play_wave_flag1(0x1f5c,5,0); anim_state_xxx_list_insert_4(battery_ui_hint_aseq); xxx_periodic_loop(); anim_state_xxx_list_remove(battery_ui_hint_aseq); xxx_periodic_loop(); memset((undefined4 *)local_3ec,0,1000); local_400[0] = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[0],(int *)&text); uVar1 = strlen(local_400[0]); FUN_00440d70((undefined4 *)local_3ec,local_400[0],uVar1); for (sVar3 = 1; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { pcVar2 = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[sVar3],(int *)&text); local_400[sVar3] = pcVar2; uVar1 = strlen(local_400[sVar3]); FUN_00440ce0(local_3ec,local_400[sVar3],uVar1); } FUN_004301cf(local_3ec); for (sVar3 = 0; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { free_resource_item_with_idx_fourcc(SHORT_ARRAY_004514ec[sVar3],(undefined1 *)&text); } return; } void __stdcall FUN_00412af9(void) { short sVar1; if (DAT_00449470 != 0) { if (DAT_00449470 == 2) { sVar1 = null_ARRAY_0044f020[DAT_0044f030]; null_ARRAY_0044f020[DAT_0044f030] = null_ARRAY_0044f020[DAT_0044f030] + 1; if (sVar1 == 0) { anim_state_xxx_list_insert_8004((undefined4 *)PTR_ARRAY_0044f9ac[DAT_0044f030]); } FUN_00412d3e(); DAT_0044f030 = 99; } else if (DAT_00449470 == 5) { null_ARRAY_0044f020[4] = null_ARRAY_0044f020[4] + 1; anim_engine_remove_cb(DAT_0044f016); *(undefined2 *)(DAT_0044f02c * 0x4e + 0x44f088 + DAT_0044f02e * 0x1a) = 99; FUN_00412d3e(); } } DAT_00449470 = 0; FUN_0040beff(); DAT_0044f030 = 99; FUN_00412bae(); return; } void __stdcall FUN_00412bae(void) { FUN_00430e33(DAT_0044946a); FUN_004104cc(); FUN_00412104(1); return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address undefined4 __stdcall FUN_00412bcd(void) { FUN_00411df1(); FUN_00412104(0); FUN_0040ca43(DAT_0044f018 + 0x37,DAT_0044f01a + 0xf); _DAT_0044f01c = DAT_0044f018; _DAT_0044f01e = DAT_0044f01a; return 0; } void __cdecl FUN_00412c17(short param_1) { undefined2 *puVar1; undefined4 uVar2; short sVar3; if (param_1 == 0) { free_tracked_heap_block((int)DAT_0044f00c); } DAT_0044f010 = 0; sVar3 = 0; do { if (null_ARRAY_0044f020[sVar3] != 0) { DAT_0044f010 = DAT_0044f010 + 1; } sVar3 = sVar3 + 1; } while (sVar3 < 5); puVar1 = (undefined2 *)alloc_tracked_heap_block((DAT_0044f010 + 1) * 0x10); sVar3 = 0; DAT_0044f00c = puVar1; do { if (null_ARRAY_0044f020[sVar3] != 0) { *puVar1 = struct_unk_2_ARRAY_0044942c[sVar3].field0_0x0; puVar1[1] = struct_unk_2_ARRAY_0044942c[sVar3].field1_0x2; uVar2 = aseq_get_img_w((int)PTR_ARRAY_0044f9ac[sVar3],0); puVar1[2] = (short)uVar2; uVar2 = aseq_get_img_h((int)PTR_ARRAY_0044f9ac[sVar3],0); puVar1[3] = (short)uVar2; *(aseq_cursor_struct **)(puVar1 + 6) = battery_puzzle_cursor_aseq_more[sVar3]; puVar1[5] = 0; puVar1 = puVar1 + 8; } sVar3 = sVar3 + 1; } while (sVar3 < 5); *puVar1 = 0; puVar1[1] = 5; puVar1[3] = 0x17a; puVar1[2] = 0x1ff; *(aseq_cursor_struct **)(puVar1 + 6) = battery_puzzle_cursor_aseq_more[5]; puVar1[5] = 0; set_cursor_override_regions((int)DAT_0044f00c,DAT_0044f010 + 1); return; } void __stdcall clear_cursor_override_regions(void) { set_cursor_override_regions(0,0); return; } void __stdcall FUN_00412d3e(void) { FUN_00412c17(0); return; } void __stdcall FUN_00412d4b(void) { short sVar1; DAT_0044f014 = 1; if (DAT_00449470 != 0) { if (DAT_00449470 == 2) { sVar1 = null_ARRAY_0044f020[DAT_0044f030]; null_ARRAY_0044f020[DAT_0044f030] = null_ARRAY_0044f020[DAT_0044f030] + 1; if (sVar1 == 0) { anim_state_xxx_list_insert_8004((undefined4 *)PTR_ARRAY_0044f9ac[DAT_0044f030]); } DAT_0044f030 = 99; FUN_00412d3e(); } else if (DAT_00449470 == 5) { null_ARRAY_0044f020[4] = null_ARRAY_0044f020[4] + 1; anim_engine_remove_cb(DAT_0044f016); *(undefined2 *)(DAT_0044f02c * 0x4e + 0x44f088 + DAT_0044f02e * 0x1a) = 99; FUN_00412d3e(); } } DAT_00449470 = 0; return; } void __stdcall energy_puzzle_on_load(void) { DAT_0044fd58 = 0; DAT_0044fd60 = 0; load_and_draw_score(); on_deactivate_xtra_cb = FUN_00416f16; FUN_0043d7c1(FUN_00416e98); energy_puzzle_load_puzzle(puzzle_idx); load_rrgb_1(15000); energy_bg_aseq = (aseq_anim_state_struct *)load_aseq(15000); aseq_draw_to_both_fbs((int)energy_bg_aseq,0,0,0); free_aseq((int *)energy_bg_aseq); energy_setup_mouse_regions(); energy_puzzle_clean_up_and_redraw(); DAT_0044fbd2 = 0x10e012c; DAT_0044fbd6 = 0x64012c; DAT_0044fbdc = 0x10e012c; DAT_0044fbe0 = 0x64012c; DAT_0044fbe4 = DAT_0044fbda; key_xxxxx_set(FUN_004167ac); energy_dot_aseq = (aseq_anim_state_struct *)load_aseq(15062); FUN_0041711b(); wave_load_list[0] = 0x1f73; wave_load_list[1] = 0x1f5c; wave_load_list[2] = 0x4a49; wave_load_list[3] = 0x4a4a; wave_load_list[4] = 0x4a4c; wave_load_list[5] = 0x4a55; wave_load_list[6] = SHORT_ARRAY_0044fbea[0]; wave_load_list[7] = SHORT_ARRAY_0044fbea[1]; wave_load_list[8] = SHORT_ARRAY_0044fbea[2]; wave_load_list[9] = SHORT_ARRAY_0044fbea[3]; wave_load_list[10] = 0x4a78; wave_load_list[0xb] = -1; load_waves_from_list(0x451486); energy_hand_aseq = (aseq_anim_state_struct *)load_aseq(15063); energy_pencil_0_aseq = (aseq_anim_state_struct *)load_aseq(15007); energy_pencil_1_aseq = (aseq_anim_state_struct *)load_aseq(15007); energy_eraser_aseq = (aseq_anim_state_struct *)load_aseq(15008); energy_hand_cursor = (aseq_cursor_struct *)aseq_setup_as_cursor((int)energy_hand_aseq,0,0); energy_eraser_cursor = (aseq_cursor_struct *)aseq_setup_as_cursor((int)energy_eraser_aseq,0,0x24); energy_pencil_cursor_0 = (aseq_cursor_struct *)aseq_setup_as_cursor((int)energy_pencil_0_aseq,0,0) ; energy_pencil_cursor_00 = (aseq_cursor_struct *)aseq_setup_as_cursor((int)energy_pencil_0_aseq,0,0); energy_hand_cursor->enable_clip_cursor = 0; energy_eraser_cursor->enable_clip_cursor = 0; energy_pencil_cursor_0->enable_clip_cursor = 0; energy_puzzle_set_cursor_regions(1); FUN_00422170(); DAT_0044fd5a = 0x14; DAT_0044fd5c = 0x14; aseq_anim_override_timing((int)energy_dot_aseq,0x3c,1); return; } void __stdcall energy_puzzle_on_remove(void) { short sVar1; aseq_anim_set_cmd_0x400_handler((int)energy_dot_aseq,0,0); FUN_00431029(); free_tracked_heap_block((int)PTR_0044fd3c); set_cursor_override_regions(0,0); free_aseq((int *)energy_pencil_0_aseq); free_aseq((int *)energy_eraser_aseq); free_aseq((int *)energy_hand_aseq); free_aseq((int *)energy_pencil_1_aseq); aseq_free_cursor((int)energy_pencil_cursor_00); aseq_free_cursor((int)energy_hand_cursor); aseq_free_cursor((int)energy_eraser_cursor); aseq_free_cursor((int)energy_pencil_cursor_0); FUN_00430ef4(0x451486); DAT_004514ae = DAT_004494b4; on_deactivate_xtra_cb = (undefined *)0x0; FUN_0043d7c1(0); key_xxxxx_clear(); mouse_region_delete_all_lists(); free_aseq((int *)energy_check_aseq); free_aseq((int *)energy_hint_aseq); free_aseq((int *)energy_go_back_aseq); free_aseq((int *)energy_pencil_write_aseq); free_aseq((int *)energy_dot_aseq); if (DAT_004514b0 != 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; } sVar1 = 0; do { if (energy_rhs[sVar1].aseq_idx != -1) { free_aseq((int *)energy_rhs_anim_aseq[sVar1]); free_aseq((int *)energy_rhs_circles_aseq[sVar1]); } if (energy_lhs[sVar1].energy_type != -1) { free_aseq((int *)energy_lhs_circles_aseq[sVar1]); } sVar1 = sVar1 + 1; } while (sVar1 < 4); FUN_0042211c(); return; } void __stdcall energy_puzzle_on_periodic(void) { short sVar1; short sVar2; undefined4 uVar3; new_player_hint(0xf); if (DAT_0044fd58 == 0) { DAT_0044fd58 = 1; DAT_004514b0 = DAT_004514c4; load_wave_flag_2(DAT_004514c4); play_wave_flag2(DAT_004514b0); } switch(energy_puzzle_state) { case 0: sVar2 = aseq_anim_get_flags((int)energy_rhs_anim_aseq[DAT_0044fbc8]); if (sVar2 != 4) { stop_playing_wave_by_id_type1(SHORT_ARRAY_0044fbea[DAT_0044fbc8]); *(undefined2 *)(DAT_0044fca4 * 0x1a + 0x44fbfc + DAT_0044fca2 * 2) = 1; play_wave_flag1(0x4a55,5,0); FUN_00416fa8(DAT_0044949e,SHORT_ARRAY_004494a0[DAT_0044fca4],DAT_0044949c, SHORT_ARRAY_004494a0[DAT_0044fca2],0,2); return; } break; case 1: if (energy_matches_left_to_use == 0) { energy_puzzle_state = 3; energy_puzzle_set_cursor_regions(0); return; } break; case 6: if ((*(short *)(DAT_0044fca2 * 0x1a + 0x44fc04 + DAT_0044fca4 * 2) != 0) && (*(short *)(DAT_0044fca4 * 0x1a + 0x44fbfc + DAT_0044fca2 * 2) == 0)) { play_wave_flag1(0x4a55,5,0); FUN_00416fa8(DAT_0044949c,SHORT_ARRAY_004494a0[DAT_0044fca2],DAT_0044949e, SHORT_ARRAY_004494a0[DAT_0044fca4],0,0); return; } DAT_0044fca4 = DAT_0044fca4 + 1; if (DAT_0044fca4 == 4) { DAT_0044fca4 = 0; DAT_0044fca2 = DAT_0044fca2 + 1; if (DAT_0044fca2 == 4) { DAT_0044fca2 = 0; energy_puzzle_state = DAT_0044fbc6; if ((DAT_004494b4 == 0) && (uVar3 = energy_puzzle_is_complete(), (short)uVar3 != 0)) { DAT_004494b4 = 1; clear_cursor_override_regions(); solved_the_puzzle(0x4a78); energy_puzzle_set_cursor_regions_wrap(); inc_score_by_400(); mouse_region_new_up(10,0x140,0x14e,0x3c,0x19,0x413c8b); return; } } } break; case 8: xxxfunc_set(&puzzle_choosing_funcset_xxx); break; case 9: sVar1 = aseq_anim_get_flags((int)energy_dot_aseq); sVar2 = DAT_0044fbc4; if (sVar1 != 4) { if (DAT_0044fbc4 == DAT_0044fbc2) { aseq_anim_set_cmd_0x400_handler((int)energy_dot_aseq,0,0); anim_state_xxx_list_remove((int *)energy_dot_aseq); DAT_0044fd60 = 0; energy_puzzle_state = 0xd; return; } DAT_0044fd5a = (&DAT_0044fa32)[DAT_0044fbc4]; DAT_0044fbc4 = DAT_0044fbc4 + 1; DAT_0044fd5c = (&DAT_0044fa32)[DAT_0044fbc4]; DAT_0044fbc4 = sVar2 + 2; aseq_anim_flags_make_2((int)energy_dot_aseq); aseq_anim_reset_and_play((undefined4 *)energy_dot_aseq); return; } break; case 10: if (*(short *)(DAT_0044fca4 * 0x12 + 0x44fc5c + energy_lhs[DAT_0044fca2].energy_type * 2) != 0) { DAT_0044fbc8 = DAT_0044fca4; FUN_004166d6(); return; } *(undefined2 *)(DAT_0044fca2 * 0x1a + 0x44fc04 + DAT_0044fca4 * 2) = 0; energy_matches_left_to_use = energy_matches_left_to_use + 1; energy_draw_matches_left_to_use(); gfxish_copy_otherbuf_to_dest_and_invalidate(0xfa,0x28,0x6e,0x10e); FUN_004167cd(); play_wave_flag1(0x4a55,5,0); FUN_00416fa8(DAT_0044949e,SHORT_ARRAY_004494a0[DAT_0044fca4],DAT_0044949c, SHORT_ARRAY_004494a0[DAT_0044fca2],1,1); DAT_0044fd60 = 1; return; case 0xb: energy_puzzle_state = 6; DAT_0044fca4 = DAT_0044fca4 + 1; if (DAT_0044fca4 == 4) { DAT_0044fca4 = 0; DAT_0044fca2 = DAT_0044fca2 + 1; if (DAT_0044fca2 == 4) { DAT_0044fca2 = 0; energy_puzzle_state = DAT_0044fbc6; if ((DAT_004494b4 == 0) && (uVar3 = energy_puzzle_is_complete(), (short)uVar3 != 0)) { DAT_004494b4 = 1; clear_cursor_override_regions(); solved_the_puzzle(0x4a78); energy_puzzle_set_cursor_regions_wrap(); inc_score_by_400(); mouse_region_new_up(10,0x140,0x14e,0x3c,0x19,0x413c8b); return; } } } break; case 0xc: energy_puzzle_state = 6; DAT_0044fca4 = DAT_0044fca4 + 1; if (DAT_0044fca4 == 4) { DAT_0044fca4 = 0; DAT_0044fca2 = DAT_0044fca2 + 1; if (DAT_0044fca2 == 4) { DAT_0044fca2 = 0; energy_puzzle_state = DAT_0044fbc6; if ((DAT_004494b4 == 0) && (uVar3 = energy_puzzle_is_complete(), (short)uVar3 != 0)) { DAT_004494b4 = 1; clear_cursor_override_regions(); solved_the_puzzle(0x4a78); energy_puzzle_set_cursor_regions_wrap(); inc_score_by_400(); mouse_region_new_up(10,0x140,0x14e,0x3c,0x19,0x413c8b); return; } } } break; case 0xd: energy_puzzle_state = DAT_0044fd5e; gfxish_copy_otherbuf_to_dest_and_invalidate(0xfa,0x28,0x6e,0x10e); FUN_004167cd(); return; } return; } void __stdcall energy_puzzle_draw_text(void) { short sVar1; int iVar2; short sVar3; char *pcVar4; undefined **ppuVar5; short sVar6; byte *pbVar7; undefined4 *puVar8; undefined4 local_220 [8]; byte local_200 [256]; byte local_100 [252]; sVar6 = 0x46; pcVar4 = s_Congratulations__You_solved_the_p_004494c4; pbVar7 = local_200; for (iVar2 = 0x40; iVar2 != 0; iVar2 = iVar2 + -1) { *(undefined4 *)pbVar7 = *(undefined4 *)pcVar4; pcVar4 = pcVar4 + 4; pbVar7 = pbVar7 + 4; } ppuVar5 = &energy_puzzle_types; puVar8 = local_220; for (iVar2 = 8; iVar2 != 0; iVar2 = iVar2 + -1) { *puVar8 = *ppuVar5; ppuVar5 = ppuVar5 + 1; puVar8 = puVar8 + 1; } load_nfnt(15000); sVar3 = 0; do { if (energy_lhs[sVar3].energy_type != -1) { sVar1 = nfnt_get_text_width(15000,(byte *)local_220[energy_lhs[sVar3].energy_type]); FUN_0043dc0b(15000,(byte *)local_220[energy_lhs[sVar3].energy_type],0xeb - sVar1,sVar6,0); } sVar6 = sVar6 + 0x41; sVar3 = sVar3 + 1; } while (sVar3 < 4); if (DAT_004494b4 == 0) { FUN_0043dc0b(15000,(byte *)s_Match_the_energy_forms_with_the_p_00449674,10,0x152,0); sprintf(local_100); FUN_0043dc0b(15000,local_100,10,0x166,0); FUN_0043dc0b(15000,(byte *)s_Then_check_your_answer__004496c8,10,0x17a,0); } else { FUN_0043e1b5(0); FUN_00401206(10,0x148,local_200); } energy_draw_matches_left_to_use(); free_nfnt(15000); return; } void __stdcall energy_setup_mouse_regions(void) { aseq_anim_state_struct *paVar1; mouse_region *pmVar2; short sVar3; short sVar4; short sVar5; sVar5 = 0x23; sVar4 = 0x3b; energy_check_aseq = (aseq_anim_state_struct *)load_aseq(15010); aseq_set_pos_order((int)energy_check_aseq,0x13,0xfc,10); energy_hint_aseq = (aseq_anim_state_struct *)load_aseq(15005); aseq_set_pos_order((int)energy_hint_aseq,0x13,0x1c,10); energy_go_back_aseq = (aseq_anim_state_struct *)load_aseq(15009); aseq_set_pos_order((int)energy_go_back_aseq,0x18e,0x143,10); energy_pencil_write_aseq = (aseq_anim_state_struct *)load_aseq(15011); aseq_set_pos_order((int)energy_pencil_write_aseq,0x14,0x78,10); sVar3 = 0; do { sVar3 = sVar3 + 1; } while (sVar3 < 4); sVar3 = 0; do { if (energy_lhs[sVar3].energy_type != -1) { paVar1 = (aseq_anim_state_struct *)load_aseq(15052); energy_lhs_circles_aseq[sVar3] = paVar1; aseq_set_pos_order((int)energy_lhs_circles_aseq[sVar3],0xfa,sVar4,10); pmVar2 = (mouse_region *) mouse_region_new_up(DAT_0044949c + -0xf,SHORT_ARRAY_004494a0[sVar3] + -0xf,0x1e,0x1e, 5,0x413d6b); energy_lhs_circles_mouse[sVar3] = pmVar2; energy_lhs_circles_mouse[sVar3]->extra_data = (int)sVar3; } if (energy_rhs[sVar3].aseq_idx != -1) { paVar1 = (aseq_anim_state_struct *)load_aseq(energy_rhs[sVar3].aseq_idx); energy_rhs_anim_aseq[sVar3] = paVar1; aseq_anim_override_timing((int)energy_rhs_anim_aseq[sVar3],6,0); aseq_set_pos_order((int)energy_rhs_anim_aseq[sVar3],DAT_004494aa,sVar5,10); paVar1 = (aseq_anim_state_struct *)load_aseq(15052); energy_rhs_circles_aseq[sVar3] = paVar1; aseq_set_pos_order((int)energy_rhs_circles_aseq[sVar3],0x14a,sVar4,10); pmVar2 = (mouse_region *) mouse_region_new_up(DAT_0044949e + -0xf,SHORT_ARRAY_004494a0[sVar3] + -0xf,0x1e,0x1e, 5,0x413d6b); energy_rhs_circles_mouse[sVar3] = pmVar2; energy_rhs_circles_mouse[sVar3]->extra_data = (int)sVar3 + 4; } sVar5 = sVar5 + 0x41; sVar4 = sVar4 + 0x41; sVar3 = sVar3 + 1; } while (sVar3 < 4); mouse_region_new_up(0,0,0x200,0x17c,0,0x413cfe); mouse_region_new_up(0x18e,0x144,100,0x30,5,0x413b75); mouse_region_new_up(0x13,0x1b,0x3a,0x30,5,0x416d22); mouse_region_new_up(0x10,0x6c,0x40,0x3d,5,0x413bd5); mouse_region_new_up(0x10,0xaa,0x40,0x41,5,0x413c24); mouse_region_new_up(0x13,0xf9,0x3a,0x30,5,0x413c64); return; } void __stdcall energy_puzzle_go_back(void) { int iVar1; iVar1 = (int)energy_puzzle_state; if (iVar1 != 0) { if (iVar1 != 3) { if (iVar1 - 4U < 2) { anim_engine_remove_cb(DAT_0044fa30); energy_pencil_cursor_0->enable_clip_cursor = 0; energy_puzzle_state = 1; } else if (iVar1 == 6) { return; } } if (energy_puzzle_state != 7) { anim_state_xxx_list_insert_4((undefined4 *)energy_go_back_aseq); energy_puzzle_state = 8; } } return; } int __stdcall energy_puzzle_draw_mode(void) { int iVar1; int iVar2; iVar1 = (int)energy_puzzle_state; iVar2 = iVar1 + -1; if ((iVar1 != 0) && (((iVar2 = 0, iVar1 == 3 || ((iVar2 = 0, iVar1 != 6 && (iVar2 = iVar1 + -0xd, 3 < iVar1 - 9U))) ) && (0 < energy_matches_left_to_use)))) { play_wave_flag1(0x1f73,5,0); energy_puzzle_state = 1; iVar2 = energy_puzzle_set_cursor_regions(0); } return iVar2; } int __stdcall energy_puzzle_erase_mode(void) { int iVar1; int iVar2; iVar1 = (int)energy_puzzle_state; iVar2 = iVar1 + -1; if (((iVar1 != 0) && (iVar2 = 0, iVar1 != 6)) && (iVar2 = iVar1 + -0xd, 3 < iVar1 - 9U)) { play_wave_flag1(0x1f73,5,0); energy_puzzle_state = 2; iVar2 = energy_puzzle_set_cursor_regions(0); } return iVar2; } void __stdcall energy_puzzle_check(void) { play_wave_flag1(0x1f5c,5,0); aseq_anim_reset_and_play((undefined4 *)energy_check_aseq); FUN_00416695(); return; } int __stdcall FUN_00413c8b(void) { int iVar1; iVar1 = energy_puzzle_state + -6; if ((int)energy_puzzle_state - 4U < 2) { anim_engine_remove_cb(DAT_0044fa30); energy_puzzle_state = 1; clip_cursor_disable(); energy_pencil_cursor_0->enable_clip_cursor = 0; clear_cursor_override_regions(); gfxish_copy_otherbuf_to_dest_and_invalidate(0xfa,0x28,0x6e,0x10e); FUN_004167cd(); iVar1 = energy_puzzle_set_cursor_regions_wrap(); } DAT_004514f6 = 1; energy_puzzle_state = 8; return iVar1; } int __stdcall energy_puzzle_mouse_on_bg(void) { int iVar1; iVar1 = (int)energy_puzzle_state; if (iVar1 == 2) { iVar1 = FUN_00416a9e(); return iVar1; } if (1 < iVar1 - 4U) { return iVar1 + -6; } anim_engine_remove_cb(DAT_0044fa30); energy_puzzle_state = 1; clip_cursor_disable(); energy_pencil_cursor_0->enable_clip_cursor = 0; clear_cursor_override_regions(); gfxish_copy_otherbuf_to_dest_and_invalidate(0xfa,0x28,0x6e,0x10e); FUN_004167cd(); iVar1 = energy_puzzle_set_cursor_regions_wrap(); return iVar1; } void __cdecl energy_puzzle_bubbles_mouse_handler(int param_1) { int iVar1; uint uVar2; if (energy_puzzle_state == 1) { switch(*(undefined4 *)(param_1 + 0x1e)) { case 0: energy_puzzle_state = 4; DAT_0044fbda = 0; DAT_0044fbd2._0_2_ = DAT_0044949c; DAT_0044fbd2._2_2_ = SHORT_ARRAY_004494a0[0]; break; case 1: energy_puzzle_state = 4; DAT_0044fbda = 1; DAT_0044fbd2._0_2_ = DAT_0044949c; DAT_0044fbd2._2_2_ = SHORT_ARRAY_004494a0[1]; break; case 2: energy_puzzle_state = 4; DAT_0044fbda = 2; DAT_0044fbd2._0_2_ = DAT_0044949c; DAT_0044fbd2._2_2_ = SHORT_ARRAY_004494a0[2]; break; case 3: energy_puzzle_state = 4; DAT_0044fbda = 3; DAT_0044fbd2._0_2_ = DAT_0044949c; DAT_0044fbd2._2_2_ = SHORT_ARRAY_004494a0[3]; break; case 4: energy_puzzle_state = 5; DAT_0044fbda = 0; DAT_0044fbd2._0_2_ = DAT_0044949e; DAT_0044fbd2._2_2_ = SHORT_ARRAY_004494a0[0]; break; case 5: energy_puzzle_state = 5; DAT_0044fbda = 1; DAT_0044fbd2._0_2_ = DAT_0044949e; DAT_0044fbd2._2_2_ = SHORT_ARRAY_004494a0[1]; break; case 6: energy_puzzle_state = 5; DAT_0044fbda = 2; DAT_0044fbd2._0_2_ = DAT_0044949e; DAT_0044fbd2._2_2_ = SHORT_ARRAY_004494a0[2]; break; case 7: energy_puzzle_state = 5; DAT_0044fbda = 3; DAT_0044fbd2._0_2_ = DAT_0044949e; DAT_0044fbd2._2_2_ = SHORT_ARRAY_004494a0[3]; } clear_cursor_override_regions(); set_custom_cursor((undefined4 *)energy_pencil_cursor_00); uVar2 = anim_engine_add_cb(FUN_00416c5b,1); DAT_0044fa30 = (ushort)uVar2; play_wave_flag1(0x4a49,5,0); energy_pencil_cursor_0->enable_clip_cursor = 1; clip_cursor_enable(0xfa,0x28,0x82,0x10e); return; } if (energy_puzzle_state == 2) { FUN_00416a9e(); } else if (energy_puzzle_state == 4) { if (*(short *)(DAT_0044fbda * 0x1a + 0x44fbfc + *(int *)(param_1 + 0x1e) * 2) != 1) { iVar1 = *(int *)(param_1 + 0x1e); if (iVar1 == 4) { energy_puzzle_state = 1; energy_lhs[DAT_0044fbda].field3_0x12[0] = 1; } else if (iVar1 == 5) { energy_puzzle_state = 1; energy_lhs[DAT_0044fbda].field3_0x12[1] = 1; } else if (iVar1 == 6) { energy_puzzle_state = 1; energy_lhs[DAT_0044fbda].field3_0x12[2] = 1; } else if (iVar1 == 7) { energy_puzzle_state = 1; energy_lhs[DAT_0044fbda].field3_0x12[3] = 1; } if ((((*(int *)(param_1 + 0x1e) == 4) || (*(int *)(param_1 + 0x1e) == 5)) || (*(int *)(param_1 + 0x1e) == 6)) || (*(int *)(param_1 + 0x1e) == 7)) { anim_engine_remove_cb(DAT_0044fa30); clear_cursor_override_regions(); gfxish_copy_otherbuf_to_dest_and_invalidate(0xfa,0x28,0x6e,0x10e); FUN_004167cd(); if (*(short *)(*(int *)(param_1 + 0x1e) * 0x12 + 0x44fc14 + energy_lhs[DAT_0044fbda].energy_type * 2) != 0) { *(undefined2 *)(DAT_0044fbda * 0x1a + 0x44fbec + *(int *)(param_1 + 0x1e) * 2) = 1; } energy_matches_left_to_use = energy_matches_left_to_use + -1; energy_draw_matches_left_to_use(); play_wave_flag1(0x4a4a,5,0); energy_pencil_cursor_0->enable_clip_cursor = 0; clip_cursor_disable(); energy_puzzle_set_cursor_regions_wrap(); return; } } } else { if (energy_puzzle_state != 5) { return; } if (*(short *)(*(int *)(param_1 + 0x1e) * 0x1a + 0x44fc04 + DAT_0044fbda * 2) != 1) { iVar1 = *(int *)(param_1 + 0x1e); if (iVar1 == 0) { energy_puzzle_state = 1; energy_lhs[0].field3_0x12[DAT_0044fbda] = 1; } else if (iVar1 == 1) { energy_puzzle_state = 1; energy_lhs[1].field3_0x12[DAT_0044fbda] = 1; } else if (iVar1 == 2) { energy_puzzle_state = 1; energy_lhs[2].field3_0x12[DAT_0044fbda] = 1; } else if (iVar1 == 3) { energy_puzzle_state = 1; energy_lhs[3].field3_0x12[DAT_0044fbda] = 1; } if (((*(int *)(param_1 + 0x1e) == 0) || (*(int *)(param_1 + 0x1e) == 1)) || ((*(int *)(param_1 + 0x1e) == 2 || (*(int *)(param_1 + 0x1e) == 3)))) { anim_engine_remove_cb(DAT_0044fa30); clear_cursor_override_regions(); gfxish_copy_otherbuf_to_dest_and_invalidate(0xfa,0x28,0x6e,0x10e); FUN_004167cd(); if (*(short *)(DAT_0044fbda * 0x12 + 0x44fc5c + energy_lhs[*(int *)(param_1 + 0x1e)].energy_type * 2) != 0) { *(undefined2 *)(*(int *)(param_1 + 0x1e) * 0x1a + 0x44fbf4 + DAT_0044fbda * 2) = 1; } energy_matches_left_to_use = energy_matches_left_to_use + -1; energy_draw_matches_left_to_use(); play_wave_flag1(0x4a4a,5,0); energy_puzzle_set_cursor_regions_wrap(); energy_pencil_cursor_0->enable_clip_cursor = 0; clip_cursor_disable(); return; } } } return; } void __cdecl FUN_0041425f(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4, undefined4 param_5) { FUN_00414394(param_4,param_5); FUN_0041654c((short)param_1,param_1._2_2_,(short)param_2,param_2._2_2_); return; } void __stdcall energy_puzzle_clean_up_and_redraw(void) { short sVar1; anim_state_xxx_list_remove((int *)energy_pencil_write_aseq); anim_state_xxx_list_insert_8004((undefined4 *)energy_pencil_write_aseq); anim_state_xxx_list_remove((int *)energy_check_aseq); anim_state_xxx_list_insert_4((undefined4 *)energy_check_aseq); anim_state_xxx_list_remove((int *)energy_hint_aseq); anim_state_xxx_list_remove((int *)energy_go_back_aseq); sVar1 = 0; do { if (energy_rhs[sVar1].aseq_idx != -1) { anim_state_xxx_list_remove((int *)energy_rhs_anim_aseq[sVar1]); if (energy_rhs[sVar1].connections[7] == 1) { anim_state_xxx_list_insert_4((undefined4 *)energy_rhs_anim_aseq[sVar1]); } else { anim_state_xxx_list_insert_8004((undefined4 *)energy_rhs_anim_aseq[sVar1]); } anim_state_xxx_list_remove((int *)energy_rhs_circles_aseq[sVar1]); anim_state_xxx_list_insert_8004((undefined4 *)energy_rhs_circles_aseq[sVar1]); } if (energy_lhs[sVar1].energy_type != -1) { anim_state_xxx_list_remove((int *)energy_lhs_circles_aseq[sVar1]); anim_state_xxx_list_insert_8004((undefined4 *)energy_lhs_circles_aseq[sVar1]); } sVar1 = sVar1 + 1; } while (sVar1 < 4); energy_puzzle_draw_text(); return; } void __cdecl FUN_00414394(undefined4 param_1,undefined4 param_2) { short sVar1; short local_6; short sVar2; sVar1 = (short)param_1; sVar2 = (short)param_2; if ((short)param_2 < (short)param_1) { sVar1 = (short)param_2; sVar2 = (short)param_1; } if (param_2._2_2_ < param_1._2_2_) { local_6 = param_1._2_2_; } else { local_6 = param_2._2_2_; param_2._2_2_ = param_1._2_2_; } gfxish_copy_otherbuf_to_dest_and_invalidate (sVar1,param_2._2_2_,(sVar2 - sVar1) + 1,(local_6 - param_2._2_2_) + 1); gfxish_invalidate_rect_wrap(sVar1,param_2._2_2_,(sVar2 - sVar1) + 1,(local_6 - param_2._2_2_) + 1) ; return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __cdecl energy_puzzle_load_puzzle(short param_1) { short sVar1; short sVar2; energy_puzzle_reset_structs(); if (0x21 < param_1) { param_1 = 1; } switch(param_1) { case 1: DAT_004514be = 4; DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3a9e; SHORT_ARRAY_004514ec[1] = 0x3a9d; SHORT_ARRAY_004514ec[2] = 15000; SHORT_ARRAY_004514ec[3] = 0x3a9a; SHORT_ARRAY_004514ce[0] = 0x3aa4; SHORT_ARRAY_004514ce[1] = 0x3aa5; SHORT_ARRAY_004514ce[2] = 0x3aa6; SHORT_ARRAY_004514ce[3] = 0x3aa3; SHORT_ARRAY_004514ce[4] = 15000; SHORT_ARRAY_004514ce[5] = 0x3a99; SHORT_ARRAY_004514ce[6] = 0x3a9a; SHORT_ARRAY_004514ce[7] = 0x3a9b; SHORT_ARRAY_004514ce[8] = 0x3a9e; SHORT_ARRAY_004514ce[9] = 0x3a9f; SHORT_ARRAY_004514ce[10] = -1; SHORT_ARRAY_0044fbea[0] = 0x4a3b; SHORT_ARRAY_0044fbea[1] = 0x4a5d; SHORT_ARRAY_0044fbea[2] = 0x4a5e; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 3; energy_matches_left_to_use = 3; energy_lhs[0].energy_type = 0; energy_lhs[1].energy_type = 2; energy_lhs[2].energy_type = 4; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 15024; energy_rhs[0].connections[2] = 1; energy_rhs[1].aseq_idx = 0x3ac1; energy_rhs[1].connections[4] = 1; energy_rhs[2].aseq_idx = 0x3ac5; energy_rhs[2].connections[0] = 1; energy_rhs[3].aseq_idx = -1; break; case 2: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3aa0; SHORT_ARRAY_004514ec[1] = 0x3a99; SHORT_ARRAY_004514ec[2] = 0x3a9d; SHORT_ARRAY_004514ec[3] = 0x3a9a; DAT_004514be = 8; SHORT_ARRAY_004514ce[0] = 0x3aaa; SHORT_ARRAY_004514ce[1] = 0x3aab; SHORT_ARRAY_004514ce[2] = 0x3aac; SHORT_ARRAY_004514ce[3] = 0x3a9c; SHORT_ARRAY_004514ce[4] = 0x3a9d; SHORT_ARRAY_004514ce[5] = 0x3aa3; SHORT_ARRAY_004514ce[6] = 0x3a9e; SHORT_ARRAY_004514ce[7] = 0x3a9f; SHORT_ARRAY_004514ce[8] = -1; SHORT_ARRAY_0044fbea[0] = 0x4a74; SHORT_ARRAY_0044fbea[1] = 0x4a58; SHORT_ARRAY_0044fbea[2] = 0x4a73; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 3; energy_matches_left_to_use = 3; energy_lhs[0].energy_type = 3; energy_lhs[1].energy_type = 0; energy_lhs[2].energy_type = 4; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3ac6; energy_rhs[0].connections[3] = 1; energy_rhs[1].aseq_idx = 0x3ac4; energy_rhs[1].connections[4] = 1; energy_rhs[2].aseq_idx = 0x3ad0; energy_rhs[2].connections[0] = 1; energy_rhs[3].aseq_idx = -1; break; case 3: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3aa0; SHORT_ARRAY_004514ec[1] = 0x3a9c; SHORT_ARRAY_004514ec[2] = 0x3a99; SHORT_ARRAY_004514ec[3] = 0x3a9d; DAT_004514be = 7; SHORT_ARRAY_004514ce[0] = 0x3aaa; SHORT_ARRAY_004514ce[1] = 0x3aab; SHORT_ARRAY_004514ce[2] = 0x3aac; SHORT_ARRAY_004514ce[3] = 0x3aa2; SHORT_ARRAY_004514ce[4] = 0x3a9c; SHORT_ARRAY_004514ce[5] = 0x3a9d; SHORT_ARRAY_004514ce[6] = 0x3aa3; SHORT_ARRAY_004514ce[7] = -1; SHORT_ARRAY_0044fbea[0] = 0x4a74; SHORT_ARRAY_0044fbea[1] = 0x4a50; SHORT_ARRAY_0044fbea[2] = 0x4a41; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 3; energy_matches_left_to_use = 3; energy_lhs[0].energy_type = 1; energy_lhs[1].energy_type = 3; energy_lhs[2].energy_type = 0; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3a9a; energy_rhs[0].connections[3] = 1; energy_rhs[1].aseq_idx = 0x3ad2; energy_rhs[1].connections[0] = 1; energy_rhs[2].aseq_idx = 0x3a99; energy_rhs[2].connections[1] = 1; energy_rhs[3].aseq_idx = -1; break; case 4: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3a9f; SHORT_ARRAY_004514ec[1] = 15000; SHORT_ARRAY_004514ec[2] = 0x3a99; SHORT_ARRAY_004514ec[3] = 0x3a9d; DAT_004514be = 10; SHORT_ARRAY_004514ce[0] = 0x3aa7; SHORT_ARRAY_004514ce[1] = 0x3aa8; SHORT_ARRAY_004514ce[2] = 0x3aa9; SHORT_ARRAY_004514ce[3] = 15000; SHORT_ARRAY_004514ce[4] = 0x3a99; SHORT_ARRAY_004514ce[5] = 0x3a9a; SHORT_ARRAY_004514ce[6] = 0x3a9b; SHORT_ARRAY_004514ce[7] = 0x3a9c; SHORT_ARRAY_004514ce[8] = 0x3a9d; SHORT_ARRAY_004514ce[9] = 0x3aa3; SHORT_ARRAY_004514ce[10] = -1; SHORT_ARRAY_0044fbea[0] = 0x4a54; SHORT_ARRAY_0044fbea[1] = 0x4a53; SHORT_ARRAY_0044fbea[2] = 0x4a3b; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 3; energy_matches_left_to_use = 3; energy_lhs[0].energy_type = 2; energy_lhs[1].energy_type = 3; energy_lhs[2].energy_type = 0; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3ac0; energy_rhs[0].connections[3] = 1; energy_rhs[1].aseq_idx = 0x3ac8; energy_rhs[1].connections[0] = 1; energy_rhs[2].aseq_idx = 0x3ab0; energy_rhs[2].connections[2] = 1; energy_rhs[3].aseq_idx = -1; break; case 5: DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3a9c; SHORT_ARRAY_004514ec[1] = 0x3aa1; SHORT_ARRAY_004514ec[2] = 0x3a9d; DAT_004514be = 5; SHORT_ARRAY_004514ce[0] = 0x3aa2; SHORT_ARRAY_004514ce[1] = 0x3aad; SHORT_ARRAY_004514ce[2] = 0x3aae; SHORT_ARRAY_004514ce[3] = 0x3aaf; SHORT_ARRAY_004514ce[4] = 0x3aa3; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 3; energy_matches_left_to_use = 3; energy_lhs[0].energy_type = 1; energy_lhs[1].energy_type = 5; energy_lhs[2].energy_type = 0; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3acf; energy_rhs[0].connections[0] = 1; energy_rhs[1].aseq_idx = 0x3a99; energy_rhs[1].connections[1] = 1; energy_rhs[2].aseq_idx = 0x3abd; energy_rhs[2].connections[5] = 1; energy_rhs[3].aseq_idx = -1; break; case 6: DAT_004514c0 = 2; SHORT_ARRAY_004514ec[0] = 0x3a9d; SHORT_ARRAY_004514ec[1] = 0x3a9a; DAT_004514be = 3; SHORT_ARRAY_004514ce[0] = 0x3aa3; SHORT_ARRAY_004514ce[1] = 0x3a9e; SHORT_ARRAY_004514ce[2] = 0x3a9f; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = 0x4a5d; energy_num_matches = 4; energy_matches_left_to_use = 4; energy_lhs[0].energy_type = -1; energy_lhs[1].energy_type = 0; energy_lhs[2].energy_type = 4; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3ad1; energy_rhs[0].connections[4] = 1; energy_rhs[1].aseq_idx = 0x3ad0; energy_rhs[1].connections[0] = 1; energy_rhs[2].aseq_idx = 0x3a9c; energy_rhs[2].connections[0] = 1; energy_rhs[3].aseq_idx = 0x3ac1; energy_rhs[3].connections[4] = 1; break; case 7: DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3a9d; SHORT_ARRAY_004514ec[1] = 0x3a9a; SHORT_ARRAY_004514ec[2] = 0x3a99; DAT_004514be = 4; SHORT_ARRAY_004514ce[0] = 0x3aa3; SHORT_ARRAY_004514ce[1] = 0x3a9e; SHORT_ARRAY_004514ce[2] = 0x3a9f; SHORT_ARRAY_004514ce[3] = 0x3a9c; SHORT_ARRAY_004514ce[4] = 0x3a9d; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = 0x4a5e; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 4; energy_matches_left_to_use = 4; energy_lhs[0].energy_type = 0; energy_lhs[1].energy_type = 4; energy_lhs[2].energy_type = 3; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3acb; energy_rhs[0].connections[3] = 1; energy_rhs[0].connections[4] = 1; energy_rhs[1].aseq_idx = 0x3ad3; energy_rhs[1].connections[4] = 1; energy_rhs[2].aseq_idx = 0x3ac5; energy_rhs[2].connections[0] = 1; energy_rhs[3].aseq_idx = -1; break; case 8: DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3a9c; SHORT_ARRAY_004514ec[1] = 0x3a9a; SHORT_ARRAY_004514ec[2] = 0x3a9d; DAT_004514be = 4; SHORT_ARRAY_004514ce[0] = 0x3aa2; SHORT_ARRAY_004514ce[1] = 0x3a9e; SHORT_ARRAY_004514ce[2] = 0x3a9f; SHORT_ARRAY_004514ce[3] = 0x3aa3; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_0044fbea[0] = 0x4a5d; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 4; energy_matches_left_to_use = 4; energy_lhs[0].energy_type = 1; energy_lhs[1].energy_type = 4; energy_lhs[2].energy_type = 0; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3ac1; energy_rhs[0].connections[4] = 1; energy_rhs[1].aseq_idx = 0x3ac4; energy_rhs[1].connections[1] = 1; energy_rhs[1].connections[4] = 1; energy_rhs[2].aseq_idx = 0x3a9c; energy_rhs[2].connections[0] = 1; energy_rhs[3].aseq_idx = -1; break; case 9: DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3a9d; SHORT_ARRAY_004514ec[1] = 0x3a99; SHORT_ARRAY_004514ec[2] = 0x3a9c; DAT_004514be = 4; SHORT_ARRAY_004514ce[0] = 0x3aa3; SHORT_ARRAY_004514ce[1] = 0x3a9c; SHORT_ARRAY_004514ce[2] = 0x3a9d; SHORT_ARRAY_004514ce[3] = 0x3aa2; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 4; energy_matches_left_to_use = 4; energy_lhs[0].energy_type = 0; energy_lhs[1].energy_type = 3; energy_lhs[2].energy_type = 1; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3ad5; energy_rhs[0].connections[3] = 1; energy_rhs[0].connections[1] = 1; energy_rhs[1].aseq_idx = 0x3ad4; energy_rhs[1].connections[1] = 1; energy_rhs[2].aseq_idx = 0x3ad2; energy_rhs[2].connections[0] = 1; energy_rhs[3].aseq_idx = -1; break; case 10: DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3a99; SHORT_ARRAY_004514ec[1] = 0x3a9c; SHORT_ARRAY_004514ec[2] = 0x3a9d; DAT_004514be = 4; SHORT_ARRAY_004514ce[0] = 0x3a9c; SHORT_ARRAY_004514ce[1] = 0x3a9d; SHORT_ARRAY_004514ce[2] = 0x3aa2; SHORT_ARRAY_004514ce[3] = 0x3aa3; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = 0x4a53; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 5; energy_matches_left_to_use = 5; energy_lhs[0].energy_type = 3; energy_lhs[1].energy_type = 1; energy_lhs[2].energy_type = 0; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3acb; energy_rhs[0].connections[3] = 1; energy_rhs[0].connections[1] = 1; energy_rhs[1].aseq_idx = 0x3ad1; energy_rhs[1].connections[3] = 1; energy_rhs[1].connections[1] = 1; energy_rhs[2].aseq_idx = 0x3ac8; energy_rhs[2].connections[0] = 1; energy_rhs[3].aseq_idx = -1; break; case 0xb: DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3a99; SHORT_ARRAY_004514ec[1] = 0x3a9c; SHORT_ARRAY_004514ec[2] = 0x3a9d; DAT_004514be = 4; SHORT_ARRAY_004514ce[0] = 0x3a9c; SHORT_ARRAY_004514ce[1] = 0x3a9d; SHORT_ARRAY_004514ce[2] = 0x3aa2; SHORT_ARRAY_004514ce[3] = 0x3aa3; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 4; energy_matches_left_to_use = 4; energy_lhs[0].energy_type = 3; energy_lhs[1].energy_type = 1; energy_lhs[2].energy_type = 0; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3ad4; energy_rhs[0].connections[1] = 1; energy_rhs[1].aseq_idx = 0x3ad2; energy_rhs[1].connections[0] = 1; energy_rhs[2].aseq_idx = 0x3ad1; energy_rhs[2].connections[3] = 1; energy_rhs[2].connections[1] = 1; energy_rhs[3].aseq_idx = -1; break; case 0xc: DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3a9c; SHORT_ARRAY_004514ec[1] = 0x3a9d; SHORT_ARRAY_004514ec[2] = 15000; DAT_004514be = 6; SHORT_ARRAY_004514ce[0] = 0x3aa2; SHORT_ARRAY_004514ce[1] = 0x3aa3; SHORT_ARRAY_004514ce[2] = 15000; SHORT_ARRAY_004514ce[3] = 0x3a99; SHORT_ARRAY_004514ce[4] = 0x3a9a; SHORT_ARRAY_004514ce[5] = 0x3a9b; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_0044fbea[0] = 0x4a5e; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 4; energy_matches_left_to_use = 4; energy_lhs[0].energy_type = 1; energy_lhs[1].energy_type = 0; energy_lhs[2].energy_type = 2; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3ac5; energy_rhs[0].connections[0] = 1; energy_rhs[1].aseq_idx = 0x3a9c; energy_rhs[1].connections[0] = 1; energy_rhs[2].aseq_idx = 0x3aae; energy_rhs[2].connections[0] = 1; energy_rhs[2].connections[2] = 1; energy_rhs[3].aseq_idx = -1; break; case 0xd: DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3a9d; SHORT_ARRAY_004514ec[1] = 0x3a99; SHORT_ARRAY_004514ec[2] = 0x3a9c; DAT_004514be = 4; SHORT_ARRAY_004514ce[0] = 0x3aa3; SHORT_ARRAY_004514ce[1] = 0x3a9c; SHORT_ARRAY_004514ce[2] = 0x3a9d; SHORT_ARRAY_004514ce[3] = 0x3aa2; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 5; energy_matches_left_to_use = 5; energy_lhs[0].energy_type = 0; energy_lhs[1].energy_type = 3; energy_lhs[2].energy_type = 1; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3ad1; energy_rhs[0].connections[3] = 1; energy_rhs[0].connections[1] = 1; energy_rhs[1].aseq_idx = 0x3a9a; energy_rhs[1].connections[3] = 1; energy_rhs[2].aseq_idx = 0x3ab3; energy_rhs[2].connections[0] = 1; energy_rhs[2].connections[3] = 1; energy_rhs[3].aseq_idx = -1; break; case 0xe: DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3a99; SHORT_ARRAY_004514ec[1] = 0x3a9d; SHORT_ARRAY_004514ec[2] = 15000; DAT_004514be = 7; SHORT_ARRAY_004514ce[0] = 0x3a9c; SHORT_ARRAY_004514ce[1] = 0x3a9d; SHORT_ARRAY_004514ce[2] = 0x3aa3; SHORT_ARRAY_004514ce[3] = 15000; SHORT_ARRAY_004514ce[4] = 0x3a99; SHORT_ARRAY_004514ce[5] = 0x3a9a; SHORT_ARRAY_004514ce[6] = 0x3a9b; SHORT_ARRAY_004514ce[7] = -1; SHORT_ARRAY_0044fbea[0] = 0x4a74; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 5; energy_matches_left_to_use = 5; energy_lhs[0].energy_type = 3; energy_lhs[1].energy_type = 0; energy_lhs[2].energy_type = 2; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3ac6; energy_rhs[0].connections[3] = 1; energy_rhs[0].connections[2] = 1; energy_rhs[1].aseq_idx = 0x3a9a; energy_rhs[1].connections[3] = 1; energy_rhs[1].connections[2] = 1; energy_rhs[2].aseq_idx = 0x3a9c; energy_rhs[2].connections[0] = 1; energy_rhs[3].aseq_idx = -1; break; case 0xf: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3a9c; SHORT_ARRAY_004514ec[1] = 0x3aa1; SHORT_ARRAY_004514ec[2] = 0x3a9d; SHORT_ARRAY_004514ec[3] = 0x3a99; DAT_004514be = 7; SHORT_ARRAY_004514ce[0] = 0x3aa2; SHORT_ARRAY_004514ce[1] = 0x3aad; SHORT_ARRAY_004514ce[2] = 0x3aae; SHORT_ARRAY_004514ce[3] = 0x3aaf; SHORT_ARRAY_004514ce[4] = 0x3aa3; SHORT_ARRAY_004514ce[5] = 0x3a9c; SHORT_ARRAY_004514ce[6] = 0x3a9d; SHORT_ARRAY_004514ce[7] = -1; SHORT_ARRAY_0044fbea[0] = 0x4a5e; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 5; energy_matches_left_to_use = 5; energy_lhs[0].energy_type = 1; energy_lhs[1].energy_type = 5; energy_lhs[2].energy_type = 0; energy_lhs[3].energy_type = 3; energy_rhs[0].aseq_idx = 0x3ac5; energy_rhs[0].connections[0] = 1; energy_rhs[1].aseq_idx = 0x3ab8; energy_rhs[1].connections[0] = 1; energy_rhs[2].aseq_idx = 0x3ab6; energy_rhs[2].connections[0] = 1; energy_rhs[3].aseq_idx = 0x3ad5; energy_rhs[3].connections[1] = 1; energy_rhs[3].connections[3] = 1; break; case 0x10: DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3a9c; SHORT_ARRAY_004514ec[1] = 15000; SHORT_ARRAY_004514ec[2] = 0x3aa1; DAT_004514be = 8; SHORT_ARRAY_004514ce[0] = 0x3aa2; SHORT_ARRAY_004514ce[1] = 15000; SHORT_ARRAY_004514ce[2] = 0x3a99; SHORT_ARRAY_004514ce[3] = 0x3a9a; SHORT_ARRAY_004514ce[4] = 0x3a9b; SHORT_ARRAY_004514ce[5] = 0x3aad; SHORT_ARRAY_004514ce[6] = 0x3aae; SHORT_ARRAY_004514ce[7] = 0x3aaf; SHORT_ARRAY_004514ce[8] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 5; energy_matches_left_to_use = 5; energy_lhs[0].energy_type = 1; energy_lhs[1].energy_type = 2; energy_lhs[2].energy_type = 5; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3abd; energy_rhs[0].connections[5] = 1; energy_rhs[1].aseq_idx = 0x3ad4; energy_rhs[1].connections[1] = 1; energy_rhs[1].connections[5] = 1; energy_rhs[2].aseq_idx = 0x3ac7; energy_rhs[2].connections[1] = 1; energy_rhs[2].connections[5] = 1; energy_rhs[3].aseq_idx = -1; break; case 0x11: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3a9a; SHORT_ARRAY_004514ec[1] = 0x3a9c; SHORT_ARRAY_004514ec[2] = 0x3a9d; SHORT_ARRAY_004514ec[3] = 0x3aa1; DAT_004514be = 7; SHORT_ARRAY_004514ce[0] = 0x3a9e; SHORT_ARRAY_004514ce[1] = 0x3a9f; SHORT_ARRAY_004514ce[2] = 0x3aa2; SHORT_ARRAY_004514ce[3] = 0x3aa3; SHORT_ARRAY_004514ce[4] = 0x3aad; SHORT_ARRAY_004514ce[5] = 0x3aae; SHORT_ARRAY_004514ce[6] = 0x3aaf; SHORT_ARRAY_004514ce[7] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = 0x4a5d; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 5; energy_matches_left_to_use = 5; energy_lhs[0].energy_type = 4; energy_lhs[1].energy_type = 1; energy_lhs[2].energy_type = 0; energy_lhs[3].energy_type = 5; energy_rhs[0].aseq_idx = 0x3aa7; energy_rhs[0].connections[1] = 1; energy_rhs[0].connections[0] = 1; energy_rhs[1].aseq_idx = 0x3ac1; energy_rhs[1].connections[4] = 1; energy_rhs[2].aseq_idx = 0x3a99; energy_rhs[2].connections[4] = 1; energy_rhs[2].connections[1] = 1; energy_rhs[3].aseq_idx = -1; break; case 0x12: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 15000; SHORT_ARRAY_004514ec[1] = 0x3a9c; SHORT_ARRAY_004514ec[2] = 0x3a99; SHORT_ARRAY_004514ec[3] = 0x3aa1; DAT_004514be = 10; SHORT_ARRAY_004514ce[0] = 15000; SHORT_ARRAY_004514ce[1] = 0x3a99; SHORT_ARRAY_004514ce[2] = 0x3a9a; SHORT_ARRAY_004514ce[3] = 0x3a9b; SHORT_ARRAY_004514ce[4] = 0x3aa2; SHORT_ARRAY_004514ce[5] = 0x3a9c; SHORT_ARRAY_004514ce[6] = 0x3a9d; SHORT_ARRAY_004514ce[7] = 0x3aad; SHORT_ARRAY_004514ce[8] = 0x3aae; SHORT_ARRAY_004514ce[9] = 0x3aaf; SHORT_ARRAY_004514ce[10] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = 0x4a3b; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 5; energy_matches_left_to_use = 5; energy_lhs[0].energy_type = 2; energy_lhs[1].energy_type = 1; energy_lhs[2].energy_type = 3; energy_lhs[3].energy_type = 5; energy_rhs[0].aseq_idx = 0x3ab1; energy_rhs[0].connections[2] = 1; energy_rhs[1].aseq_idx = 0x3ab0; energy_rhs[1].connections[2] = 1; energy_rhs[2].aseq_idx = 0x3ac6; energy_rhs[2].connections[2] = 1; energy_rhs[2].connections[3] = 1; energy_rhs[3].aseq_idx = 0x3ab6; energy_rhs[3].connections[2] = 1; break; case 0x13: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3a99; SHORT_ARRAY_004514ec[1] = 0x3aa1; SHORT_ARRAY_004514ec[2] = 15000; SHORT_ARRAY_004514ec[3] = 0x3a9d; DAT_004514be = 10; SHORT_ARRAY_004514ce[0] = 0x3a9c; SHORT_ARRAY_004514ce[1] = 0x3a9d; SHORT_ARRAY_004514ce[2] = 0x3aad; SHORT_ARRAY_004514ce[3] = 0x3aae; SHORT_ARRAY_004514ce[4] = 0x3aaf; SHORT_ARRAY_004514ce[5] = 15000; SHORT_ARRAY_004514ce[6] = 0x3a99; SHORT_ARRAY_004514ce[7] = 0x3a9a; SHORT_ARRAY_004514ce[8] = 0x3a9b; SHORT_ARRAY_004514ce[9] = 0x3aa3; SHORT_ARRAY_004514ce[10] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = 0x4a3b; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 5; energy_matches_left_to_use = 5; energy_lhs[0].energy_type = 3; energy_lhs[1].energy_type = 5; energy_lhs[2].energy_type = 2; energy_lhs[3].energy_type = 0; energy_rhs[0].aseq_idx = 0x3ad2; energy_rhs[0].connections[0] = 1; energy_rhs[1].aseq_idx = 0x3a9e; energy_rhs[1].connections[2] = 1; energy_rhs[1].connections[0] = 1; energy_rhs[2].aseq_idx = 0x3ab0; energy_rhs[2].connections[2] = 1; energy_rhs[3].aseq_idx = 0x3ad0; energy_rhs[3].connections[0] = 1; break; case 0x14: DAT_004514c0 = 2; SHORT_ARRAY_004514ec[0] = 0x3aa2; SHORT_ARRAY_004514ec[1] = 0x3a9b; DAT_004514be = 4; SHORT_ARRAY_004514ce[0] = 0x3ab0; SHORT_ARRAY_004514ce[1] = 0x3ab1; SHORT_ARRAY_004514ce[2] = 0x3aa0; SHORT_ARRAY_004514ce[3] = 0x3aa1; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 2; energy_matches_left_to_use = 2; energy_lhs[0].energy_type = 6; energy_lhs[1].energy_type = 7; energy_lhs[2].energy_type = -1; energy_lhs[3].energy_type = -1; _DAT_0044fbca = 0x3aac; energy_rhs[0].aseq_idx = 0x3aab; energy_rhs[0].connections[7] = 1; energy_rhs[1].aseq_idx = 0x3aad; energy_rhs[1].connections[6] = 1; energy_rhs[2].aseq_idx = -1; energy_rhs[3].aseq_idx = -1; break; case 0x15: DAT_004514c0 = 2; SHORT_ARRAY_004514ec[0] = 0x3aa2; SHORT_ARRAY_004514ec[1] = 0x3a9b; DAT_004514be = 4; SHORT_ARRAY_004514ce[0] = 0x3ab0; SHORT_ARRAY_004514ce[1] = 0x3ab1; SHORT_ARRAY_004514ce[2] = 0x3aa0; SHORT_ARRAY_004514ce[3] = 0x3aa1; SHORT_ARRAY_004514ce[4] = -1; energy_num_matches = 2; energy_matches_left_to_use = 2; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_lhs[0].energy_type = 6; energy_lhs[1].energy_type = 7; energy_lhs[2].energy_type = -1; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3ab9; energy_rhs[0].connections[6] = 1; _DAT_0044fbcc = 0x3abc; energy_rhs[1].aseq_idx = 0x3abb; energy_rhs[1].connections[7] = 1; energy_rhs[2].aseq_idx = -1; energy_rhs[3].aseq_idx = -1; break; case 0x16: DAT_004514c0 = 2; SHORT_ARRAY_004514ec[0] = 0x3a9b; SHORT_ARRAY_004514ec[1] = 0x3aa2; DAT_004514be = 4; SHORT_ARRAY_004514ce[0] = 0x3aa0; SHORT_ARRAY_004514ce[1] = 0x3aa1; SHORT_ARRAY_004514ce[2] = 0x3ab0; SHORT_ARRAY_004514ce[3] = 0x3ab1; SHORT_ARRAY_004514ce[4] = -1; energy_num_matches = 4; energy_matches_left_to_use = 4; energy_lhs[0].energy_type = -1; energy_lhs[1].energy_type = 7; energy_lhs[2].energy_type = 6; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3ab9; energy_rhs[0].connections[6] = 1; _DAT_0044fbcc = 0x3abc; energy_rhs[1].aseq_idx = 0x3abb; energy_rhs[1].connections[7] = 1; energy_rhs[2].aseq_idx = 0x3aad; energy_rhs[2].connections[6] = 1; _DAT_0044fbd0 = 0x3aac; energy_rhs[3].aseq_idx = 0x3aab; energy_rhs[3].connections[7] = 1; break; case 0x17: DAT_004514c0 = 2; SHORT_ARRAY_004514ec[0] = 0x3a9b; SHORT_ARRAY_004514ec[1] = 0x3aa2; DAT_004514be = 4; SHORT_ARRAY_004514ce[0] = 0x3aa0; SHORT_ARRAY_004514ce[1] = 0x3aa1; SHORT_ARRAY_004514ce[2] = 0x3ab0; SHORT_ARRAY_004514ce[3] = 0x3ab1; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = 0x4a53; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 4; energy_matches_left_to_use = 4; energy_lhs[0].energy_type = -1; energy_lhs[1].energy_type = 7; energy_lhs[2].energy_type = 6; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3aa7; energy_rhs[0].connections[6] = 1; _DAT_0044fbcc = 0x3ab6; energy_rhs[1].aseq_idx = 0x3ab5; energy_rhs[1].connections[7] = 1; energy_rhs[2].aseq_idx = 0x3ac9; energy_rhs[2].connections[6] = 1; energy_rhs[3].aseq_idx = 0x3ab9; energy_rhs[3].connections[6] = 1; break; case 0x18: SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = 0x4a53; energy_num_matches = 4; energy_matches_left_to_use = 4; DAT_004514c0 = 2; SHORT_ARRAY_004514ec[0] = 0x3a9b; SHORT_ARRAY_004514ec[1] = 0x3aa2; DAT_004514be = 4; SHORT_ARRAY_004514ce[0] = 0x3aa0; SHORT_ARRAY_004514ce[1] = 0x3aa1; SHORT_ARRAY_004514ce[2] = 0x3ab0; SHORT_ARRAY_004514ce[3] = 0x3ab1; SHORT_ARRAY_004514ce[4] = -1; energy_lhs[0].energy_type = -1; energy_lhs[1].energy_type = 7; energy_lhs[2].energy_type = 6; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3aa7; energy_rhs[0].connections[6] = 1; _DAT_0044fbcc = 0x3abc; energy_rhs[1].aseq_idx = 0x3abb; energy_rhs[1].connections[7] = 1; _DAT_0044fbce = 0x3aac; energy_rhs[2].aseq_idx = 0x3aab; energy_rhs[2].connections[7] = 1; energy_rhs[3].aseq_idx = 0x3ac9; energy_rhs[3].connections[6] = 1; break; case 0x19: DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 15000; SHORT_ARRAY_004514ec[1] = 0x3a9d; SHORT_ARRAY_004514ec[2] = 0x3a9c; DAT_004514be = 6; SHORT_ARRAY_004514ce[0] = 15000; SHORT_ARRAY_004514ce[1] = 0x3a99; SHORT_ARRAY_004514ce[2] = 0x3a9a; SHORT_ARRAY_004514ce[3] = 0x3a9b; SHORT_ARRAY_004514ce[4] = 0x3aa3; SHORT_ARRAY_004514ce[5] = 0x3aa2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 6; energy_matches_left_to_use = 6; energy_lhs[0].energy_type = 2; energy_lhs[1].energy_type = 0; energy_lhs[2].energy_type = 1; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3aae; energy_rhs[0].connections[0] = 1; energy_rhs[0].connections[2] = 1; energy_rhs[1].aseq_idx = 0x3ab1; energy_rhs[1].connections[0] = 1; energy_rhs[1].connections[2] = 1; energy_rhs[2].aseq_idx = 0x3ad3; energy_rhs[2].connections[2] = 1; energy_rhs[2].connections[1] = 1; energy_rhs[3].aseq_idx = -1; break; case 0x1a: DAT_004514c0 = 2; SHORT_ARRAY_004514ec[0] = 15000; SHORT_ARRAY_004514ec[1] = 0x3a99; DAT_004514be = 6; SHORT_ARRAY_004514ce[0] = 15000; SHORT_ARRAY_004514ce[1] = 0x3a99; SHORT_ARRAY_004514ce[2] = 0x3a9a; SHORT_ARRAY_004514ce[3] = 0x3a9b; SHORT_ARRAY_004514ce[4] = 0x3a9c; SHORT_ARRAY_004514ce[5] = 0x3a9d; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 6; energy_matches_left_to_use = 6; energy_lhs[0].energy_type = -1; energy_lhs[1].energy_type = 2; energy_lhs[2].energy_type = 3; energy_lhs[3].energy_type = -1; energy_rhs[0].aseq_idx = 0x3acf; energy_rhs[0].connections[2] = 1; energy_rhs[0].connections[3] = 1; energy_rhs[1].aseq_idx = 0x3ad5; energy_rhs[1].connections[3] = 1; energy_rhs[2].aseq_idx = 0x3ac0; energy_rhs[2].connections[3] = 1; energy_rhs[3].aseq_idx = 0x3ac6; energy_rhs[3].connections[2] = 1; energy_rhs[3].connections[3] = 1; break; case 0x1b: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3a99; SHORT_ARRAY_004514ec[1] = 0x3aa1; SHORT_ARRAY_004514ec[2] = 0x3a9d; SHORT_ARRAY_004514ec[3] = 0x3a9c; DAT_004514be = 7; SHORT_ARRAY_004514ce[0] = 0x3a9c; SHORT_ARRAY_004514ce[1] = 0x3a9d; SHORT_ARRAY_004514ce[2] = 0x3aad; SHORT_ARRAY_004514ce[3] = 0x3aae; SHORT_ARRAY_004514ce[4] = 0x3aaf; SHORT_ARRAY_004514ce[5] = 0x3aa3; SHORT_ARRAY_004514ce[6] = 0x3aa2; SHORT_ARRAY_004514ce[7] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 7; energy_matches_left_to_use = 7; energy_lhs[0].energy_type = 3; energy_lhs[1].energy_type = 5; energy_lhs[2].energy_type = 0; energy_lhs[3].energy_type = 1; energy_rhs[0].aseq_idx = 0x3ac4; energy_rhs[0].connections[1] = 1; energy_rhs[1].aseq_idx = 0x3ac0; energy_rhs[1].connections[3] = 1; energy_rhs[1].connections[1] = 1; energy_rhs[2].aseq_idx = 0x3ad5; energy_rhs[2].connections[3] = 1; energy_rhs[2].connections[1] = 1; energy_rhs[3].aseq_idx = 0x3ad4; energy_rhs[3].connections[5] = 1; energy_rhs[3].connections[1] = 1; break; case 0x1c: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 15000; SHORT_ARRAY_004514ec[1] = 0x3aa1; SHORT_ARRAY_004514ec[2] = 0x3a9a; SHORT_ARRAY_004514ec[3] = 0x3a9d; DAT_004514be = 10; SHORT_ARRAY_004514ce[0] = 15000; SHORT_ARRAY_004514ce[1] = 0x3a99; SHORT_ARRAY_004514ce[2] = 0x3a9a; SHORT_ARRAY_004514ce[3] = 0x3a9b; SHORT_ARRAY_004514ce[4] = 0x3aad; SHORT_ARRAY_004514ce[5] = 0x3aae; SHORT_ARRAY_004514ce[6] = 0x3aaf; SHORT_ARRAY_004514ce[7] = 0x3a9e; SHORT_ARRAY_004514ce[8] = 0x3a9f; SHORT_ARRAY_004514ce[9] = 0x3aa3; SHORT_ARRAY_004514ce[10] = -1; SHORT_ARRAY_0044fbea[0] = 0x4a5d; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 7; energy_matches_left_to_use = 7; energy_lhs[0].energy_type = 2; energy_lhs[1].energy_type = 5; energy_lhs[2].energy_type = 4; energy_lhs[3].energy_type = 0; energy_rhs[0].aseq_idx = 0x3ac1; energy_rhs[0].connections[4] = 1; energy_rhs[1].aseq_idx = 0x3a99; energy_rhs[1].connections[2] = 1; energy_rhs[1].connections[4] = 1; energy_rhs[2].aseq_idx = 0x3ad3; energy_rhs[2].connections[2] = 1; energy_rhs[2].connections[4] = 1; energy_rhs[3].aseq_idx = 0x3ad4; energy_rhs[3].connections[5] = 1; energy_rhs[3].connections[4] = 1; break; case 0x1d: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 15000; SHORT_ARRAY_004514ec[1] = 0x3a99; SHORT_ARRAY_004514ec[2] = 0x3a9c; SHORT_ARRAY_004514ec[3] = 0x3a9d; DAT_004514be = 8; SHORT_ARRAY_004514ce[0] = 15000; SHORT_ARRAY_004514ce[1] = 0x3a99; SHORT_ARRAY_004514ce[2] = 0x3a9a; SHORT_ARRAY_004514ce[3] = 0x3a9b; SHORT_ARRAY_004514ce[4] = 0x3a9c; SHORT_ARRAY_004514ce[5] = 0x3a9d; SHORT_ARRAY_004514ce[6] = 0x3aa2; SHORT_ARRAY_004514ce[7] = 0x3aa3; SHORT_ARRAY_004514ce[8] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 6; energy_matches_left_to_use = 6; energy_lhs[0].energy_type = 2; energy_lhs[1].energy_type = 3; energy_lhs[2].energy_type = 1; energy_lhs[3].energy_type = 0; energy_rhs[0].aseq_idx = 0x3ab3; energy_rhs[0].connections[3] = 1; energy_rhs[0].connections[0] = 1; energy_rhs[1].aseq_idx = 0x3ab6; energy_rhs[1].connections[2] = 1; energy_rhs[1].connections[0] = 1; energy_rhs[2].aseq_idx = 0x3ab1; energy_rhs[2].connections[0] = 1; energy_rhs[2].connections[2] = 1; energy_rhs[3].aseq_idx = -1; break; case 0x1e: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 15000; SHORT_ARRAY_004514ec[1] = 0x3a9c; SHORT_ARRAY_004514ec[2] = 0x3a9d; SHORT_ARRAY_004514ec[3] = 0x3aa1; DAT_004514be = 9; SHORT_ARRAY_004514ce[0] = 15000; SHORT_ARRAY_004514ce[1] = 0x3a99; SHORT_ARRAY_004514ce[2] = 0x3a9a; SHORT_ARRAY_004514ce[3] = 0x3a9b; SHORT_ARRAY_004514ce[4] = 0x3aa2; SHORT_ARRAY_004514ce[5] = 0x3aa3; SHORT_ARRAY_004514ce[6] = 0x3aad; SHORT_ARRAY_004514ce[7] = 0x3aae; SHORT_ARRAY_004514ce[8] = 0x3aaf; SHORT_ARRAY_004514ce[9] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = 0x4a3b; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 6; energy_matches_left_to_use = 6; energy_lhs[0].energy_type = 2; energy_lhs[1].energy_type = 1; energy_lhs[2].energy_type = 0; energy_lhs[3].energy_type = 5; energy_rhs[0].aseq_idx = 0x3acf; energy_rhs[0].connections[2] = 1; energy_rhs[0].connections[0] = 1; energy_rhs[1].aseq_idx = 0x3ab0; energy_rhs[1].connections[2] = 1; energy_rhs[2].aseq_idx = 0x3ac4; energy_rhs[2].connections[2] = 1; energy_rhs[2].connections[1] = 1; energy_rhs[3].aseq_idx = 0x3acb; energy_rhs[3].connections[1] = 1; break; case 0x1f: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3a9c; SHORT_ARRAY_004514ec[1] = 0x3aa1; SHORT_ARRAY_004514ec[2] = 0x3a9d; SHORT_ARRAY_004514ec[3] = 0x3a9a; DAT_004514be = 7; SHORT_ARRAY_004514ce[0] = 0x3aa2; SHORT_ARRAY_004514ce[1] = 0x3aad; SHORT_ARRAY_004514ce[2] = 0x3aae; SHORT_ARRAY_004514ce[3] = 0x3aaf; SHORT_ARRAY_004514ce[4] = 0x3aa3; SHORT_ARRAY_004514ce[5] = 0x3a9e; SHORT_ARRAY_004514ce[6] = 0x3a9f; SHORT_ARRAY_004514ce[7] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 8; energy_matches_left_to_use = 8; energy_lhs[0].energy_type = 1; energy_lhs[1].energy_type = 5; energy_lhs[2].energy_type = 0; energy_lhs[3].energy_type = 4; energy_rhs[0].aseq_idx = 0x3ac7; energy_rhs[0].connections[1] = 1; energy_rhs[0].connections[5] = 1; energy_rhs[0].connections[4] = 1; energy_rhs[1].aseq_idx = 0x3ac0; energy_rhs[1].connections[1] = 1; energy_rhs[1].connections[4] = 1; energy_rhs[2].aseq_idx = 0x3ad0; energy_rhs[2].connections[0] = 1; energy_rhs[3].aseq_idx = 0x3ad3; energy_rhs[3].connections[1] = 1; energy_rhs[3].connections[4] = 1; break; case 0x20: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3a9c; SHORT_ARRAY_004514ec[1] = 0x3aa1; SHORT_ARRAY_004514ec[2] = 0x3a9d; SHORT_ARRAY_004514ec[3] = 0x3a99; DAT_004514be = 7; SHORT_ARRAY_004514ce[0] = 0x3aa2; SHORT_ARRAY_004514ce[1] = 0x3aad; SHORT_ARRAY_004514ce[2] = 0x3aae; SHORT_ARRAY_004514ce[3] = 0x3aaf; SHORT_ARRAY_004514ce[4] = 0x3aa3; SHORT_ARRAY_004514ce[5] = 0x3a9c; SHORT_ARRAY_004514ce[6] = 0x3a9d; SHORT_ARRAY_004514ce[7] = -1; SHORT_ARRAY_0044fbea[0] = -1; SHORT_ARRAY_0044fbea[1] = -1; SHORT_ARRAY_0044fbea[2] = -1; SHORT_ARRAY_0044fbea[3] = -1; energy_num_matches = 8; energy_matches_left_to_use = 8; energy_lhs[0].energy_type = 1; energy_lhs[1].energy_type = 5; energy_lhs[2].energy_type = 0; energy_lhs[3].energy_type = 3; energy_rhs[0].aseq_idx = 0x3acf; energy_rhs[0].connections[0] = 1; energy_rhs[0].connections[3] = 1; energy_rhs[1].aseq_idx = 0x3aa7; energy_rhs[1].connections[1] = 1; energy_rhs[1].connections[0] = 1; energy_rhs[1].connections[3] = 1; energy_rhs[2].aseq_idx = 0x3ad0; energy_rhs[2].connections[0] = 1; energy_rhs[3].aseq_idx = 0x3ab3; energy_rhs[3].connections[0] = 1; energy_rhs[3].connections[3] = 1; break; case 0x21: DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3a9a; SHORT_ARRAY_004514ec[1] = 0x3a99; SHORT_ARRAY_004514ec[2] = 0x3aa1; SHORT_ARRAY_004514ec[3] = 0x3a9c; DAT_004514be = 8; SHORT_ARRAY_004514ce[0] = 0x3a9e; SHORT_ARRAY_004514ce[1] = 0x3a9f; SHORT_ARRAY_004514ce[2] = 0x3a9c; SHORT_ARRAY_004514ce[3] = 0x3a9d; SHORT_ARRAY_004514ce[4] = 0x3aad; SHORT_ARRAY_004514ce[5] = 0x3aae; SHORT_ARRAY_004514ce[6] = 0x3aaf; SHORT_ARRAY_004514ce[7] = 0x3aa2; SHORT_ARRAY_004514ce[8] = -1; energy_num_matches = 9; energy_matches_left_to_use = 9; energy_lhs[0].energy_type = 4; energy_lhs[1].energy_type = 3; energy_lhs[2].energy_type = 5; energy_lhs[3].energy_type = 1; energy_rhs[0].aseq_idx = 0x3a99; energy_rhs[0].connections[1] = 1; energy_rhs[0].connections[4] = 1; energy_rhs[1].aseq_idx = 0x3ac4; energy_rhs[1].connections[1] = 1; energy_rhs[1].connections[4] = 1; energy_rhs[2].aseq_idx = 0x3ad3; energy_rhs[2].connections[1] = 1; energy_rhs[2].connections[4] = 1; energy_rhs[3].aseq_idx = 0x3ad4; energy_rhs[3].connections[1] = 1; energy_rhs[3].connections[4] = 1; energy_rhs[3].connections[5] = 1; } sVar2 = 0; do { sVar1 = 0; do { if (*(short *)(sVar1 * 0x12 + 0x44fc5c + energy_lhs[sVar2].energy_type * 2) == 0) { *(undefined2 *)(sVar2 * 0x1a + 0x44fbf4 + sVar1 * 2) = 1; } else { *(undefined2 *)(sVar2 * 0x1a + 0x44fbf4 + sVar1 * 2) = 0; } sVar1 = sVar1 + 1; } while (sVar1 < 4); sVar2 = sVar2 + 1; } while (sVar2 < 4); switch(energy_matches_left_to_use) { case 2: DAT_004514c4 = 0x3ab2; break; case 3: DAT_004514c4 = 0x3ab3; break; case 4: DAT_004514c4 = 0x3ab4; break; case 5: DAT_004514c4 = 0x3ab5; break; case 6: DAT_004514c4 = 0x3ab6; break; case 7: DAT_004514c4 = 0x3ab7; break; case 8: DAT_004514c4 = 0x3ab8; break; case 9: DAT_004514c4 = 0x3ab9; } return; } void __cdecl FUN_0041654c(short param_1,short param_2,short param_3,short param_4) { short sVar1; short sVar3; short sVar4; short local_14; short local_12; short local_e; short local_a; short local_6; short sVar2; if (param_4 < param_2) { local_e = param_4; local_12 = param_2; } else { local_e = param_2; local_12 = param_4; } local_a = param_4; sVar2 = param_3; if (param_3 < param_1) { local_a = param_2; param_2 = param_4; sVar2 = param_1; param_1 = param_3; } sVar1 = sVar2 - param_1; if (param_2 < local_a) { local_14 = 1; local_a = local_a - param_2; } else { local_14 = -1; local_a = param_2 - local_a; } sVar3 = local_a * 2 - sVar1; if ((sVar1 != 0) || (local_a == 0)) { sVar4 = param_1 + -1; local_6 = 0; if (0 < sVar1) { do { sVar4 = sVar4 + 1; gfxish_set_px_wrapped(sVar4,param_2); for (; -1 < sVar3; sVar3 = sVar3 + sVar1 * -2) { param_2 = param_2 + local_14; gfxish_set_px_wrapped(sVar4,param_2); } sVar3 = sVar3 + local_a * 2; local_6 = local_6 + 1; } while (local_6 < sVar1); } } gfxish_invalidate_rect_wrap(param_1,local_e,(sVar2 - param_1) + 1,(local_12 - local_e) + 1); return; } undefined4 __cdecl FUN_00416668(short param_1,short param_2) { undefined4 uVar1; if ((((param_1 < 0x61) || (500 < param_1)) || (param_2 < 0x20)) || (0x128 < param_2)) { uVar1 = 0; } else { uVar1 = 1; } return uVar1; } int __stdcall FUN_00416695(void) { int iVar1; int iVar2; iVar1 = (int)energy_puzzle_state; iVar2 = iVar1 + -1; if (((iVar1 != 0) && (iVar2 = 0, iVar1 != 6)) && (iVar2 = iVar1 + -0xd, 3 < iVar1 - 9U)) { DAT_0044fca2 = 0; DAT_0044fca4 = 0; iVar2 = CONCAT22((short)((uint)iVar2 >> 0x10),energy_puzzle_state); DAT_0044fbc6 = energy_puzzle_state; energy_puzzle_state = 6; } return iVar2; } void __stdcall FUN_004166d6(void) { aseq_anim_state_struct *paVar1; if (energy_rhs[DAT_0044fbc8].connections[7] == 1) { aseq_anim_flags_make_2((int)energy_rhs_anim_aseq[DAT_0044fbc8]); free_aseq((int *)energy_rhs_anim_aseq[DAT_0044fbc8]); paVar1 = (aseq_anim_state_struct *)load_aseq(*(short *)(&DAT_0044fbca + DAT_0044fbc8 * 2)); energy_rhs_anim_aseq[DAT_0044fbc8] = paVar1; aseq_set_pos_order((int)energy_rhs_anim_aseq[DAT_0044fbc8],DAT_004494aa, DAT_0044fbc8 * 0x41 + 0x23,10); anim_state_xxx_list_insert_4((undefined4 *)energy_rhs_anim_aseq[DAT_0044fbc8]); } else { aseq_anim_flags_make_2((int)energy_rhs_anim_aseq[DAT_0044fbc8]); aseq_anim_reset_and_play((undefined4 *)energy_rhs_anim_aseq[DAT_0044fbc8]); } play_wave_flag1(SHORT_ARRAY_0044fbea[DAT_0044fbc8],0xf,1); energy_puzzle_state = 0; return; } void __stdcall FUN_004167ac(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if ((sVar1 == 0xd) && (DAT_004494b4 != 0)) { FUN_00413c8b(); } return; } void __stdcall FUN_004167cd(void) { short sVar1; short sVar2; sVar2 = 0; do { sVar1 = 0; do { if (*(short *)(sVar2 * 0x1a + 0x44fc04 + sVar1 * 2) != 0) { FUN_0041654c(DAT_0044949c,SHORT_ARRAY_004494a0[sVar2],DAT_0044949e, SHORT_ARRAY_004494a0[sVar1]); } if (DAT_0044fd60 != 0) { FUN_0041654c(DAT_0044fd62,DAT_0044fd64,DAT_0044fd5a,DAT_0044fd5c); } sVar1 = sVar1 + 1; } while (sVar1 < 4); sVar2 = sVar2 + 1; } while (sVar2 < 4); gfxish_invalidate_rect_wrap(0xfa,0x28,0x6e,0x10e); return; } undefined4 __cdecl FUN_00416874(short param_1,short param_2,short param_3,short param_4,short param_5,short param_6) { short sVar1; undefined2 extraout_var; undefined2 extraout_var_00; short sVar2; short sVar3; short sVar4; short sVar5; short sVar6; short sVar7; short local_6; sVar1 = param_2; sVar4 = param_1; if (param_3 < param_1) { sVar1 = param_4; param_4 = param_2; sVar4 = param_3; param_3 = param_1; } sVar7 = param_3 - sVar4; if (sVar1 < param_4) { sVar6 = 1; sVar2 = param_4 - sVar1; } else { sVar6 = -1; sVar2 = sVar1 - param_4; } sVar3 = sVar2 * 2 - sVar7; local_6 = 0; sVar4 = sVar4 + -1; if (0 < sVar7) { do { sVar5 = sVar4 + 1; if ((sVar5 == param_5) && (sVar1 == param_6)) { gfxish_set_px_wrapped(sVar4 + 2,sVar1); return CONCAT22(extraout_var,1); } for (; -1 < sVar3; sVar3 = sVar3 + sVar7 * -2) { sVar1 = sVar1 + sVar6; if ((sVar5 == param_5) && (sVar1 == param_6)) { gfxish_set_px_wrapped(sVar5,sVar1 + sVar6); return CONCAT22(extraout_var_00,1); } } sVar3 = sVar3 + sVar2 * 2; local_6 = local_6 + 1; sVar4 = sVar5; } while (local_6 < sVar7); } return 0; } void __stdcall energy_draw_matches_left_to_use(void) { byte local_10 [12]; load_nfnt(15000); gfxish_copy_otherbuf_to_dest_and_invalidate(0x37,0x70,0x1a,0x1a); if (0 < energy_matches_left_to_use) { sprintf(local_10); FUN_0043dc0b(15000,local_10,0x3b,0x82,0); } gfxish_invalidate_rect_wrap(0x37,0x70,0x1a,0x1a); free_nfnt(15000); return; } undefined4 __stdcall energy_puzzle_is_complete(void) { int iVar1; short sVar2; sVar2 = 0; do { iVar1 = sVar2 * 0xd; if (energy_lhs[sVar2].energy_type != -1) { iVar1 = 0; do { if (*(short *)(sVar2 * 0x1a + 0x44fbf4 + (short)iVar1 * 2) == 0) { return 0; } iVar1 = iVar1 + 1; } while ((short)iVar1 < 4); } sVar2 = sVar2 + 1; } while (sVar2 < 4); return CONCAT22((short)((uint)iVar1 >> 0x10),1); } void __stdcall energy_puzzle_reset_structs(void) { short sVar1; short sVar2; DAT_004494b4 = 0; energy_puzzle_state = 1; sVar2 = 0; do { energy_rhs[sVar2].aseq_idx = 0; sVar1 = 0; do { *(undefined2 *)(sVar2 * 0x1a + 0x44fbf4 + sVar1 * 2) = 0; *(undefined2 *)(sVar2 * 0x1a + 0x44fbfc + sVar1 * 2) = 0; *(undefined2 *)(sVar2 * 0x1a + 0x44fc04 + sVar1 * 2) = 0; *(undefined2 *)(sVar2 * 0x12 + 0x44fc5c + sVar1 * 2) = 0; *(undefined2 *)(sVar2 * 0x12 + 0x44fc64 + sVar1 * 2) = 0; sVar1 = sVar1 + 1; } while (sVar1 < 4); sVar2 = sVar2 + 1; } while (sVar2 < 4); return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __stdcall FUN_00416a9e(void) { undefined4 uVar1; short sVar2; short sVar3; short sVar4; short local_14; short local_12; short local_e; short local_c; short local_a; short local_8; short local_6; local_e = 0; get_mouse_xy_relative(&local_14); local_c = local_14; local_8 = local_14; local_a = local_12 + 0x1e; sVar3 = 0; do { sVar2 = 0; do { if (*(short *)(sVar3 * 0x1a + 0x44fc04 + sVar2 * 2) != 0) { local_6 = 0; do { sVar4 = 0; do { if (local_e == 0) { uVar1 = FUN_00416874(DAT_0044949c,SHORT_ARRAY_004494a0[sVar3],DAT_0044949e, SHORT_ARRAY_004494a0[sVar2],local_8 + local_6,local_a + sVar4); if ((short)uVar1 != 0) { clear_cursor_override_regions(); local_e = 1; if (*(short *)(sVar2 * 0x12 + 0x44fc5c + energy_lhs[sVar3].energy_type * 2) == 0) { *(undefined2 *)(sVar3 * 0x1a + 0x44fbf4 + sVar2 * 2) = 1; } else { *(undefined2 *)(sVar3 * 0x1a + 0x44fbf4 + sVar2 * 2) = 0; } *(undefined2 *)(sVar3 * 0x1a + 0x44fc04 + sVar2 * 2) = 0; *(undefined2 *)(sVar2 * 0x1a + 0x44fbfc + sVar3 * 2) = 0; energy_matches_left_to_use = energy_matches_left_to_use + 1; energy_draw_matches_left_to_use(); gfxish_copy_otherbuf_to_dest_and_invalidate(0xfa,0x28,0x6e,0x10e); FUN_004167cd(); energy_puzzle_set_cursor_regions_wrap(); play_wave_flag1(0x4a4c,5,0); } } sVar4 = sVar4 + 1; } while (sVar4 < 7); local_6 = local_6 + 1; } while (local_6 < 7); } sVar2 = sVar2 + 1; } while (sVar2 < 4); sVar3 = sVar3 + 1; } while (sVar3 < 4); _DAT_0044fbe6 = local_c; _DAT_0044fbe8 = local_c; return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address undefined4 __stdcall FUN_00416c5b(void) { get_mouse_xy_relative_(&DAT_0044fa2c,&DAT_0044fa2e); DAT_0044fbd6._2_2_ = DAT_0044fa2e + 4; DAT_0044fbd6._0_2_ = DAT_0044fa2c; if (0x168 < DAT_0044fa2c) { DAT_0044fbd6._0_2_ = 0x168; } if ((short)DAT_0044fbd6 < 0xfa) { DAT_0044fbd6._0_2_ = 0xfa; } if (0x136 < DAT_0044fbd6._2_2_) { DAT_0044fbd6._2_2_ = 0x136; } if (DAT_0044fbd6._2_2_ < 0x28) { DAT_0044fbd6._2_2_ = 0x28; } FUN_00414394(DAT_0044fbdc,DAT_0044fbe0); FUN_0041654c((short)DAT_0044fbd2,DAT_0044fbd2._2_2_,(short)DAT_0044fbd6,DAT_0044fbd6._2_2_); FUN_004167cd(); DAT_0044fbdc = DAT_0044fbd2; _DAT_0044fbe4 = CONCAT22(_DAT_0044fbe6,DAT_0044fbda); DAT_0044fbe0._0_2_ = (short)DAT_0044fbd6; DAT_0044fbe0._2_2_ = DAT_0044fbd6._2_2_; return 0; } void __stdcall energy_puzzle_hint(void) { uint uVar1; char *pcVar2; short sVar3; char *apcStackY_20400 [32762]; char *local_400 [5]; char local_3ec [1000]; switch(energy_puzzle_state) { case 0: case 6: case 9: case 10: case 0xb: case 0xc: return; case 4: case 5: anim_engine_remove_cb(DAT_0044fa30); energy_pencil_cursor_0->enable_clip_cursor = 0; energy_puzzle_state = 1; } anim_state_xxx_list_insert_4((undefined4 *)energy_hint_aseq); xxx_periodic_loop(); anim_state_xxx_list_remove((int *)energy_hint_aseq); xxx_periodic_loop(); memset((undefined4 *)local_3ec,0,1000); local_400[0] = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[0],(int *)&text); uVar1 = strlen(local_400[0]); FUN_00440d70((undefined4 *)local_3ec,local_400[0],uVar1); for (sVar3 = 1; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { pcVar2 = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[sVar3],(int *)&text); local_400[sVar3] = pcVar2; uVar1 = strlen(local_400[sVar3]); FUN_00440ce0(local_3ec,local_400[sVar3],uVar1); } FUN_004301cf(local_3ec); for (sVar3 = 0; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { free_resource_item_with_idx_fourcc(SHORT_ARRAY_004514ec[sVar3],(undefined1 *)&text); } return; } void __stdcall FUN_00416e98(void) { energy_puzzle_clean_up_and_redraw(); xxx_periodic_loop(); FUN_004167cd(); if (energy_puzzle_state == 2) { clip_cursor_disable(); return; } if (1 < (int)energy_puzzle_state - 4U) { clip_cursor_disable(); return; } clear_cursor_override_regions(); anim_engine_remove_cb(DAT_0044fa30); energy_pencil_cursor_0->enable_clip_cursor = 0; energy_puzzle_state = 1; gfxish_copy_otherbuf_to_dest_and_invalidate(0xfa,0x28,0x6e,0x10e); FUN_004167cd(); energy_puzzle_set_cursor_regions_wrap(); return; } void __stdcall FUN_00416f16(void) { switch(energy_puzzle_state) { case 0: case 2: case 3: case 6: case 9: case 10: case 0xb: case 0xc: goto switchD_00416f2b_caseD_0; default: energy_puzzle_state = 1; switchD_00416f2b_caseD_0: return; case 4: case 5: clear_cursor_override_regions(); anim_engine_remove_cb(DAT_0044fa30); energy_pencil_cursor_0->enable_clip_cursor = 0; energy_puzzle_state = 1; gfxish_copy_otherbuf_to_dest_and_invalidate(0xfa,0x28,0x6e,0x10e); FUN_004167cd(); energy_puzzle_set_cursor_regions_wrap(); return; } } void __cdecl FUN_00416fa8(short param_1,short param_2,short param_3,short param_4,undefined4 param_5, short param_6) { short sVar1; short sVar2; short sVar3; short sVar4; bool bVar5; short local_a; short local_8; short local_6; sVar4 = 3; DAT_0044fbc2 = 0; DAT_0044fbc4 = 0; if (param_2 < param_4) { sVar3 = 1; local_8 = param_4 - param_2; } else { sVar3 = -1; local_8 = param_2 - param_4; } if (param_1 < param_3) { local_a = 1; sVar2 = param_3 - param_1; } else { local_a = -1; sVar2 = param_1 - param_3; } sVar1 = local_8 * 2 - sVar2; param_1 = param_1 - local_a; local_6 = 0; if (0 < sVar2) { do { param_1 = param_1 + local_a; bVar5 = sVar4 == 0; sVar4 = sVar4 + -1; if (bVar5) { (&DAT_0044fa32)[DAT_0044fbc2] = param_1; DAT_0044fbc2 = DAT_0044fbc2 + 1; (&DAT_0044fa32)[DAT_0044fbc2] = param_2; DAT_0044fbc2 = DAT_0044fbc2 + 1; sVar4 = 2; } for (; -1 < sVar1; sVar1 = sVar1 + sVar2 * -2) { param_2 = param_2 + sVar3; } sVar1 = sVar1 + local_8 * 2; local_6 = local_6 + 1; } while (local_6 < sVar2); } energy_puzzle_state = 9; DAT_0044fd5e = param_6 + 10; anim_state_xxx_list_insert_8004((undefined4 *)energy_dot_aseq); aseq_anim_set_cmd_0x400_handler((int)energy_dot_aseq,FUN_00417590,0); DAT_0044fd62 = param_3; DAT_0044fd64 = param_4; return; } void __cdecl FUN_004170f4(short param_1,short param_2) { aseq_set_pos_order((int)energy_dot_aseq,param_1 + -4,param_2 + -4,0x14); return; } void __stdcall FUN_0041711b(void) { short sVar1; sVar1 = 0; do { SHORT_ARRAY_0044fbea[sVar1] = 0x4a49; switch(energy_rhs[sVar1].aseq_idx) { case 0x3a99: SHORT_ARRAY_0044fbea[sVar1] = 0x4a41; break; case 0x3a9a: SHORT_ARRAY_0044fbea[sVar1] = 0x4a74; break; case 0x3a9b: SHORT_ARRAY_0044fbea[sVar1] = 0x4a47; break; case 0x3a9c: SHORT_ARRAY_0044fbea[sVar1] = 0x4a46; break; case 0x3a9e: SHORT_ARRAY_0044fbea[sVar1] = 0x4a3e; break; case 0x3aa6: SHORT_ARRAY_0044fbea[sVar1] = 0x4a48; break; case 0x3aa7: SHORT_ARRAY_0044fbea[sVar1] = 0x4a48; break; case 0x3aa8: SHORT_ARRAY_0044fbea[sVar1] = 0x4a48; break; case 0x3aa9: SHORT_ARRAY_0044fbea[sVar1] = 0x4a48; break; case 0x3aaa: SHORT_ARRAY_0044fbea[sVar1] = 0x4a6b; break; case 0x3aab: SHORT_ARRAY_0044fbea[sVar1] = 0x4a6c; break; case 0x3aac: SHORT_ARRAY_0044fbea[sVar1] = 0x4a48; break; case 0x3aad: SHORT_ARRAY_0044fbea[sVar1] = 0x4a6c; break; case 0x3aae: SHORT_ARRAY_0044fbea[sVar1] = 0x4a6c; break; case 0x3aaf: SHORT_ARRAY_0044fbea[sVar1] = 0x4a3a; break; case 0x3ab0: SHORT_ARRAY_0044fbea[sVar1] = 0x4a3b; break; case 0x3ab1: SHORT_ARRAY_0044fbea[sVar1] = 0x4a59; break; case 0x3ab2: SHORT_ARRAY_0044fbea[sVar1] = 0x4a59; break; case 0x3ab3: SHORT_ARRAY_0044fbea[sVar1] = 0x4a59; break; case 0x3ab4: SHORT_ARRAY_0044fbea[sVar1] = 0x4a5c; break; case 0x3ab5: SHORT_ARRAY_0044fbea[sVar1] = 0x4a5c; break; case 0x3ab6: SHORT_ARRAY_0044fbea[sVar1] = 0x4a5c; break; case 0x3ab7: SHORT_ARRAY_0044fbea[sVar1] = 0x4a5c; break; case 0x3ab8: SHORT_ARRAY_0044fbea[sVar1] = 0x4a42; break; case 0x3ab9: SHORT_ARRAY_0044fbea[sVar1] = 0x4a43; break; case 0x3aba: SHORT_ARRAY_0044fbea[sVar1] = 0x4a43; break; case 0x3abb: SHORT_ARRAY_0044fbea[sVar1] = 0x4a43; break; case 0x3abd: SHORT_ARRAY_0044fbea[sVar1] = 0x4a6e; break; case 0x3abe: SHORT_ARRAY_0044fbea[sVar1] = 0x4a6e; break; case 0x3abf: SHORT_ARRAY_0044fbea[sVar1] = 0x4a6e; break; case 0x3ac0: SHORT_ARRAY_0044fbea[sVar1] = 0x1f9a; break; case 0x3ac1: SHORT_ARRAY_0044fbea[sVar1] = 0x4a5d; break; case 0x3ac2: SHORT_ARRAY_0044fbea[sVar1] = 0x4a5d; break; case 0x3ac3: SHORT_ARRAY_0044fbea[sVar1] = 0x4a58; break; case 0x3ac4: SHORT_ARRAY_0044fbea[sVar1] = 0x4a58; break; case 0x3ac5: SHORT_ARRAY_0044fbea[sVar1] = 0x4a5e; break; case 0x3ac6: SHORT_ARRAY_0044fbea[sVar1] = 0x4a74; break; case 0x3ac7: SHORT_ARRAY_0044fbea[sVar1] = 0x4a5a; break; case 0x3ac8: SHORT_ARRAY_0044fbea[sVar1] = 0x4a53; break; case 0x3ac9: SHORT_ARRAY_0044fbea[sVar1] = 0x4a53; break; case 0x3aca: SHORT_ARRAY_0044fbea[sVar1] = 0x4a53; break; case 0x3acb: SHORT_ARRAY_0044fbea[sVar1] = 0x4a74; break; case 0x3acf: SHORT_ARRAY_0044fbea[sVar1] = 0x4a59; break; case 0x3ad0: SHORT_ARRAY_0044fbea[sVar1] = 0x4a73; break; case 0x3ad1: SHORT_ARRAY_0044fbea[sVar1] = 0x4a54; break; case 0x3ad2: SHORT_ARRAY_0044fbea[sVar1] = 0x4a50; break; case 0x3ad3: SHORT_ARRAY_0044fbea[sVar1] = 0x4a4d; break; case 0x3ad4: SHORT_ARRAY_0044fbea[sVar1] = 0x4a6a; break; case 0x3ad5: SHORT_ARRAY_0044fbea[sVar1] = 0x1f9a; break; case 0x3ad8: SHORT_ARRAY_0044fbea[sVar1] = 0x4a43; } sVar1 = sVar1 + 1; } while (sVar1 < 4); return; } void __cdecl energy_puzzle_set_cursor_regions(short param_1) { cursor_override_region *pcVar1; if (param_1 == 0) { free_tracked_heap_block((int)PTR_0044fd3c); } pcVar1 = (cursor_override_region *)alloc_tracked_heap_block(0x10); PTR_0044fd3c = pcVar1; (pcVar1->rect).x = 0; (pcVar1->rect).y = 5; (pcVar1->rect).h = 0x17a; (pcVar1->rect).w = 0x1ff; if (energy_puzzle_state == 1) { pcVar1->cursor_struct = energy_pencil_cursor_0; } else if (energy_puzzle_state == 2) { pcVar1->cursor_struct = energy_eraser_cursor; } else if (energy_puzzle_state == 3) { pcVar1->cursor_struct = energy_hand_cursor; } pcVar1->shape_circle = 0; set_cursor_override_regions((int)PTR_0044fd3c,1); return; } void __stdcall clear_cursor_override_regions(void) { set_cursor_override_regions(0,0); return; } void __stdcall energy_puzzle_set_cursor_regions_wrap(void) { energy_puzzle_set_cursor_regions(0); return; } void __stdcall FUN_00417590(void) { FUN_004170f4(DAT_0044fd5a,DAT_0044fd5c); FUN_004167cd(); return; } void __stdcall setup_keyboard_buffer(void) { if (DAT_004496f4 == 0) { key_buffer_wptr = 0; key_buffer_rptr = 0; DAT_004496f4 = 1; ptr_on_key_down = key_down_handler_buffered; } return; } void __stdcall FUN_004175dc(void) { if (DAT_004496f4 != 0) { DAT_004496f4 = 0; } return; } void __stdcall wait_for_key(void) { undefined4 uVar1; do { pump_some_messages(); uVar1 = get_key_from_buffer(); } while ((short)uVar1 == 0); return; } void __stdcall pump_messages_and_get_key(void) { pump_some_messages(); get_key_from_buffer(); return; } bool __stdcall pump_messages_and_has_key(void) { pump_some_messages(); return key_buffer_rptr != key_buffer_wptr; } void __stdcall pump_some_messages_(void) { pump_some_messages(); return; } void __cdecl key_down_handler_buffered(word param_1) { uint uVar1; if ((DAT_004496f4 != 0) && (DAT_004496f6 == 0)) { uVar1 = (int)key_buffer_wptr + 1U & 0x8000001f; if ((int)uVar1 < 0) { uVar1 = (uVar1 - 1 | 0xffffffe0) + 1; } if ((short)uVar1 != key_buffer_rptr) { key_buffer[key_buffer_wptr] = param_1; key_buffer_wptr = (short)uVar1; } DAT_004496f6 = 0; } return; } undefined4 __stdcall get_key_from_buffer(void) { undefined4 uVar1; uint uVar2; uVar1 = 0; if (DAT_004496f6 == 0) { if (key_buffer_wptr != key_buffer_rptr) { uVar1 = CONCAT22(key_buffer_rptr >> 0xf,key_buffer[key_buffer_rptr]); key_buffer_rptr = key_buffer_rptr + 1; uVar2 = (int)key_buffer_rptr & 0x8000001f; if ((int)uVar2 < 0) { uVar2 = (uVar2 - 1 | 0xffffffe0) + 1; } key_buffer_rptr = (short)uVar2; } DAT_004496f6 = 0; } return uVar1; } void __cdecl open_windows_relative(char *param_1,ushort param_2) { char local_110 [268]; if ((param_2 & 0x8000) != 0) { strcpy(local_110,windows_dir); strcat(local_110,param_1); param_2 = param_2 & 0x7fff; } fopen(local_110,(&PTR_s_rb_004496f8)[(short)param_2]); return; } void __cdecl FUN_00417767(int *param_1) { fclose(param_1); return; } int __cdecl FUN_00417775(int *param_1,char *param_2,uint param_3) { uint uVar1; uVar1 = fread(param_2,param_3 & 0xffff,1,param_1); return uVar1 * (param_3 & 0xffff); } int __cdecl FUN_00417798(int *param_1,byte *param_2,uint param_3) { uint uVar1; uVar1 = fwrite(param_2,param_3 & 0xffff,1,param_1); return uVar1 * (param_3 & 0xffff); } void __stdcall force_puzzle_on_load(void) { DAT_0044fe5c = 0; wave_load_list[0] = 0x1f73; wave_load_list[1] = 0x1f67; wave_load_list[2] = 0x1f81; wave_load_list[3] = 0x4a6d; wave_load_list[4] = 0x1fa7; wave_load_list[5] = 0x4a5b; wave_load_list[6] = 0x1f5f; wave_load_list[7] = 0x4a61; wave_load_list[8] = 0x4a4c; wave_load_list[9] = 0x1f5c; wave_load_list[10] = 0x4a77; wave_load_list[0xb] = -1; load_waves_from_list(0x451486); load_and_draw_score(); FUN_0043d7c1(FUN_0041bc1d); force_puzzle_select_puzzle(); force_puzzle_load_gfx(); force_puzzle_redraw_gfx(); force_puzzle_make_mouse_regions(); key_xxxxx_set(FUN_00418583); DAT_0044fdf0 = get_time_ms(); force_hand_cur_aseq = (aseq_anim_state_struct *)load_aseq(17062); force_hand_cur = (aseq_cursor_struct *)aseq_setup_as_cursor((int)force_hand_cur_aseq,0,0); force_hand_cur->enable_clip_cursor = 0; force_puzzle_setup_cur_override_regions(1); FUN_00422170(); on_deactivate_xtra_cb = FUN_0041bcba; force_puzzle_cleared = 0; return; } void __stdcall force_puzzle_on_remove(void) { if (DAT_004514b0 != 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; } on_deactivate_xtra_cb = (undefined *)0x0; free_tracked_heap_block(DAT_0044fe58); set_cursor_override_regions(0,0); free_aseq((int *)force_hand_cur_aseq); aseq_free_cursor((int)force_hand_cur); DAT_004514ae = DAT_004498d8; FUN_00431029(); FUN_00430ef4(0x451486); FUN_0043d7c1(0); mouse_region_delete_all_lists(); FUN_00418378(); key_xxxxx_clear(); free_resource_item_with_idx_fourcc(DAT_004514c2,(undefined1 *)&text); FUN_0042211c(); return; } void __stdcall force_puzzle_on_periodic(void) { short sVar1; undefined4 uVar2; int iVar3; new_player_hint(0xf); if (DAT_0044fe5c == 0) { DAT_0044fe5c = 1; DAT_004514b0 = DAT_004514c4; load_wave_flag_2(DAT_004514c4); play_wave_flag2(DAT_004514b0); } if ((force_puzzle_cleared != 0) && (DAT_0044fdf6 == 0)) { DAT_0044fdf6 = 1; anim_state_xxx_list_remove((int *)force_puzzle_glowing_hole_aseq); clear_cursor_override_regions(); solved_the_puzzle(0x4a77); force_puzzle_setup_cur_override_regions_wrap(); inc_score_by_400(); force_puzzle_make_mouse_regions(); } switch(force_puzzle_state) { case 0: sVar1 = wave_is_playing_(DAT_004514b0); if (sVar1 == 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; force_puzzle_state = 3; return; } break; case 1: iVar3 = get_time_ms(); if (4 < (uint)(iVar3 - DAT_0044fdf0)) { DAT_0044fdf0 = get_time_ms(); if (force_puzzle_computed_distance < DAT_0044fdee) { DAT_0044fdee = force_puzzle_computed_distance; force_puzzle_state = 2; return; } aseq_set_pos_order((int)force_puzzle_selected_ball_aseq, point_ARRAY_ARRAY_0044988c[force_puzzle_incline_base_idx][DAT_0044fdee].x, *(short *)(force_puzzle_incline_base_idx * 0x10 + 0x44988e + DAT_0044fdee * 4),0x46); DAT_0044fdee = DAT_0044fdee + 1; return; } break; case 2: iVar3 = get_time_ms(); if (4 < (uint)(iVar3 - DAT_0044fdf0)) { DAT_0044fdf0 = get_time_ms(); if (DAT_0044fdee < 0) { DAT_0044fdee = 0; force_puzzle_state = 3; aseq_set_pos_order((int)force_puzzle_selected_ball_aseq,DAT_0044fdea,DAT_0044fdec,0x46); } else { aseq_set_pos_order((int)force_puzzle_selected_ball_aseq, point_ARRAY_ARRAY_0044988c[force_puzzle_incline_base_idx][DAT_0044fdee].x ,*(short *)(force_puzzle_incline_base_idx * 0x10 + 0x44988e + DAT_0044fdee * 4),0x46); DAT_0044fdee = DAT_0044fdee + -1; } } force_puzzle_setup_cur_override_regions_wrap(); break; case 4: force_puzzle_move_plunger(); return; case 5: sVar1 = aseq_anim_get_flags((int)force_puzzle_selected_ball_aseq); if ((sVar1 != 4) && (iVar3 = get_time_ms(), 4 < (uint)(iVar3 - DAT_0044fdf0))) { DAT_0044fdf0 = get_time_ms(); DAT_0044fdfe = DAT_0044fdfe + 1; if ((int)DAT_0044fdfe < force_puzzle_computed_distance + -4) { aseq_set_pos_order((int)force_puzzle_selected_ball_aseq,point_ARRAY_004497e8[DAT_0044fdfe].x ,point_ARRAY_004497e8[DAT_0044fdfe].y + force_puzzle_incline_base_idx * -5,0x96); } else { stop_playing_wave_by_id_type1(0x1f67); DAT_0044fdfe = force_puzzle_computed_distance + -4; force_puzzle_state = 3; force_puzzle_setup_cur_override_regions_wrap(); aseq_set_pos_order((int)force_puzzle_selected_ball_aseq,point_ARRAY_0044982c[DAT_0044fdfe].x ,point_ARRAY_0044982c[DAT_0044fdfe].y,0x19); if ((DAT_0044fdfe < 8) && (-1 < DAT_0044fdfe)) { if (DAT_004498e0 != 0) { free_aseq(DAT_0044fe28); } DAT_004498e0 = 1; DAT_0044fe28 = load_aseq(DAT_0044fdfe + 0x4296); anim_state_xxx_list_insert_8004(DAT_0044fe28); aseq_set_pos_order((int)DAT_0044fe28,point_ARRAY_0044986c[DAT_0044fdfe].x, point_ARRAY_0044986c[DAT_0044fdfe].y,0x1e); uVar2 = FUN_0041bcd0(); aseq_set_pos_order((int)force_puzzle_glowing_hole_aseq, force_puzzle_glowing_hole_pos[force_puzzle_glowing_hole_slot].x, force_puzzle_glowing_hole_pos[force_puzzle_glowing_hole_slot].y, (short)uVar2 + 0x14); } if (DAT_004498d8 == 0) { uVar2 = force_puzzle_is_cleared(); DAT_004498d8 = (short)uVar2; } if (force_puzzle_computed_distance + -4 < 8) { play_wave_flag1(0x4a6d,5,0); } else { play_wave_flag1(0x1f81,5,0); anim_state_xxx_list_remove((int *)force_puzzle_selected_ball_aseq); } if ((DAT_004498d8 != 0) && (force_puzzle_cleared == 0)) { force_puzzle_cleared = 1; } } if ((DAT_0044fdfe < 8) && (-1 < DAT_0044fdfe)) { aseq_anim_reset_and_play((undefined4 *)force_puzzle_selected_ball_aseq); return; } } break; case 6: sVar1 = aseq_anim_get_flags((int)force_puzzle_apply_remove_stuff_aseq); if (sVar1 != 4) { free_aseq((int *)force_puzzle_apply_remove_stuff_aseq); force_puzzle_state = 3; force_puzzle_setup_cur_override_regions_wrap(); return; } break; case 7: iVar3 = get_time_ms(); if (4 < (uint)(iVar3 - DAT_0044fdf0)) { if (3 < DAT_0044fdee) { force_puzzle_state = 5; return; } aseq_set_pos_order((int)force_puzzle_selected_ball_aseq, point_ARRAY_ARRAY_0044988c[force_puzzle_incline_base_idx][DAT_0044fdee].x, *(short *)(force_puzzle_incline_base_idx * 0x10 + 0x44988e + DAT_0044fdee * 4),0x46); DAT_0044fdee = DAT_0044fdee + 2; DAT_0044fdf0 = get_time_ms(); return; } break; case 8: xxxfunc_set(&puzzle_choosing_funcset_xxx); return; } return; } void __stdcall FUN_00417ecb(void) { if (force_puzzle_state != 0) { play_wave_flag1(0x1f5c,5,0); anim_state_xxx_list_insert_4((undefined4 *)force_puzzle_go_back_aseq); xxx_periodic_loop(); force_puzzle_state = 8; } return; } void __cdecl force_puzzle_change_gravity(int param_1) { int iVar1; play_wave_flag1(0x1f5c,5,0); iVar1 = *(int *)(param_1 + 0x1e); if (iVar1 == 0) { force_puzzle_gravity_idx = 1; } else if (iVar1 == 1) { force_puzzle_gravity_idx = 2; } else if (iVar1 == 2) { force_puzzle_gravity_idx = 3; } free_aseq((int *)force_puzzle_gravity_aseq); force_puzzle_gravity_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_gravity_idx + 0x4272) ; anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_gravity_aseq); aseq_set_pos_order((int)force_puzzle_gravity_aseq,6,0x103,100); return; } void __stdcall force_puzzle_redraw_gfx(void) { short sVar1; if (DAT_0044fdf6 == 0) { anim_state_xxx_list_remove((int *)force_puzzle_glowing_hole_aseq); anim_state_xxx_list_insert_4((undefined4 *)force_puzzle_glowing_hole_aseq); } anim_state_xxx_list_remove((int *)force_puzzle_hint_aseq); anim_state_xxx_list_remove((int *)force_puzzle_go_back_aseq); anim_state_xxx_list_remove((int *)force_puzzle_gravity_aseq); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_gravity_aseq); anim_state_xxx_list_remove((int *)force_puzzle_incline_aseq); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); anim_state_xxx_list_remove((int *)force_puzzle_plunger_aseq); aseq_select_anim((int)force_puzzle_plunger_aseq,0); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_plunger_aseq); sVar1 = 0; do { if (force_puzzle_ball_enabled[sVar1] != 0) { anim_state_xxx_list_remove((int *)force_puzzle_balls_sidebar_aseq[sVar1]); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_balls_sidebar_aseq[sVar1]); } sVar1 = sVar1 + 1; } while (sVar1 < 4); if (force_puzzle_allow_oil != 0) { anim_state_xxx_list_remove((int *)force_puzzle_oil_aseq); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_oil_aseq); anim_state_xxx_list_remove((int *)force_puzzle_rag_aseq); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_rag_aseq); } if (force_puzzle_allow_sand != 0) { anim_state_xxx_list_remove((int *)force_puzzle_sand_aseq); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_sand_aseq); anim_state_xxx_list_remove((int *)force_puzzle_brush_aseq); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_brush_aseq); } FUN_00430e33(DAT_0044fdf6); return; } void __stdcall force_puzzle_load_gfx(void) { aseq_anim_state_struct *paVar1; short sVar2; load_rrgb_1(17000); force_puzzle_bg_aseq = (aseq_anim_state_struct *)load_aseq(17000); aseq_draw_to_both_fbs((int)force_puzzle_bg_aseq,0,0,0); free_aseq((int *)force_puzzle_bg_aseq); force_puzzle_glowing_hole_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_glowing_hole_slot + 17002); aseq_set_pos_order((int)force_puzzle_glowing_hole_aseq, force_puzzle_glowing_hole_pos[force_puzzle_glowing_hole_slot].x, force_puzzle_glowing_hole_pos[force_puzzle_glowing_hole_slot].y,0x14); force_puzzle_hint_aseq = (aseq_anim_state_struct *)load_aseq(17055); aseq_set_pos_order((int)force_puzzle_hint_aseq,0x12,0x19,100); force_puzzle_go_back_aseq = (aseq_anim_state_struct *)load_aseq(17001); aseq_set_pos_order((int)force_puzzle_go_back_aseq,0x18e,0x143,100); force_puzzle_gravity_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_gravity_idx + 17010); aseq_set_pos_order((int)force_puzzle_gravity_aseq,6,0x103,100); force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_idx + 17028); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_plunger_aseq = (aseq_anim_state_struct *)load_aseq(17019); aseq_select_anim((int)force_puzzle_plunger_aseq,0); aseq_set_pos_order((int)force_puzzle_plunger_aseq,0x18e,0xe3,200); sVar2 = 0; do { if (force_puzzle_ball_enabled[sVar2] != 0) { paVar1 = (aseq_anim_state_struct *)load_aseq(sVar2 + 17024); force_puzzle_balls_sidebar_aseq[sVar2] = paVar1; aseq_set_pos_order((int)force_puzzle_balls_sidebar_aseq[sVar2], force_puzzle_balls_sidebar_pos[sVar2].x, force_puzzle_balls_sidebar_pos[sVar2].y,0x46); } sVar2 = sVar2 + 1; } while (sVar2 < 4); if (force_puzzle_allow_oil != 0) { force_puzzle_oil_aseq = (aseq_anim_state_struct *)load_aseq(17020); aseq_set_pos_order((int)force_puzzle_oil_aseq,0x3c,0x68,0x3c); force_puzzle_rag_aseq = (aseq_anim_state_struct *)load_aseq(17021); aseq_set_pos_order((int)force_puzzle_rag_aseq,0x3c,0x87,0x3c); } if (force_puzzle_allow_sand != 0) { force_puzzle_sand_aseq = (aseq_anim_state_struct *)load_aseq(17023); aseq_set_pos_order((int)force_puzzle_sand_aseq,0xf,0x68,0x3c); force_puzzle_brush_aseq = (aseq_anim_state_struct *)load_aseq(17022); aseq_set_pos_order((int)force_puzzle_brush_aseq,0xf,0x82,0x3c); } return; } void __stdcall FUN_00418378(void) { short sVar1; free_aseq((int *)force_puzzle_glowing_hole_aseq); free_aseq((int *)force_puzzle_go_back_aseq); free_aseq((int *)force_puzzle_hint_aseq); free_aseq((int *)force_puzzle_gravity_aseq); if (force_puzzle_selected_ball_idx != -1) { free_aseq((int *)force_puzzle_selected_ball_aseq); } free_aseq((int *)force_puzzle_incline_aseq); free_aseq((int *)force_puzzle_plunger_aseq); sVar1 = 0; do { if (force_puzzle_ball_enabled[sVar1] != 0) { free_aseq((int *)force_puzzle_balls_sidebar_aseq[sVar1]); } sVar1 = sVar1 + 1; } while (sVar1 < 4); if (force_puzzle_allow_oil != 0) { free_aseq((int *)force_puzzle_oil_aseq); free_aseq((int *)force_puzzle_rag_aseq); } if (force_puzzle_allow_sand != 0) { free_aseq((int *)force_puzzle_sand_aseq); free_aseq((int *)force_puzzle_brush_aseq); } if (DAT_004498e0 != 0) { free_aseq(DAT_0044fe28); } return; } void __stdcall FUN_0041845e(void) { uint uVar1; char *pcVar2; short sVar3; char *apcStackY_20400 [32762]; char *local_400 [5]; char local_3ec [1000]; anim_state_xxx_list_insert_4((undefined4 *)force_puzzle_hint_aseq); xxx_periodic_loop(); anim_state_xxx_list_remove((int *)force_puzzle_hint_aseq); xxx_periodic_loop(); play_wave_flag1(0x1f5c,5,0); memset((undefined4 *)local_3ec,0,1000); local_400[0] = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[0],(int *)&text); uVar1 = strlen(local_400[0]); FUN_00440d70((undefined4 *)local_3ec,local_400[0],uVar1); for (sVar3 = 1; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { pcVar2 = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[sVar3],(int *)&text); local_400[sVar3] = pcVar2; uVar1 = strlen(local_400[sVar3]); FUN_00440ce0(local_3ec,local_400[sVar3],uVar1); } FUN_004301cf(local_3ec); for (sVar3 = 0; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { free_resource_item_with_idx_fourcc(SHORT_ARRAY_004514ec[sVar3],(undefined1 *)&text); } return; } void __stdcall FUN_00418583(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if (sVar1 == 0xd) { if (DAT_004498d8 != 0) { force_puzzle_state = 8; } DAT_004514f6 = 1; } return; } void __stdcall force_puzzle_move_plunger(void) { undefined2 local_8; short local_6; get_mouse_xy_relative_(&local_6,&local_8); force_puzzle_plunger_force = (short)((local_6 + -0x1b8) / 6); if (force_puzzle_plunger_force < 0) { force_puzzle_plunger_force = 0; } if (7 < force_puzzle_plunger_force) { force_puzzle_plunger_force = 7; } anim_state_xxx_list_remove((int *)force_puzzle_plunger_aseq); aseq_select_anim((int)force_puzzle_plunger_aseq,force_puzzle_plunger_force); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_plunger_aseq); aseq_set_pos_order((int)force_puzzle_plunger_aseq,0x18e,0xe3,200); return; } void __stdcall force_puzzle_select_puzzle(void) { short sVar1; force_puzzle_state = 3; DAT_004498d8 = 0; force_puzzle_required_ball = 4; force_puzzle_required_friction = 3; force_puzzle_required_gravity = 3; SHORT_004498be = 3; force_puzzle_plunger_force = 0; DAT_0044fdfe = 0; force_puzzle_friction_type = 1; force_puzzle_selected_ball_idx = -1; DAT_0044fdf6 = 0; DAT_004498e0 = 0; DAT_0044fe00 = 0; if (0x2a < puzzle_idx) { puzzle_idx = 1; } sVar1 = 0; do { force_puzzle_ball_enabled[sVar1] = 0; sVar1 = sVar1 + 1; } while (sVar1 < 4); switch(puzzle_idx) { case 1: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 17000; SHORT_ARRAY_004514ce[1] = 0x4269; SHORT_ARRAY_004514ce[2] = 0x426a; SHORT_ARRAY_004514ce[3] = 0x426b; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x428a; DAT_004514c2 = 17000; DAT_004514c4 = 0x42d6; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 0; force_puzzle_required_ball = 1; force_puzzle_ball_enabled[0] = 0; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 0; force_puzzle_ball_enabled[3] = 0; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 3; break; case 2: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 17000; SHORT_ARRAY_004514ce[1] = 0x4269; SHORT_ARRAY_004514ce[2] = 0x426a; SHORT_ARRAY_004514ce[3] = 0x426b; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x428a; DAT_004514c2 = 17000; DAT_004514c4 = 0x42d6; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 0; force_puzzle_required_ball = 1; force_puzzle_ball_enabled[0] = 0; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 0; force_puzzle_ball_enabled[3] = 0; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 2; break; case 3: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 17000; SHORT_ARRAY_004514ce[1] = 0x4269; SHORT_ARRAY_004514ce[2] = 0x426a; SHORT_ARRAY_004514ce[3] = 0x426b; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x428a; DAT_004514c2 = 17000; DAT_004514c4 = 0x42d6; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 0; force_puzzle_required_ball = 1; force_puzzle_ball_enabled[0] = 0; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 0; force_puzzle_ball_enabled[3] = 0; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 6; break; case 4: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4296; SHORT_ARRAY_004514ce[1] = 0x4297; SHORT_ARRAY_004514ce[2] = 0x4298; SHORT_ARRAY_004514ce[3] = 0x4299; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x428b; DAT_004514c2 = 0x4269; DAT_004514c4 = 0x42f3; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 0; force_puzzle_required_ball = 3; force_puzzle_ball_enabled[0] = 0; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 0; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 0; break; case 5: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4296; SHORT_ARRAY_004514ce[1] = 0x4297; SHORT_ARRAY_004514ce[2] = 0x4298; SHORT_ARRAY_004514ce[3] = 0x4299; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x428b; DAT_004514c2 = 0x4269; DAT_004514c4 = 0x42f3; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 0; force_puzzle_required_ball = 3; force_puzzle_ball_enabled[0] = 0; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 0; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 2; break; case 6: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4296; SHORT_ARRAY_004514ce[1] = 0x4297; SHORT_ARRAY_004514ce[2] = 0x4298; SHORT_ARRAY_004514ce[3] = 0x4299; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x428b; DAT_004514c2 = 0x4269; DAT_004514c4 = 0x42f3; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 0; force_puzzle_required_ball = 3; force_puzzle_ball_enabled[0] = 0; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 0; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 3; break; case 7: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x429a; SHORT_ARRAY_004514ce[1] = 0x429b; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x428c; DAT_004514c2 = 0x426a; DAT_004514c4 = 0x42f7; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 0; force_puzzle_required_ball = 2; force_puzzle_ball_enabled[0] = 0; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 3; break; case 8: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x429a; SHORT_ARRAY_004514ce[1] = 0x429b; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x428c; DAT_004514c2 = 0x426a; DAT_004514c4 = 0x42f7; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 0; force_puzzle_required_ball = 2; force_puzzle_ball_enabled[0] = 0; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 7; break; case 9: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x429a; SHORT_ARRAY_004514ce[1] = 0x429b; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x428c; DAT_004514c2 = 0x426a; DAT_004514c4 = 0x42f7; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 0; force_puzzle_required_ball = 2; force_puzzle_ball_enabled[0] = 0; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 5; break; case 10: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x426c; SHORT_ARRAY_004514ce[1] = 0x426d; SHORT_ARRAY_004514ce[2] = 0x426e; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x428d; DAT_004514c2 = 0x426b; DAT_004514c4 = 0x42d7; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 0; force_puzzle_required_ball = 0; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 4; break; case 0xb: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x426c; SHORT_ARRAY_004514ce[1] = 0x426d; SHORT_ARRAY_004514ce[2] = 0x426e; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x428d; DAT_004514c2 = 0x426b; DAT_004514c4 = 0x42d7; DAT_0044fdfc = 0; force_puzzle_required_ball = 0; force_puzzle_gravity_idx = 0; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 1; break; case 0xc: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x426c; SHORT_ARRAY_004514ce[1] = 0x426d; SHORT_ARRAY_004514ce[2] = 0x426e; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x428d; DAT_004514c2 = 0x426b; DAT_004514c4 = 0x42d7; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 0; force_puzzle_required_ball = 0; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 0; break; case 0xd: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x426f; SHORT_ARRAY_004514ce[1] = 0x4270; SHORT_ARRAY_004514ce[2] = 0x4271; SHORT_ARRAY_004514ce[3] = 0x4272; SHORT_ARRAY_004514ce[4] = 0x4273; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x428e; DAT_004514c2 = 0x426c; DAT_004514c4 = 0x42d8; DAT_0044fdfc = 0; force_puzzle_required_gravity = 0; force_puzzle_gravity_idx = 1; force_puzzle_required_ball = 1; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 7; break; case 0xe: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4274; SHORT_ARRAY_004514ce[1] = 0x4275; SHORT_ARRAY_004514ce[2] = 0x4276; SHORT_ARRAY_004514ce[3] = 0x4277; SHORT_ARRAY_004514ce[4] = 0x4278; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x428f; DAT_004514c2 = 0x426d; DAT_004514c4 = 0x42d9; DAT_0044fdfc = 0; force_puzzle_required_gravity = 2; force_puzzle_gravity_idx = 3; force_puzzle_required_ball = 3; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 0; break; case 0xf: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x426f; SHORT_ARRAY_004514ce[1] = 0x4270; SHORT_ARRAY_004514ce[2] = 0x4271; SHORT_ARRAY_004514ce[3] = 0x4272; SHORT_ARRAY_004514ce[4] = 0x4273; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x428e; DAT_004514c2 = 0x426e; DAT_004514c4 = 0x42da; DAT_0044fdfc = 0; force_puzzle_required_gravity = 0; force_puzzle_gravity_idx = 1; force_puzzle_required_ball = 3; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 0; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 1; break; case 0x10: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4279; SHORT_ARRAY_004514ce[1] = 0x427b; SHORT_ARRAY_004514ce[2] = 0x427c; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x4290; DAT_004514c2 = 0x426f; DAT_004514c4 = 0x42db; DAT_0044fdfc = 0; force_puzzle_required_ball = 1; force_puzzle_required_friction = 2; force_puzzle_required_gravity = 3; force_puzzle_gravity_idx = 2; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 6; break; case 0x11: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4279; SHORT_ARRAY_004514ce[1] = 0x427b; SHORT_ARRAY_004514ce[2] = 0x427c; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x4290; DAT_004514c2 = 0x4270; DAT_004514c4 = 0x42dc; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 2; force_puzzle_required_friction = 2; force_puzzle_required_gravity = 3; force_puzzle_required_ball = 0; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 4; break; case 0x12: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4279; SHORT_ARRAY_004514ce[1] = 0x427b; SHORT_ARRAY_004514ce[2] = 0x427c; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x4290; DAT_004514c2 = 0x4271; DAT_004514c4 = 0x42dd; DAT_0044fdfc = 0; force_puzzle_required_friction = 2; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 3; force_puzzle_required_ball = 3; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 0; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 5; break; case 0x13: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x427d; SHORT_ARRAY_004514ce[1] = 0x427e; SHORT_ARRAY_004514ce[2] = 0x427f; SHORT_ARRAY_004514ce[3] = 0x4280; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x4291; DAT_004514c2 = 0x4272; DAT_004514c4 = 0x42df; DAT_0044fdfc = 0; force_puzzle_required_friction = 0; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 3; force_puzzle_required_ball = 1; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 4; break; case 0x14: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x427d; SHORT_ARRAY_004514ce[1] = 0x427e; SHORT_ARRAY_004514ce[2] = 0x427f; SHORT_ARRAY_004514ce[3] = 0x4280; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x4291; DAT_004514c2 = 0x4273; DAT_004514c4 = 0x42e0; DAT_0044fdfc = 0; force_puzzle_gravity_idx = 2; force_puzzle_required_friction = 0; force_puzzle_required_gravity = 3; force_puzzle_required_ball = 3; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 1; break; case 0x15: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x427d; SHORT_ARRAY_004514ce[1] = 0x427e; SHORT_ARRAY_004514ce[2] = 0x427f; SHORT_ARRAY_004514ce[3] = 0x4280; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x4291; DAT_004514c2 = 0x4274; DAT_004514c4 = 0x42e1; DAT_0044fdfc = 0; force_puzzle_required_friction = 0; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 3; force_puzzle_required_ball = 0; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 1; force_puzzle_glowing_hole_slot = 1; break; case 0x16: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4281; SHORT_ARRAY_004514ce[1] = 0x4282; SHORT_ARRAY_004514ce[2] = 0x4283; SHORT_ARRAY_004514ce[3] = 0x4284; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x4292; DAT_004514c2 = 0x4275; DAT_004514c4 = 0x42e2; DAT_0044fdfc = 1; SHORT_004498be = 0; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 3; force_puzzle_required_ball = 1; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 0; force_puzzle_incline_idx = 9; force_puzzle_glowing_hole_slot = 5; break; case 0x17: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4281; SHORT_ARRAY_004514ce[1] = 0x4282; SHORT_ARRAY_004514ce[2] = 0x4283; SHORT_ARRAY_004514ce[3] = 0x4284; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x4292; DAT_004514c2 = 0x4276; DAT_004514c4 = 0x42e3; DAT_0044fdfc = 1; force_puzzle_required_gravity = 3; SHORT_004498be = 2; force_puzzle_gravity_idx = 2; force_puzzle_required_ball = 1; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 2; force_puzzle_incline_idx = 0xb; force_puzzle_glowing_hole_slot = 5; break; case 0x18: DAT_004514be = 4; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4281; SHORT_ARRAY_004514ce[1] = 0x4282; SHORT_ARRAY_004514ce[2] = 0x4283; SHORT_ARRAY_004514ce[3] = 0x4284; SHORT_ARRAY_004514ce[4] = -1; SHORT_ARRAY_004514ec[0] = 0x4292; DAT_004514c2 = 0x4275; DAT_004514c4 = 0x42e2; DAT_0044fdfc = 1; force_puzzle_required_gravity = 3; SHORT_004498be = 0; force_puzzle_gravity_idx = 2; force_puzzle_required_ball = 1; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 0; force_puzzle_incline_idx = 9; force_puzzle_glowing_hole_slot = 2; break; case 0x19: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4285; SHORT_ARRAY_004514ce[1] = 0x4286; SHORT_ARRAY_004514ce[2] = 0x4287; SHORT_ARRAY_004514ce[3] = -1; SHORT_ARRAY_004514ec[0] = 0x4293; DAT_004514c2 = 0x4277; DAT_004514c4 = 0x42e4; DAT_0044fdfc = 1; SHORT_004498be = 3; force_puzzle_required_friction = 2; force_puzzle_required_gravity = 3; force_puzzle_gravity_idx = 2; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 0; break; case 0x1a: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4288; SHORT_ARRAY_004514ce[1] = 0x4289; SHORT_ARRAY_004514ce[2] = 0x428a; SHORT_ARRAY_004514ce[3] = 0x428b; SHORT_ARRAY_004514ce[4] = 0x428c; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x4294; DAT_004514c2 = 0x4278; DAT_004514c4 = 0x42e5; DAT_0044fdfc = 1; SHORT_004498be = 3; force_puzzle_required_friction = 0; force_puzzle_required_gravity = 3; force_puzzle_gravity_idx = 2; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 7; break; case 0x1b: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x428d; SHORT_ARRAY_004514ce[1] = 0x428e; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x4295; DAT_004514c2 = 0x4279; DAT_004514c4 = 0x42e6; DAT_0044fdfc = 1; force_puzzle_required_gravity = 0; SHORT_004498be = 3; force_puzzle_gravity_idx = 1; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 0; break; case 0x1c: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x428f; SHORT_ARRAY_004514ce[1] = 0x4290; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x4296; DAT_004514c2 = 0x427b; DAT_004514c4 = 0x42e7; DAT_0044fdfc = 1; force_puzzle_required_gravity = 2; SHORT_004498be = 3; force_puzzle_gravity_idx = 3; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 7; break; case 0x1d: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4291; SHORT_ARRAY_004514ce[1] = 0x4292; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x4297; DAT_004514c2 = 0x427c; DAT_004514c4 = 0x42e8; DAT_0044fdfc = 1; SHORT_004498be = 0; force_puzzle_gravity_idx = 2; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_idx = 9; force_puzzle_incline_base_idx = 0; force_puzzle_glowing_hole_slot = 0; break; case 0x1e: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4293; SHORT_ARRAY_004514ce[1] = 0x4294; SHORT_ARRAY_004514ce[2] = -1; SHORT_ARRAY_004514ec[0] = 0x4298; DAT_004514c2 = 0x427d; DAT_004514c4 = 0x42e9; DAT_0044fdfc = 1; SHORT_004498be = 2; force_puzzle_gravity_idx = 2; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_idx = 0xb; force_puzzle_incline_base_idx = 2; force_puzzle_glowing_hole_slot = 7; break; case 0x1f: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4295; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x4299; DAT_004514c2 = 0x427e; DAT_004514c4 = 0x42ea; DAT_0044fdfc = 1; SHORT_004498be = 3; force_puzzle_gravity_idx = 2; force_puzzle_required_friction = 2; force_puzzle_required_gravity = 0; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_idx = 10; force_puzzle_incline_base_idx = 1; force_puzzle_glowing_hole_slot = 1; break; case 0x20: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4295; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x4299; DAT_004514c2 = 0x427f; DAT_004514c4 = 0x42eb; DAT_0044fdfc = 1; SHORT_004498be = 3; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 2; force_puzzle_required_friction = 0; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_idx = 10; force_puzzle_incline_base_idx = 1; force_puzzle_glowing_hole_slot = 7; break; case 0x21: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4295; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x4299; DAT_004514c2 = 0x4280; DAT_004514c4 = 0x42ec; DAT_0044fdfc = 1; SHORT_004498be = 3; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 0; force_puzzle_required_friction = 0; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 0; break; case 0x22: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4295; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x4299; DAT_004514c2 = 0x4281; DAT_004514c4 = 0x42ed; DAT_0044fdfc = 1; SHORT_004498be = 0; force_puzzle_gravity_idx = 2; force_puzzle_required_friction = 2; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 3; break; case 0x23: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4295; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x4299; DAT_004514c2 = 0x4282; DAT_004514c4 = 0x42ee; DAT_0044fdfc = 1; SHORT_004498be = 2; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 3; force_puzzle_required_friction = 0; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 7; break; case 0x24: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4295; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x4299; DAT_004514c2 = 0x4283; DAT_004514c4 = 0x42ef; DAT_0044fdfc = 1; SHORT_004498be = 0; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 3; force_puzzle_required_friction = 0; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 0; break; case 0x25: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4295; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x4299; DAT_004514c2 = 0x4284; DAT_004514c4 = 0x42f0; DAT_0044fdfc = 1; SHORT_004498be = 0; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 0; force_puzzle_required_friction = 3; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 1; break; case 0x26: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4295; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x4299; DAT_004514c2 = 0x4285; DAT_004514c4 = 0x42f1; DAT_0044fdfc = 1; SHORT_004498be = 2; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 2; force_puzzle_required_friction = 3; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 5; break; case 0x27: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4295; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x4299; DAT_004514c2 = 0x4286; DAT_004514c4 = 0x42f2; DAT_0044fdfc = 1; SHORT_004498be = 2; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 0; force_puzzle_required_friction = 3; force_puzzle_required_ball = 4; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 7; break; case 0x28: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4295; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x4299; DAT_004514c2 = 0x4287; DAT_004514c4 = 0x42f4; DAT_0044fdfc = 1; SHORT_004498be = 2; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 0; force_puzzle_required_friction = 3; force_puzzle_required_ball = 1; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_idx = 10; force_puzzle_incline_base_idx = 1; force_puzzle_glowing_hole_slot = 0; break; case 0x29: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4295; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x4299; DAT_004514c2 = 0x4288; DAT_004514c4 = 0x42f5; DAT_0044fdfc = 1; SHORT_004498be = 0; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 2; force_puzzle_required_friction = 3; force_puzzle_required_ball = 0; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 4; break; case 0x2a: DAT_004514be = 1; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x4295; SHORT_ARRAY_004514ce[1] = -1; SHORT_ARRAY_004514ec[0] = 0x4299; DAT_004514c2 = 0x4289; DAT_004514c4 = 0x42f6; DAT_0044fdfc = 1; SHORT_004498be = 2; force_puzzle_gravity_idx = 2; force_puzzle_required_gravity = 2; force_puzzle_required_friction = 3; force_puzzle_required_ball = 3; force_puzzle_ball_enabled[0] = 1; force_puzzle_ball_enabled[1] = 1; force_puzzle_ball_enabled[2] = 1; force_puzzle_ball_enabled[3] = 1; force_puzzle_allow_oil = 1; force_puzzle_allow_sand = 1; force_puzzle_incline_base_idx = 1; force_puzzle_incline_idx = 10; force_puzzle_glowing_hole_slot = 0; } DAT_004514b4 = load_resource_item_0(DAT_004514c2,(int *)&text); return; } void __stdcall force_puzzle_make_mouse_regions(void) { mouse_region *pmVar1; short sVar2; mouse_region_delete_all_lists(); if (force_puzzle_state == 4) { mouse_region_new_up(0,0,0x1ff,0x17f,0,0x41b9ed); } else { mouse_region_new_up(0x18e,0x144,0x1f5,0x165,5,0x417ecb); mouse_region_new_up(0x12,0x19,0x3b,0x1f,5,0x41845e); if (force_puzzle_gravity_idx != 0) { mouse_region_gravity_low = (mouse_region *)mouse_region_new_up(6,0x103,0x52,0x13,5,0x417f05); mouse_region_gravity_low->extra_data = 0; mouse_region_gravity_norm = (mouse_region *)mouse_region_new_up(6,0x116,0x52,0x13,5,0x417f05); mouse_region_gravity_norm->extra_data = 1; mouse_region_gravity_high = (mouse_region *)mouse_region_new_up(6,0x129,0x52,0x14,5,0x417f05); mouse_region_gravity_high->extra_data = 2; } mouse_region_new_up(0,0,0x1ff,0x17f,0,0x41b9ed); if (DAT_0044fdfc != 0) { PTR_0044fddc = (mouse_region *)mouse_region_new_up(0xf6,0xc0,0x4b,0x62,5,0x41aad0); PTR_0044fddc->extra_data = 505; PTR_0044fde0 = (mouse_region *)mouse_region_new_up(0x141,0xa5,0x31,0x62,5,0x41aad0); PTR_0044fde0->extra_data = 506; PTR_0044fde4 = (mouse_region *)mouse_region_new_up(0x172,0x7d,0x6d,0x75,5,0x41aad0); PTR_0044fde4->extra_data = 507; } DAT_0044fdd8 = mouse_region_new_down(0x1bd,0x104,0x23,0x23,0xf,0x41aad0); *(undefined4 *)((int)DAT_0044fdd8 + 0x1e) = 100; sVar2 = 0; do { if (force_puzzle_ball_enabled[sVar2] != 0) { pmVar1 = (mouse_region *) mouse_region_new_up(force_puzzle_balls_sidebar_mouse_pos[sVar2].x, force_puzzle_balls_sidebar_mouse_pos[sVar2].y,0x27,0x22,10, 0x41aad0); force_puzzle_balls_sidebar_mouse_region[sVar2] = pmVar1; force_puzzle_balls_sidebar_mouse_region[sVar2]->extra_data = (int)sVar2; } sVar2 = sVar2 + 1; } while (sVar2 < 4); if (force_puzzle_allow_oil != 0) { force_oil_mouse_region = (mouse_region *)mouse_region_new_up(0x32,100,0x27,0x22,10,0x41aad0); force_oil_mouse_region->extra_data = 10; force_rag_mouse_region = (mouse_region *)mouse_region_new_up(0x32,0x86,0x27,0x22,10,0x41aad0); force_rag_mouse_region->extra_data = 0xb; } if (force_puzzle_allow_sand != 0) { force_sand_mouse_region = (mouse_region *)mouse_region_new_up(10,100,0x27,0x22,10,0x41aad0); force_sand_mouse_region->extra_data = 0xc; force_brush_mouse_region = (mouse_region *)mouse_region_new_up(10,0x86,0x27,0x22,10,0x41aad0); force_brush_mouse_region->extra_data = 0xd; } } if (DAT_004498d8 != 0) { mouse_region_new_up(10,0x140,0x14e,0x3c,0x19,0x41aabd); } return; } void __stdcall FUN_0041aabd(void) { DAT_004514f6 = 1; force_puzzle_state = 8; return; } void __cdecl mouse_region_main_mouse_handler(int param_1) { int iVar1; undefined4 *puVar2; if (force_puzzle_state == 3) { iVar1 = *(int *)(param_1 + 0x1e); if (iVar1 < 0xd) { if (iVar1 == 0xc) { if (force_puzzle_friction_type == 1) { force_puzzle_friction_type = 0; if (DAT_0044fdfc == 0) { free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_idx = force_puzzle_incline_base_idx + 3; force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 17031); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_apply_remove_stuff_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 17059); aseq_select_anim((int)force_puzzle_apply_remove_stuff_aseq,1); aseq_set_pos_order((int)force_puzzle_apply_remove_stuff_aseq, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx + 3].x, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx + 3].y, 0x46); anim_state_xxx_list_insert_4((undefined4 *)force_puzzle_apply_remove_stuff_aseq); } else { free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_idx = force_puzzle_incline_base_idx + 0xf; force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 17043); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_apply_remove_stuff_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 17059); aseq_select_anim((int)force_puzzle_apply_remove_stuff_aseq,1); aseq_set_pos_order((int)force_puzzle_apply_remove_stuff_aseq, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx + 3].x, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx + 3].y, 0x46); anim_state_xxx_list_insert_4((undefined4 *)force_puzzle_apply_remove_stuff_aseq); } force_puzzle_state = 6; play_wave_flag1(0x4a61,5,0); return; } } else { switch(iVar1) { case 0: if (force_puzzle_selected_ball_idx != -1) { free_aseq((int *)force_puzzle_selected_ball_aseq); } play_wave_flag1(0x1f73,5,0); force_puzzle_selected_ball_idx = 0; force_puzzle_selected_ball_aseq = (aseq_anim_state_struct *)load_aseq(17014); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_selected_ball_aseq); aseq_set_pos_order((int)force_puzzle_selected_ball_aseq,0x17d,0xd6,0x96); return; case 1: if (force_puzzle_selected_ball_idx != -1) { free_aseq((int *)force_puzzle_selected_ball_aseq); } force_puzzle_selected_ball_idx = 1; force_puzzle_selected_ball_aseq = (aseq_anim_state_struct *)load_aseq(17015); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_selected_ball_aseq); play_wave_flag1(0x1f73,5,0); aseq_set_pos_order((int)force_puzzle_selected_ball_aseq,0x17d,0xd6,0x96); return; case 2: if (force_puzzle_selected_ball_idx != -1) { free_aseq((int *)force_puzzle_selected_ball_aseq); } force_puzzle_selected_ball_idx = 2; force_puzzle_selected_ball_aseq = (aseq_anim_state_struct *)load_aseq(17016); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_selected_ball_aseq); play_wave_flag1(0x1f73,5,0); aseq_set_pos_order((int)force_puzzle_selected_ball_aseq,0x17d,0xd6,0x96); return; case 3: if (force_puzzle_selected_ball_idx != -1) { free_aseq((int *)force_puzzle_selected_ball_aseq); } force_puzzle_selected_ball_idx = 3; force_puzzle_selected_ball_aseq = (aseq_anim_state_struct *)load_aseq(17017); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_selected_ball_aseq); play_wave_flag1(0x1f73,5,0); aseq_set_pos_order((int)force_puzzle_selected_ball_aseq,0x17d,0xd6,0x96); return; case 10: if (force_puzzle_friction_type == 1) { force_puzzle_friction_type = 2; if (DAT_0044fdfc == 0) { free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_idx = force_puzzle_incline_base_idx + 6; force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 17034); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_apply_remove_stuff_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 17056); aseq_select_anim((int)force_puzzle_apply_remove_stuff_aseq,1); aseq_set_pos_order((int)force_puzzle_apply_remove_stuff_aseq, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx].x, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx].y,0x46 ); anim_state_xxx_list_insert_4((undefined4 *)force_puzzle_apply_remove_stuff_aseq); } else { free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_idx = force_puzzle_incline_base_idx + 0xc; force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 17040); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_apply_remove_stuff_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 0x42a0); aseq_select_anim((int)force_puzzle_apply_remove_stuff_aseq,1); aseq_set_pos_order((int)force_puzzle_apply_remove_stuff_aseq, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx].x, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx].y,0x46 ); anim_state_xxx_list_insert_4((undefined4 *)force_puzzle_apply_remove_stuff_aseq); } force_puzzle_state = 6; play_wave_flag1(0x4a5b,5,0); return; } break; case 0xb: if (force_puzzle_friction_type == 2) { force_puzzle_friction_type = 1; if (DAT_0044fdfc == 0) { free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_idx = force_puzzle_incline_base_idx; force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 17028); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_apply_remove_stuff_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 17056); aseq_select_anim((int)force_puzzle_apply_remove_stuff_aseq,0); aseq_set_pos_order((int)force_puzzle_apply_remove_stuff_aseq, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx].x, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx].y,0x46 ); anim_state_xxx_list_insert_4((undefined4 *)force_puzzle_apply_remove_stuff_aseq); } else { free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_idx = force_puzzle_incline_base_idx + 9; force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 17037); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_apply_remove_stuff_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 17056); aseq_select_anim((int)force_puzzle_apply_remove_stuff_aseq,0); aseq_set_pos_order((int)force_puzzle_apply_remove_stuff_aseq, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx].x, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx].y,0x46 ); anim_state_xxx_list_insert_4((undefined4 *)force_puzzle_apply_remove_stuff_aseq); } force_puzzle_state = 6; play_wave_flag1(0x1f5f,5,0); return; } } } } else if (iVar1 < 506) { if (iVar1 == 505) { clear_cursor_override_regions(); if (force_puzzle_friction_type == 0) { force_puzzle_incline_idx = 0xf; force_puzzle_incline_base_idx = 0; free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_idx + 0x4284); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_make_mouse_regions(); } else if (force_puzzle_friction_type == 1) { force_puzzle_incline_idx = 9; force_puzzle_incline_base_idx = 0; aseq_set_pos_order((int)force_puzzle_incline_aseq,force_puzzle_incline_pos[9].x, force_puzzle_incline_pos[9].y,0x3c); force_puzzle_make_mouse_regions(); } else if (force_puzzle_friction_type == 2) { force_puzzle_incline_idx = 0xc; force_puzzle_incline_base_idx = 0; free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_idx + 0x4284); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_make_mouse_regions(); } force_puzzle_setup_cur_override_regions_wrap(); return; } if (iVar1 == 0xd) { if (force_puzzle_friction_type == 0) { force_puzzle_friction_type = 1; if (DAT_0044fdfc == 0) { free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_idx = force_puzzle_incline_base_idx; force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 0x4284); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_apply_remove_stuff_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 0x42a3); aseq_select_anim((int)force_puzzle_apply_remove_stuff_aseq,0); aseq_set_pos_order((int)force_puzzle_apply_remove_stuff_aseq, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx + 3].x, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx + 3].y, 0x46); anim_state_xxx_list_insert_4((undefined4 *)force_puzzle_apply_remove_stuff_aseq); } else { free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_idx = force_puzzle_incline_base_idx + 9; force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 0x428d); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_apply_remove_stuff_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_base_idx + 0x42a3); aseq_select_anim((int)force_puzzle_apply_remove_stuff_aseq,0); aseq_set_pos_order((int)force_puzzle_apply_remove_stuff_aseq, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx + 3].x, force_puzzle_apply_remove_pos[force_puzzle_incline_base_idx + 3].y, 0x46); anim_state_xxx_list_insert_4((undefined4 *)force_puzzle_apply_remove_stuff_aseq); } force_puzzle_state = 6; play_wave_flag1(0x4a4c,5,0); return; } } else if (iVar1 == 100) { clip_cursor_enable(300,100,0xd2,0x11a); clear_cursor_override_regions(); DAT_0044fe54 = load_aseq(0x36ba); puVar2 = (undefined4 *)aseq_setup_as_cursor((int)DAT_0044fe54,0,0); set_custom_cursor(puVar2); if (force_puzzle_selected_ball_idx != -1) { free_aseq((int *)force_puzzle_selected_ball_aseq); force_puzzle_selected_ball_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_selected_ball_idx + 0x4276); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_selected_ball_aseq); aseq_set_pos_order((int)force_puzzle_selected_ball_aseq,0x17d,0xd6,0x96); } force_puzzle_state = 4; play_wave_flag1(0x1f73,5,0); force_puzzle_make_mouse_regions(); return; } } else { if (iVar1 == 506) { clear_cursor_override_regions(); if (force_puzzle_friction_type == 0) { force_puzzle_incline_idx = 0x10; force_puzzle_incline_base_idx = 1; free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_idx + 0x4284); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_make_mouse_regions(); } else if (force_puzzle_friction_type == 1) { force_puzzle_incline_idx = 10; force_puzzle_incline_base_idx = 1; aseq_set_pos_order((int)force_puzzle_incline_aseq,force_puzzle_incline_pos[10].x, force_puzzle_incline_pos[10].y,0x3c); force_puzzle_make_mouse_regions(); } else if (force_puzzle_friction_type == 2) { force_puzzle_incline_idx = 0xd; force_puzzle_incline_base_idx = 1; free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_idx + 0x4284); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_make_mouse_regions(); } force_puzzle_setup_cur_override_regions_wrap(); return; } if (iVar1 == 0x1fb) { clear_cursor_override_regions(); if (force_puzzle_friction_type == 0) { force_puzzle_incline_idx = 17; force_puzzle_incline_base_idx = 2; free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_idx + 17028); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_make_mouse_regions(); } else if (force_puzzle_friction_type == 1) { force_puzzle_incline_idx = 0xb; force_puzzle_incline_base_idx = 2; aseq_set_pos_order((int)force_puzzle_incline_aseq,force_puzzle_incline_pos[0xb].x, force_puzzle_incline_pos[0xb].y,0x3c); force_puzzle_make_mouse_regions(); } else if (force_puzzle_friction_type == 2) { force_puzzle_incline_idx = 14; force_puzzle_incline_base_idx = 2; free_aseq((int *)force_puzzle_incline_aseq); force_puzzle_incline_aseq = (aseq_anim_state_struct *)load_aseq(force_puzzle_incline_idx + 17028); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_incline_aseq); aseq_set_pos_order((int)force_puzzle_incline_aseq, force_puzzle_incline_pos[force_puzzle_incline_idx].x, force_puzzle_incline_pos[force_puzzle_incline_idx].y,0x3c); force_puzzle_make_mouse_regions(); } force_puzzle_setup_cur_override_regions_wrap(); return; } } } else if (force_puzzle_state != 4) { return; } return; } void __stdcall force_puzzle_mouse_on_bg(void) { if (force_puzzle_state != 3) { if (force_puzzle_state != 4) { return; } free_cur_cursor(); free_aseq(DAT_0044fe54); clip_cursor_disable(); anim_state_xxx_list_remove((int *)force_puzzle_plunger_aseq); aseq_select_anim((int)force_puzzle_plunger_aseq,0); anim_state_xxx_list_insert_8004((undefined4 *)force_puzzle_plunger_aseq); aseq_set_pos_order((int)force_puzzle_plunger_aseq,0x18e,0xe3,200); force_puzzle_state = 3; force_puzzle_make_mouse_regions(); force_puzzle_setup_cur_override_regions_wrap(); if ((force_puzzle_plunger_force != 0) && (force_puzzle_selected_ball_idx != -1)) { force_puzzle_compute_distance(); FUN_0041bba7(); } } return; } void __stdcall force_puzzle_compute_distance(void) { short sVar1; if (force_puzzle_selected_ball_idx == 2) { sVar1 = force_puzzle_ball_modifier[force_puzzle_selected_ball_idx] + 2; } else { sVar1 = force_puzzle_ball_modifier[force_puzzle_selected_ball_idx] + force_puzzle_friction_modifier[force_puzzle_friction_type]; } force_puzzle_computed_distance = force_puzzle_distances [(short)(sVar1 + force_puzzle_gravity_modifier[force_puzzle_gravity_idx] + force_puzzle_incline_modifier[force_puzzle_incline_base_idx] + force_puzzle_plunger_force + -1)]; return; } undefined4 __stdcall force_puzzle_is_cleared(void) { int in_EAX; if ((force_puzzle_required_friction != 3) && (in_EAX = CONCAT22((short)((uint)in_EAX >> 0x10),force_puzzle_required_friction), force_puzzle_required_friction != force_puzzle_friction_type)) { return 0; } if ((force_puzzle_required_ball != 4) && (in_EAX = CONCAT22((short)((uint)in_EAX >> 0x10),force_puzzle_required_ball), force_puzzle_required_ball != force_puzzle_selected_ball_idx)) { return 0; } if ((force_puzzle_required_gravity != 3) && (in_EAX = (int)force_puzzle_required_gravity, in_EAX != force_puzzle_gravity_idx + -1)) { return 0; } if ((force_puzzle_glowing_hole_slot != -1) && (in_EAX = force_puzzle_computed_distance + -4, in_EAX != force_puzzle_glowing_hole_slot)) { return 0; } if ((SHORT_004498be != 3) && (SHORT_004498be != force_puzzle_incline_base_idx)) { return 0; } return CONCAT22((short)((uint)in_EAX >> 0x10),1); } void __stdcall FUN_0041bba7(void) { DAT_0044fdea = force_puzzle_selected_ball_aseq->default_x; DAT_0044fdec = force_puzzle_selected_ball_aseq->default_y; DAT_0044fdfe = 0xffff; if (-1 < force_puzzle_computed_distance + -4) { DAT_0044fdee = 1; play_wave_flag1(0x1f67,5,1); force_puzzle_state = 7; return; } DAT_0044fdee = 0; clear_cursor_override_regions(); force_puzzle_state = 1; return; } void __stdcall FUN_0041bc1d(void) { force_puzzle_redraw_gfx(); if (force_puzzle_state == 4) { force_puzzle_state = 3; } force_puzzle_make_mouse_regions(); return; } void __cdecl force_puzzle_setup_cur_override_regions(short param_1) { undefined2 *puVar1; if (param_1 == 0) { free_tracked_heap_block((int)DAT_0044fe58); } puVar1 = (undefined2 *)alloc_tracked_heap_block(0x10); DAT_0044fe58 = puVar1; *puVar1 = 0; puVar1[1] = 5; puVar1[3] = 0x17a; puVar1[2] = 0x1ff; *(aseq_cursor_struct **)(puVar1 + 6) = force_hand_cur; puVar1[5] = 0; set_cursor_override_regions((int)DAT_0044fe58,1); return; } void __stdcall clear_cursor_override_regions(void) { set_cursor_override_regions(0,0); return; } void __stdcall force_puzzle_setup_cur_override_regions_wrap(void) { force_puzzle_setup_cur_override_regions(0); return; } void __stdcall FUN_0041bcba(void) { if (force_puzzle_state == 4) { force_puzzle_state = 3; } return; } undefined4 __stdcall FUN_0041bcd0(void) { if ((int)force_puzzle_glowing_hole_slot < force_puzzle_computed_distance + -4) { DAT_0044fe00 = 0xf; } else { DAT_0044fe00 = 0xfff1; } return CONCAT22((short)((uint)(force_puzzle_computed_distance + -4) >> 0x10),DAT_0044fe00); } void init_new_save_file_big(undefined4 param_1) { short sVar1; undefined4 local_1774 [12]; undefined2 local_1744; undefined2 local_1740; undefined2 local_173e; undefined2 local_173c; undefined4 uStack_1004; uStack_1004 = param_1; memset(local_1774,0,5999); local_1744 = 0xffff; local_173c = 0xffff; local_173e = 0xffff; local_1740 = 0xffff; sVar1 = is_bgm_enabled(); save_file_big->sounds_music_disabled = (ushort)(sVar1 == 0); sVar1 = are_voices_enabled(); save_file_big->voices_disabled = (ushort)(sVar1 == 0); disable_hints = 0; save_file_big->disable_hints = 0; memcpy((undefined4 *)save_file_big,local_1774,5999); return; } short __cdecl open_ssgwin_dat(ushort param_1,short param_2) { short sVar1; char local_11c [256]; char local_1c [12]; char local_10 [4]; short local_c; sVar1 = 1; strcpy(local_11c,windows_dir); strcat(local_11c,s_ssgwin_dat_00449908); if (param_1 == 1) { strcpy(local_1c,s_rb_00449918); } else if ((param_1 & 4) == 0) { strcpy(local_1c,s_r_b_0044991f); } else { strcpy(local_1c,s_w_b_0044991b); } ssgwin_dat_file = fopen(local_11c,local_1c); if (ssgwin_dat_file == (int *)0x0) { if (param_2 == 0) { sVar1 = 0; } else { xxxfunc_set(&exit_game_funcset); } } if ((param_1 == 1) && (sVar1 != 0)) { fread(local_10,8,1,ssgwin_dat_file); if (local_c != 0x11) { sVar1 = 0; } } if (sVar1 != 0) { fseek(ssgwin_dat_file,0,0); } return sVar1; } void __cdecl readdatfile(char *param_1,ushort param_2,short param_3) { uint uVar1; uVar1 = fread(param_1,(uint)param_2,1,ssgwin_dat_file); if ((uVar1 != 1) && (param_3 != 0)) { alert_message(s_ReadDatFile_Error_00449923); xxxfunc_set(&exit_game_funcset); } return; } void __stdcall FUN_0041bee6(void) { FUN_00422170(); dec_clear_repost_mouse_downup(1); gfxish_copy_dest_to_otherbuf_wrap(); show_dialog_wait_continue_with_ids(0x3fd,0xffff); xxxfunc_set(&exit_game_funcset); return; } bool __cdecl write_save_file_and_xxx(byte *param_1,ushort param_2) { uint uVar1; bool bVar2; uVar1 = fwrite(param_1,(uint)param_2,1,ssgwin_dat_file); bVar2 = (short)uVar1 != 1; if (bVar2) { FUN_0041bee6(); } return bVar2; } void __stdcall close_ssgwin_dat(void) { fclose(ssgwin_dat_file); return; } void __cdecl load_save_5999_xxx(ushort param_1) { open_ssgwin_dat(1,1); fseek(ssgwin_dat_file,(uint)param_1 * 5999 + 0x8a0,0); readdatfile((char *)save_file_big,5999,1); close_ssgwin_dat(); disable_hints = save_file_big->disable_hints; set_bgm_enabled((ushort)(save_file_big->sounds_music_disabled == 0)); set_voices_enabled((ushort)(save_file_big->voices_disabled == 0)); return; } bool __stdcall write_save_big_xxx(void) { word wVar1; save_file_main *psVar2; bool bVar3; short sVar4; undefined3 extraout_var; if (DAT_00449914 == 0) { save_file_big->disable_hints = disable_hints; sVar4 = is_bgm_enabled(); save_file_big->sounds_music_disabled = (ushort)(sVar4 == 0); sVar4 = are_voices_enabled(); save_file_big->voices_disabled = (ushort)(sVar4 == 0); if (DAT_00449c4a != 0) { save_file_big->xxx[(short)save_file_big->building_idx] = 1; psVar2 = save_file_big; wVar1 = save_file_big->building_idx; memcpy((undefined4 *)(save_file_big->per_building_data + (short)wVar1), (undefined4 *)&save_file_big->basic_stats,0x14); write_parts_fields(psVar2->per_building_data[(short)wVar1].parts_state_xxx[0]); write_doors_items(psVar2->per_building_data[(short)wVar1].doors_state, psVar2->per_building_data[(short)wVar1].items_state); write_actors((int)psVar2->per_building_data[(short)wVar1].actor_state); DAT_00449c4a = 0; } if (((save_file_big->player_entry).name[0] == '\0') && (DAT_00449916 == 0)) { alert_message(s_Writing_Empty_Name__Bad__00449935); } open_ssgwin_dat(2,1); fseek(ssgwin_dat_file,(short)(save_file_big->player_entry).idx * 5999 + 0x8a0,0); bVar3 = write_save_file_and_xxx((byte *)save_file_big,5999); bVar3 = (short)CONCAT31(extraout_var,bVar3) != 0; if (!bVar3) { fseek(ssgwin_dat_file,selected_file_idx * 0x16 + 8,0); fwrite((byte *)save_file_big,0x16,1,ssgwin_dat_file); } close_ssgwin_dat(); } else { bVar3 = false; } return bVar3; } void __cdecl rand_shuffle_array(short param_1,short *param_2) { short sVar1; short *psVar2; uint uVar3; short sVar4; short sVar5; short sVar6; sVar6 = 0; psVar2 = param_2; if (0 < param_1) { do { *psVar2 = sVar6; psVar2 = psVar2 + 1; sVar6 = sVar6 + 1; } while (sVar6 < param_1); } sVar6 = 0; if (0 < (short)(param_1 * 10)) { do { if (param_1 == 0) { sVar4 = 0; sVar5 = 0; } else { uVar3 = rand(); sVar4 = (short)((int)uVar3 % (int)param_1); uVar3 = rand(); sVar5 = (short)((int)uVar3 % (int)param_1); } sVar1 = param_2[sVar4]; param_2[sVar4] = param_2[sVar5]; param_2[sVar5] = sVar1; sVar6 = sVar6 + 1; } while (sVar6 < (short)(param_1 * 10)); } return; } undefined4 * __cdecl actor_parts_find_held_by(undefined4 *param_1,short param_2,ushort param_3) { bool bVar1; int iVar2; undefined4 *unaff_EBX; ushort uVar3; bVar1 = false; iVar2 = linked_list_sz(param_1); uVar3 = param_3; if ((ushort)iVar2 == 0) { unaff_EBX = (undefined4 *)0x0; } else { while (!bVar1) { unaff_EBX = linked_list_index(param_1,uVar3); if ((((int)*(short *)((int)unaff_EBX + 0x36) & 0x8000U) == 0) && (*(short *)(unaff_EBX + 3) == param_2)) { bVar1 = true; } else { uVar3 = uVar3 + 1; if (uVar3 == (ushort)iVar2) { uVar3 = 0; } if (uVar3 == param_3) { unaff_EBX = (undefined4 *)0x0; bVar1 = true; } } } } return unaff_EBX; } void __cdecl get_rank_for_score(uint param_1) { short sVar1; sVar1 = 0; do { if (param_1 < (uint)score_thresholds[sVar1]) { return; } sVar1 = sVar1 + 1; } while (sVar1 < 7); return; } void __stdcall gear_puzzle_on_load(void) { DAT_0044ff28 = 0; wave_load_list[0] = 0x4a4e; wave_load_list[1] = 0x4a4f; wave_load_list[2] = 0x1f73; wave_load_list[3] = 0x4a54; wave_load_list[4] = 0x4a5f; wave_load_list[5] = 0x1fa7; wave_load_list[6] = 0x1f5c; wave_load_list[7] = 0x4a79; wave_load_list[8] = -1; aseq_14012_small_gear = (aseq_anim_state_struct *)load_aseq(14012); aseq_14007_big_gear = (aseq_anim_state_struct *)load_aseq(14007); aseq_14010_px = (aseq_anim_state_struct *)load_aseq(14010); aseq_14012_small_gear_cursor = (aseq_cursor_struct *)aseq_setup_as_cursor((int)aseq_14012_small_gear,0x11,0x1c); aseq_14007_big_gear_cursor = (aseq_cursor_struct *)aseq_setup_as_cursor((int)aseq_14007_big_gear,0x11,0x20); aseq_14010_px_cursor = (aseq_cursor_struct *)aseq_setup_as_cursor((int)aseq_14010_px,0,0); load_waves_from_list(0x451486); load_and_draw_score(); FUN_0043d7c1(FUN_0041fef3); load_gear(puzzle_idx); gear_puzzle_setup_structs(puzzle_idx); gear_puzzle_setup_objs(); gear_puzzle_draw(); gear_draw_counts_on_left(); gear_update_anim_states_and_maybe_play_sound(1); gear_puzzle_setup_mouse_regions(); FUN_00430e33(DAT_00449ad4); key_xxxxx_set(FUN_0041d620); gear_shuffle_some_fields(); aseq_15009_gear_go_back = (aseq_anim_state_struct *)load_aseq(15009); aseq_set_pos_order((int)aseq_15009_gear_go_back,0x18e,0x143,10); aseq_15005_gear_hint = load_aseq(15005); aseq_set_pos_order((int)aseq_15005_gear_hint,0x25,0x2e,1); gear_aseq_14011_hand = (aseq_anim_state_struct *)load_aseq(14011); gear_aseq_14011_hand_cursor = (aseq_cursor_struct *)aseq_setup_as_cursor((int)gear_aseq_14011_hand,0,0); gear_aseq_14011_hand_cursor->enable_clip_cursor = 0; gear_puzzle_setup_hand_cursor(1); on_deactivate_xtra_cb = FUN_0042012f; FUN_00422170(); return; } void __stdcall gear_puzzle_on_remove(void) { if (DAT_004514b0 != 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; } on_deactivate_xtra_cb = (undefined *)0x0; free_tracked_heap_block(DAT_0044fe84); set_cursor_override_regions(0,0); free_aseq((int *)gear_aseq_14011_hand); aseq_free_cursor((int)gear_aseq_14011_hand_cursor); aseq_14012_small_gear = (aseq_anim_state_struct *)free_aseq((int *)aseq_14012_small_gear); aseq_14007_big_gear = (aseq_anim_state_struct *)free_aseq((int *)aseq_14007_big_gear); aseq_14010_px = (aseq_anim_state_struct *)free_aseq((int *)aseq_14010_px); aseq_free_cursor((int)aseq_14012_small_gear_cursor); aseq_free_cursor((int)aseq_14007_big_gear_cursor); aseq_free_cursor((int)aseq_14010_px_cursor); FUN_00431029(); FUN_00430ef4(0x451486); DAT_004514ae = DAT_00449ad4; FUN_0043d7c1(0); mouse_region_delete_all_lists(); FUN_0041d587(); key_xxxxx_clear(); free_resource_item_with_idx_fourcc(puzzle_idx + 0x3714,(undefined1 *)&gear); free_resource_item_with_idx_fourcc(DAT_004514c2,(undefined1 *)&text); free_wave_flag_2(DAT_004514b0); FUN_0042211c(); return; } void __stdcall gear_puzzle_on_periodic(void) { short sVar1; undefined4 uVar2; new_player_hint(0xf); if (DAT_0044ff28 == 0) { DAT_0044ff28 = 1; DAT_004514b0 = DAT_004514c4; load_wave_flag_2(DAT_004514c4); play_wave_flag2(DAT_004514b0); } get_mouse_xy_relative_(&gear_mouse_x,&gear_mouse_y); if (DAT_0044febc != 0) { DAT_0044febc = 0; gear_puzzle_setup_mouse_regions(); gear_draw_counts_on_left(); } if (gear_puzzle_state == 0) { sVar1 = wave_is_playing_(DAT_004514b0); if (sVar1 == 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; gear_puzzle_state = 2; return; } } else if (gear_puzzle_state == 1) { gear_puzzle_do_cranking(); if (DAT_00449ad4 == 0) { uVar2 = gear_puzzle_count_buttons_pressed(); DAT_00449ad4 = (short)uVar2; if (DAT_00449ad4 != 0) { solved_the_puzzle(19065); inc_score_by_400(); gear_puzzle_setup_mouse_regions(); return; } } } else if (gear_puzzle_state != 4) { if (gear_puzzle_state != 0xc) { return; } xxxfunc_set(&puzzle_choosing_funcset_xxx); } return; } void __stdcall FUN_0041c668(void) { anim_state_xxx_list_insert_4(aseq_15005_gear_hint); aseq_set_pos_order((int)aseq_15005_gear_hint,0x25,0x2e,1); xxx_periodic_loop(); gear_puzzle_state = 0xc; return; } void __stdcall FUN_0041c69b(void) { byte local_38 [52]; load_nfnt(15000); gfxish_copy_otherbuf_to_dest_and_invalidate(10,0x14a,0xfa,0x28); sprintf(local_38); FUN_0043dc0b(15000,PTR_s_Normal_00449be4,10,0x159,0); FUN_0043dc0b(15000,local_38,10,0x16d,0); gfxish_invalidate_rect_wrap(10,0x14a,0x96,0x28); free_nfnt(15000); return; } void __stdcall gear_puzzle_setup_mouse_regions(void) { short sVar1; undefined4 uVar2; mouse_region *pmVar3; short sVar4; short sVar5; code *pcVar6; mouse_region_delete_all_lists(); if (gear_puzzle_state == 1) { DAT_0044ff10 = mouse_region_new_up(0,0,0x200,0x180,4,0x41cac3); *(undefined4 *)((int)DAT_0044ff10 + 0x1e) = 100; } else { DAT_0044ff00 = mouse_region_new_up(8,0xa3,0x79,0x79,1,0x41cac3); *(undefined4 *)((int)DAT_0044ff00 + 0x1e) = 1000; DAT_0044ff04 = mouse_region_new_up(0x89,0x2c,0x165,0xf9,1,0x41cac3); *(undefined4 *)((int)DAT_0044ff04 + 0x1e) = 1001; DAT_0044ff0c = mouse_region_new_up(0x18e,0x144,100,0x32,5,0x41cac3); *(undefined4 *)((int)DAT_0044ff0c + 0x1e) = 1003; DAT_0044ff08 = mouse_region_new_up(0x25,0x2e,0x39,0x1c,0x32,0x41cac3); *(undefined4 *)((int)DAT_0044ff08 + 0x1e) = 1002; sVar4 = 0; do { if (loaded_gear_more_data[sVar4].type != 0xffff) { if (loaded_gear_more_data[sVar4].type < 2) { if (loaded_gear_more_data[sVar4].xish != -99) { pmVar3 = (mouse_region *) mouse_region_new_up((loaded_gear_more_data[sVar4].aseq_struct)->default_x, (loaded_gear_more_data[sVar4].aseq_struct)->default_y, ((loaded_gear_more_data[sVar4].aseq_struct)->some_rect).w, ((loaded_gear_more_data[sVar4].aseq_struct)->some_rect).h, 10,0x41cac3); loaded_gear_more_data[sVar4].mouse_region = pmVar3; (loaded_gear_more_data[sVar4].mouse_region)->extra_data = (int)sVar4 + 2000; } } else if (loaded_gear_more_data[sVar4].type == 6) { pcVar6 = gear_puzzle_mouse_handler; sVar5 = 0xf; uVar2 = aseq_get_img_h((int)loaded_gear_more_data[sVar4].aseq_struct, (loaded_gear_more_data[sVar4].aseq_struct)->ptr_to_anim_entry-> img_idx); sVar1 = (short)uVar2; uVar2 = aseq_get_img_w((int)loaded_gear_more_data[sVar4].aseq_struct, (loaded_gear_more_data[sVar4].aseq_struct)->ptr_to_anim_entry-> img_idx); gear_puzzle_crank_mouse_region = (mouse_region *) mouse_region_new_down ((loaded_gear_more_data[sVar4].aseq_struct)->default_x + (loaded_gear_more_data[sVar4].aseq_struct)->ptr_to_anim_entry->x, (loaded_gear_more_data[sVar4].aseq_struct)->default_y + (loaded_gear_more_data[sVar4].aseq_struct)->ptr_to_anim_entry->y, (short)uVar2,sVar1,sVar5,(uint)pcVar6); gear_puzzle_crank_mouse_region->extra_data = 1100; } } sVar4 = sVar4 + 1; } while (sVar4 < 100); sVar4 = 1; do { if (gear_puzzle_gears_in_sidebar[sVar4] != 0) { pcVar6 = gear_puzzle_mouse_handler; sVar5 = 5; uVar2 = aseq_get_img_h((int)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar4].gear_aseq,0 ); sVar1 = (short)uVar2; uVar2 = aseq_get_img_w((int)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar4].gear_aseq,0 ); pmVar3 = (mouse_region *) mouse_region_new_up(gear_lhs_xpos[sVar4],gear_lhs_ypos[sVar4],(short)uVar2,sVar1, sVar5,(uint)pcVar6); gear_lhs_mouse_regions[sVar4] = pmVar3; gear_lhs_mouse_regions[sVar4]->extra_data = (int)sVar4; } sVar4 = sVar4 + -1; } while (-1 < sVar4); if (DAT_00449ad4 != 0) { mouse_region_new_up(10,0x140,0x14e,0x3c,0x19,0x41cab0); } } return; } void __stdcall FUN_0041cab0(void) { DAT_004514f6 = 1; gear_puzzle_state = 0xc; return; } uint __cdecl gear_puzzle_mouse_handler(int param_1) { uint uVar1; int iVar2; uint uVar3; aseq_anim_state_struct *paVar4; undefined2 extraout_var; iVar2 = (int)gear_puzzle_state; if (iVar2 == 1) { uVar3 = *(int *)(param_1 + 0x1e) - 100; if (uVar3 == 0) { clip_cursor_disable(); gear_shuffle_some_fields_ccc(); gear_puzzle_state = 2; free_aseq((int *)loaded_gear_more_data->aseq_struct); paVar4 = (aseq_anim_state_struct *)load_aseq(14008); loaded_gear_more_data->aseq_struct = paVar4; gear_update_anim_states_and_maybe_play_sound(1); gear_puzzle_setup_hand_cursor_and_free_memory(); uVar3 = gear_puzzle_setup_mouse_regions(); return uVar3; } } else if (iVar2 == 2) { uVar1 = *(uint *)(param_1 + 0x1e); if ((int)uVar1 < 1004) { if (uVar1 == 1003) { anim_state_xxx_list_insert_4((undefined4 *)aseq_15009_gear_go_back); uVar3 = xxx_periodic_loop(); gear_puzzle_state = 0xc; return uVar3; } if (uVar1 < 2) { uVar3 = gear_pick_up_from_left(*(short *)(param_1 + 0x1e)); return uVar3; } uVar3 = uVar1 - 0x3ea; if (uVar3 == 0) { uVar3 = gear_puzzle_hint_maybe(); return uVar3; } } else { if (uVar1 == 1100) { clear_cursor_override_regions(); set_custom_cursor((undefined4 *)aseq_14010_px_cursor); clip_cursor_enable(10,10,500,0x168); free_aseq((int *)loaded_gear_more_data->aseq_struct); paVar4 = (aseq_anim_state_struct *)load_aseq(14009); loaded_gear_more_data->aseq_struct = paVar4; gear_puzzle_state = 1; gear_update_anim_states_and_maybe_play_sound(1); gear_puzzle_setup_mouse_regions(); gear_shuffle_some_fields_bbb(); gear_cranking_start_mouse_x = gear_mouse_x; gear_cranking_start_mouse_y = gear_mouse_y; return CONCAT22(extraout_var,gear_mouse_y); } uVar3 = uVar1 - 0x834; if (uVar1 - 2000 < 100) { uVar3 = gear_pick_up_from_board(*(short *)(param_1 + 0x1e) + -2000); return uVar3; } } } else { uVar3 = iVar2 - 4; if (uVar3 == 0) { uVar1 = *(uint *)(param_1 + 0x1e); if ((int)uVar1 < 0x3eb) { if (uVar1 == 0x3ea) { uVar3 = gear_puzzle_hint_maybe(); return uVar3; } if ((uVar1 < 2) || (uVar1 == 1000)) { clear_cursor_override_regions(); gear_puzzle_state = 2; gear_puzzle_gears_in_sidebar[DAT_0044fec0] = gear_puzzle_gears_in_sidebar[DAT_0044fec0] + 1; gear_puzzle_related_xxx_struct_ARRAY_0044fe94[DAT_0044fec0].field0_0x0 = DAT_0044fe7a; gear_draw_counts_on_left(); gear_puzzle_setup_mouse_regions(); DAT_0044fec0 = 0xffff; uVar3 = gear_puzzle_setup_hand_cursor_and_free_memory(); return uVar3; } uVar3 = uVar1 - 0x3e9; if (uVar3 == 0) { LAB_0041cb21: uVar3 = FUN_0041e070(gear_mouse_x,gear_mouse_y); return uVar3; } } else { if (uVar1 == 1003) { anim_state_xxx_list_insert_4((undefined4 *)aseq_15009_gear_go_back); xxx_periodic_loop(); play_wave_flag1(0x1f5c,5,0); uVar3 = xxx_periodic_loop(); gear_puzzle_state = 0xc; return uVar3; } uVar3 = uVar1 - 0x834; if (uVar1 - 2000 < 100) goto LAB_0041cb21; } } } return uVar3; } void __stdcall gear_puzzle_do_cranking(void) { short sVar1; short sVar2; uint uVar3; sVar1 = gear_cranking_start_mouse_y; sVar2 = gear_cranking_start_mouse_x; DAT_0044ff18 = gear_cranking_start_mouse_x; DAT_0044ff1a = gear_cranking_start_mouse_y; gear_cranking_start_mouse_x = gear_mouse_x; gear_cranking_start_mouse_y = gear_mouse_y; if ((gear_mouse_x != sVar2) || (gear_mouse_y != sVar1)) { DAT_0044fe70 = loaded_gear_more_data->anim_idx; if (gear_obj0_x < gear_mouse_x) { DAT_0044fe66 = 0; if (gear_obj0_y <= gear_mouse_y) { DAT_0044fe66 = 1; } } else { DAT_0044fe66 = 2; if (gear_mouse_y <= gear_obj0_y) { DAT_0044fe66 = 3; } } if (gear_obj0_x < sVar2) { DAT_0044fe64 = 0; if (gear_obj0_y <= sVar1) { DAT_0044fe64 = 1; } } else { DAT_0044fe64 = 2; if (sVar1 <= gear_obj0_y) { DAT_0044fe64 = 3; } } uVar3 = (int)DAT_0044fe66 - (int)DAT_0044fe64 & 3; if (uVar3 == 0) { if ((short)(sVar2 - gear_obj0_x) == 0) { DAT_0044fe68 = 0x7fff; } else { DAT_0044fe6e = sVar1 - gear_obj0_y; DAT_0044fe68 = (short)((DAT_0044fe6e * 100) / (int)(short)(sVar2 - gear_obj0_x)); } DAT_0044fe6c = gear_mouse_x - gear_obj0_x; if (DAT_0044fe6c == 0) { DAT_0044fe6a = 0x7fff; } else { DAT_0044fe6e = gear_mouse_y - gear_obj0_y; DAT_0044fe6a = (short)((DAT_0044fe6e * 100) / (int)DAT_0044fe6c); } if (DAT_0044fe68 != DAT_0044fe6a) { sVar2 = 1; if (DAT_0044fe68 <= DAT_0044fe6a) { sVar2 = -1; } gear_puzzle_do_cranking_inner(sVar2); } } else if (uVar3 == 1) { gear_puzzle_do_cranking_inner(-1); } else if (uVar3 == 3) { gear_puzzle_do_cranking_inner(1); } if (loaded_gear_more_data->anim_idx != DAT_0044fe70) { DAT_0044fe70 = loaded_gear_more_data->anim_idx + 1; } } return; } void __cdecl gear_puzzle_do_cranking_inner(short param_1) { undefined2 uVar1; undefined2 uVar2; undefined2 uVar3; gear_more_data *pgVar4; short sVar5; for (sVar5 = 0; pgVar4 = loaded_gear_more_data, sVar5 < gear_puzzle_num_objs; sVar5 = sVar5 + 1) { if (((short)loaded_gear_more_data[sVar5].type < 2) || (5 < (short)loaded_gear_more_data[sVar5].type)) { uVar1 = loaded_gear_more_data[sVar5].anim_idx; loaded_gear_more_data[sVar5].backup_anim_idx = uVar1; } uVar2 = loaded_gear_more_data[sVar5].xish; loaded_gear_more_data[sVar5].backup_xish = uVar2; uVar3 = loaded_gear_more_data[sVar5].yish; loaded_gear_more_data[sVar5].backup_yish = uVar3; } if (param_1 == -1) { loaded_gear_more_data->anim_idx = loaded_gear_more_data->anim_idx + 1; if (0x17 < (short)pgVar4->anim_idx) { loaded_gear_more_data->anim_idx = 0; } } else { loaded_gear_more_data->anim_idx = loaded_gear_more_data->anim_idx - 1; if ((short)pgVar4->anim_idx < 0) { loaded_gear_more_data->anim_idx = 0x17; } } gears_clash = 0; loaded_gear_more_data->cranking_direction = param_1; loaded_gear_more_data->type = 0; gear_handle_interactions(0); loaded_gear_more_data->type = 6; play_wave_flag1(0x4a4e,5,0); gear_update_anim_states_and_maybe_play_sound(1); xxx_periodic_loop(); if (gears_clash != 0) { for (sVar5 = 0; sVar5 < gear_puzzle_num_objs; sVar5 = sVar5 + 1) { if (((short)loaded_gear_more_data[sVar5].type < 2) || (5 < (short)loaded_gear_more_data[sVar5].type)) { loaded_gear_more_data[sVar5].anim_idx = loaded_gear_more_data[sVar5].backup_anim_idx; } loaded_gear_more_data[sVar5].xish = loaded_gear_more_data[sVar5].backup_xish; loaded_gear_more_data[sVar5].yish = loaded_gear_more_data[sVar5].backup_yish; } play_wave_flag1(19022,5,0); gear_update_anim_states_and_maybe_play_sound(1); xxx_periodic_loop(); } return; } void __stdcall gear_draw_counts_on_left(void) { short sVar1; short sVar2; short sVar3; sVar3 = 1; do { anim_state_xxx_list_remove ((int *)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].gear_aseq); anim_state_xxx_list_remove ((int *)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].digits_aseq_0); anim_state_xxx_list_remove ((int *)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].digits_aseq_1); sVar1 = gear_puzzle_gears_in_sidebar[sVar3]; sVar2 = gear_puzzle_gears_in_sidebar[sVar3]; if (gear_puzzle_gears_in_sidebar[sVar3] != 0) { anim_state_xxx_list_insert_8004 ((undefined4 *)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].gear_aseq); aseq_set_pos_order((int)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].gear_aseq, gear_lhs_xpos[sVar3],gear_lhs_ypos[sVar3],5); } aseq_select_anim((int)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].digits_aseq_0, sVar1 % 10); anim_state_xxx_list_insert_8004 ((undefined4 *)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].digits_aseq_0); aseq_select_anim((int)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].digits_aseq_1, sVar2 / 10); anim_state_xxx_list_insert_8004 ((undefined4 *)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].digits_aseq_1); aseq_set_pos_order((int)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].digits_aseq_1, SHORT_ARRAY_00449abc[sVar3 + 2],SHORT_ARRAY_00449ac8[sVar3],5); aseq_set_pos_order((int)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].digits_aseq_0, SHORT_ARRAY_00449abc[sVar3 + 4],SHORT_ARRAY_00449acc[sVar3],5); sVar3 = sVar3 + -1; } while (-1 < sVar3); return; } void __cdecl gear_puzzle_setup_structs(short param_1) { aseq_anim_state_struct *paVar1; int iVar2; short sVar3; DAT_00449ad4 = 0; gear_puzzle_state = 2; gear_puzzle_related_xxx_struct_ARRAY_0044fe94[1].gear_aseq = (aseq_anim_state_struct *)load_aseq(14007); gear_puzzle_related_xxx_struct_ARRAY_0044fe94[0].gear_aseq = (aseq_anim_state_struct *)load_aseq(14012); sVar3 = 1; do { paVar1 = (aseq_anim_state_struct *)load_aseq(14013); gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].digits_aseq_0 = paVar1; paVar1 = (aseq_anim_state_struct *)load_aseq(14013); gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar3].digits_aseq_1 = paVar1; sVar3 = sVar3 + -1; } while (-1 < sVar3); iVar2 = (int)param_1; if (iVar2 < 4) { if (iVar2 == 3) { DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 14000; SHORT_ARRAY_004514ce[0] = 14007; SHORT_ARRAY_004514ce[1] = 14008; SHORT_ARRAY_004514ce[2] = 14009; SHORT_ARRAY_004514ce[3] = -1; } else if (iVar2 == 1) { DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x36b4; SHORT_ARRAY_004514ce[0] = 0x36b1; SHORT_ARRAY_004514ce[1] = 0x36b2; SHORT_ARRAY_004514ce[2] = 0x36b3; SHORT_ARRAY_004514ce[3] = -1; } else if (iVar2 == 2) { DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x36b5; SHORT_ARRAY_004514ce[0] = 0x36b4; SHORT_ARRAY_004514ce[1] = 0x36b5; SHORT_ARRAY_004514ce[2] = 0x36b6; SHORT_ARRAY_004514ce[3] = -1; } } else if (iVar2 - 4U < 0x17) { DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x36b3; SHORT_ARRAY_004514ce[0] = 0x36bf; SHORT_ARRAY_004514ce[1] = 0x36c0; SHORT_ARRAY_004514ce[2] = 0x36c1; SHORT_ARRAY_004514ce[3] = 0x36c2; SHORT_ARRAY_004514ce[4] = 0x36c3; SHORT_ARRAY_004514ce[5] = -1; } else if (iVar2 - 0x1bU < 0x10) { DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x36b2; SHORT_ARRAY_004514ce[0] = 0x36ba; SHORT_ARRAY_004514ce[1] = 0x36bb; SHORT_ARRAY_004514ce[2] = 0x36bc; SHORT_ARRAY_004514ce[3] = 0x36bd; SHORT_ARRAY_004514ce[4] = 0x36be; SHORT_ARRAY_004514ce[5] = -1; } DAT_004514c2 = 0x36b1; DAT_004514c4 = 14000; DAT_004514b4 = load_resource_item_0(0x36b1,(int *)&text); return; } void __cdecl gear_pick_up_from_left(short param_1) { short sVar1; short sVar2; clear_cursor_override_regions(); if (param_1 == 0) { set_custom_cursor((undefined4 *)aseq_14012_small_gear_cursor); } else if (param_1 == 1) { set_custom_cursor((undefined4 *)aseq_14007_big_gear_cursor); } DAT_0044fec0 = param_1; gear_puzzle_state = 4; sVar2 = 0; while ((sVar1 = DAT_0044fe7a, sVar2 < gear_puzzle_num_objs && ((param_1 != loaded_gear_more_data[sVar2].type || (sVar1 = sVar2, loaded_gear_more_data[sVar2].xish != -99))))) { sVar2 = sVar2 + 1; } DAT_0044fe7a = sVar1; play_wave_flag1(0x1f73,5,0); gear_puzzle_gears_in_sidebar[param_1] = gear_puzzle_gears_in_sidebar[param_1] + -1; gear_draw_counts_on_left(); gear_puzzle_setup_mouse_regions(); return; } void __stdcall FUN_0041d587(void) { short sVar1; sVar1 = 0; do { if (loaded_gear_more_data[sVar1].type != 0xffff) { free_aseq((int *)loaded_gear_more_data[sVar1].aseq_struct); } sVar1 = sVar1 + 1; } while (sVar1 < 100); sVar1 = 1; do { free_aseq((int *)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar1].gear_aseq); free_aseq((int *)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar1].digits_aseq_0); free_aseq((int *)gear_puzzle_related_xxx_struct_ARRAY_0044fe94[sVar1].digits_aseq_1); sVar1 = sVar1 + -1; } while (-1 < sVar1); free_aseq(aseq_15005_gear_hint); free_aseq((int *)aseq_15009_gear_go_back); return; } void __stdcall FUN_0041d620(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if ((sVar1 == 0xd) && (DAT_00449ad4 != 0)) { gear_puzzle_state = 0xc; DAT_004514f6 = 1; } return; } void __cdecl gear_update_anim_states_and_maybe_play_sound(short param_1) { word wVar1; bool bVar2; bool bVar3; short sVar4; bVar2 = false; bVar3 = true; gfxish_copy_otherbuf_to_dest_and_invalidate(0x89,2,0x165,0xf9); sVar4 = gear_puzzle_num_objs; while (sVar4 = sVar4 + -1, -1 < sVar4) { loaded_gear_more_data[sVar4].cranking_direction = 0; loaded_gear_more_data[sVar4].has_interacted = 0; switch(loaded_gear_more_data[sVar4].type) { case 0: case 1: if (loaded_gear_more_data[sVar4].xish != -99) { wVar1 = loaded_gear_more_data[sVar4].type; anim_state_xxx_list_remove((int *)loaded_gear_more_data[sVar4].aseq_struct); anim_state_xxx_list_insert_8004((undefined4 *)loaded_gear_more_data[sVar4].aseq_struct); aseq_select_anim((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].anim_idx); aseq_set_pos_order((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].xish * 0xf + gear_xpos[(short)wVar1], loaded_gear_more_data[sVar4].yish * 0x12 + gear_ypos[(short)wVar1],10); } break; case 2: anim_state_xxx_list_remove((int *)loaded_gear_more_data[sVar4].aseq_struct); anim_state_xxx_list_insert_8004((undefined4 *)loaded_gear_more_data[sVar4].aseq_struct); aseq_set_pos_order((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].xish * 5 + 0x9a, loaded_gear_more_data[sVar4].yish * 0x12 + 0x52,9); break; case 3: anim_state_xxx_list_remove((int *)loaded_gear_more_data[sVar4].aseq_struct); anim_state_xxx_list_insert_8004((undefined4 *)loaded_gear_more_data[sVar4].aseq_struct); aseq_set_pos_order((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].xish * 0xf + 0x9d, loaded_gear_more_data[sVar4].yish * 6 + 0x4d,9); break; case 4: anim_state_xxx_list_remove((int *)loaded_gear_more_data[sVar4].aseq_struct); anim_state_xxx_list_insert_8004((undefined4 *)loaded_gear_more_data[sVar4].aseq_struct); aseq_set_pos_order((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].xish * 5 + 0x9a, loaded_gear_more_data[sVar4].yish * 0x12 + 0x4c,0xb); break; case 5: anim_state_xxx_list_remove((int *)loaded_gear_more_data[sVar4].aseq_struct); anim_state_xxx_list_insert_8004((undefined4 *)loaded_gear_more_data[sVar4].aseq_struct); aseq_set_pos_order((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].xish * 0xf + 0x9b, loaded_gear_more_data[sVar4].yish * 6 + 0x4b,0xb); break; case 6: anim_state_xxx_list_remove((int *)loaded_gear_more_data[sVar4].aseq_struct); anim_state_xxx_list_insert_8004((undefined4 *)loaded_gear_more_data[sVar4].aseq_struct); aseq_select_anim((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].anim_idx); aseq_set_pos_order((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].xish * 0xf + 0x89, loaded_gear_more_data[sVar4].yish * 0x12 + 0x3b,0xf); } } for (sVar4 = 1; sVar4 < gear_puzzle_num_objs; sVar4 = sVar4 + 1) { if (6 < (short)loaded_gear_more_data[sVar4].type) { wVar1 = loaded_gear_more_data[sVar4].type; if (wVar1 == 7) { if ((short)loaded_gear_more_data[sVar4].backup_anim_idx < (short)loaded_gear_more_data[sVar4].anim_idx) { bVar2 = true; } else if (loaded_gear_more_data[sVar4].anim_idx == 0) { bVar3 = false; } anim_state_xxx_list_remove((int *)loaded_gear_more_data[sVar4].aseq_struct); anim_state_xxx_list_insert_8004((undefined4 *)loaded_gear_more_data[sVar4].aseq_struct); aseq_select_anim((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].anim_idx); aseq_set_pos_order((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].xish * 5 + 0x9d, loaded_gear_more_data[sVar4].yish * 0x12 + 0x40,0xf); } else if (wVar1 == 8) { if ((short)loaded_gear_more_data[sVar4].backup_anim_idx < (short)loaded_gear_more_data[sVar4].anim_idx) { bVar2 = true; } else if (loaded_gear_more_data[sVar4].anim_idx == 0) { bVar3 = false; } anim_state_xxx_list_remove((int *)loaded_gear_more_data[sVar4].aseq_struct); anim_state_xxx_list_insert_8004((undefined4 *)loaded_gear_more_data[sVar4].aseq_struct); aseq_select_anim((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].anim_idx); aseq_set_pos_order((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].xish * 5 + 0x95, loaded_gear_more_data[sVar4].yish * 0x12 + 0x40,0xf); } else if (wVar1 == 9) { if ((short)loaded_gear_more_data[sVar4].backup_anim_idx < (short)loaded_gear_more_data[sVar4].anim_idx) { bVar2 = true; } else if (loaded_gear_more_data[sVar4].anim_idx == 0) { bVar3 = false; } anim_state_xxx_list_remove((int *)loaded_gear_more_data[sVar4].aseq_struct); anim_state_xxx_list_insert_8004((undefined4 *)loaded_gear_more_data[sVar4].aseq_struct); aseq_select_anim((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].anim_idx); aseq_set_pos_order((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].xish * 0xf + 0x93, loaded_gear_more_data[sVar4].yish * 6 + 0x45,0xf); } else if (wVar1 == 10) { if ((short)loaded_gear_more_data[sVar4].backup_anim_idx < (short)loaded_gear_more_data[sVar4].anim_idx) { bVar2 = true; } else if (loaded_gear_more_data[sVar4].anim_idx == 0) { bVar3 = false; } anim_state_xxx_list_remove((int *)loaded_gear_more_data[sVar4].aseq_struct); anim_state_xxx_list_insert_8004((undefined4 *)loaded_gear_more_data[sVar4].aseq_struct); aseq_select_anim((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].anim_idx); aseq_set_pos_order((int)loaded_gear_more_data[sVar4].aseq_struct, loaded_gear_more_data[sVar4].xish * 0xf + 0x93, loaded_gear_more_data[sVar4].yish * 6 + 0x53,0xf); } } } if (param_1 != 0) { if (bVar3) { play_wave_flag1(19028,10,0); } else if (bVar2) { play_wave_flag1(19028,5,0); } } gfxish_invalidate_rect_wrap(0x89,2,0x165,0xf9); return; } void __cdecl gear_handle_interactions(short param_1) { short sVar1; short sVar2; loaded_gear_more_data[param_1].has_interacted = 1; for (sVar2 = 0; sVar2 < gear_puzzle_num_objs; sVar2 = sVar2 + 1) { if ((param_1 != sVar2) && (loaded_gear_more_data[sVar2].xish != -99)) { if ((code *)gear_interaction_table[(short)loaded_gear_more_data[param_1].type] [(short)loaded_gear_more_data[sVar2].type] != (code *)0x0) { sVar1 = (*(code *)gear_interaction_table[(short)loaded_gear_more_data[param_1].type] [(short)loaded_gear_more_data[sVar2].type])(); if ((sVar1 != 0) && (loaded_gear_more_data[sVar2].has_interacted == 0)) { gear_handle_interactions(sVar2); } } } } return; } void __cdecl gear_pick_up_from_board(short param_1) { word wVar1; wVar1 = loaded_gear_more_data[param_1].type; clear_cursor_override_regions(); if (wVar1 == 0) { set_custom_cursor((undefined4 *)aseq_14012_small_gear_cursor); } else if (wVar1 == 1) { set_custom_cursor((undefined4 *)aseq_14007_big_gear_cursor); } gear_puzzle_state = 4; DAT_0044fec0 = wVar1; anim_state_xxx_list_remove((int *)loaded_gear_more_data[param_1].aseq_struct); loaded_gear_more_data[param_1].yish = -99; loaded_gear_more_data[param_1].xish = -99; DAT_0044fe7a = param_1; play_wave_flag1(0x4a4e,5,0); gear_update_anim_states_and_maybe_play_sound(1); return; } void __cdecl FUN_0041e070(short param_1,short param_2) { word wVar1; ushort uVar2; gear_more_data *pgVar3; short sVar4; short sVar5; short sVar6; int iVar7; short sVar8; short sVar9; short local_8; pgVar3 = loaded_gear_more_data; sVar4 = (short)(((short)(param_1 + SHORT_ARRAY_00449abc[(short)loaded_gear_more_data[DAT_0044fe7a].type]) + -0x92) / 0xf); sVar5 = (short)(((short)(param_2 + SHORT_ARRAY_00449abc[(short)loaded_gear_more_data[DAT_0044fe7a].type]) + -0x41) / 0x12); if ((((*(char *)(loaded_gear + sVar4 + sVar5 * 0x17) != '\0') && (-1 < sVar4)) && (-1 < sVar5)) && (((sVar4 < 0x17 && (sVar5 < 0xc)) && (wVar1 = loaded_gear_more_data[DAT_0044fe7a].type, iVar7 = (int)sVar4 - (int)loaded_gear_more_data->xish, uVar2 = (ushort)(iVar7 >> 0x1f), sVar8 = ((ushort)iVar7 ^ uVar2) - uVar2, iVar7 = (int)sVar5 - (int)loaded_gear_more_data->yish , uVar2 = (ushort)(iVar7 >> 0x1f), sVar6 = ((ushort)iVar7 ^ uVar2) - uVar2, (int)SHORT_ARRAY_ARRAY_004499dc[(short)wVar1][0] <= (int)sVar8 * (int)sVar8 + (int)sVar6 * (int)sVar6)))) { local_8 = -1; for (sVar6 = 0; sVar6 < gear_puzzle_num_objs; sVar6 = sVar6 + 1) { iVar7 = (int)sVar4 - (int)loaded_gear_more_data[sVar6].xish; uVar2 = (ushort)(iVar7 >> 0x1f); sVar9 = ((ushort)iVar7 ^ uVar2) - uVar2; iVar7 = (int)sVar5 - (int)loaded_gear_more_data[sVar6].yish; uVar2 = (ushort)(iVar7 >> 0x1f); sVar8 = ((ushort)iVar7 ^ uVar2) - uVar2; if (((sVar6 != DAT_0044fe7a) && (loaded_gear_more_data[sVar6].xish != -99)) && ((short)loaded_gear_more_data[sVar6].type < 2)) { if ((int)sVar9 * (int)sVar9 + (int)sVar8 * (int)sVar8 < (int)SHORT_ARRAY_ARRAY_004499dc[(short)wVar1][(short)loaded_gear_more_data[sVar6].type]) { return; } if (((sVar9 < 5) && (sVar8 < 5)) && (gear_interact_dist_table[(short)wVar1][(short)loaded_gear_more_data[sVar6].type][sVar8] [sVar9] != 0)) { local_8 = sVar6; } } } if (((local_8 != -1) && ((loaded_gear_more_data[DAT_0044fe7a].anim_idx & 1) == (loaded_gear_more_data[local_8].anim_idx & 1))) && (iVar7 = (int)DAT_0044fe7a, loaded_gear_more_data[iVar7].anim_idx = loaded_gear_more_data[iVar7].anim_idx + 1, gear_num_anims[(short)wVar1] <= (short)pgVar3[iVar7].anim_idx)) { loaded_gear_more_data[DAT_0044fe7a].anim_idx = 0; } loaded_gear_more_data[DAT_0044fe7a].xish = sVar4; loaded_gear_more_data[DAT_0044fe7a].yish = sVar5; play_wave_flag1(0x4a4f,5,0); anim_state_xxx_list_insert_8004((undefined4 *)loaded_gear_more_data[DAT_0044fe7a].aseq_struct); gear_puzzle_state = 2; gear_puzzle_setup_hand_cursor_and_free_memory(); gear_update_anim_states_and_maybe_play_sound(1); gear_puzzle_setup_mouse_regions(); } return; } undefined4 __cdecl gear_to_gear_handler(short param_1,short param_2) { word wVar1; ushort uVar2; gear_more_data *pgVar3; short sVar4; short sVar5; int iVar6; undefined4 uVar7; undefined2 uVar8; iVar6 = (int)loaded_gear_more_data[param_1].xish - (int)loaded_gear_more_data[param_2].xish; uVar2 = (ushort)(iVar6 >> 0x1f); sVar4 = ((ushort)iVar6 ^ uVar2) - uVar2; iVar6 = (int)loaded_gear_more_data[param_1].yish - (int)loaded_gear_more_data[param_2].yish; uVar2 = (ushort)(iVar6 >> 0x1f); sVar5 = ((ushort)iVar6 ^ uVar2) - uVar2; if ((sVar4 < 5) && (sVar5 < 5)) { wVar1 = loaded_gear_more_data[param_2].type; if (gear_interact_dist_table[(short)loaded_gear_more_data[param_1].type][(short)wVar1][sVar5] [sVar4] == 0) { uVar7 = 0; } else if (loaded_gear_more_data[param_2].cranking_direction == 0) { if (loaded_gear_more_data[param_1].cranking_direction == -1) { loaded_gear_more_data[param_2].cranking_direction = 1; pgVar3 = loaded_gear_more_data; iVar6 = (int)param_2; loaded_gear_more_data[iVar6].anim_idx = loaded_gear_more_data[iVar6].anim_idx - 1; uVar8 = (undefined2)((uint)(iVar6 * 0xf) >> 0x10); if ((short)pgVar3[iVar6].anim_idx < 0) { uVar8 = (undefined2)((uint)(param_2 * 0xf) >> 0x10); loaded_gear_more_data[param_2].anim_idx = gear_num_anims[(short)wVar1] - 1; } } else { loaded_gear_more_data[param_2].cranking_direction = -1; pgVar3 = loaded_gear_more_data; iVar6 = (int)param_2; loaded_gear_more_data[iVar6].anim_idx = loaded_gear_more_data[iVar6].anim_idx + 1; uVar8 = (undefined2)((uint)(iVar6 * 0xf) >> 0x10); if (gear_num_anims[(short)wVar1] <= (short)pgVar3[iVar6].anim_idx) { uVar8 = (undefined2)((uint)(param_2 * 0xf) >> 0x10); loaded_gear_more_data[param_2].anim_idx = 0; } } uVar7 = CONCAT22(uVar8,1); } else { if (loaded_gear_more_data[param_2].cranking_direction == loaded_gear_more_data[param_1].cranking_direction) { gears_clash = 1; } uVar7 = CONCAT22((short)((uint)(param_2 * 0xf) >> 0x10),1); } } else { uVar7 = 0; } return uVar7; } undefined4 __cdecl gear_h_struct_interact_handler(short param_1,short param_2) { short sVar1; if (loaded_gear_more_data[param_1].yish != loaded_gear_more_data[param_2].yish) { return 0; } sVar1 = loaded_gear_more_data[param_1].xish - loaded_gear_more_data[param_1].cranking_direction; if (loaded_gear_more_data[param_2].xish < sVar1) { if ((loaded_gear_more_data[param_1].type == loaded_gear_more_data[param_2].type) && (0 < loaded_gear_more_data[param_1].cranking_direction)) { return 0; } if ((int)sVar1 <= (int)loaded_gear_more_data[param_2].xish + (short)loaded_gear_more_data[param_2].obj23_related_zzz * 2) { if (loaded_gear_more_data[param_2].cranking_direction == 0) { sVar1 = loaded_gear_more_data[param_1].cranking_direction; loaded_gear_more_data[param_2].cranking_direction = sVar1; loaded_gear_more_data[param_2].xish = loaded_gear_more_data[param_2].xish + sVar1; } if (loaded_gear_more_data[param_1].cranking_direction != loaded_gear_more_data[param_2].cranking_direction) { gears_clash = 1; } return CONCAT22((short)((uint)(param_2 * 0xf) >> 0x10),1); } } else { if ((loaded_gear_more_data[param_1].type == loaded_gear_more_data[param_2].type) && (loaded_gear_more_data[param_1].cranking_direction < 0)) { return 0; } if (loaded_gear_more_data[param_2].xish <= (short)(loaded_gear_more_data[param_1].obj23_related_zzz * 2 + sVar1)) { if (loaded_gear_more_data[param_2].cranking_direction == 0) { sVar1 = loaded_gear_more_data[param_1].cranking_direction; loaded_gear_more_data[param_2].cranking_direction = sVar1; loaded_gear_more_data[param_2].xish = loaded_gear_more_data[param_2].xish + sVar1; } if (loaded_gear_more_data[param_1].cranking_direction != loaded_gear_more_data[param_2].cranking_direction) { gears_clash = 1; } return CONCAT22((short)((uint)(param_2 * 0xf) >> 0x10),1); } } return 0; } undefined4 __cdecl gear_h_to_button_interact_handler(short param_1,short param_2) { short sVar1; if (loaded_gear_more_data[param_1].yish == loaded_gear_more_data[param_2].yish) { if (loaded_gear_more_data[param_2].type == 7) { sVar1 = loaded_gear_more_data[param_1].xish - loaded_gear_more_data[param_1].cranking_direction; if (loaded_gear_more_data[param_2].xish + 7 == (int)sVar1) { if (0 < loaded_gear_more_data[param_1].cranking_direction) { loaded_gear_more_data[param_2].anim_idx = 0; } } else if ((loaded_gear_more_data[param_2].xish + 8 == (int)sVar1) && (loaded_gear_more_data[param_1].cranking_direction < 0)) { loaded_gear_more_data[param_2].anim_idx = 1; } } else { sVar1 = (loaded_gear_more_data[param_1].xish - loaded_gear_more_data[param_1].cranking_direction) + loaded_gear_more_data[param_1].obj23_related_zzz * 2; if (loaded_gear_more_data[param_2].xish + 1 == (int)sVar1) { if (loaded_gear_more_data[param_1].cranking_direction < 0) { loaded_gear_more_data[param_2].anim_idx = 0; } } else if ((sVar1 == loaded_gear_more_data[param_2].xish) && (0 < loaded_gear_more_data[param_1].cranking_direction)) { loaded_gear_more_data[param_2].anim_idx = 1; } } } return 0; } undefined4 __cdecl gear_v_to_button_interaction_handler(short param_1,short param_2) { short sVar1; if (loaded_gear_more_data[param_1].xish == loaded_gear_more_data[param_2].xish) { if (loaded_gear_more_data[param_2].type == 10) { sVar1 = loaded_gear_more_data[param_1].yish - loaded_gear_more_data[param_1].cranking_direction; if (loaded_gear_more_data[param_2].yish + 8 == (int)sVar1) { if (0 < loaded_gear_more_data[param_1].cranking_direction) { loaded_gear_more_data[param_2].anim_idx = 0; } } else if ((loaded_gear_more_data[param_2].yish + 9 == (int)sVar1) && (loaded_gear_more_data[param_1].cranking_direction < 0)) { loaded_gear_more_data[param_2].anim_idx = 1; } } else { sVar1 = (loaded_gear_more_data[param_1].yish - loaded_gear_more_data[param_1].cranking_direction) + loaded_gear_more_data[param_1].obj23_related_zzz * 2; if (loaded_gear_more_data[param_2].yish + 1 == (int)sVar1) { if (loaded_gear_more_data[param_1].cranking_direction < 0) { loaded_gear_more_data[param_2].anim_idx = 0; } } else if ((sVar1 == loaded_gear_more_data[param_2].yish) && (0 < loaded_gear_more_data[param_1].cranking_direction)) { loaded_gear_more_data[param_2].anim_idx = 1; } } } return 0; } undefined4 __cdecl gear_v_struct_interact_handler(short param_1,short param_2) { short sVar1; if (loaded_gear_more_data[param_1].xish != loaded_gear_more_data[param_2].xish) { return 0; } sVar1 = loaded_gear_more_data[param_1].yish - loaded_gear_more_data[param_1].cranking_direction; if (loaded_gear_more_data[param_2].yish < sVar1) { if ((loaded_gear_more_data[param_1].type == loaded_gear_more_data[param_2].type) && (0 < loaded_gear_more_data[param_1].cranking_direction)) { return 0; } if ((int)sVar1 <= (int)loaded_gear_more_data[param_2].yish + (short)loaded_gear_more_data[param_2].obj23_related_zzz * 2) { if (loaded_gear_more_data[param_2].cranking_direction == 0) { sVar1 = loaded_gear_more_data[param_1].cranking_direction; loaded_gear_more_data[param_2].cranking_direction = sVar1; loaded_gear_more_data[param_2].yish = loaded_gear_more_data[param_2].yish + sVar1; } if (loaded_gear_more_data[param_1].cranking_direction != loaded_gear_more_data[param_2].cranking_direction) { gears_clash = 1; } return CONCAT22((short)((uint)(param_2 * 0xf) >> 0x10),1); } } else { if ((loaded_gear_more_data[param_1].type == loaded_gear_more_data[param_2].type) && (loaded_gear_more_data[param_1].cranking_direction < 0)) { return 0; } if (loaded_gear_more_data[param_2].yish <= (short)(loaded_gear_more_data[param_1].obj23_related_zzz * 2 + sVar1)) { if (loaded_gear_more_data[param_2].cranking_direction == 0) { sVar1 = loaded_gear_more_data[param_1].cranking_direction; loaded_gear_more_data[param_2].cranking_direction = sVar1; loaded_gear_more_data[param_2].yish = loaded_gear_more_data[param_2].yish + sVar1; } if (loaded_gear_more_data[param_1].cranking_direction != loaded_gear_more_data[param_2].cranking_direction) { gears_clash = 1; } return CONCAT22((short)((uint)(param_2 * 0xf) >> 0x10),1); } } return 0; } undefined4 __cdecl gear_to_h_teeth_handler(short param_1,short param_2) { word wVar1; undefined4 uVar2; short sVar3; short sVar4; wVar1 = loaded_gear_more_data[param_1].type; sVar3 = loaded_gear_more_data[param_2].yish - loaded_gear_more_data[param_1].yish; if ((int)sVar3 == (short)wVar1 + 1) { sVar3 = loaded_gear_more_data[param_1].cranking_direction; } else { if ((int)sVar3 != -((short)wVar1 + 2)) { return 0; } sVar3 = -loaded_gear_more_data[param_1].cranking_direction; } sVar4 = (loaded_gear_more_data[param_2].xish - loaded_gear_more_data[param_2].cranking_direction) + sVar3; if ((int)(((int)loaded_gear_more_data[param_1].xish + (int)(short)wVar1) * 3 + ((int)(short)wVar1 ^ 1U)) < (int)sVar4) { uVar2 = 0; } else if ((int)(short)(sVar4 + loaded_gear_more_data[param_2].obj23_related_zzz * 2) < ((int)loaded_gear_more_data[param_1].xish - (int)(short)wVar1) * 3) { uVar2 = 0; } else { if (loaded_gear_more_data[param_2].cranking_direction == 0) { loaded_gear_more_data[param_2].cranking_direction = sVar3; loaded_gear_more_data[param_2].xish = loaded_gear_more_data[param_2].xish + sVar3; } if (loaded_gear_more_data[param_2].cranking_direction != sVar3) { gears_clash = 1; } if (loaded_gear_more_data[param_2].xish < 0) { gears_clash = 1; } uVar2 = CONCAT22((short)((uint)(param_2 * 0xf) >> 0x10),1); } return uVar2; } undefined4 __cdecl gear_h_teeth_to_gear_handler(short param_1,short param_2) { word wVar1; gear_more_data *pgVar2; undefined4 uVar3; short sVar4; wVar1 = loaded_gear_more_data[param_2].type; sVar4 = loaded_gear_more_data[param_1].yish - loaded_gear_more_data[param_2].yish; if ((int)sVar4 == (short)wVar1 + 1) { sVar4 = loaded_gear_more_data[param_1].cranking_direction; } else { if ((int)sVar4 != -((short)wVar1 + 2)) { return 0; } sVar4 = -loaded_gear_more_data[param_1].cranking_direction; } if ((int)(((int)loaded_gear_more_data[param_2].xish + (int)(short)wVar1) * 3 + ((int)(short)wVar1 ^ 1U)) < (int)loaded_gear_more_data[param_1].xish) { uVar3 = 0; } else if ((int)loaded_gear_more_data[param_1].xish + (short)loaded_gear_more_data[param_1].obj23_related_zzz * 2 < ((int)loaded_gear_more_data[param_2].xish - (int)(short)wVar1) * 3) { uVar3 = 0; } else { if (loaded_gear_more_data[param_2].cranking_direction == 0) { loaded_gear_more_data[param_2].cranking_direction = sVar4; pgVar2 = loaded_gear_more_data; if (sVar4 == 1) { loaded_gear_more_data[param_2].anim_idx = loaded_gear_more_data[param_2].anim_idx - 1; if ((short)pgVar2[param_2].anim_idx < 0) { loaded_gear_more_data[param_2].anim_idx = gear_num_anims[(short)wVar1] - 1; } } else { loaded_gear_more_data[param_2].anim_idx = loaded_gear_more_data[param_2].anim_idx + 1; if (gear_num_anims[(short)wVar1] <= (short)pgVar2[param_2].anim_idx) { loaded_gear_more_data[param_2].anim_idx = 0; } } } if (loaded_gear_more_data[param_2].cranking_direction != sVar4) { gears_clash = 1; } uVar3 = CONCAT22((short)((uint)(param_2 * 0xf) >> 0x10),1); } return uVar3; } undefined4 __cdecl gear_to_v_teeth_handler(short param_1,short param_2) { word wVar1; undefined4 uVar2; short sVar3; short sVar4; wVar1 = loaded_gear_more_data[param_1].type; sVar3 = loaded_gear_more_data[param_2].xish - loaded_gear_more_data[param_1].xish; if ((int)sVar3 == (short)wVar1 + 1) { sVar3 = -loaded_gear_more_data[param_1].cranking_direction; } else { if ((int)sVar3 != -((short)wVar1 + 2)) { return 0; } sVar3 = loaded_gear_more_data[param_1].cranking_direction; } sVar4 = (loaded_gear_more_data[param_2].yish - loaded_gear_more_data[param_2].cranking_direction) + sVar3; if ((int)(((int)loaded_gear_more_data[param_1].yish + (int)(short)wVar1) * 3 + ((int)(short)wVar1 ^ 1U)) < (int)sVar4) { uVar2 = 0; } else if ((int)(short)(sVar4 + loaded_gear_more_data[param_2].obj23_related_zzz * 2) < ((int)loaded_gear_more_data[param_1].yish - (int)(short)wVar1) * 3) { uVar2 = 0; } else { if (loaded_gear_more_data[param_2].cranking_direction == 0) { loaded_gear_more_data[param_2].cranking_direction = sVar3; loaded_gear_more_data[param_2].yish = loaded_gear_more_data[param_2].yish + sVar3; } if (loaded_gear_more_data[param_2].cranking_direction != sVar3) { gears_clash = 1; } if (loaded_gear_more_data[param_2].yish < 0) { gears_clash = 1; } uVar2 = CONCAT22((short)((uint)(param_2 * 0xf) >> 0x10),1); } return uVar2; } undefined4 __cdecl gear_v_teeth_to_gear_handler(short param_1,short param_2) { word wVar1; gear_more_data *pgVar2; undefined4 uVar3; short sVar4; wVar1 = loaded_gear_more_data[param_2].type; sVar4 = loaded_gear_more_data[param_1].xish - loaded_gear_more_data[param_2].xish; if ((int)sVar4 == (short)wVar1 + 1) { sVar4 = -loaded_gear_more_data[param_1].cranking_direction; } else { if ((int)sVar4 != -((short)wVar1 + 2)) { return 0; } sVar4 = loaded_gear_more_data[param_1].cranking_direction; } if ((int)(((int)loaded_gear_more_data[param_2].yish + (int)(short)wVar1) * 3 + ((int)(short)wVar1 ^ 1U)) < (int)loaded_gear_more_data[param_1].yish) { uVar3 = 0; } else if ((int)loaded_gear_more_data[param_1].yish + (short)loaded_gear_more_data[param_1].obj23_related_zzz * 2 < ((int)loaded_gear_more_data[param_2].yish - (int)(short)wVar1) * 3) { uVar3 = 0; } else { if (loaded_gear_more_data[param_2].cranking_direction == 0) { loaded_gear_more_data[param_2].cranking_direction = sVar4; pgVar2 = loaded_gear_more_data; if (sVar4 == 1) { loaded_gear_more_data[param_2].anim_idx = loaded_gear_more_data[param_2].anim_idx - 1; if ((short)pgVar2[param_2].anim_idx < 0) { loaded_gear_more_data[param_2].anim_idx = gear_num_anims[(short)wVar1] - 1; } } else { loaded_gear_more_data[param_2].anim_idx = loaded_gear_more_data[param_2].anim_idx + 1; if (gear_num_anims[(short)wVar1] <= (short)pgVar2[param_2].anim_idx) { loaded_gear_more_data[param_2].anim_idx = 0; } } } if (loaded_gear_more_data[param_2].cranking_direction != sVar4) { gears_clash = 1; } uVar3 = CONCAT22((short)((uint)(param_2 * 0xf) >> 0x10),1); } return uVar3; } void __cdecl load_gear(short param_1) { loaded_gear = load_resource_item_0(param_1 + 14100,(int *)&gear); loaded_gear_more_data = (gear_more_data *)(loaded_gear + 0x116); loaded_gear_2 = loaded_gear; loaded_gear_more_data->type = 6; loaded_gear_more_data->anim_idx = 0; gear_puzzle_num_objs = 0; load_gear_obj0_pos(); return; } void __cdecl gfx_outer_draw_circle(short param_1,short param_2) { gfx_outer_draw_h_line(param_1 * 0xf + 0x9a,param_2 * 0x12 + 0x4b,param_1 * 0xf + 0x9d); gfx_outer_draw_h_line(param_1 * 0xf + 0x99,param_2 * 0x12 + 0x4c,param_1 * 0xf + 0x9e); gfx_outer_draw_h_line(param_1 * 0xf + 0x98,param_2 * 0x12 + 0x4d,param_1 * 0xf + 0x9f); gfx_outer_draw_h_line(param_1 * 0xf + 0x98,param_2 * 0x12 + 0x4e,param_1 * 0xf + 0x9f); gfx_outer_draw_h_line(param_1 * 0xf + 0x99,param_2 * 0x12 + 0x4f,param_1 * 0xf + 0x9e); gfx_outer_draw_h_line(param_1 * 0xf + 0x9a,param_2 * 0x12 + 0x50,param_1 * 0xf + 0x9d); return; } void __stdcall load_gear_obj0_pos(void) { gear_obj0_x = loaded_gear_more_data->xish * 0xf + 155; gear_obj0_y = loaded_gear_more_data->yish * 0x12 + 76; return; } void __cdecl gfx_outer_draw_h_line(short param_1,undefined2 param_2,short param_3) { short sVar1; short sVar2; short sVar3; sVar1 = param_3; if (param_3 < param_1) { sVar1 = param_1; param_1 = param_3; } sVar2 = param_1 + -1; sVar3 = 0; if (0 < (short)(sVar1 - param_1)) { do { sVar2 = sVar2 + 1; gfxish_set_px_wrapped(sVar2,param_2); sVar3 = sVar3 + 1; } while (sVar3 < (short)(sVar1 - param_1)); } gfxish_invalidate_rect_wrap(param_1,param_2,(sVar1 - param_1) + 1,1); return; } void __stdcall gear_puzzle_count_xminus99(void) { short sVar1; gear_puzzle_gears_in_sidebar[1] = 0; gear_puzzle_gears_in_sidebar[0] = 0; for (sVar1 = 0; sVar1 < gear_puzzle_num_objs; sVar1 = sVar1 + 1) { if (((short)loaded_gear_more_data[sVar1].type < 2) && (loaded_gear_more_data[sVar1].xish == -99) ) { gear_puzzle_gears_in_sidebar[(short)loaded_gear_more_data[sVar1].type] = gear_puzzle_gears_in_sidebar[(short)loaded_gear_more_data[sVar1].type] + 1; } } return; } void __stdcall gear_puzzle_setup_objs(void) { aseq_anim_state_struct *paVar1; short sVar2; short unaff_SI; sVar2 = 0; do { if (loaded_gear_more_data[sVar2].type != 0xffff) { switch(loaded_gear_more_data[sVar2].type) { case 0: unaff_SI = 14012; break; case 1: unaff_SI = 14007; break; case 2: unaff_SI = loaded_gear_more_data[sVar2].obj23_related_zzz + 14022; break; case 3: unaff_SI = loaded_gear_more_data[sVar2].obj23_related_zzz + 14054; break; case 4: unaff_SI = 14019; break; case 5: unaff_SI = 14020; break; case 6: unaff_SI = 14008; break; case 7: unaff_SI = 14018; break; case 8: unaff_SI = 14017; break; case 9: unaff_SI = 14015; break; case 10: unaff_SI = 14016; } gear_puzzle_num_objs = gear_puzzle_num_objs + 1; paVar1 = (aseq_anim_state_struct *)load_aseq(unaff_SI); loaded_gear_more_data[sVar2].aseq_struct = paVar1; } sVar2 = sVar2 + 1; } while (sVar2 < 100); gear_puzzle_count_xminus99(); return; } void __stdcall gear_puzzle_draw(void) { short sVar1; short sVar2; load_rrgb_1(14000); gear_bg = (aseq_anim_state_struct *)load_aseq(14000); aseq_draw_to_both_fbs((int)gear_bg,0,0,0); free_aseq((int *)gear_bg); sVar2 = 0; do { sVar1 = 0; do { if (*(char *)(loaded_gear + sVar1 + sVar2 * 0x17) != '\0') { is_256_color(); gfx_outer_draw_circle(sVar1,sVar2); } sVar1 = sVar1 + 1; } while (sVar1 < 0x17); sVar2 = sVar2 + 1; } while (sVar2 < 0xc); gfxish_copy_dest_to_otherbuf_wrap(); gear_update_anim_states_and_maybe_play_sound(1); gear_puzzle_count_xminus99(); gear_draw_counts_on_left(); return; } undefined4 __stdcall gear_puzzle_count_buttons_pressed(void) { short sVar1; int iVar2; iVar2 = 0; while( true ) { sVar1 = (short)iVar2; if (gear_puzzle_num_objs <= sVar1) { return CONCAT22((short)((uint)iVar2 >> 0x10),1); } if ((6 < (short)loaded_gear_more_data[sVar1].type) && (loaded_gear_more_data[sVar1].anim_idx == 0)) break; iVar2 = iVar2 + 1; } return 0; } void __stdcall gear_shuffle_some_fields(void) { short sVar1; for (sVar1 = 0; sVar1 < gear_puzzle_num_objs; sVar1 = sVar1 + 1) { switch(loaded_gear_more_data[sVar1].type) { case 0: case 1: loaded_gear_more_data[sVar1].obj23_related_zzz = loaded_gear_more_data[sVar1].anim_idx; break; case 2: case 4: loaded_gear_more_data[sVar1].anim_idx = loaded_gear_more_data[sVar1].xish; break; case 3: case 5: loaded_gear_more_data[sVar1].anim_idx = loaded_gear_more_data[sVar1].yish; } } return; } void __stdcall gear_shuffle_some_fields_bbb(void) { short sVar1; for (sVar1 = 0; sVar1 < gear_puzzle_num_objs; sVar1 = sVar1 + 1) { if ((loaded_gear_more_data[sVar1].type < 2) || (loaded_gear_more_data[sVar1].type == 6)) { loaded_gear_more_data[sVar1].obj23_related_zzz = loaded_gear_more_data[sVar1].anim_idx; } } return; } void __stdcall gear_shuffle_some_fields_ccc(void) { short sVar1; for (sVar1 = 0; sVar1 < gear_puzzle_num_objs; sVar1 = sVar1 + 1) { switch(loaded_gear_more_data[sVar1].type) { case 0: case 1: case 6: loaded_gear_more_data[sVar1].anim_idx = loaded_gear_more_data[sVar1].obj23_related_zzz; break; case 2: case 4: loaded_gear_more_data[sVar1].xish = loaded_gear_more_data[sVar1].anim_idx; break; case 3: case 5: loaded_gear_more_data[sVar1].yish = loaded_gear_more_data[sVar1].anim_idx; break; case 7: case 8: case 9: case 10: loaded_gear_more_data[sVar1].anim_idx = 0; } } gear_update_anim_states_and_maybe_play_sound(1); gear_puzzle_setup_mouse_regions(); return; } void __stdcall FUN_0041fde7(void) { short sVar1; mouse_region_delete_all_lists(); gear_puzzle_gears_in_sidebar[1] = 0; gear_puzzle_gears_in_sidebar[0] = 0; sVar1 = 1; do { if (loaded_gear_more_data[sVar1].aseq_struct != (aseq_anim_state_struct *)0x0) { free_aseq((int *)loaded_gear_more_data[sVar1].aseq_struct); } sVar1 = sVar1 + 1; } while (sVar1 < 100); memset(loaded_gear,0,0x114); sVar1 = 1; do { loaded_gear_more_data[sVar1].type = 0xffff; loaded_gear_more_data[sVar1].anim_idx = 0; loaded_gear_more_data[sVar1].xish = 0; loaded_gear_more_data[sVar1].yish = 0; loaded_gear_more_data[sVar1].aseq_struct = (aseq_anim_state_struct *)0x0; sVar1 = sVar1 + 1; } while (sVar1 < 100); loaded_gear_more_data->type = 6; loaded_gear_more_data->anim_idx = 0; loaded_gear_more_data->xish = 5; loaded_gear_more_data->yish = 5; gear_puzzle_num_objs = 1; gear_puzzle_draw(); gear_update_anim_states_and_maybe_play_sound(1); gear_puzzle_setup_mouse_regions(); return; } void __stdcall FUN_0041fef3(void) { if (gear_puzzle_state == 1) { gear_puzzle_state = 2; gear_puzzle_setup_hand_cursor_and_free_memory(); } else if (gear_puzzle_state == 4) { gear_puzzle_gears_in_sidebar[DAT_0044fec0] = gear_puzzle_gears_in_sidebar[DAT_0044fec0] + 1; gear_puzzle_state = 2; gear_puzzle_setup_hand_cursor_and_free_memory(); gear_puzzle_related_xxx_struct_ARRAY_0044fe94[DAT_0044fec0].field0_0x0 = DAT_0044fe7a; DAT_0044fec0 = -1; } else { gear_puzzle_state = 2; } FUN_0041ff6d(); gear_puzzle_setup_mouse_regions(); return; } void __stdcall FUN_0041ff6d(void) { gear_puzzle_draw(); gear_draw_counts_on_left(); gear_update_anim_states_and_maybe_play_sound(1); FUN_00430e33(DAT_00449ad4); return; } void __stdcall gear_puzzle_hint_maybe(void) { uint uVar1; char *pcVar2; short sVar3; char *apcStackY_20400 [32762]; char *local_400 [5]; char local_3ec [1000]; play_wave_flag1(0x1f5c,5,0); anim_state_xxx_list_insert_4(aseq_15005_gear_hint); xxx_periodic_loop(); anim_state_xxx_list_remove(aseq_15005_gear_hint); xxx_periodic_loop(); memset((undefined4 *)local_3ec,0,1000); local_400[0] = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[0],(int *)&text); uVar1 = strlen(local_400[0]); FUN_00440d70((undefined4 *)local_3ec,local_400[0],uVar1); for (sVar3 = 1; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { pcVar2 = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[sVar3],(int *)&text); local_400[sVar3] = pcVar2; uVar1 = strlen(local_400[sVar3]); FUN_00440ce0(local_3ec,local_400[sVar3],uVar1); } FUN_004301cf(local_3ec); for (sVar3 = 0; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { free_resource_item_with_idx_fourcc(SHORT_ARRAY_004514ec[sVar3],(undefined1 *)&text); } return; } void __cdecl gear_puzzle_setup_hand_cursor(short param_1) { undefined2 *puVar1; if (param_1 == 0) { free_tracked_heap_block((int)DAT_0044fe84); } puVar1 = (undefined2 *)alloc_tracked_heap_block(0x10); DAT_0044fe84 = puVar1; *puVar1 = 0; puVar1[1] = 5; puVar1[3] = 0x17a; puVar1[2] = 0x1ff; *(aseq_cursor_struct **)(puVar1 + 6) = gear_aseq_14011_hand_cursor; puVar1[5] = 0; set_cursor_override_regions((int)DAT_0044fe84,1); return; } void __stdcall clear_cursor_override_regions(void) { set_cursor_override_regions(0,0); return; } void __stdcall gear_puzzle_setup_hand_cursor_and_free_memory(void) { gear_puzzle_setup_hand_cursor(0); return; } void __stdcall FUN_0042012f(void) { aseq_anim_state_struct *paVar1; DAT_0044febc = 1; if (gear_puzzle_state == 1) { clip_cursor_disable(); gear_shuffle_some_fields_ccc(); gear_puzzle_state = 2; free_aseq((int *)loaded_gear_more_data->aseq_struct); paVar1 = (aseq_anim_state_struct *)load_aseq(0x36b8); loaded_gear_more_data->aseq_struct = paVar1; gear_puzzle_setup_hand_cursor_and_free_memory(); return; } if (gear_puzzle_state != 4) { gear_puzzle_state = 2; return; } gear_puzzle_state = 2; gear_puzzle_gears_in_sidebar[DAT_0044fec0] = gear_puzzle_gears_in_sidebar[DAT_0044fec0] + 1; gear_puzzle_setup_hand_cursor_and_free_memory(); gear_puzzle_related_xxx_struct_ARRAY_0044fe94[DAT_0044fec0].field0_0x0 = DAT_0044fe7a; DAT_0044fec0 = 0xffff; return; } void __stdcall exit_game_on_periodic_(void) { if (game_exited == 0) { if (save_file_big != (save_file_main *)0x0) { free_tracked_heap_block((int)save_file_big); } FUN_00406c24(); nullsub(); xxxfunc_tear_down(); game_exited = 1; } exit(0); return; } undefined4 __cdecl custom_anim_command_handler(int param_1,short param_2,short param_3,ushort param_4) { if (param_2 == -0x28a) { FUN_0042dc11((short *)(param_1 + 0x3a)); } else if (param_2 == -0x27d) { stop_playing_wave_by_id_type1(wave_ints_xxxxxxxxx[param_3]); } else if (param_2 == -0x27c) { play_wave_flag1(wave_ints_xxxxxxxxx[param_3],param_4 & 0xff,(short)(char)(param_4 >> 8)); } return 0; } void __stdcall FUN_00420284(void) { status_bar_load_xxx(); workshop_new_veh_parts_list(); init_new_player_hints(); save_file_big = (save_file_main *)alloc_tracked_heap_block(5999); init_new_save_file_big(save_file_big); set_up_actors_01(); return; } void __stdcall enable_all_menus(void) { restore_enable_menus(0xff,0xffff,1); return; } void __stdcall setup_default_enable_menus(void) { disable_menus(1,0xffff,1); restore_enable_menus(1,2,1); restore_enable_menus(2,0xffff,1); disable_menus(2,0,1); restore_enable_menus(4,0xffff,1); restore_enable_menus(8,0xffff,1); return; } void __stdcall enter_building(void) { word wVar1; save_file_main *psVar2; undefined4 uVar3; uint uVar4; save_file_big->level_in_building = save_file_big->num_built_vehicles[(short)save_file_big->building_idx] + 1; save_file_big->area = save_file_big->building_idx * 5 + save_file_big->level_in_building; load_area_parts(); load_area(); if (save_file_big->xxx[(short)save_file_big->building_idx] == 0) { actor_01_reset_xxx(); uVar3 = part_get_num_parts_needed(); (save_file_big->basic_stats).parts_needed = (word)uVar3; if (save_file_big->level_in_building == 0) { (save_file_big->basic_stats).green_tube_hint_flag = 0; (save_file_big->basic_stats).bananas = 10; } else { (save_file_big->basic_stats).bananas = save_file_big->per_building_data[(short)save_file_big->building_idx].basic_stats.bananas; } uVar4 = rand(); (save_file_big->basic_stats).xxx_rand_related = (ushort)((int)uVar4 % 100 < 0x32); setup_actors_N(); (save_file_big->basic_stats).xxx_blueprint_related = 0; (save_file_big->basic_stats).xxx_built_vehicle_related = 0; (save_file_big->basic_stats).vehicle_color = -1; (save_file_big->basic_stats).building_sector = SHORT_ARRAY_00449c58[(short)save_file_big->level_in_building]; (save_file_big->basic_stats).parts_have = 0; randomly_place_chimps(); } else { load_eseq_4500_3(); setup_actors_N(); psVar2 = save_file_big; wVar1 = save_file_big->building_idx; memcpy((undefined4 *)&save_file_big->basic_stats, (undefined4 *)(save_file_big->per_building_data + (short)wVar1),0x14); parse_save_big_part_related(psVar2->per_building_data[(short)wVar1].parts_state_xxx[0]); parse_save_stuff_on_map (psVar2->per_building_data[(short)wVar1].doors_state, (ushort *)psVar2->per_building_data[(short)wVar1].items_state); parse_save_actor_state((int)psVar2->per_building_data[(short)wVar1].actor_state); DAT_00449c4a = 1; } restore_enable_menus(2,0,1); xxxfunc_set(&into_warehouse_modeswitch_funcset); return; } void __stdcall pre_puzzle_choosing_on_load(void) { dec_clear_repost_mouse_downup(0); return; } void __stdcall pre_puzzle_choosing_on_periodic(void) { status_bar_flags = status_bar_flags | 0x20; xxxfunc_set(&puzzle_choosing_funcset_xxx); return; } void __stdcall into_warehouse_modeswitch_onload(void) { xxxfunc_funcset *pxVar1; short sVar2; DAT_00449c4c = 1; restore_enable_menus(1,0xffff,1); if (actors[0].saved.screen_idx == 0) { sVar2 = 1400; if (save_file_big->building_idx == 1) { sVar2 = 1401; } if ((save_file_big->building_idx == 2) && ((short)save_file_big->level_in_building < 2)) { sVar2 = 1401; } status_bar_flags = status_bar_flags | 0x20; } else { sVar2 = save_file_big->building_idx + 1402; status_bar_flags = status_bar_flags | 0x8000; if (wave_ints_xxxxxxxxx == (short *)0x0) { wave_ints_xxxxxxxxx = (short *)load_wave_by_ints(4500); } } load_rrgb_1(sVar2); draw_status_bar(0); load_screen(actors[0].saved.screen_idx); actors_load_stuff(); if (actors[0].saved.screen_idx == 0) { pxVar1 = &workshop_funcset; } else { pxVar1 = &warehouse_platforming_funcset; } xxxfunc_set(pxVar1); return; } void __stdcall from_warehouse_modeswitch_on_load(void) { xxxfunc_funcset *pxVar1; bool bVar2; bool bVar3; pxVar1 = &into_warehouse_modeswitch_funcset; free_cur_screen_aseq(); FUN_00425b5a(); bVar2 = go_through_locked_door != 0; if (bVar2) { midi_stop(bgm_midi_idx); go_through_locked_door = 0; pxVar1 = &pre_puzzle_choosing_funcset; FUN_0042211c(); } bVar3 = go_race != 0; if (bVar3) { pxVar1 = &get_parts_on_vehicle_funcset; go_race = 0; save_file_big->xxx[(short)save_file_big->building_idx] = 1; DAT_00449c4a = 1; write_save_big_xxx(); } if (actors[0].saved.screen_idx == 0 || (bVar3 || bVar2)) { free_eseq_4504_7(); free_eseq_4500_3(); free_waves_from_list((int)wave_ints_xxxxxxxxx); wave_ints_xxxxxxxxx = (short *)0x0; } xxxfunc_set(pxVar1); return; } void __stdcall process_cheats(void) { word *pwVar1; int *piVar2; short sVar3; uint uVar4; sVar3 = pump_messages_and_get_key_(); if (cheatkeys != 0) { switch(sVar3) { case 1: cheat_give_all_parts(); break; case 2: pwVar1 = &(save_file_big->basic_stats).bananas; *pwVar1 = *pwVar1 + 5; status_bar_flags = status_bar_flags | 8; status_bar_set_text_flags_0x10(s_Yes__we_have_no_bananas_00449e03); break; case 6: DAT_0044a77c = DAT_0044a77c ^ 1; aseq_4508_override_timing(); status_bar_set_text_flags_0x10(s_Hang_on_tight____00449e1b); break; case 9: god_mode = god_mode ^ 1; if (god_mode == 0) { status_bar_set_text_flags_0x10(s_God_Mode_Off_00449e4e); } else { status_bar_set_text_flags_0x10(s_God_Mode_On_00449e42); } break; case 0x10: piVar2 = &(save_file_big->player_entry).score; *piVar2 = *piVar2 + 100; status_bar_flags = status_bar_flags | 4; break; case 0x15: uVar4 = area_screen_type_b0(actors[0].saved.screen_idx); if ((short)uVar4 == 0) { if ((short)actors[0].saved.y2 < 3) { if (actors[0].saved.y2 == 0) { actors[0].saved.y2 = 2; actors[0].saved.y = actors[0].saved.y + 200; } else { actors[0].saved.y2 = actors[0].saved.y2 - 1; actors[0].saved.y = actors[0].saved.y + -100; } } else if (actors[0].saved.y2 == 3) { actors[0].saved.y2 = 5; actors[0].saved.y = actors[0].saved.y + 200; } else { actors[0].saved.y2 = actors[0].saved.y2 - 1; actors[0].saved.y = actors[0].saved.y + -100; } } else if ((short)actors[0].saved.y2 < 1) { actors[0].saved.y2 = 5; actors[0].saved.y = actors[0].saved.y + 0xfa; } else { actors[0].saved.y2 = actors[0].saved.y2 - 1; actors[0].saved.y = actors[0].saved.y + -0x32; } status_bar_set_text_flags_0x10(s_Up__up__and_awaaaay___00449e2c); break; case 0x19: unlock_all_doors(); break; case 0x1a: cheat_pick_a_puzzle = cheat_pick_a_puzzle ^ 1; } } if (sVar3 == 0x13) { if (DAT_00449c3c == 0) { DAT_00449c3c = 1; return; } } else { if (sVar3 == 0x17) { if (DAT_00449c3c == 1) { actors[0].saved.x = 0x10; uVar4 = area_screen_type_b0(actors[0].saved.screen_idx); if ((short)uVar4 == 0) { actors[0].saved.y = 0xf4; uVar4 = area_screen_type(actors[0].saved.screen_idx); if ((uVar4 & 2) == 0) { actors[0].saved.y2 = 2; } else { actors[0].saved.y2 = 5; } } else { actors[0].saved.y = 0x115; actors[0].saved.y2 = 5; } actor_go_to_state(0,0); actors[0].saved.eseq_step = 0; actors[0].collision_flags = 0; actors[0].saved.collide_entity_checks_en = 1; actors[0].saved.process_thing2_en = 1; DAT_00449c3c = 0; } status_bar_set_text_flags_0x10(s_Beam_me_up_Sid__00449e5b); return; } DAT_00449c3c = 0; } return; } void __stdcall warehouse_platforming_on_load(void) { int iVar1; word *pwVar2; nullishsub(); DAT_0044ff32 = 0; key_xxxxx_set(process_cheats); on_deactivate_xtra_cb = status_bar_put_down_held; status_bar_put_down_held(); draw_status_bar(0); last_key_time = get_time_ms(); pwVar2 = &(save_file_big->basic_stats).go_through_door_hint_flag; iVar1 = time_get_secs_count(0x3c); enqueue_new_player_hint(5,(ushort)iVar1,pwVar2); process_all_actors(); draw_all_actors(); dec_clear_repost_mouse_downup(0); return; } void __stdcall warehouse_platforming_on_remove(void) { key_xxxxx_clear(); tear_down_new_player_hints(); (*(code *)on_deactivate_xtra_cb)(); on_deactivate_xtra_cb = (undefined *)0x0; if ((actors[0].saved.screen_idx != 0) && (DAT_0044ff32 == 0)) { inc_repost_mouse_downup(); return; } FUN_0042211c(); wave_ints_xxxxxxxxx = (short *)free_waves_from_list((int)wave_ints_xxxxxxxxx); return; } void __stdcall warehouse_platforming_on_periodic(void) { short sVar1; FUN_00422170(); process_new_player_hints(); if (aseq_4508_skip_draw_happened != 0) { aseq_4508_skip_draw_happened = 0; sVar1 = process_all_actors(); if (sVar1 == 0) { draw_all_actors(); } else { xxxfunc_set(&from_warehouse_modeswitch_funcset); } } draw_status_bar(0); return; } void __stdcall get_parts_on_vehicle(void) { part_chunk *ppVar1; short *psVar2; short sVar3; psVar2 = filtered_parts_array; ppVar1 = loaded_parts; for (sVar3 = 0; sVar3 < (short)loaded_area_parts->num_parts; sVar3 = sVar3 + 1) { if ((ppVar1->held_by_actor == 0) && ((ppVar1->state_flags & 0x8000) != 0)) { *psVar2 = sVar3; psVar2 = psVar2 + 1; } ppVar1 = ppVar1 + 1; } *psVar2 = -1; DAT_00449c66 = 0; xxxfunc_set(&switch_to_correct_race_funcset); return; } void __stdcall switch_to_correct_race(void) { word wVar1; DAT_004520e4 = 1; draw_status_bar(0); disable_menus(0xff,0xffff,0); wVar1 = save_file_big->building_idx; if (wVar1 != 0) { if (wVar1 == 1) { xxxfunc_set(&race_1_funcset); return; } if (wVar1 != 2) { return; } } xxxfunc_set(&race_02_funcset); return; } void __stdcall nullsub(void) { return; } void __cdecl increment_score(short param_1,short param_2) { int *piVar1; piVar1 = &(save_file_big->player_entry).score; *piVar1 = *piVar1 + (int)param_1; if (param_2 != 0) { status_bar_flags = status_bar_flags | 4; } return; } void __cdecl give_bananas(short param_1) { word *pwVar1; pwVar1 = &(save_file_big->basic_stats).bananas; *pwVar1 = *pwVar1 + param_1; status_bar_flags = status_bar_flags | 8; return; } bool __cdecl show_yesno_dialog(short param_1,short param_2) { short sVar1; undefined2 *puVar2; undefined4 uVar3; puVar2 = (undefined2 *)new_yesno_dialog(); *puVar2 = 0xffff; puVar2[1] = 0xffff; uVar3 = load_resource_item_0(param_1,(int *)PTR_text_0044ae14); *(undefined4 *)(puVar2 + 0xd) = uVar3; *(char **)(puVar2 + 0xf) = s_to_go_Back_00449e6b; uVar3 = load_resource_item_0(param_2,(int *)PTR_text_0044ae14); *(undefined4 *)(puVar2 + 0x11) = uVar3; sVar1 = show_dialog(puVar2); free_resource_item_with_data(*(int *)(puVar2 + 0xd)); free_resource_item_with_data(*(int *)(puVar2 + 0x11)); free_tracked_heap_block((int)puVar2); return sVar1 != 0; } void __stdcall FUN_00420b6e(void) { FUN_00420c4c(); xxxfunc_set(DAT_0044ff38); return; } void __stdcall file_start_another_game(void) { bool bVar1; undefined1 extraout_AH; bVar1 = show_yesno_dialog(0x3f6,0x3f7); if (CONCAT11(extraout_AH,bVar1) != 0) { DAT_0044ff32 = 1; write_save_big_xxx(); DAT_0044ff38 = &file_select_related_funcset_maybe; xxxfunc_set(&xxxfunc_funcset_00449d0c); } return; } void __stdcall file_go_to_tech_center(void) { bool bVar1; undefined1 extraout_AH; bVar1 = show_yesno_dialog(0x3f4,0x3f5); if (CONCAT11(extraout_AH,bVar1) != 0) { DAT_0044ff32 = 1; write_save_big_xxx(); DAT_0044ff38 = &save_loaded_parking_lot_funcs; xxxfunc_set(&xxxfunc_funcset_00449d0c); } return; } undefined4 __stdcall exit_game_handler(void) { bool bVar1; undefined3 extraout_var; undefined4 uVar2; uVar2 = 0; if (disable_exiting_because_dialog_xxx == 0) { if ((DAT_00449914 == 0) && (bVar1 = show_yesno_dialog(0x3f2,0x3f3), (short)CONCAT31(extraout_var,bVar1) == 0)) { return 0; } write_save_big_xxx(); xxxfunc_set(&exit_game_funcset); uVar2 = 1; } return uVar2; } void __stdcall FUN_00420c4c(void) { FUN_0040b21a(1); free_eseq_4500_3(); FUN_00408a73(); mouse_region_delete_all_lists(); FUN_004371de(); free_cur_screen_aseq(); free_area(); FUN_00425b5a(); free_part_xxx(); linked_list_head_zero(&(actors[0].parts_linked_list)->next); FUN_0043d7c1(0); FUN_004385a6(); return; } void __stdcall nullsub(void) { return; } void __stdcall exit_game_on_periodic(void) { exit_game_on_periodic_(); return; } void __stdcall on_activate_handler(void) { if (DAT_0044ff3c == 0) { set_cursor(0); restore_cursor_override_regions(); dec_clear_repost_mouse_downup(1); FUN_0042c2cf(); unpause_all_sounds(0); DAT_0044ff3c = 1; if (DAT_0044ff3e != 0) { hide_sys_cursor(); } timers_resume(); } return; } void __stdcall on_deactivate_handler(void) { if (DAT_0044ff3c != 0) { timers_pause(); if (on_deactivate_xtra_cb != (undefined *)0x0) { (*(code *)on_deactivate_xtra_cb)(); } save_unset_custom_cursor(); pause_all_sounds(); FUN_0042c2af(); DAT_0044ff3c = 0; inc_repost_mouse_downup(); DAT_0044ff3e = restore_sys_cursor(); } return; } undefined4 __cdecl char_filter_xxx(short param_1) { undefined2 extraout_var; undefined2 extraout_var_00; undefined2 uVar1; if (param_1 == L'R') { LAB_00420d68: key_down_handler_buffered(0x12); uVar1 = extraout_var_00; } else { if (param_1 != L'S') { if (param_1 == 0x72) goto LAB_00420d68; if (param_1 != 0x73) { return 0; } } toggle_all_sounds(); uVar1 = extraout_var; } return CONCAT22(uVar1,1); } void __stdcall nullsub(void) { return; } void __stdcall nullsub(void) { return; } void __cdecl set_cursor_wait_arrow(short param_1) { if (param_1 != 0) { set_cursor(0xffff); return; } set_cursor(0); return; } void __stdcall tear_down_lots_of_stuff(void) { ptr_on_pump_messages_448124 = nullsub; ptr_on_activate = nullsub; ptr_on_deactivate = nullsub; FUN_00436d8b(); anim_engine_tear_down_lots_of_heaps(); FUN_004175dc(); free_all_nfnt(); time_end_period(); mouse_region_teardown(); free_all_resources(); gfxish_teardown(); destroy_main_menu(); free_tracked_heap_blocks(); return; } undefined4 __stdcall load_and_set_up_stuff(void) { undefined4 uVar1; undefined2 extraout_var; undefined4 extraout_EDX; short sVar2; undefined4 uVar3; init_tracked_heap_blocks(500); uVar1 = load_ini_settings(); if ((short)uVar1 == 0) { return 0; } init_resources_list(); sVar2 = 0; do { uVar1 = load_dat_file(dat_file_names[sVar2]); if ((short)uVar1 == 0) { open_dialog_box_wrapped_xxx(129); return 0; } sVar2 = sVar2 + 1; } while (sVar2 < 0x14); uVar3 = 1000; uVar1 = time_begin_period(1000); gfxish_initialize(uVar1,extraout_EDX,uVar3,0x200,0x180,2); anim_engine_init_lots_of_heaps(); setup_keyboard_buffer(); mouse_region_setup(); create_sound_window(); setup_nfnt(); create_main_win_menu(); atexit(tear_down_lots_of_stuff); add_system_menu_2000(s_About_Gizmos____Gadgets__CD_00449e78); setup_menus(); ptr_on_activate = on_activate_handler; ptr_on_deactivate = on_deactivate_handler; ptr_on_close = exit_game_handler; ptr_wm_char_filter = char_filter_xxx; ptr_wm_initmenu = on_deactivate_handler; ptr_wm_menuselect = on_activate_handler; ptr_on_wmcommand = on_wmcommand_handler; load_nfnt(200); set_default_nfnt(200); FUN_00420284(); custom_cursor_setup(); xxxfunc_setup(2,&default_funcset); set_cursor(0); uVar1 = time((int *)0x0); srand(uVar1); clip_cursor_disable(); FUN_00422bc9(set_cursor_wait_arrow); DAT_0044ff3c = 1; return CONCAT22(extraout_var,1); } undefined4 load_wing32(undefined4 param_1) { UINT uMode; h_wing32 = (HMODULE)0x0; if (gfx_render_mode == 3) { uMode = SetErrorMode(0x8000); h_wing32 = LoadLibraryA(s_WING32_DLL_0044a6b4); SetErrorMode(uMode); if (h_wing32 < (HMODULE)0x20) { param_1 = 0; } else { WinGCreateDC = GetProcAddress(h_wing32,(LPCSTR)0x3); WinGRecommendDIBFormat = GetProcAddress(h_wing32,(LPCSTR)0x8); WinGCreateBitmap = GetProcAddress(h_wing32,(LPCSTR)0x2); WinGGetDIBPointer = GetProcAddress(h_wing32,(LPCSTR)0x7); WinGGetDIBColorTable = GetProcAddress(h_wing32,(LPCSTR)0x6); WinGSetDIBColorTable = GetProcAddress(h_wing32,(LPCSTR)0x9); WinGBitBlt = GetProcAddress(h_wing32,(LPCSTR)0x1); WinGStretchBlt = GetProcAddress(h_wing32,(LPCSTR)0xa); param_1 = CONCAT22((short)((uint)WinGStretchBlt >> 0x10),1); } } return param_1; } void __stdcall free_wing32(void) { if (h_wing32 != (HMODULE)0x0) { FreeLibrary(h_wing32); h_wing32 = (HMODULE)0x0; } return; } void __stdcall wing_bitblt_wrap(void) { (*(code *)WinGBitBlt)(); return; } void __stdcall stretchdibits_wrap(void) { int DestHeight; DestHeight = (int)paint_intersect_h; StretchDIBits(hdc,(int)paint_intersect_x + (int)paint_off_x, (int)paint_intersect_y + (int)paint_off_y,(int)paint_intersect_w,DestHeight, (int)paint_intersect_x, (int)(short)gfxish_fbs[0].h - (paint_intersect_y + DestHeight), (int)paint_intersect_w,DestHeight,gfxish_fbs[0].memory,bitmap_info, (int)bitmap_iusage,0xcc0020); return; } void __cdecl gfxish_init_framebuffer(short param_1,short param_2,short param_3) { int iVar1; undefined *puVar2; int iVar3; undefined1 *puVar4; HDC pHVar5; HBITMAP h; HGDIOBJ pvVar6; undefined1 *puVar7; ushort uVar8; short sVar9; uint uVar10; short local_428; undefined1 local_408 [1026]; undefined2 local_6; local_6 = 0; iVar1 = (int)param_1; memset((undefined4 *)(gfxish_fbs + iVar1),0,0x1c); gfxish_fbs[iVar1].render_mode = gfx_render_mode; gfxish_fbs[iVar1].w = param_2; gfxish_fbs[iVar1].h = param_3; uVar8 = param_2 + 3U & 0xfffc; gfxish_fbs[iVar1].stride = uVar8; uVar10 = (int)(short)uVar8 * (int)param_3; if ((uVar10 & 0xffff) == 0) { uVar10 = uVar10 + 100; } if (gfx_render_mode == 1) { gfxish_fbs[iVar1].field6_0xe = 0; gfxish_fbs[iVar1].y_direction = 1; puVar2 = (undefined *)alloc_tracked_heap_block(uVar10); gfxish_fbs[iVar1].memory = puVar2; } else if (gfx_render_mode == 3) { gfxish_fbs[iVar1].field6_0xe = 1; iVar3 = (*(code *)WinGRecommendDIBFormat)(); if (iVar3 != 0) { sVar9 = 0; puVar4 = local_408 + 2; puVar7 = &DAT_004502c0; do { *puVar4 = *puVar7; puVar4[-1] = puVar7[1]; puVar4[-2] = puVar7[2]; puVar4[1] = 0; sVar9 = sVar9 + 1; puVar4 = puVar4 + 4; puVar7 = puVar7 + 3; } while (sVar9 < 0x100); pHVar5 = (HDC)(*(code *)WinGCreateDC)(); gfxish_fbs[iVar1].wing_dc = pHVar5; gfxish_fbs[iVar1].y_direction = local_428; if (gfxish_fbs[iVar1].wing_dc != (HDC)0x0) { h = (HBITMAP)(*(code *)WinGCreateBitmap)(); gfxish_fbs[iVar1].wing_bitmap = h; if (h != (HBITMAP)0x0) { pvVar6 = SelectObject(gfxish_fbs[iVar1].wing_dc,h); gfxish_fbs[iVar1].wing_gdiobj = pvVar6; } } } } return; } void __cdecl gfxish_free_framebuffer(short param_1) { int iVar1; iVar1 = (int)param_1; if (gfx_render_mode == 1) { free_tracked_heap_block((int)gfxish_fbs[iVar1].memory); return; } if (gfx_render_mode != 3) { return; } SelectObject(gfxish_fbs[iVar1].wing_dc,gfxish_fbs[iVar1].wing_gdiobj); DeleteObject(gfxish_fbs[iVar1].wing_bitmap); DeleteDC(gfxish_fbs[iVar1].wing_dc); return; } void __cdecl other_paint_func(HDC param_1,RECT *param_2) { HBRUSH hbr; HWND hWnd; BOOL BVar1; int iVar2; tagRECT *ptVar3; RECT *pRVar4; RECT local_24; tagRECT local_14; hbr = GetStockObject(1); ptVar3 = &local_14; hWnd = GetDesktopWindow(); GetWindowRect(hWnd,ptVar3); ptVar3 = &local_14; pRVar4 = &local_24; for (iVar2 = 4; iVar2 != 0; iVar2 = iVar2 + -1) { pRVar4->left = ptVar3->left; ptVar3 = (tagRECT *)&ptVar3->top; pRVar4 = (RECT *)&pRVar4->top; } local_24.bottom = paint_off_y + local_24.top; FillRect(param_1,&local_24,hbr); local_24.bottom = local_14.bottom; local_24.top = local_24.top + (int)paint_off_y + (int)paint_h; FillRect(param_1,&local_24,hbr); local_24.top = local_14.top; local_24.right = (LONG)paint_off_x; FillRect(param_1,&local_24,hbr); local_24.right = local_14.right; local_24.left = local_24.left + (int)paint_off_x + (int)paint_w; FillRect(param_1,&local_24,hbr); SetRect(&local_14,(int)paint_off_x,(int)paint_off_y,(int)paint_w + (int)paint_off_x, (int)paint_h + (int)paint_off_y); BVar1 = IntersectRect(&local_24,param_2,&local_14); if (BVar1 != 0) { hdc = param_1; paint_intersect_x = (short)local_24.left - paint_off_x; paint_intersect_y = (short)local_24.top - paint_off_y; paint_intersect_w = (short)local_24.right - (short)local_24.left; paint_intersect_h = (short)local_24.bottom - (short)local_24.top; if (paint_palette != (HPALETTE)0x0) { SelectPalette(param_1,paint_palette,0); RealizePalette(hdc); } (*chosen_blit_function)(); } return; } undefined4 gfxish_initialize(undefined4 param_1,undefined4 param_2,undefined4 param_3,short param_4, short param_5,short param_6) { short sVar1; undefined4 uVar2; BITMAPINFO *pBVar3; undefined2 extraout_var; undefined2 extraout_var_00; undefined2 uVar4; undefined2 extraout_var_01; undefined4 extraout_ECX; undefined4 extraout_ECX_00; RGBQUAD *pRVar5; undefined4 extraout_EDX; undefined4 extraout_EDX_00; undefined4 uVar6; uVar4 = (undefined2)((uint)param_1 >> 0x10); if (gr_is_initialized == 0xa55a) { if (gfxish_is_init == 0) { set_paint_offs((undefined2)mouse_xbase,(undefined2)mouse_ybase); ptr_paint_func = other_paint_func; FUN_00421ecc(); if (gfx_render_mode == 1) { chosen_blit_function = stretchdibits_wrap; pBVar3 = (BITMAPINFO *)alloc_tracked_heap_block(0x428); bitmap_info = pBVar3; (pBVar3->bmiHeader).biSize = 0x28; (pBVar3->bmiHeader).biPlanes = 1; (pBVar3->bmiHeader).biBitCount = 8; (pBVar3->bmiHeader).biCompression = 0; (pBVar3->bmiHeader).biYPelsPerMeter = 0; (pBVar3->bmiHeader).biXPelsPerMeter = 0; (pBVar3->bmiHeader).biClrImportant = 0; (pBVar3->bmiHeader).biClrUsed = 0; (pBVar3->bmiHeader).biWidth = (int)param_4; (pBVar3->bmiHeader).biHeight = (int)param_5; (pBVar3->bmiHeader).biSizeImage = (int)param_4 * (int)param_5; pRVar5 = bitmap_info->bmiColors; sVar1 = 0; do { pRVar5->rgbBlue = (char)sVar1; pRVar5->rgbGreen = (char)((ushort)sVar1 >> 8); pRVar5 = (RGBQUAD *)&pRVar5->rgbRed; sVar1 = sVar1 + 1; } while (sVar1 < 0x100); } else if (gfx_render_mode == 3) { chosen_blit_function = wing_bitblt_wrap; } if (2 < param_6) { param_6 = 2; } gfxish_init_draw_sprite_bounds(0,0,param_4,param_5); gfxish_num_framebuffers = param_6; sVar1 = 0; uVar2 = extraout_ECX; uVar6 = extraout_EDX; uVar4 = extraout_var; if (0 < param_6) { do { gfxish_init_framebuffer(sVar1,param_4,param_5); sVar1 = sVar1 + 1; uVar2 = extraout_ECX_00; uVar6 = extraout_EDX_00; uVar4 = extraout_var_00; } while (sVar1 < param_6); } gfxish_setup_pointers (CONCAT22(uVar4,gfxish_fbs[0].render_mode),uVar6,uVar2,gfxish_fbs[0].render_mode, gfxish_fbs[0].y_direction); set_gfxish_dest_other(); gfxish_fill_rect_wrap(0,0,param_4,param_5,0); set_gfxish_dest(); gfxish_fill_rect_wrap(0,0,param_4,param_5,0); gfxish_is_init = 1; uVar4 = extraout_var_01; } uVar2 = CONCAT22(uVar4,1); } else { alert_message(s_gr_not_initialized__0044a6bf); uVar2 = 0; } return uVar2; } void __stdcall gfxish_teardown(void) { short sVar1; if (gfxish_is_init != 0) { gfxish_fill_rect_wrap(0,0,0x200,0x180,0); gfxish_do_a_paint(); for (sVar1 = 0; sVar1 < gfxish_num_framebuffers; sVar1 = sVar1 + 1) { gfxish_free_framebuffer(sVar1); } if (paint_palette != (HPALETTE)0x0) { DeleteObject(paint_palette); } if (gfx_render_mode == 1) { free_tracked_heap_block((int)bitmap_info); } ptr_paint_func = fill_light_grey; gfxish_is_init = 0; } free_wing32(); return; } void __cdecl gr_initialize(short param_1,short param_2,byte param_3) { HDC hdc; int iVar1; undefined4 uVar2; if (param_1 == 2) { param_1 = 3; param_2 = 1; } hdc = GetDC((HWND)0x0); iVar1 = GetDeviceCaps(hdc,0xc); bits_per_px = (short)iVar1; iVar1 = GetDeviceCaps(hdc,0xe); num_planes = (short)iVar1; iVar1 = GetDeviceCaps(hdc,8); h_px = (undefined2)iVar1; iVar1 = GetDeviceCaps(hdc,10); v_px = (undefined2)iVar1; iVar1 = ReleaseDC((HWND)0x0,hdc); gfx_render_mode = 0; DAT_0044ff4e = 1; if ((num_planes == 1) && (7 < bits_per_px)) { num_colors = 0x100; gfx_render_mode = param_1; if (param_1 == 3) { uVar2 = load_wing32(iVar1); if ((short)uVar2 == 0) { gfx_render_mode = param_2; } } if ((8 < bits_per_px) && (param_1 == 2)) { gfx_render_mode = param_2; } } if (((num_planes == 4) && (bits_per_px == 1)) || ((num_planes == 1 && (bits_per_px == 4)))) { num_colors = 0x10; gfx_render_mode = 4; DAT_0044ff4e = 0; } if ((param_3 & 1) != 0) { bitmap_iusage = 2; } gr_is_initialized = 0xa55a; return; } void __stdcall gfxish_uninvalidate_all(void) { memset((undefined4 *)gfx_invalidate_array,0,0x300); gfxish_has_paint = 0; return; } undefined4 __cdecl gfxish_set_invalidate(undefined4 *param_1) { undefined4 *puVar1; puVar1 = memcpy((undefined4 *)gfx_invalidate_array,param_1,0x300); if (gfxish_has_paint == 0) { gfxish_has_paint = 1; } return CONCAT22((short)((uint)puVar1 >> 0x10),0x300); } void __cdecl gfxish_invalidate_rect(short *param_1) { byte *pbVar1; short sVar2; short sVar3; short sVar4; short local_8; short local_6; if (param_1 == (short *)0x0) { gfxish_has_paint = -1; } else { local_6 = *param_1; sVar2 = local_6 + param_1[2] + -1; sVar3 = param_1[1]; local_8 = sVar3 + param_1[3] + -1; if (local_6 < 0) { local_6 = 0; } if (0x1ff < sVar2) { sVar2 = 0x1ff; } if (sVar3 < 0) { sVar3 = 0; } if (0x17f < local_8) { local_8 = 0x17f; } for (sVar3 = sVar3 >> 4; sVar3 <= local_8 >> 4; sVar3 = sVar3 + 1) { pbVar1 = gfx_invalidate_array[sVar3] + (local_6 >> 4); for (sVar4 = local_6 >> 4; sVar4 <= sVar2 >> 4; sVar4 = sVar4 + 1) { *pbVar1 = 1; pbVar1 = pbVar1 + 1; } } if (gfxish_has_paint == 0) { gfxish_has_paint = 1; } } return; } void __cdecl gfxish_uninvalidate_rect(short *param_1) { short sVar1; byte *pbVar2; short sVar3; short sVar4; short local_8; short local_6; local_6 = *param_1; sVar3 = local_6 + param_1[2] + -1; sVar1 = param_1[1]; local_8 = sVar1 + param_1[3] + -1; if (local_6 < 0) { local_6 = 0; } if (0x1ff < sVar3) { sVar3 = 0x1ff; } if (sVar1 < 0) { sVar1 = 0; } if (0x17f < local_8) { local_8 = 0x17f; } for (sVar1 = sVar1 >> 4; sVar1 <= local_8 >> 4; sVar1 = sVar1 + 1) { pbVar2 = gfx_invalidate_array[sVar1] + (local_6 >> 4); for (sVar4 = local_6 >> 4; sVar4 <= sVar3 >> 4; sVar4 = sVar4 + 1) { *pbVar2 = 0; pbVar2 = pbVar2 + 1; } } return; } void __cdecl gfxish_invalidate_rect_wrap(short param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4) { short local_c; undefined2 uStack_a; undefined2 local_8; undefined2 local_6; local_c = param_1; uStack_a = param_2; local_8 = param_3; local_6 = param_4; gfxish_invalidate_rect(&local_c); return; } void __cdecl FUN_004218f4(short param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4,byte param_5) { short local_c; undefined2 local_a; undefined2 local_8; undefined2 local_6; paint_intersect_x = param_1; paint_intersect_y = param_2; paint_intersect_w = param_3; paint_intersect_h = param_4; hdc = GetDC(main_hwnd); if (hdc == (HDC)0x0) { fatal_message(s_Uh_oh__0044a6d3); } if (paint_palette != (HPALETTE)0x0) { SelectPalette(hdc,paint_palette,0); RealizePalette(hdc); } (*chosen_blit_function)(); ReleaseDC(main_hwnd,hdc); if ((param_5 & 1) != 0) { local_c = param_1; local_a = param_2; local_8 = param_3; local_6 = param_4; gfxish_uninvalidate_rect(&local_c); } return; } undefined4 __stdcall gfxish_do_a_paint(void) { char cVar1; short sVar2; undefined4 uVar3; short sVar4; byte *pbVar5; short sStack_18; byte *local_14; uVar3 = 0; if ((DAT_00449ea4 == 0) && (DAT_00449ea6 == 0)) { pump_some_messages_(); if (gfxish_has_paint < 0) { paint_intersect_y = 0; paint_intersect_x = 0; paint_intersect_w = 0x200; paint_intersect_h = 0x180; hdc = GetDC(main_hwnd); if (hdc == (HDC)0x0) { alert_message(s_Uh_oh__0044a6da); } if (paint_palette != (HPALETTE)0x0) { SelectPalette(hdc,paint_palette,0); RealizePalette(hdc); } (*chosen_blit_function)(); ReleaseDC(main_hwnd,hdc); gfxish_has_paint = 0; uVar3 = 1; } if (gfxish_has_paint != 0) { gfxish_has_paint = 0; local_14 = gfx_invalidate_array[0]; paint_intersect_h = 0x10; hdc = GetDC(main_hwnd); if (paint_palette != (HPALETTE)0x0) { SelectPalette(hdc,paint_palette,0); RealizePalette(hdc); } sStack_18 = 0; paint_intersect_y = 0; do { paint_intersect_x = 0; sVar4 = 0; pbVar5 = local_14; do { for (sVar2 = 0; (cVar1 = *pbVar5, pbVar5 = pbVar5 + 1, cVar1 != '\0' && ((int)sVar4 + (int)sVar2 < 0x20)); sVar2 = sVar2 + 1) { } if (sVar2 == 0) { sVar4 = sVar4 + 1; } else { paint_intersect_w = sVar2 << 4; (*chosen_blit_function)(); sVar4 = sVar4 + sVar2 + 1; paint_intersect_x = paint_intersect_w + paint_intersect_x; uVar3 = 1; } paint_intersect_x = paint_intersect_x + 0x10; } while (sVar4 < 0x20); local_14 = local_14 + 0x20; paint_intersect_y = paint_intersect_y + 0x10; sStack_18 = sStack_18 + 1; } while (sStack_18 < 0x18); ReleaseDC(main_hwnd,hdc); } gfxish_uninvalidate_all(); if (DAT_00449ea4 != 0) { FUN_00422170(); } } else { uVar3 = 0; } return uVar3; } void __stdcall gfxish_copy_dest_to_otherbuf_wrap(void) { gfxish_copy_dest_to_otherbuf(); return; } void __cdecl gfxish_copy_otherbuf_to_dest_and_invalidate (short param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4) { short local_c; undefined2 local_a; undefined2 local_8; undefined2 local_6; local_c = param_1; local_a = param_2; local_8 = param_3; local_6 = param_4; gfxish_copy_otherbuf_to_dest(); gfxish_invalidate_rect(&local_c); return; } void __stdcall FUN_00421c0c(void) { PALETTEENTRY *pPVar1; HDC hdc; HPALETTE pHVar2; int iVar3; undefined4 *puVar4; LOGPALETTE *pLVar5; LOGPALETTE aLStack_410 [128]; puVar4 = &DAT_00449eac; pLVar5 = aLStack_410; for (iVar3 = 0x101; iVar3 != 0; iVar3 = iVar3 + -1) { *(undefined4 *)pLVar5 = *puVar4; puVar4 = puVar4 + 1; pLVar5 = (LOGPALETTE *)((int)pLVar5 + 4); } iVar3 = 0; pPVar1 = aLStack_410[0].palPalEntry; do { pPVar1->peRed = '\0'; pPVar1->peGreen = '\0'; pPVar1->peBlue = '\0'; pPVar1->peFlags = '\x04'; iVar3 = iVar3 + 1; pPVar1 = pPVar1 + 1; } while (iVar3 < 0x100); hdc = GetDC((HWND)0x0); pHVar2 = CreatePalette(aLStack_410); if (pHVar2 != (HPALETTE)0x0) { pHVar2 = SelectPalette(hdc,pHVar2,0); RealizePalette(hdc); pHVar2 = SelectPalette(hdc,pHVar2,0); DeleteObject(pHVar2); } ReleaseDC((HWND)0x0,hdc); return; } void __cdecl load_rrgb_palette(short param_1,short param_2,undefined2 *param_3) { BYTE BVar1; undefined1 *puVar2; BYTE *pBVar3; UINT UVar4; BYTE *pBVar5; PALETTEENTRY *pPVar6; short sVar7; BYTE local_804 [1024]; PALETTEENTRY local_404 [256]; puVar2 = &DAT_004502c0 + param_1 * 3; for (sVar7 = param_1; sVar7 < (short)(param_1 + param_2); sVar7 = sVar7 + 1) { *puVar2 = (char)((ushort)*param_3 >> 8); puVar2[1] = (char)((ushort)param_3[1] >> 8); puVar2[2] = (char)((ushort)param_3[2] >> 8); param_3 = param_3 + 3; puVar2 = puVar2 + 3; } pBVar3 = &DAT_004502c0 + param_1 * 3; sVar7 = 0; pBVar5 = local_804 + 2; pPVar6 = local_404; if (0 < param_2) { do { BVar1 = *pBVar3; pPVar6->peRed = BVar1; *pBVar5 = BVar1; BVar1 = pBVar3[1]; pPVar6->peGreen = BVar1; pBVar5[-1] = BVar1; BVar1 = pBVar3[2]; pPVar6->peBlue = BVar1; pBVar5[-2] = BVar1; pPVar6->peFlags = '\0'; pBVar5[1] = '\0'; pBVar3 = pBVar3 + 3; pPVar6 = pPVar6 + 1; pBVar5 = pBVar5 + 4; sVar7 = sVar7 + 1; } while (sVar7 < param_2); } UVar4 = SetPaletteEntries(paint_palette,(int)param_1,(int)param_2,local_404); if (UVar4 == 0) { alert_message(s_Set_Palette_Entries_failed_0044a6e1); } if (((gfx_render_mode != 1) && (gfx_render_mode != 2)) && (gfx_render_mode == 3)) { for (sVar7 = 0; sVar7 < gfxish_num_framebuffers; sVar7 = sVar7 + 1) { (*(code *)WinGSetDIBColorTable)(); } } return; } void __cdecl load_rrgb_1(short param_1) { undefined2 *puVar1; DAT_004502be = param_1; puVar1 = (undefined2 *)load_resource_item_0(param_1,(int *)&rrgb); load_rrgb_palette(0,0x100,puVar1); free_resource_item_with_idx_fourcc(param_1,(undefined1 *)&rrgb); return; } void __cdecl load_rrgb_2(short param_1,short param_2,short param_3,short param_4) { undefined2 *puVar1; puVar1 = (undefined2 *)load_resource_item_0(param_1,(int *)&rrgb); if (param_4 != 0) { puVar1 = puVar1 + param_2 * 3; } load_rrgb_palette(param_2,param_3,puVar1); free_resource_item_with_idx_fourcc(param_1,(undefined1 *)&rrgb); return; } void __cdecl FUN_00421ea4(short param_1) { if (param_1 == 0) { DAT_004502bc = DAT_004502be; return; } load_rrgb_1(DAT_004502bc); return; } void __stdcall FUN_00421ecc(void) { undefined4 uVar1; short sVar2; HDC hdc; UINT UVar3; uint uVar4; int iVar5; PALETTEENTRY *pPVar6; undefined4 *puVar7; undefined1 *puVar8; BYTE *pBVar9; LOGPALETTE *pLVar10; LOGPALETTE local_414 [128]; undefined1 local_14; undefined1 local_13; undefined1 local_12; undefined1 local_11; puVar7 = &DAT_0044a2b0; pLVar10 = local_414; for (iVar5 = 0x101; iVar5 != 0; iVar5 = iVar5 + -1) { uVar1 = *puVar7; pLVar10->palVersion = (short)uVar1; pLVar10->palNumEntries = (short)((uint)uVar1 >> 0x10); puVar7 = puVar7 + 1; pLVar10 = (LOGPALETTE *)pLVar10->palPalEntry; } hdc = GetDC((HWND)0x0); DAT_004502be = 0xffff; FUN_00421c0c(); UVar3 = GetSystemPaletteUse(hdc); if (UVar3 == 2) { puVar8 = &DAT_004502c0; pPVar6 = local_414[0].palPalEntry; for (sVar2 = 0; sVar2 < num_colors; sVar2 = sVar2 + 1) { pPVar6->peRed = '\0'; *puVar8 = 0; pPVar6->peGreen = '\0'; puVar8[1] = 0; pPVar6->peBlue = '\0'; puVar8[2] = 0; pPVar6->peFlags = '\x04'; puVar8 = puVar8 + 3; pPVar6 = pPVar6 + 1; } local_14 = 0xff; DAT_004505bd = 0xff; local_13 = 0xff; DAT_004505be = 0xff; local_12 = 0xff; DAT_004505bf = 0xff; local_11 = 0; local_414[0].palPalEntry[0].peRed = '\0'; DAT_004502c0 = 0; local_414[0].palPalEntry[0].peGreen = '\0'; DAT_004502c1 = 0; local_414[0].palPalEntry[0].peBlue = '\0'; DAT_004502c2 = 0; local_414[0].palPalEntry[0].peFlags = '\0'; } else { uVar4 = GetDeviceCaps(hdc,0x18); GetSystemPaletteEntries(hdc,0,0x100,local_414[0].palPalEntry); iVar5 = (int)uVar4 >> 1; if (iVar5 < 0) { iVar5 = iVar5 + (uint)((uVar4 & 1) != 0); } pBVar9 = &DAT_004502c0; pPVar6 = local_414[0].palPalEntry; for (sVar2 = 0; sVar2 < iVar5; sVar2 = sVar2 + 1) { *pBVar9 = pPVar6->peRed; pBVar9[1] = pPVar6->peGreen; pBVar9[2] = pPVar6->peBlue; pPVar6->peFlags = '\0'; pBVar9 = pBVar9 + 3; pPVar6 = pPVar6 + 1; } pPVar6 = local_414[0].palPalEntry + sVar2; pBVar9 = &DAT_004502c0 + sVar2 * 3; for (; (int)sVar2 < 0x100 - iVar5; sVar2 = sVar2 + 1) { pPVar6->peRed = *pBVar9; pPVar6->peGreen = pBVar9[1]; pPVar6->peBlue = pBVar9[2]; pPVar6->peFlags = '\x01'; pPVar6 = pPVar6 + 1; pBVar9 = pBVar9 + 3; } sVar2 = 0x100 - (short)iVar5; pBVar9 = &DAT_004502c0 + sVar2 * 3; pPVar6 = local_414[0].palPalEntry + sVar2; for (; sVar2 < 0x100; sVar2 = sVar2 + 1) { *pBVar9 = pPVar6->peRed; pBVar9[1] = pPVar6->peGreen; pBVar9[2] = pPVar6->peBlue; pPVar6->peFlags = '\0'; pBVar9 = pBVar9 + 3; pPVar6 = pPVar6 + 1; } } ReleaseDC((HWND)0x0,hdc); paint_palette = CreatePalette(local_414); return; } int __stdcall FUN_00422098(void) { byte *pbVar1; int iVar2; ushort uVar3; ushort uVar4; int iVar5; iVar5 = 0; uVar4 = (ushort)DAT_004502c0 + (ushort)DAT_004502c1 + (ushort)DAT_004502c2; uVar3 = (ushort)DAT_004505bd + (ushort)DAT_004505be + (ushort)DAT_004505bf; if (uVar3 < uVar4) { iVar5 = 0xff; uVar4 = uVar3; } iVar2 = 1; pbVar1 = &DAT_004502c3; do { uVar3 = (ushort)*pbVar1 + (ushort)pbVar1[1] + (ushort)pbVar1[2]; if (uVar3 < uVar4) { iVar5 = iVar2; uVar4 = uVar3; } iVar2 = iVar2 + 1; pbVar1 = pbVar1 + 3; } while ((short)iVar2 < 0xff); return iVar5; } void __stdcall FUN_0042211c(void) { int iVar1; if (DAT_00449ea4 == 0) { iVar1 = FUN_00422098(); gfxish_has_paint = 0xffff; gfxish_fill_rect_wrap(0,0,gfxish_fbs[0].w,gfxish_fbs[0].h,(ushort)iVar1); gfxish_do_a_paint(); DAT_00449ea4 = 1; if (DAT_00449e98 != (code *)0x0) { (*DAT_00449e98)(); } } return; } void __stdcall FUN_00422170(void) { if ((DAT_00449ea4 != 0) && (DAT_00449ea4 = 0, DAT_00449e98 != (code *)0x0)) { (*DAT_00449e98)(); } return; } undefined1 * __cdecl FUN_00422198(short param_1) { return &DAT_004502c0 + param_1 * 3; } void __stdcall set_gfxish_dest(void) { gfxish_selected_fb = 0; gfxish_dest = gfxish_fbs[0].memory; gfxish_otherbuf = gfxish_fbs[1].memory; paint_w = gfxish_fbs[0].w; paint_h = gfxish_fbs[0].h; DAT_0044ffa8 = 0; DAT_0044ffaa = 1; return; } void __stdcall set_gfxish_dest_other(void) { gfxish_selected_fb = 1; gfxish_dest = gfxish_fbs[1].memory; gfxish_otherbuf = gfxish_fbs[0].memory; paint_w = gfxish_fbs[1].w; paint_h = gfxish_fbs[1].h; DAT_0044ffa8 = 1; DAT_0044ffaa = 0; return; } void __cdecl gfxish_copy_between_rect_xxx(undefined4 param_1,undefined4 param_2,short *param_3) { undefined1 uVar1; short sVar2; short sVar3; short sVar4; undefined2 extraout_var; undefined1 *puVar5; undefined2 extraout_var_00; undefined1 *puVar6; undefined4 extraout_ECX; undefined4 extraout_ECX_00; undefined4 extraout_EDX; undefined4 extraout_EDX_00; short sVar7; short local_c; short local_8; sVar2 = *param_3; local_8 = param_3[1]; sVar3 = param_3[2]; sVar4 = param_3[3]; local_c = 0; if (0 < sVar4) { do { set_gfxish_dest_other(); puVar5 = (undefined1 *) gfxish_fb_get_xy_ptr (CONCAT22(extraout_var,sVar2),extraout_EDX,extraout_ECX,sVar2,local_8); set_gfxish_dest(); puVar6 = (undefined1 *) gfxish_fb_get_xy_ptr (CONCAT22(extraout_var_00,sVar2),extraout_EDX_00,extraout_ECX_00,sVar2, local_8); sVar7 = 0; if (0 < sVar3) { do { uVar1 = *puVar6; *puVar6 = *puVar5; puVar6 = puVar6 + 1; *puVar5 = uVar1; puVar5 = puVar5 + 1; sVar7 = sVar7 + 1; } while (sVar7 < sVar3); } local_8 = local_8 + 1; local_c = local_c + 1; } while (local_c < sVar4); } return; } void __cdecl gfxish_set_px_wrapped(short param_1,undefined2 param_2) { gfxish_set_px(); gfxish_invalidate_rect_wrap(param_1,param_2,1,1); return; } void __cdecl gfxish_draw_sprite_bounds_checked(short param_1,short param_2,int param_3) { short sVar1; byte bVar2; byte bVar3; short sVar4; word wVar5; short sVar6; int iVar7; short sVar8; byte *pbVar9; byte *pbVar10; byte *pbVar11; word local_1a; short local_14; short local_12; byte *local_c; local_12 = *(short *)(param_3 + 4) + param_2; wVar5 = param_2; if (param_2 < (short)draw_sprite_rect_ystart) { wVar5 = draw_sprite_rect_ystart; } if ((short)wVar5 <= (short)draw_sprite_rect_yend) { if ((short)draw_sprite_rect_yend < local_12) { local_12 = draw_sprite_rect_yend + 1; } sVar4 = *(short *)(param_3 + 2); pbVar10 = (byte *)(param_3 + 6); local_14 = sVar4; do { while( true ) { if ((short)draw_sprite_rect_ystart <= param_2) { local_1a = gfxish_fbs[0].stride; if (gfxish_fbs[0].y_direction == -1) { iVar7 = (int)(short)wVar5 * (int)(short)gfxish_fbs[0].stride + (int)param_1; } else { iVar7 = (0x17f - (short)wVar5) * (int)(short)gfxish_fbs[0].stride + (int)param_1; local_1a = -gfxish_fbs[0].stride; } pbVar9 = (byte *)(iVar7 + gfxish_dest); for (; sVar6 = param_1, sVar1 = sVar4, local_c = pbVar9, (short)wVar5 < local_12; wVar5 = wVar5 + 1) { while (sVar1 != 0) { bVar2 = *pbVar10; pbVar11 = pbVar10 + 1; if (bVar2 == 0) { bVar2 = *pbVar11; local_c = local_c + bVar2; sVar1 = sVar1 - (ushort)bVar2; sVar6 = sVar6 + (ushort)bVar2; pbVar10 = pbVar10 + 2; } else if (bVar2 == 0xff) { bVar2 = *pbVar11; bVar3 = pbVar10[2]; pbVar10 = pbVar10 + 3; sVar1 = sVar1 - (ushort)bVar3; for (sVar8 = 0; sVar8 < (short)(ushort)bVar3; sVar8 = sVar8 + 1) { if (((short)draw_sprite_rect_xstart <= sVar6) && (sVar6 <= (short)draw_sprite_rect_xend)) { *local_c = bVar2; } sVar6 = sVar6 + 1; local_c = local_c + 1; } } else { sVar1 = sVar1 - (ushort)bVar2; for (sVar8 = 0; pbVar10 = pbVar11, sVar8 < (short)(ushort)bVar2; sVar8 = sVar8 + 1) { if (((short)draw_sprite_rect_xstart <= sVar6) && (sVar6 <= (short)draw_sprite_rect_xend)) { *local_c = *pbVar11; } pbVar11 = pbVar11 + 1; local_c = local_c + 1; sVar6 = sVar6 + 1; } } } pbVar9 = pbVar9 + (short)local_1a; } return; } bVar2 = *pbVar10; if (bVar2 != 0) break; bVar2 = pbVar10[1]; pbVar10 = pbVar10 + 2; joined_r0x00422428: local_14 = local_14 - (ushort)bVar2; if ((local_14 == 0) && (param_2 = param_2 + 1, local_14 = sVar4, param_2 == local_12)) { return; } } if (bVar2 == 0xff) { bVar2 = pbVar10[2]; pbVar10 = pbVar10 + 3; goto joined_r0x00422428; } local_14 = local_14 - (ushort)bVar2; pbVar10 = pbVar10 + 1 + bVar2; } while ((local_14 != 0) || (param_2 = param_2 + 1, local_14 = sVar4, param_2 != local_12)); } return; } void __cdecl FUN_004225bc(short param_1,short param_2,int param_3) { short sVar1; byte bVar2; byte bVar3; short sVar4; int iVar5; int iVar6; int iVar7; int iVar8; byte *pbVar9; byte *pbVar10; word local_1c; short local_16; int local_14; byte *local_c; iVar7 = (int)param_2; local_14 = iVar7 + *(short *)(param_3 + 4); if (param_2 < (short)draw_sprite_rect_ystart) { param_2 = draw_sprite_rect_ystart; } if ((param_2 <= (short)draw_sprite_rect_yend) && ((short)draw_sprite_rect_ystart <= local_14)) { if ((short)draw_sprite_rect_yend < local_14) { local_14 = (int)(short)draw_sprite_rect_yend; } sVar4 = *(short *)(param_3 + 2); pbVar9 = (byte *)(param_3 + 6); local_16 = sVar4; do { while( true ) { if ((short)draw_sprite_rect_ystart <= iVar7) { local_1c = gfxish_fbs[0].stride; if (gfxish_fbs[0].y_direction == -1) { iVar7 = (int)param_2 * (int)(short)gfxish_fbs[0].stride; } else { iVar7 = (0x17f - param_2) * (int)(short)gfxish_fbs[0].stride; local_1c = -gfxish_fbs[0].stride; } iVar7 = iVar7 + gfxish_dest; for (iVar5 = (int)param_2; iVar5 < local_14; iVar5 = iVar5 + 1) { iVar6 = (int)param_1 + (int)sVar4 + -1; local_c = (byte *)(iVar7 + iVar6); sVar1 = sVar4; while (sVar1 != 0) { bVar2 = *pbVar9; pbVar10 = pbVar9 + 1; if (bVar2 == 0) { bVar2 = *pbVar10; local_c = local_c + -(uint)bVar2; sVar1 = sVar1 - (ushort)bVar2; iVar6 = iVar6 - (uint)bVar2; pbVar9 = pbVar9 + 2; } else if (bVar2 == 0xff) { bVar2 = *pbVar10; bVar3 = pbVar9[2]; pbVar9 = pbVar9 + 3; sVar1 = sVar1 - (ushort)bVar3; for (iVar8 = 0; iVar8 < (int)(uint)bVar3; iVar8 = iVar8 + 1) { if (((short)draw_sprite_rect_xstart <= iVar6) && (iVar6 <= (short)draw_sprite_rect_xend)) { *local_c = bVar2; } local_c = local_c + -1; iVar6 = iVar6 + -1; } } else { sVar1 = sVar1 - (ushort)bVar2; for (iVar8 = 0; pbVar9 = pbVar10, iVar8 < (int)(uint)bVar2; iVar8 = iVar8 + 1) { if (((short)draw_sprite_rect_xstart <= iVar6) && (iVar6 <= (short)draw_sprite_rect_xend)) { *local_c = *pbVar10; } pbVar10 = pbVar10 + 1; local_c = local_c + -1; iVar6 = iVar6 + -1; } } } iVar7 = iVar7 + (short)local_1c; } return; } bVar2 = *pbVar9; if (bVar2 != 0) break; bVar2 = pbVar9[1]; pbVar9 = pbVar9 + 2; joined_r0x00422668: local_16 = local_16 - (ushort)bVar2; if ((local_16 == 0) && (iVar7 = iVar7 + 1, local_16 = sVar4, iVar7 == local_14)) { return; } } if (bVar2 == 0xff) { bVar2 = pbVar9[2]; pbVar9 = pbVar9 + 3; goto joined_r0x00422668; } local_16 = local_16 - (ushort)bVar2; pbVar9 = pbVar9 + 1 + bVar2; } while ((local_16 != 0) || (iVar7 = iVar7 + 1, local_16 = sVar4, iVar7 != local_14)); } return; } int gfxish_fb_get_xy_ptr (int param_1,undefined4 param_2,undefined4 param_3,short param_4,short param_5) { if (gfx_render_mode != 1) { if (1 < (int)gfx_render_mode - 2U) goto LAB_00422867; if (gfxish_fbs[gfxish_selected_fb].y_direction == -1) { param_1 = (int)param_5 * (int)(short)gfxish_fbs[gfxish_selected_fb].stride + (int)param_4; goto LAB_00422867; } } param_1 = (((short)gfxish_fbs[gfxish_selected_fb].h + -1) - (int)param_5) * (int)(short)gfxish_fbs[gfxish_selected_fb].stride + (int)param_4; LAB_00422867: return (int)(gfxish_fbs[gfxish_selected_fb].memory + param_1); } void __cdecl gfxish_line_h_wrap(short param_1,undefined2 param_2,undefined2 param_3,ushort param_4) { clamp_color_idx(param_4); gfxish_line_h(); gfxish_invalidate_rect_wrap(param_1,param_2,param_3,1); return; } void __cdecl gfxish_line_v_wrap(short param_1,undefined2 param_2,undefined2 param_3,ushort param_4) { clamp_color_idx(param_4); gfxish_line_v(); gfxish_invalidate_rect_wrap(param_1,param_2,1,param_3); return; } void __cdecl gfxish_fill_rect_wrap (short param_1,undefined2 param_2,undefined2 param_3,undefined2 param_4,ushort param_5) { clamp_color_idx(param_5); gfxish_fill_rect(); gfxish_invalidate_rect_wrap(param_1,param_2,param_3,param_4); return; } void __cdecl gfx_draw_box(short param_1,short param_2,short param_3,short param_4,ushort param_5) { gfxish_line_h_wrap(param_1,param_2,param_3,param_5); gfxish_line_h_wrap(param_1,param_4 + param_2 + -1,param_3,param_5); gfxish_line_v_wrap(param_1,param_2,param_4,param_5); gfxish_line_v_wrap(param_1 + param_3 + -1,param_2,param_4,param_5); return; } void __stdcall nullsub(void) { return; } short __cdecl gfx_data_probably_hit_test(short param_1,short param_2,int param_3) { byte bVar1; bool bVar2; short sVar3; byte *pbVar4; byte *pbVar5; short sVar6; short sVar7; sVar7 = *(short *)(param_3 + 2); pbVar4 = (byte *)(param_3 + 6); sVar6 = 0; if ((param_1 < sVar7) && (param_2 < *(short *)(param_3 + 4))) { sVar3 = sVar7; if (param_2 != 0) { do { bVar1 = *pbVar4; pbVar5 = pbVar4 + 1; if (bVar1 == 0) { pbVar4 = pbVar4 + 2; sVar3 = sVar3 - (ushort)*pbVar5; if (sVar3 == 0) { sVar6 = sVar6 + 1; sVar3 = sVar7; } } else if (bVar1 == 0xff) { sVar3 = sVar3 - (ushort)pbVar4[2]; pbVar4 = pbVar4 + 3; if (sVar3 == 0) { sVar6 = sVar6 + 1; sVar3 = sVar7; } } else { sVar3 = sVar3 - (ushort)bVar1; pbVar4 = pbVar5 + bVar1; if (sVar3 == 0) { sVar6 = sVar6 + 1; sVar3 = sVar7; } } } while (sVar6 != param_2); } sVar7 = 0; bVar2 = false; while (!bVar2) { bVar1 = *pbVar4; pbVar5 = pbVar4 + 1; if (bVar1 == 0) { pbVar4 = pbVar4 + 2; param_1 = param_1 - (ushort)*pbVar5; if (param_1 < 0) { bVar2 = true; } } else if (bVar1 == 0xff) { pbVar5 = pbVar4 + 2; pbVar4 = pbVar4 + 3; param_1 = param_1 - (ushort)*pbVar5; if (param_1 < 0) { bVar2 = true; sVar7 = 1; } } else { param_1 = param_1 - (ushort)bVar1; pbVar4 = pbVar5 + bVar1; if (param_1 < 0) { bVar2 = true; sVar7 = 1; } } } } else { sVar7 = 0; } return sVar7; } undefined4 __cdecl zomg_intersect_rect(short *param_1,short *param_2) { undefined4 uVar1; if (((((short)(*param_2 + param_2[2] + -1) < *param_1) || ((short)(*param_1 + param_1[2] + -1) < *param_2)) || ((short)(param_2[1] + param_2[3] + -1) < param_1[1])) || ((short)(param_1[1] + param_1[3] + -1) < param_2[1])) { uVar1 = 0; } else { uVar1 = CONCAT22((short)((uint)param_1 >> 0x10),1); } return uVar1; } void __cdecl gfxish_init_draw_sprite_bounds(short param_1,short param_2,short param_3,short param_4) { if (-1 < param_1) { draw_sprite_rect_xstart = param_1; } if (-1 < param_2) { draw_sprite_rect_ystart = param_2; } if ((-1 < param_3) && (draw_sprite_rect_xend = param_3 + -1 + param_1, 0x1ff < (short)draw_sprite_rect_xend)) { draw_sprite_rect_xend = 0x1ff; } if ((-1 < param_4) && (draw_sprite_rect_yend = param_4 + -1 + param_2, 0x17f < (short)draw_sprite_rect_yend)) { draw_sprite_rect_yend = 0x17f; } return; } bool __stdcall is_16_colors(void) { return num_colors == 0x10; } bool __stdcall is_256_color(void) { return num_colors == 0x100; } ushort __cdecl clamp_color_idx(ushort param_1) { ushort uVar1; if (num_colors == 0x10) { uVar1 = (short)param_1 >> 8; } else { uVar1 = param_1 & 0xff; } return uVar1; } void __cdecl FUN_00422b9d(undefined2 *param_1,undefined2 *param_2) { *param_1 = 0x200; *param_2 = 0x180; return; } int __cdecl gfxish_calc_sz(short param_1,short param_2) { return (int)param_1 * (int)param_2 + 8; } void __cdecl FUN_00422bc9(undefined4 param_1) { DAT_00449e98 = param_1; return; } void __cdecl set_paint_offs(undefined2 param_1,undefined2 param_2) { paint_off_x = param_1; paint_off_y = param_2; return; } void __stdcall help_prev_page_button_click(void) { aseq_select_anim((int)help_left_button_anim,2); aseq_select_anim((int)help_right_button_anim,0); aseq_anim_reset_and_play((undefined4 *)help_left_button_anim); aseq_anim_reset_and_play((undefined4 *)help_right_button_anim); help_nextprev_thing = 2; return; } void __stdcall help_next_page_button_click(void) { aseq_select_anim((int)help_left_button_anim,0); aseq_select_anim((int)help_right_button_anim,2); aseq_anim_reset_and_play((undefined4 *)help_left_button_anim); aseq_anim_reset_and_play((undefined4 *)help_right_button_anim); help_nextprev_thing = 1; return; } void __stdcall help_done_button_click(void) { aseq_select_anim((int)help_left_button_anim,0); aseq_select_anim((int)help_right_button_anim,2); aseq_anim_reset_and_play((undefined4 *)help_left_button_anim); aseq_anim_reset_and_play((undefined4 *)help_right_button_anim); help_nextprev_thing = VK_ESCAPE; return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __stdcall FUN_00422cd2(void) { int iVar1; FUN_0043cba0(-1,-1,0x1c4,0xfa,5); FUN_0043e1b5(0); iVar1 = (int)DAT_004520a0 >> 1; if (iVar1 < 0) { iVar1 = iVar1 + (uint)(((int)DAT_004520a0 & 1U) != 0); } FUN_0043dbb3(-1,help_hdr_string,(short)iVar1 + _DAT_0045209c,DAT_0045209e + 4,0xffff); FUN_00401220(DAT_00452094 + 5,DAT_00452096 + 5,(byte *)help_cur_page->str); return; } // WARNING: Removing unreachable block (ram,0x00422e18) // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __cdecl help_draw_page(undefined4 *param_1) { int iVar1; int iVar2; int *piVar3; code *pcVar4; short sVar5; short sVar6; undefined2 uVar7; FUN_00422cd2(); iVar1 = deref_prev((int)param_1); if (iVar1 == 0) { help_left_button_anim = (aseq_anim_state_struct *)0x0; } else { help_left_button_anim = help_prev_page_anim; } iVar2 = deref_next(param_1); if (iVar2 == 0) { help_right_button_anim = help_done_anim; } else { help_right_button_anim = help_next_page_anim; } if (iVar1 != 0) { sVar5 = DAT_00452094 + 0x14; sVar6 = DAT_00452096 + DAT_0045209a + 10; aseq_select_anim((int)help_left_button_anim,0); aseq_set_pos_order((int)help_left_button_anim,sVar5,sVar6,0x66); aseq_anim_reset_and_play((undefined4 *)help_left_button_anim); uVar7 = 1; piVar3 = mouse_region_new_up(sVar5,sVar6,0x7a,0x1d,10,0x422c00); mouse_region_set_filter_key((int)piVar3,uVar7); } sVar5 = DAT_00452094 + DAT_00452098 + -0x90; sVar6 = DAT_00452096 + DAT_0045209a + 10; aseq_set_pos_order((int)help_right_button_anim,sVar5,sVar6,0x66); aseq_select_anim((int)help_right_button_anim,1); _DAT_004505f4 = help_right_button_anim; aseq_anim_reset_and_play((undefined4 *)help_right_button_anim); uVar7 = 1; if (iVar2 == 0) { pcVar4 = help_done_button_click; } else { pcVar4 = help_next_page_button_click; } piVar3 = mouse_region_new_up(sVar5,sVar6,0x7a,0x1d,10,(uint)pcVar4); mouse_region_set_filter_key((int)piVar3,uVar7); for (sVar5 = 0; sVar5 < *(short *)(param_1 + 2); sVar5 = sVar5 + 1) { aseq_set_pos_order(*(int *)((int)param_1 + sVar5 * 4 + 10), *(short *)((int)param_1 + sVar5 * 2 + 0x12) + 0x1e, *(short *)((int)param_1 + sVar5 * 2 + 0x16) + DAT_00452096,0x65); aseq_anim_reset_and_play(*(undefined4 **)((int)param_1 + sVar5 * 4 + 10)); } return; } void __cdecl help_clean_up_page(int param_1) { short sVar1; mouse_region_remove_by_filter_key(1); for (sVar1 = 0; sVar1 < *(short *)(param_1 + 8); sVar1 = sVar1 + 1) { anim_state_xxx_list_remove(*(int **)(param_1 + 10 + sVar1 * 4)); } anim_state_xxx_list_remove((int *)help_next_page_anim); anim_state_xxx_list_remove((int *)help_done_anim); anim_state_xxx_list_remove((int *)help_prev_page_anim); return; } void __stdcall help_key_handler(void) { char cVar1; cVar1 = pump_messages_and_get_key_(); if ((cVar1 != VK_RETURN) && (((cVar1 == '\x1b' || (cVar1 == '%')) || (cVar1 == '\'')))) { help_pressed_key = (short)cVar1; return; } help_pressed_key = 0; return; } void __stdcall help_press_esc(void) { help_pressed_key = VK_ESCAPE; return; } void __stdcall help_on_load(void) { undefined4 uVar1; int iVar2; undefined4 *puVar3; undefined4 *puVar4; short sVar5; short local_a; char *local_8; anim_state_xxx_new_list(); mouse_region_stash_lists(); DWORD_00450614 = get_time_ms(); disable_menus(0xff,0xffff,0); key_xxxxx_inc(); pause_all_sounds(); save_unset_custom_cursor(); DAT_00448080 = 1; mouse_region_new_up_whole_screen(0x422f92); mouse_region_new_up(0x1e,0x1b,0x1c4,0x136,5,0); key_xxxxx_set(help_key_handler); local_8 = (char *)load_resource_item_0(help_idx + 9000,(int *)&help); uVar1 = read_word_and_inc((int *)&local_8); help_num_entries = (short)uVar1; help_hdr_string = local_8; iVar2 = strlen(local_8); local_8 = local_8 + iVar2 + 1; help_linked_list = (int *)alloc_linked_list_marker(); for (local_a = 0; local_a < help_num_entries; local_a = local_a + 1) { puVar4 = (undefined4 *)alloc_tracked_heap_block(0x1e); uVar1 = read_word_and_inc((int *)&local_8); *(short *)(puVar4 + 2) = (short)uVar1; for (sVar5 = 0; sVar5 < *(short *)(puVar4 + 2); sVar5 = sVar5 + 1) { uVar1 = read_word_and_inc((int *)&local_8); *(short *)((int)puVar4 + sVar5 * 2 + 0x12) = (short)uVar1; uVar1 = read_word_and_inc((int *)&local_8); *(short *)((int)puVar4 + sVar5 * 2 + 0x16) = (short)uVar1; uVar1 = read_word_and_inc((int *)&local_8); puVar3 = load_aseq((short)uVar1); *(undefined4 **)((int)puVar4 + sVar5 * 4 + 10) = puVar3; *(undefined2 *)(*(int *)((int)puVar4 + sVar5 * 4 + 10) + 0x4e) = 3; } linked_list_insert(help_linked_list,puVar4,0xffff); } for (puVar4 = (undefined4 *)deref_next_if_not_null(help_linked_list); puVar4 != (undefined4 *)0x0; puVar4 = (undefined4 *)deref_next(puVar4)) { *(char **)((int)puVar4 + 0x1a) = local_8; iVar2 = strlen(local_8); local_8 = local_8 + iVar2 + 1; } help_cur_page = (help_page_struct *)deref_next_if_not_null(help_linked_list); help_next_page_anim = (aseq_anim_state_struct *)load_aseq(9005); help_prev_page_anim = (aseq_anim_state_struct *)load_aseq(9006); help_done_anim = (aseq_anim_state_struct *)load_aseq(9007); help_done_anim->removal_related = 3; help_prev_page_anim->removal_related = 3; help_next_page_anim->removal_related = 3; help_draw_page((undefined4 *)help_cur_page); DAT_00450608._0_2_ = 0; return; } void __stdcall help_on_remove(void) { int *piVar1; short sVar2; short sVar3; DAT_00448080 = 0; anim_engine_test_drawn_imgs_intersects_xxx((short *)&dialog_related_rect_xxx); help_next_page_anim = (aseq_anim_state_struct *)free_aseq((int *)help_next_page_anim); help_prev_page_anim = (aseq_anim_state_struct *)free_aseq((int *)help_prev_page_anim); help_done_anim = (aseq_anim_state_struct *)free_aseq((int *)help_done_anim); for (sVar3 = 0; sVar3 < help_num_entries; sVar3 = sVar3 + 1) { piVar1 = (int *)deref_next_if_not_null(help_linked_list); for (sVar2 = 0; sVar2 < (short)piVar1[2]; sVar2 = sVar2 + 1) { free_aseq(*(int **)((int)piVar1 + sVar2 * 4 + 10)); } linked_list_unlink(help_linked_list,piVar1); free_tracked_heap_block((int)piVar1); } free_tracked_heap_block_((int)help_linked_list); free_resource_item_with_idx_fourcc(help_idx + 9000,(undefined1 *)&help); key_xxxxx_pop(); anim_state_xxx_restore_list(); mouse_region_unstash_list(); restore_enable_menus(0xff,0xffff,0); restore_cursor_override_regions(); unpause_all_sounds(0); FUN_0043d7ce(); return; } void __stdcall help_on_periodic(void) { short sVar1; if (help_nextprev_thing != 0) { sVar1 = aseq_anim_get_flags((int)help_left_button_anim); if (sVar1 == 4) { return; } sVar1 = aseq_anim_get_flags((int)help_right_button_anim); if (sVar1 == 4) { return; } help_pressed_key = help_nextprev_thing; help_nextprev_thing = 0; } if (help_pressed_key == 1) { help_clean_up_page((int)help_cur_page); help_cur_page = (help_page_struct *)deref_next((undefined4 *)help_cur_page); help_draw_page((undefined4 *)help_cur_page); } else if (help_pressed_key == 2) { help_clean_up_page((int)help_cur_page); help_cur_page = (help_page_struct *)deref_prev((int)help_cur_page); help_draw_page((undefined4 *)help_cur_page); } else if ((help_pressed_key != 0xd) && (help_pressed_key == 0x1b)) { help_clean_up_page((int)help_cur_page); xxxfunc_remove(); } help_pressed_key = 0; return; } void __stdcall jigsaw_puzzle_on_load(void) { DAT_0045077c = 0; wave_load_list[0] = 0x1f73; wave_load_list[1] = 0x1f74; wave_load_list[2] = 0x1f5b; wave_load_list[3] = 0x1fa7; wave_load_list[4] = 0x1f5c; wave_load_list[5] = 0x4a77; wave_load_list[6] = -1; load_waves_from_list(0x451486); load_and_draw_score(); FUN_0043d7c1(FUN_00424da0); load_rrgb_1(11000); DAT_0045076c = load_aseq(11000); aseq_draw_to_both_fbs((int)DAT_0045076c,0,0,0); free_aseq(DAT_0045076c); jigsaw_load_stuff(); FUN_00430e33(DAT_0044a73a); jigsaw_make_mouse_regions(); FUN_00423d35(); key_xxxxx_set(FUN_004238b1); DAT_00450774 = load_aseq(0x3aa1); aseq_set_pos_order((int)DAT_00450774,0x18e,0x143,10); DAT_00450764 = load_aseq(0x2b75); DAT_00450778 = load_aseq(0x3a9d); aseq_set_pos_order((int)DAT_00450778,0x2a,0x19,1); DAT_00450760 = load_aseq(0x2b74); DAT_00450768 = aseq_setup_as_cursor((int)DAT_00450760,0,0); *(undefined2 *)(DAT_00450768 + 0x12) = 0; FUN_00424e09(1); on_deactivate_xtra_cb = FUN_00424e82; FUN_00422170(); return; } void __stdcall FUN_004234d8(void) { DAT_0045075a = 15000; load_nfnt(15000); gfxish_copy_otherbuf_to_dest_and_invalidate(10,200,0x96,0x14); sprintf(s__00450728); FUN_0043dc0b(DAT_0045075a,(byte *)s__00450728,10,0xd2,0); gfxish_invalidate_rect_wrap(10,0xd2,0x96,0x14); free_nfnt(DAT_0045075a); return; } void __stdcall jigsaw_puzzle_on_remove(void) { if (DAT_004514b0 != 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; } on_deactivate_xtra_cb = (undefined *)0x0; free_tracked_heap_block(DAT_0045075c); set_cursor_override_regions(0,0); free_aseq(DAT_00450760); aseq_free_cursor(DAT_00450768); FUN_00431029(); FUN_00430ef4(0x451486); DAT_004514ae = DAT_0044a73a; FUN_0043d7c1(0); mouse_region_delete_all_lists(); FUN_00423734(); key_xxxxx_clear(); free_resource_item_with_idx_fourcc(DAT_004514c2,(undefined1 *)&text); FUN_0042211c(); return; } void __stdcall jigsaw_puzzle_on_periodic(void) { short sVar1; new_player_hint(0xf); if (DAT_0045077c == 0) { DAT_0045077c = 1; DAT_004514b0 = DAT_004514c4; load_wave_flag_2(DAT_004514c4); play_wave_flag2(DAT_004514b0); } if (DAT_0045077e != 0) { DAT_0045077e = 0; jigsaw_make_mouse_regions(); FUN_00423d35(); } if (jigsaw_state == 1) { sVar1 = wave_is_playing_(DAT_004514b0); if (sVar1 == 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; jigsaw_state = 0; return; } } else { if (jigsaw_state != 2) { if (jigsaw_state != 3) { return; } get_mouse_xy_relative_ ((short *)(jigsaw_pieces + selected_jigsaw_piece), &jigsaw_pieces[selected_jigsaw_piece].rect.y); return; } xxxfunc_set(&puzzle_choosing_funcset_xxx); } return; } void __stdcall FUN_004236ef(void) { if (jigsaw_state != 1) { play_wave_flag1(0x1f5c,5,0); aseq_anim_reset_and_play(DAT_00450774); xxx_periodic_loop(); xxxfunc_set(&puzzle_choosing_funcset_xxx); jigsaw_state = 2; } return; } void __stdcall FUN_00423734(void) { short sVar1; for (sVar1 = 0; sVar1 < jigsaw_num_pieces; sVar1 = sVar1 + 1) { free_aseq((int *)jigsaw_pieces[sVar1].anim_state); } free_aseq(DAT_00450770); free_aseq(DAT_00450778); free_aseq(DAT_00450774); free_aseq(DAT_00450764); return; } void __stdcall FUN_0042378c(void) { uint uVar1; char *pcVar2; short sVar3; char *apcStackY_20400 [32762]; char *local_400 [5]; char local_3ec [1000]; play_wave_flag1(0x1f5c,5,0); anim_state_xxx_list_insert_4(DAT_00450778); xxx_periodic_loop(); anim_state_xxx_list_remove(DAT_00450778); xxx_periodic_loop(); memset((undefined4 *)local_3ec,0,1000); local_400[0] = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[0],(int *)&text); uVar1 = strlen(local_400[0]); FUN_00440d70((undefined4 *)local_3ec,local_400[0],uVar1); for (sVar3 = 1; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { pcVar2 = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[sVar3],(int *)&text); local_400[sVar3] = pcVar2; uVar1 = strlen(local_400[sVar3]); FUN_00440ce0(local_3ec,local_400[sVar3],uVar1); } FUN_004301cf(local_3ec); for (sVar3 = 0; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { free_resource_item_with_idx_fourcc(SHORT_ARRAY_004514ec[sVar3],(undefined1 *)&text); } return; } void __stdcall FUN_004238b1(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if (sVar1 == 0xd) { if (DAT_0044a73a != 0) { jigsaw_state = 2; } DAT_004514f6 = 1; } return; } void __stdcall jigsaw_make_mouse_regions(void) { mouse_region *pmVar1; short sVar2; mouse_region_delete_all_lists(); mouse_region_new_up(0x29,0x19,0x3a,0x1c,5,0x42378c); mouse_region_new_up(0x18e,0x144,100,0x32,5,0x4236ef); mouse_region_new_up(0,0,0x200,0x180,0,0x423a29); PTR_00450724 = (mouse_region *)mouse_region_new_up(10,0x9e,0x7f,0x76,5,0x423b30); PTR_00450724->extra_data = 0; for (sVar2 = 0; sVar2 < jigsaw_num_pieces; sVar2 = sVar2 + 1) { if (jigsaw_pieces[sVar2].unk1 == 1) { pmVar1 = (mouse_region *) mouse_region_new_up(jigsaw_pieces[sVar2].rect.x,jigsaw_pieces[sVar2].rect.y, jigsaw_pieces[sVar2].rect.w,jigsaw_pieces[sVar2].rect.h, jigsaw_pieces[sVar2].prio,0x423b30); PTR_ARRAY_004506fc[sVar2] = pmVar1; PTR_ARRAY_004506fc[sVar2]->extra_data = (int)sVar2 + 1000; } } if (DAT_0044a73a != 0) { mouse_region_new_up(10,0x140,0x14e,0x3c,0x19,0x423a16); } return; } void __stdcall FUN_00423a16(void) { DAT_004514f6 = 1; jigsaw_state = 2; return; } void __stdcall FUN_00423a29(void) { undefined4 uVar1; if (jigsaw_state != 0) { if (jigsaw_state != 3) { return; } FUN_00424814(); if (DAT_0044a73a == 0) { uVar1 = FUN_00424ad0(); DAT_0044a73a = (short)uVar1; if ((DAT_0044a73a != 0) && (DAT_0044a73c == 0)) { DAT_0044a73c = 1; solved_the_puzzle(0x4a77); inc_score_by_400(); jigsaw_make_mouse_regions(); } } } return; } void __stdcall jigsaw_load_stuff(void) { short sVar1; sVar1 = 0; do { jigsaw_pieces[sVar1].unk1 = 0; jigsaw_pieces[sVar1].xxx = 0; jigsaw_pieces[sVar1].yyy = 0; jigsaw_pieces[sVar1].prio = 0; sVar1 = sVar1 + 1; } while (sVar1 < 10); DAT_0044a73a = 0; DAT_0044a73c = 0; jigsaw_state = 0; selected_jigsaw_piece = 0xb; jigsaw_load_puzzle(puzzle_idx); DAT_004514c2 = 11000; DAT_004514c4 = 11000; DAT_004514b4 = load_resource_item_0(11000,(int *)&text); return; } int __cdecl jigsaw_mouse_handler(int param_1) { int iVar1; undefined4 *puVar2; int iVar3; if (jigsaw_state == 0) { iVar1 = *(int *)(param_1 + 0x1e); if (iVar1 == 0) { iVar1 = FUN_00423c67(); return iVar1; } iVar3 = iVar1 + -0x3f2; if (iVar1 - 1000U < 10) { clear_cursor_override_regions(); play_wave_flag1(0x1f73,5,0); anim_state_xxx_list_remove(DAT_00450770); jigsaw_redraw_xxx(); selected_jigsaw_piece = *(short *)(param_1 + 0x1e) + -1000; anim_state_xxx_list_remove((int *)jigsaw_pieces[selected_jigsaw_piece].anim_state); jigsaw_state = 3; xxx_periodic_loop(); puVar2 = (undefined4 *) aseq_setup_as_cursor((int)jigsaw_pieces[selected_jigsaw_piece].anim_state,0,0); set_custom_cursor(puVar2); iVar1 = clip_cursor_enable(0x95,0x1a,0x15e,0x111); return iVar1; } } else { iVar1 = jigsaw_state + -3; if (iVar1 != 0) { return iVar1; } if (9 < *(int *)(param_1 + 0x1e) - 1000U) { return *(int *)(param_1 + 0x1e) + -0x3f2; } iVar3 = FUN_00424814(); if (DAT_0044a73a == 0) { iVar3 = FUN_00424ad0(); DAT_0044a73a = (short)iVar3; if ((DAT_0044a73a != 0) && (DAT_0044a73c == 0)) { DAT_0044a73c = 1; solved_the_puzzle(0x4a77); inc_score_by_400(); iVar3 = jigsaw_make_mouse_regions(); } } } return iVar3; } void __stdcall FUN_00423c67(void) { uint uVar1; undefined4 *puVar2; if ((selected_jigsaw_piece == 0xb) && (0 < DAT_0044a738)) { clear_cursor_override_regions(); FUN_00424ed3(); DAT_0044a738 = DAT_0044a738 + -1; do { if (jigsaw_num_pieces == 0) { selected_jigsaw_piece = 0; } else { uVar1 = rand(); selected_jigsaw_piece = (short)((int)uVar1 % (int)jigsaw_num_pieces); } } while (jigsaw_pieces[selected_jigsaw_piece].unk1 == 1); jigsaw_state = 3; FUN_00424f23(); FUN_00423d35(); puVar2 = (undefined4 *) aseq_setup_as_cursor((int)jigsaw_pieces[selected_jigsaw_piece].anim_state,0,0); set_custom_cursor(puVar2); clip_cursor_enable(0x95,0x1a,0x15e,0x111); play_wave_flag1(0x1f73,5,0); } return; } void __stdcall FUN_00423d35(void) { byte local_10 [12]; load_nfnt(15000); gfxish_copy_otherbuf_to_dest_and_invalidate(0x3c,0xf5,0x1a,0x1a); if (0 < DAT_0044a738) { sprintf(local_10); FUN_0043dc0b(15000,local_10,0x41,0x104,0); } gfxish_invalidate_rect_wrap(0x3c,0xf5,0x1a,0x1a); free_nfnt(15000); return; } void __cdecl jigsaw_load_puzzle(short param_1) { aseq_anim_state_struct *paVar1; undefined4 uVar2; word wVar3; short unaff_DI; short asStackY_10040 [10]; short asStackY_1002c [10]; short asStackY_10018 [32738]; short local_40 [10]; short local_2c [10]; short local_18 [10]; if (0x14 < param_1) { param_1 = 1; } switch(param_1) { case 1: unaff_DI = 0x2b03; jigsaw_num_pieces = 2; local_2c[0] = 0; local_2c[1] = 4; local_40[0] = 0; local_40[1] = 0x2c; local_18[0] = 1; local_18[1] = 2; break; case 2: unaff_DI = 0x2b3f; jigsaw_num_pieces = 4; local_2c[0] = 0x2f; local_2c[1] = 0; local_2c[2] = 0xb5; local_2c[3] = 0xf; local_40[0] = 2; local_40[1] = 1; local_40[2] = 0; local_40[3] = 0x59; local_18[0] = 2; local_18[1] = 3; local_18[2] = 3; local_18[3] = 1; break; case 3: unaff_DI = 0x2b34; jigsaw_num_pieces = 3; local_2c[0] = 0x10; local_40[0] = 0xb; local_18[0] = 1; local_2c[1] = 0; local_40[1] = 0; local_18[1] = 2; local_2c[2] = 0x10; local_40[2] = 0xc1; local_18[2] = 3; break; case 4: unaff_DI = 0x2b4a; jigsaw_num_pieces = 4; local_2c[0] = 7; local_2c[1] = 0; local_2c[2] = 0x45; local_2c[3] = 0xb9; local_40[0] = 0x45; local_40[1] = 0x16; local_40[2] = 0x49; local_40[3] = 0; local_18[0] = 3; local_18[1] = 2; local_18[2] = 1; local_18[3] = 3; break; case 5: unaff_DI = 0x2b2e; jigsaw_num_pieces = 4; local_2c[0] = 0x4e; local_2c[1] = 0x41; local_2c[2] = 0; local_2c[3] = 0x5c; local_40[0] = 0x52; local_40[1] = 0x8e; local_40[2] = 0; local_40[3] = 0x47; local_18[0] = 3; local_18[1] = 3; local_18[2] = 1; local_18[3] = 2; break; case 6: unaff_DI = 0x2b57; jigsaw_num_pieces = 5; local_2c[0] = 0x51; local_2c[1] = 0; local_2c[2] = 0x31; local_2c[3] = 0x30; local_2c[4] = 0x55; local_40[0] = 0x18; local_40[1] = 0x24; local_40[2] = 0x20; local_40[3] = 1; local_40[4] = 0; local_18[0] = 5; local_18[1] = 1; local_18[2] = 2; local_18[3] = 3; local_18[4] = 1; break; case 7: unaff_DI = 0x2b1b; jigsaw_num_pieces = 3; local_2c[0] = 0; local_2c[1] = 0x55; local_2c[2] = 0x3a; local_40[0] = 0x41; local_40[1] = 0xd; local_40[2] = 0; local_18[0] = 1; local_18[1] = 3; local_18[2] = 2; break; case 8: unaff_DI = 0x2b69; jigsaw_num_pieces = 3; local_2c[0] = 0; local_2c[1] = 0xd; local_2c[2] = 0x2e; local_40[0] = 0; local_40[1] = 0x1e; local_40[2] = 0x17; local_18[0] = 3; local_18[1] = 2; local_18[2] = 1; break; case 9: unaff_DI = 0x2b63; jigsaw_num_pieces = 4; local_2c[0] = 0x96; local_2c[1] = 0; local_2c[2] = 0x49; local_2c[3] = 0x5e; local_40[0] = 0x3a; local_40[1] = 0; local_40[2] = 0x15; local_40[3] = 0x40; local_18[0] = 1; local_18[1] = 2; local_18[2] = 3; local_18[3] = 4; break; case 10: unaff_DI = 0x2b0e; jigsaw_num_pieces = 4; local_2c[0] = 0; local_2c[1] = 0; local_2c[2] = 0x3d; local_2c[3] = 0xb0; local_40[0] = 0x7b; local_40[1] = 0x86; local_40[2] = 0; local_40[3] = 0xa8; local_18[0] = 3; local_18[1] = 1; local_18[2] = 4; local_18[3] = 2; break; case 0xb: unaff_DI = 0x2b16; jigsaw_num_pieces = 3; local_2c[0] = 0; local_2c[1] = 0xf9; local_2c[2] = 0xc; local_40[0] = 0; local_40[1] = 0xe; local_40[2] = 0x53; local_18[0] = 2; local_18[1] = 1; local_18[2] = 3; break; case 0xc: unaff_DI = 0x2b45; jigsaw_num_pieces = 3; local_2c[0] = 0x8c; local_2c[1] = 0; local_2c[2] = 1; local_40[0] = 0x49; local_40[1] = 0; local_40[2] = 0x30; local_18[0] = 3; local_18[1] = 1; local_18[2] = 2; break; case 0xd: unaff_DI = 0x2afc; jigsaw_num_pieces = 5; local_2c[0] = 0; local_2c[1] = 4; local_2c[2] = 0x29; local_2c[3] = 0x85; local_2c[4] = 0x12; local_40[0] = 0x35; local_40[1] = 0x19; local_40[2] = 0x38; local_40[3] = 0; local_40[4] = 0xe; local_18[0] = 3; local_18[1] = 4; local_18[2] = 2; local_18[3] = 5; local_18[4] = 6; break; case 0xe: unaff_DI = 0x2b39; jigsaw_num_pieces = 4; local_2c[0] = 0; local_2c[1] = 0x14; local_2c[2] = 0x14; local_2c[3] = 0x15; local_40[0] = 0x8c; local_40[1] = 0; local_40[2] = 0x49; local_40[3] = 0xd; local_18[0] = 3; local_18[1] = 2; local_18[2] = 2; local_18[3] = 1; break; case 0xf: unaff_DI = 0x2b20; jigsaw_num_pieces = 5; local_2c[0] = 0xed; local_2c[1] = 0xef; local_2c[2] = 0; local_2c[3] = 0; local_2c[4] = 0x15; local_40[0] = 0x91; local_40[1] = 0x71; local_40[2] = 0; local_40[3] = 6; local_40[4] = 0x3f; local_18[0] = 5; local_18[1] = 3; local_18[2] = 1; local_18[3] = 1; local_18[4] = 4; break; case 0x10: unaff_DI = 0x2b50; jigsaw_num_pieces = 5; local_2c[0] = 0xde; local_2c[1] = 0xb; local_2c[2] = 0; local_2c[3] = 0xce; local_2c[4] = 0x5a; local_40[0] = 0x34; local_40[1] = 0x49; local_40[2] = 0x5b; local_40[3] = 0xa1; local_40[4] = 0; local_18[0] = 1; local_18[1] = 2; local_18[2] = 3; local_18[3] = 4; local_18[4] = 1; break; case 0x11: unaff_DI = 0x2b07; local_2c[0] = 0x51; local_2c[1] = 0x9b; local_2c[2] = 0xe8; local_2c[3] = 4; local_2c[4] = 0; local_40[0] = 0x14; local_40[1] = 0; local_40[2] = 0x18; local_40[3] = 0x1a; local_40[4] = 0x7d; local_18[0] = 2; local_18[1] = 1; local_18[2] = 3; local_18[3] = 4; local_18[4] = 1; jigsaw_num_pieces = 5; break; case 0x12: unaff_DI = 0x2b5e; jigsaw_num_pieces = 3; local_2c[0] = 0x103; local_2c[1] = 0; local_2c[2] = 7; local_40[0] = 0x19; local_40[1] = 0; local_40[2] = 0x21; local_18[0] = 3; local_18[1] = 2; local_18[2] = 1; break; case 0x13: unaff_DI = 0x2b6e; jigsaw_num_pieces = 4; local_2c[0] = 10; local_2c[1] = 0; local_2c[2] = 4; local_2c[3] = 0x18; local_40[0] = 0x19; local_40[1] = 6; local_40[2] = 0x35; local_40[3] = 0; local_18[0] = 1; local_18[1] = 3; local_18[2] = 2; local_18[3] = 3; break; case 0x14: unaff_DI = 0x2b27; jigsaw_num_pieces = 5; local_2c[0] = 0; local_2c[1] = 0x58; local_2c[2] = 0x58; local_2c[3] = 0x58; local_2c[4] = 0x42; local_40[0] = 0x5b; local_40[1] = 0x5c; local_40[2] = 0x3a; local_40[3] = 0x11; local_40[4] = 0; local_18[0] = 2; local_18[1] = 2; local_18[2] = 3; local_18[3] = 4; local_18[4] = 1; } DAT_004514be = 5; DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x2b0d; SHORT_ARRAY_004514ec[1] = puzzle_idx + 11000; SHORT_ARRAY_004514ec[2] = 0x2b0e; SHORT_ARRAY_004514ce[0] = 0x2b0d; SHORT_ARRAY_004514ce[1] = puzzle_idx + 11000; SHORT_ARRAY_004514ce[2] = 0x2b0e; SHORT_ARRAY_004514ce[3] = 0x2b0f; SHORT_ARRAY_004514ce[4] = 0x2b10; SHORT_ARRAY_004514ce[5] = -1; for (wVar3 = 0; (short)wVar3 < jigsaw_num_pieces; wVar3 = wVar3 + 1) { jigsaw_pieces[(short)wVar3].xxx = local_2c[(short)wVar3]; jigsaw_pieces[(short)wVar3].yyy = local_40[(short)wVar3]; jigsaw_pieces[(short)wVar3].prio = local_18[(short)wVar3]; paVar1 = (aseq_anim_state_struct *)load_aseq(wVar3 + unaff_DI); jigsaw_pieces[(short)wVar3].anim_state = paVar1; uVar2 = aseq_get_img_w((int)jigsaw_pieces[(short)wVar3].anim_state,0); jigsaw_pieces[(short)wVar3].rect.w = (word)uVar2; uVar2 = aseq_get_img_h((int)jigsaw_pieces[(short)wVar3].anim_state,0); jigsaw_pieces[(short)wVar3].rect.h = (word)uVar2; jigsaw_pieces[(short)wVar3].idx = wVar3; } DAT_0044a738 = jigsaw_num_pieces; DAT_00450770 = load_aseq(unaff_DI + jigsaw_num_pieces + 1); return; } void __cdecl FUN_00424646(short param_1,short param_2) { word *pwVar1; short sVar2; short sVar3; short sVar4; short sVar5; short sVar6; short local_6; for (sVar6 = 0; sVar6 < jigsaw_num_pieces; sVar6 = sVar6 + 1) { if (jigsaw_pieces[sVar6].idx == DAT_0045061a) { sVar2 = jigsaw_pieces[sVar6].xxx + param_1; sVar5 = jigsaw_pieces[sVar6].yyy + param_2; sVar3 = jigsaw_pieces[sVar6].rect.w + sVar2; sVar4 = jigsaw_pieces[sVar6].rect.h + sVar5; if (sVar2 < 0x95) { param_1 = param_1 + (0x95 - sVar2); } else if (499 < sVar3) { param_1 = param_1 - (sVar3 + -499); } if (sVar5 < 0x1a) { param_2 = param_2 + (0x1a - sVar5); } else if (299 < sVar4) { param_2 = param_2 - (sVar4 + -299); } } } for (sVar6 = 0; sVar6 < jigsaw_num_pieces; sVar6 = sVar6 + 1) { if (jigsaw_pieces[sVar6].idx == DAT_0045061a) { sVar2 = (short)((((int)param_1 + (int)jigsaw_pieces[sVar6].xxx) - (int)(short)jigsaw_pieces[sVar6].rect.x) / 5); sVar3 = (short)((((int)param_2 + (int)jigsaw_pieces[sVar6].yyy) - (int)(short)jigsaw_pieces[sVar6].rect.y) / 5); if ((sVar2 != 0) || (sVar3 != 0)) { local_6 = 0; do { jigsaw_pieces[sVar6].rect.x = jigsaw_pieces[sVar6].rect.x + sVar2; pwVar1 = &jigsaw_pieces[sVar6].rect.y; *pwVar1 = *pwVar1 + sVar3; jigsaw_redraw_xxx(); xxx_periodic_loop(); local_6 = local_6 + 1; } while (local_6 < 5); } jigsaw_pieces[sVar6].rect.x = jigsaw_pieces[sVar6].xxx + param_1; jigsaw_pieces[sVar6].rect.y = jigsaw_pieces[sVar6].yyy + param_2; jigsaw_redraw_xxx(); } } return; } void __stdcall FUN_00424814(void) { short sVar1; short sVar2; short sVar3; short sVar4; short local_6; jigsaw_state = 0; if (selected_jigsaw_piece != 11) { free_cur_cursor(); DAT_0045061a = jigsaw_pieces[selected_jigsaw_piece].idx; if ((((0x94 < (short)jigsaw_pieces[selected_jigsaw_piece].rect.x) && (0x19 < (short)jigsaw_pieces[selected_jigsaw_piece].rect.y)) && ((int)(short)jigsaw_pieces[selected_jigsaw_piece].rect.x + (int)(short)jigsaw_pieces[selected_jigsaw_piece].rect.w < 500)) && ((int)(short)jigsaw_pieces[selected_jigsaw_piece].rect.y + (int)(short)jigsaw_pieces[selected_jigsaw_piece].rect.h < 300)) { sVar1 = jigsaw_pieces[selected_jigsaw_piece].rect.x - jigsaw_pieces[selected_jigsaw_piece].xxx ; sVar2 = jigsaw_pieces[selected_jigsaw_piece].rect.y - jigsaw_pieces[selected_jigsaw_piece].yyy ; local_6 = sVar2; sVar4 = sVar1; for (sVar3 = 0; sVar3 < jigsaw_num_pieces; sVar3 = sVar3 + 1) { if ((sVar3 != selected_jigsaw_piece) && (jigsaw_pieces[sVar3].unk1 == 1)) { sVar4 = jigsaw_pieces[sVar3].rect.x - jigsaw_pieces[sVar3].xxx; local_6 = jigsaw_pieces[sVar3].rect.y - jigsaw_pieces[sVar3].yyy; if ((((int)sVar1 < sVar4 + 0x14) && ((sVar4 + -0x14 < (int)sVar1 && ((int)sVar2 < local_6 + 0x14)))) && (local_6 + -0x14 < (int)sVar2)) { jigsaw_pieces[selected_jigsaw_piece].rect.x = jigsaw_pieces[selected_jigsaw_piece].xxx + sVar4; jigsaw_pieces[selected_jigsaw_piece].rect.y = jigsaw_pieces[selected_jigsaw_piece].yyy + local_6; FUN_00424bca(sVar3); break; } sVar4 = jigsaw_pieces[selected_jigsaw_piece].rect.x - jigsaw_pieces[selected_jigsaw_piece].xxx; local_6 = jigsaw_pieces[selected_jigsaw_piece].rect.y - jigsaw_pieces[selected_jigsaw_piece].yyy; } } FUN_00424646(sVar4,local_6); play_wave_flag1(0x1f74,5,0); jigsaw_redraw_xxx(); jigsaw_pieces[selected_jigsaw_piece].unk1 = 1; anim_state_xxx_list_insert_8004((undefined4 *)jigsaw_pieces[selected_jigsaw_piece].anim_state) ; aseq_set_pos_order((int)jigsaw_pieces[selected_jigsaw_piece].anim_state, jigsaw_pieces[selected_jigsaw_piece].rect.x, jigsaw_pieces[selected_jigsaw_piece].rect.y, jigsaw_pieces[selected_jigsaw_piece].prio); selected_jigsaw_piece = 0xb; gfxish_copy_otherbuf_to_dest_and_invalidate(0x95,0x1a,0x15e,0x111); gfxish_invalidate_rect_wrap(0x95,0x1a,0x15e,0x111); xxx_periodic_loop(); FUN_00424e75(); jigsaw_make_mouse_regions(); } } return; } undefined4 __stdcall FUN_00424ad0(void) { undefined4 uVar1; undefined2 extraout_var; short sVar2; if (jigsaw_pieces[0].unk1 == 1) { for (sVar2 = 1; sVar2 < jigsaw_num_pieces; sVar2 = sVar2 + 1) { if (jigsaw_pieces[sVar2].unk1 != 1) { return 0; } if ((int)(short)jigsaw_pieces[sVar2].rect.x - (int)jigsaw_pieces[sVar2].xxx != (int)(short)(jigsaw_pieces[0].rect.x - jigsaw_pieces[0].xxx)) { return 0; } if ((int)(short)jigsaw_pieces[sVar2].rect.y - (int)jigsaw_pieces[sVar2].yyy != (int)(short)(jigsaw_pieces[0].rect.y - jigsaw_pieces[0].yyy)) { return 0; } } for (sVar2 = 0; sVar2 < jigsaw_num_pieces; sVar2 = sVar2 + 1) { anim_state_xxx_list_remove((int *)jigsaw_pieces[sVar2].anim_state); } play_wave_flag1(0x1f5b,5,0); anim_state_xxx_list_insert_8004(DAT_00450770); aseq_set_pos_order((int)DAT_00450770,jigsaw_pieces[0].rect.x - jigsaw_pieces[0].xxx, jigsaw_pieces[0].rect.y - jigsaw_pieces[0].yyy,0x32); uVar1 = CONCAT22(extraout_var,1); } else { uVar1 = 0; } return uVar1; } void __cdecl FUN_00424bca(short param_1) { short sVar1; word in_DX; if ((short)jigsaw_pieces[selected_jigsaw_piece].idx < (short)jigsaw_pieces[param_1].idx) { DAT_0045061a = jigsaw_pieces[selected_jigsaw_piece].idx; in_DX = jigsaw_pieces[param_1].idx; } else if ((short)jigsaw_pieces[param_1].idx < (short)jigsaw_pieces[selected_jigsaw_piece].idx) { in_DX = jigsaw_pieces[selected_jigsaw_piece].idx; DAT_0045061a = jigsaw_pieces[param_1].idx; } for (sVar1 = 0; sVar1 < jigsaw_num_pieces; sVar1 = sVar1 + 1) { if (in_DX == jigsaw_pieces[sVar1].idx) { jigsaw_pieces[sVar1].idx = DAT_0045061a; } } return; } void __stdcall jigsaw_redraw_xxx(void) { short sVar1; for (sVar1 = 0; sVar1 < jigsaw_num_pieces; sVar1 = sVar1 + 1) { if ((((jigsaw_pieces[sVar1].unk1 == 1) && (0x94 < (short)jigsaw_pieces[sVar1].rect.x)) && ((int)(short)jigsaw_pieces[sVar1].rect.x + (int)(short)jigsaw_pieces[sVar1].rect.w < 500)) && ((0x19 < (short)jigsaw_pieces[sVar1].rect.y && ((int)(short)jigsaw_pieces[sVar1].rect.y + (int)(short)jigsaw_pieces[sVar1].rect.h < 300) ))) { anim_state_xxx_list_remove((int *)jigsaw_pieces[sVar1].anim_state); aseq_set_pos_order((int)jigsaw_pieces[sVar1].anim_state,jigsaw_pieces[sVar1].rect.x, jigsaw_pieces[sVar1].rect.y,jigsaw_pieces[sVar1].prio); anim_state_xxx_list_insert_8004((undefined4 *)jigsaw_pieces[sVar1].anim_state); } } gfxish_copy_otherbuf_to_dest_and_invalidate(0x95,0x1a,0x15e,0x111); gfxish_invalidate_rect_wrap(0x95,0x1a,0x15e,0x111); return; } void __stdcall FUN_00424da0(void) { if (jigsaw_state == 3) { free_cur_cursor(); jigsaw_pieces[selected_jigsaw_piece].unk1 = 0; DAT_0044a738 = DAT_0044a738 + 1; FUN_00424e75(); selected_jigsaw_piece = 0xb; } jigsaw_state = 0; jigsaw_make_mouse_regions(); FUN_00424df2(); return; } void __stdcall FUN_00424df2(void) { FUN_00430e33(DAT_0044a73a); FUN_00423d35(); return; } void __cdecl FUN_00424e09(short param_1) { undefined2 *puVar1; if (param_1 == 0) { free_tracked_heap_block((int)DAT_0045075c); } puVar1 = (undefined2 *)alloc_tracked_heap_block(0x10); DAT_0045075c = puVar1; *puVar1 = 0; puVar1[1] = 5; puVar1[3] = 0x17a; puVar1[2] = 0x1ff; *(undefined4 *)(puVar1 + 6) = DAT_00450768; puVar1[5] = 0; set_cursor_override_regions((int)DAT_0045075c,1); return; } void __stdcall clear_cursor_override_regions(void) { set_cursor_override_regions(0,0); return; } void __stdcall FUN_00424e75(void) { FUN_00424e09(0); return; } void __stdcall FUN_00424e82(void) { DAT_0045077e = 1; if (jigsaw_state == 3) { free_cur_cursor(); jigsaw_pieces[selected_jigsaw_piece].unk1 = 0; DAT_0044a738 = DAT_0044a738 + 1; FUN_00424e75(); selected_jigsaw_piece = 0xb; } jigsaw_state = 0; return; } void __stdcall FUN_00424ed3(void) { anim_state_xxx_list_remove(DAT_00450764); aseq_anim_flags_make_2((int)DAT_00450764); aseq_select_anim((int)DAT_00450764,1); aseq_set_pos_order((int)DAT_00450764,0xe,0xb7,0x14); anim_state_xxx_list_insert_4(DAT_00450764); return; } void __stdcall FUN_00424f23(void) { anim_state_xxx_list_remove(DAT_00450764); aseq_anim_flags_make_2((int)DAT_00450764); aseq_set_pos_order((int)DAT_00450764,0xe,0xb7,0x14); aseq_select_anim((int)DAT_00450764,0); anim_state_xxx_list_insert_4(DAT_00450764); return; } uint __stdcall get_certain_keys_down(void) { uint uVar1; BYTE local_104 [17]; byte local_f3; byte local_e4; byte local_df; byte local_de; byte local_dd; byte local_dc; uVar1 = 0; GetKeyboardState(local_104); if ((local_f3 & 0x80) != 0) { uVar1 = 0x10; } if ((local_df & 0x80) != 0) { uVar1 = uVar1 | 1; } if ((local_dd & 0x80) != 0) { uVar1 = uVar1 | 2; } if ((local_de & 0x80) != 0) { uVar1 = uVar1 | 4; } if ((local_dc & 0x80) != 0) { uVar1 = uVar1 | 8; } if ((local_e4 & 0x80) != 0) { uVar1 = uVar1 | 0x20; } return uVar1; } uint __stdcall get_keys_and_coll_actor0(void) { uint uVar1; int iVar2; uint uVar3; uVar1 = get_certain_keys_down(); uVar3 = (uint)(short)uVar1; uVar1 = get_time_ms(); if (uVar3 == 0) { DAT_00448b02 = 0; iVar2 = time_get_secs_count(30); if ((iVar2 + last_key_time < uVar1) && (go_idle_flag == 0)) { uVar3 = 0x40; go_idle_flag = 1; } } else { if ((uVar3 & 0xffffffef) == 0) { DAT_004520e4 = 0; } else { DAT_004520e4 = 1; if (DAT_00448b02 != 0) { DAT_004520e4 = 0; } } go_idle_flag = 0; last_key_time = uVar1; } return uVar3 | (int)(short)actors[0].collision_flags << 0x10; } int __cdecl FUN_0042507c(int param_1) { short sVar1; int iVar2; short *psVar3; iVar2 = 0; psVar3 = *(short **)(param_1 + 4); while (sVar1 = *psVar3, psVar3 = psVar3 + 5, sVar1 != -1000) { iVar2 = iVar2 + 1; } return iVar2; } void __cdecl actor_go_to_state(short param_1,short param_2) { eseq_chunk *peVar1; int iVar2; iVar2 = (int)param_1; actors[iVar2].saved.prev_state = actors[iVar2].saved.cur_state; actors[iVar2].saved.cur_state = param_2; peVar1 = actors[iVar2].xxx_eseq_a_selected[param_2]; actors[iVar2].saved.eseq_step = 0; actors[iVar2].cmd_24_related_state = peVar1->aaa; actors[iVar2].xxx_obstacle_col_direction_related = peVar1->bbb; return; } short * __cdecl load_eseq(short param_1,int param_2,undefined4 *param_3,undefined4 *param_4) { short sVar1; short sVar2; short sVar3; short *psVar4; short *psVar5; psVar4 = (short *)load_resource_item_0(param_1,(int *)&eseq); sVar3 = *psVar4; psVar5 = psVar4 + 1; *param_3 = psVar5; psVar5 = psVar5 + sVar3; *param_4 = psVar5; sVar1 = psVar5[sVar3]; psVar5 = psVar5 + sVar3 + 1; sVar3 = 0; if (0 < sVar1) { do { *(short **)(param_2 + sVar3 * 4) = psVar5; sVar2 = psVar5[4]; *(short **)(*(int *)(param_2 + sVar3 * 4) + 4) = psVar5 + 5; psVar5 = psVar5 + 5 + sVar2 * 5; sVar3 = sVar3 + 1; } while (sVar3 < sVar1); } *(undefined4 *)(param_2 + sVar3 * 4) = 0; return psVar4; } void __cdecl actor_xxx_eseq_select(short param_1,short param_2) { int iVar1; eseq_chunk **ppeVar2; iVar1 = (int)param_1; if (param_2 == 1) { ppeVar2 = actors[iVar1].xxx_eseq_a_0; } else { ppeVar2 = actors[iVar1].xxx_eseq_a_1; } actors[iVar1].xxx_eseq_a_selected = ppeVar2; return; } void __stdcall aseq_4508_skip_draw_cb(void) { aseq_4508_skip_draw_happened = 1; return; } undefined2 __cdecl actor_process_eseq(short param_1) { word *pwVar1; ushort uVar2; int iVar3; int iVar4; short sVar5; short sVar6; word wVar7; int iVar8; uint uVar9; short *psVar10; int iVar11; undefined4 uVar12; word wVar13; actor_struct *paVar14; eseq_chunk_inner *peVar15; short local_14; word local_12; short local_10; word local_e; word local_8; undefined2 local_6; iVar8 = (int)param_1; paVar14 = actors + iVar8; local_6 = 0; uVar9 = area_screen_type_b0(actors[iVar8].saved.screen_idx); sVar5 = (short)uVar9; iVar3 = *(int *)(iVar8 * 0xa8 + 0x4507fa + sVar5 * 4); iVar4 = *(int *)(iVar8 * 0xa8 + 0x450802 + sVar5 * 4); peVar15 = actors[iVar8].xxx_eseq_a_selected[(short)actors[iVar8].saved.cur_state]->p; do { wVar7 = actors[iVar8].saved.eseq_step; if (-1 < peVar15[(short)wVar7].p.new_img_idx) { peVar15 = peVar15 + (short)wVar7; actors[iVar8].flip_and_xtra_disable = *(word *)((int)peVar15 + 6); wVar7 = *(word *)(iVar3 + (peVar15->p).new_img_idx * 2); actors[iVar8].rect.w = wVar7; local_e = *(word *)(iVar4 + (peVar15->p).new_img_idx * 2); actors[iVar8].rect.h = local_e; local_14 = actors[iVar8].saved.x; local_10 = *(short *)((int)peVar15 + 2); wVar13 = actors[iVar8].saved.x + local_10; (paVar14->rect).x = wVar13; actors[iVar8].saved.x = wVar13; local_12 = *(short *)((int)peVar15 + 4) + actors[iVar8].saved.y; actors[iVar8].rect.y = local_12; if (actors[iVar8].saved.process_thing2_en != 0) { if (actors[iVar8].saved.x < local_14) { local_10 = 1 - local_10; local_14 = actors[iVar8].saved.x; } else { local_10 = wVar7 + (actors[iVar8].saved.x - local_14); } uVar12 = actor_process_obstacle_related(param_1,&local_14,-1); if ((short)uVar12 == 0) { actors[iVar8].saved.process_thing2_result = 0; } else if ((short)uVar12 == 2) { if (actors[iVar8].xxx_obstacle_col_direction_related < 2) { wVar7 = actors[iVar8].xxx_obstacle_col_intermed_x + 1; (paVar14->rect).x = wVar7; actors[iVar8].saved.x = wVar7; actors[iVar8].saved.process_thing2_result = -1; } } else if (-2 < actors[iVar8].xxx_obstacle_col_direction_related) { wVar7 = (actors[iVar8].xxx_obstacle_col_intermed_x - actors[iVar8].rect.w) + 1; (paVar14->rect).x = wVar7; actors[iVar8].saved.x = wVar7; actors[iVar8].saved.process_thing2_result = 1; } } if (actors[iVar8].saved.x < 1) { (paVar14->rect).x = 1; actors[iVar8].saved.x = 1; } if (0x1ff < (int)(short)(paVar14->rect).x + (int)(short)actors[iVar8].rect.w) { wVar7 = 0x1ff - actors[iVar8].rect.w; actors[iVar8].saved.x = wVar7; (paVar14->rect).x = wVar7; } actors[iVar8].new_img_idx = (peVar15->p).new_img_idx; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; return local_6; } local_8 = *(word *)((int)peVar15 + (short)wVar7 * 10 + 2); uVar2 = *(ushort *)((int)peVar15 + (short)wVar7 * 10 + 4); switch(peVar15[(short)wVar7].p.new_img_idx) { case -0x2e: sVar6 = 510; if (sVar5 == 0) { sVar6 = 0x1fc; } actors[iVar8].saved.x = sVar6 - *(short *)(iVar3 + (short)local_8 * 2); pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x2b: if (local_8 == 0xffff) { sVar6 = 0x12; if (save_file_big->chimps_enabled != 0) { sVar6 = 8; } enqueue_new_player_hint(sVar6,5,0); } else { enqueue_new_player_hint(local_8,0,0); } pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x2a: if ((actors[iVar8].collision_flags & 1) == 0) { pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; } else { actors[iVar8].saved.eseq_step = local_8; } break; case -0x29: psVar10 = (short *)area_screen_thing0_0_idx (actors[iVar8].saved.screen_idx, actors[iVar8].saved.idx_of_hole_related); actors[iVar8].saved.x = *psVar10 + 4; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x28: psVar10 = (short *)area_screen_thing0_0_idx (actors[iVar8].saved.screen_idx, actors[iVar8].saved.idx_of_hole_related); actors[iVar8].saved.x = *psVar10 + *(short *)(iVar3 + (short)local_8 * 2) + -7; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x25: if (actors[iVar8].saved.screen_idx == loaded_screen_idx) { stop_playing_wave_by_id_type1(wave_ints_xxxxxxxxx[(short)local_8]); } pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x24: if ((actors[iVar8].saved.screen_idx == loaded_screen_idx) && (sVar6 = wave_is_playing_(wave_ints_xxxxxxxxx[(short)local_8]), sVar6 == 0)) { play_wave_flag1(wave_ints_xxxxxxxxx[(short)local_8],uVar2 & 0xff,(short)(char)(uVar2 >> 8)); } pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x21: actor_drop_part_in_world(param_1); pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x20: pwVar1 = &actors[iVar8].saved.eseq_loop_count; *pwVar1 = *pwVar1 - 1; if (actors[iVar8].saved.eseq_loop_count == 0) { pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; } else { actors[iVar8].saved.eseq_step = actors[iVar8].saved.saved_eseq_step; } break; case -0x1f: actors[iVar8].saved.eseq_loop_count = eseq_loop_counts_list[(short)save_file_big->level_in_building]; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; actors[iVar8].saved.saved_eseq_step = actors[iVar8].saved.eseq_step; break; case -0x1e: actors[1].saved.disable = 1; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; if ((save_file_big->basic_stats).bananas == 0) { enqueue_new_player_hint(0xe,0,0); } anim_state_xxx_list_remove((int *)actors[1].anim_state); break; case -0x1d: (*(code *)actors[iVar8].eseq_action_29_cb)(); pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x1c: actors[iVar8].saved.collide_entity_checks_en = local_8; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x1b: xxx_maybe_throw_banana(local_8,uVar2); pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x1a: psVar10 = (short *)area_screen_thing0_0_idx (actors[iVar8].saved.screen_idx, actors[iVar8].saved.idx_of_up_warp_related); actors[iVar8].saved.x = *psVar10; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x19: actors[iVar8].saved.disable = 1; if ((save_file_big->basic_stats).bananas == 0) { enqueue_new_player_hint(0xe,0,0); } return local_6; case -0x18: actors[iVar8].cmd_24_related_state = local_8; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x17: if (uVar2 == 0xffff) { area_screen_thing0_0_idx (actors[iVar8].saved.screen_idx,actors[iVar8].saved.idx_of_ladder_related); nullsub(); } else { nullsub(); } pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x16: if (uVar2 == 0xffff) { area_screen_thing0_0_idx (actors[iVar8].saved.screen_idx,actors[iVar8].saved.idx_of_ladder_related); nullsub(); } else { nullsub(); } pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x15: if (local_8 != 0x8000) { psVar10 = (short *)area_screen_thing1_0_idx (actors[iVar8].saved.screen_idx, actors[iVar8].saved.idx_of_ladder_related); actors[iVar8].saved.x = *psVar10 + local_8; } if (uVar2 != 0x8000) { iVar11 = area_screen_thing1_0_idx (actors[iVar8].saved.screen_idx,actors[iVar8].saved.idx_of_ladder_related ); actors[iVar8].saved.y = uVar2 + *(short *)(iVar11 + 2); } pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x11: actors[iVar8].saved.process_thing2_en = 0; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0x10: actors[iVar8].saved.process_thing2_en = 1; actors[iVar8].saved.process_thing2_result = 0; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0xf: actors[iVar8].saved.y = local_8; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0xe: actors[iVar8].saved.x = local_8; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0xd: psVar10 = &actors[iVar8].saved.y; *psVar10 = *psVar10 + local_8; pwVar1 = &actors[iVar8].saved.y2; *pwVar1 = *pwVar1 + uVar2; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0xc: actors[iVar8].saved.x = actors[iVar8].saved.x + local_8; pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -0xb: (*(code *)actors[iVar8].eseq_action_11_cb_a)(); if (param_1 == 0) { actors_switch_game_mode = 1; return 1; } (*(code *)actors[iVar8].eseq_action_11_cb_b)(); actors[iVar8].saved.eseq_step = 0; peVar15 = actors[iVar8].xxx_eseq_a_selected[(short)actors[iVar8].saved.cur_state]->p; break; case -10: (*(code *)actors[iVar8].eseq_action_10_cb)(); pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -9: iVar11 = area_screen_thing1_0_idx (actors[iVar8].saved.screen_idx,actors[iVar8].saved.idx_of_ladder_related); if (actors[iVar8].saved.screen_idx == loaded_screen_idx) { aseq_anim_reset_and_play(*(undefined4 **)(iVar11 + 10)); } pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; break; case -8: pwVar1 = &actors[iVar8].saved.eseq_step; *pwVar1 = *pwVar1 + 1; actors[iVar8].flip_and_xtra_disable = actors[iVar8].flip_and_xtra_disable | 0x8000; return local_6; case -7: actor_go_to_state(param_1,actors[iVar8].saved.prev_state); peVar15 = actors[iVar8].xxx_eseq_a_selected[(short)actors[iVar8].saved.cur_state]->p; actors[iVar8].saved.eseq_step = 0; break; case -6: actor_go_to_state(param_1,local_8); peVar15 = actors[iVar8].xxx_eseq_a_selected[(short)actors[iVar8].saved.cur_state]->p; actors[iVar8].saved.eseq_step = 0; break; case -4: actors[iVar8].saved.eseq_step = local_8; break; case -1: actors[iVar8].saved.eseq_step = 0; } } while( true ); } void __stdcall draw_all_actors(void) { uint uVar1; actor_struct *paVar2; short sVar3; paVar2 = actors; sVar3 = 1; do { paVar2 = paVar2 + 1; if ((((paVar2->saved).disable == 0) && ((paVar2->saved).screen_idx == loaded_screen_idx)) && (((int)(short)paVar2->flip_and_xtra_disable & 0x8000U) == 0)) { aseq_set_pos_order((int)paVar2->anim_state,(paVar2->rect).x,(paVar2->rect).y,sVar3 + 10); aseq_anim_set_img_and_flags ((int)paVar2->anim_state,0,paVar2->new_img_idx, (ushort)((paVar2->flip_and_xtra_disable & 2) != 0)); aseq_anim_reset_and_play((undefined4 *)paVar2->anim_state); } else { anim_state_xxx_list_remove((int *)paVar2->anim_state); } sVar3 = sVar3 + 1; } while (sVar3 < 0xc); if (actors[0].saved.player_iframes == 0) { player_iframe_blink_frame = 0; } if (((int)(short)actors[0].flip_and_xtra_disable & 0x8000U) == 0) { if (player_iframe_blink_frame < 2) { aseq_set_pos_order((int)actors[0].anim_state,actors[0].rect.x,actors[0].rect.y,0xf); aseq_anim_set_img_and_flags ((int)actors[0].anim_state,0,actors[0].new_img_idx, (ushort)((actors[0].flip_and_xtra_disable & 2) != 0)); aseq_anim_reset_and_play((undefined4 *)actors[0].anim_state); } else { anim_state_xxx_list_remove((int *)actors[0].anim_state); } if (actors[0].saved.player_iframes != 0) { player_iframe_blink_frame = player_iframe_blink_frame + 1; uVar1 = (int)player_iframe_blink_frame & 0x80000003; if ((int)uVar1 < 0) { uVar1 = (uVar1 - 1 | 0xfffffffc) + 1; } player_iframe_blink_frame = (short)uVar1; } } return; } void __stdcall actors_load_stuff(void) { uint uVar1; undefined2 extraout_var; int iVar2; aseq_anim_state_struct *paVar3; undefined4 extraout_EDX; undefined4 extraout_EDX_00; short sVar4; short sVar5; uVar1 = area_screen_type_b0(loaded_screen_idx); if (loaded_screen_idx != 0) { load_eseq_4500_3(); load_eseq_4504_7(); DAT_0044a794 = 1; aseq_4508_invisible_px = (aseq_anim_state_struct *)load_aseq(4508); aseq_4508_override_timing(); aseq_anim_set_cmd_0x400_handler((int)aseq_4508_invisible_px,aseq_4508_skip_draw_cb,1); aseq_anim_reset_and_play((undefined4 *)aseq_4508_invisible_px); sVar5 = (short)uVar1; actors[0].aseq_idx_cur = actors[0].aseq_idx_base + sVar5; iVar2 = CONCAT22(extraout_var,4501); if (sVar5 == 0) { iVar2 = iVar2 + -1; } actors[0].anim_state = (aseq_anim_state_struct *)load_aseq((short)iVar2); (*(code *)actors[0].eseq_action_11_cb_b)(actors[0].anim_state,extraout_EDX,iVar2,0); actors[1].aseq_idx_cur = actors[1].aseq_idx_base + sVar5; uVar1 = (uint)(ushort)actors[1].aseq_idx_cur; actors[1].anim_state = (aseq_anim_state_struct *)load_aseq(actors[1].aseq_idx_cur); (*(code *)actors[1].eseq_action_11_cb_b)(actors[1].anim_state,extraout_EDX_00,uVar1,1); if (save_file_big->chimps_enabled == 1) { sVar4 = 2; do { actors[sVar4].aseq_idx_cur = actors[sVar4].aseq_idx_base + sVar5; paVar3 = (aseq_anim_state_struct *)load_aseq(actors[sVar4].aseq_idx_cur); actors[sVar4].anim_state = paVar3; aseq_select_anim((int)actors[sVar4].anim_state,sVar4); if ((actors[sVar4].saved.disable == 0) && (actors[sVar4].saved.screen_idx == loaded_screen_idx)) { (*(code *)actors[sVar4].eseq_action_11_cb_b)(); } sVar4 = sVar4 + 1; } while (sVar4 < 0xc); } } return; } void __stdcall FUN_00425b5a(void) { aseq_anim_state_struct *paVar1; short sVar2; if ((loaded_screen_idx != 0) && (DAT_0044a794 != 0)) { DAT_0044a794 = 0; aseq_4508_invisible_px = (aseq_anim_state_struct *)free_aseq((int *)aseq_4508_invisible_px); actors[0].anim_state = (aseq_anim_state_struct *)free_aseq((int *)actors[0].anim_state); actors[0].aseq_idx_cur = -1; actors[1].anim_state = (aseq_anim_state_struct *)free_aseq((int *)actors[1].anim_state); actors[1].aseq_idx_cur = -1; if (save_file_big->chimps_enabled == 1) { sVar2 = 2; do { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)actors[sVar2].anim_state); actors[sVar2].anim_state = paVar1; actors[sVar2].aseq_idx_cur = -1; sVar2 = sVar2 + 1; } while (sVar2 < 0xc); } } return; } bool __cdecl actor_give_part(short param_1,short param_2) { int iVar1; undefined4 uVar2; int iVar3; undefined4 *puVar4; bool bVar5; short local_6; iVar1 = (int)param_1; uVar2 = part_get_slot(param_2); bVar5 = false; iVar3 = part_linked_list_find_given_slot (&(actors[iVar1].parts_linked_list)->next,(short)uVar2,&local_6); if ((short)iVar3 < 2) { puVar4 = (undefined4 *)part_get_chunk_by_file_idx(param_2); *(ushort *)((int)puVar4 + 0x36) = *(ushort *)((int)puVar4 + 0x36) & 0x4000; *(undefined2 *)((int)puVar4 + 0x5e) = 0; *(short *)(puVar4 + 7) = local_6; *(short *)(puVar4 + 3) = param_1; iVar3 = time_get_secs_count(60); *(short *)((int)puVar4 + 0x1a) = (short)iVar3; bVar5 = local_6 != -1; if (bVar5) { loaded_parts[local_6].idx_other_part_of_same_slot = *(ushort *)(puVar4 + 0x18) | 0x8000; } actors[iVar1].held_parts = actors[iVar1].held_parts + 1; linked_list_insert((int *)actors[iVar1].parts_linked_list,puVar4,0xffff); } return bVar5; } int __cdecl actor_take_part(short param_1,short param_2,short param_3) { int *piVar1; int iVar2; int *piVar3; undefined4 uVar4; int *piVar5; part_chunk *ppVar6; undefined2 uVar7; part_chunk *ppVar8; ushort uVar9; undefined2 local_6; iVar2 = (int)param_1; piVar3 = (int *)deref_next_if_not_null(&(actors[iVar2].parts_linked_list)->next); uVar4 = part_get_slot(param_2); piVar5 = (int *)part_linked_list_find_given_slot (&(actors[iVar2].parts_linked_list)->next,(short)uVar4,&local_6); uVar9 = 0; piVar1 = piVar5; do { uVar7 = (undefined2)((uint)piVar1 >> 0x10); if (piVar3 == (int *)0x0) { LAB_00425db0: return CONCAT22(uVar7,(short)piVar5) + -1; } if (((short)piVar3[0x18] == param_2) && (((short)piVar3[3] == param_1 || (param_3 == 0)))) { actors[(short)piVar3[3]].held_parts = actors[(short)piVar3[3]].held_parts - 1; *(undefined2 *)(piVar3 + 3) = 0xffff; linked_list_unlink((int *)actors[iVar2].parts_linked_list,piVar3); if ((short)piVar3[7] != -1) { if ((*(byte *)((int)piVar3 + 0x1d) & 0x80) == 0) { ppVar6 = loaded_parts + (short)piVar3[7]; ppVar8 = ppVar6; } else { ppVar8 = loaded_parts + ((int)(short)piVar3[7] & 0x7fff); linked_list_unlink((int *)actors[iVar2].parts_linked_list,(int *)ppVar8); ppVar6 = (part_chunk *) linked_list_insert((int *)actors[iVar2].parts_linked_list,(undefined4 *)ppVar8, uVar9); } uVar7 = (undefined2)((uint)ppVar6 >> 0x10); ppVar8->idx_other_part_of_same_slot = 0xffff; goto LAB_00425db0; } } uVar9 = uVar9 + 1; piVar3 = (int *)deref_next(piVar3); piVar1 = piVar3; } while( true ); } undefined2 __stdcall process_all_actors(void) { ushort uVar1; undefined4 uVar2; undefined4 extraout_EDX; int iVar3; actor_struct *paVar4; short sVar5; int iVar6; paVar4 = actors; iVar3 = 0; do { if ((paVar4->saved).disable == 0) { sVar5 = (short)iVar3; iVar6 = iVar3; uVar2 = zzzactor_collide_intersect_stuff(sVar5); uVar1 = (*(code *)paVar4->process_cb)(uVar2,extraout_EDX,iVar6,iVar3); if ((uVar1 != 0xffff) && ((uVar1 & 0x7fff) != (paVar4->saved).cur_state)) { actor_go_to_state(sVar5,uVar1 & 0x7fff); if (((int)(short)uVar1 & 0x8000U) == 0) { (paVar4->saved).eseq_step = 0; paVar4->field7_0x10 = 0; } } actor_process_eseq(sVar5); } paVar4 = paVar4 + 1; iVar3 = iVar3 + 1; } while ((short)iVar3 < 0xc); return actors_switch_game_mode; } void __cdecl write_actors(int param_1) { short sVar1; actor_struct *paVar2; paVar2 = actors; sVar1 = 0; do { memcpy((undefined4 *)(sVar1 * 0x2e + param_1),(undefined4 *)&paVar2->saved,0x2e); paVar2 = paVar2 + 1; sVar1 = sVar1 + 1; } while (sVar1 < 0xc); return; } void __cdecl parse_save_actor_state(int param_1) { eseq_chunk *peVar1; uint uVar2; actor_struct *paVar3; short sVar4; paVar3 = actors; sVar4 = 0; do { memcpy((undefined4 *)&paVar3->saved,(undefined4 *)(sVar4 * 0x2e + param_1),0x2e); if ((paVar3->saved).disable == 0) { uVar2 = area_screen_type_b0((paVar3->saved).screen_idx); actor_xxx_eseq_select(sVar4,(short)uVar2); peVar1 = paVar3->xxx_eseq_a_selected[(short)(paVar3->saved).cur_state]; paVar3->cmd_24_related_state = peVar1->aaa; paVar3->xxx_obstacle_col_direction_related = peVar1->bbb; } paVar3 = paVar3 + 1; sVar4 = sVar4 + 1; } while (sVar4 < 0xc); return; } void __stdcall aseq_4508_override_timing(void) { short sVar1; sVar1 = DAT_0044a77e; if (DAT_0044a77c == 0) { sVar1 = 0x14; } aseq_anim_override_timing((int)aseq_4508_invisible_px,sVar1,0); return; } undefined4 __cdecl deref_next_if_not_null(undefined4 *param_1) { if (param_1 == (undefined4 *)0x0) { return 0; } return *param_1; } undefined4 __cdecl deref_prev_if_not_null(int param_1) { if (param_1 == 0) { return 0; } return *(undefined4 *)(param_1 + 4); } undefined4 __cdecl deref_next(undefined4 *param_1) { return *param_1; } undefined4 __cdecl deref_prev(int param_1) { return *(undefined4 *)(param_1 + 4); } undefined4 * __cdecl linked_list_index(undefined4 *param_1,ushort param_2) { undefined4 *puVar1; ushort uVar2; if (param_1 == (undefined4 *)0x0) { return (undefined4 *)0x0; } uVar2 = 0; for (puVar1 = (undefined4 *)*param_1; (uVar2 < param_2 && (puVar1 != (undefined4 *)0x0)); puVar1 = (undefined4 *)*puVar1) { uVar2 = uVar2 + 1; } if (puVar1 == (undefined4 *)0x0) { puVar1 = (undefined4 *)param_1[1]; } return puVar1; } void __cdecl linked_list_insert_sorted(int *param_1,undefined4 *param_2,undefined *param_3) { undefined4 *puVar1; short sVar2; undefined4 *puVar3; undefined4 *puVar4; short local_6; if (*param_1 == 0) { linked_list_insert(param_1,param_2,0); } else { local_6 = 0; puVar1 = (undefined4 *)*param_1; puVar4 = (undefined4 *)0x0; while (puVar3 = puVar1, puVar3 != (undefined4 *)0x0) { sVar2 = (*(code *)param_3)(); if (sVar2 < 0) break; local_6 = local_6 + 1; puVar4 = puVar3; puVar1 = (undefined4 *)*puVar3; } if (puVar3 == (undefined4 *)0x0) { param_1[1] = (int)param_2; } else { puVar3[1] = param_2; } *param_2 = puVar3; param_2[1] = puVar4; if (puVar4 != (undefined4 *)0x0) { *puVar4 = param_2; } if (local_6 == 0) { *param_1 = (int)param_2; } } return; } void __cdecl linked_list_insert(int *param_1,undefined4 *param_2,ushort param_3) { undefined4 *puVar1; undefined4 *puVar2; undefined4 *puVar3; ushort uVar4; if (*param_1 == 0) { param_1[1] = (int)param_2; *param_1 = (int)param_2; *(undefined4 *)(*param_1 + 4) = 0; *(undefined4 *)*param_1 = 0; return; } if (param_3 == 0xffff) { puVar2 = (undefined4 *)0x0; puVar3 = (undefined4 *)param_1[1]; param_1[1] = (int)param_2; } else { uVar4 = 0; puVar1 = (undefined4 *)*param_1; puVar3 = (undefined4 *)0x0; while ((puVar2 = puVar1, uVar4 < param_3 && (puVar2 != (undefined4 *)0x0))) { uVar4 = uVar4 + 1; puVar3 = puVar2; puVar1 = (undefined4 *)*puVar2; } if (puVar2 == (undefined4 *)0x0) { param_1[1] = (int)param_2; } else { puVar2[1] = param_2; } } *param_2 = puVar2; param_2[1] = puVar3; if (puVar3 != (undefined4 *)0x0) { *puVar3 = param_2; } if (param_3 == 0) { *param_1 = (int)param_2; } return; } void __cdecl linked_list_unlink(int *param_1,int *param_2) { int *piVar1; piVar1 = (int *)param_2[1]; if (piVar1 == (int *)0x0) { *param_1 = *param_2; } else { *piVar1 = *param_2; } if (*param_2 != 0) { *(int **)(*param_2 + 4) = piVar1; return; } param_1[1] = param_2[1]; return; } int * __cdecl FUN_004260b3(int *param_1,ushort param_2) { int *piVar1; int *piVar2; int *piVar3; ushort uVar4; if (*param_1 == 0) { piVar2 = (int *)0x0; } else { uVar4 = 0; piVar1 = (int *)*param_1; piVar3 = (int *)0x0; while ((piVar2 = piVar1, uVar4 < param_2 && (piVar2 != (int *)0x0))) { uVar4 = uVar4 + 1; piVar3 = piVar2; piVar1 = (int *)*piVar2; } if (piVar3 == (int *)0x0) { *param_1 = *piVar2; } else { *piVar3 = *piVar2; } if (*piVar2 == 0) { param_1[1] = piVar2[1]; } else { *(int **)(*piVar2 + 4) = piVar3; } } return piVar2; } int __cdecl linked_list_sz(undefined4 *param_1) { undefined4 *puVar1; int iVar2; iVar2 = 0; if (param_1 != (undefined4 *)0x0) { for (puVar1 = (undefined4 *)deref_next_if_not_null(param_1); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)*puVar1) { iVar2 = iVar2 + 1; } return iVar2; } return 0; } void __stdcall alloc_linked_list_marker(void) { undefined4 *puVar1; puVar1 = (undefined4 *)alloc_tracked_heap_block(8); puVar1[1] = 0; *puVar1 = 0; return; } void __cdecl free_tracked_heap_block_(int param_1) { if (param_1 != 0) { free_tracked_heap_block(param_1); } return; } void __cdecl linked_list_head_zero(undefined4 *param_1) { if (param_1 != (undefined4 *)0x0) { param_1[1] = 0; *param_1 = 0; } return; } void __cdecl FUN_00426182(undefined2 param_1) { DAT_0044a7a4 = param_1; return; } undefined2 __stdcall FUN_00426191(void) { return DAT_0044a7a4; } void __stdcall magnet_puzzle_on_load(void) { aseq_anim_state_struct *paVar1; aseq_cursor_struct *paVar2; short sVar3; DAT_00451192 = 0; wave_load_list[0] = 0x1f73; wave_load_list[1] = 0x1f74; wave_load_list[2] = 0x4a57; wave_load_list[3] = 0x1f4e; wave_load_list[4] = 0x4a77; wave_load_list[5] = -1; load_waves_from_list(0x451486); load_and_draw_score(); FUN_0043d7c1(FUN_0042b7ce); cordcode_list = (cordcode *)alloc_tracked_heap_block(900); load_rrgb_1(13000); DAT_0045115c = load_aseq(13000); aseq_draw_to_both_fbs((int)DAT_0045115c,0,0,0); free_aseq(DAT_0045115c); magnet_puzzle_load_stuff(puzzle_idx); FUN_00426be8(); FUN_0042683f(); FUN_00430e33(DAT_0044a8ce); FUN_00429ca1(); key_xxxxx_set(FUN_00426811); DAT_0045116c = load_aseq(0x3aa1); aseq_set_pos_order((int)DAT_0045116c,0x18e,0x143,10); DAT_00451170 = load_aseq(0x3a9d); aseq_set_pos_order((int)DAT_00451170,0x15,0x19,1); DAT_004510e0 = load_aseq(0x32ea); DAT_004510e4 = aseq_setup_as_cursor((int)DAT_004510e0,0,0); *(undefined2 *)(DAT_004510e4 + 0x12) = 0; FUN_0042b82e(1); on_deactivate_xtra_cb = FUN_0042b8a7; sVar3 = 0; do { paVar1 = (aseq_anim_state_struct *)load_aseq(sVar3 + 0x32cb); PTR_ARRAY_004510f0[sVar3] = paVar1; paVar2 = (aseq_cursor_struct *)aseq_setup_as_cursor((int)PTR_ARRAY_004510f0[sVar3],0,0); PTR_ARRAY_00451124[sVar3] = paVar2; sVar3 = sVar3 + 1; } while (sVar3 < 0xc); DAT_00451120 = load_aseq(0x36ba); DAT_00451154 = aseq_setup_as_cursor((int)DAT_00451120,0,0); FUN_00422170(); return; } void __stdcall magnet_puzzle_on_remove(void) { aseq_anim_state_struct *paVar1; aseq_cursor_struct *paVar2; short sVar3; if (DAT_004514b0 != 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; } on_deactivate_xtra_cb = (undefined *)0x0; FUN_00431029(); free_tracked_heap_block(DAT_004510d4); set_cursor_override_regions(0,0); free_aseq(DAT_004510e0); aseq_free_cursor(DAT_004510e4); sVar3 = 0; do { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)PTR_ARRAY_004510f0[sVar3]); PTR_ARRAY_004510f0[sVar3] = paVar1; paVar2 = (aseq_cursor_struct *)aseq_free_cursor((int)PTR_ARRAY_00451124[sVar3]); PTR_ARRAY_00451124[sVar3] = paVar2; sVar3 = sVar3 + 1; } while (sVar3 < 0xc); DAT_00451120 = (int *)free_aseq(DAT_00451120); DAT_00451154 = aseq_free_cursor(DAT_00451154); FUN_00430ef4(0x451486); FUN_0043d7c1(0); DAT_004514ae = DAT_0044a8ce; mouse_region_delete_all_lists(); FUN_00426b61(); key_xxxxx_clear(); free_tracked_heap_block((int)cordcode_list); free_resource_item_with_idx_fourcc(DAT_004514c2,(undefined1 *)&text); FUN_0042211c(); return; } void __stdcall magnet_puzzle_on_periodic(void) { short sVar1; undefined4 uVar2; new_player_hint(0xf); if (DAT_00451192 == 0) { DAT_00451192 = 1; DAT_004514b0 = DAT_004514c4; load_wave_flag_2(DAT_004514c4); play_wave_flag2(DAT_004514b0); } get_mouse_xy_relative_(&DAT_004510ea,&DAT_004510ec); if (DAT_004510e8 != 0) { DAT_004510e8 = 0; FUN_0042683f(); FUN_00426be8(); } switch(DAT_0044a8d0) { case 0: sVar1 = wave_is_playing_(DAT_004514b0); if (sVar1 == 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; DAT_0044a8d0 = 1; return; } break; case 4: xxxfunc_set(&puzzle_choosing_funcset_xxx); break; case 5: if ((DAT_004510dc != 0) && (DAT_004510de < 0x10)) { DAT_004510da = 0xffff; DAT_004510d8 = 0xffff; DAT_004510dc = 0; DAT_0044a8d0 = 6; DAT_004510de = DAT_004510de + 1; return; } if (DAT_0044a8ce == 0) { uVar2 = FUN_0042b3fc(); DAT_0044a8ce = (short)uVar2; if (DAT_0044a8ce != 0) { solved_the_puzzle(0x4a77); inc_score_by_400(); FUN_0042683f(); } } DAT_0044a8d0 = DAT_00451190; FUN_0042683f(); if (DAT_0044a8d0 != 3) { FUN_0042b89a(); return; } break; case 6: DAT_004510d8 = DAT_004510d8 + 1; if (DAT_004510d8 == 0x1e) { DAT_004510d8 = 0; sVar1 = FUN_0042a6cc(DAT_004510da); if (sVar1 != 0) { DAT_004510dc = 1; } FUN_0042a448(); DAT_004510da = DAT_004510da + 1; if (DAT_004510da == 4) { DAT_0044a8d0 = 5; return; } } DAT_0044a8d0 = 7; return; case 7: if ((cordcode_list[DAT_004510d8].type != -1) && (*(short *)&cordcode_list[DAT_004510d8].field_0xe == 0)) { FUN_0042a5aa(DAT_004510d8); } DAT_0044a8d0 = 6; return; } return; } void __stdcall FUN_004266a0(void) { if (DAT_0044a8d0 != 5) { play_wave_flag1(0x1f5c,5,0); aseq_anim_reset_and_play(DAT_0045116c); xxx_periodic_loop(); DAT_0044a8d0 = 4; } return; } void __stdcall FUN_004266dc(void) { uint uVar1; char *pcVar2; short sVar3; char *apcStackY_20400 [32762]; char *local_400 [5]; char local_3ec [1000]; if (DAT_0044a8d0 != 5) { play_wave_flag1(0x1f5c,5,0); anim_state_xxx_list_insert_4(DAT_00451170); xxx_periodic_loop(); anim_state_xxx_list_remove(DAT_00451170); xxx_periodic_loop(); memset((undefined4 *)local_3ec,0,1000); local_400[0] = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[0],(int *)&text); uVar1 = strlen(local_400[0]); FUN_00440d70((undefined4 *)local_3ec,local_400[0],uVar1); for (sVar3 = 1; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { pcVar2 = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[sVar3],(int *)&text); local_400[sVar3] = pcVar2; uVar1 = strlen(local_400[sVar3]); FUN_00440ce0(local_3ec,local_400[sVar3],uVar1); } FUN_004301cf(local_3ec); for (sVar3 = 0; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { free_resource_item_with_idx_fourcc(SHORT_ARRAY_004514ec[sVar3],(undefined1 *)&text); } } return; } void __stdcall FUN_00426811(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if (sVar1 == 0xd) { if (DAT_0044a8ce != 0) { DAT_0044a8d0 = 4; } DAT_004514f6 = 1; } return; } void __stdcall FUN_0042683f(void) { short sVar1; int *piVar3; short sVar4; short sVar5; code *pcVar6; undefined4 uVar2; mouse_region_delete_all_lists(); DAT_00451184 = mouse_region_new_up(0xd,0x5a,0x5d,0x90,1,0x426a87); *(undefined4 *)((int)DAT_00451184 + 0x1e) = 1000; DAT_00451188 = mouse_region_new_up(0x70,0x2c,0x17d,0xf6,1,0x426a87); *(undefined4 *)((int)DAT_00451188 + 0x1e) = 0x3e9; DAT_0045118c = mouse_region_new_up(5,0xf6,0x61,0x30,1,0x426a87); *(undefined4 *)((int)DAT_0045118c + 0x1e) = 0x3ea; mouse_region_new_up(0x18e,0x144,100,0x32,5,0x4266a0); mouse_region_new_up(0x15,0x19,0x3a,0x1e,5,0x4266dc); sVar4 = 0; do { if (0 < (short)null_ARRAY_0044a8c8[sVar4]) { pcVar6 = FUN_00426a87; sVar5 = 5; uVar2 = aseq_get_img_h((int)PTR_ARRAY_00451160[sVar4],0); sVar1 = (short)uVar2; uVar2 = aseq_get_img_w((int)PTR_ARRAY_00451160[sVar4],0); piVar3 = mouse_region_new_up(null_ARRAY_ARRAY_0044a7a8[sVar4][0], null_ARRAY_ARRAY_0044a7a8[sVar4][1],(short)uVar2,sVar1,sVar5, (uint)pcVar6); (&DAT_00451178)[sVar4] = piVar3; *(int *)((&DAT_00451178)[sVar4] + 0x1e) = (int)sVar4; } sVar4 = sVar4 + 1; } while (sVar4 < 3); sVar4 = 0; do { if (cordcode_list[sVar4].type != -1) { pcVar6 = FUN_00426a87; sVar5 = 5; uVar2 = aseq_get_img_h(*(int *)&cordcode_list[sVar4].field_0x12,0); sVar1 = (short)uVar2; uVar2 = aseq_get_img_w(*(int *)&cordcode_list[sVar4].field_0x12,0); piVar3 = mouse_region_new_up(cordcode_list[sVar4].x,cordcode_list[sVar4].y,(short)uVar2,sVar1, sVar5,(uint)pcVar6); *(int **)&cordcode_list[sVar4].field_0x1a = piVar3; *(int *)(*(int *)&cordcode_list[sVar4].field_0x1a + 0x1e) = sVar4 + 2000; } sVar4 = sVar4 + 1; } while (sVar4 < 0x1e); if (DAT_0044a8ce != 0) { mouse_region_new_up(10,0x140,0x14e,0x3c,0x19,0x426a74); } return; } int __cdecl FUN_00426a87(int param_1) { uint uVar1; int iVar2; if (DAT_0044a8d0 == 1) { uVar1 = *(uint *)(param_1 + 0x1e); if (uVar1 < 3) { iVar2 = FUN_00429c14(*(short *)(param_1 + 0x1e)); return iVar2; } if (0x1d < uVar1 - 2000) { return uVar1 - 0x7ee; } iVar2 = FUN_0042a32e(*(short *)(param_1 + 0x1e) + -2000); } else { iVar2 = DAT_0044a8d0 + -3; if (iVar2 == 0) { uVar1 = *(uint *)(param_1 + 0x1e); if ((int)uVar1 < 0x3ea) { if (uVar1 == 0x3e9) { LAB_00426ae8: iVar2 = FUN_00429ddd(); return iVar2; } if ((uVar1 < 3) || (iVar2 = uVar1 - 1000, iVar2 == 0)) { clear_cursor_override_regions(); DAT_0044a8d0 = 1; null_ARRAY_0044a8c8[DAT_004510cc] = null_ARRAY_0044a8c8[DAT_004510cc] + 1; FUN_00426be8(); FUN_0042683f(); DAT_004510cc = 0xffff; iVar2 = FUN_0042b89a(); return iVar2; } } else if (uVar1 == 0x3ea) { iVar2 = 0; if (DAT_004510cc != -1) { iVar2 = FUN_00429d59(0); return iVar2; } } else { iVar2 = uVar1 - 0x7ee; if (uVar1 - 2000 < 0x1e) goto LAB_00426ae8; } } } return iVar2; } void __stdcall FUN_00426b61(void) { short sVar1; sVar1 = 0; do { free_aseq((int *)PTR_ARRAY_00451160[sVar1]); sVar1 = sVar1 + 1; } while (sVar1 < 3); sVar1 = 0; do { if (cordcode_list[sVar1].type != -1) { free_aseq(*(int **)&cordcode_list[sVar1].field_0x12); free_aseq(*(int **)&cordcode_list[sVar1].field_0x16); } sVar1 = sVar1 + 1; } while (sVar1 < 0x1e); free_aseq(DAT_00451170); free_aseq(DAT_0045116c); return; } void __stdcall FUN_00426be8(void) { short sVar1; short sVar2; ushort uVar3; short sVar4; byte local_10 [12]; load_nfnt(15000); gfxish_copy_otherbuf_to_dest_and_invalidate(0xd,0x5a,0x5d,0x90); sVar4 = 0; do { anim_state_xxx_list_remove((int *)PTR_ARRAY_00451160[sVar4]); if (0 < (short)null_ARRAY_0044a8c8[sVar4]) { sVar1 = null_ARRAY_ARRAY_0044a7a8[sVar4][0]; sVar2 = null_ARRAY_ARRAY_0044a7a8[sVar4][1]; anim_state_xxx_list_insert_8004((undefined4 *)PTR_ARRAY_00451160[sVar4]); aseq_set_pos_order((int)PTR_ARRAY_00451160[sVar4],sVar1,sVar2,5); uVar3 = null_ARRAY_ARRAY_0044a7b4[sVar4][0]; sVar1 = null_ARRAY_ARRAY_0044a7b4[sVar4][1]; sprintf(local_10); FUN_0043dc0b(15000,local_10,uVar3,sVar1,0x996); } sVar4 = sVar4 + 1; } while (sVar4 < 3); gfxish_invalidate_rect_wrap(0xd,0x5a,0x5d,0x90); free_nfnt(15000); return; } void __cdecl magnet_puzzle_load_stuff(short param_1) { aseq_anim_state_struct *paVar1; short sVar2; if (0x1e < param_1) { param_1 = 1; } DAT_0044a8ce = 0; DAT_004510cc = 0xffff; DAT_0044a8d0 = 1; sVar2 = 0; do { cordcode_list[sVar2].type = -1; sVar2 = sVar2 + 1; } while (sVar2 < 0x1e); sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *)load_aseq(sVar2 + 13031); PTR_ARRAY_00451160[sVar2] = paVar1; sVar2 = sVar2 + 1; } while (sVar2 < 3); sVar2 = 0; do { null_ARRAY_0044a8c8[sVar2] = (short)CHAR_ARRAY_ARRAY_0044a84d[CHAR_ARRAY_0044a8a9[param_1]][sVar2]; sVar2 = sVar2 + 1; } while (sVar2 < 3); sVar2 = 0; do { null_ARRAY_ARRAY_00450f84[sVar2][3] = 0xffff; sVar2 = sVar2 + 1; } while (sVar2 < 0x28); switch(param_1) { case 1: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 13000; SHORT_ARRAY_004514ce[1] = 0x32c9; SHORT_ARRAY_004514ce[2] = 0x32ca; SHORT_ARRAY_004514ce[3] = 0x32cb; SHORT_ARRAY_004514ce[4] = 0x32cc; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x32c9; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x124; null_ARRAY_ARRAY_00450f84[0][1] = 0xa0; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0xff; null_ARRAY_ARRAY_00450f84[1][1] = 0xa0; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x149; null_ARRAY_ARRAY_00450f84[2][1] = 0xa0; break; case 2: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 13000; SHORT_ARRAY_004514ce[1] = 0x32c9; SHORT_ARRAY_004514ce[2] = 0x32ca; SHORT_ARRAY_004514ce[3] = 0x32cb; SHORT_ARRAY_004514ce[4] = 0x32cc; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x32c9; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x119; null_ARRAY_ARRAY_00450f84[0][1] = 0x83; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x108; null_ARRAY_ARRAY_00450f84[1][1] = 0x94; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x12d; null_ARRAY_ARRAY_00450f84[2][1] = 0x94; break; case 3: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 13000; SHORT_ARRAY_004514ce[1] = 0x32c9; SHORT_ARRAY_004514ce[2] = 0x32ca; SHORT_ARRAY_004514ce[3] = 0x32cb; SHORT_ARRAY_004514ce[4] = 0x32cc; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x32c9; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x120; null_ARRAY_ARRAY_00450f84[0][1] = 0x81; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x10f; null_ARRAY_ARRAY_00450f84[1][1] = 0x92; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x134; null_ARRAY_ARRAY_00450f84[2][1] = 0x92; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0x120; null_ARRAY_ARRAY_00450f84[3][1] = 0xa3; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0xfb; null_ARRAY_ARRAY_00450f84[4][1] = 0xa3; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 0; null_ARRAY_ARRAY_00450f84[5][0] = 0x145; null_ARRAY_ARRAY_00450f84[5][1] = 0xa3; break; case 4: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32d3; SHORT_ARRAY_004514ce[1] = 0x32d4; SHORT_ARRAY_004514ce[2] = 0x32d5; SHORT_ARRAY_004514ce[3] = 0x32d6; SHORT_ARRAY_004514ce[4] = 0x32d7; SHORT_ARRAY_004514ce[5] = 0x32d8; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32ca; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x123; null_ARRAY_ARRAY_00450f84[0][1] = 0x96; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0xfe; null_ARRAY_ARRAY_00450f84[1][1] = 0x96; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x148; null_ARRAY_ARRAY_00450f84[2][1] = 0x96; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 1; null_ARRAY_ARRAY_00450f84[3][0] = 0xfe; null_ARRAY_ARRAY_00450f84[3][1] = 0xa7; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 1; null_ARRAY_ARRAY_00450f84[4][0] = 0x15c; null_ARRAY_ARRAY_00450f84[4][1] = 0xa7; break; case 5: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32d3; SHORT_ARRAY_004514ce[1] = 0x32d4; SHORT_ARRAY_004514ce[2] = 0x32d5; SHORT_ARRAY_004514ce[3] = 0x32d6; SHORT_ARRAY_004514ce[4] = 0x32d7; SHORT_ARRAY_004514ce[5] = 0x32d8; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32ca; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x11c; null_ARRAY_ARRAY_00450f84[0][1] = 0xc1; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0xf7; null_ARRAY_ARRAY_00450f84[1][1] = 0xc1; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x141; null_ARRAY_ARRAY_00450f84[2][1] = 0xc1; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 1; null_ARRAY_ARRAY_00450f84[3][0] = 0xf7; null_ARRAY_ARRAY_00450f84[3][1] = 0x9c; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 1; null_ARRAY_ARRAY_00450f84[4][0] = 0x155; null_ARRAY_ARRAY_00450f84[4][1] = 0x9c; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 0; null_ARRAY_ARRAY_00450f84[5][0] = 0xe3; null_ARRAY_ARRAY_00450f84[5][1] = 0x8b; null_ARRAY_ARRAY_00450f84[6][3] = 0; null_ARRAY_ARRAY_00450f84[6][2] = 0; null_ARRAY_ARRAY_00450f84[6][0] = 0x155; null_ARRAY_ARRAY_00450f84[6][1] = 0x8b; break; case 6: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32d3; SHORT_ARRAY_004514ce[1] = 0x32d4; SHORT_ARRAY_004514ce[2] = 0x32d5; SHORT_ARRAY_004514ce[3] = 0x32d6; SHORT_ARRAY_004514ce[4] = 0x32d7; SHORT_ARRAY_004514ce[5] = 0x32d8; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32ca; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x117; null_ARRAY_ARRAY_00450f84[0][1] = 0x6e; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0xf2; null_ARRAY_ARRAY_00450f84[1][1] = 0x6e; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x13c; null_ARRAY_ARRAY_00450f84[2][1] = 0x6e; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 1; null_ARRAY_ARRAY_00450f84[3][0] = 0xf2; null_ARRAY_ARRAY_00450f84[3][1] = 0x7f; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0x117; null_ARRAY_ARRAY_00450f84[4][1] = 200; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 1; null_ARRAY_ARRAY_00450f84[5][0] = 0xf2; null_ARRAY_ARRAY_00450f84[5][1] = 0xa4; null_ARRAY_ARRAY_00450f84[6][3] = 0; null_ARRAY_ARRAY_00450f84[6][2] = 1; null_ARRAY_ARRAY_00450f84[6][0] = 0x150; null_ARRAY_ARRAY_00450f84[6][1] = 0x7f; null_ARRAY_ARRAY_00450f84[7][3] = 0; null_ARRAY_ARRAY_00450f84[7][2] = 0; null_ARRAY_ARRAY_00450f84[7][0] = 0xf2; null_ARRAY_ARRAY_00450f84[7][1] = 200; null_ARRAY_ARRAY_00450f84[8][3] = 0; null_ARRAY_ARRAY_00450f84[8][2] = 1; null_ARRAY_ARRAY_00450f84[8][0] = 0x150; null_ARRAY_ARRAY_00450f84[8][1] = 0xa4; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 0; null_ARRAY_ARRAY_00450f84[9][0] = 0x13c; null_ARRAY_ARRAY_00450f84[9][1] = 200; break; case 7: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32d3; SHORT_ARRAY_004514ce[1] = 0x32d4; SHORT_ARRAY_004514ce[2] = 0x32d5; SHORT_ARRAY_004514ce[3] = 0x32d6; SHORT_ARRAY_004514ce[4] = 0x32d7; SHORT_ARRAY_004514ce[5] = 0x32d8; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32ca; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x100; null_ARRAY_ARRAY_00450f84[0][1] = 0x8d; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x100; null_ARRAY_ARRAY_00450f84[1][1] = 0x9e; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x13f; null_ARRAY_ARRAY_00450f84[2][1] = 0x8d; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0x13f; null_ARRAY_ARRAY_00450f84[3][1] = 0x9e; break; case 8: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32d3; SHORT_ARRAY_004514ce[1] = 0x32d4; SHORT_ARRAY_004514ce[2] = 0x32d5; SHORT_ARRAY_004514ce[3] = 0x32d6; SHORT_ARRAY_004514ce[4] = 0x32d7; SHORT_ARRAY_004514ce[5] = 0x32d8; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32ca; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x114; null_ARRAY_ARRAY_00450f84[0][1] = 0x70; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x101; null_ARRAY_ARRAY_00450f84[1][1] = 0x81; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x126; null_ARRAY_ARRAY_00450f84[2][1] = 0x81; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0x115; null_ARRAY_ARRAY_00450f84[3][1] = 0xb2; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0xf0; null_ARRAY_ARRAY_00450f84[4][1] = 0xb2; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 0; null_ARRAY_ARRAY_00450f84[5][0] = 0x13a; null_ARRAY_ARRAY_00450f84[5][1] = 0xb2; break; case 9: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32d3; SHORT_ARRAY_004514ce[1] = 0x32d4; SHORT_ARRAY_004514ce[2] = 0x32d5; SHORT_ARRAY_004514ce[3] = 0x32d6; SHORT_ARRAY_004514ce[4] = 0x32d7; SHORT_ARRAY_004514ce[5] = 0x32d8; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32ca; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x117; null_ARRAY_ARRAY_00450f84[0][1] = 0x74; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0xf2; null_ARRAY_ARRAY_00450f84[1][1] = 0x74; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x13c; null_ARRAY_ARRAY_00450f84[2][1] = 0x74; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0xf2; null_ARRAY_ARRAY_00450f84[3][1] = 0xa6; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0x117; null_ARRAY_ARRAY_00450f84[4][1] = 0xa6; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 0; null_ARRAY_ARRAY_00450f84[5][0] = 0x13c; null_ARRAY_ARRAY_00450f84[5][1] = 0xa6; break; case 10: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x11e; null_ARRAY_ARRAY_00450f84[0][1] = 0x9d; null_ARRAY_ARRAY_00450f84[1][3] = 1; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x11e; null_ARRAY_ARRAY_00450f84[1][1] = 0xae; null_ARRAY_ARRAY_00450f84[2][3] = 1; null_ARRAY_ARRAY_00450f84[2][2] = 2; null_ARRAY_ARRAY_00450f84[2][0] = 0x11e; null_ARRAY_ARRAY_00450f84[2][1] = 0x73; break; case 0xb: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 1; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x105; null_ARRAY_ARRAY_00450f84[0][1] = 0xa7; null_ARRAY_ARRAY_00450f84[1][3] = 1; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x12a; null_ARRAY_ARRAY_00450f84[1][1] = 0xa7; null_ARRAY_ARRAY_00450f84[2][3] = 1; null_ARRAY_ARRAY_00450f84[2][2] = 2; null_ARRAY_ARRAY_00450f84[2][0] = 0x105; null_ARRAY_ARRAY_00450f84[2][1] = 0x7d; null_ARRAY_ARRAY_00450f84[3][3] = 1; null_ARRAY_ARRAY_00450f84[3][2] = 2; null_ARRAY_ARRAY_00450f84[3][0] = 0x12a; null_ARRAY_ARRAY_00450f84[3][1] = 0x7d; break; case 0xc: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 1; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x105; null_ARRAY_ARRAY_00450f84[0][1] = 0xa9; null_ARRAY_ARRAY_00450f84[1][3] = 1; null_ARRAY_ARRAY_00450f84[1][2] = 1; null_ARRAY_ARRAY_00450f84[1][0] = 0xec; null_ARRAY_ARRAY_00450f84[1][1] = 0x84; null_ARRAY_ARRAY_00450f84[2][3] = 1; null_ARRAY_ARRAY_00450f84[2][2] = 2; null_ARRAY_ARRAY_00450f84[2][0] = 0x116; null_ARRAY_ARRAY_00450f84[2][1] = 0x6b; null_ARRAY_ARRAY_00450f84[3][3] = 1; null_ARRAY_ARRAY_00450f84[3][2] = 3; null_ARRAY_ARRAY_00450f84[3][0] = 0x12a; null_ARRAY_ARRAY_00450f84[3][1] = 0x95; break; case 0xd: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 1; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0xea; null_ARRAY_ARRAY_00450f84[0][1] = 0xb8; null_ARRAY_ARRAY_00450f84[1][3] = 1; null_ARRAY_ARRAY_00450f84[1][2] = 2; null_ARRAY_ARRAY_00450f84[1][0] = 0xfe; null_ARRAY_ARRAY_00450f84[1][1] = 0x8e; null_ARRAY_ARRAY_00450f84[2][3] = 1; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x112; null_ARRAY_ARRAY_00450f84[2][1] = 0xb8; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 1; null_ARRAY_ARRAY_00450f84[3][0] = 0x126; null_ARRAY_ARRAY_00450f84[3][1] = 0x93; null_ARRAY_ARRAY_00450f84[4][3] = 1; null_ARRAY_ARRAY_00450f84[4][2] = 2; null_ARRAY_ARRAY_00450f84[4][0] = 0x126; null_ARRAY_ARRAY_00450f84[4][1] = 0x6a; break; case 0xe: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32ce; SHORT_ARRAY_004514ce[1] = 0x32cf; SHORT_ARRAY_004514ce[2] = 0x32d0; SHORT_ARRAY_004514ce[3] = 0x32d1; SHORT_ARRAY_004514ce[4] = 0x32d2; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x32dc; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x116; null_ARRAY_ARRAY_00450f84[0][1] = 0xd0; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0xf1; null_ARRAY_ARRAY_00450f84[1][1] = 0xd0; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x13b; null_ARRAY_ARRAY_00450f84[2][1] = 0xd0; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 1; null_ARRAY_ARRAY_00450f84[3][0] = 0x160; null_ARRAY_ARRAY_00450f84[3][1] = 0xbc; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 1; null_ARRAY_ARRAY_00450f84[4][0] = 0x160; null_ARRAY_ARRAY_00450f84[4][1] = 0x97; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 1; null_ARRAY_ARRAY_00450f84[5][0] = 0xf1; null_ARRAY_ARRAY_00450f84[5][1] = 0xab; null_ARRAY_ARRAY_00450f84[6][3] = 0; null_ARRAY_ARRAY_00450f84[6][2] = 1; null_ARRAY_ARRAY_00450f84[6][0] = 0xf1; null_ARRAY_ARRAY_00450f84[6][1] = 0x86; null_ARRAY_ARRAY_00450f84[7][3] = 0; null_ARRAY_ARRAY_00450f84[7][2] = 1; null_ARRAY_ARRAY_00450f84[7][0] = 0xf1; null_ARRAY_ARRAY_00450f84[7][1] = 0x61; null_ARRAY_ARRAY_00450f84[8][3] = 0; null_ARRAY_ARRAY_00450f84[8][2] = 0; null_ARRAY_ARRAY_00450f84[8][0] = 0x102; null_ARRAY_ARRAY_00450f84[8][1] = 0x61; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 0; null_ARRAY_ARRAY_00450f84[9][0] = 0x127; null_ARRAY_ARRAY_00450f84[9][1] = 0x61; null_ARRAY_ARRAY_00450f84[10][3] = 0; null_ARRAY_ARRAY_00450f84[10][2] = 0; null_ARRAY_ARRAY_00450f84[10][0] = 0x14c; null_ARRAY_ARRAY_00450f84[10][1] = 0x61; null_ARRAY_ARRAY_00450f84[0xb][3] = 0; null_ARRAY_ARRAY_00450f84[0xb][2] = 1; null_ARRAY_ARRAY_00450f84[0xb][0] = 0x160; null_ARRAY_ARRAY_00450f84[0xb][1] = 0x72; break; case 0xf: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x106; null_ARRAY_ARRAY_00450f84[0][1] = 0xa5; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 1; null_ARRAY_ARRAY_00450f84[1][0] = 299; null_ARRAY_ARRAY_00450f84[1][1] = 0x91; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x13c; null_ARRAY_ARRAY_00450f84[2][1] = 0x91; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 1; null_ARRAY_ARRAY_00450f84[3][0] = 299; null_ARRAY_ARRAY_00450f84[3][1] = 0xb6; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0x117; null_ARRAY_ARRAY_00450f84[4][1] = 0xdb; null_ARRAY_ARRAY_00450f84[5][3] = 1; null_ARRAY_ARRAY_00450f84[5][2] = 0; null_ARRAY_ARRAY_00450f84[5][0] = 0x121; null_ARRAY_ARRAY_00450f84[5][1] = 0x57; null_ARRAY_ARRAY_00450f84[6][3] = 0; null_ARRAY_ARRAY_00450f84[6][2] = 0; null_ARRAY_ARRAY_00450f84[6][0] = 0x121; null_ARRAY_ARRAY_00450f84[6][1] = 0x46; null_ARRAY_ARRAY_00450f84[7][3] = 0; null_ARRAY_ARRAY_00450f84[7][2] = 0; null_ARRAY_ARRAY_00450f84[7][0] = 0xfc; null_ARRAY_ARRAY_00450f84[7][1] = 0x57; break; case 0x10: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x122; null_ARRAY_ARRAY_00450f84[0][1] = 0x8e; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x122; null_ARRAY_ARRAY_00450f84[1][1] = 0x9f; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x122; null_ARRAY_ARRAY_00450f84[2][1] = 0xb0; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0x122; null_ARRAY_ARRAY_00450f84[3][1] = 0x7d; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0x122; null_ARRAY_ARRAY_00450f84[4][1] = 0x6d; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 0; null_ARRAY_ARRAY_00450f84[5][0] = 0x122; null_ARRAY_ARRAY_00450f84[5][1] = 0xc1; null_ARRAY_ARRAY_00450f84[6][3] = 0; null_ARRAY_ARRAY_00450f84[6][2] = 0; null_ARRAY_ARRAY_00450f84[6][0] = 0x134; null_ARRAY_ARRAY_00450f84[6][1] = 0x5c; null_ARRAY_ARRAY_00450f84[7][3] = 0; null_ARRAY_ARRAY_00450f84[7][2] = 0; null_ARRAY_ARRAY_00450f84[7][0] = 0x10f; null_ARRAY_ARRAY_00450f84[7][1] = 0x5c; null_ARRAY_ARRAY_00450f84[8][3] = 0; null_ARRAY_ARRAY_00450f84[8][2] = 0; null_ARRAY_ARRAY_00450f84[8][0] = 0x10f; null_ARRAY_ARRAY_00450f84[8][1] = 0xd2; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 0; null_ARRAY_ARRAY_00450f84[9][0] = 0x134; null_ARRAY_ARRAY_00450f84[9][1] = 0xd2; null_ARRAY_ARRAY_00450f84[10][3] = 1; null_ARRAY_ARRAY_00450f84[10][2] = 1; null_ARRAY_ARRAY_00450f84[10][0] = 0xf8; null_ARRAY_ARRAY_00450f84[10][1] = 0x8d; null_ARRAY_ARRAY_00450f84[0xb][3] = 1; null_ARRAY_ARRAY_00450f84[0xb][2] = 3; null_ARRAY_ARRAY_00450f84[0xb][0] = 0x147; null_ARRAY_ARRAY_00450f84[0xb][1] = 0x8e; break; case 0x11: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 1; null_ARRAY_ARRAY_00450f84[0][0] = 0x119; null_ARRAY_ARRAY_00450f84[0][1] = 0x55; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 1; null_ARRAY_ARRAY_00450f84[1][0] = 0x12a; null_ARRAY_ARRAY_00450f84[1][1] = 0x55; null_ARRAY_ARRAY_00450f84[2][3] = 1; null_ARRAY_ARRAY_00450f84[2][2] = 1; null_ARRAY_ARRAY_00450f84[2][0] = 0xef; null_ARRAY_ARRAY_00450f84[2][1] = 0x55; null_ARRAY_ARRAY_00450f84[3][3] = 1; null_ARRAY_ARRAY_00450f84[3][2] = 3; null_ARRAY_ARRAY_00450f84[3][0] = 0x13b; null_ARRAY_ARRAY_00450f84[3][1] = 0x55; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 1; null_ARRAY_ARRAY_00450f84[4][0] = 0x108; null_ARRAY_ARRAY_00450f84[4][1] = 0x99; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 1; null_ARRAY_ARRAY_00450f84[5][0] = 0x13b; null_ARRAY_ARRAY_00450f84[5][1] = 0x9a; null_ARRAY_ARRAY_00450f84[6][3] = 1; null_ARRAY_ARRAY_00450f84[6][2] = 1; null_ARRAY_ARRAY_00450f84[6][0] = 0xde; null_ARRAY_ARRAY_00450f84[6][1] = 0x99; null_ARRAY_ARRAY_00450f84[7][3] = 1; null_ARRAY_ARRAY_00450f84[7][2] = 3; null_ARRAY_ARRAY_00450f84[7][0] = 0x14c; null_ARRAY_ARRAY_00450f84[7][1] = 0x9a; null_ARRAY_ARRAY_00450f84[8][3] = 0; null_ARRAY_ARRAY_00450f84[8][2] = 1; null_ARRAY_ARRAY_00450f84[8][0] = 0x11a; null_ARRAY_ARRAY_00450f84[8][1] = 0xdd; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 1; null_ARRAY_ARRAY_00450f84[9][0] = 299; null_ARRAY_ARRAY_00450f84[9][1] = 0xdd; null_ARRAY_ARRAY_00450f84[10][3] = 1; null_ARRAY_ARRAY_00450f84[10][2] = 1; null_ARRAY_ARRAY_00450f84[10][0] = 0xcf; null_ARRAY_ARRAY_00450f84[10][1] = 0xdd; null_ARRAY_ARRAY_00450f84[0xb][3] = 1; null_ARRAY_ARRAY_00450f84[0xb][2] = 3; null_ARRAY_ARRAY_00450f84[0xb][0] = 0x15e; null_ARRAY_ARRAY_00450f84[0xb][1] = 0xdd; break; case 0x12: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32ce; SHORT_ARRAY_004514ce[1] = 0x32cf; SHORT_ARRAY_004514ce[2] = 0x32d0; SHORT_ARRAY_004514ce[3] = 0x32d1; SHORT_ARRAY_004514ce[4] = 0x32d2; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x32dc; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x116; null_ARRAY_ARRAY_00450f84[0][1] = 0x9b; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 1; null_ARRAY_ARRAY_00450f84[1][0] = 0x118; null_ARRAY_ARRAY_00450f84[1][1] = 0x76; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 1; null_ARRAY_ARRAY_00450f84[2][0] = 0x128; null_ARRAY_ARRAY_00450f84[2][1] = 0x76; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0x116; null_ARRAY_ARRAY_00450f84[3][1] = 0x65; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0x105; null_ARRAY_ARRAY_00450f84[4][1] = 0x54; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 0; null_ARRAY_ARRAY_00450f84[5][0] = 0x12a; null_ARRAY_ARRAY_00450f84[5][1] = 0x54; null_ARRAY_ARRAY_00450f84[6][3] = 0; null_ARRAY_ARRAY_00450f84[6][2] = 0; null_ARRAY_ARRAY_00450f84[6][0] = 0x116; null_ARRAY_ARRAY_00450f84[6][1] = 0x43; null_ARRAY_ARRAY_00450f84[7][3] = 0; null_ARRAY_ARRAY_00450f84[7][2] = 0; null_ARRAY_ARRAY_00450f84[7][0] = 0x104; null_ARRAY_ARRAY_00450f84[7][1] = 0xac; null_ARRAY_ARRAY_00450f84[8][3] = 0; null_ARRAY_ARRAY_00450f84[8][2] = 0; null_ARRAY_ARRAY_00450f84[8][0] = 0x129; null_ARRAY_ARRAY_00450f84[8][1] = 0xac; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 0; null_ARRAY_ARRAY_00450f84[9][0] = 0xf1; null_ARRAY_ARRAY_00450f84[9][1] = 0x9b; null_ARRAY_ARRAY_00450f84[10][3] = 0; null_ARRAY_ARRAY_00450f84[10][2] = 0; null_ARRAY_ARRAY_00450f84[10][0] = 0x13b; null_ARRAY_ARRAY_00450f84[10][1] = 0x9b; null_ARRAY_ARRAY_00450f84[0xb][3] = 0; null_ARRAY_ARRAY_00450f84[0xb][2] = 1; null_ARRAY_ARRAY_00450f84[0xb][0] = 0xe0; null_ARRAY_ARRAY_00450f84[0xb][1] = 0x87; null_ARRAY_ARRAY_00450f84[0xc][3] = 0; null_ARRAY_ARRAY_00450f84[0xc][2] = 1; null_ARRAY_ARRAY_00450f84[0xc][0] = 0xe0; null_ARRAY_ARRAY_00450f84[0xc][1] = 0x62; null_ARRAY_ARRAY_00450f84[0xd][3] = 0; null_ARRAY_ARRAY_00450f84[0xd][2] = 1; null_ARRAY_ARRAY_00450f84[0xd][0] = 0x160; null_ARRAY_ARRAY_00450f84[0xd][1] = 0x9b; null_ARRAY_ARRAY_00450f84[0xe][3] = 0; null_ARRAY_ARRAY_00450f84[0xe][2] = 1; null_ARRAY_ARRAY_00450f84[0xe][0] = 0x160; null_ARRAY_ARRAY_00450f84[0xe][1] = 0xc0; null_ARRAY_ARRAY_00450f84[0xf][3] = 0; null_ARRAY_ARRAY_00450f84[0xf][2] = 0; null_ARRAY_ARRAY_00450f84[0xf][0] = 0x104; null_ARRAY_ARRAY_00450f84[0xf][1] = 0xbd; null_ARRAY_ARRAY_00450f84[0x10][3] = 0; null_ARRAY_ARRAY_00450f84[0x10][2] = 0; null_ARRAY_ARRAY_00450f84[0x10][0] = 0x104; null_ARRAY_ARRAY_00450f84[0x10][1] = 0xce; null_ARRAY_ARRAY_00450f84[0x11][3] = 0; null_ARRAY_ARRAY_00450f84[0x11][2] = 0; null_ARRAY_ARRAY_00450f84[0x11][0] = 0x104; null_ARRAY_ARRAY_00450f84[0x11][1] = 0xdf; null_ARRAY_ARRAY_00450f84[0x12][3] = 0; null_ARRAY_ARRAY_00450f84[0x12][2] = 0; null_ARRAY_ARRAY_00450f84[0x12][0] = 0x129; null_ARRAY_ARRAY_00450f84[0x12][1] = 0xbd; null_ARRAY_ARRAY_00450f84[0x13][3] = 0; null_ARRAY_ARRAY_00450f84[0x13][2] = 0; null_ARRAY_ARRAY_00450f84[0x13][0] = 0x129; null_ARRAY_ARRAY_00450f84[0x13][1] = 0xce; null_ARRAY_ARRAY_00450f84[0x14][3] = 0; null_ARRAY_ARRAY_00450f84[0x14][2] = 0; null_ARRAY_ARRAY_00450f84[0x14][0] = 0x129; null_ARRAY_ARRAY_00450f84[0x14][1] = 0xdf; break; case 0x13: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x106; null_ARRAY_ARRAY_00450f84[0][1] = 0x93; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 299; null_ARRAY_ARRAY_00450f84[1][1] = 0x93; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x106; null_ARRAY_ARRAY_00450f84[2][1] = 0xa4; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 299; null_ARRAY_ARRAY_00450f84[3][1] = 0xa4; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0x106; null_ARRAY_ARRAY_00450f84[4][1] = 0xb5; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 0; null_ARRAY_ARRAY_00450f84[5][0] = 299; null_ARRAY_ARRAY_00450f84[5][1] = 0xb5; null_ARRAY_ARRAY_00450f84[6][3] = 0; null_ARRAY_ARRAY_00450f84[6][2] = 0; null_ARRAY_ARRAY_00450f84[6][0] = 0x106; null_ARRAY_ARRAY_00450f84[6][1] = 0xc6; null_ARRAY_ARRAY_00450f84[7][3] = 0; null_ARRAY_ARRAY_00450f84[7][2] = 0; null_ARRAY_ARRAY_00450f84[7][0] = 299; null_ARRAY_ARRAY_00450f84[7][1] = 0xc6; null_ARRAY_ARRAY_00450f84[8][3] = 0; null_ARRAY_ARRAY_00450f84[8][2] = 1; null_ARRAY_ARRAY_00450f84[8][0] = 0x106; null_ARRAY_ARRAY_00450f84[8][1] = 0xd7; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 1; null_ARRAY_ARRAY_00450f84[9][0] = 0x13f; null_ARRAY_ARRAY_00450f84[9][1] = 0xd7; null_ARRAY_ARRAY_00450f84[10][3] = 0; null_ARRAY_ARRAY_00450f84[10][2] = 0; null_ARRAY_ARRAY_00450f84[10][0] = 200; null_ARRAY_ARRAY_00450f84[10][1] = 0x93; null_ARRAY_ARRAY_00450f84[0xb][3] = 0; null_ARRAY_ARRAY_00450f84[0xb][2] = 0; null_ARRAY_ARRAY_00450f84[0xb][0] = 0x169; null_ARRAY_ARRAY_00450f84[0xb][1] = 0x93; null_ARRAY_ARRAY_00450f84[0xc][3] = 1; null_ARRAY_ARRAY_00450f84[0xc][2] = 0; null_ARRAY_ARRAY_00450f84[0xc][0] = 0x118; null_ARRAY_ARRAY_00450f84[0xc][1] = 0x58; null_ARRAY_ARRAY_00450f84[0xd][3] = 0; null_ARRAY_ARRAY_00450f84[0xd][2] = 0; null_ARRAY_ARRAY_00450f84[0xd][0] = 0x118; null_ARRAY_ARRAY_00450f84[0xd][1] = 0x47; break; case 0x14: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32ce; SHORT_ARRAY_004514ce[1] = 0x32cf; SHORT_ARRAY_004514ce[2] = 0x32d0; SHORT_ARRAY_004514ce[3] = 0x32d1; SHORT_ARRAY_004514ce[4] = 0x32d2; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x32dc; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x11f; null_ARRAY_ARRAY_00450f84[0][1] = 0x9c; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x10c; null_ARRAY_ARRAY_00450f84[1][1] = 0x6a; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x131; null_ARRAY_ARRAY_00450f84[2][1] = 0x6a; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0x10c; null_ARRAY_ARRAY_00450f84[3][1] = 0xce; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0x131; null_ARRAY_ARRAY_00450f84[4][1] = 0xce; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 0; null_ARRAY_ARRAY_00450f84[5][0] = 0xf9; null_ARRAY_ARRAY_00450f84[5][1] = 0xdf; null_ARRAY_ARRAY_00450f84[6][3] = 0; null_ARRAY_ARRAY_00450f84[6][2] = 0; null_ARRAY_ARRAY_00450f84[6][0] = 0xe7; null_ARRAY_ARRAY_00450f84[6][1] = 0xf0; null_ARRAY_ARRAY_00450f84[7][3] = 0; null_ARRAY_ARRAY_00450f84[7][2] = 0; null_ARRAY_ARRAY_00450f84[7][0] = 0x144; null_ARRAY_ARRAY_00450f84[7][1] = 0xdf; null_ARRAY_ARRAY_00450f84[8][3] = 0; null_ARRAY_ARRAY_00450f84[8][2] = 0; null_ARRAY_ARRAY_00450f84[8][0] = 0x156; null_ARRAY_ARRAY_00450f84[8][1] = 0xf0; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 0; null_ARRAY_ARRAY_00450f84[9][0] = 0xf9; null_ARRAY_ARRAY_00450f84[9][1] = 0x59; null_ARRAY_ARRAY_00450f84[10][3] = 0; null_ARRAY_ARRAY_00450f84[10][2] = 0; null_ARRAY_ARRAY_00450f84[10][0] = 0xe7; null_ARRAY_ARRAY_00450f84[10][1] = 0x48; null_ARRAY_ARRAY_00450f84[0xb][3] = 0; null_ARRAY_ARRAY_00450f84[0xb][2] = 0; null_ARRAY_ARRAY_00450f84[0xb][0] = 0x144; null_ARRAY_ARRAY_00450f84[0xb][1] = 0x59; null_ARRAY_ARRAY_00450f84[0xc][3] = 0; null_ARRAY_ARRAY_00450f84[0xc][2] = 0; null_ARRAY_ARRAY_00450f84[0xc][0] = 0x156; null_ARRAY_ARRAY_00450f84[0xc][1] = 0x48; break; case 0x15: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 1; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x11a; null_ARRAY_ARRAY_00450f84[0][1] = 0xd0; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x11a; null_ARRAY_ARRAY_00450f84[1][1] = 0xbf; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0xf5; null_ARRAY_ARRAY_00450f84[2][1] = 0xbf; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0x13f; null_ARRAY_ARRAY_00450f84[3][1] = 0xbf; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 1; null_ARRAY_ARRAY_00450f84[4][0] = 0xe5; null_ARRAY_ARRAY_00450f84[4][1] = 0xab; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 1; null_ARRAY_ARRAY_00450f84[5][0] = 0x164; null_ARRAY_ARRAY_00450f84[5][1] = 0xab; null_ARRAY_ARRAY_00450f84[6][3] = 0; null_ARRAY_ARRAY_00450f84[6][2] = 1; null_ARRAY_ARRAY_00450f84[6][0] = 0xe5; null_ARRAY_ARRAY_00450f84[6][1] = 0x86; null_ARRAY_ARRAY_00450f84[7][3] = 0; null_ARRAY_ARRAY_00450f84[7][2] = 1; null_ARRAY_ARRAY_00450f84[7][0] = 0xe5; null_ARRAY_ARRAY_00450f84[7][1] = 0x61; null_ARRAY_ARRAY_00450f84[8][3] = 0; null_ARRAY_ARRAY_00450f84[8][2] = 1; null_ARRAY_ARRAY_00450f84[8][0] = 0x164; null_ARRAY_ARRAY_00450f84[8][1] = 0x86; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 1; null_ARRAY_ARRAY_00450f84[9][0] = 0x164; null_ARRAY_ARRAY_00450f84[9][1] = 0x61; null_ARRAY_ARRAY_00450f84[10][3] = 0; null_ARRAY_ARRAY_00450f84[10][2] = 0; null_ARRAY_ARRAY_00450f84[10][0] = 0xf6; null_ARRAY_ARRAY_00450f84[10][1] = 0x61; null_ARRAY_ARRAY_00450f84[0xb][3] = 0; null_ARRAY_ARRAY_00450f84[0xb][2] = 0; null_ARRAY_ARRAY_00450f84[0xb][0] = 0x11b; null_ARRAY_ARRAY_00450f84[0xb][1] = 0x61; null_ARRAY_ARRAY_00450f84[0xc][3] = 0; null_ARRAY_ARRAY_00450f84[0xc][2] = 0; null_ARRAY_ARRAY_00450f84[0xc][0] = 0x140; null_ARRAY_ARRAY_00450f84[0xc][1] = 0x61; null_ARRAY_ARRAY_00450f84[0xd][3] = 1; null_ARRAY_ARRAY_00450f84[0xd][2] = 2; null_ARRAY_ARRAY_00450f84[0xd][0] = 0x11a; null_ARRAY_ARRAY_00450f84[0xd][1] = 0x37; null_ARRAY_ARRAY_00450f84[0xe][3] = 1; null_ARRAY_ARRAY_00450f84[0xe][2] = 1; null_ARRAY_ARRAY_00450f84[0xe][0] = 0x13a; null_ARRAY_ARRAY_00450f84[0xe][1] = 0x86; null_ARRAY_ARRAY_00450f84[0xf][3] = 1; null_ARRAY_ARRAY_00450f84[0xf][2] = 3; null_ARRAY_ARRAY_00450f84[0xf][0] = 0xf6; null_ARRAY_ARRAY_00450f84[0xf][1] = 0x86; null_ARRAY_ARRAY_00450f84[0x10][3] = 1; null_ARRAY_ARRAY_00450f84[0x10][2] = 3; null_ARRAY_ARRAY_00450f84[0x10][0] = 0x175; null_ARRAY_ARRAY_00450f84[0x10][1] = 0x86; break; case 0x16: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x105; null_ARRAY_ARRAY_00450f84[0][1] = 0x96; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x12a; null_ARRAY_ARRAY_00450f84[1][1] = 0x96; null_ARRAY_ARRAY_00450f84[2][3] = 1; null_ARRAY_ARRAY_00450f84[2][2] = 1; null_ARRAY_ARRAY_00450f84[2][0] = 0xdb; null_ARRAY_ARRAY_00450f84[2][1] = 0x82; null_ARRAY_ARRAY_00450f84[3][3] = 1; null_ARRAY_ARRAY_00450f84[3][2] = 3; null_ARRAY_ARRAY_00450f84[3][0] = 0x105; null_ARRAY_ARRAY_00450f84[3][1] = 0x6e; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0xe0; null_ARRAY_ARRAY_00450f84[4][1] = 0x6e; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 0; null_ARRAY_ARRAY_00450f84[5][0] = 0xbc; null_ARRAY_ARRAY_00450f84[5][1] = 0x6e; null_ARRAY_ARRAY_00450f84[6][3] = 1; null_ARRAY_ARRAY_00450f84[6][2] = 1; null_ARRAY_ARRAY_00450f84[6][0] = 0x92; null_ARRAY_ARRAY_00450f84[6][1] = 0x5a; null_ARRAY_ARRAY_00450f84[7][3] = 1; null_ARRAY_ARRAY_00450f84[7][2] = 3; null_ARRAY_ARRAY_00450f84[7][0] = 0x14f; null_ARRAY_ARRAY_00450f84[7][1] = 0x96; null_ARRAY_ARRAY_00450f84[8][3] = 1; null_ARRAY_ARRAY_00450f84[8][2] = 1; null_ARRAY_ARRAY_00450f84[8][0] = 0x125; null_ARRAY_ARRAY_00450f84[8][1] = 0xaa; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 0; null_ARRAY_ARRAY_00450f84[9][0] = 0x14f; null_ARRAY_ARRAY_00450f84[9][1] = 0xbe; null_ARRAY_ARRAY_00450f84[10][3] = 0; null_ARRAY_ARRAY_00450f84[10][2] = 0; null_ARRAY_ARRAY_00450f84[10][0] = 0x174; null_ARRAY_ARRAY_00450f84[10][1] = 0xbe; null_ARRAY_ARRAY_00450f84[0xb][3] = 1; null_ARRAY_ARRAY_00450f84[0xb][2] = 3; null_ARRAY_ARRAY_00450f84[0xb][0] = 0x199; null_ARRAY_ARRAY_00450f84[0xb][1] = 0xbe; null_ARRAY_ARRAY_00450f84[0xc][3] = 1; null_ARRAY_ARRAY_00450f84[0xc][2] = 1; null_ARRAY_ARRAY_00450f84[0xc][0] = 0x92; null_ARRAY_ARRAY_00450f84[0xc][1] = 0xbe; null_ARRAY_ARRAY_00450f84[0xd][3] = 1; null_ARRAY_ARRAY_00450f84[0xd][2] = 3; null_ARRAY_ARRAY_00450f84[0xd][0] = 0xbc; null_ARRAY_ARRAY_00450f84[0xd][1] = 0xbe; null_ARRAY_ARRAY_00450f84[0xe][3] = 1; null_ARRAY_ARRAY_00450f84[0xe][2] = 3; null_ARRAY_ARRAY_00450f84[0xe][0] = 0x199; null_ARRAY_ARRAY_00450f84[0xe][1] = 0x5a; null_ARRAY_ARRAY_00450f84[0xf][3] = 1; null_ARRAY_ARRAY_00450f84[0xf][2] = 1; null_ARRAY_ARRAY_00450f84[0xf][0] = 0x16f; null_ARRAY_ARRAY_00450f84[0xf][1] = 0x5a; break; case 0x17: DAT_004514be = 5; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32ce; SHORT_ARRAY_004514ce[1] = 0x32cf; SHORT_ARRAY_004514ce[2] = 0x32d0; SHORT_ARRAY_004514ce[3] = 0x32d1; SHORT_ARRAY_004514ce[4] = 0x32d2; SHORT_ARRAY_004514ce[5] = -1; SHORT_ARRAY_004514ec[0] = 0x32dc; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 1; null_ARRAY_ARRAY_00450f84[0][0] = 299; null_ARRAY_ARRAY_00450f84[0][1] = 0x78; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 1; null_ARRAY_ARRAY_00450f84[1][0] = 299; null_ARRAY_ARRAY_00450f84[1][1] = 0x53; null_ARRAY_ARRAY_00450f84[2][3] = 1; null_ARRAY_ARRAY_00450f84[2][2] = 1; null_ARRAY_ARRAY_00450f84[2][0] = 0x101; null_ARRAY_ARRAY_00450f84[2][1] = 0x53; null_ARRAY_ARRAY_00450f84[3][3] = 1; null_ARRAY_ARRAY_00450f84[3][2] = 3; null_ARRAY_ARRAY_00450f84[3][0] = 0x13c; null_ARRAY_ARRAY_00450f84[3][1] = 0x53; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 1; null_ARRAY_ARRAY_00450f84[4][0] = 299; null_ARRAY_ARRAY_00450f84[4][1] = 0x9d; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 1; null_ARRAY_ARRAY_00450f84[5][0] = 0x11a; null_ARRAY_ARRAY_00450f84[5][1] = 0xd4; null_ARRAY_ARRAY_00450f84[6][3] = 0; null_ARRAY_ARRAY_00450f84[6][2] = 1; null_ARRAY_ARRAY_00450f84[6][0] = 299; null_ARRAY_ARRAY_00450f84[6][1] = 0xc2; null_ARRAY_ARRAY_00450f84[7][3] = 0; null_ARRAY_ARRAY_00450f84[7][2] = 1; null_ARRAY_ARRAY_00450f84[7][0] = 0x109; null_ARRAY_ARRAY_00450f84[7][1] = 0xe7; null_ARRAY_ARRAY_00450f84[8][3] = 0; null_ARRAY_ARRAY_00450f84[8][2] = 1; null_ARRAY_ARRAY_00450f84[8][0] = 0x13c; null_ARRAY_ARRAY_00450f84[8][1] = 0xd4; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 1; null_ARRAY_ARRAY_00450f84[9][0] = 0x14d; null_ARRAY_ARRAY_00450f84[9][1] = 0xe7; null_ARRAY_ARRAY_00450f84[10][3] = 0; null_ARRAY_ARRAY_00450f84[10][2] = 0; null_ARRAY_ARRAY_00450f84[10][0] = 0x106; null_ARRAY_ARRAY_00450f84[10][1] = 0x9d; null_ARRAY_ARRAY_00450f84[0xb][3] = 0; null_ARRAY_ARRAY_00450f84[0xb][2] = 0; null_ARRAY_ARRAY_00450f84[0xb][0] = 0x13c; null_ARRAY_ARRAY_00450f84[0xb][1] = 0x9d; null_ARRAY_ARRAY_00450f84[0xc][3] = 1; null_ARRAY_ARRAY_00450f84[0xc][2] = 1; null_ARRAY_ARRAY_00450f84[0xc][0] = 0xdc; null_ARRAY_ARRAY_00450f84[0xc][1] = 0x89; null_ARRAY_ARRAY_00450f84[0xd][3] = 1; null_ARRAY_ARRAY_00450f84[0xd][2] = 3; null_ARRAY_ARRAY_00450f84[0xd][0] = 0x161; null_ARRAY_ARRAY_00450f84[0xd][1] = 0x9d; break; case 0x18: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0xff; null_ARRAY_ARRAY_00450f84[0][1] = 0xb2; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x124; null_ARRAY_ARRAY_00450f84[1][1] = 0xb2; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 1; null_ARRAY_ARRAY_00450f84[2][0] = 0xee; null_ARRAY_ARRAY_00450f84[2][1] = 0xb2; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0x149; null_ARRAY_ARRAY_00450f84[3][1] = 0xb2; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 1; null_ARRAY_ARRAY_00450f84[4][0] = 0x16e; null_ARRAY_ARRAY_00450f84[4][1] = 0xb2; null_ARRAY_ARRAY_00450f84[5][3] = 1; null_ARRAY_ARRAY_00450f84[5][2] = 3; null_ARRAY_ARRAY_00450f84[5][0] = 0xee; null_ARRAY_ARRAY_00450f84[5][1] = 0xd7; null_ARRAY_ARRAY_00450f84[6][3] = 1; null_ARRAY_ARRAY_00450f84[6][2] = 3; null_ARRAY_ARRAY_00450f84[6][0] = 0x16e; null_ARRAY_ARRAY_00450f84[6][1] = 0xd7; null_ARRAY_ARRAY_00450f84[7][3] = 1; null_ARRAY_ARRAY_00450f84[7][2] = 1; null_ARRAY_ARRAY_00450f84[7][0] = 0xc5; null_ARRAY_ARRAY_00450f84[7][1] = 0xd7; null_ARRAY_ARRAY_00450f84[8][3] = 1; null_ARRAY_ARRAY_00450f84[8][2] = 1; null_ARRAY_ARRAY_00450f84[8][0] = 0x144; null_ARRAY_ARRAY_00450f84[8][1] = 0xd7; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 1; null_ARRAY_ARRAY_00450f84[9][0] = 0xff; null_ARRAY_ARRAY_00450f84[9][1] = 0x8d; null_ARRAY_ARRAY_00450f84[10][3] = 0; null_ARRAY_ARRAY_00450f84[10][2] = 1; null_ARRAY_ARRAY_00450f84[10][0] = 0xff; null_ARRAY_ARRAY_00450f84[10][1] = 0x68; null_ARRAY_ARRAY_00450f84[0xb][3] = 0; null_ARRAY_ARRAY_00450f84[0xb][2] = 0; null_ARRAY_ARRAY_00450f84[0xb][0] = 0xeb; null_ARRAY_ARRAY_00450f84[0xb][1] = 0x57; null_ARRAY_ARRAY_00450f84[0xc][3] = 0; null_ARRAY_ARRAY_00450f84[0xc][2] = 0; null_ARRAY_ARRAY_00450f84[0xc][0] = 0xc6; null_ARRAY_ARRAY_00450f84[0xc][1] = 0x57; null_ARRAY_ARRAY_00450f84[0xd][3] = 0; null_ARRAY_ARRAY_00450f84[0xd][2] = 0; null_ARRAY_ARRAY_00450f84[0xd][0] = 0xa1; null_ARRAY_ARRAY_00450f84[0xd][1] = 0x57; null_ARRAY_ARRAY_00450f84[0xe][3] = 0; null_ARRAY_ARRAY_00450f84[0xe][2] = 1; null_ARRAY_ARRAY_00450f84[0xe][0] = 0xa1; null_ARRAY_ARRAY_00450f84[0xe][1] = 0x68; null_ARRAY_ARRAY_00450f84[0xf][3] = 1; null_ARRAY_ARRAY_00450f84[0xf][2] = 3; null_ARRAY_ARRAY_00450f84[0xf][0] = 0xa1; null_ARRAY_ARRAY_00450f84[0xf][1] = 0x8d; null_ARRAY_ARRAY_00450f84[0x10][3] = 0; null_ARRAY_ARRAY_00450f84[0x10][2] = 1; null_ARRAY_ARRAY_00450f84[0x10][0] = 0x16e; null_ARRAY_ARRAY_00450f84[0x10][1] = 0x8d; null_ARRAY_ARRAY_00450f84[0x11][3] = 0; null_ARRAY_ARRAY_00450f84[0x11][2] = 0; null_ARRAY_ARRAY_00450f84[0x11][0] = 0x15a; null_ARRAY_ARRAY_00450f84[0x11][1] = 0x7c; null_ARRAY_ARRAY_00450f84[0x12][3] = 0; null_ARRAY_ARRAY_00450f84[0x12][2] = 0; null_ARRAY_ARRAY_00450f84[0x12][0] = 0x135; null_ARRAY_ARRAY_00450f84[0x12][1] = 0x7c; null_ARRAY_ARRAY_00450f84[0x13][3] = 0; null_ARRAY_ARRAY_00450f84[0x13][2] = 1; null_ARRAY_ARRAY_00450f84[0x13][0] = 0x135; null_ARRAY_ARRAY_00450f84[0x13][1] = 0x8d; break; case 0x19: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 1; null_ARRAY_ARRAY_00450f84[0][2] = 2; null_ARRAY_ARRAY_00450f84[0][0] = 0x11c; null_ARRAY_ARRAY_00450f84[0][1] = 0x8c; null_ARRAY_ARRAY_00450f84[1][3] = 1; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x108; null_ARRAY_ARRAY_00450f84[1][1] = 0xb6; null_ARRAY_ARRAY_00450f84[2][3] = 1; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x130; null_ARRAY_ARRAY_00450f84[2][1] = 0xb6; null_ARRAY_ARRAY_00450f84[3][3] = 1; null_ARRAY_ARRAY_00450f84[3][2] = 2; null_ARRAY_ARRAY_00450f84[3][0] = 0xf4; null_ARRAY_ARRAY_00450f84[3][1] = 0x68; null_ARRAY_ARRAY_00450f84[4][3] = 1; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0xe0; null_ARRAY_ARRAY_00450f84[4][1] = 0x92; null_ARRAY_ARRAY_00450f84[5][3] = 1; null_ARRAY_ARRAY_00450f84[5][2] = 2; null_ARRAY_ARRAY_00450f84[5][0] = 0x145; null_ARRAY_ARRAY_00450f84[5][1] = 0x67; null_ARRAY_ARRAY_00450f84[6][3] = 1; null_ARRAY_ARRAY_00450f84[6][2] = 0; null_ARRAY_ARRAY_00450f84[6][0] = 0x159; null_ARRAY_ARRAY_00450f84[6][1] = 0x91; break; case 0x1a: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x145; null_ARRAY_ARRAY_00450f84[0][1] = 0xde; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x16a; null_ARRAY_ARRAY_00450f84[1][1] = 0xde; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0xd6; null_ARRAY_ARRAY_00450f84[2][1] = 0xde; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0xfb; null_ARRAY_ARRAY_00450f84[3][1] = 0xde; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0x120; null_ARRAY_ARRAY_00450f84[4][1] = 0xde; null_ARRAY_ARRAY_00450f84[5][3] = 1; null_ARRAY_ARRAY_00450f84[5][2] = 2; null_ARRAY_ARRAY_00450f84[5][0] = 0xc2; null_ARRAY_ARRAY_00450f84[5][1] = 0xb4; null_ARRAY_ARRAY_00450f84[6][3] = 1; null_ARRAY_ARRAY_00450f84[6][2] = 2; null_ARRAY_ARRAY_00450f84[6][0] = 0x17e; null_ARRAY_ARRAY_00450f84[6][1] = 0xb4; null_ARRAY_ARRAY_00450f84[7][3] = 1; null_ARRAY_ARRAY_00450f84[7][2] = 0; null_ARRAY_ARRAY_00450f84[7][0] = 0xae; null_ARRAY_ARRAY_00450f84[7][1] = 0xde; null_ARRAY_ARRAY_00450f84[8][3] = 1; null_ARRAY_ARRAY_00450f84[8][2] = 0; null_ARRAY_ARRAY_00450f84[8][0] = 0x192; null_ARRAY_ARRAY_00450f84[8][1] = 0xde; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 1; null_ARRAY_ARRAY_00450f84[9][0] = 0xae; null_ARRAY_ARRAY_00450f84[9][1] = 0xb9; null_ARRAY_ARRAY_00450f84[10][3] = 0; null_ARRAY_ARRAY_00450f84[10][2] = 1; null_ARRAY_ARRAY_00450f84[10][0] = 0xae; null_ARRAY_ARRAY_00450f84[10][1] = 0x94; null_ARRAY_ARRAY_00450f84[0xb][3] = 0; null_ARRAY_ARRAY_00450f84[0xb][2] = 1; null_ARRAY_ARRAY_00450f84[0xb][0] = 0xae; null_ARRAY_ARRAY_00450f84[0xb][1] = 0x6f; null_ARRAY_ARRAY_00450f84[0xc][3] = 1; null_ARRAY_ARRAY_00450f84[0xc][2] = 2; null_ARRAY_ARRAY_00450f84[0xc][0] = 0xae; null_ARRAY_ARRAY_00450f84[0xc][1] = 0x45; null_ARRAY_ARRAY_00450f84[0xd][3] = 1; null_ARRAY_ARRAY_00450f84[0xd][2] = 0; null_ARRAY_ARRAY_00450f84[0xd][0] = 0xc2; null_ARRAY_ARRAY_00450f84[0xd][1] = 0x6f; null_ARRAY_ARRAY_00450f84[0xe][3] = 0; null_ARRAY_ARRAY_00450f84[0xe][2] = 0; null_ARRAY_ARRAY_00450f84[0xe][0] = 0xd6; null_ARRAY_ARRAY_00450f84[0xe][1] = 0x5e; null_ARRAY_ARRAY_00450f84[0xf][3] = 0; null_ARRAY_ARRAY_00450f84[0xf][2] = 0; null_ARRAY_ARRAY_00450f84[0xf][0] = 0xfb; null_ARRAY_ARRAY_00450f84[0xf][1] = 0x5e; null_ARRAY_ARRAY_00450f84[0x10][3] = 0; null_ARRAY_ARRAY_00450f84[0x10][2] = 0; null_ARRAY_ARRAY_00450f84[0x10][0] = 0x120; null_ARRAY_ARRAY_00450f84[0x10][1] = 0x5e; null_ARRAY_ARRAY_00450f84[0x11][3] = 0; null_ARRAY_ARRAY_00450f84[0x11][2] = 0; null_ARRAY_ARRAY_00450f84[0x11][0] = 0x145; null_ARRAY_ARRAY_00450f84[0x11][1] = 0x5e; null_ARRAY_ARRAY_00450f84[0x12][3] = 0; null_ARRAY_ARRAY_00450f84[0x12][2] = 0; null_ARRAY_ARRAY_00450f84[0x12][0] = 0x16a; null_ARRAY_ARRAY_00450f84[0x12][1] = 0x5e; null_ARRAY_ARRAY_00450f84[0x13][3] = 1; null_ARRAY_ARRAY_00450f84[0x13][2] = 0; null_ARRAY_ARRAY_00450f84[0x13][0] = 0x17e; null_ARRAY_ARRAY_00450f84[0x13][1] = 0x6f; null_ARRAY_ARRAY_00450f84[0x14][3] = 1; null_ARRAY_ARRAY_00450f84[0x14][2] = 2; null_ARRAY_ARRAY_00450f84[0x14][0] = 0x192; null_ARRAY_ARRAY_00450f84[0x14][1] = 0x45; null_ARRAY_ARRAY_00450f84[0x15][3] = 0; null_ARRAY_ARRAY_00450f84[0x15][2] = 1; null_ARRAY_ARRAY_00450f84[0x15][0] = 0x1a6; null_ARRAY_ARRAY_00450f84[0x15][1] = 0x6f; null_ARRAY_ARRAY_00450f84[0x16][3] = 0; null_ARRAY_ARRAY_00450f84[0x16][2] = 1; null_ARRAY_ARRAY_00450f84[0x16][0] = 0x1a6; null_ARRAY_ARRAY_00450f84[0x16][1] = 0x94; null_ARRAY_ARRAY_00450f84[0x17][3] = 0; null_ARRAY_ARRAY_00450f84[0x17][2] = 1; null_ARRAY_ARRAY_00450f84[0x17][0] = 0x1a6; null_ARRAY_ARRAY_00450f84[0x17][1] = 0xb9; break; case 0x1b: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 1; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x114; null_ARRAY_ARRAY_00450f84[0][1] = 0x5c; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x114; null_ARRAY_ARRAY_00450f84[1][1] = 0x4b; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0xef; null_ARRAY_ARRAY_00450f84[2][1] = 0x4b; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0xca; null_ARRAY_ARRAY_00450f84[3][1] = 0x4b; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0x139; null_ARRAY_ARRAY_00450f84[4][1] = 0x4b; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 0; null_ARRAY_ARRAY_00450f84[5][0] = 0x15e; null_ARRAY_ARRAY_00450f84[5][1] = 0x4b; null_ARRAY_ARRAY_00450f84[6][3] = 1; null_ARRAY_ARRAY_00450f84[6][2] = 1; null_ARRAY_ARRAY_00450f84[6][0] = 0x82; null_ARRAY_ARRAY_00450f84[6][1] = 0x4b; null_ARRAY_ARRAY_00450f84[7][3] = 1; null_ARRAY_ARRAY_00450f84[7][2] = 3; null_ARRAY_ARRAY_00450f84[7][0] = 0x1a1; null_ARRAY_ARRAY_00450f84[7][1] = 0x4b; null_ARRAY_ARRAY_00450f84[8][3] = 1; null_ARRAY_ARRAY_00450f84[8][2] = 3; null_ARRAY_ARRAY_00450f84[8][0] = 0xac; null_ARRAY_ARRAY_00450f84[8][1] = 0x5f; null_ARRAY_ARRAY_00450f84[9][3] = 1; null_ARRAY_ARRAY_00450f84[9][2] = 1; null_ARRAY_ARRAY_00450f84[9][0] = 0x177; null_ARRAY_ARRAY_00450f84[9][1] = 0x5f; null_ARRAY_ARRAY_00450f84[10][3] = 0; null_ARRAY_ARRAY_00450f84[10][2] = 1; null_ARRAY_ARRAY_00450f84[10][0] = 0x7d; null_ARRAY_ARRAY_00450f84[10][1] = 0x73; null_ARRAY_ARRAY_00450f84[0xb][3] = 0; null_ARRAY_ARRAY_00450f84[0xb][2] = 1; null_ARRAY_ARRAY_00450f84[0xb][0] = 0x7d; null_ARRAY_ARRAY_00450f84[0xb][1] = 0x98; null_ARRAY_ARRAY_00450f84[0xc][3] = 0; null_ARRAY_ARRAY_00450f84[0xc][2] = 1; null_ARRAY_ARRAY_00450f84[0xc][0] = 0x1bf; null_ARRAY_ARRAY_00450f84[0xc][1] = 0x73; null_ARRAY_ARRAY_00450f84[0xd][3] = 0; null_ARRAY_ARRAY_00450f84[0xd][2] = 1; null_ARRAY_ARRAY_00450f84[0xd][0] = 0x1bf; null_ARRAY_ARRAY_00450f84[0xd][1] = 0x98; null_ARRAY_ARRAY_00450f84[0xe][3] = 1; null_ARRAY_ARRAY_00450f84[0xe][2] = 3; null_ARRAY_ARRAY_00450f84[0xe][0] = 0xac; null_ARRAY_ARRAY_00450f84[0xe][1] = 0xab; null_ARRAY_ARRAY_00450f84[0xf][3] = 1; null_ARRAY_ARRAY_00450f84[0xf][2] = 1; null_ARRAY_ARRAY_00450f84[0xf][0] = 0x82; null_ARRAY_ARRAY_00450f84[0xf][1] = 0xbf; null_ARRAY_ARRAY_00450f84[0x10][3] = 0; null_ARRAY_ARRAY_00450f84[0x10][2] = 0; null_ARRAY_ARRAY_00450f84[0x10][0] = 0xca; null_ARRAY_ARRAY_00450f84[0x10][1] = 0xd2; null_ARRAY_ARRAY_00450f84[0x11][3] = 0; null_ARRAY_ARRAY_00450f84[0x11][2] = 0; null_ARRAY_ARRAY_00450f84[0x11][0] = 0xef; null_ARRAY_ARRAY_00450f84[0x11][1] = 0xd2; null_ARRAY_ARRAY_00450f84[0x12][3] = 0; null_ARRAY_ARRAY_00450f84[0x12][2] = 0; null_ARRAY_ARRAY_00450f84[0x12][0] = 0x114; null_ARRAY_ARRAY_00450f84[0x12][1] = 0xd2; null_ARRAY_ARRAY_00450f84[0x13][3] = 0; null_ARRAY_ARRAY_00450f84[0x13][2] = 0; null_ARRAY_ARRAY_00450f84[0x13][0] = 0x139; null_ARRAY_ARRAY_00450f84[0x13][1] = 0xd2; null_ARRAY_ARRAY_00450f84[0x14][3] = 0; null_ARRAY_ARRAY_00450f84[0x14][2] = 0; null_ARRAY_ARRAY_00450f84[0x14][0] = 0x15e; null_ARRAY_ARRAY_00450f84[0x14][1] = 0xd2; null_ARRAY_ARRAY_00450f84[0x15][3] = 1; null_ARRAY_ARRAY_00450f84[0x15][2] = 1; null_ARRAY_ARRAY_00450f84[0x15][0] = 0x177; null_ARRAY_ARRAY_00450f84[0x15][1] = 0xab; null_ARRAY_ARRAY_00450f84[0x16][3] = 1; null_ARRAY_ARRAY_00450f84[0x16][2] = 3; null_ARRAY_ARRAY_00450f84[0x16][0] = 0x1a1; null_ARRAY_ARRAY_00450f84[0x16][1] = 0xbf; break; case 0x1c: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 0; null_ARRAY_ARRAY_00450f84[0][2] = 0; null_ARRAY_ARRAY_00450f84[0][0] = 0x118; null_ARRAY_ARRAY_00450f84[0][1] = 0x69; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x107; null_ARRAY_ARRAY_00450f84[1][1] = 0x7a; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 300; null_ARRAY_ARRAY_00450f84[2][1] = 0x7a; null_ARRAY_ARRAY_00450f84[3][3] = 1; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0xf3; null_ARRAY_ARRAY_00450f84[3][1] = 0x8a; null_ARRAY_ARRAY_00450f84[4][3] = 1; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0x140; null_ARRAY_ARRAY_00450f84[4][1] = 0x8b; null_ARRAY_ARRAY_00450f84[5][3] = 1; null_ARRAY_ARRAY_00450f84[5][2] = 2; null_ARRAY_ARRAY_00450f84[5][0] = 0xdf; null_ARRAY_ARRAY_00450f84[5][1] = 0x60; null_ARRAY_ARRAY_00450f84[6][3] = 1; null_ARRAY_ARRAY_00450f84[6][2] = 2; null_ARRAY_ARRAY_00450f84[6][0] = 0x154; null_ARRAY_ARRAY_00450f84[6][1] = 0x61; null_ARRAY_ARRAY_00450f84[7][3] = 0; null_ARRAY_ARRAY_00450f84[7][2] = 1; null_ARRAY_ARRAY_00450f84[7][0] = 0xdf; null_ARRAY_ARRAY_00450f84[7][1] = 0x8a; null_ARRAY_ARRAY_00450f84[8][3] = 0; null_ARRAY_ARRAY_00450f84[8][2] = 1; null_ARRAY_ARRAY_00450f84[8][0] = 0xdf; null_ARRAY_ARRAY_00450f84[8][1] = 0xaf; null_ARRAY_ARRAY_00450f84[9][3] = 1; null_ARRAY_ARRAY_00450f84[9][2] = 0; null_ARRAY_ARRAY_00450f84[9][0] = 0xcb; null_ARRAY_ARRAY_00450f84[9][1] = 0xd4; null_ARRAY_ARRAY_00450f84[10][3] = 1; null_ARRAY_ARRAY_00450f84[10][2] = 0; null_ARRAY_ARRAY_00450f84[10][0] = 0xf0; null_ARRAY_ARRAY_00450f84[10][1] = 0xd4; null_ARRAY_ARRAY_00450f84[0xb][3] = 1; null_ARRAY_ARRAY_00450f84[0xb][2] = 0; null_ARRAY_ARRAY_00450f84[0xb][0] = 0xa6; null_ARRAY_ARRAY_00450f84[0xb][1] = 0xd4; null_ARRAY_ARRAY_00450f84[0xc][3] = 0; null_ARRAY_ARRAY_00450f84[0xc][2] = 1; null_ARRAY_ARRAY_00450f84[0xc][0] = 0xa6; null_ARRAY_ARRAY_00450f84[0xc][1] = 0xaf; null_ARRAY_ARRAY_00450f84[0xd][3] = 0; null_ARRAY_ARRAY_00450f84[0xd][2] = 1; null_ARRAY_ARRAY_00450f84[0xd][0] = 0xa6; null_ARRAY_ARRAY_00450f84[0xd][1] = 0x8a; null_ARRAY_ARRAY_00450f84[0xe][3] = 0; null_ARRAY_ARRAY_00450f84[0xe][2] = 0; null_ARRAY_ARRAY_00450f84[0xe][0] = 0x92; null_ARRAY_ARRAY_00450f84[0xe][1] = 0x79; null_ARRAY_ARRAY_00450f84[0xf][3] = 0; null_ARRAY_ARRAY_00450f84[0xf][2] = 1; null_ARRAY_ARRAY_00450f84[0xf][0] = 0x168; null_ARRAY_ARRAY_00450f84[0xf][1] = 0x8b; null_ARRAY_ARRAY_00450f84[0x10][3] = 0; null_ARRAY_ARRAY_00450f84[0x10][2] = 1; null_ARRAY_ARRAY_00450f84[0x10][0] = 0x168; null_ARRAY_ARRAY_00450f84[0x10][1] = 0xb0; null_ARRAY_ARRAY_00450f84[0x11][3] = 1; null_ARRAY_ARRAY_00450f84[0x11][2] = 0; null_ARRAY_ARRAY_00450f84[0x11][0] = 0x168; null_ARRAY_ARRAY_00450f84[0x11][1] = 0xd5; null_ARRAY_ARRAY_00450f84[0x12][3] = 1; null_ARRAY_ARRAY_00450f84[0x12][2] = 0; null_ARRAY_ARRAY_00450f84[0x12][0] = 0x18d; null_ARRAY_ARRAY_00450f84[0x12][1] = 0xd5; null_ARRAY_ARRAY_00450f84[0x13][3] = 1; null_ARRAY_ARRAY_00450f84[0x13][2] = 0; null_ARRAY_ARRAY_00450f84[0x13][0] = 0x143; null_ARRAY_ARRAY_00450f84[0x13][1] = 0xd5; null_ARRAY_ARRAY_00450f84[0x14][3] = 0; null_ARRAY_ARRAY_00450f84[0x14][2] = 1; null_ARRAY_ARRAY_00450f84[0x14][0] = 0x1a1; null_ARRAY_ARRAY_00450f84[0x14][1] = 0xb0; null_ARRAY_ARRAY_00450f84[0x15][3] = 0; null_ARRAY_ARRAY_00450f84[0x15][2] = 1; null_ARRAY_ARRAY_00450f84[0x15][0] = 0x1a1; null_ARRAY_ARRAY_00450f84[0x15][1] = 0x8b; null_ARRAY_ARRAY_00450f84[0x16][3] = 0; null_ARRAY_ARRAY_00450f84[0x16][2] = 0; null_ARRAY_ARRAY_00450f84[0x16][0] = 0x1a1; null_ARRAY_ARRAY_00450f84[0x16][1] = 0x7a; break; case 0x1d: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 1; null_ARRAY_ARRAY_00450f84[0][2] = 2; null_ARRAY_ARRAY_00450f84[0][0] = 0x116; null_ARRAY_ARRAY_00450f84[0][1] = 0x8a; null_ARRAY_ARRAY_00450f84[1][3] = 0; null_ARRAY_ARRAY_00450f84[1][2] = 0; null_ARRAY_ARRAY_00450f84[1][0] = 0x116; null_ARRAY_ARRAY_00450f84[1][1] = 0xb4; null_ARRAY_ARRAY_00450f84[2][3] = 0; null_ARRAY_ARRAY_00450f84[2][2] = 1; null_ARRAY_ARRAY_00450f84[2][0] = 0x118; null_ARRAY_ARRAY_00450f84[2][1] = 0xc5; null_ARRAY_ARRAY_00450f84[3][3] = 0; null_ARRAY_ARRAY_00450f84[3][2] = 1; null_ARRAY_ARRAY_00450f84[3][0] = 0x129; null_ARRAY_ARRAY_00450f84[3][1] = 0xc5; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 0; null_ARRAY_ARRAY_00450f84[4][0] = 0xf3; null_ARRAY_ARRAY_00450f84[4][1] = 0xd9; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 0; null_ARRAY_ARRAY_00450f84[5][0] = 0x13a; null_ARRAY_ARRAY_00450f84[5][1] = 0xd9; null_ARRAY_ARRAY_00450f84[6][3] = 0; null_ARRAY_ARRAY_00450f84[6][2] = 0; null_ARRAY_ARRAY_00450f84[6][0] = 0xce; null_ARRAY_ARRAY_00450f84[6][1] = 0xd9; null_ARRAY_ARRAY_00450f84[7][3] = 0; null_ARRAY_ARRAY_00450f84[7][2] = 0; null_ARRAY_ARRAY_00450f84[7][0] = 0x15f; null_ARRAY_ARRAY_00450f84[7][1] = 0xd9; null_ARRAY_ARRAY_00450f84[8][3] = 1; null_ARRAY_ARRAY_00450f84[8][2] = 1; null_ARRAY_ARRAY_00450f84[8][0] = 0xa5; null_ARRAY_ARRAY_00450f84[8][1] = 0xc5; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 1; null_ARRAY_ARRAY_00450f84[9][0] = 0xcf; null_ARRAY_ARRAY_00450f84[9][1] = 0xb1; null_ARRAY_ARRAY_00450f84[10][3] = 1; null_ARRAY_ARRAY_00450f84[10][2] = 3; null_ARRAY_ARRAY_00450f84[10][0] = 0x184; null_ARRAY_ARRAY_00450f84[10][1] = 0xc5; null_ARRAY_ARRAY_00450f84[0xb][3] = 0; null_ARRAY_ARRAY_00450f84[0xb][2] = 1; null_ARRAY_ARRAY_00450f84[0xb][0] = 0x173; null_ARRAY_ARRAY_00450f84[0xb][1] = 0xb1; null_ARRAY_ARRAY_00450f84[0xc][3] = 0; null_ARRAY_ARRAY_00450f84[0xc][2] = 1; null_ARRAY_ARRAY_00450f84[0xc][0] = 0xcf; null_ARRAY_ARRAY_00450f84[0xc][1] = 0x8c; null_ARRAY_ARRAY_00450f84[0xd][3] = 0; null_ARRAY_ARRAY_00450f84[0xd][2] = 1; null_ARRAY_ARRAY_00450f84[0xd][0] = 0x173; null_ARRAY_ARRAY_00450f84[0xd][1] = 0x8c; null_ARRAY_ARRAY_00450f84[0xe][3] = 0; null_ARRAY_ARRAY_00450f84[0xe][2] = 1; null_ARRAY_ARRAY_00450f84[0xe][0] = 0xcf; null_ARRAY_ARRAY_00450f84[0xe][1] = 0x67; null_ARRAY_ARRAY_00450f84[0xf][3] = 0; null_ARRAY_ARRAY_00450f84[0xf][2] = 1; null_ARRAY_ARRAY_00450f84[0xf][0] = 0x173; null_ARRAY_ARRAY_00450f84[0xf][1] = 0x67; null_ARRAY_ARRAY_00450f84[0x10][3] = 1; null_ARRAY_ARRAY_00450f84[0x10][2] = 1; null_ARRAY_ARRAY_00450f84[0x10][0] = 0xa5; null_ARRAY_ARRAY_00450f84[0x10][1] = 0x53; null_ARRAY_ARRAY_00450f84[0x11][3] = 1; null_ARRAY_ARRAY_00450f84[0x11][2] = 3; null_ARRAY_ARRAY_00450f84[0x11][0] = 0x184; null_ARRAY_ARRAY_00450f84[0x11][1] = 0x53; null_ARRAY_ARRAY_00450f84[0x12][3] = 0; null_ARRAY_ARRAY_00450f84[0x12][2] = 0; null_ARRAY_ARRAY_00450f84[0x12][0] = 0xcf; null_ARRAY_ARRAY_00450f84[0x12][1] = 0x53; null_ARRAY_ARRAY_00450f84[0x13][3] = 0; null_ARRAY_ARRAY_00450f84[0x13][2] = 0; null_ARRAY_ARRAY_00450f84[0x13][0] = 0xf4; null_ARRAY_ARRAY_00450f84[0x13][1] = 0x53; null_ARRAY_ARRAY_00450f84[0x14][3] = 0; null_ARRAY_ARRAY_00450f84[0x14][2] = 0; null_ARRAY_ARRAY_00450f84[0x14][0] = 0x15f; null_ARRAY_ARRAY_00450f84[0x14][1] = 0x53; null_ARRAY_ARRAY_00450f84[0x15][3] = 0; null_ARRAY_ARRAY_00450f84[0x15][2] = 0; null_ARRAY_ARRAY_00450f84[0x15][0] = 0x13a; null_ARRAY_ARRAY_00450f84[0x15][1] = 0x53; null_ARRAY_ARRAY_00450f84[0x16][3] = 0; null_ARRAY_ARRAY_00450f84[0x16][2] = 1; null_ARRAY_ARRAY_00450f84[0x16][0] = 0x119; null_ARRAY_ARRAY_00450f84[0x16][1] = 0x53; null_ARRAY_ARRAY_00450f84[0x17][3] = 0; null_ARRAY_ARRAY_00450f84[0x17][2] = 1; null_ARRAY_ARRAY_00450f84[0x17][0] = 0x12a; null_ARRAY_ARRAY_00450f84[0x17][1] = 0x53; null_ARRAY_ARRAY_00450f84[0x18][3] = 0; null_ARRAY_ARRAY_00450f84[0x18][2] = 0; null_ARRAY_ARRAY_00450f84[0x18][0] = 0x117; null_ARRAY_ARRAY_00450f84[0x18][1] = 0x78; break; case 0x1e: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ce[0] = 0x32cd; SHORT_ARRAY_004514ce[1] = 0x32ce; SHORT_ARRAY_004514ce[2] = 0x32cf; SHORT_ARRAY_004514ce[3] = 0x32d0; SHORT_ARRAY_004514ce[4] = 0x32d1; SHORT_ARRAY_004514ce[5] = 0x32d2; SHORT_ARRAY_004514ce[6] = -1; SHORT_ARRAY_004514ec[0] = 0x32cb; null_ARRAY_ARRAY_00450f84[0][3] = 1; null_ARRAY_ARRAY_00450f84[0][2] = 2; null_ARRAY_ARRAY_00450f84[0][0] = 0x105; null_ARRAY_ARRAY_00450f84[0][1] = 0xae; null_ARRAY_ARRAY_00450f84[1][3] = 1; null_ARRAY_ARRAY_00450f84[1][2] = 2; null_ARRAY_ARRAY_00450f84[1][0] = 0x12a; null_ARRAY_ARRAY_00450f84[1][1] = 0xae; null_ARRAY_ARRAY_00450f84[2][3] = 1; null_ARRAY_ARRAY_00450f84[2][2] = 0; null_ARRAY_ARRAY_00450f84[2][0] = 0x105; null_ARRAY_ARRAY_00450f84[2][1] = 0xd8; null_ARRAY_ARRAY_00450f84[3][3] = 1; null_ARRAY_ARRAY_00450f84[3][2] = 0; null_ARRAY_ARRAY_00450f84[3][0] = 0x12a; null_ARRAY_ARRAY_00450f84[3][1] = 0xd8; null_ARRAY_ARRAY_00450f84[4][3] = 0; null_ARRAY_ARRAY_00450f84[4][2] = 1; null_ARRAY_ARRAY_00450f84[4][0] = 0xf4; null_ARRAY_ARRAY_00450f84[4][1] = 199; null_ARRAY_ARRAY_00450f84[5][3] = 0; null_ARRAY_ARRAY_00450f84[5][2] = 1; null_ARRAY_ARRAY_00450f84[5][0] = 0xe3; null_ARRAY_ARRAY_00450f84[5][1] = 199; null_ARRAY_ARRAY_00450f84[6][3] = 0; null_ARRAY_ARRAY_00450f84[6][2] = 1; null_ARRAY_ARRAY_00450f84[6][0] = 0x14f; null_ARRAY_ARRAY_00450f84[6][1] = 199; null_ARRAY_ARRAY_00450f84[7][3] = 0; null_ARRAY_ARRAY_00450f84[7][2] = 1; null_ARRAY_ARRAY_00450f84[7][0] = 0x160; null_ARRAY_ARRAY_00450f84[7][1] = 199; null_ARRAY_ARRAY_00450f84[8][3] = 0; null_ARRAY_ARRAY_00450f84[8][2] = 0; null_ARRAY_ARRAY_00450f84[8][0] = 0xcf; null_ARRAY_ARRAY_00450f84[8][1] = 0xb6; null_ARRAY_ARRAY_00450f84[9][3] = 0; null_ARRAY_ARRAY_00450f84[9][2] = 0; null_ARRAY_ARRAY_00450f84[9][0] = 0x15f; null_ARRAY_ARRAY_00450f84[9][1] = 0xb6; null_ARRAY_ARRAY_00450f84[10][3] = 1; null_ARRAY_ARRAY_00450f84[10][2] = 1; null_ARRAY_ARRAY_00450f84[10][0] = 0xb9; null_ARRAY_ARRAY_00450f84[10][1] = 0x91; null_ARRAY_ARRAY_00450f84[0xb][3] = 0; null_ARRAY_ARRAY_00450f84[0xb][2] = 0; null_ARRAY_ARRAY_00450f84[0xb][0] = 0xce; null_ARRAY_ARRAY_00450f84[0xb][1] = 0x80; null_ARRAY_ARRAY_00450f84[0xc][3] = 0; null_ARRAY_ARRAY_00450f84[0xc][2] = 1; null_ARRAY_ARRAY_00450f84[0xc][0] = 0xe2; null_ARRAY_ARRAY_00450f84[0xc][1] = 0x5b; null_ARRAY_ARRAY_00450f84[0xd][3] = 0; null_ARRAY_ARRAY_00450f84[0xd][2] = 1; null_ARRAY_ARRAY_00450f84[0xd][0] = 0xf3; null_ARRAY_ARRAY_00450f84[0xd][1] = 0x5b; null_ARRAY_ARRAY_00450f84[0xe][3] = 1; null_ARRAY_ARRAY_00450f84[0xe][2] = 0; null_ARRAY_ARRAY_00450f84[0xe][0] = 0x104; null_ARRAY_ARRAY_00450f84[0xe][1] = 0x6d; null_ARRAY_ARRAY_00450f84[0xf][3] = 1; null_ARRAY_ARRAY_00450f84[0xf][2] = 0; null_ARRAY_ARRAY_00450f84[0xf][0] = 0x129; null_ARRAY_ARRAY_00450f84[0xf][1] = 0x6d; null_ARRAY_ARRAY_00450f84[0x10][3] = 1; null_ARRAY_ARRAY_00450f84[0x10][2] = 2; null_ARRAY_ARRAY_00450f84[0x10][0] = 0x104; null_ARRAY_ARRAY_00450f84[0x10][1] = 0x43; null_ARRAY_ARRAY_00450f84[0x11][3] = 1; null_ARRAY_ARRAY_00450f84[0x11][2] = 2; null_ARRAY_ARRAY_00450f84[0x11][0] = 0x129; null_ARRAY_ARRAY_00450f84[0x11][1] = 0x43; null_ARRAY_ARRAY_00450f84[0x12][3] = 0; null_ARRAY_ARRAY_00450f84[0x12][2] = 1; null_ARRAY_ARRAY_00450f84[0x12][0] = 0x14e; null_ARRAY_ARRAY_00450f84[0x12][1] = 0x5b; null_ARRAY_ARRAY_00450f84[0x13][3] = 0; null_ARRAY_ARRAY_00450f84[0x13][2] = 1; null_ARRAY_ARRAY_00450f84[0x13][0] = 0x15f; null_ARRAY_ARRAY_00450f84[0x13][1] = 0x5b; null_ARRAY_ARRAY_00450f84[0x14][3] = 0; null_ARRAY_ARRAY_00450f84[0x14][2] = 0; null_ARRAY_ARRAY_00450f84[0x14][0] = 0x15f; null_ARRAY_ARRAY_00450f84[0x14][1] = 0x80; null_ARRAY_ARRAY_00450f84[0x15][3] = 1; null_ARRAY_ARRAY_00450f84[0x15][2] = 3; null_ARRAY_ARRAY_00450f84[0x15][0] = 0x170; null_ARRAY_ARRAY_00450f84[0x15][1] = 0x91; } DAT_004514c2 = 13000; DAT_004514c4 = 0x32d9; DAT_004514b4 = load_resource_item_0(13000,(int *)&text); return; } void __cdecl FUN_00429c14(short param_1) { short unaff_BX; if (param_1 == 0) { unaff_BX = 8; } else if (param_1 == 1) { unaff_BX = 4; } else if (param_1 == 2) { unaff_BX = 0; } DAT_004510cc = param_1; DAT_004510d0 = 0; DAT_0044a8d0 = 3; clear_cursor_override_regions(); DAT_00451158 = PTR_ARRAY_00451124[unaff_BX]; set_custom_cursor((undefined4 *)PTR_ARRAY_00451124[unaff_BX]); play_wave_flag1(0x1f73,5,0); null_ARRAY_0044a8c8[DAT_004510cc] = null_ARRAY_0044a8c8[DAT_004510cc] + -1; FUN_00426be8(); FUN_0042683f(); return; } void __stdcall FUN_00429ca1(void) { undefined4 *puVar1; short sVar2; short sVar3; int aiStack_a4 [40]; sVar2 = 0; do { if (null_ARRAY_ARRAY_00450f84[sVar2][3] != -1) { if (null_ARRAY_ARRAY_00450f84[sVar2][3] == 0) { sVar3 = 0x32e3; } else { sVar3 = 0x32df; } puVar1 = load_aseq(sVar3 + null_ARRAY_ARRAY_00450f84[sVar2][2]); aiStack_a4[sVar2] = (int)puVar1; anim_state_xxx_list_insert_8004((undefined4 *)aiStack_a4[sVar2]); aseq_set_pos_order(aiStack_a4[sVar2],null_ARRAY_ARRAY_00450f84[sVar2][0], null_ARRAY_ARRAY_00450f84[sVar2][1],1); } sVar2 = sVar2 + 1; } while (sVar2 < 0x28); anim_engine_important_core(); sVar2 = 0; do { if (null_ARRAY_ARRAY_00450f84[sVar2][3] != -1) { free_aseq((int *)aiStack_a4[sVar2]); } sVar2 = sVar2 + 1; } while (sVar2 < 0x28); return; } void FUN_00429d59(short param_1) { short sVar1; DAT_004510d0 = DAT_004510d0 + 1; if (3 < DAT_004510d0) { DAT_004510d0 = 0; } if (DAT_004510cc == 0) { sVar1 = DAT_004510d0 + 8; } else if (DAT_004510cc == 1) { sVar1 = DAT_004510d0 + 4; } else { sVar1 = DAT_004510d0; if (DAT_004510cc != 2) { sVar1 = param_1; } } DAT_00451158 = PTR_ARRAY_00451124[sVar1]; set_custom_cursor((undefined4 *)PTR_ARRAY_00451124[sVar1]); play_wave_flag1(0x1f4e,5,0); return; } void __stdcall FUN_00429ddd(void) { short sVar1; undefined4 uVar2; undefined4 uVar3; undefined4 uVar4; undefined4 *puVar5; short sVar6; short local_a; short local_8; uVar2 = aseq_get_img_w(*(int *)(DAT_00451158 + 0x1e),0); uVar3 = aseq_get_img_h(*(int *)(DAT_00451158 + 0x1e),0); if ((((0x6f < DAT_004510ea) && (0x2b < DAT_004510ec)) && ((int)DAT_004510ea + (int)(short)((short)uVar2 + 4) < 0x1ee)) && ((int)DAT_004510ec + (int)(short)((short)uVar3 + 4) < 0x123)) { uVar2 = aseq_get_img_w(*(int *)(DAT_00451158 + 0x1e),0); uVar3 = aseq_get_img_h(*(int *)(DAT_00451158 + 0x1e),0); sVar6 = 0; do { if (cordcode_list[sVar6].type != -1) { uVar4 = aseq_get_img_h(*(int *)&cordcode_list[sVar6].field_0x12,0); sVar1 = (short)uVar4 + -3; uVar4 = aseq_get_img_w(*(int *)&cordcode_list[sVar6].field_0x12,0); uVar4 = FUN_0042a1a3(DAT_004510ea,DAT_004510ec,(short)uVar2 + -3,(short)uVar3 + -3, cordcode_list[sVar6].x,cordcode_list[sVar6].y,(short)uVar4 + -3,sVar1); if ((short)uVar4 != 0) { return; } } sVar6 = sVar6 + 1; } while (sVar6 < 0x1e); sVar6 = 0; do { if (cordcode_list[sVar6].type == -1) break; sVar6 = sVar6 + 1; } while (sVar6 < 0x1e); if (sVar6 < 0x1e) { if (DAT_004510cc == 0) { local_8 = DAT_004510d0 + 0x32d3; local_a = DAT_004510d0 + 0x32db; } else if (DAT_004510cc == 1) { local_8 = DAT_004510d0 + 0x32cf; local_a = DAT_004510d0 + 0x32d7; } else if (DAT_004510cc == 2) { local_8 = DAT_004510d0 + 0x32cb; local_a = DAT_004510d0 + 0x32d7; } FUN_0042a313(); puVar5 = load_aseq(local_8); *(undefined4 **)&cordcode_list[sVar6].field_0x12 = puVar5; puVar5 = load_aseq(local_a); *(undefined4 **)&cordcode_list[sVar6].field_0x16 = puVar5; cordcode_list[sVar6].type = DAT_004510cc; cordcode_list[sVar6].rot = DAT_004510d0; cordcode_list[sVar6].x = DAT_004510ea; cordcode_list[sVar6].y = DAT_004510ec; anim_state_xxx_list_insert_8004(*(undefined4 **)&cordcode_list[sVar6].field_0x12); anim_state_xxx_list_insert_8004(*(undefined4 **)&cordcode_list[sVar6].field_0x16); aseq_set_pos_order(*(int *)&cordcode_list[sVar6].field_0x12,cordcode_list[sVar6].x, cordcode_list[sVar6].y,5); aseq_set_pos_order(*(int *)&cordcode_list[sVar6].field_0x16,cordcode_list[sVar6].x + 4, cordcode_list[sVar6].y + 4,4); DAT_004510cc = -1; DAT_00451190 = 1; FUN_0042a13e(); } } return; } void __stdcall FUN_0042a13e(void) { short sVar1; DAT_004510de = 0; DAT_004510dc = 1; sVar1 = 0; do { *(undefined2 *)&cordcode_list[sVar1].field_0xe = 0; *(undefined2 *)&cordcode_list[sVar1].field_0xa = 0; *(undefined2 *)&cordcode_list[sVar1].field_0xc = 0; sVar1 = sVar1 + 1; } while (sVar1 < 0x1e); DAT_0044a8d0 = 5; return; } undefined4 __cdecl FUN_0042a1a3(short param_1,short param_2,short param_3,short param_4,short param_5,short param_6, short param_7,short param_8) { bool bVar1; bool bVar2; int iVar3; undefined4 uVar4; bVar1 = false; if (param_7 < param_3) { if ((param_1 <= param_5) && ((int)param_5 < (int)param_1 + (int)param_3)) { bVar1 = true; } if (((int)param_1 < (int)param_5 + (int)param_7) && ((int)param_5 + (int)param_7 <= (int)param_1 + (int)param_3)) { bVar1 = true; } } else { if ((param_5 <= param_1) && ((int)param_1 < (int)param_5 + (int)param_7)) { bVar1 = true; } if (((int)param_5 < (int)param_1 + (int)param_3) && ((int)param_1 + (int)param_3 <= (int)param_5 + (int)param_7)) { bVar1 = true; } } bVar2 = false; if (param_8 < param_4) { if ((param_2 <= param_6) && ((int)param_6 < (int)param_2 + (int)param_4)) { bVar2 = true; } iVar3 = (int)param_6 + (int)param_8; if ((param_2 < iVar3) && (iVar3 = (int)param_6 + (int)param_8, iVar3 <= (int)param_2 + (int)param_4)) { bVar2 = true; } } else { if ((param_6 <= param_2) && ((int)param_2 < (int)param_6 + (int)param_8)) { bVar2 = true; } iVar3 = (int)param_2 + (int)param_4; if ((param_6 < iVar3) && (iVar3 = (int)param_2 + (int)param_4, iVar3 <= (int)param_6 + (int)param_8)) { bVar2 = true; } } if ((bVar1) && (bVar2)) { uVar4 = CONCAT22((short)((uint)iVar3 >> 0x10),1); } else { uVar4 = 0; } return uVar4; } void __stdcall FUN_0042a313(void) { clear_cursor_override_regions(); play_wave_flag1(0x1f74,5,0); return; } void __cdecl FUN_0042a32e(short param_1) { undefined4 uVar1; short unaff_SI; short sVar2; play_wave_flag1(0x1f73,5,0); DAT_004510cc = cordcode_list[param_1].type; DAT_004510d0 = cordcode_list[param_1].rot; if (DAT_004510cc == 0) { sVar2 = DAT_004510d0 + 8; } else if (DAT_004510cc == 1) { sVar2 = DAT_004510d0 + 4; } else { sVar2 = DAT_004510d0; if (DAT_004510cc != 2) { sVar2 = unaff_SI; } } clear_cursor_override_regions(); DAT_00451158 = PTR_ARRAY_00451124[sVar2]; set_custom_cursor((undefined4 *)DAT_00451158); cordcode_list[param_1].type = -1; DAT_0044a8d0 = 3; uVar1 = free_aseq(*(int **)&cordcode_list[param_1].field_0x12); *(undefined4 *)&cordcode_list[param_1].field_0x12 = uVar1; uVar1 = free_aseq(*(int **)&cordcode_list[param_1].field_0x16); *(undefined4 *)&cordcode_list[param_1].field_0x16 = uVar1; DAT_00451190 = 3; FUN_0042a13e(); return; } void __stdcall FUN_0042a448(void) { undefined4 uVar1; short sVar2; sVar2 = 0; do { *(undefined2 *)&cordcode_list[sVar2].field_0x8 = 0; sVar2 = sVar2 + 1; } while (sVar2 < 0x1e); while (uVar1 = FUN_0042b72d(), (short)uVar1 == 0) { sVar2 = 0; do { if (((cordcode_list[sVar2].type != -1) && (*(short *)&cordcode_list[sVar2].field_0x8 == 0)) && (uVar1 = FUN_0042b76d(sVar2), (short)uVar1 != 0)) { anim_state_xxx_list_remove(*(int **)&cordcode_list[sVar2].field_0x12); anim_state_xxx_list_insert_8004(*(undefined4 **)&cordcode_list[sVar2].field_0x12); aseq_set_pos_order(*(int *)&cordcode_list[sVar2].field_0x12,cordcode_list[sVar2].x, cordcode_list[sVar2].y,5); aseq_set_pos_order(*(int *)&cordcode_list[sVar2].field_0x16,cordcode_list[sVar2].x + 4, cordcode_list[sVar2].y + 4,4); aseq_anim_mark_all_drawn_invalidated(*(int *)&cordcode_list[sVar2].field_0x16); *(undefined2 *)&cordcode_list[sVar2].field_0x8 = 1; } sVar2 = sVar2 + 1; } while (sVar2 < 0x1e); } return; } void __cdecl FUN_0042a5aa(short param_1) { short sVar1; short sVar2; short sVar3; sVar1 = cordcode_list[param_1].type * 4 + cordcode_list[param_1].rot; sVar3 = 0; do { if ((&DAT_0044a7c0)[sVar3 * 2 + sVar1 * 0xc] != -1) { sVar2 = 0; do { if (*(short *)&cordcode_list[param_1].field_0xe != 0) break; if ((cordcode_list[sVar2].type != -1) && (param_1 != sVar2)) { FUN_0042b140((ushort)(sVar3 < 3), cordcode_list[param_1].x + (short)(char)(&DAT_0044a7c0)[sVar3 * 2 + sVar1 * 0xc], cordcode_list[param_1].y + (short)(char)(&DAT_0044a7c1)[sVar3 * 2 + sVar1 * 0xc],param_1,sVar2); } sVar2 = sVar2 + 1; } while (sVar2 < 0x1e); } sVar3 = sVar3 + 1; if (5 < sVar3) { return; } } while( true ); } undefined2 __cdecl FUN_0042a6cc(short param_1) { bool bVar1; undefined2 uVar2; undefined4 uVar3; uint uVar4; uint uVar5; short sVar6; short sVar7; uVar2 = 0; sVar6 = 0; do { uVar4 = (int)*(short *)&cordcode_list[sVar6].field_0xa >> 0x1f; if ((int)(((int)*(short *)&cordcode_list[sVar6].field_0xa ^ uVar4) - uVar4) < 0x201) { uVar4 = (int)*(short *)&cordcode_list[sVar6].field_0xa >> 0x1f; if (0x40 < (int)(((int)*(short *)&cordcode_list[sVar6].field_0xa ^ uVar4) - uVar4)) { uVar4 = (int)param_1 & 0x80000001; if ((int)uVar4 < 0) { uVar4 = (uVar4 - 1 | 0xfffffffe) + 1; } if (uVar4 != 0) goto LAB_0042a751; } uVar5 = (int)*(short *)&cordcode_list[sVar6].field_0xa >> 0x1f; uVar4 = (int)*(short *)&cordcode_list[sVar6].field_0xa ^ uVar5; if ((uVar4 != uVar5 && -1 < (int)(uVar4 - uVar5)) && (param_1 == 1)) goto LAB_0042a751; bVar1 = false; } else { LAB_0042a751: bVar1 = true; } if (cordcode_list[sVar6].type != -1) { if ((bVar1) && (*(short *)&cordcode_list[sVar6].field_0xe == 0)) { uVar3 = FUN_0042aa73(sVar6); if ((short)uVar3 != 0) goto LAB_0042a792; } else { LAB_0042a792: uVar3 = FUN_0042ac84(sVar6,1); if ((short)uVar3 == 0) goto LAB_0042a805; } sVar7 = -1; if (-1 < *(short *)&cordcode_list[sVar6].field_0xa) { sVar7 = 1; } cordcode_list[sVar6].x = cordcode_list[sVar6].x + sVar7; uVar3 = FUN_0042a94a(sVar6); if ((short)uVar3 == 0) { uVar2 = 1; } else { cordcode_list[sVar6].x = cordcode_list[sVar6].x - sVar7; } *(undefined2 *)&cordcode_list[sVar6].field_0xa = 0; } LAB_0042a805: sVar6 = sVar6 + 1; } while (sVar6 < 0x1e); sVar6 = 0; do { uVar4 = (int)*(short *)&cordcode_list[sVar6].field_0xc >> 0x1f; if ((int)(((int)*(short *)&cordcode_list[sVar6].field_0xc ^ uVar4) - uVar4) < 0x41) { uVar4 = (int)*(short *)&cordcode_list[sVar6].field_0xc >> 0x1f; if (0x10 < (int)(((int)*(short *)&cordcode_list[sVar6].field_0xc ^ uVar4) - uVar4)) { uVar4 = (int)param_1 & 0x80000001; if ((int)uVar4 < 0) { uVar4 = (uVar4 - 1 | 0xfffffffe) + 1; } if (uVar4 != 0) goto LAB_0042a881; } uVar5 = (int)*(short *)&cordcode_list[sVar6].field_0xc >> 0x1f; uVar4 = (int)*(short *)&cordcode_list[sVar6].field_0xc ^ uVar5; if ((uVar4 != uVar5 && -1 < (int)(uVar4 - uVar5)) && (param_1 == 1)) goto LAB_0042a881; bVar1 = false; } else { LAB_0042a881: bVar1 = true; } if (cordcode_list[sVar6].type != -1) { if ((bVar1) && (*(short *)&cordcode_list[sVar6].field_0xe == 0)) { uVar3 = FUN_0042aa73(sVar6); if ((short)uVar3 != 0) goto LAB_0042a8c2; } else { LAB_0042a8c2: uVar3 = FUN_0042ac84(sVar6,0); if ((short)uVar3 == 0) goto LAB_0042a935; } sVar7 = -1; if (-1 < *(short *)&cordcode_list[sVar6].field_0xc) { sVar7 = 1; } cordcode_list[sVar6].y = cordcode_list[sVar6].y + sVar7; uVar3 = FUN_0042a94a(sVar6); if ((short)uVar3 == 0) { uVar2 = 1; } else { cordcode_list[sVar6].y = cordcode_list[sVar6].y - sVar7; } *(undefined2 *)&cordcode_list[sVar6].field_0xc = 0; } LAB_0042a935: sVar6 = sVar6 + 1; if (0x1d < sVar6) { return uVar2; } } while( true ); } undefined4 __cdecl FUN_0042a94a(short param_1) { short sVar1; undefined4 uVar2; undefined4 uVar3; int iVar4; uVar2 = aseq_get_img_w(*(int *)&cordcode_list[param_1].field_0x12,0); uVar3 = aseq_get_img_h(*(int *)&cordcode_list[param_1].field_0x12,0); sVar1 = (short)uVar3 + 4; iVar4 = CONCAT22((short)((uint)uVar3 >> 0x10),sVar1); if ((((cordcode_list[param_1].x < 0x70) || (cordcode_list[param_1].y < 0x2c)) || (0x1ed < (int)cordcode_list[param_1].x + (int)(short)((short)uVar2 + 4))) || (iVar4 = (int)sVar1, 0x122 < cordcode_list[param_1].y + iVar4)) { uVar2 = CONCAT22((short)((uint)iVar4 >> 0x10),1); } else { aseq_get_img_w(*(int *)&cordcode_list[param_1].field_0x12,0); aseq_get_img_h(*(int *)&cordcode_list[param_1].field_0x12,0); sVar1 = 0; do { if (((cordcode_list[sVar1].type != -1) && (param_1 != sVar1)) && (uVar2 = FUN_0042af5d(sVar1,param_1,1), (short)uVar2 != 0)) { return CONCAT22((short)((uint)uVar2 >> 0x10),1); } sVar1 = sVar1 + 1; } while (sVar1 < 0x1e); uVar2 = 0; } return uVar2; } undefined4 __cdecl FUN_0042aa73(short param_1) { bool bVar1; short sVar2; short sVar3; ushort uVar4; short sVar5; uint uVar6; short sVar7; ushort uVar8; uint uVar9; short sVar10; short local_6; local_6 = 0; do { sVar2 = (short)(char)(&DAT_0044a7c0) [local_6 * 2 + (cordcode_list[param_1].type * 4 + (int)cordcode_list[param_1].rot) * 0xc] + cordcode_list[param_1].x; sVar3 = (short)(char)(&DAT_0044a7c1) [local_6 * 2 + (cordcode_list[param_1].type * 4 + (int)cordcode_list[param_1].rot) * 0xc] + cordcode_list[param_1].y; sVar7 = 0; do { if ((cordcode_list[sVar7].type != -1) && (sVar7 != param_1)) { uVar4 = 3; if (2 < local_6) { uVar4 = 0; } uVar8 = 6; if (2 < local_6) { uVar8 = 3; } bVar1 = uVar4 < uVar8; while (bVar1) { if ((char)(&DAT_0044a7c0) [(short)uVar4 * 2 + (cordcode_list[sVar7].type * 4 + (int)cordcode_list[sVar7].rot) * 0xc] != -1) { sVar5 = (short)(char)(&DAT_0044a7c0) [(short)uVar4 * 2 + (cordcode_list[sVar7].type * 4 + (int)cordcode_list[sVar7].rot) * 0xc] + cordcode_list[sVar7].x; sVar10 = (short)(char)(&DAT_0044a7c1) [(short)uVar4 * 2 + (cordcode_list[sVar7].type * 4 + (int)cordcode_list[sVar7].rot) * 0xc] + cordcode_list[sVar7].y; uVar6 = (int)sVar5 - (int)sVar2; uVar9 = (int)uVar6 >> 0x1f; if ((((uVar6 ^ uVar9) - uVar9 == 2) && (sVar10 == sVar3)) || ((uVar6 = (int)sVar10 - (int)sVar3, uVar9 = (int)uVar6 >> 0x1f, (uVar6 ^ uVar9) - uVar9 == 1 && (sVar5 == sVar2)))) { return 1; } } uVar4 = uVar4 + 1; bVar1 = (short)uVar4 < (short)uVar8; } } sVar7 = sVar7 + 1; } while (sVar7 < 0x1e); local_6 = local_6 + 1; if (5 < local_6) { return 0; } } while( true ); } undefined4 __cdecl FUN_0042ac84(short param_1,short param_2) { short sVar1; short sVar2; short sVar3; uint uVar4; undefined4 uVar5; short sVar6; ushort uVar7; uint uVar8; short sVar9; short local_8; ushort local_6; local_8 = 0; do { sVar1 = (short)(char)(&DAT_0044a7c0) [local_8 * 2 + (cordcode_list[param_1].type * 4 + (int)cordcode_list[param_1].rot) * 0xc] + cordcode_list[param_1].x; sVar2 = (short)(char)(&DAT_0044a7c1) [local_8 * 2 + (cordcode_list[param_1].type * 4 + (int)cordcode_list[param_1].rot) * 0xc] + cordcode_list[param_1].y; sVar6 = 0; do { if ((cordcode_list[sVar6].type != -1) && (param_1 != sVar6)) { local_6 = 0; if (2 < local_8) { local_6 = 3; } uVar7 = 3; if (2 < local_8) { uVar7 = 6; } if (local_6 < uVar7) { do { if ((char)(&DAT_0044a7c0) [(short)local_6 * 2 + (cordcode_list[sVar6].type * 4 + (int)cordcode_list[sVar6].rot) * 0xc] != -1) { sVar3 = (short)(char)(&DAT_0044a7c0) [(short)local_6 * 2 + (cordcode_list[sVar6].type * 4 + (int)cordcode_list[sVar6].rot) * 0xc] + cordcode_list[sVar6].x; sVar9 = (short)(char)(&DAT_0044a7c1) [(short)local_6 * 2 + (cordcode_list[sVar6].type * 4 + (int)cordcode_list[sVar6].rot) * 0xc] + cordcode_list[sVar6].y; uVar4 = (int)sVar3 - (int)sVar1; uVar8 = (int)uVar4 >> 0x1f; if ((((uVar4 ^ uVar8) - uVar8 == 2) && (sVar9 == sVar2)) || ((uVar4 = (int)sVar9 - (int)sVar2, uVar8 = (int)uVar4 >> 0x1f, (uVar4 ^ uVar8) - uVar8 == 2 && (sVar3 == sVar1)))) { if (param_2 == 0) { cordcode_list[param_1].x = cordcode_list[param_1].x + 1; uVar5 = FUN_0042a94a(param_1); if ((short)uVar5 == 0) { *(undefined2 *)&cordcode_list[param_1].field_0xa = 1; } else { *(undefined2 *)&cordcode_list[param_1].field_0xa = 0xffff; } cordcode_list[param_1].x = cordcode_list[param_1].x + -1; } else { cordcode_list[param_1].y = cordcode_list[param_1].y + 1; uVar5 = FUN_0042a94a(param_1); if ((short)uVar5 == 0) { *(undefined2 *)&cordcode_list[param_1].field_0xc = 1; } else { *(undefined2 *)&cordcode_list[param_1].field_0xc = 0xffff; } cordcode_list[param_1].y = cordcode_list[param_1].y + -1; } return CONCAT22((short)((uint)(param_1 * 0xf) >> 0x10),1); } } local_6 = local_6 + 1; } while ((short)local_6 < (short)uVar7); } } sVar6 = sVar6 + 1; } while (sVar6 < 0x1e); local_8 = local_8 + 1; if (5 < local_8) { return 0; } } while( true ); } undefined4 __cdecl FUN_0042af5d(short param_1,short param_2,short param_3) { short sVar1; short sVar2; short sVar3; undefined4 uVar4; short sVar5; short sVar6; if (param_3 == 0) { uVar4 = aseq_get_img_h(*(int *)&cordcode_list[param_2].field_0x12,0); sVar1 = (short)uVar4 + -3; uVar4 = aseq_get_img_w(*(int *)&cordcode_list[param_2].field_0x12,0); sVar2 = (short)uVar4 + -3; sVar6 = cordcode_list[param_2].y; sVar5 = cordcode_list[param_2].x; uVar4 = aseq_get_img_h(*(int *)&cordcode_list[param_1].field_0x12,0); sVar3 = (short)uVar4 + 4; uVar4 = aseq_get_img_w(*(int *)&cordcode_list[param_1].field_0x12,0); uVar4 = FUN_0042a1a3(cordcode_list[param_1].x,cordcode_list[param_1].y,(short)uVar4 + 4,sVar3, sVar5,sVar6,sVar2,sVar1); if ((short)uVar4 != 0) { return CONCAT22((short)((uint)uVar4 >> 0x10),1); } } else if (param_3 == 1) { uVar4 = aseq_get_img_h(*(int *)&cordcode_list[param_2].field_0x12,0); sVar1 = (short)uVar4 + -3; uVar4 = aseq_get_img_w(*(int *)&cordcode_list[param_2].field_0x12,0); sVar2 = (short)uVar4 + -3; sVar6 = cordcode_list[param_2].y; sVar5 = cordcode_list[param_2].x; uVar4 = aseq_get_img_h(*(int *)&cordcode_list[param_1].field_0x12,0); sVar3 = (short)uVar4 + -3; uVar4 = aseq_get_img_w(*(int *)&cordcode_list[param_1].field_0x12,0); uVar4 = FUN_0042a1a3(cordcode_list[param_1].x,cordcode_list[param_1].y,(short)uVar4 + -3,sVar3, sVar5,sVar6,sVar2,sVar1); if ((short)uVar4 != 0) { return CONCAT22((short)((uint)uVar4 >> 0x10),1); } } return 0; } void __cdecl FUN_0042b140(ushort param_1,short param_2,short param_3,short param_4,short param_5) { short sVar1; short sVar2; uint uVar3; int iVar4; short sVar5; short sVar6; short sVar7; short local_c; short local_a; local_a = 0; local_c = 0; sVar1 = cordcode_list[param_5].type * 4 + cordcode_list[param_5].rot; sVar5 = 0; do { if (param_1 == sVar5 < 3) { sVar6 = (param_2 - cordcode_list[param_5].x) - (short)(char)(&DAT_0044a7c0)[sVar5 * 2 + sVar1 * 0xc]; sVar7 = (param_3 - cordcode_list[param_5].y) - (short)(char)(&DAT_0044a7c1)[sVar5 * 2 + sVar1 * 0xc]; } else { sVar6 = (cordcode_list[param_5].x + (short)(char)(&DAT_0044a7c0)[sVar5 * 2 + sVar1 * 0xc]) - param_2; sVar7 = (cordcode_list[param_5].y + (short)(char)(&DAT_0044a7c1)[sVar5 * 2 + sVar1 * 0xc]) - param_3; } uVar3 = FUN_0042b3a4((int)sVar6 * (int)sVar6 + (int)sVar7 * (int)sVar7); sVar2 = (short)uVar3; uVar3 = (int)sVar6 >> 0x1f; if ((((((int)sVar6 ^ uVar3) - uVar3 == 1) && (sVar7 == 0)) || ((sVar6 == 1 && (uVar3 = (int)sVar7 >> 0x1f, ((int)sVar7 ^ uVar3) - uVar3 == 1)))) && (param_1 != sVar5 < 3)) { *(undefined2 *)&cordcode_list[param_4].field_0xe = 1; *(undefined2 *)&cordcode_list[param_4].field_0xa = 0; *(undefined2 *)&cordcode_list[param_4].field_0xc = 0; return; } if (sVar2 < 0x12) { iVar4 = FUN_0042b38b(0x12 - sVar2); local_a = local_a + (short)(((int)(short)iVar4 * (int)sVar6) / (int)sVar2); local_c = local_c + (short)(((int)(short)iVar4 * (int)sVar7) / (int)sVar2); } sVar5 = sVar5 + 1; } while (sVar5 < 6); *(short *)&cordcode_list[param_4].field_0xa = *(short *)&cordcode_list[param_4].field_0xa + local_a; *(short *)&cordcode_list[param_4].field_0xc = *(short *)&cordcode_list[param_4].field_0xc + local_c; return; } int __cdecl FUN_0042b38b(short param_1) { return (int)param_1 * (int)param_1 * (int)param_1; } uint __cdecl FUN_0042b3a4(uint param_1) { undefined4 in_EAX; uint uVar1; uint uVar2; uint uVar3; uint uVar4; uint uVar5; if (param_1 < 4) { uVar4 = CONCAT22((short)((uint)in_EAX >> 0x10),1); } else { uVar4 = 2; uVar2 = (param_1 >> 2) + 1; uVar5 = param_1 >> 1; while ((uVar3 = (int)(uVar5 - uVar4) >> 0x1f, 1 < (int)((uVar5 - uVar4 ^ uVar3) - uVar3) && ((uVar1 = uVar2 * uVar2, uVar3 = uVar2, param_1 <= uVar1 && uVar1 - param_1 != 0 || (uVar4 = uVar2, uVar3 = uVar5, uVar1 < param_1))))) { uVar5 = uVar3; uVar2 = (uVar3 - uVar4 >> 1) + uVar4; } } return uVar4; } undefined4 __stdcall FUN_0042b3fc(void) { ushort uVar1; ushort uVar2; int iVar3; uint uVar4; int iVar5; short sVar6; short sVar7; ushort uVar8; short local_c; short local_6; sVar7 = 0; do { *(undefined2 *)&cordcode_list[sVar7].field_0x10 = 0; sVar7 = sVar7 + 1; } while (sVar7 < 0x1e); sVar7 = 0; do { iVar3 = (int)sVar7; if (null_ARRAY_ARRAY_00450f84[iVar3][3] != -1) { local_c = -1; sVar6 = 0; do { if (cordcode_list[sVar6].type != -1) { uVar8 = (ushort)(0 < cordcode_list[sVar6].type); if (uVar8 == 1) { uVar4 = (int)cordcode_list[sVar6].rot & 0x80000003; if ((int)uVar4 < 0) { uVar4 = (uVar4 - 1 | 0xfffffffc) + 1; } local_6 = (short)uVar4; } else { uVar4 = (int)cordcode_list[sVar6].rot & 0x80000001; if ((int)uVar4 < 0) { uVar4 = (uVar4 - 1 | 0xfffffffe) + 1; } local_6 = (short)uVar4; } iVar3 = (int)cordcode_list[sVar6].x - (int)(short)null_ARRAY_ARRAY_00450f84[sVar7][0]; uVar1 = (ushort)(iVar3 >> 0x1f); iVar5 = (int)cordcode_list[sVar6].y - (int)(short)null_ARRAY_ARRAY_00450f84[sVar7][1]; uVar2 = (ushort)(iVar5 >> 0x1f); if ((((*(short *)&cordcode_list[sVar6].field_0x10 == 0) && (uVar8 == null_ARRAY_ARRAY_00450f84[sVar7][3])) && (null_ARRAY_ARRAY_00450f84[sVar7][2] == local_6)) && (((short)(((ushort)iVar3 ^ uVar1) - uVar1) < 8 && ((short)(((ushort)iVar5 ^ uVar2) - uVar2) < 8)))) { local_c = sVar6; } } sVar6 = sVar6 + 1; } while (sVar6 < 0x1e); if (local_c == -1) { return 0; } iVar3 = local_c * 0xf; *(undefined2 *)&cordcode_list[local_c].field_0x10 = 1; } sVar7 = sVar7 + 1; if (0x27 < sVar7) { return CONCAT22((short)((uint)iVar3 >> 0x10),1); } } while( true ); } void __stdcall generate_cordcode_c(void) { int *piVar1; short sVar2; piVar1 = fopen(s_D_cordcode_c_0044a8fa,s_a__0044a907); fprintf(piVar1,s_case__d__0044a90a); sVar2 = 0; do { if (cordcode_list[sVar2].type != -1) { fprintf(piVar1,s_ii__d__type____d__0044a91a); fprintf(piVar1,s_ii__d__rot____d__0044a936); fprintf(piVar1,s_ii__d__x____d__0044a952); fprintf(piVar1,s_ii__d__y____d__0044a96e); } sVar2 = sVar2 + 1; } while (sVar2 < 0x1e); fprintf(piVar1,s_break__0044a98b); fclose(piVar1); return; } void __stdcall FUN_0042b6a2(void) { byte local_38 [52]; load_nfnt(15000); gfxish_copy_otherbuf_to_dest_and_invalidate(10,0x15e,0xfa,0x14); sprintf(local_38); FUN_0043dc0b(15000,local_38,10,0x16d,0); gfxish_invalidate_rect_wrap(10,0x15e,0x96,0x14); free_nfnt(15000); return; } undefined4 __stdcall FUN_0042b72d(void) { int iVar1; iVar1 = 0; while ((cordcode_list[(short)iVar1].type == -1 || (*(short *)&cordcode_list[(short)iVar1].field_0x8 != 0))) { iVar1 = iVar1 + 1; if (0x1d < (short)iVar1) { return CONCAT22((short)((uint)iVar1 >> 0x10),1); } } return 0; } undefined4 __cdecl FUN_0042b76d(short param_1) { int iVar1; short sVar2; sVar2 = 0; while ((((iVar1 = sVar2 * 0xf, cordcode_list[sVar2].type == -1 || (iVar1 = sVar2 * 0xf, *(short *)&cordcode_list[sVar2].field_0x8 != 0)) || (param_1 == sVar2)) || (iVar1 = FUN_0042af5d(sVar2,param_1,0), (short)iVar1 == 0))) { sVar2 = sVar2 + 1; if (0x1d < sVar2) { return CONCAT22((short)((uint)iVar1 >> 0x10),1); } } return 0; } void __stdcall FUN_0042b7ce(void) { if (DAT_0044a8d0 == 3) { clear_cursor_override_regions(); null_ARRAY_0044a8c8[DAT_004510cc] = null_ARRAY_0044a8c8[DAT_004510cc] + 1; DAT_004510cc = -1; FUN_0042b89a(); DAT_0044a8d0 = 1; } FUN_0042b812(); FUN_0042683f(); return; } void __stdcall FUN_0042b812(void) { FUN_00429ca1(); FUN_00426be8(); FUN_00430e33(DAT_0044a8ce); return; } void __cdecl FUN_0042b82e(short param_1) { undefined2 *puVar1; if (param_1 == 0) { free_tracked_heap_block((int)DAT_004510d4); } puVar1 = (undefined2 *)alloc_tracked_heap_block(0x10); DAT_004510d4 = puVar1; *puVar1 = 0; puVar1[1] = 5; puVar1[3] = 0x17a; puVar1[2] = 0x1ff; *(undefined4 *)(puVar1 + 6) = DAT_004510e4; puVar1[5] = 0; set_cursor_override_regions((int)DAT_004510d4,1); return; } void __stdcall clear_cursor_override_regions(void) { set_cursor_override_regions(0,0); return; } void __stdcall FUN_0042b89a(void) { FUN_0042b82e(0); return; } void __stdcall FUN_0042b8a7(void) { DAT_004510e8 = 1; if (DAT_0044a8d0 == 3) { clear_cursor_override_regions(); null_ARRAY_0044a8c8[DAT_004510cc] = null_ARRAY_0044a8c8[DAT_004510cc] + 1; DAT_004510cc = -1; FUN_0042b89a(); DAT_0044a8d0 = 1; } return; } short __stdcall FUN_0042b8ed(void) { short sVar1; undefined4 *puVar2; undefined4 *puVar3; LAB_0042b8f7: puVar2 = (undefined4 *)deref_next_if_not_null(&menu_structs->next); sVar1 = DAT_0044a9b6; do { if (puVar2 == (undefined4 *)0x0) { DAT_0044a9b6 = sVar1 + 1; return sVar1; } DAT_0044a9b6 = sVar1; for (puVar3 = (undefined4 *)deref_next_if_not_null((undefined4 *)puVar2[6]); puVar3 != (undefined4 *)0x0; puVar3 = (undefined4 *)deref_next(puVar3)) { if (*(short *)((int)puVar3 + 10) == DAT_0044a9b6) { DAT_0044a9b6 = DAT_0044a9b6 + 1; if (0x7ef3 < DAT_0044a9b6) { DAT_0044a9b6 = 0x80; } goto LAB_0042b8f7; } } puVar2 = (undefined4 *)deref_next(puVar2); sVar1 = DAT_0044a9b6; } while( true ); } undefined4 * __cdecl menu_struct_find(short param_1,short *param_2) { undefined4 *puVar1; short sVar2; sVar2 = 0; puVar1 = (undefined4 *)deref_next_if_not_null(&menu_structs->next); while( true ) { if (puVar1 == (undefined4 *)0x0) { return (undefined4 *)0x0; } if (param_1 == *(short *)((int)puVar1 + 10)) break; sVar2 = sVar2 + 1; puVar1 = (undefined4 *)deref_next(puVar1); } if (param_2 == (short *)0x0) { return puVar1; } *param_2 = sVar2; return puVar1; } undefined4 * __cdecl menu_item_find(short param_1,ushort param_2) { undefined4 *puVar1; undefined4 *puVar2; puVar2 = (undefined4 *)0x0; puVar1 = menu_struct_find(param_1,(short *)0x0); if (puVar1 != (undefined4 *)0x0) { if ((param_2 & 0x8000) == 0) { puVar2 = linked_list_index((undefined4 *)puVar1[6],param_2); } else { for (puVar2 = (undefined4 *)deref_next_if_not_null((undefined4 *)puVar1[6]); (puVar2 != (undefined4 *)0x0 && ((param_2 & 0x7fff) != *(ushort *)((int)puVar2 + 10))); puVar2 = (undefined4 *)deref_next(puVar2)) { } } } return puVar2; } void __stdcall create_main_win_menu(void) { menu_structs = (linked_list_head *)alloc_linked_list_marker(); main_win_menu = CreateMenu(); SetMenu(main_hwnd,main_win_menu); return; } void __stdcall destroy_main_menu(void) { delete_all_menus(); DestroyMenu(main_win_menu); return; } undefined4 __cdecl FUN_0042ba3a(LPCSTR param_1,undefined2 param_2,ushort param_3) { undefined4 *puVar1; int iVar2; HMENU pHVar3; undefined4 uVar4; uVar4 = 0; puVar1 = (undefined4 *)alloc_tracked_heap_block(0x20); if (param_3 == 0xffff) { iVar2 = linked_list_sz(&menu_structs->next); param_3 = (ushort)iVar2; } if (puVar1 != (undefined4 *)0x0) { *(undefined2 *)((int)puVar1 + 10) = param_2; *(undefined2 *)(puVar1 + 3) = 1; *(undefined2 *)((int)puVar1 + 0x16) = 0; uVar4 = alloc_linked_list_marker(); puVar1[6] = uVar4; puVar1[7] = 0; *(undefined2 *)(puVar1 + 2) = 0; pHVar3 = CreateMenu(); *(HMENU *)((int)puVar1 + 0xe) = pHVar3; InsertMenuA(main_win_menu,(int)(short)param_3,0x410,*(UINT_PTR *)((int)puVar1 + 0xe),param_1); linked_list_insert((int *)menu_structs,puVar1,param_3); uVar4 = 1; if (DAT_0044a9b4 != 0) { DrawMenuBar(main_hwnd); } } return uVar4; } undefined4 __cdecl enable_menu_item(short param_1,ushort param_2) { undefined4 *puVar1; undefined4 *puVar2; puVar1 = menu_struct_find(param_1,(short *)0x0); if (puVar1 != (undefined4 *)0x0) { puVar2 = menu_item_find(param_1,param_2); *(ushort *)(puVar2 + 2) = *(ushort *)(puVar2 + 2) & 0xfffb; EnableMenuItem(*(HMENU *)((int)puVar1 + 0xe),(int)(short)(param_2 & 0x7fff),0x400); } return 0; } undefined4 __cdecl disable_menu_item(short param_1,ushort param_2) { undefined4 *puVar1; undefined4 *puVar2; puVar1 = menu_struct_find(param_1,(short *)0x0); if (puVar1 != (undefined4 *)0x0) { puVar2 = menu_item_find(param_1,param_2); *(ushort *)(puVar2 + 2) = *(ushort *)(puVar2 + 2) | 4; EnableMenuItem(*(HMENU *)((int)puVar1 + 0xe),(int)(short)(param_2 & 0x7fff),0x403); } return 0; } undefined4 __cdecl FUN_0042bb80(short param_1,ushort param_2,short param_3) { ushort uVar1; undefined4 *puVar2; undefined4 *puVar3; undefined4 uVar4; uVar4 = 0; puVar2 = menu_struct_find(param_1,(short *)0x0); if (puVar2 != (undefined4 *)0x0) { puVar3 = linked_list_index((undefined4 *)puVar2[6],param_2); if (param_3 == 0) { *(ushort *)(puVar3 + 2) = *(ushort *)(puVar3 + 2) & 0xfffd; } else { *(ushort *)(puVar3 + 2) = *(ushort *)(puVar3 + 2) | 2; } uVar1 = 8; if (param_3 != 1) { uVar1 = 0; } CheckMenuItem(*(HMENU *)((int)puVar2 + 0xe),(int)(short)(param_2 & 0x7fff), (int)(short)(uVar1 | 0x400)); uVar4 = 1; } return uVar4; } short __cdecl create_structs_for_menu_rsrc(ushort param_1) { undefined4 *puVar1; undefined4 uVar2; HMENU hMenu; int iVar3; undefined4 *puVar4; UINT UVar5; short sVar6; CHAR local_40 [52]; HMENU local_c; ushort local_8; short local_6; sVar6 = 0; puVar1 = (undefined4 *)alloc_tracked_heap_block(0x20); *(ushort *)((int)puVar1 + 10) = param_1; *(undefined2 *)(puVar1 + 3) = 1; uVar2 = alloc_linked_list_marker(); puVar1[6] = uVar2; *(undefined2 *)(puVar1 + 2) = 1; hMenu = LoadMenuA(instance,(LPCSTR)(uint)param_1); *(HMENU *)((int)puVar1 + 0x12) = hMenu; local_c = GetSubMenu(hMenu,0); if (local_c == (HMENU)0x0) { free_tracked_heap_block((int)puVar1); } else { GetMenuStringA(hMenu,0,local_40,0x31,0x400); *(HMENU *)((int)puVar1 + 0xe) = local_c; AppendMenuA(main_win_menu,0x410,(UINT_PTR)local_c,local_40); iVar3 = GetMenuItemCount(local_c); local_6 = (short)iVar3; puVar4 = (undefined4 *)alloc_tracked_heap_block((int)local_6 << 4); puVar1[7] = puVar4; sVar6 = 0; if (0 < local_6) { do { local_8 = 1; UVar5 = GetMenuItemID(local_c,(int)sVar6); *(short *)((int)puVar4 + 10) = (short)UVar5; UVar5 = GetMenuState(local_c,(int)sVar6,0x400); if ((UVar5 & 8) != 0) { local_8 = local_8 | 2; } if ((UVar5 & 1) != 0) { local_8 = local_8 | 4; } if ((UVar5 & 0x800) != 0) { local_8 = local_8 | 8; } *(ushort *)(puVar4 + 2) = local_8; puVar4[3] = &nullsub; linked_list_insert((int *)puVar1[6],puVar4,0xffff); puVar4 = puVar4 + 4; sVar6 = sVar6 + 1; } while (sVar6 < local_6); } sVar6 = 1; } if (sVar6 != 0) { linked_list_insert((int *)menu_structs,puVar1,0xffff); if (DAT_0044a9b4 != 0) { DrawMenuBar(main_hwnd); } } return sVar6; } undefined4 __cdecl delete_menu(short param_1) { int *piVar1; int *piVar2; int *piVar3; undefined4 uVar4; short local_6; uVar4 = 0; piVar2 = menu_struct_find(param_1,&local_6); if (piVar2 != (int *)0x0) { DeleteMenu(main_win_menu,(int)local_6,0x400); if ((*(byte *)(piVar2 + 2) & 1) != 0) { DestroyMenu(*(HMENU *)((int)piVar2 + 0x12)); } piVar3 = (int *)deref_next_if_not_null((undefined4 *)piVar2[6]); while (piVar1 = piVar3, piVar1 != (int *)0x0) { piVar3 = (int *)deref_next(piVar1); linked_list_unlink((int *)piVar2[6],piVar1); if ((*(byte *)(piVar1 + 2) & 1) == 0) { free_tracked_heap_block((int)piVar1); } } if (piVar2[7] != 0) { free_tracked_heap_block(piVar2[7]); } free_tracked_heap_block_(piVar2[6]); linked_list_unlink((int *)menu_structs,piVar2); free_tracked_heap_block((int)piVar2); if (DAT_0044a9b4 != 0) { DrawMenuBar(main_hwnd); } uVar4 = 1; } return uVar4; } undefined4 __stdcall ret0(void) { return 0; } undefined4 __cdecl FUN_0042be28(short param_1,ushort param_2) { undefined4 *puVar1; int *piVar2; undefined4 uVar3; short local_6; uVar3 = 0; puVar1 = menu_struct_find(param_1,&local_6); if (puVar1 != (undefined4 *)0x0) { piVar2 = menu_item_find(param_1,param_2); linked_list_unlink((int *)puVar1[6],piVar2); if ((*(byte *)(piVar2 + 2) & 1) == 0) { free_tracked_heap_block((int)piVar2); } RemoveMenu(*(HMENU *)((int)puVar1 + 0xe),(int)local_6,0x400); uVar3 = CONCAT22((short)((uint)piVar2 >> 0x10),1); } return uVar3; } short __cdecl FUN_0042be8e(short param_1,short param_2,LPCSTR param_3,undefined4 param_4) { short sVar1; undefined4 *puVar2; undefined4 *puVar3; sVar1 = 0; puVar2 = menu_struct_find(param_1,(short *)0x0); if (puVar2 != (undefined4 *)0x0) { puVar3 = (undefined4 *)alloc_tracked_heap_block(0x10); *(undefined2 *)(puVar3 + 2) = 0; sVar1 = FUN_0042b8ed(); *(short *)((int)puVar3 + 10) = sVar1; puVar3[3] = param_4; linked_list_insert((int *)puVar2[6],puVar3,0xffff); linked_list_sz((undefined4 *)puVar2[6]); if (param_3 == (LPCSTR)0x0) { InsertMenuA(*(HMENU *)((int)puVar2 + 0xe),(int)param_2,0x400,0x800,(LPCSTR)0x0); } else { AppendMenuA(*(HMENU *)((int)puVar2 + 0xe),0,(int)sVar1,param_3); } } return sVar1; } undefined4 __cdecl FUN_0042bf34(short param_1) { undefined4 *puVar1; undefined4 uVar2; short local_6; uVar2 = 0; puVar1 = menu_struct_find(param_1,&local_6); if ((puVar1 != (undefined4 *)0x0) && (*(short *)(puVar1 + 3) == 0)) { *(undefined2 *)(puVar1 + 3) = 1; EnableMenuItem(main_win_menu,(int)local_6,0x400); uVar2 = 1; if (DAT_0044a9b4 != 0) { DrawMenuBar(main_hwnd); } } return uVar2; } undefined4 __cdecl FUN_0042bf91(short param_1) { undefined4 *puVar1; undefined4 uVar2; short local_6; uVar2 = 0; puVar1 = menu_struct_find(param_1,&local_6); if ((puVar1 != (undefined4 *)0x0) && (*(short *)(puVar1 + 3) != 0)) { *(undefined2 *)(puVar1 + 3) = 0; EnableMenuItem(main_win_menu,(int)local_6,0x401); uVar2 = 1; if (DAT_0044a9b4 != 0) { DrawMenuBar(main_hwnd); } } return uVar2; } void __stdcall FUN_0042bfee(void) { undefined4 *puVar1; for (puVar1 = (undefined4 *)deref_next_if_not_null(&menu_structs->next); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { FUN_0042bf91(*(short *)((int)puVar1 + 10)); } return; } void __stdcall FUN_0042c01f(void) { undefined4 *puVar1; for (puVar1 = (undefined4 *)deref_next_if_not_null(&menu_structs->next); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { FUN_0042bf34(*(short *)((int)puVar1 + 10)); } return; } void __cdecl on_wmcommand_handler(int param_1) { undefined4 *puVar1; undefined4 *puVar2; undefined4 *puVar3; undefined4 *puVar4; puVar1 = (undefined4 *)deref_next_if_not_null(&menu_structs->next); do { if (puVar1 == (undefined4 *)0x0) { return; } puVar3 = (undefined4 *)puVar1[6]; puVar2 = (undefined4 *)deref_next_if_not_null(puVar3); while (puVar4 = puVar2, puVar4 != (undefined4 *)0x0) { if (param_1 == *(short *)((int)puVar4 + 10)) { (*(code *)puVar4[3])(puVar4,(int)*(short *)((int)puVar4 + 10),puVar3); return; } puVar2 = (undefined4 *)deref_next(puVar4); puVar3 = puVar4; } puVar1 = (undefined4 *)deref_next(puVar1); } while( true ); } void __cdecl menu_item_set_cb(short param_1,ushort param_2,undefined4 param_3) { undefined4 *puVar1; puVar1 = menu_struct_find(param_1,(short *)0x0); if (puVar1 != (undefined4 *)0x0) { puVar1 = linked_list_index((undefined4 *)puVar1[6],param_2); if (puVar1 != (undefined4 *)0x0) { puVar1[3] = param_3; } } return; } void __cdecl FUN_0042c0d2(short param_1,undefined4 *param_2) { undefined4 *puVar1; puVar1 = menu_struct_find(param_1,(short *)0x0); if (puVar1 != (undefined4 *)0x0) { for (puVar1 = (undefined4 *)deref_next_if_not_null((undefined4 *)puVar1[6]); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { if ((*(byte *)(puVar1 + 2) & 8) == 0) { puVar1[3] = *param_2; param_2 = param_2 + 1; } } } return; } void __stdcall delete_all_menus(void) { undefined4 *puVar1; undefined4 *puVar2; puVar1 = (undefined4 *)deref_next_if_not_null(&menu_structs->next); while (puVar1 != (undefined4 *)0x0) { puVar2 = (undefined4 *)deref_next(puVar1); delete_menu(*(short *)((int)puVar1 + 10)); puVar1 = puVar2; } return; } int __cdecl FUN_0042c14a(ushort param_1) { ushort *puVar1; short sVar2; int iVar3; iVar3 = 0; DAT_0044a9b4 = 0; puVar1 = (ushort *)&stack0x00000008; while (param_1 != 0xffff) { sVar2 = create_structs_for_menu_rsrc(param_1); if (sVar2 != 0) { iVar3 = iVar3 + 1; } param_1 = *puVar1; puVar1 = puVar1 + 2; } DAT_0044a9b4 = 1; DrawMenuBar(main_hwnd); return iVar3; } void __cdecl clip_cursor_enable(short param_1,short param_2,short param_3,short param_4) { word wVar1; word wVar2; short sVar3; short sVar4; RECT local_1c; tagPOINT local_c; wVar1 = 0; wVar2 = 0; if (has_custom_cursor != 0) { wVar1 = aseq_cursor.rect.w; wVar2 = aseq_cursor.rect.h; } sVar3 = param_1 + (short)mouse_xbase; sVar4 = param_2 + (short)mouse_ybase; local_c.x = ((int)sVar3 + (int)param_3) - (int)(short)wVar1; local_c.y = ((int)sVar4 + (int)param_4) - (int)(short)wVar2; ClientToScreen(main_hwnd,&local_c); local_1c.right = local_c.x; local_1c.bottom = local_c.y; local_c.x = (LONG)sVar3; local_c.y = (LONG)sVar4; ClientToScreen(main_hwnd,&local_c); local_1c.left = local_c.x; local_1c.top = local_c.y; ClipCursor(&local_1c); clip_cursor_is_enabled = 1; memcpy((undefined4 *)&xxx_bugged_clip_cursor,&local_1c.left,8); return; } void __stdcall clip_cursor_disable(void) { RECT local_14; local_14.left = (LONG)(short)orig_clip_cursor.x; local_14.top = (LONG)(short)orig_clip_cursor.y; local_14.right = (int)(short)orig_clip_cursor.x + (int)(short)orig_clip_cursor.w; local_14.bottom = (int)(short)orig_clip_cursor.y + (int)(short)orig_clip_cursor.h; ClipCursor(&local_14); clip_cursor_is_enabled = 0; return; } void __stdcall FUN_0042c2af(void) { DAT_0044a9c8 = clip_cursor_is_enabled; if (clip_cursor_is_enabled != 0) { clip_cursor_disable(); } return; } void __stdcall FUN_0042c2cf(void) { clip_cursor_is_enabled = DAT_0044a9c8; if (DAT_0044a9c8 != 0) { clip_cursor_enable(xxx_bugged_clip_cursor.x,xxx_bugged_clip_cursor.y,xxx_bugged_clip_cursor.w, xxx_bugged_clip_cursor.h); } return; } short __stdcall hide_sys_cursor(void) { short sVar1; sVar1 = sys_cursor_is_hidden; if (sys_cursor_is_hidden == 0) { sys_cursor_is_hidden = 1; ShowCursor(0); } return sVar1; } short __stdcall restore_sys_cursor(void) { short sVar1; sVar1 = sys_cursor_is_hidden; if (sys_cursor_is_hidden != 0) { ShowCursor(1); sys_cursor_is_hidden = 0; } return sVar1; } void __cdecl custom_cursor_main_cb(short param_1) { if (param_1 != 0) { cursor_cb_after(); return; } cursor_restore_fb(); return; } void __cdecl set_custom_cursor(undefined4 *param_1) { undefined4 local_8; get_mouse_xy_relative((short *)&local_8); unset_custom_cursor(); hide_sys_cursor(); aseq_cursor_ptr = (aseq_cursor_struct *)param_1; memcpy((undefined4 *)&aseq_cursor,param_1,0x26); aseq_cursor.rect.x = (word)local_8; aseq_cursor.rect.y = local_8._2_2_; aseq_cursor.fb_save_state = 1; has_custom_cursor = 1; *(undefined2 *)(param_1 + 4) = 1; aseq_cursor.was_used = 1; if (*(short *)((int)param_1 + 0x12) != 0) { clip_cursor_enable(0,0,0x1ff,0x17f); } return; } void __stdcall cursor_restore_fb(void) { if (aseq_cursor.fb_save_state == 0) { gfxish_copy_block(); gfxish_invalidate_rect((short *)&aseq_cursor.rect); aseq_cursor.fb_save_state = 1; } return; } int __cdecl aseq_setup_as_cursor(int param_1,undefined2 param_2,undefined2 param_3) { short sVar1; short sVar2; int iVar3; int iVar4; uint uVar5; int iVar6; iVar3 = alloc_tracked_heap_block(0x26); *(undefined2 *)(iVar3 + 6) = 0; *(undefined2 *)(iVar3 + 4) = 0; iVar6 = *(int *)(param_1 + 0x22); iVar4 = *(int *)(*(int *)(param_1 + 0x26) + 0x12) + iVar6; *(int *)(iVar3 + 0x14) = iVar4; sVar2 = 0; do { if (*(short *)(*(int *)(param_1 + 0x26) + 10) <= sVar2) { LAB_0042c47d: sVar2 = *(short *)(iVar4 + 2); *(short *)(iVar3 + 8) = sVar2; sVar1 = *(short *)(iVar4 + 4); *(short *)(iVar3 + 10) = sVar1; *(int *)(iVar3 + 0x1e) = param_1; *(undefined2 *)(iVar3 + 0x24) = *(undefined2 *)(param_1 + 0x6e); aseq_anim_state_set_which_rect_xxx(param_1,0); uVar5 = gfxish_calc_sz(sVar2,sVar1); iVar6 = alloc_tracked_heap_block(uVar5); *(int *)(iVar3 + 0x1a) = iVar6; *(undefined2 *)(iVar3 + 0x18) = 0; *(undefined2 *)(iVar3 + 0x10) = 0; *(undefined2 *)(iVar3 + 0x12) = 1; *(undefined2 *)(iVar3 + 0xc) = param_2; *(undefined2 *)(iVar3 + 0xe) = param_3; return iVar3; } if (iVar6 == *(int *)(*(int *)(*(int *)(param_1 + 0x26) + 0x16) + sVar2 * 4)) { *(short *)(iVar3 + 0x22) = sVar2; goto LAB_0042c47d; } sVar2 = sVar2 + 1; } while( true ); } void __stdcall unset_custom_cursor(void) { if (has_custom_cursor != 0) { cursor_restore_fb(); aseq_anim_state_set_which_rect_xxx((int)aseq_cursor.anim_state,aseq_cursor.which_rect_xxx); aseq_cursor.fb_save_state = -1; has_custom_cursor = 0; clip_cursor_disable(); restore_sys_cursor(); aseq_cursor_ptr = (aseq_cursor_struct *)0x0; } return; } undefined4 __cdecl aseq_free_cursor(int param_1) { unset_custom_cursor(); free_tracked_heap_block(*(int *)(param_1 + 0x1a)); free_tracked_heap_block(param_1); return 0; } void __stdcall free_cur_cursor(void) { if (aseq_cursor_ptr != (aseq_cursor_struct *)0x0) { aseq_cursor_ptr = (aseq_cursor_struct *)aseq_free_cursor((int)aseq_cursor_ptr); } aseq_cursor.fb_save_state = -1; aseq_cursor.was_used = 0; return; } void __stdcall cursor_cb_after(void) { word wVar1; word wVar2; bool bVar3; cursor_override_region *pcVar4; int iVar5; short local_a; ushort local_8; word local_6; get_mouse_xy_relative((short *)&local_8); aseq_cursor.rect.x = local_8 & 0xfffe; aseq_cursor.rect.y = local_6; if (cursor_override_regions == (cursor_override_region *)0x0) { bVar3 = true; } else { bVar3 = false; pcVar4 = cursor_override_regions; for (local_a = 0; local_a < cursor_override_regions_num; local_a = local_a + 1) { wVar1 = (pcVar4->rect).x; wVar2 = (pcVar4->rect).y; if (pcVar4->shape_circle == 0) { if (((((short)wVar1 <= (short)aseq_cursor.rect.x) && ((int)(short)aseq_cursor.rect.x < (int)(short)wVar1 + (int)(short)(pcVar4->rect).w)) && ((short)wVar2 <= (short)local_6)) && ((int)(short)local_6 < (int)(short)wVar2 + (int)(short)(pcVar4->rect).h)) { bVar3 = true; break; } } else { iVar5 = ((int)(short)(pcVar4->rect).x + (int)(short)(pcVar4->rect).w + -1) - (int)(short)wVar1; if ((uint)(((int)(short)aseq_cursor.rect.x - (int)(short)wVar1) * ((int)(short)aseq_cursor.rect.x - (int)(short)wVar1) + ((int)(short)local_6 - (int)(short)wVar2) * ((int)(short)local_6 - (int)(short)wVar2)) < (uint)(iVar5 * iVar5)) { bVar3 = true; break; } } pcVar4 = pcVar4 + 1; } if ((bVar3) && (pcVar4->cursor_struct != aseq_cursor_ptr)) { set_custom_cursor((undefined4 *)pcVar4->cursor_struct); } } if (!bVar3) { unset_custom_cursor(); } wVar2 = aseq_cursor.rect.y; wVar1 = aseq_cursor.rect.x; if (aseq_cursor.fb_save_state == 1) { aseq_cursor.rect.w = *(word *)(aseq_cursor.ptr_to_gfx_data + 2); aseq_cursor.rect.h = *(word *)(aseq_cursor.ptr_to_gfx_data + 4); if (0x1ff < (int)(short)aseq_cursor.rect.x + (int)(short)aseq_cursor.rect.w) { aseq_cursor.rect.w = 0x200 - aseq_cursor.rect.x; } if (0x17f < (int)(short)aseq_cursor.rect.y + (int)(short)aseq_cursor.rect.h) { aseq_cursor.rect.h = 0x180 - aseq_cursor.rect.y; } if (0x17f < (short)aseq_cursor.rect.y) { aseq_cursor.rect.y = 0x17f; } if (0x1ff < (short)aseq_cursor.rect.x) { aseq_cursor.rect.x = 0x1ff; } if ((0 < (short)aseq_cursor.rect.w) && (0 < (short)aseq_cursor.rect.h)) { hide_sys_cursor(); gfxish_save_rect(&aseq_cursor.rect.x,(undefined2 *)aseq_cursor.heap_block); aseq_draw_gfx_and_xxx((int)aseq_cursor.anim_state,wVar1,wVar2,aseq_cursor.img_idx,4); has_custom_cursor = 1; aseq_cursor.fb_save_state = 0; } } return; } void __stdcall custom_cursor_setup(void) { tagRECT local_14; GetClipCursor(&local_14); orig_clip_cursor.x = (word)local_14.left; orig_clip_cursor.y = (word)local_14.top; orig_clip_cursor.w = (short)local_14.right - (word)local_14.left; orig_clip_cursor.h = (short)local_14.bottom - (word)local_14.top; aseq_cursor.fb_save_state = -1; aseq_cursor.was_used = 0; anim_engine_set_cb(custom_cursor_main_cb); return; } void __cdecl set_cursor_override_regions(int param_1,undefined2 param_2) { if (param_1 == 0) { unset_custom_cursor(); } cursor_override_regions = (cursor_override_region *)param_1; cursor_override_regions_num = param_2; return; } void __stdcall save_unset_custom_cursor(void) { if (unset_custom_cursor_saved == 0) { unset_custom_cursor(); saved_custom_cursor_regions = cursor_override_regions; cursor_override_regions = (cursor_override_region *)0x0; } unset_custom_cursor_saved = unset_custom_cursor_saved + 1; return; } void __stdcall restore_cursor_override_regions(void) { if ((unset_custom_cursor_saved != 0) && (unset_custom_cursor_saved = unset_custom_cursor_saved + -1, unset_custom_cursor_saved == 0)) { cursor_override_regions = saved_custom_cursor_regions; } return; } void __cdecl mouse_cursor_get_dx_dy(undefined2 *param_1,undefined2 *param_2) { if (has_custom_cursor != 0) { *param_1 = aseq_cursor.dx; *param_2 = aseq_cursor.dy; return; } *param_2 = 0; *param_1 = 0; return; } void __cdecl show_toggle_dialog(short param_1,short param_2,short param_3,ushort *param_4) { short sVar1; undefined2 *puVar2; undefined4 uVar3; puVar2 = (undefined2 *)new_yesno_dialog(); *puVar2 = 0xffff; puVar2[1] = 0xffff; uVar3 = load_resource_item_0(param_1,(int *)PTR_text_0044ae14); *(undefined4 *)(puVar2 + 0xd) = uVar3; *(char **)(puVar2 + 0xf) = s_to_go_Back_0044a9d6; if (*param_4 != 0) { param_2 = param_3; } uVar3 = load_resource_item_0(param_2,(int *)PTR_text_0044ae14); *(undefined4 *)(puVar2 + 0x11) = uVar3; sVar1 = show_dialog(puVar2); if (sVar1 != 0) { *param_4 = *param_4 ^ 1; } free_resource_item_with_data(*(int *)(puVar2 + 0xd)); free_resource_item_with_data(*(int *)(puVar2 + 0x11)); free_tracked_heap_block((int)puVar2); return; } void __stdcall options_sound_and_music(void) { ushort uVar1; ushort local_6; uVar1 = is_bgm_enabled(); local_6 = uVar1; show_toggle_dialog(0x3eb,0x3ec,0x3ed,&local_6); if (uVar1 != local_6) { set_bgm_enabled(local_6); set_sfx_enabled(local_6); } return; } void __stdcall options_voice(void) { ushort local_6; local_6 = are_voices_enabled(); show_toggle_dialog(0x3ee,0x3ef,0x3f0,&local_6); set_voices_enabled(local_6); return; } void __stdcall help_about_the_game(void) { help_idx = 0; xxxfunc_add_funcset(&help_funcset); return; } void __stdcall options_puzzle_customization(void) { options_puzzle_customization_(); return; } void __stdcall help_moving_around(void) { help_idx = 3; xxxfunc_add_funcset(&help_funcset); return; } void __stdcall help_building_vehicles(void) { help_idx = 1; xxxfunc_add_funcset(&help_funcset); return; } void __stdcall help_finding_paths(void) { help_idx = 2; xxxfunc_add_funcset(&help_funcset); return; } void __stdcall help_solving_puzzles(void) { help_idx = 5; xxxfunc_add_funcset(&help_funcset); return; } void __stdcall help_challenge_races(void) { help_idx = 4; xxxfunc_add_funcset(&help_funcset); return; } void __stdcall help_educational_focus(void) { help_idx = 6; xxxfunc_add_funcset(&help_funcset); return; } void __stdcall on_sys_about(void) { show_dialog_wait_continue_with_ids(0x3ff,0x20); return; } void __stdcall setup_menus(void) { if (menus_are_set_up == 0) { system_menu_xxx_enable_array[0] = 1; system_menu_xxx_enable_array[1] = 1; ptr_on_sysmenu_about = on_sys_about; create_structs_for_menu_rsrc(500); menu_item_set_cb(500,0,file_start_another_game); disable_menu_item(500,0); file_menu_xxx_enable_array[0] = 0; menu_item_set_cb(500,1,file_go_to_tech_center); disable_menu_item(500,1); file_menu_xxx_enable_array[1] = 0; menu_item_set_cb(500,2,exit_game_handler); enable_menu_item(500,2); file_menu_xxx_enable_array[2] = 1; create_structs_for_menu_rsrc(600); menu_item_set_cb(600,0,options_puzzle_customization); disable_menu_item(600,0); options_menu_xxx_enable_array[0] = 0; menu_item_set_cb(600,1,options_new_player_hints); options_menu_xxx_enable_array[1] = 1; menu_item_set_cb(600,2,options_sound_and_music); options_menu_xxx_enable_array[2] = 1; menu_item_set_cb(600,3,options_voice); options_menu_xxx_enable_array[3] = 1; create_structs_for_menu_rsrc(700); menu_item_set_cb(700,0,help_about_the_game); help_menu_xxx_enable_array[0] = 1; menu_item_set_cb(700,1,help_moving_around); help_menu_xxx_enable_array[1] = 1; menu_item_set_cb(700,2,help_building_vehicles); help_menu_xxx_enable_array[2] = 1; menu_item_set_cb(700,3,help_finding_paths); help_menu_xxx_enable_array[3] = 1; menu_item_set_cb(700,4,help_solving_puzzles); help_menu_xxx_enable_array[4] = 1; menu_item_set_cb(700,5,help_challenge_races); help_menu_xxx_enable_array[5] = 1; menu_item_set_cb(700,6,help_educational_focus); help_menu_xxx_enable_array[6] = 1; menus_are_set_up = 1; } return; } void __stdcall nullsub(void) { return; } void __cdecl disable_menus(byte param_1,ushort param_2,short param_3) { HMENU hMenu; ushort uVar1; short sVar2; if ((param_1 & 1) != 0) { uVar1 = 0; do { if (((uint)param_2 == (int)(short)uVar1) || (param_2 == 0xffff)) { disable_menu_item(500,uVar1); if (param_3 == 0) { file_menu_xxx_enable_array[(short)uVar1] = file_menu_xxx_enable_array[(short)uVar1] << 1; } else { file_menu_xxx_enable_array[(short)uVar1] = 0; } } uVar1 = uVar1 + 1; } while ((short)uVar1 < 3); } if ((param_1 & 2) != 0) { uVar1 = 0; do { if (((uint)param_2 == (int)(short)uVar1) || (param_2 == 0xffff)) { disable_menu_item(600,uVar1); if (param_3 == 0) { options_menu_xxx_enable_array[(short)uVar1] = options_menu_xxx_enable_array[(short)uVar1] << 1; } else { options_menu_xxx_enable_array[(short)uVar1] = 0; } } uVar1 = uVar1 + 1; } while ((short)uVar1 < 4); } if ((param_1 & 4) != 0) { uVar1 = 0; do { if (((uint)param_2 == (int)(short)uVar1) || (param_2 == 0xffff)) { disable_menu_item(700,uVar1); if (param_3 == 0) { help_menu_xxx_enable_array[(short)uVar1] = help_menu_xxx_enable_array[(short)uVar1] << 1; } else { help_menu_xxx_enable_array[(short)uVar1] = 0; } } uVar1 = uVar1 + 1; } while ((short)uVar1 < 7); } if ((param_1 & 8) != 0) { hMenu = GetSystemMenu(main_hwnd,0); sVar2 = 0; do { if (((uint)param_2 == (int)sVar2) || (param_2 == 0xffff)) { if (param_3 == 0) { system_menu_xxx_enable_array[sVar2] = system_menu_xxx_enable_array[sVar2] << 1; } else { system_menu_xxx_enable_array[sVar2] = 0; } if (sVar2 == 0) { EnableMenuItem(hMenu,0,0x403); } else if (sVar2 == 1) { EnableMenuItem(hMenu,0xf060,3); EnableMenuItem(hMenu,0xf130,3); EnableMenuItem(hMenu,0xf020,3); } } sVar2 = sVar2 + 1; } while (sVar2 < 2); } return; } void __cdecl restore_enable_menus(byte param_1,ushort param_2,short param_3) { HMENU hMenu; ushort uVar1; short sVar2; if ((param_1 & 1) != 0) { uVar1 = 0; do { if (((uint)param_2 == (int)(short)uVar1) || (param_2 == 0xffff)) { file_menu_xxx_enable_array[(short)uVar1] = file_menu_xxx_enable_array[(short)uVar1] >> 1; if (param_3 != 0) { file_menu_xxx_enable_array[(short)uVar1] = 1; } if ((*(byte *)(file_menu_xxx_enable_array + (short)uVar1) & 1) != 0) { enable_menu_item(500,uVar1); } } uVar1 = uVar1 + 1; } while ((short)uVar1 < 3); } if ((param_1 & 2) != 0) { uVar1 = 0; do { if (((uint)param_2 == (int)(short)uVar1) || (param_2 == 0xffff)) { options_menu_xxx_enable_array[(short)uVar1] = options_menu_xxx_enable_array[(short)uVar1] >> 1; if (param_3 != 0) { options_menu_xxx_enable_array[(short)uVar1] = 1; } if ((*(byte *)(options_menu_xxx_enable_array + (short)uVar1) & 1) != 0) { enable_menu_item(600,uVar1); } } uVar1 = uVar1 + 1; } while ((short)uVar1 < 4); } if ((param_1 & 4) != 0) { uVar1 = 0; do { if (((uint)param_2 == (int)(short)uVar1) || (param_2 == 0xffff)) { help_menu_xxx_enable_array[(short)uVar1] = help_menu_xxx_enable_array[(short)uVar1] >> 1; if (param_3 != 0) { help_menu_xxx_enable_array[(short)uVar1] = 1; } if ((*(byte *)(help_menu_xxx_enable_array + (short)uVar1) & 1) != 0) { enable_menu_item(700,uVar1); } } uVar1 = uVar1 + 1; } while ((short)uVar1 < 7); } if ((param_1 & 8) != 0) { hMenu = GetSystemMenu(main_hwnd,0); sVar2 = 0; do { if (((uint)param_2 == (int)sVar2) || (param_2 == 0xffff)) { system_menu_xxx_enable_array[sVar2] = system_menu_xxx_enable_array[sVar2] >> 1; if (param_3 != 0) { system_menu_xxx_enable_array[sVar2] = 1; } if ((*(byte *)(system_menu_xxx_enable_array + sVar2) & 1) != 0) { if (sVar2 == 0) { EnableMenuItem(hMenu,0,0x400); } else if (sVar2 == 1) { EnableMenuItem(hMenu,SC_CLOSE,0); EnableMenuItem(hMenu,SC_TASKLIST,0); EnableMenuItem(hMenu,SC_MINIMIZE,0); } } } sVar2 = sVar2 + 1; } while (sVar2 < 2); } return; } uint __cdecl FUN_0042d06c(short param_1,short param_2) { return CONCAT22(param_2 >> 0xf,system_menu_xxx_enable_array[param_1 * 8 + (int)param_2]) & 0xffff0001; } void __cdecl init_tracked_heap_blocks(uint param_1) { short sVar1; tracked_heap_blocks_used = (linked_list_head *)malloc(8); tracked_heap_blocks_used->prev = (linked_list_head *)0x0; tracked_heap_blocks_used->next = (linked_list_head *)0x0; tracked_heap_blocks_free = (linked_list_head *)malloc(8); tracked_heap_blocks_free->prev = (linked_list_head *)0x0; tracked_heap_blocks_free->next = (linked_list_head *)0x0; tracked_heap_blocks_ents = (tracked_heap_block *)malloc((param_1 & 0xffff) * 0xc); for (sVar1 = 0; (int)sVar1 < (int)(param_1 & 0xffff); sVar1 = sVar1 + 1) { linked_list_insert((int *)tracked_heap_blocks_free, (undefined4 *)(tracked_heap_blocks_ents + sVar1),0xffff); } return; } void __stdcall free_tracked_heap_blocks(void) { nullsub(); free((int)tracked_heap_blocks_free); free((int)tracked_heap_blocks_used); free((int)tracked_heap_blocks_ents); return; } int __cdecl alloc_tracked_heap_block(uint param_1) { int *piVar1; uint *puVar2; piVar1 = (int *)deref_next_if_not_null(&tracked_heap_blocks_free->next); linked_list_unlink((int *)tracked_heap_blocks_free,piVar1); puVar2 = malloc(param_1); piVar1[2] = (int)puVar2; linked_list_insert((int *)tracked_heap_blocks_used,piVar1,0xffff); return piVar1[2]; } void __cdecl free_tracked_heap_block(int param_1) { int *piVar1; for (piVar1 = (int *)deref_next_if_not_null(&tracked_heap_blocks_used->next); (piVar1 != (int *)0x0 && (param_1 != piVar1[2])); piVar1 = (int *)deref_next(piVar1)) { } linked_list_unlink((int *)tracked_heap_blocks_used,piVar1); free(piVar1[2]); memset(piVar1,0,0xc); linked_list_insert((int *)tracked_heap_blocks_free,piVar1,0xffff); return; } void __stdcall nullsub(void) { return; } void __stdcall nullsub(void) { return; } void __stdcall nullishsub(void) { return; } void __stdcall nullishsub(void) { nullishsub(); return; } undefined4 __cdecl FUN_0042d20c(int param_1,int param_2) { int iVar1; undefined4 uVar2; iVar1 = *(int *)(param_2 + 10) - *(int *)(param_1 + 10); if (iVar1 < 1) { if (iVar1 < 0) { uVar2 = 0xffffffff; } else { uVar2 = 0; } } else { uVar2 = CONCAT22((short)((uint)iVar1 >> 0x10),1); } return uVar2; } void __stdcall init_new_player_hints(void) { short sVar1; new_player_hint_list = (linked_list_head *)alloc_linked_list_marker(); sVar1 = 0; do { new_player_hint_struct_ARRAY_00451230[sVar1].idx = -1; sVar1 = sVar1 + 1; } while (sVar1 < 5); return; } void __cdecl enqueue_new_player_hint(short param_1,ushort param_2,short *param_3) { int iVar1; short sVar2; if ((disable_hints == 0) && (save_file_big->seen_hint[param_1] == 0)) { sVar2 = 0; do { if (new_player_hint_struct_ARRAY_00451230[sVar2].idx == -1) break; sVar2 = sVar2 + 1; } while (sVar2 < 5); new_player_hint_struct_ARRAY_00451230[sVar2].idx = param_1; iVar1 = get_time_ms(); new_player_hint_struct_ARRAY_00451230[sVar2].time = iVar1 + (uint)param_2; new_player_hint_struct_ARRAY_00451230[sVar2].save_short_ptr = param_3; linked_list_insert_sorted ((int *)new_player_hint_list, (undefined4 *)(new_player_hint_struct_ARRAY_00451230 + sVar2),FUN_0042d20c); } return; } void __cdecl FUN_0042d2ea(int param_1) { free_resource_item_with_data(*(int *)(param_1 + 0x26)); free_resource_item_with_data(*(int *)(param_1 + 0x22)); free_tracked_heap_block(param_1); return; } undefined4 __stdcall process_new_player_hints(void) { int iVar1; int *piVar2; uint uVar3; undefined4 uVar4; uVar4 = 0; piVar2 = (int *)deref_next_if_not_null(&new_player_hint_list->next); if (piVar2 != (int *)0x0) { uVar3 = get_time_ms(); if (*(uint *)((int)piVar2 + 10) < uVar3) { iVar1 = piVar2[2]; if ((*(int *)((int)piVar2 + 0xe) == 0) || (**(short **)((int)piVar2 + 0xe) == 0)) { new_player_hint((short)iVar1); uVar4 = 1; } linked_list_unlink((int *)new_player_hint_list,piVar2); *(undefined2 *)(piVar2 + 2) = 0xffff; save_file_big->seen_hint[(short)iVar1] = 1; } } return uVar4; } void __stdcall tear_down_new_player_hints(void) { short sVar1; linked_list_head_zero(&new_player_hint_list->next); sVar1 = 0; do { new_player_hint_struct_ARRAY_00451230[sVar1].idx = -1; sVar1 = sVar1 + 1; } while (sVar1 < 5); return; } void __stdcall options_new_player_hints(void) { show_toggle_dialog(1000,0x3ea,0x3e9,&disable_hints); return; } void __cdecl new_player_hint(short param_1) { short sVar1; undefined2 *puVar2; undefined4 uVar3; if ((disable_hints == 0) && (save_file_big->seen_hint[param_1] == 0)) { puVar2 = (undefined2 *)new_no_buttons_dialog(); *puVar2 = 0xffff; puVar2[1] = 0xffff; *(undefined **)(puVar2 + 0xd) = PTR_s_New_Player_Hint_0044a9e8; *(undefined **)(puVar2 + 0xf) = PTR_s_Press_to_continue__0044a9ec; uVar3 = load_resource_item_0(param_1 + 1200,(int *)&text); *(undefined4 *)(puVar2 + 0x11) = uVar3; sVar1 = are_voices_enabled(); if (sVar1 == 0) { *(undefined4 *)(puVar2 + 0x13) = 0; } else { uVar3 = load_resource_item_0(param_1 + 0x4b0,(int *)&ints); *(undefined4 *)(puVar2 + 0x13) = uVar3; } show_dialog(puVar2); free_resource_item_with_data(*(int *)(puVar2 + 0x11)); if (*(int *)(puVar2 + 0x13) != 0) { free_resource_item_with_data(*(int *)(puVar2 + 0x13)); } free_tracked_heap_block((int)puVar2); } save_file_big->seen_hint[param_1] = 1; return; } void __stdcall debug_dump_new_player_hint(void) { int iVar1; undefined4 *puVar2; char *pcVar3; char local_1f8 [500]; iVar1 = linked_list_sz(&new_player_hint_list->next); if ((short)iVar1 != 0) { get_time_ms(); iVar1 = sprintf(local_1f8); pcVar3 = local_1f8 + iVar1; for (puVar2 = (undefined4 *)deref_next_if_not_null(&new_player_hint_list->next); puVar2 != (undefined4 *)0x0; puVar2 = (undefined4 *)deref_next(puVar2)) { iVar1 = sprintf(pcVar3); pcVar3 = pcVar3 + iVar1; } alert_message(local_1f8); } return; } undefined4 __stdcall ret0(void) { return 0; } void __stdcall FUN_0042d51f(void) { FUN_0042211c(); free_midi(0x1784); DAT_0044aa46 = 0; anim_engine_set_custom_command_handler(0); wave_ints_xxxxxxxxx = (short *)free_waves_from_list((int)wave_ints_xxxxxxxxx); key_xxxxx_clear(); mouse_region_delete_all_lists(); xxxfunc_set(&file_select_related_funcset_maybe); return; } void __stdcall FUN_0042d56b(void) { DAT_0044aa44 = 1; return; } void __stdcall FUN_0042d579(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if (sVar1 == 0x1b) { xxxfunc_set(&exit_game_funcset); return; } if (sVar1 == 0x20) { DAT_0044aa44 = 2; return; } DAT_0044aa44 = 1; return; } void __stdcall title_screen_onload(void) { short sVar1; int *piVar2; aseq_anim_state_struct *paVar3; int iVar4; CHAR local_104 [256]; if (DAT_0044aa46 == 0) { load_midi(6020); midi_stop_and_play(6020,1); DAT_0044aa46 = 1; } if (wave_ints_xxxxxxxxx == (short *)0x0) { wave_ints_xxxxxxxxx = (short *)load_wave_by_ints(1603); mouse_region_new_up_whole_screen(0x42d56b); key_xxxxx_set(FUN_0042d579); } DAT_0044aa44 = 0; load_rrgb_1(1602); piVar2 = load_aseq(1600); aseq_draw_to_both_fbs((int)piVar2,0,0,0); free_aseq(piVar2); title_screen_anim_batch = (title_screen_anim_xxx *)alloc_tracked_heap_block(0x20); sVar1 = 0; do { paVar3 = (aseq_anim_state_struct *)load_aseq(sVar1 + 1679); (&title_screen_anim_batch->anim_state)[sVar1] = paVar3; anim_state_xxx_list_insert_4((undefined4 *)(&title_screen_anim_batch->anim_state)[sVar1]); sVar1 = sVar1 + 1; } while (sVar1 < 8); aseq_1601 = (aseq_anim_state_struct *)load_aseq(1601); anim_state_xxx_list_insert_4((undefined4 *)aseq_1601); aseq_1602 = (aseq_anim_state_struct *)load_aseq(1602); anim_state_xxx_list_insert_4((undefined4 *)aseq_1602); sVar1 = 0; do { paVar3 = (aseq_anim_state_struct *)load_aseq(sVar1 + 1687); aseq_1678_4[sVar1] = paVar3; sVar1 = sVar1 + 1; } while (sVar1 < 4); string_0x80 = (char *)0x0; sVar1 = wrapped_loadstring(0x80,local_104,0xff); if (sVar1 != 0) { iVar4 = strlen(local_104); string_0x80 = (char *)alloc_tracked_heap_block(iVar4 + 1); strcpy(string_0x80,local_104); } aseq_set_pos_order((int)aseq_1678_4[0],0x5e,0x11,5); iVar4 = time_get_secs_count(2); anim_state_xxx_list_insert_shorter((undefined4 *)aseq_1678_4[0],iVar4); aseq_set_pos_order((int)aseq_1678_4[1],0x53,0x62,5); iVar4 = time_get_secs_count(3); anim_state_xxx_list_insert_shorter((undefined4 *)aseq_1678_4[1],iVar4); aseq_set_pos_order((int)aseq_1678_4[2],0x9e,0x109,5); iVar4 = time_get_secs_count(3); anim_state_xxx_list_insert_shorter((undefined4 *)aseq_1678_4[2],iVar4); iVar4 = time_get_secs_count(8); DAT_004512b8 = get_new_time_ms(iVar4); DAT_004512c0 = 8092; anim_engine_set_custom_command_handler(custom_anim_command_handler); FUN_00422170(); return; } void __stdcall title_screen_onremove(void) { aseq_anim_state_struct *paVar1; short sVar2; if (string_0x80 != (char *)0x0) { free_tracked_heap_block((int)string_0x80); string_0x80 = (char *)0x0; } aseq_1601 = (aseq_anim_state_struct *)free_aseq((int *)aseq_1601); aseq_1602 = (aseq_anim_state_struct *)free_aseq((int *)aseq_1602); sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *) free_aseq((int *)(&title_screen_anim_batch->anim_state)[sVar2]); (&title_screen_anim_batch->anim_state)[sVar2] = paVar1; sVar2 = sVar2 + 1; } while (sVar2 < 8); sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)aseq_1678_4[sVar2]); aseq_1678_4[sVar2] = paVar1; sVar2 = sVar2 + 1; } while (sVar2 < 4); free_tracked_heap_block((int)title_screen_anim_batch); return; } void __stdcall title_screen_onperiodic(void) { bool bVar1; short sVar2; undefined3 extraout_var; if (DAT_0044aa44 == 2) { xxxfunc_set(&xxxfunc_funcset_0044aa6c); } if (DAT_0044aa44 == 1) { xxxfunc_set(&xxxfunc_funcset_0044aa84); } if (DAT_004512c0 == 0x1f9c) { sVar2 = aseq_anim_get_flags((int)aseq_1678_4[0]); if (sVar2 == 0x10) { play_wave_flag1(0x1f9c,5,0); DAT_004512c0 = 0x1f9d; } } if (DAT_004512c0 == 0x1f9d) { sVar2 = aseq_anim_get_flags((int)aseq_1678_4[1]); if (sVar2 == 0x10) { play_wave_flag1(0x1f9d,5,0); FUN_0043dc0b(-1,(byte *)string_0x80,0,0x15c,0xff); DAT_004512c0 = 0; } } bVar1 = time_not_yet_reached_ms(DAT_004512b8); if ((short)CONCAT31(extraout_var,bVar1) != 0) { sVar2 = 0; do { anim_state_xxx_list_remove((int *)aseq_1678_4[sVar2]); sVar2 = sVar2 + 1; } while (sVar2 < 4); xxxfunc_set(&xxxfunc_funcset_0044aa84); } return; } void __stdcall FUN_0042d96b(void) { int *piVar1; int iVar2; DAT_0044aa44 = 0; load_rrgb_1(1601); piVar1 = load_aseq(1600); aseq_draw_to_both_fbs((int)piVar1,0,0,0); free_aseq(piVar1); aseq_1601 = (aseq_anim_state_struct *)load_aseq(1601); aseq_1602 = (aseq_anim_state_struct *)load_aseq(1602); aseq_set_pos_order((int)aseq_1601,-0x8000,-0x8000,5); anim_state_xxx_list_insert_4((undefined4 *)aseq_1601); aseq_set_pos_order((int)aseq_1602,-0x8000,-0x8000,5); anim_state_xxx_list_insert_4((undefined4 *)aseq_1602); iVar2 = time_get_secs_count(1); DAT_004512b8 = get_new_time_ms(iVar2); aseq_1678_4[0] = (aseq_anim_state_struct *)load_aseq(0x687); return; } void __stdcall FUN_0042da39(void) { stop_playing_all_waves(); aseq_1601 = (aseq_anim_state_struct *)free_aseq((int *)aseq_1601); aseq_1602 = (aseq_anim_state_struct *)free_aseq((int *)aseq_1602); aseq_1678_4[0] = (aseq_anim_state_struct *)free_aseq((int *)aseq_1678_4[0]); FUN_0042211c(); return; } void __stdcall FUN_0042da7b(void) { bool bVar1; short sVar2; undefined3 extraout_var; if (DAT_0044aa44 == 2) { xxxfunc_set(&xxxfunc_funcset_0044aa6c); } if (DAT_0044aa44 == 1) { xxxfunc_set(&xxxfunc_funcset_0044aa48); } if (DAT_004512b8 != 0) { bVar1 = time_not_yet_reached_ms(DAT_004512b8); if ((short)CONCAT31(extraout_var,bVar1) != 0) { DAT_004512b8 = 0; aseq_anim_reset_and_play((undefined4 *)aseq_1678_4[0]); } } sVar2 = aseq_anim_get_flags((int)aseq_1678_4[0]); if (sVar2 == 0x10) { xxxfunc_set(&xxxfunc_funcset_0044aa48); } return; } void __stdcall FUN_0042daf4(void) { int *piVar1; DAT_0044aa44 = 0; load_rrgb_1(0x644); piVar1 = load_aseq(0x688); aseq_draw_to_both_fbs((int)piVar1,0,0,0); free_aseq(piVar1); aseq_1678_4[0] = (aseq_anim_state_struct *)load_aseq(0x6a2); anim_state_xxx_list_insert_4((undefined4 *)aseq_1678_4[0]); load_wave_flag_1(0x640); FUN_00422170(); DAT_004512bc = 0; return; } void __stdcall FUN_0042db67(void) { free_wave_flag_1(0x640); aseq_1678_4[0] = (aseq_anim_state_struct *)free_aseq((int *)aseq_1678_4[0]); FUN_0042211c(); return; } void __stdcall FUN_0042db8d(void) { short sVar1; if (DAT_0044aa44 == 2) { xxxfunc_set(&xxxfunc_funcset_0044aa6c); } if (DAT_0044aa44 == 1) { xxxfunc_set(&xxxfunc_funcset_0044aa90); } sVar1 = aseq_anim_get_flags((int)aseq_1678_4[0]); if (sVar1 == 0x10) { aseq_anim_reset_and_play((undefined4 *)aseq_1678_4[0]); play_wave_flag1(0x640,5,0); DAT_004512bc = 1; } sVar1 = aseq_anim_get_flags((int)aseq_1678_4[0]); if (sVar1 == 1) { xxxfunc_set(&xxxfunc_funcset_0044aa90); } return; } void __cdecl FUN_0042dc11(short *param_1) { short sVar1; uint uVar2; int iVar3; int iVar4; undefined4 local_8; sVar1 = param_1[3]; FUN_0043e3fb(-1,DAT_004512c4,(short *)((int)&local_8 + 2),(short *)&local_8); uVar2 = (int)(short)(sVar1 + -0x17) - (int)(short)local_8; iVar3 = (int)uVar2 >> 1; if (iVar3 < 0) { iVar3 = iVar3 + (uint)((uVar2 & 1) != 0); } iVar4 = (int)param_1[2] - (int)local_8._2_2_ >> 1; if (iVar4 < 0) { iVar4 = iVar4 + (uint)(((int)param_1[2] - (int)local_8._2_2_ & 1U) != 0); } FUN_00401220((short)iVar4 + *param_1,(short)iVar3 + param_1[1],DAT_004512c4); return; } void __stdcall FUN_0042dc77(void) { int *piVar1; DAT_0044aa44 = 0; load_rrgb_1(0x645); piVar1 = load_aseq(0x69f); aseq_draw_to_both_fbs((int)piVar1,0,0,0); free_aseq(piVar1); aseq_1678_4[0] = (aseq_anim_state_struct *)load_aseq(0x6a0); anim_state_xxx_list_insert_4((undefined4 *)aseq_1678_4[0]); aseq_1678_4[1] = (aseq_anim_state_struct *)load_aseq(0x6a1); aseq_anim_override_timing((int)aseq_1678_4[1],10,0); aseq_set_pos_order((int)aseq_1678_4[1],0x156,0x87,5); anim_state_xxx_list_insert_8004((undefined4 *)aseq_1678_4[1]); DAT_004512c8 = load_resource_item_0(0x644,(int *)PTR_ints_0044ae18); aseq_1678_4[2] = (aseq_anim_state_struct *)load_aseq(0x6a4); anim_set_flags_0x800_handler((int)aseq_1678_4[2],0x42dc11,0); FUN_00422170(); DAT_004512bc = 0; midi_stop(0x1784); return; } void __stdcall FUN_0042dd5f(void) { free_resource_item_with_idx_fourcc(0x644,PTR_ints_0044ae18); if (DAT_004512be == 0) { if (DAT_004512c4 != 0) { free_resource_item_with_data(DAT_004512c4); } } else { FUN_00437219(); } aseq_1678_4[2] = (aseq_anim_state_struct *)free_aseq((int *)aseq_1678_4[2]); aseq_1678_4[1] = (aseq_anim_state_struct *)free_aseq((int *)aseq_1678_4[1]); aseq_1678_4[0] = (aseq_anim_state_struct *)free_aseq((int *)aseq_1678_4[0]); midi_stop_and_play(0x1784,1); FUN_0042211c(); return; } void __stdcall FUN_0042ddda(void) { ushort *puVar1; ushort *puVar2; bool bVar3; short sVar4; ushort uVar5; undefined3 extraout_var; undefined3 extraout_var_00; int iVar6; undefined3 extraout_var_01; if (DAT_0044aa44 == 2) { xxxfunc_set(&xxxfunc_funcset_0044aa6c); } if ((DAT_004512be != 0) && (DAT_0044aa44 == 1)) { xxxfunc_set(&xxxfunc_funcset_0044aa9c); } switch(DAT_004512bc) { case 0: DAT_004512be = are_voices_enabled(); puVar1 = DAT_004512c8; DAT_004512c0 = *DAT_004512c8; DAT_004512c8 = DAT_004512c8 + 1; uVar5 = *DAT_004512c8; DAT_004512c8 = puVar1 + 2; puVar2 = DAT_004512c8; if (DAT_004512c0 == 0xfffd) { anim_change_to_xxx((int *)aseq_1678_4[0],2); return; } if (DAT_004512c0 != 0xfffe) { if (DAT_004512c0 == 0xffff) { DAT_004512bc = 3; return; } if (DAT_004512be == 0) { DAT_004512c8 = puVar1 + 3; DAT_004512c4 = load_resource_item_0(*puVar2,(int *)PTR_text_0044ae14); puVar1 = DAT_004512c8; DAT_004512c8 = DAT_004512c8 + 1; aseq_select_anim((int)aseq_1678_4[2],*puVar1); anim_state_xxx_list_insert_4((undefined4 *)aseq_1678_4[2]); iVar6 = time_get_secs_count(0x1e); DAT_004512b8 = get_new_time_ms(iVar6); } else { load_wave_flag_2(DAT_004512c0); DAT_004512c8 = DAT_004512c8 + 2; play_wave_flag2(DAT_004512c0); DAT_004512b8 = 0; } anim_change_to_xxx((int *)aseq_1678_4[1],uVar5); anim_state_xxx_list_remove((int *)aseq_1678_4[1]); aseq_anim_reset_and_play((undefined4 *)aseq_1678_4[1]); DAT_004512bc = 1; return; } anim_change_to_xxx((int *)aseq_1678_4[0],1); return; case 1: if ((DAT_004512be != 0) && (sVar4 = wave_is_playing_(DAT_004512c0), sVar4 == 0)) { aseq_anim_flags_make_2((int)aseq_1678_4[1]); } if (DAT_004512be == 0) { bVar3 = time_not_yet_reached_ms(DAT_004512b8); if (((short)CONCAT31(extraout_var_00,bVar3) != 0) || (DAT_0044aa44 == 1)) { free_resource_item_with_data(DAT_004512c4); DAT_004512c4 = 0; aseq_anim_reset_and_play((undefined4 *)aseq_1678_4[2]); iVar6 = time_get_secs_count(1); DAT_004512b8 = get_new_time_ms(iVar6); DAT_004512bc = 2; DAT_0044aa44 = 0; return; } } else { uVar5 = aseq_anim_get_flags((int)aseq_1678_4[1]); if ((((uVar5 & 0x13) != 0) && (bVar3 = time_not_yet_reached_ms(DAT_004512b8), (short)CONCAT31(extraout_var,bVar3) != 0)) && (sVar4 = wave_is_playing_(DAT_004512c0), sVar4 == 0)) { free_wave_flag_2(DAT_004512c0); DAT_004512c0 = 0; DAT_004512bc = 0; return; } } break; case 2: bVar3 = time_not_yet_reached_ms(DAT_004512b8); if ((short)CONCAT31(extraout_var_01,bVar3) != 0) { DAT_004512bc = 0; } if (DAT_0044aa44 == 1) { xxxfunc_set(&xxxfunc_funcset_0044aa9c); return; } break; case 3: xxxfunc_set(&xxxfunc_funcset_0044aa9c); return; } return; } void __stdcall FUN_0042e0bd(void) { int *piVar1; DAT_0044aa44 = 0; load_rrgb_1(0x644); piVar1 = load_aseq(0x688); aseq_draw_to_both_fbs((int)piVar1,0,0,0); free_aseq(piVar1); title_screen_anim_batch = (title_screen_anim_xxx *)alloc_tracked_heap_block(0x28); memset((undefined4 *)title_screen_anim_batch,0,0x28); DAT_004512bc = 0; aseq_1678_4[0] = (aseq_anim_state_struct *)load_aseq(0x68e); FUN_00422170(); return; } void __stdcall FUN_0042e138(void) { short sVar1; aseq_1678_4[0] = (aseq_anim_state_struct *)free_aseq((int *)aseq_1678_4[0]); aseq_1678_4[1] = (aseq_anim_state_struct *)free_aseq((int *)aseq_1678_4[1]); sVar1 = 0; do { free_aseq((int *)(&title_screen_anim_batch->anim_state)[sVar1]); sVar1 = sVar1 + 1; } while (sVar1 < 10); free_tracked_heap_block((int)title_screen_anim_batch); FUN_0042211c(); return; } void __stdcall FUN_0042e18d(void) { short sVar1; short sVar2; uint uVar3; aseq_anim_state_struct *paVar4; int iVar5; short sVar6; int iVar7; if (DAT_0044aa44 == 2) { xxxfunc_set(&xxxfunc_funcset_0044aa6c); } if (DAT_0044aa44 == 1) { xxxfunc_set(&xxxfunc_funcset_0044aa54); } switch(DAT_004512bc) { case 0: aseq_anim_reset_and_play((undefined4 *)aseq_1678_4[0]); DAT_004512bc = 1; break; case 1: sVar2 = aseq_anim_get_flags((int)aseq_1678_4[0]); if (sVar2 == 1) { free_aseq((int *)aseq_1678_4[0]); aseq_1678_4[0] = (aseq_anim_state_struct *)load_aseq(0x68c); aseq_anim_reset_and_play((undefined4 *)aseq_1678_4[0]); DAT_004512bc = 2; } break; case 2: sVar2 = aseq_anim_get_flags((int)aseq_1678_4[0]); if (sVar2 == 0x10) { aseq_1678_4[1] = (aseq_anim_state_struct *)load_aseq(0x68d); aseq_anim_reset_and_play((undefined4 *)aseq_1678_4[1]); DAT_004512bc = 3; } break; case 3: sVar2 = aseq_anim_get_flags((int)aseq_1678_4[1]); if (sVar2 == 1) { aseq_1678_4[1] = (aseq_anim_state_struct *)free_aseq((int *)aseq_1678_4[1]); aseq_anim_reset_and_play((undefined4 *)aseq_1678_4[0]); DAT_004512bc = 4; } break; case 4: sVar2 = aseq_anim_get_flags((int)aseq_1678_4[0]); if (sVar2 == 1) { free_aseq((int *)aseq_1678_4[0]); aseq_1678_4[0] = (aseq_anim_state_struct *)load_aseq(0x68a); aseq_anim_reset_and_play((undefined4 *)aseq_1678_4[0]); DAT_004512bc = 5; } break; case 5: sVar2 = aseq_anim_get_flags((int)aseq_1678_4[0]); if (sVar2 == 1) { aseq_1678_4[1] = (aseq_anim_state_struct *)load_aseq(0x68b); aseq_anim_reset_and_play((undefined4 *)aseq_1678_4[1]); DAT_004512bc = 6; } break; case 6: sVar2 = aseq_anim_get_flags((int)aseq_1678_4[1]); if (sVar2 == 1) { iVar7 = 0; sVar6 = 0; sVar2 = 0x32; do { uVar3 = rand(); if ((int)uVar3 % 100 < 0x32) { sVar1 = 0x68a; } else { sVar1 = 0x68b; } paVar4 = (aseq_anim_state_struct *)load_aseq(sVar1); (&title_screen_anim_batch->anim_state)[sVar6] = paVar4; aseq_set_pos_order((int)(&title_screen_anim_batch->anim_state)[sVar6],-0x8000,-0x8000,sVar2) ; anim_state_xxx_list_insert_shorter ((undefined4 *)(&title_screen_anim_batch->anim_state)[sVar6],iVar7); iVar5 = time_get_secs_count(1); uVar3 = time_get_one_over_secs_count(3); iVar7 = iVar7 + iVar5 + uVar3; sVar6 = sVar6 + 1; sVar2 = sVar2 + -1; } while (sVar6 < 10); DAT_004512bc = 7; } break; case 7: sVar2 = aseq_anim_get_flags(title_screen_anim_batch[4].field1_0x4); if (sVar2 == 1) { xxxfunc_set(&xxxfunc_funcset_0044aa54); } } return; } void __stdcall FUN_0042e43e(void) { int *piVar1; DAT_0044aa44 = 0; load_rrgb_1(0x641); piVar1 = load_aseq(0x640); aseq_draw_to_both_fbs((int)piVar1,0,0,0); free_aseq(piVar1); aseq_1678_4[0] = (aseq_anim_state_struct *)load_aseq(0x689); anim_state_xxx_list_insert_4((undefined4 *)aseq_1678_4[0]); aseq_1601 = (aseq_anim_state_struct *)load_aseq(0x641); anim_state_xxx_list_insert_4((undefined4 *)aseq_1601); aseq_1602 = (aseq_anim_state_struct *)load_aseq(0x642); anim_state_xxx_list_insert_4((undefined4 *)aseq_1602); FUN_00422170(); return; } void __stdcall FUN_0042e4d5(void) { aseq_1601 = (aseq_anim_state_struct *)free_aseq((int *)aseq_1601); aseq_1602 = (aseq_anim_state_struct *)free_aseq((int *)aseq_1602); aseq_1678_4[0] = (aseq_anim_state_struct *)free_aseq((int *)aseq_1678_4[0]); FUN_0042211c(); return; } void __stdcall FUN_0042e512(void) { short sVar1; if (DAT_0044aa44 == 2) { xxxfunc_set(&xxxfunc_funcset_0044aa6c); } if (DAT_0044aa44 == 1) { xxxfunc_set(&xxxfunc_funcset_0044aa60); } sVar1 = aseq_anim_get_flags((int)aseq_1678_4[0]); if (sVar1 == 0x10) { xxxfunc_set(&xxxfunc_funcset_0044aa60); } return; } void __stdcall FUN_0042e55e(void) { int *piVar1; int iVar2; DAT_0044aa44 = 0; load_rrgb_1(6000); piVar1 = load_aseq(6000); aseq_draw_to_both_fbs((int)piVar1,0,0,0); free_aseq(piVar1); piVar1 = load_aseq(1699); aseq_draw_to_both_fbs((int)piVar1,0x95,0x3f,0); free_aseq(piVar1); iVar2 = time_get_secs_count(0x1e); DAT_004512b8 = get_new_time_ms(iVar2); FUN_00422170(); return; } void __stdcall FUN_0042e5db(void) { FUN_0042211c(); return; } void __stdcall FUN_0042e5e5(void) { bool bVar1; undefined1 extraout_AH; if ((DAT_0044aa44 == 2) || (DAT_0044aa44 == 1)) { xxxfunc_set(&xxxfunc_funcset_0044aa6c); } bVar1 = time_not_yet_reached_ms(DAT_004512b8); if (CONCAT11(extraout_AH,bVar1) != 0) { xxxfunc_set(&default_funcset); } return; } short __stdcall load_area_parts(void) { word wVar1; area_parts_hdr *paVar2; aseq_anim_state_struct *paVar3; char *pcVar4; part_chunk *ppVar5; word wVar6; loaded_area_parts = (area_parts_hdr *)load_resource_item_0(save_file_big->area + 1000,(int *)&part); paVar2 = loaded_area_parts + 1; loaded_area_parts->shorts = (undefined *)paVar2; ppVar5 = (part_chunk *)(paVar2->unk2 + (short)loaded_area_parts->num_parts_needed + -5); loaded_area_parts->parts = (undefined *)ppVar5; opponent_parts = ppVar5 + (short)loaded_area_parts->num_parts; wVar1 = loaded_area_parts->num_parts; wVar6 = 0; loaded_parts = ppVar5; if (0 < (short)wVar1) { do { paVar3 = (aseq_anim_state_struct *)load_aseq(loaded_area_parts->aseq_idx_for_status_bar); ppVar5->anim_for_status_bar = paVar3; aseq_select_anim((int)ppVar5->anim_for_status_bar,ppVar5->anim_idx_for_status_bar); ppVar5->idx_in_file = wVar6; pcVar4 = (char *)load_resource_item_0(ppVar5->wave_text_idx,(int *)PTR_text_0044ae14); ppVar5->text = pcVar4; (ppVar5->rect_and_anim_for_conveyor).anim = (aseq_anim_state_struct *)0x0; ppVar5 = ppVar5 + 1; wVar6 = wVar6 + 1; } while ((short)wVar6 < (short)wVar1); } return wVar1; } void __stdcall free_part_xxx(void) { word wVar1; aseq_anim_state_struct *paVar2; part_chunk *ppVar3; short sVar4; wVar1 = loaded_area_parts->num_parts; sVar4 = 0; ppVar3 = loaded_parts; if (0 < (short)wVar1) { do { paVar2 = (aseq_anim_state_struct *)free_aseq((int *)ppVar3->anim_for_status_bar); ppVar3->anim_for_status_bar = paVar2; free_resource_item_with_idx_fourcc(ppVar3->wave_text_idx,PTR_text_0044ae14); ppVar3->text = (char *)0x0; ppVar3 = ppVar3 + 1; sVar4 = sVar4 + 1; } while (sVar4 < (short)wVar1); } free_resource_item_with_data((int)loaded_area_parts); loaded_area_parts = (area_parts_hdr *)0x0; return; } undefined4 __cdecl part_get_slot(short param_1) { return CONCAT22((short)((uint)(param_1 * 0x31) >> 0x10),loaded_parts[param_1].slot); } undefined4 __cdecl part_get_anim_idx_for_status_bar(short param_1) { return CONCAT22((short)((uint)(param_1 * 0x31) >> 0x10), loaded_parts[param_1].anim_idx_for_status_bar); } undefined4 __cdecl part_get_aseq_for_conveyor(short param_1) { return CONCAT22((short)((uint)(param_1 * 0x31) >> 0x10), loaded_parts[param_1].aseq_idx_for_conveyor); } undefined4 __cdecl part_get_aseq_for_vehicle(short param_1) { return CONCAT22((short)((uint)(param_1 * 0x31) >> 0x10),loaded_parts[param_1].aseq_idx_for_vehicle ); } undefined4 __cdecl part_get_is_not_decoration(short param_1) { return CONCAT22((short)((uint)(param_1 * 0x31) >> 0x10),loaded_parts[param_1].is_not_decoration); } int __cdecl part_get_chunk_by_file_idx(short param_1) { return (int)(loaded_parts + param_1); } void __cdecl shuffle_parts_related_array(short param_1) { word wVar1; short sVar2; wVar1 = loaded_area_parts->num_parts; parts_related_array_idx = 0; rand_shuffle_array(param_1,parts_related_array); sVar2 = 0; if (0 < param_1) { do { if ((short)wVar1 <= parts_related_array[sVar2]) { parts_related_array[sVar2] = 1000; } sVar2 = sVar2 + 1; } while (sVar2 < param_1); } return; } undefined4 __stdcall get_parts_related_array_item(void) { short sVar1; sVar1 = parts_related_array_idx; parts_related_array_idx = parts_related_array_idx + 1; return CONCAT22(sVar1 >> 0xf,parts_related_array[sVar1]); } int __cdecl part_linked_list_find_given_slot(undefined4 *param_1,short param_2,undefined2 *param_3) { undefined4 *puVar1; int iVar2; puVar1 = (undefined4 *)deref_next_if_not_null(param_1); *param_3 = 0xffff; iVar2 = 0; for (; puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { if (param_2 == *(short *)(puVar1 + 2)) { iVar2 = iVar2 + 1; *param_3 = *(undefined2 *)(puVar1 + 0x18); } } return iVar2; } undefined2 __cdecl actor_parts_find_by_slot(undefined4 *param_1,short param_2) { undefined4 *puVar1; for (puVar1 = (undefined4 *)deref_next_if_not_null(param_1); (puVar1 != (undefined4 *)0x0 && (param_2 != *(short *)(puVar1 + 2))); puVar1 = (undefined4 *)deref_next(puVar1)) { } return *(undefined2 *)(puVar1 + 0x18); } int __cdecl actor_count_held_parts(short param_1) { undefined4 *puVar1; int iVar2; puVar1 = (undefined4 *)deref_next_if_not_null(&(actors[param_1].parts_linked_list)->next); iVar2 = 0; for (; puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { if (param_1 == *(short *)(puVar1 + 3)) { iVar2 = iVar2 + 1; } } return iVar2; } undefined4 __stdcall part_get_num_parts_needed(void) { return CONCAT22((short)((uint)loaded_area_parts >> 0x10),loaded_area_parts->num_parts_needed); } void __cdecl part_find_next_skipping_second___(undefined4 *param_1) { undefined4 *puVar1; for (puVar1 = (undefined4 *)deref_next(param_1); (puVar1 != (undefined4 *)0x0 && (-1 < *(short *)(puVar1 + 7))); puVar1 = (undefined4 *)deref_next(puVar1)) { } return; } void __cdecl part_find_prev_skipping_second___(int param_1) { int iVar1; for (iVar1 = deref_prev(param_1); (iVar1 != 0 && (-1 < *(short *)(iVar1 + 0x1c))); iVar1 = deref_prev(iVar1)) { } return; } void __cdecl write_parts_fields(undefined2 *param_1) { short sVar1; for (sVar1 = 0; sVar1 < (short)loaded_area_parts->num_parts; sVar1 = sVar1 + 1) { *param_1 = loaded_parts[sVar1].held_by_actor; param_1[1] = loaded_parts[sVar1].state_flags; param_1 = param_1 + 2; } return; } void __cdecl parse_save_big_part_related(short *param_1) { short sVar1; sVar1 = 0; while( true ) { if ((short)loaded_area_parts->num_parts <= sVar1) break; if (*param_1 != -1) { actor_give_part(*param_1,sVar1); if (*param_1 == 0) { FUN_004070c3(sVar1); } } loaded_parts[sVar1].state_flags = param_1[1]; param_1 = param_1 + 2; sVar1 = sVar1 + 1; } return; } void __stdcall cheat_give_all_parts(void) { word *pwVar1; short sVar2; short sVar3; for (sVar2 = 0; sVar2 < (short)loaded_area_parts->num_parts_needed; sVar2 = sVar2 + 1) { sVar3 = sVar2 * 4 + 3; actor_give_part(0,sVar3); FUN_004070c3(sVar3); status_bar_flags = status_bar_flags | 1; pwVar1 = &(save_file_big->basic_stats).parts_needed; *pwVar1 = *pwVar1 - 1; } return; } void __cdecl race_1_calc_parts_result(int param_1,short *param_2) { word wVar1; short sVar2; int iVar3; int local_1c [6]; local_1c[0] = 0; local_1c[1] = 0; local_1c[2] = 0; local_1c[3] = race_1_base_minmax_speed[(short)save_file_big->level_in_building]; for (; *param_2 != -1; param_2 = param_2 + 1) { wVar1 = loaded_parts[*param_2].perf; switch(loaded_parts[*param_2].slot) { case 0xd: local_1c[3] = local_1c[3] - INT_ARRAY_0044aafc[(short)wVar1]; break; case 0xe: local_1c[3] = local_1c[3] - INT_ARRAY_0044ab08[(short)wVar1]; break; case 0xf: local_1c[0] = INT_ARRAY_0044ab18[(short)wVar1]; break; case 0x10: local_1c[0] = local_1c[0] + INT_ARRAY_0044ab20[(short)wVar1]; break; case 0x11: local_1c[0] = local_1c[0] + INT_ARRAY_0044ab30[(short)wVar1]; break; case 0x12: local_1c[0] = local_1c[0] + INT_ARRAY_0044ab40[(short)wVar1]; break; case 0x13: local_1c[0] = local_1c[0] + INT_ARRAY_0044ab4c[(short)wVar1]; break; case 0x14: local_1c[0] = local_1c[0] + INT_ARRAY_0044ab5c[(short)wVar1]; break; case 0x15: local_1c[0] = local_1c[0] + INT_ARRAY_0044ab6c[(short)wVar1]; break; case 0x16: local_1c[0] = local_1c[0] + INT_ARRAY_0044ab7c[(short)wVar1]; break; case 0x17: local_1c[0] = local_1c[0] + INT_ARRAY_0044ab8c[(short)wVar1]; break; case 0x18: local_1c[3] = local_1c[3] - INT_ARRAY_0044ab9c[(short)wVar1]; break; case 0x19: local_1c[3] = local_1c[3] - INT_ARRAY_0044ab9c[(short)wVar1]; break; case 0x1a: local_1c[3] = local_1c[3] - INT_ARRAY_0044abbc[(short)wVar1]; break; case 0x1b: local_1c[3] = local_1c[3] - INT_ARRAY_0044abcc[(short)wVar1]; break; case 0x1c: local_1c[3] = local_1c[3] - INT_ARRAY_0044abdc[(short)wVar1]; break; case 0x1d: local_1c[3] = local_1c[3] - INT_ARRAY_0044abec[(short)wVar1]; break; case 0x1e: local_1c[3] = local_1c[3] - INT_ARRAY_0044ac7c[(short)wVar1]; break; case 0x1f: local_1c[3] = local_1c[3] - INT_ARRAY_0044ac8c[(short)wVar1]; break; case 0x20: local_1c[0] = local_1c[0] + INT_ARRAY_0044ac9c[(short)wVar1]; break; case 0x21: local_1c[3] = local_1c[3] - INT_ARRAY_0044acac[(short)wVar1]; break; case 0x24: local_1c[3] = local_1c[3] - INT_ARRAY_0044acbc[(short)wVar1]; break; case 0x25: local_1c[3] = local_1c[3] - INT_ARRAY_0044accc[(short)wVar1]; break; case 0x26: local_1c[3] = local_1c[3] - INT_ARRAY_0044acdc[(short)wVar1]; break; case 0x27: local_1c[3] = local_1c[3] - INT_ARRAY_0044acec[(short)wVar1]; break; case 0x28: local_1c[3] = local_1c[3] - INT_ARRAY_0044abfc[(short)wVar1]; break; case 0x29: local_1c[3] = local_1c[3] - INT_ARRAY_0044ac0c[(short)wVar1]; break; case 0x2a: local_1c[3] = local_1c[3] - INT_ARRAY_0044ac1c[(short)wVar1]; break; case 0x2b: local_1c[3] = local_1c[3] - INT_ARRAY_0044ac2c[(short)wVar1]; break; case 0x2c: local_1c[0] = local_1c[0] + INT_ARRAY_0044ac3c[(short)wVar1]; break; case 0x2d: local_1c[0] = local_1c[0] + INT_ARRAY_0044ac4c[(short)wVar1]; break; case 0x2e: local_1c[3] = local_1c[3] - INT_ARRAY_0044ac5c[(short)wVar1]; break; case 0x2f: local_1c[3] = local_1c[3] - INT_ARRAY_0044ac6c[(short)wVar1]; } } iVar3 = (int)(short)save_file_big->level_in_building; if (iVar3 != 0) { if (iVar3 == 1) { local_1c[4] = 0x50000; local_1c[1] = 0x4ccd; local_1c[5] = 0x18000; local_1c[3] = 0x18000; local_1c[0] = -local_1c[0]; local_1c[2] = local_1c[0]; goto LAB_0042ed97; } if (2 < iVar3 - 2U) goto LAB_0042ed97; } local_1c[5] = local_1c[3]; local_1c[4] = local_1c[3]; local_1c[2] = local_1c[0]; local_1c[1] = local_1c[0]; LAB_0042ed97: sVar2 = 0; do { *(int *)(param_1 + 0x1c + sVar2 * 4) = local_1c[sVar2 + 3]; *(int *)(param_1 + 0x28 + sVar2 * 4) = local_1c[sVar2]; sVar2 = sVar2 + 1; } while (sVar2 < 3); return; } void __cdecl race_1_rdat_animate(int param_1,undefined4 param_2) { int *piVar1; bool bVar2; short *psVar3; short sVar4; bVar2 = false; sVar4 = 0; while (!bVar2) { if (*(short *)(param_1 + 4 + sVar4 * 10) == -1) { bVar2 = true; } else { piVar1 = *(int **)(param_1 + 6 + sVar4 * 10); anim_state_xxx_list_remove(piVar1); aseq_set_pos_order((int)piVar1, *(short *)(param_1 + sVar4 * 10) - (short)((uint)param_2 >> 0x10), *(short *)(param_1 + 2 + sVar4 * 10),0); anim_state_xxx_list_insert_4(piVar1); psVar3 = (short *)aseq_anim_get_some_rect((int)piVar1); if ((0x200 < *psVar3) || ((int)*psVar3 + (int)psVar3[2] < 0)) { anim_state_xxx_list_remove(piVar1); } } sVar4 = sVar4 + 1; } return; } void __cdecl race_1_calc_step_delta(int param_1) { short sVar1; sVar1 = *(short *)(param_1 + 0x14); *(int *)(param_1 + 0xe) = *(int *)(param_1 + 0xe) + *(int *)(param_1 + 0x28 + sVar1 * 4); if (*(int *)(param_1 + 0x28 + sVar1 * 4) < 0) { if (*(int *)(param_1 + 0xe) < *(int *)(param_1 + 0x1c + sVar1 * 4)) { *(undefined4 *)(param_1 + 0xe) = *(undefined4 *)(param_1 + 0x1c + sVar1 * 4); return; } } else if (*(int *)(param_1 + 0x1c + sVar1 * 4) < *(int *)(param_1 + 0xe)) { *(undefined4 *)(param_1 + 0xe) = *(undefined4 *)(param_1 + 0x1c + sVar1 * 4); } return; } uint __cdecl race_1_process_path(int param_1) { short sVar1; bool bVar2; undefined2 uVar3; int in_EAX; bVar2 = false; uVar3 = 0; do { if (bVar2) { return CONCAT22((short)((uint)in_EAX >> 0x10),uVar3); } *(short *)(param_1 + 0x12) = *(short *)(param_1 + 0x12) + 1; sVar1 = *(short *)(*(int *)(param_1 + 0x18) + *(short *)(param_1 + 0x12) * 6); in_EAX = *(short *)(*(int *)(param_1 + 0x18) + 4 + *(short *)(param_1 + 0x12) * 6) + 0xe; switch(in_EAX) { case 0: in_EAX = stop_playing_wave_by_id_type1(sVar1); break; case 1: in_EAX = wave_is_playing_(sVar1); if ((short)in_EAX == 0) { in_EAX = play_wave_flag1(sVar1,0,0); } break; case 2: in_EAX = CONCAT22((short)((uint)(*(short *)(param_1 + 0x12) * 3) >> 0x10), *(short *)(*(int *)(param_1 + 0x18) + *(short *)(param_1 + 0x12) * 6) + *(short *)(param_1 + 0x12)) + -1; *(short *)(param_1 + 0x12) = (short)in_EAX; break; case 3: case 5: *(undefined2 *)(param_1 + 0x14) = 0; break; case 4: *(undefined2 *)(param_1 + 0x14) = 2; break; case 6: *(undefined2 *)(param_1 + 0x14) = 1; break; case 7: case 8: break; case 0xc: *(undefined2 *)(param_1 + 0x16) = 1; uVar3 = 1; break; case 0xd: DAT_0045143e = 1; default: bVar2 = true; } } while( true ); } void __stdcall FUN_0042efc4(void) { DAT_0044ad10 = 1; return; } void __stdcall race_1_on_load(void) { int *piVar1; aseq_anim_state_struct *paVar2; short sVar3; race_1_level = save_file_big->level_in_building; load_rrgb_1(5500); gfxish_fill_rect_wrap(0,0,0x200,0x12a,0xee0); gfxish_copy_dest_to_otherbuf_wrap(); loaded_rdat = (short *)load_resource_item_0(save_file_big->level_in_building + 5500,(int *)&rdat); loaded_rdat_thing0 = (rdat_chunk *)(loaded_rdat + 1); loaded_rdat_thing1 = (rdat_chunk *)(loaded_rdat + *loaded_rdat * 5 + 2); piVar1 = load_aseq(5701); aseq_draw_to_both_fbs((int)piVar1,0,0xfb,0); free_aseq(piVar1); piVar1 = load_aseq(5700); aseq_draw_to_both_fbs((int)piVar1,0,0xd5,0); free_aseq(piVar1); load_midi(6002); midi_stop_and_play(6002,1); DAT_00451398 = load_wave_by_ints(WORD_ARRAY_0044aac0[(short)race_1_level]); sVar3 = 0; while (loaded_rdat_thing0[sVar3].anim_idx != 0xffff) { paVar2 = (aseq_anim_state_struct *)load_aseq(loaded_rdat_thing0[sVar3].anim_idx + 5700); loaded_rdat_thing0[sVar3].anim_state = paVar2; sVar3 = sVar3 + 1; } sVar3 = 0; while (loaded_rdat_thing1[sVar3].anim_idx != 0xffff) { paVar2 = (aseq_anim_state_struct *)load_aseq(loaded_rdat_thing1[sVar3].anim_idx + 5700); loaded_rdat_thing1[sVar3].anim_state = paVar2; sVar3 = sVar3 + 1; } race_1_state_player.race_data = (short *)load_resource_item_0(race_idx_array_0[(short)race_1_level],(int *)&race); race_1_state_player.anim_state = (aseq_anim_state_struct *) load_aseq((short)save_file_big->vehicle_colors_shapes[save_file_big->area] + race_1_veh_aseq_base_idx_player[(short)race_1_level]); sVar3 = DAT_0044a77e; if (DAT_0044a77c == 0) { sVar3 = 0x14; } aseq_anim_override_timing((int)race_1_state_player.anim_state,sVar3,0); race_1_state_morty.race_data = (short *)load_resource_item_0(race_idx_array_1[(short)race_1_level],(int *)&race); race_1_state_morty.anim_state = (aseq_anim_state_struct *)load_aseq(race_1_veh_aseq_idx_morty[(short)race_1_level]); sVar3 = DAT_0044a77e; if (DAT_0044a77c == 0) { sVar3 = 0x14; } aseq_anim_override_timing((int)race_1_state_morty.anim_state,sVar3,0); if (save_file_big->level_in_building == 1) { race_1_lvl_1_launch_plane_aseq_0 = (aseq_anim_state_struct *)load_aseq(5734); race_1_lvl_1_launch_plane_aseq_1 = (aseq_anim_state_struct *)load_aseq(5734); race_1_lvl_1_launch_plane_race_data_0 = (short *)load_resource_item_0(5506,(int *)&race); race_1_lvl_1_launch_plane_race_data_1 = (short *)load_resource_item_0(5507,(int *)&race); } else { race_1_lvl_1_launch_plane_race_data_0 = (short *)0x0; } race_1_calc_parts_result(0x4513ac,filtered_parts_array); race_1_calc_parts_result(0x4513ee,opponent_parts); race_1_rdat_bg_parallax_1_pos = 0; race_1_rdat_bg_parallax_0_pos = 0; race_1_state_player.track_step_delta = 0; race_1_state_player.race_data_idx_pos = 0; race_1_state_morty.track_step_delta = 0; race_1_state_morty.race_data_idx_pos = 0; race_1_state_player.finished_cmd2 = 0; race_1_state_morty.finished_cmd2 = 0; race_1_lvl_1_launch_plane_step = 0; race_1_state_player.track_step_fine = (uint)(ushort)*race_1_state_player.race_data << 0x10; race_1_state_morty.track_step_fine = (uint)(ushort)*race_1_state_morty.race_data << 0x10; race_1_state_player.actual_unwrapped_x = *race_1_state_player.race_data; race_1_state_morty.actual_unwrapped_x = *race_1_state_morty.race_data; aseq_set_pos_order((int)race_1_state_player.anim_state,*race_1_state_player.race_data, race_1_state_player.race_data[1],5); aseq_set_pos_order((int)race_1_state_morty.anim_state,*race_1_state_morty.race_data, race_1_state_morty.race_data[1],10); anim_state_xxx_list_insert_8004((undefined4 *)race_1_state_player.anim_state); anim_state_xxx_list_insert_8004((undefined4 *)race_1_state_morty.anim_state); if (save_file_big->level_in_building == 1) { aseq_set_pos_order((int)race_1_lvl_1_launch_plane_aseq_0,*race_1_lvl_1_launch_plane_race_data_0, race_1_lvl_1_launch_plane_race_data_0[1],5); aseq_set_pos_order((int)race_1_lvl_1_launch_plane_aseq_1,*race_1_lvl_1_launch_plane_race_data_1, race_1_lvl_1_launch_plane_race_data_1[1],10); anim_state_xxx_list_insert_8004((undefined4 *)race_1_lvl_1_launch_plane_aseq_0); anim_state_xxx_list_insert_8004((undefined4 *)race_1_lvl_1_launch_plane_aseq_1); } DAT_00451440 = 0; DAT_0045143e = 0; DAT_00451382 = WORD_ARRAY_0044aaca[(short)save_file_big->level_in_building]; DAT_00451380 = 0; race_1_rdat_animate((int)loaded_rdat_thing0,race_1_rdat_bg_parallax_0_pos); race_1_rdat_animate((int)loaded_rdat_thing1,race_1_rdat_bg_parallax_1_pos); race_1_state = 0; status_bar_flags = 0x20; draw_status_bar(0); FUN_00422170(); nullishsub(); return; } void __stdcall race_1_on_unload(void) { aseq_anim_state_struct *paVar1; short sVar2; free_midi(0x1772); DAT_00451398 = free_waves_from_list(DAT_00451398); if (save_file_big->level_in_building == 1) { free_resource_item_with_data((int)race_1_lvl_1_launch_plane_race_data_0); free_resource_item_with_data((int)race_1_lvl_1_launch_plane_race_data_1); race_1_lvl_1_launch_plane_aseq_0 = (aseq_anim_state_struct *)free_aseq((int *)race_1_lvl_1_launch_plane_aseq_0); race_1_lvl_1_launch_plane_aseq_1 = (aseq_anim_state_struct *)free_aseq((int *)race_1_lvl_1_launch_plane_aseq_1); } sVar2 = 0; while (loaded_rdat_thing0[sVar2].anim_idx != 0xffff) { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)loaded_rdat_thing0[sVar2].anim_state); loaded_rdat_thing0[sVar2].anim_state = paVar1; sVar2 = sVar2 + 1; } sVar2 = 0; while (loaded_rdat_thing1[sVar2].anim_idx != 0xffff) { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)loaded_rdat_thing1[sVar2].anim_state); loaded_rdat_thing1[sVar2].anim_state = paVar1; sVar2 = sVar2 + 1; } race_1_state_player.anim_state = (aseq_anim_state_struct *)free_aseq((int *)race_1_state_player.anim_state); race_1_state_morty.anim_state = (aseq_anim_state_struct *)free_aseq((int *)race_1_state_morty.anim_state); free_resource_item_with_data((int)race_1_state_player.race_data); free_resource_item_with_data((int)race_1_state_morty.race_data); free_resource_item_with_data(loaded_rdat); FUN_0042211c(); nullishsub(); return; } uint __stdcall race_1_on_periodic(void) { int iVar1; ushort uVar2; int iVar3; uint uVar4; uint uVar5; uint uVar6; xxxfunc_funcset *pxVar7; short sVar8; ushort uVar9; ushort uVar10; iVar3 = (int)race_1_state; if (iVar3 == 0) { iVar3 = get_time_ms(); uVar4 = time_get_secs_count(1); race_rdat_delay_1s = iVar3 + uVar4; race_1_state = 1; } else if (iVar3 == 1) { uVar4 = get_time_ms(); if (race_rdat_delay_1s < uVar4) { race_1_state = 2; aseq_anim_reset_and_play((undefined4 *)race_1_state_player.anim_state); aseq_anim_reset_and_play((undefined4 *)race_1_state_morty.anim_state); if (save_file_big->level_in_building == 1) { aseq_anim_reset_and_play((undefined4 *)race_1_lvl_1_launch_plane_aseq_0); aseq_anim_reset_and_play((undefined4 *)race_1_lvl_1_launch_plane_aseq_1); } anim_set_flags_0x800_handler((int)race_1_state_player.anim_state,0x42efc4,0); uVar4 = anim_set_flags_0x800_handler((int)race_1_state_morty.anim_state,0x42efc4,0); } } else { uVar4 = iVar3 - 2; if (uVar4 == 0) { if ((race_1_state_player.finished_cmd2 == 0) && (race_1_state_morty.finished_cmd2 == 0)) { if (DAT_0044ad10 != 0) { race_1_calc_step_delta(0x4513ac); race_1_calc_step_delta(0x4513ee); race_1_state_player.last_track_step_fine = race_1_state_player.track_step_fine; iVar3 = race_1_state_player.track_step_fine + race_1_state_player.track_step_delta; race_1_state_morty.last_track_step_fine = race_1_state_morty.track_step_fine; race_1_state_morty.track_step_fine = race_1_state_morty.track_step_fine + race_1_state_morty.track_step_delta; iVar1 = iVar3; if (race_1_state_player.finished_cmd2 == 0) { uVar4 = (uint)race_1_state_player.track_step_fine >> 0x10; sVar8 = 0; race_1_state_player.track_step_fine = iVar3; while ((iVar1 = race_1_state_player.track_step_fine, sVar8 < (short)((short)((uint)iVar3 >> 0x10) - (short)uVar4) && (uVar5 = race_1_process_path(0x4513ac), iVar1 = race_1_state_player.track_step_fine, (short)uVar5 == 0))) { sVar8 = sVar8 + 1; } } race_1_state_player.track_step_fine = iVar1; if (race_1_state_morty.finished_cmd2 == 0) { uVar4 = (uint)race_1_state_morty.last_track_step_fine >> 0x10; uVar5 = (uint)race_1_state_morty.track_step_fine >> 0x10; sVar8 = 0; while ((sVar8 < (short)((short)uVar5 - (short)uVar4) && (uVar6 = race_1_process_path(0x4513ee), (short)uVar6 == 0))) { sVar8 = sVar8 + 1; } } uVar10 = race_1_state_player.race_data[(short)race_1_state_player.race_data_idx_pos * 3] - race_1_state_player.actual_unwrapped_x; race_1_state_player.actual_unwrapped_x = race_1_state_player.race_data[(short)race_1_state_player.race_data_idx_pos * 3]; race_1_state_player.x = race_1_state_player.race_data[(short)race_1_state_player.race_data_idx_pos * 3] - (short)((uint)race_1_rdat_bg_parallax_1_pos >> 0x10); race_1_state_player.y = race_1_state_player.race_data[(short)race_1_state_player.race_data_idx_pos * 3 + 1]; aseq_set_pos_order((int)race_1_state_player.anim_state,race_1_state_player.x, race_1_state_player.y,-0x8000); aseq_anim_set_img_and_flags ((int)race_1_state_player.anim_state,0, race_1_state_player.race_data [(short)race_1_state_player.race_data_idx_pos * 3 + 2] + DAT_00451380,0); uVar2 = race_1_state_morty.race_data[(short)race_1_state_morty.race_data_idx_pos * 3] - race_1_state_morty.actual_unwrapped_x; race_1_state_morty.actual_unwrapped_x = race_1_state_morty.race_data[(short)race_1_state_morty.race_data_idx_pos * 3]; race_1_state_morty.x = race_1_state_morty.race_data[(short)race_1_state_morty.race_data_idx_pos * 3] - (short)((uint)race_1_rdat_bg_parallax_1_pos >> 0x10); race_1_state_morty.y = race_1_state_morty.race_data[(short)race_1_state_morty.race_data_idx_pos * 3 + 1]; aseq_set_pos_order((int)race_1_state_morty.anim_state,race_1_state_morty.x, race_1_state_morty.y,-0x8000); aseq_anim_set_img_and_flags ((int)race_1_state_morty.anim_state,0, race_1_state_morty.race_data [(short)race_1_state_morty.race_data_idx_pos * 3 + 2] + DAT_00451380,0); uVar9 = 0; if (((short)race_1_state_morty.race_data_idx_pos <= (short)race_1_state_player.race_data_idx_pos) && (DAT_0044aab2 = 2, 0x100 < race_1_state_player.x)) { uVar9 = uVar10; } if (((short)race_1_state_player.race_data_idx_pos < (short)race_1_state_morty.race_data_idx_pos) && (DAT_0044aab2 = 3, 0x100 < race_1_state_morty.x)) { uVar9 = uVar2; } if (save_file_big->level_in_building == 1) { if (race_1_lvl_1_launch_plane_step < 0x3a) { if (race_1_lvl_1_launch_plane_step == 0) { play_wave_flag1(0x1f88,3,1); } race_1_lvl_1_launch_plane_x = race_1_lvl_1_launch_plane_race_data_0[race_1_lvl_1_launch_plane_step * 3] - (short)((uint)race_1_rdat_bg_parallax_1_pos >> 0x10); race_1_lvl_1_launch_plane_y = race_1_lvl_1_launch_plane_race_data_0[race_1_lvl_1_launch_plane_step * 3 + 1]; aseq_set_pos_order((int)race_1_lvl_1_launch_plane_aseq_0,race_1_lvl_1_launch_plane_x, race_1_lvl_1_launch_plane_y,-0x8000); aseq_anim_set_img_and_flags ((int)race_1_lvl_1_launch_plane_aseq_0,0, race_1_lvl_1_launch_plane_race_data_0 [race_1_lvl_1_launch_plane_step * 3 + 2] + DAT_00451380,0); race_1_lvl_1_launch_plane_x = race_1_lvl_1_launch_plane_race_data_1[race_1_lvl_1_launch_plane_step * 3] - (short)((uint)race_1_rdat_bg_parallax_1_pos >> 0x10); race_1_lvl_1_launch_plane_y = race_1_lvl_1_launch_plane_race_data_1[race_1_lvl_1_launch_plane_step * 3 + 1]; aseq_set_pos_order((int)race_1_lvl_1_launch_plane_aseq_1,race_1_lvl_1_launch_plane_x, race_1_lvl_1_launch_plane_y,-0x8000); aseq_anim_set_img_and_flags ((int)race_1_lvl_1_launch_plane_aseq_1,0, race_1_lvl_1_launch_plane_race_data_0 [race_1_lvl_1_launch_plane_step * 3 + 2] + DAT_00451380,0); race_1_lvl_1_launch_plane_step = race_1_lvl_1_launch_plane_step + 1; if (race_1_lvl_1_launch_plane_step == 0x3a) { stop_playing_wave_by_id_type1(0x1f88); } } else { anim_state_xxx_list_remove((int *)race_1_lvl_1_launch_plane_aseq_0); anim_state_xxx_list_remove((int *)race_1_lvl_1_launch_plane_aseq_1); } } race_1_rdat_bg_parallax_1_pos = (uint)uVar9 * 0x10000 + race_1_rdat_bg_parallax_1_pos; race_1_rdat_bg_parallax_0_pos = more_precise_div_xxx(race_1_rdat_bg_parallax_1_pos,0xa0000); race_1_rdat_animate((int)loaded_rdat_thing0,race_1_rdat_bg_parallax_0_pos); race_1_rdat_animate((int)loaded_rdat_thing1,race_1_rdat_bg_parallax_1_pos); DAT_00451380 = DAT_00451380 + 1; uVar4 = (int)DAT_00451380 / (int)DAT_00451382; DAT_00451380 = DAT_00451380 % DAT_00451382; DAT_0044ad10 = 0; } } else { race_lost = (ushort)(race_1_state_player.finished_cmd2 == 0); if ((DAT_00449c66 == 0) && (race_lost == 0)) { save_file_big->num_built_vehicles[(short)save_file_big->building_idx] = save_file_big->num_built_vehicles[(short)save_file_big->building_idx] + 1; save_file_big->total_built_vehicles = save_file_big->total_built_vehicles + 1; } if (DAT_00449c66 == 0) { pxVar7 = &xxxfunc_funcset_00448a28; } else { pxVar7 = &xxxfunc_funcset_00448a34; } uVar4 = xxxfunc_set(pxVar7); } } } return uVar4; } void __stdcall FUN_0042fb68(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if (DAT_0044ad3c != 0) { if ((sVar1 != 0xd) && (sVar1 != 0x1b)) { return; } DAT_00451468 = 5; DAT_0044ad38 = 0; } return; } void __stdcall FUN_0042fb9d(void) { short sVar1; sVar1 = wave_is_playing_(*(short *)(DAT_00451464 + 0x34)); if (sVar1 != 0) { stop_playing_wave_by_id_type2(*(short *)(DAT_00451464 + 0x34)); } if (*(short *)(DAT_00451464 + 0x34) != 0) { free_wave_flag_2(*(short *)(DAT_00451464 + 0x34)); *(undefined2 *)(DAT_00451464 + 0x34) = 0; } DAT_00451468 = 3; return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address undefined2 __cdecl FUN_0042fbf7(int param_1) { bool bVar1; short sVar2; int iVar3; BOOL BVar4; short sVar5; tagMSG local_60 [2]; ushort local_10; short local_e; short local_c; short local_a; short local_8; undefined2 local_6; bVar1 = false; disable_exiting_because_dialog_xxx = 1; if (on_deactivate_xtra_cb != (undefined *)0x0) { (*(code *)on_deactivate_xtra_cb)(); } anim_state_xxx_new_list(); mouse_region_stash_lists(); _DAT_00451470 = get_time_ms(); disable_menus(0xff,0xffff,0); key_xxxxx_inc(); stop_playing_all_waves(); midi_pause_current(); DAT_00451474 = FUN_0043e1b5(0); key_xxxxx_set(FUN_0042fb68); DAT_00451464 = param_1; DAT_0044ad38 = 0xffff; save_unset_custom_cursor(); load_nfnt(15000); local_6 = set_default_nfnt(15000); local_c = 0; sVar2 = 0xfa; do { sVar5 = sVar2; iVar3 = FUN_0043e266(-1,0xffce,-0x32,sVar5,*(byte **)(DAT_00451464 + 0x26)); local_e = (short)iVar3; if (local_e < 300) { local_c = 1; } sVar2 = sVar5 + 0x14; } while (local_c == 0); local_10 = (ushort)(*(int *)(DAT_00451464 + 0x1e) != 0); if (*(int *)(DAT_00451464 + 0x22) != 0) { local_10 = local_10 | 2; } if (*(short *)(DAT_00451464 + 0xc) != 0) { local_10 = local_10 | 4; } FUN_0043020b(CONCAT22((short)((uint)DAT_00451464 >> 0x10),*(undefined2 *)(DAT_00451464 + 2)), *(short *)(DAT_00451464 + 4),sVar5 + 0x1e,local_e + 10,(byte)local_10); mouse_region_new_up(*(short *)(DAT_00451464 + 2),*(short *)(DAT_00451464 + 4),sVar5 + 0x1e, local_e + 10,0xc9,0); FUN_0043e266(-1,DAT_0045144c + 5,DAT_0045144e + 3,sVar5 + 0x14,*(byte **)(DAT_00451464 + 0x26)); sVar2 = set_default_nfnt(local_6); free_nfnt(sVar2); if ((local_10 & 1) != 0) { iVar3 = (int)DAT_00451458 >> 1; if (iVar3 < 0) { iVar3 = iVar3 + (uint)(((int)DAT_00451458 & 1U) != 0); } FUN_0043dbb3(-1,*(byte **)(DAT_00451464 + 0x1e),(short)iVar3 + _DAT_00451454,DAT_00451456 + 4, 0xffff); } if (*(short *)(DAT_00451464 + 0xc) != 0) { _DAT_0045146a = _DAT_0045146a - (local_a + 5); } *(undefined2 *)(DAT_00451464 + 0x34) = 0; DAT_00451468 = 3; sVar2 = are_voices_enabled(); if (sVar2 != 0) { DAT_0045147c = load_aseq(19012); aseq_set_pos_order((int)DAT_0045147c,*(short *)(DAT_00451464 + 2) + -1, *(short *)(DAT_00451464 + 4) + -1,0xcd); anim_state_xxx_list_insert_8004(DAT_0045147c); mouse_region_new_up(*(short *)(DAT_00451464 + 2) + -1,*(short *)(DAT_00451464 + 4) + -1,0x52, 0x14,0xcd,0x43012b); DAT_0044ad3a = 0; } local_8 = sVar5 + -0x2c; sVar2 = local_e + 0x28; DAT_00451480 = load_aseq(19011); aseq_set_pos_order((int)DAT_00451480,local_8,sVar2,0xcd); mouse_region_new_up(local_8,sVar2,0x52,0x14,0xcd,0x4301bc); mouse_region_new_up(0,0,0x200,0x180,200,0x4301bc); anim_state_xxx_list_insert_8004(DAT_00451480); DAT_0044ad3c = 1; while (!bVar1) { xxx_periodic_loop(); BVar4 = PeekMessageA(local_60,(HWND)0x0,0,0,1); if (BVar4 != 0) { TranslateMessage(local_60); DispatchMessageA(local_60); } switch(DAT_00451468) { case 1: if (SHORT_ARRAY_004514ce[DAT_0045146c] == -1) { DAT_0045146c = 0; aseq_select_anim((int)DAT_0045147c,0); anim_state_xxx_list_remove(DAT_0045147c); anim_state_xxx_list_insert_8004(DAT_0045147c); DAT_0044ad3a = DAT_0044ad3a ^ 1; DAT_00451468 = 3; } else { *(short *)(DAT_00451464 + 0x34) = SHORT_ARRAY_004514ce[DAT_0045146c]; DAT_0045146c = DAT_0045146c + 1; load_wave_flag_2(*(ushort *)(DAT_00451464 + 0x34)); play_wave_flag2(*(short *)(DAT_00451464 + 0x34)); DAT_00451468 = 2; } break; case 2: sVar2 = wave_is_playing_(*(short *)(DAT_00451464 + 0x34)); if (sVar2 == 0) { free_wave_flag_2(*(short *)(DAT_00451464 + 0x34)); *(undefined2 *)(DAT_00451464 + 0x34) = 0; DAT_00451468 = 1; } break; case 4: sVar2 = aseq_anim_get_flags(*(int *)(DAT_00451464 + 0x16)); if ((sVar2 == 0x10) && (sVar2 = aseq_anim_get_flags(*(int *)(DAT_00451464 + 0x1a)), sVar2 == 0x10)) { bVar1 = true; } break; case 5: bVar1 = true; } } FUN_0042fb9d(); sVar2 = are_voices_enabled(); if (sVar2 != 0) { DAT_0045147c = (int *)free_aseq(DAT_0045147c); } free_aseq(DAT_00451480); anim_engine_test_drawn_imgs_intersects_xxx((short *)&DAT_00451444); restore_cursor_override_regions(); FUN_0043e1b5(DAT_00451474); key_xxxxx_pop(); anim_state_xxx_restore_list(); mouse_region_unstash_list(); restore_enable_menus(0xff,0xffff,0); restart_current_midi(0); DAT_00451464 = 0; FUN_0043d7ce(); disable_exiting_because_dialog_xxx = 0; return DAT_0044ad38; } void __stdcall FUN_004300e0(void) { int iVar1; iVar1 = alloc_tracked_heap_block(0x3e); *(undefined2 *)(iVar1 + 2) = 0xffff; *(undefined2 *)(iVar1 + 4) = 0xffff; *(undefined2 *)(iVar1 + 0xc) = 0; *(undefined2 *)(iVar1 + 0x12) = 0; *(undefined2 *)(iVar1 + 0x14) = 0; *(undefined4 *)(iVar1 + 0x2a) = 0; *(undefined4 *)(iVar1 + 0x22) = 0; *(undefined4 *)(iVar1 + 0x26) = 0; *(undefined4 *)(iVar1 + 0x1e) = 0; *(undefined2 *)(iVar1 + 0x32) = 0; *(undefined2 *)(iVar1 + 10) = 0; *(undefined4 *)(iVar1 + 0x3a) = 0; *(undefined4 *)(iVar1 + 0x36) = 0; return; } void __stdcall FUN_0043012b(void) { ushort uVar1; short sVar2; if (DAT_0044ad3a == 0) { DAT_0045146c = 0; DAT_00451468 = 1; } else { sVar2 = wave_is_playing_(*(short *)(DAT_00451464 + 0x34)); if (sVar2 != 0) { free_wave_flag_2(*(short *)(DAT_00451464 + 0x34)); *(undefined2 *)(DAT_00451464 + 0x34) = 0; DAT_00451468 = 3; } } uVar1 = DAT_0044ad3a; DAT_0044ad3a = DAT_0044ad3a ^ 1; aseq_select_anim((int)DAT_0045147c,uVar1 ^ 1); anim_state_xxx_list_remove(DAT_0045147c); anim_state_xxx_list_insert_8004(DAT_0045147c); return; } void __cdecl FUN_004301cf(undefined4 param_1) { int iVar1; iVar1 = FUN_004300e0(); *(undefined4 *)(iVar1 + 0x26) = param_1; *(char **)(iVar1 + 0x1e) = s_Puzzle_Hint_0044ad3e; *(undefined **)(iVar1 + 0x22) = &DAT_0044ad4a; *(undefined2 *)(iVar1 + 4) = 8; *(undefined2 *)(iVar1 + 2) = 8; FUN_0042fbf7(iVar1); free_tracked_heap_block(iVar1); return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __cdecl FUN_0043020b(int param_1,short param_2,short param_3,short param_4,byte param_5) { uint uVar1; ushort uVar2; short sVar3; short sVar4; short sVar5; int iVar6; short sVar7; short sVar8; int iVar9; short sVar10; short sVar11; short local_c; short local_a; short local_8; ushort local_6; sVar3 = param_3 + 0x14; sVar4 = 0; if ((param_5 & 1) != 0) { sVar4 = 0x15; } if ((param_5 & 2) != 0) { sVar4 = sVar4 + 0x15; } if ((param_5 & 4) != 0) { sVar4 = sVar4 + 0x32; } sVar4 = sVar4 + param_4; sVar5 = sVar4 + 0x14; FUN_00422b9d(&local_8,&local_a); if ((short)param_1 < 0) { iVar9 = (int)local_8 - (int)sVar3 >> 1; if (iVar9 < 0) { iVar9 = iVar9 + (uint)(((int)local_8 - (int)sVar3 & 1U) != 0); } } else { iVar9 = param_1 + -8; } if (param_2 < 0) { iVar6 = (int)local_a - (int)sVar5 >> 1; if (iVar6 < 0) { iVar6 = iVar6 + (uint)(((int)local_a - (int)sVar5 & 1U) != 0); } local_c = (short)iVar6; } else { local_c = param_2 + -8; } sVar11 = (short)iVar9; gfxish_fill_rect_wrap(sVar11,local_c,sVar3,sVar5,0xfff); _DAT_00451446 = local_c; uVar1 = iVar9 + 4; local_8 = param_3 + 8; local_a = sVar4 + 8; sVar10 = 0; _DAT_00451444 = sVar11; _DAT_00451448 = sVar3; _DAT_0045144a = sVar5; sVar7 = local_c + 4; do { local_6 = (ushort)uVar1; uVar2 = local_6; sVar8 = sVar7 + 1; local_6 = local_6 + 1; gfx_draw_box(uVar2,sVar7,local_8,local_a,0); uVar1 = (uint)local_6; local_8 = local_8 + -2; local_a = local_a + -2; sVar10 = sVar10 + 1; sVar7 = sVar8; } while (sVar10 < 4); DAT_0045144c = local_6; DAT_0045144e = sVar8; DAT_00451450 = local_8; _DAT_00451452 = local_a; gfxish_fill_rect_wrap(sVar11 + 8,local_c + sVar5 + -8,param_3 + 8,4,0x8f7); gfxish_fill_rect_wrap(sVar3 + sVar11 + -8,local_c + 8,4,sVar4 + 8,0x8f7); uVar1 = (uint)_DAT_00451454; if ((param_5 & 1) != 0) { gfxish_line_h_wrap(sVar11 + 4,local_c + 0x1d,param_3 + 8,0); gfxish_line_h_wrap(sVar11 + 4,local_c + 0x1c,param_3 + 8,0); DAT_0045144e = DAT_0045144e + 0x16; _DAT_00451452 = _DAT_00451452 + -0x16; uVar1 = iVar9 + 8; DAT_00451456 = local_c + 8; DAT_00451458 = DAT_00451450; _DAT_0045145a = 0x15; } _DAT_00451454 = (ushort)uVar1; if ((param_5 & 2) != 0) { local_c = local_c + sVar5; _DAT_00451452 = _DAT_00451452 + -0x15; gfxish_line_h_wrap(sVar11 + 4,local_c + -0x21,param_3 + 8,0); gfxish_line_h_wrap(sVar11 + 4,local_c + -0x22,param_3 + 8,0); _DAT_0045145c = sVar11 + 8; _DAT_0045145e = local_c + -0x20; _DAT_00451460 = DAT_00451450; _DAT_00451462 = 0x14; } if ((param_5 & 4) != 0) { _DAT_00451452 = _DAT_00451452 + -0x32; } return; } void __cdecl FUN_004304bc(byte *param_1,short *param_2,short param_3) { byte bVar1; byte bVar2; bool bVar3; short sVar4; undefined4 uVar5; byte *pbVar6; byte *pbVar7; byte *pbVar8; short local_a; bVar3 = true; local_a = 0; uVar5 = nfnt_get_max_height(-1); pbVar6 = param_1; pbVar8 = param_1; do { if ((((*pbVar6 == 0x20) || (*pbVar6 == 0)) || (*pbVar6 == 10)) || ((*pbVar6 == 0x2d || (*pbVar6 == 0x5e)))) { if ((*pbVar6 == 0x2d) || (*pbVar6 == 0x5e)) { pbVar6 = pbVar6 + 1; } bVar1 = *pbVar6; *pbVar6 = 0; sVar4 = nfnt_get_text_width(-1,pbVar8); if (param_3 < sVar4) { bVar2 = *param_1; *param_1 = 0; local_a = local_a + 1; *param_1 = bVar2; *pbVar6 = bVar1; pbVar7 = param_1; if (*param_1 == 10) { pbVar7 = param_1 + 1; } for (; *pbVar7 == 0x20; pbVar7 = pbVar7 + 1) { } param_1 = pbVar7; pbVar8 = pbVar7; if (bVar3) { bVar3 = false; } } else { *pbVar6 = bVar1; pbVar7 = pbVar6 + 1; param_1 = pbVar6; } } else { pbVar7 = pbVar6 + 1; } pbVar6 = pbVar7; } while (*pbVar7 != 0); sVar4 = nfnt_get_text_width(-1,pbVar8); if (param_3 < sVar4) { bVar1 = *param_1; *param_1 = 0; local_a = local_a + 1; *param_1 = bVar1; for (; pbVar8 = param_1, *param_1 == 0x20; param_1 = param_1 + 1) { } } if (pbVar8 != (byte *)0x0) { local_a = local_a + 1; } *param_2 = local_a * ((short)uVar5 + 3); return; } void __stdcall puzzle_choosing_onload_xxx(void) { DAT_004514fa = 0; load_wave_flag_1(8014); DAT_0045153c = load_aseq(19101); if ((DAT_0044ad4c == 0) || (cheat_pick_a_puzzle != 0)) { DAT_004514f6 = 0; DAT_0044ad4c = 1; DAT_004514ae = 0; FUN_00422170(); if (cheat_pick_a_puzzle != 0) { DAT_004514fa = 0; load_rrgb_1(19100); // pick a puzzle screen DAT_00451538 = load_aseq(19100); aseq_draw_to_both_fbs((int)DAT_00451538,0,0,0); free_aseq(DAT_00451538); FUN_00430aa3(); if (total_puzzles_of_type_[puzzle_type] < puzzle_idx) { puzzle_idx = 1; } FUN_00430a39(); FUN_00430803(); return; } pick_random_puzzle(); DAT_004514fa = 1; } else { FUN_00422170(); DAT_0044ad4c = 0; if (DAT_004514ae == 0) { FUN_0043e538(0); xxxfunc_set(&into_warehouse_modeswitch_funcset); return; } if (DAT_004514ae == 1) { FUN_0043e538(1); xxxfunc_set(&into_warehouse_modeswitch_funcset); return; } } return; } void __stdcall puzzle_choosing_onremove_xxx(void) { if (DAT_004514b0 != 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; } free_aseq(DAT_0045153c); free_wave_flag_1(0x1f4e); mouse_region_delete_all_lists(); FUN_0042211c(); draw_status_bar(0); return; } void __stdcall go_to_puzzle(void) { if ((DAT_004514fa != 0) && (DAT_004514fa == 1)) { switch(puzzle_type) { case 0: xxxfunc_set(&balance_puzzle_funcset); break; case 1: xxxfunc_set(&electricity_puzzle_funcset); break; case 2: xxxfunc_set(&energy_puzzle_funcset); break; case 3: xxxfunc_set(&force_puzzle_funcset); break; case 4: xxxfunc_set(&gear_puzzle_funcs); break; case 5: xxxfunc_set(&jigsaw_puzzle_funcset); break; case 6: xxxfunc_set(&magnet_puzzle_funcset); break; case 7: xxxfunc_set(&simple_machines_puzzle_funcset); break; default: xxxfunc_set(&energy_puzzle_funcset); } } return; } void __stdcall FUN_00430803(void) { int *piVar1; short sVar2; mouse_region_delete_all_lists(); sVar2 = 0; do { piVar1 = mouse_region_new_up(10,(&DAT_0044ada8)[sVar2],100,0xf,1,0x4308da); (&DAT_004514fc)[sVar2] = piVar1; *(int *)((&DAT_004514fc)[sVar2] + 0x1e) = (int)sVar2; sVar2 = sVar2 + 1; } while (sVar2 < 8); sVar2 = 8; do { piVar1 = mouse_region_new_up(0xe1,(&DAT_0044ada8)[sVar2],0x58,0x17,1,0x4308da); (&DAT_004514fc)[sVar2] = piVar1; *(int *)((&DAT_004514fc)[sVar2] + 0x1e) = (int)sVar2; sVar2 = sVar2 + 1; } while (sVar2 < 0xb); DAT_00451528 = mouse_region_new_up(0x65,0x37,0x13,0x10,1,0x4308da); *(undefined4 *)((int)DAT_00451528 + 0x1e) = 0xb; DAT_0045152c = mouse_region_new_up(0x65,0x4c,0x13,0x10,1,0x4308da); *(undefined4 *)((int)DAT_0045152c + 0x1e) = 0xc; return; } void __cdecl FUN_004308da(int param_1) { switch(*(undefined4 *)(param_1 + 0x1e)) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: puzzle_type = *(short *)(param_1 + 0x1e); FUN_00430aa3(); if (total_puzzles_of_type_[puzzle_type] < puzzle_idx) { puzzle_idx = 1; } FUN_00430a39(); play_wave_flag1(0x1f4e,10,0); return; case 8: DAT_004514fa = 1; play_wave_flag1(0x1f4e,10,0); return; case 9: FUN_0043e538(1); xxxfunc_set(&into_warehouse_modeswitch_funcset); play_wave_flag1(0x1f4e,10,0); return; case 10: FUN_0043e538(0); xxxfunc_set(&into_warehouse_modeswitch_funcset); play_wave_flag1(0x1f4e,10,0); return; case 0xb: puzzle_idx = puzzle_idx + 1; if (total_puzzles_of_type_[puzzle_type] < puzzle_idx) { puzzle_idx = 1; } FUN_00430a39(); return; case 0xc: if ((puzzle_idx != 0) && (puzzle_idx = puzzle_idx + -1, puzzle_idx < 1)) { puzzle_idx = total_puzzles_of_type_[puzzle_type]; } FUN_00430a39(); } return; } void __stdcall FUN_00430a39(void) { byte local_c [8]; load_nfnt(15000); gfxish_copy_otherbuf_to_dest_and_invalidate(0x17,0x41,0x4f,0xf); sprintf(local_c); FUN_0043dc0b(15000,local_c,0x1a,0x4d,0); gfxish_invalidate_rect_wrap(0x17,0x41,0x4f,0xf); free_nfnt(15000); return; } void __stdcall FUN_00430aa3(void) { anim_state_xxx_list_remove(DAT_0045153c); aseq_set_pos_order((int)DAT_0045153c,0x1a,*(short *)(&DAT_0044ad98 + puzzle_type * 2),1); anim_state_xxx_list_insert_8004(DAT_0045153c); return; } void __stdcall pick_random_puzzle(void) { bool bVar1; uint uVar2; short sVar3; int unaff_EDI; bVar1 = false; while (!bVar1) { puzzle_type = choose_rand_puzzle_type(); get_three_possible_puzzles(puzzle_type); sVar3 = 3; if (three_possible_puzzles[2] == -1) { sVar3 = 2; } if (three_possible_puzzles[1] == -1) { sVar3 = sVar3 + -1; } if (three_possible_puzzles[0] != -1) { if (sVar3 == 0) { unaff_EDI = 0; } else { uVar2 = rand(); unaff_EDI = (int)uVar2 % (int)sVar3; } bVar1 = true; } } puzzle_idx = three_possible_puzzles[(short)unaff_EDI] + 1; return; } undefined4 __stdcall check_low_on_puzzles(void) { short sVar1; int iVar2; undefined4 uVar3; short sVar4; short sVar5; sVar5 = 0; sVar4 = 0; do { for (sVar1 = 0; sVar1 < total_puzzles_of_type_[sVar4]; sVar1 = sVar1 + 1) { if (save_file_big->puzzles[sVar4].completed[sVar1] == 0) { sVar5 = sVar5 + 1; } } sVar4 = sVar4 + 1; } while (sVar4 < 8); if (sVar5 < 7) { sVar5 = 0; do { iVar2 = (int)sVar5; save_file_big->puzzles[iVar2].enable_state = 3; sVar5 = sVar5 + 1; } while (sVar5 < 8); DAT_0044adbe = 1; uVar3 = CONCAT22((short)((uint)(iVar2 * 0xb) >> 0x10),1); } else { uVar3 = 0; } return uVar3; } short __stdcall choose_rand_puzzle_type(void) { short sVar1; uint uVar2; int iVar3; short sVar4; short sVar5; short asStack_10014 [32762]; short asStack_14 [8]; sVar5 = 0; sVar4 = 0; sVar1 = 0; do { if ((save_file_big->puzzles[sVar1].enable_state == 0) || (save_file_big->puzzles[sVar1].enable_state == 3)) { asStack_14[sVar4] = sVar1; sVar4 = sVar4 + 1; } sVar1 = sVar1 + 1; } while (sVar1 < 8); if (sVar4 == 0) { no_more_chosen_puzzles(); } else { if (sVar4 == 0) { iVar3 = 0; } else { uVar2 = rand(); iVar3 = (int)uVar2 % (int)sVar4; } sVar5 = asStack_14[iVar3]; } return sVar5; } int __cdecl get_three_possible_puzzles(short param_1) { short sVar1; int iVar2; uint uVar3; short sVar4; sVar1 = 0; do { three_possible_puzzles[sVar1] = -1; sVar1 = sVar1 + 1; } while (sVar1 < 3); sVar1 = total_puzzles_of_type_[param_1]; iVar2 = check_low_on_puzzles(); if ((short)iVar2 == 0) { sVar4 = 0; iVar2 = 0; if (0 < sVar1) { do { if (save_file_big->puzzles[param_1].completed[(short)iVar2] == 0) { three_possible_puzzles[sVar4] = (short)iVar2; sVar4 = sVar4 + 1; } } while ((sVar4 < 3) && (iVar2 = iVar2 + 1, (short)iVar2 < sVar1)); } } else if (sVar1 == 0) { three_possible_puzzles[0] = 0; } else { uVar3 = rand(); iVar2 = (int)uVar3 / (int)sVar1; three_possible_puzzles[0] = (short)((int)uVar3 % (int)sVar1); } return iVar2; } void __stdcall inc_score_by_400(void) { short sVar1; sVar1 = 0; do { increment_score(100,0); draw_score_digits(); xxx_periodic_loop(); sVar1 = sVar1 + 1; } while (sVar1 < 4); return; } void __cdecl solved_the_puzzle(short param_1) { undefined4 uVar1; play_wave_flag1(param_1,0xf,0); gfxish_copy_otherbuf_to_dest_and_invalidate(10,0x140,0x14e,0x3f); gfxish_invalidate_rect_wrap(10,0x140,0x14e,0x3f); FUN_0043e1b5(0); FUN_00401206(10,0x148,(byte *)s_Congratulations__You_solved_the_p_0044ad4e); if ((DAT_0044adbe == 0) && (save_file_big->puzzles[puzzle_type].completed[puzzle_idx + -1] == 0)) { save_file_big->puzzles[puzzle_type].completed[puzzle_idx + -1] = 1; uVar1 = FUN_004310e9(puzzle_type); if ((short)uVar1 != 0) { save_file_big->puzzles[puzzle_type].enable_state = 2; uVar1 = FUN_00431167(); if ((short)uVar1 != 0) { no_more_chosen_puzzles(); } } } return; } void __stdcall FUN_00430def(void) { short sVar1; if (DAT_00451484 != 0) { sVar1 = wave_is_playing_(DAT_00451484); if (sVar1 != 0) { stop_playing_wave_by_id_type1(DAT_00451484); } free_wave_flag_2(DAT_00451484); DAT_00451484 = 0; } return; } void __cdecl FUN_00430e33(short param_1) { undefined2 uVar1; gfxish_copy_otherbuf_to_dest_and_invalidate(10,0x140,0x14e,0x3f); gfxish_invalidate_rect_wrap(10,300,0x14e,0x50); FUN_0043e1b5(0); if (param_1 == 0) { load_nfnt(15000); uVar1 = set_default_nfnt(15000); FUN_00401206(10,0x148,DAT_004514b4); set_default_nfnt(uVar1); free_nfnt(15000); return; } FUN_00401206(10,0x148,(byte *)s_Congratulations__You_solved_the_p_0044ad4e); return; } void __cdecl load_waves_from_list(int param_1) { short sVar1; sVar1 = 0; while (*(short *)(param_1 + sVar1 * 2) != -1) { load_wave_flag_1(*(ushort *)(param_1 + sVar1 * 2)); sVar1 = sVar1 + 1; } return; } void __cdecl FUN_00430ef4(int param_1) { short sVar1; stop_playing_all_waves(); sVar1 = 0; while (*(short *)(param_1 + sVar1 * 2) != -1) { free_wave_flag_1(*(short *)(param_1 + sVar1 * 2)); sVar1 = sVar1 + 1; } return; } void __stdcall no_more_chosen_puzzles(void) { undefined4 uVar1; uVar1 = load_resource_item_0(19000,(int *)&text); show_dialog_wait_continue(uVar1,100); puzzle_change_state_1_to_0(); free_resource_item_with_idx_fourcc(19000,(undefined1 *)&text); return; } void __stdcall draw_score_digits(void) { short sVar1; int local_1c [4]; int local_c; int local_8; local_1c[0] = (save_file_big->player_entry).score % 10; local_1c[1] = ((save_file_big->player_entry).score / 10) % 10; local_1c[2] = ((save_file_big->player_entry).score / 100) % 10; local_1c[3] = ((save_file_big->player_entry).score / 1000) % 10; local_c = ((save_file_big->player_entry).score / 10000) % 10; local_8 = (save_file_big->player_entry).score / 100000; sVar1 = 0; do { anim_state_xxx_list_remove((int *)score_digits_aseqs[sVar1]); aseq_select_anim((int)score_digits_aseqs[sVar1],(short)local_1c[sVar1]); anim_state_xxx_list_insert_8004((undefined4 *)score_digits_aseqs[sVar1]); sVar1 = sVar1 + 1; } while (sVar1 < 6); return; } void __stdcall FUN_00431029(void) { short sVar1; free_aseq((int *)aseq_score_label_19501); sVar1 = 0; do { free_aseq((int *)score_digits_aseqs[sVar1]); sVar1 = sVar1 + 1; } while (sVar1 < 6); return; } void __stdcall load_and_draw_score(void) { aseq_anim_state_struct *paVar1; short sVar2; aseq_score_label_19501 = (aseq_anim_state_struct *)load_aseq(puzzle_type + 19501); aseq_set_pos_order((int)aseq_score_label_19501,0x15d,0x16a,10); anim_state_xxx_list_insert_8004((undefined4 *)aseq_score_label_19501); sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *)load_aseq(puzzle_type + 19509); score_digits_aseqs[sVar2] = paVar1; aseq_set_pos_order((int)score_digits_aseqs[sVar2],score_digit_pos[sVar2][0] + 0x15d,0x16b,0xf); sVar2 = sVar2 + 1; } while (sVar2 < 6); draw_score_digits(); return; } undefined4 __cdecl FUN_004310e9(short param_1) { int iVar1; undefined4 uVar2; short sVar3; sVar3 = 0; iVar1 = 0; while( true ) { if (total_puzzles_of_type_[param_1] <= (short)iVar1) break; if (save_file_big->puzzles[param_1].completed[(short)iVar1] == 0) { sVar3 = sVar3 + 1; } iVar1 = iVar1 + 1; } if (sVar3 == 0) { uVar2 = CONCAT22((short)((uint)iVar1 >> 0x10),1); } else { uVar2 = 0; } return uVar2; } void __stdcall puzzle_change_state_1_to_0(void) { short sVar1; sVar1 = 0; do { if (save_file_big->puzzles[sVar1].enable_state == 1) { save_file_big->puzzles[sVar1].enable_state = 0; } sVar1 = sVar1 + 1; } while (sVar1 < 8); return; } undefined4 __stdcall FUN_00431167(void) { int iVar1; iVar1 = 0; while ((save_file_big->puzzles[(short)iVar1].enable_state != 0 && (save_file_big->puzzles[(short)iVar1].enable_state != 3))) { iVar1 = iVar1 + 1; if (7 < (short)iVar1) { return CONCAT22((short)((uint)iVar1 >> 0x10),1); } } return 0; } bool __cdecl load_resource(int param_1) { bool bVar1; char *pcVar2; int iVar3; UINT uMode; uint uVar4; char local_108 [260]; if (*(char *)(param_1 + 9) == ':') { local_108[0] = '\0'; } else { strcpy(local_108,cddrive); } strcat(local_108,(char *)(param_1 + 8)); pcVar2 = FUN_00440c40((char *)(param_1 + 8),'.'); iVar3 = strcmp2(pcVar2,s__exe_0044af3d); if (iVar3 == 0) { *(undefined2 *)(param_1 + 0x1c) = 5; *(undefined4 *)(param_1 + 0x1e) = instance; bVar1 = false; } else { uMode = SetErrorMode(0x8000); uVar4 = ne_rsrc_load_dat_real(local_108); *(uint *)(param_1 + 0x1e) = uVar4; SetErrorMode(uMode); bVar1 = 0x1f < *(int *)(param_1 + 0x1e); if (bVar1) { *(undefined2 *)(param_1 + 0x1c) = 1; } bVar1 = !bVar1; } return bVar1; } undefined4 __stdcall init_resources_list(void) { if (resources_list_inited == 0) { resources_list_inited = 1; resource_items_list = (linked_list_head *)alloc_linked_list_marker(); resources_list = (linked_list_head *)alloc_linked_list_marker(); } return 0; } void __stdcall free_all_resources(void) { int *piVar1; int *piVar2; if (resources_list_inited != 0) { free_all_resource_items(); piVar1 = (int *)deref_next_if_not_null(&resources_list->next); while (piVar1 != (int *)0x0) { piVar2 = (int *)deref_next(piVar1); if ((short)piVar1[7] == 1) { ne_rsrc_close(*(int *)((int)piVar1 + 0x1e)); } linked_list_unlink((int *)resources_list,piVar1); free_tracked_heap_block((int)piVar1); piVar1 = piVar2; } free_tracked_heap_block_((int)resource_items_list); free_tracked_heap_block_((int)resources_list); resources_list_inited = 0; } return; } undefined4 __cdecl load_dat_file(char *param_1) { bool bVar1; undefined4 *puVar2; undefined3 extraout_var; undefined2 extraout_var_00; puVar2 = (undefined4 *)alloc_tracked_heap_block(0x22); strcpy((char *)(puVar2 + 2),param_1); bVar1 = load_resource((int)puVar2); if ((short)CONCAT31(extraout_var,bVar1) != 0) { free_all_resources(); return 0; } linked_list_insert((int *)resources_list,puVar2,0xffff); return CONCAT22(extraout_var_00,1); } void __cdecl free_dat_file_maybe(char *param_1) { int *piVar1; int *piVar2; int iVar3; piVar2 = (int *)deref_next_if_not_null(&resources_list->next); while (piVar1 = piVar2, piVar1 != (int *)0x0) { piVar2 = (int *)deref_next(piVar1); iVar3 = strcmp2((char *)(piVar1 + 2),param_1); if (iVar3 == 0) { if ((short)piVar1[7] == 1) { ne_rsrc_close(*(int *)((int)piVar1 + 0x1e)); } linked_list_unlink((int *)resources_list,piVar1); free_tracked_heap_block((int)piVar1); } } return; } uint __cdecl load_rsrc_4cc(undefined1 *param_1) { short sVar1; uint in_ECX; uint *puVar2; uint local_8; if (((uint)param_1 & 0xffff0000) == 0) { local_8 = (uint)param_1 & 0xffff; } else { puVar2 = &local_8; sVar1 = 0; local_8 = in_ECX; do { *(undefined1 *)puVar2 = *param_1; param_1 = param_1 + 1; puVar2 = (uint *)((int)puVar2 + 1); sVar1 = sVar1 + 1; } while (sVar1 < 4); } return local_8; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address undefined4 __cdecl load_resource_item(short param_1,int *param_2) { uint uVar1; undefined4 *puVar2; undefined4 *puVar3; HRSRC hResInfo; HGLOBAL pvVar4; LPVOID pvVar5; undefined4 uVar6; uVar1 = load_rsrc_4cc((undefined1 *)param_2); for (puVar2 = (undefined4 *)deref_next_if_not_null(&resource_items_list->next); puVar2 != (undefined4 *)0x0; puVar2 = (undefined4 *)deref_next(puVar2)) { if ((param_1 == *(short *)(puVar2 + 2)) && (uVar1 == puVar2[3])) { resource_already_loaded = 1; *(short *)((int)puVar2 + 10) = *(short *)((int)puVar2 + 10) + 1; _DAT_00451560 = puVar2; return puVar2[5]; } } puVar3 = (undefined4 *)alloc_tracked_heap_block(0x1a); resource_already_loaded = 0; _DAT_00451560 = puVar3; *(short *)(puVar3 + 2) = param_1; puVar3[3] = uVar1; *(undefined2 *)((int)puVar3 + 10) = 1; puVar3[5] = 0; puVar2 = (undefined4 *)deref_next_if_not_null(&resources_list->next); do { if (puVar2 == (undefined4 *)0x0) { LAB_0043151a: if ((puVar3[4] == 0) || (puVar3[5] == 0)) { free_tracked_heap_block((int)puVar3); uVar6 = 0; } else { linked_list_insert((int *)resource_items_list,puVar3,0xffff); uVar6 = puVar3[5]; } return uVar6; } if (*(short *)(puVar2 + 7) == 5) { hResInfo = FindResourceA(*(HMODULE *)((int)puVar2 + 0x1e), (LPCSTR)(uint)*(ushort *)(puVar3 + 2),(LPCSTR)param_2); if (hResInfo != (HRSRC)0x0) { pvVar4 = LoadResource(*(HMODULE *)((int)puVar2 + 0x1e),hResInfo); puVar3[4] = pvVar4; pvVar5 = LockResource((HGLOBAL)puVar3[4]); puVar3[5] = pvVar5; *(undefined2 *)(puVar3 + 6) = 1; goto LAB_0043151a; } } else { uVar1 = ne_rsrc_find(*(int *)((int)puVar2 + 0x1e),*(short *)(puVar3 + 2),param_2); if (uVar1 != 0) { pvVar4 = ne_rsrc_load(*(int *)((int)puVar2 + 0x1e),(ushort)uVar1); puVar3[4] = pvVar4; pvVar5 = wrapped_globallock((HGLOBAL)puVar3[4]); puVar3[5] = pvVar5; *(undefined2 *)(puVar3 + 6) = 0; goto LAB_0043151a; } } puVar2 = (undefined4 *)deref_next(puVar2); } while( true ); } void __cdecl load_resource_item_0(short param_1,int *param_2) { load_resource_item(param_1,param_2); return; } void __cdecl load_resource_item_1(short param_1,int *param_2) { load_resource_item(param_1,param_2); return; } void __cdecl free_resource_with_hglobal(int param_1) { bool bVar1; undefined4 *puVar2; undefined4 *puVar3; undefined4 local_c; undefined1 local_8; bVar1 = false; puVar2 = (undefined4 *)deref_next_if_not_null(&resource_items_list->next); while ((puVar3 = puVar2, !bVar1 && (puVar3 != (undefined4 *)0x0))) { puVar2 = (undefined4 *)deref_next(puVar3); if (puVar3[4] == param_1) { memcpy(&local_c,puVar3 + 3,4); local_8 = 0; free_resource_item_with_idx_fourcc(*(short *)(puVar3 + 2),(undefined1 *)&local_c); bVar1 = true; } } return; } void __cdecl free_resource_item_with_idx_fourcc(short param_1,undefined1 *param_2) { bool bVar1; uint uVar2; int *piVar3; int *piVar4; bVar1 = false; uVar2 = load_rsrc_4cc(param_2); piVar3 = (int *)deref_next_if_not_null(&resource_items_list->next); while( true ) { piVar4 = piVar3; if (bVar1) { return; } if (piVar4 == (int *)0x0) break; piVar3 = (int *)deref_next(piVar4); if ((uVar2 == piVar4[3]) && ((short)piVar4[2] == param_1)) { bVar1 = true; *(short *)((int)piVar4 + 10) = *(short *)((int)piVar4 + 10) + -1; if (*(short *)((int)piVar4 + 10) == 0) { resource_already_loaded = 0; if ((short)piVar4[6] == 1) { FreeResource((HGLOBAL)piVar4[4]); } else { wrapped_globalunlock((HGLOBAL)piVar4[4]); wrapped_globalfree((HGLOBAL)piVar4[4]); } linked_list_unlink((int *)resource_items_list,piVar4); free_tracked_heap_block((int)piVar4); return; } resource_already_loaded = 1; } } return; } void __cdecl free_resource_item_with_data(int param_1) { bool bVar1; int *piVar2; int *piVar3; bVar1 = false; piVar2 = (int *)deref_next_if_not_null(&resource_items_list->next); while ((piVar3 = piVar2, !bVar1 && (piVar3 != (int *)0x0))) { piVar2 = (int *)deref_next(piVar3); if (piVar3[5] == param_1) { bVar1 = true; *(short *)((int)piVar3 + 10) = *(short *)((int)piVar3 + 10) + -1; if (*(short *)((int)piVar3 + 10) == 0) { resource_already_loaded = 0; if ((short)piVar3[6] == 1) { FreeResource((HGLOBAL)piVar3[4]); } else { wrapped_globalunlock((HGLOBAL)piVar3[4]); wrapped_globalfree((HGLOBAL)piVar3[4]); } linked_list_unlink((int *)resource_items_list,piVar3); free_tracked_heap_block((int)piVar3); } else { resource_already_loaded = 1; } } } return; } undefined4 __cdecl hglobal_for_resource_item_data(int param_1) { undefined4 *puVar1; undefined4 unaff_EDI; puVar1 = (undefined4 *)deref_next_if_not_null(&resource_items_list->next); while( true ) { if (puVar1 == (undefined4 *)0x0) { return unaff_EDI; } if (param_1 == puVar1[5]) break; puVar1 = (undefined4 *)deref_next(puVar1); } return puVar1[4]; } undefined4 __cdecl get_handle_for_resource(ushort param_1,int *param_2) { undefined4 *puVar1; HRSRC pHVar2; puVar1 = (undefined4 *)deref_next_if_not_null(&resources_list->next); while( true ) { if (puVar1 == (undefined4 *)0x0) { return 0; } if (*(short *)(puVar1 + 7) == 5) { pHVar2 = FindResourceA(*(HMODULE *)((int)puVar1 + 0x1e),(LPCSTR)(uint)param_1,(LPCSTR)param_2) ; } else { pHVar2 = (HRSRC)ne_rsrc_find(*(int *)((int)puVar1 + 0x1e),param_1,param_2); } if (pHVar2 != (HRSRC)0x0) break; puVar1 = (undefined4 *)deref_next(puVar1); } return *(undefined4 *)((int)puVar1 + 0x1e); } void __stdcall free_all_resource_items(void) { int *piVar1; int *piVar2; piVar1 = (int *)deref_next_if_not_null(&resource_items_list->next); while (piVar1 != (int *)0x0) { piVar2 = (int *)deref_next(piVar1); if ((short)piVar1[6] == 1) { FreeResource((HGLOBAL)piVar1[4]); } else { wrapped_globalunlock((HGLOBAL)piVar1[4]); wrapped_globalfree((HGLOBAL)piVar1[4]); } linked_list_unlink((int *)resource_items_list,piVar1); free_tracked_heap_block((int)piVar1); piVar1 = piVar2; } return; } undefined4 __cdecl find_and_alert_rs32(undefined4 *param_1) { undefined4 *puVar1; undefined4 uVar2; char local_200 [500]; undefined4 local_c; undefined1 local_8; uVar2 = 0; for (puVar1 = (undefined4 *)deref_next_if_not_null(&resource_items_list->next); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { if (puVar1 == param_1) { uVar2 = 1; memcpy(&local_c,puVar1 + 3,4); local_8 = 0; sprintf(local_200); alert_message(local_200); } } return uVar2; } undefined4 __cdecl find_resource_item(short param_1,undefined1 *param_2) { uint uVar1; undefined4 *puVar2; uVar1 = load_rsrc_4cc(param_2); puVar2 = (undefined4 *)deref_next_if_not_null(&resource_items_list->next); while( true ) { if (puVar2 == (undefined4 *)0x0) { return 0; } if ((param_1 == *(short *)(puVar2 + 2)) && (uVar1 == puVar2[3])) break; puVar2 = (undefined4 *)deref_next(puVar2); } return puVar2[5]; } void __stdcall balance_puzzle_make_mouse_regions(void) { mouse_region *pmVar1; short sVar2; short sVar3; mouse_region_delete_all_lists(); sVar2 = 0; do { if (0 < (short)balance_num_weights_in_sidebar[sVar2]) { pmVar1 = (mouse_region *) mouse_region_new_up(balance_weight_pos_ARRAY_0044af5c[sVar2].mouse_x, balance_weight_pos_ARRAY_0044af5c[sVar2].mouse_y, balance_weight_pos_ARRAY_0044af5c[sVar2].mouse_w, balance_weight_pos_ARRAY_0044af5c[sVar2].mouse_h,10,0x4326b4); PTR_ARRAY_004515d4[sVar2] = pmVar1; PTR_ARRAY_004515d4[sVar2]->extra_data = (int)sVar2; } sVar2 = sVar2 + 1; } while (sVar2 < 6); sVar2 = 0; do { if (balance_items[sVar2][0].global_idx == -1) { pmVar1 = (mouse_region *) mouse_region_new_up(balance_weight_pos[10 - balance_tilt_maybe][sVar2].x + -10, *(short *)((10 - balance_tilt_maybe) * 0x28 + 0x44afca + sVar2 * 4) + -10,0x1e,0x32,10,0x4324af); PTR_ARRAY_004515ec[sVar2] = pmVar1; PTR_ARRAY_004515ec[sVar2]->extra_data = (int)sVar2; } else { sVar3 = 2; do { if (balance_items[sVar2][sVar3].global_idx != -1) { pmVar1 = (mouse_region *) mouse_region_new_up(balance_weight_pos[10 - balance_tilt_maybe][sVar2].x + -10, *(short *)((10 - balance_tilt_maybe) * 0x28 + 0x44afca + sVar2 * 4) + sVar3 * 0x1f + -10,0x1e,0x32,10, 0x4324af); PTR_ARRAY_004515ec[sVar2] = pmVar1; PTR_ARRAY_004515ec[sVar2]->extra_data = (int)sVar2; break; } sVar3 = sVar3 + -1; } while (-1 < sVar3); } sVar2 = sVar2 + 1; if (4 < sVar2) { mouse_region_new_up(0x18e,0x144,0x1f5,0x165,5,0x432316); mouse_region_new_up(0x13,0x1b,0x3a,0x30,5,0x4327ac); mouse_region_new_up(0,0,0x200,0x17c,0,0x432487); mouse_region_new_up(0xb,0x81,0x42,0xb1,5,0x43242a); if (balance_puzzle_is_beat != 0) { mouse_region_new_up(10,0x140,0x14e,0x3c,0x19,0x431b4b); } return; } } while( true ); } void __stdcall balance_puzzle_on_load(void) { aseq_anim_state_struct *paVar1; aseq_cursor_struct *paVar2; short sVar3; DAT_00451618 = 0; wave_load_list[0] = 0x4a64; wave_load_list[1] = 0x4a65; wave_load_list[2] = 0x4a70; wave_load_list[3] = 0x4a72; wave_load_list[4] = 0x4a77; wave_load_list[5] = -1; load_waves_from_list(0x451486); load_and_draw_score(); FUN_0043d7c1(FUN_00434734); sVar3 = 0; do { balance_puzzle_weights_on_the_balance_aseq[sVar3] = (aseq_anim_state_struct *)0x0; sVar3 = sVar3 + 1; } while (sVar3 < 0xc); sVar3 = 0; do { paVar1 = (aseq_anim_state_struct *)load_aseq(sVar3 + 12013); balance_blue_weight_aseq_for_cursor[sVar3] = paVar1; paVar2 = (aseq_cursor_struct *) aseq_setup_as_cursor ((int)balance_blue_weight_aseq_for_cursor[sVar3], -balance_weights_widths[sVar3],0); balance_blue_weight_cursors[sVar3] = paVar2; sVar3 = sVar3 + 1; } while (sVar3 < 6); load_rrgb_1(12000); balance_bg = load_aseq(12000); aseq_draw_to_both_fbs((int)balance_bg,0,0,0); free_aseq(balance_bg); balance_puzzle_load_level(); balance_puzzle_make_mouse_regions(); balance_hint = (aseq_anim_state_struct *)load_aseq(12022); anim_state_xxx_list_insert_4((undefined4 *)balance_hint); aseq_set_pos_order((int)balance_hint,10,0x19,10); key_xxxxx_set(FUN_00434706); balance_go_back = (aseq_anim_state_struct *)load_aseq(12023); anim_state_xxx_list_insert_4((undefined4 *)balance_go_back); aseq_set_pos_order((int)balance_go_back,0x18e,0x143,10); balance_rotating_beam = (aseq_anim_state_struct *)load_aseq(12024); anim_state_xxx_list_insert_8004((undefined4 *)balance_rotating_beam); aseq_set_pos_order((int)balance_rotating_beam,0x6b,0x1f,10); aseq_select_anim((int)balance_rotating_beam,3); DAT_00451564 = get_time_ms(); balance_position_all_weights(); FUN_00430e33(balance_puzzle_is_beat); balance_draw_sidebar(); balance_hand_aseq = (aseq_anim_state_struct *)load_aseq(12025); balance_hand_cursor = (aseq_cursor_struct *)aseq_setup_as_cursor((int)balance_hand_aseq,0,0); balance_hand_cursor->enable_clip_cursor = 0; FUN_00434813(1); on_deactivate_xtra_cb = FUN_004347b2; FUN_00422170(); return; } void __stdcall balance_puzzle_on_remove(void) { aseq_anim_state_struct *paVar1; aseq_cursor_struct *paVar2; short sVar3; if (DAT_004514b0 != 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; } FUN_00431029(); free_tracked_heap_block(DAT_004516a0); set_cursor_override_regions(0,0); free_aseq((int *)balance_hand_aseq); aseq_free_cursor((int)balance_hand_cursor); FUN_00430ef4(0x451486); on_deactivate_xtra_cb = (undefined *)0x0; DAT_004514ae = balance_puzzle_is_beat; FUN_0043d7c1(0); free_aseq((int *)balance_hint); free_aseq((int *)balance_go_back); free_aseq((int *)balance_rotating_beam); mouse_region_delete_all_lists(); key_xxxxx_clear(); sVar3 = 0; do { free_aseq((int *)balance_puzzle_blue_weights_aseq[sVar3]); paVar1 = (aseq_anim_state_struct *)free_aseq((int *)balance_blue_weight_aseq_for_cursor[sVar3]); balance_blue_weight_aseq_for_cursor[sVar3] = paVar1; paVar2 = (aseq_cursor_struct *)aseq_free_cursor((int)balance_blue_weight_cursors[sVar3]); balance_blue_weight_cursors[sVar3] = paVar2; sVar3 = sVar3 + 1; } while (sVar3 < 6); sVar3 = 0; do { if (balance_puzzle_weights_on_the_balance_aseq[sVar3] != (aseq_anim_state_struct *)0x0) { paVar1 = (aseq_anim_state_struct *) free_aseq((int *)balance_puzzle_weights_on_the_balance_aseq[sVar3]); balance_puzzle_weights_on_the_balance_aseq[sVar3] = paVar1; } sVar3 = sVar3 + 1; } while (sVar3 < 0xc); free_resource_item_with_idx_fourcc(DAT_004514c2,(undefined1 *)&text); free_cur_cursor(); FUN_0042211c(); return; } void __stdcall balance_puzzle_on_periodic(void) { short sVar1; undefined4 uVar2; int iVar3; new_player_hint(0xf); if (DAT_00451618 == 0) { DAT_00451618 = 1; DAT_004514b0 = DAT_004514c4; load_wave_flag_2(DAT_004514c4); play_wave_flag2(DAT_004514b0); } if (DAT_0044af58 != 0) { DAT_0044af58 = 0; if (balance_puzzle_is_beat == 0) { uVar2 = balance_compute_tilt(); balance_puzzle_is_beat = (short)uVar2; if (balance_puzzle_is_beat == 1) { balance_puzzle_is_beat = 1; } } else { balance_compute_tilt(); } } if (DAT_00451568 != 0) { DAT_00451568 = 0; balance_puzzle_make_mouse_regions(); balance_draw_sidebar(); } switch(balance_puzzle_state) { case 0: sVar1 = aseq_anim_get_flags((int)balance_rotating_beam); if ((sVar1 != 4) && (iVar3 = get_time_ms(), (uint)(int)DAT_0045156e <= (uint)(iVar3 - DAT_00451564))) { DAT_00451564 = get_time_ms(); if (balance_tilt_maybe == 0) { aseq_anim_set_cmd_0x400_handler((int)balance_rotating_beam,0,0); aseq_select_anim((int)balance_rotating_beam,1); aseq_anim_reset_and_play((undefined4 *)balance_rotating_beam); balance_puzzle_state = DAT_0045156a; balance_puzzle_make_mouse_regions(); return; } balance_tilt_maybe = balance_tilt_maybe + -1; aseq_anim_reset_and_play((undefined4 *)balance_rotating_beam); play_wave_flag1(0x4a64,5,0); return; } break; case 1: sVar1 = aseq_anim_get_flags((int)balance_rotating_beam); if ((sVar1 != 4) && (iVar3 = get_time_ms(), (uint)(int)DAT_0045156e <= (uint)(iVar3 - DAT_00451564))) { DAT_00451564 = get_time_ms(); if (balance_tilt_maybe != 5) { balance_tilt_maybe = balance_tilt_maybe + -1; aseq_anim_reset_and_play((undefined4 *)balance_rotating_beam); play_wave_flag1(0x4a64,5,0); return; } aseq_anim_set_cmd_0x400_handler((int)balance_rotating_beam,0,0); aseq_select_anim((int)balance_rotating_beam,2); aseq_anim_reset_and_play((undefined4 *)balance_rotating_beam); balance_puzzle_state = DAT_0045156a; balance_puzzle_make_mouse_regions(); if (DAT_0044af5a == 0) { DAT_0044af5a = 1; clear_cursor_override_regions(); solved_the_puzzle(0x4a77); if (DAT_0045156a == 4) { set_custom_cursor((undefined4 *)balance_blue_weight_cursors[balance_selected_weight]); } else { FUN_0043487f(); } inc_score_by_400(); balance_puzzle_make_mouse_regions(); return; } } break; case 2: sVar1 = aseq_anim_get_flags((int)balance_rotating_beam); if ((sVar1 != 4) && (iVar3 = get_time_ms(), (uint)(int)DAT_0045156e <= (uint)(iVar3 - DAT_00451564))) { DAT_00451564 = get_time_ms(); if (balance_tilt_maybe == 10) { aseq_select_anim((int)balance_rotating_beam,3); aseq_anim_reset_and_play((undefined4 *)balance_rotating_beam); balance_puzzle_state = DAT_0045156a; balance_puzzle_make_mouse_regions(); return; } balance_tilt_maybe = balance_tilt_maybe + 1; aseq_anim_reset_and_play((undefined4 *)balance_rotating_beam); play_wave_flag1(0x4a64,5,0); } break; case 3: sVar1 = aseq_anim_get_flags((int)balance_rotating_beam); if ((sVar1 != 4) && (iVar3 = get_time_ms(), (uint)(int)DAT_0045156e <= (uint)(iVar3 - DAT_00451564))) { DAT_00451564 = get_time_ms(); if (balance_tilt_maybe != 5) { balance_tilt_maybe = balance_tilt_maybe + 1; aseq_anim_reset_and_play((undefined4 *)balance_rotating_beam); play_wave_flag1(0x4a64,5,0); return; } aseq_select_anim((int)balance_rotating_beam,0); aseq_anim_reset_and_play((undefined4 *)balance_rotating_beam); aseq_anim_set_cmd_0x400_handler((int)balance_rotating_beam,0,0); balance_puzzle_state = DAT_0045156a; balance_puzzle_make_mouse_regions(); if (DAT_0044af5a == 0) { DAT_0044af5a = 1; clear_cursor_override_regions(); solved_the_puzzle(0x4a77); if (DAT_0045156a == 4) { set_custom_cursor((undefined4 *)balance_blue_weight_cursors[balance_selected_weight]); } else { FUN_0043487f(); } inc_score_by_400(); balance_puzzle_make_mouse_regions(); return; } } break; case 7: sVar1 = wave_is_playing_(DAT_004514b0); if (sVar1 == 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; balance_puzzle_state = 6; return; } break; case 8: xxxfunc_set(&puzzle_choosing_funcset_xxx); return; } return; } void __stdcall FUN_00432316(void) { if (balance_puzzle_state != 7) { aseq_anim_reset_and_play((undefined4 *)balance_go_back); balance_puzzle_state = 8; } return; } void __stdcall balance_tilting_right(void) { aseq_anim_set_cmd_0x400_handler((int)balance_rotating_beam,balance_position_all_weights_wrap,1); DAT_0045156a = balance_puzzle_state; balance_puzzle_state = 2; if (balance_tilt_maybe == 5) { aseq_select_anim((int)balance_rotating_beam,2); } else { aseq_select_anim((int)balance_rotating_beam,1); } aseq_anim_flags_make_2((int)balance_rotating_beam); aseq_anim_reset_and_play((undefined4 *)balance_rotating_beam); return; } void __stdcall balance_tilting_left(void) { aseq_anim_set_cmd_0x400_handler((int)balance_rotating_beam,balance_position_all_weights_wrap,1); DAT_0045156a = balance_puzzle_state; balance_puzzle_state = 0; if (balance_tilt_maybe == 5) { aseq_select_anim((int)balance_rotating_beam,0); } else { aseq_select_anim((int)balance_rotating_beam,3); } aseq_anim_flags_make_2((int)balance_rotating_beam); aseq_anim_reset_and_play((undefined4 *)balance_rotating_beam); return; } void __stdcall FUN_0043242a(void) { short sVar1; if (3 < balance_puzzle_state) { if (balance_puzzle_state != 4) { return; } balance_puzzle_state = 6; sVar1 = balance_num_weights_in_sidebar[balance_selected_weight]; balance_num_weights_in_sidebar[balance_selected_weight] = balance_num_weights_in_sidebar[balance_selected_weight] + 1; if (sVar1 == 0) { anim_state_xxx_list_insert_8004 ((undefined4 *)balance_puzzle_blue_weights_aseq[balance_selected_weight]); } balance_puzzle_make_mouse_regions(); balance_draw_sidebar(); FUN_0043487f(); } return; } int balance_find_new_slot(undefined4 param_1,int param_2) { int iVar1; iVar1 = 0; do { if (balance_puzzle_weights_on_the_balance_aseq[(short)iVar1] == (aseq_anim_state_struct *)0x0) { return iVar1; } iVar1 = iVar1 + 1; } while ((short)iVar1 < 0xc); return param_2; } void __cdecl balance_puzzle_click_item_on_balance(int param_1) { short sVar1; undefined4 uVar2; int iVar3; aseq_anim_state_struct *paVar4; int extraout_EDX; short sVar5; sVar1 = *(short *)(param_1 + 0x1e); if (3 < balance_puzzle_state) { if (balance_puzzle_state == 4) { if (balance_items[sVar1][2].global_idx == -1) { uVar2 = clear_cursor_override_regions(); balance_puzzle_state = 6; iVar3 = balance_find_new_slot(uVar2,extraout_EDX); sVar5 = (short)iVar3; balance_items[sVar1][balance_num_items_on_slot[sVar1]].global_idx = sVar5; *(short *)(sVar1 * 0xc + 0x451628 + balance_num_items_on_slot[sVar1] * 4) = balance_selected_weight; paVar4 = (aseq_anim_state_struct *)load_aseq(balance_selected_weight + 12007); balance_puzzle_weights_on_the_balance_aseq[sVar5] = paVar4; anim_state_xxx_list_insert_8004 ((undefined4 *)balance_puzzle_weights_on_the_balance_aseq[sVar5]); balance_draw_lhs_blue_xxx(sVar1); balance_num_items_on_slot[sVar1] = balance_num_items_on_slot[sVar1] + 1; balance_position_all_weights(); FUN_0043487f(); balance_puzzle_make_mouse_regions(); play_wave_flag1(0x4a72,5,0); DAT_0044af58 = 1; } } else if ((balance_puzzle_state == 6) && (balance_items[sVar1][0].global_idx != -1)) { clear_cursor_override_regions(); balance_num_items_on_slot[sVar1] = balance_num_items_on_slot[sVar1] + -1; sVar5 = balance_items[sVar1][balance_num_items_on_slot[sVar1]].global_idx; balance_puzzle_state = 4; balance_selected_weight = *(short *)(sVar1 * 0xc + 0x451628 + balance_num_items_on_slot[sVar1] * 4); set_custom_cursor((undefined4 *)balance_blue_weight_cursors[balance_selected_weight]); paVar4 = (aseq_anim_state_struct *) free_aseq((int *)balance_puzzle_weights_on_the_balance_aseq[sVar5]); balance_puzzle_weights_on_the_balance_aseq[sVar5] = paVar4; *(undefined2 *)(sVar1 * 0xc + 0x451628 + balance_num_items_on_slot[sVar1] * 4) = 0xffff; balance_items[sVar1][balance_num_items_on_slot[sVar1]].global_idx = -1; balance_draw_lhs_blue_xxx(sVar1); play_wave_flag1(0x4a70,5,0); balance_position_all_weights(); balance_puzzle_make_mouse_regions(); DAT_0044af58 = 1; } } return; } void __cdecl balance_puzzle_click_sidebar(int param_1) { short sVar1; int iVar2; if (3 < balance_puzzle_state) { if (balance_puzzle_state == 4) { clear_cursor_override_regions(); balance_puzzle_state = 6; sVar1 = balance_num_weights_in_sidebar[balance_selected_weight]; balance_num_weights_in_sidebar[balance_selected_weight] = balance_num_weights_in_sidebar[balance_selected_weight] + 1; if (sVar1 == 0) { anim_state_xxx_list_insert_8004 ((undefined4 *)balance_puzzle_blue_weights_aseq[balance_selected_weight]); } balance_puzzle_make_mouse_regions(); play_wave_flag1(0x4a72,5,0); balance_draw_sidebar(); FUN_0043487f(); return; } if (balance_puzzle_state != 6) { return; } balance_puzzle_state = 4; clear_cursor_override_regions(); balance_selected_weight = *(short *)(param_1 + 0x1e); set_custom_cursor((undefined4 *)balance_blue_weight_cursors[balance_selected_weight]); iVar2 = (int)balance_selected_weight; balance_num_weights_in_sidebar[iVar2] = balance_num_weights_in_sidebar[iVar2] + -1; if (balance_num_weights_in_sidebar[iVar2] == 0) { anim_state_xxx_list_remove((int *)balance_puzzle_blue_weights_aseq[balance_selected_weight]); } balance_draw_sidebar(); balance_puzzle_make_mouse_regions(); play_wave_flag1(0x4a70,5,0); } return; } void __stdcall FUN_004327ac(void) { uint uVar1; char *pcVar2; short sVar3; char *apcStackY_20400 [32762]; char *local_400 [5]; char local_3ec [1000]; anim_state_xxx_list_insert_4((undefined4 *)balance_hint); xxx_periodic_loop(); anim_state_xxx_list_remove((int *)balance_hint); xxx_periodic_loop(); memset((undefined4 *)local_3ec,0,1000); local_400[0] = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[0],(int *)&text); uVar1 = strlen(local_400[0]); FUN_00440d70((undefined4 *)local_3ec,local_400[0],uVar1); for (sVar3 = 1; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { pcVar2 = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[sVar3],(int *)&text); local_400[sVar3] = pcVar2; uVar1 = strlen(local_400[sVar3]); FUN_00440ce0(local_3ec,local_400[sVar3],uVar1); } FUN_004301cf(local_3ec); for (sVar3 = 0; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { free_resource_item_with_idx_fourcc(SHORT_ARRAY_004514ec[sVar3],(undefined1 *)&text); } return; } void __stdcall balance_draw_sidebar(void) { short sVar1; byte local_10 [12]; load_nfnt(15000); gfxish_copy_otherbuf_to_dest_and_invalidate(0xb,0x81,0x42,0xb1); sVar1 = 0; do { if (0 < (short)balance_num_weights_in_sidebar[sVar1]) { anim_state_xxx_list_insert_8004((undefined4 *)balance_puzzle_blue_weights_aseq[sVar1]); aseq_set_pos_order((int)balance_puzzle_blue_weights_aseq[sVar1], balance_weight_pos_ARRAY_0044af5c[sVar1].sidebar_x, balance_weight_pos_ARRAY_0044af5c[sVar1].sidebar_y,0x14); sprintf(local_10); FUN_0043dc0b(15000,local_10,balance_weight_pos_ARRAY_0044af5c[sVar1].sidebar_text_x, balance_weight_pos_ARRAY_0044af5c[sVar1].sidebar_text_y,0); } sVar1 = sVar1 + 1; } while (sVar1 < 6); gfxish_invalidate_rect_wrap(0xb,0x81,0x42,0xb1); free_nfnt(15000); return; } void __cdecl balance_position_weight(short param_1,short param_2,short param_3) { short sVar1; sVar1 = 0; do { if (balance_items[param_3][sVar1].global_idx != -1) { aseq_set_pos_order((int)balance_puzzle_weights_on_the_balance_aseq [balance_items[param_3][sVar1].global_idx], balance_weights_widths[*(short *)(param_3 * 0xc + 0x451628 + sVar1 * 4)] + param_1,sVar1 * 0x1f + param_2,0x14); } sVar1 = sVar1 + 1; } while (sVar1 < 3); return; } void __stdcall balance_position_all_weights(void) { short sVar1; sVar1 = 0; do { if (balance_items[sVar1][0].global_idx != -1) { balance_position_weight (balance_weight_pos[10 - balance_tilt_maybe][sVar1].x, *(short *)((10 - balance_tilt_maybe) * 0x28 + 0x44afca + sVar1 * 4) + -2,sVar1); } sVar1 = sVar1 + 1; } while (sVar1 < 10); return; } short __stdcall compute_balance_lhs(void) { short sVar1; short sVar2; short sVar3; sVar2 = 0; sVar3 = 0; do { sVar1 = 0; do { if (*(short *)(sVar3 * 0xc + 0x451628 + sVar1 * 4) == -1) break; sVar2 = sVar2 + balance_weight_pos_ARRAY_0044af5c [*(short *)(sVar3 * 0xc + 0x451628 + sVar1 * 4)].value_maybe * (5 - sVar3); sVar1 = sVar1 + 1; } while (sVar1 < 3); sVar3 = sVar3 + 1; if (4 < sVar3) { return sVar2; } } while( true ); } short __stdcall compute_balance_rhs(void) { short sVar1; short sVar2; short sVar3; sVar2 = 0; sVar3 = 5; do { sVar1 = 0; do { if (*(short *)(sVar3 * 0xc + 0x451628 + sVar1 * 4) == -1) break; sVar2 = sVar2 + balance_weight_pos_ARRAY_0044af5c [*(short *)(sVar3 * 0xc + 0x451628 + sVar1 * 4)].value_maybe * (sVar3 + -4); sVar1 = sVar1 + 1; } while (sVar1 < 3); sVar3 = sVar3 + 1; if (9 < sVar3) { return sVar2; } } while( true ); } void __stdcall balanct_tilt_towards_center(void) { aseq_anim_set_cmd_0x400_handler((int)balance_rotating_beam,balance_position_all_weights_wrap,1); DAT_0045156a = balance_puzzle_state; if (balance_tilt_maybe == 0) { aseq_select_anim((int)balance_rotating_beam,1); aseq_anim_flags_make_2((int)balance_rotating_beam); aseq_anim_reset_and_play((undefined4 *)balance_rotating_beam); balance_puzzle_state = 3; return; } if (balance_tilt_maybe != 5) { if (balance_tilt_maybe != 10) { return; } aseq_select_anim((int)balance_rotating_beam,3); aseq_anim_flags_make_2((int)balance_rotating_beam); aseq_anim_reset_and_play((undefined4 *)balance_rotating_beam); balance_puzzle_state = 1; } return; } undefined4 __stdcall balance_compute_tilt(void) { short sVar1; short sVar2; uint uVar3; int iVar4; undefined4 uVar5; undefined2 extraout_var; sVar1 = compute_balance_lhs(); sVar2 = compute_balance_rhs(); if (sVar1 < sVar2) { uVar3 = (sVar1 * 100) / (int)sVar2 + 1; iVar4 = (int)uVar3 >> 1; if (iVar4 < 0) { iVar4 = iVar4 + (uint)((uVar3 & 1) != 0); } DAT_0045156e = (undefined2)iVar4; } else { uVar3 = (sVar2 * 100) / (int)sVar1 + 1; iVar4 = (int)uVar3 >> 1; if (iVar4 < 0) { iVar4 = iVar4 + (uint)((uVar3 & 1) != 0); } DAT_0045156e = (undefined2)iVar4; } if (sVar2 < sVar1) { if (balance_tilt_maybe != 0) { balance_tilting_left(); } uVar5 = 0; } else if (sVar1 < sVar2) { if (balance_tilt_maybe != 10) { balance_tilting_right(); } uVar5 = 0; } else if (sVar1 == sVar2) { DAT_0045156e = 0x19; balanct_tilt_towards_center(); uVar5 = CONCAT22(extraout_var,1); } else { uVar5 = 0; } return uVar5; } void __stdcall balance_puzzle_load_level(void) { aseq_anim_state_struct *paVar1; undefined4 in_ECX; short sVar2; short sVar3; undefined4 uStack_8; balance_puzzle_is_beat = 0; DAT_0044af5a = 0; balance_puzzle_state = 6; balance_tilt_maybe = 10; balance_puzzle_blue_weights_aseq[0] = (aseq_anim_state_struct *)load_aseq(12013); balance_puzzle_blue_weights_aseq[1] = (aseq_anim_state_struct *)load_aseq(12014); balance_puzzle_blue_weights_aseq[2] = (aseq_anim_state_struct *)load_aseq(12015); balance_puzzle_blue_weights_aseq[3] = (aseq_anim_state_struct *)load_aseq(12016); balance_puzzle_blue_weights_aseq[4] = (aseq_anim_state_struct *)load_aseq(12017); balance_puzzle_blue_weights_aseq[5] = (aseq_anim_state_struct *)load_aseq(12018); sVar3 = 0; do { sVar2 = 0; do { balance_items[sVar3][sVar2].global_idx = -1; *(undefined2 *)(sVar3 * 0xc + 0x451628 + sVar2 * 4) = 0xffff; sVar2 = sVar2 + 1; } while (sVar2 < 3); sVar3 = sVar3 + 1; } while (sVar3 < 10); sVar3 = 0; do { balance_num_items_on_slot[sVar3] = 0; sVar3 = sVar3 + 1; } while (sVar3 < 5); if (0x2b < puzzle_idx) { puzzle_idx = 1; } switch(puzzle_idx) { case 1: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee1; SHORT_ARRAY_004514ce[0] = 0x2ee1; SHORT_ARRAY_004514ce[1] = 0x2ee2; SHORT_ARRAY_004514ce[2] = 0x2ee3; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[7][0].weight_idx = 2; break; case 2: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee1; SHORT_ARRAY_004514ce[0] = 0x2ee1; SHORT_ARRAY_004514ce[1] = 0x2ee2; SHORT_ARRAY_004514ce[2] = 0x2ee3; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[8][0].weight_idx = 4; break; case 3: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee1; SHORT_ARRAY_004514ce[0] = 0x2ee1; SHORT_ARRAY_004514ce[1] = 0x2ee2; SHORT_ARRAY_004514ce[2] = 0x2ee3; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 1; balance_items[5][0].weight_idx = 5; break; case 4: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee6; SHORT_ARRAY_004514ce[0] = 0x2ee4; SHORT_ARRAY_004514ce[1] = 0x2ee5; SHORT_ARRAY_004514ce[2] = 0x2ee6; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[7][0].weight_idx = 4; break; case 5: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee4; SHORT_ARRAY_004514ce[0] = 0x2ee7; SHORT_ARRAY_004514ce[1] = 0x2ee8; SHORT_ARRAY_004514ce[2] = 0x2ee9; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[8][0].weight_idx = 1; break; case 6: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee4; SHORT_ARRAY_004514ce[0] = 0x2ee7; SHORT_ARRAY_004514ce[1] = 0x2ee8; SHORT_ARRAY_004514ce[2] = 0x2ee9; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[6][0].weight_idx = 5; break; case 7: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee3; SHORT_ARRAY_004514ce[0] = 0x2eea; SHORT_ARRAY_004514ce[1] = 0x2eeb; SHORT_ARRAY_004514ce[2] = 0x2eec; SHORT_ARRAY_004514ce[3] = 0x2eed; SHORT_ARRAY_004514ce[4] = 0x2eee; SHORT_ARRAY_004514ce[5] = 0x2eef; SHORT_ARRAY_004514ce[6] = -1; balance_num_weights_in_sidebar[0] = 2; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[5][0].weight_idx = 5; break; case 8: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee3; SHORT_ARRAY_004514ce[0] = 0x2eea; SHORT_ARRAY_004514ce[1] = 0x2eeb; SHORT_ARRAY_004514ce[2] = 0x2eec; SHORT_ARRAY_004514ce[3] = 0x2eed; SHORT_ARRAY_004514ce[4] = 0x2eee; SHORT_ARRAY_004514ce[5] = 0x2eef; SHORT_ARRAY_004514ce[6] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 2; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[5][0].weight_idx = 5; break; case 9: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee5; SHORT_ARRAY_004514ce[0] = 0x2ef3; SHORT_ARRAY_004514ce[1] = 0x2ef4; SHORT_ARRAY_004514ce[2] = 0x2ef5; SHORT_ARRAY_004514ce[3] = 0x2ef6; SHORT_ARRAY_004514ce[4] = 0x2ef7; SHORT_ARRAY_004514ce[5] = 0x2ef8; SHORT_ARRAY_004514ce[6] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 2; balance_num_weights_in_sidebar[5] = 0; balance_items[7][0].weight_idx = 5; break; case 10: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[7][0].weight_idx = 3; balance_items[7][1].weight_idx = 0; break; case 0xb: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 1; balance_items[9][0].weight_idx = 4; balance_items[9][1].weight_idx = 0; break; case 0xc: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 3; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[6][0].weight_idx = 4; break; case 0xd: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[5][0].weight_idx = 5; balance_items[5][1].weight_idx = 5; break; case 0xe: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 2; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[8][0].weight_idx = 1; balance_items[8][1].weight_idx = 1; balance_items[8][2].weight_idx = 0; break; case 0xf: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[7][0].weight_idx = 2; balance_items[7][1].weight_idx = 0; balance_items[7][2].weight_idx = 0; break; case 0x10: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[9][0].weight_idx = 2; break; case 0x11: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 2; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 2; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[5][0].weight_idx = 5; break; case 0x12: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 1; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[8][0].weight_idx = 3; break; case 0x13: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 1; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[6][0].weight_idx = 4; balance_items[8][0].weight_idx = 1; break; case 0x14: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[6][0].weight_idx = 5; balance_items[8][0].weight_idx = 4; break; case 0x15: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 1; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[5][0].weight_idx = 0; balance_items[8][0].weight_idx = 3; break; case 0x16: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 1; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[5][0].weight_idx = 4; balance_items[7][0].weight_idx = 2; break; case 0x17: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[5][0].weight_idx = 0; balance_items[7][0].weight_idx = 5; break; case 0x18: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[7][0].weight_idx = 5; break; case 0x19: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[7][0].weight_idx = 0; balance_items[9][0].weight_idx = 4; break; case 0x1a: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 1; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[5][0].weight_idx = 0; balance_items[8][0].weight_idx = 2; break; case 0x1b: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 1; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 1; balance_items[5][0].weight_idx = 0; balance_items[6][0].weight_idx = 1; balance_items[7][0].weight_idx = 2; break; case 0x1c: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[5][0].weight_idx = 4; balance_items[7][0].weight_idx = 2; balance_items[8][0].weight_idx = 2; break; case 0x1d: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 1; balance_items[5][0].weight_idx = 0; balance_items[8][0].weight_idx = 3; balance_items[9][0].weight_idx = 4; break; case 0x1e: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 1; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[7][0].weight_idx = 4; balance_items[8][0].weight_idx = 3; break; case 0x1f: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 2; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 1; balance_items[5][0].weight_idx = 1; balance_items[8][0].weight_idx = 3; balance_items[9][0].weight_idx = 2; break; case 0x20: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 1; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 1; balance_items[5][0].weight_idx = 0; balance_items[7][0].weight_idx = 1; break; case 0x21: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 1; balance_items[5][0].weight_idx = 2; balance_items[7][0].weight_idx = 5; balance_items[8][0].weight_idx = 3; break; case 0x22: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee7; SHORT_ARRAY_004514ce[0] = 0x2ef0; SHORT_ARRAY_004514ce[1] = 0x2ef1; SHORT_ARRAY_004514ce[2] = 0x2ef2; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 1; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 2; balance_num_weights_in_sidebar[5] = 0; balance_items[5][0].weight_idx = 2; balance_items[6][0].weight_idx = 3; balance_items[9][0].weight_idx = 5; break; case 0x23: DAT_004514be = 6; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee5; SHORT_ARRAY_004514ce[0] = 0x2ef3; SHORT_ARRAY_004514ce[1] = 0x2ef4; SHORT_ARRAY_004514ce[2] = 0x2ef5; SHORT_ARRAY_004514ce[3] = 0x2ef6; SHORT_ARRAY_004514ce[4] = 0x2ef7; SHORT_ARRAY_004514ce[5] = 0x2ef8; SHORT_ARRAY_004514ce[6] = -1; balance_num_weights_in_sidebar[0] = 2; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[5][0].weight_idx = 0; balance_items[6][0].weight_idx = 3; balance_items[7][0].weight_idx = 4; balance_items[8][0].weight_idx = 3; break; case 0x24: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee8; SHORT_ARRAY_004514ce[0] = 0x2ef9; SHORT_ARRAY_004514ce[1] = 0x2efa; SHORT_ARRAY_004514ce[2] = 0x2efb; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 2; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 0; balance_items[6][0].weight_idx = 5; balance_items[7][0].weight_idx = 0; balance_items[8][0].weight_idx = 0; balance_items[9][0].weight_idx = 4; break; case 0x25: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee8; SHORT_ARRAY_004514ce[0] = 0x2ef9; SHORT_ARRAY_004514ce[1] = 0x2efa; SHORT_ARRAY_004514ce[2] = 0x2efb; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 0; balance_items[5][0].weight_idx = 0; balance_items[6][0].weight_idx = 0; balance_items[7][0].weight_idx = 0; balance_items[8][0].weight_idx = 0; balance_items[9][0].weight_idx = 0; break; case 0x26: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee8; SHORT_ARRAY_004514ce[0] = 0x2ef9; SHORT_ARRAY_004514ce[1] = 0x2efa; SHORT_ARRAY_004514ce[2] = 0x2efb; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 3; balance_items[5][0].weight_idx = 5; balance_items[6][0].weight_idx = 5; balance_items[7][0].weight_idx = 5; balance_items[8][0].weight_idx = 5; balance_items[9][0].weight_idx = 5; break; case 0x27: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee8; SHORT_ARRAY_004514ce[0] = 0x2ef9; SHORT_ARRAY_004514ce[1] = 0x2efa; SHORT_ARRAY_004514ce[2] = 0x2efb; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 1; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 2; balance_items[5][0].weight_idx = 4; balance_items[6][0].weight_idx = 3; balance_items[7][0].weight_idx = 2; balance_items[8][0].weight_idx = 1; balance_items[9][0].weight_idx = 0; break; case 0x28: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee8; SHORT_ARRAY_004514ce[0] = 0x2ef9; SHORT_ARRAY_004514ce[1] = 0x2efa; SHORT_ARRAY_004514ce[2] = 0x2efb; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 1; balance_items[5][0].weight_idx = 0; balance_items[6][0].weight_idx = 1; balance_items[7][0].weight_idx = 2; balance_items[8][0].weight_idx = 3; balance_items[9][0].weight_idx = 4; break; case 0x29: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee8; SHORT_ARRAY_004514ce[0] = 0x2ef9; SHORT_ARRAY_004514ce[1] = 0x2efa; SHORT_ARRAY_004514ce[2] = 0x2efb; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 1; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 1; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 0; balance_num_weights_in_sidebar[5] = 1; balance_items[5][0].weight_idx = 5; balance_items[6][0].weight_idx = 4; balance_items[7][0].weight_idx = 3; balance_items[8][0].weight_idx = 2; balance_items[9][0].weight_idx = 1; break; case 0x2a: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee8; SHORT_ARRAY_004514ce[0] = 0x2ef9; SHORT_ARRAY_004514ce[1] = 0x2efa; SHORT_ARRAY_004514ce[2] = 0x2efb; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 1; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 1; balance_items[5][0].weight_idx = 2; balance_items[6][0].weight_idx = 2; balance_items[7][0].weight_idx = 2; balance_items[8][0].weight_idx = 2; balance_items[9][0].weight_idx = 2; break; case 0x2b: DAT_004514be = 3; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x2ee2; SHORT_ARRAY_004514ce[0] = 0x2efc; SHORT_ARRAY_004514ce[1] = 0x2efd; SHORT_ARRAY_004514ce[2] = 0x2efe; SHORT_ARRAY_004514ce[3] = -1; balance_num_weights_in_sidebar[0] = 0; balance_num_weights_in_sidebar[1] = 0; balance_num_weights_in_sidebar[2] = 0; balance_num_weights_in_sidebar[3] = 0; balance_num_weights_in_sidebar[4] = 1; balance_num_weights_in_sidebar[5] = 1; balance_items[5][0].weight_idx = 3; balance_items[5][1].weight_idx = 3; balance_items[5][2].weight_idx = 1; balance_items[6][0].weight_idx = 3; balance_items[6][1].weight_idx = 3; balance_items[6][2].weight_idx = 1; balance_items[7][0].weight_idx = 3; balance_items[7][1].weight_idx = 3; balance_items[7][2].weight_idx = 1; } DAT_00451570 = 0; sVar3 = 0; uStack_8 = in_ECX; do { sVar2 = 0; do { if (*(short *)(sVar3 * 0xc + 0x451628 + sVar2 * 4) != -1) { switch(*(undefined2 *)(sVar3 * 0xc + 0x451628 + sVar2 * 4)) { case 0: uStack_8 = 0x2ee10000; break; case 1: uStack_8 = 0x2ee20000; break; case 2: uStack_8 = 0x2ee30000; break; case 3: uStack_8 = 0x2ee40000; break; case 4: uStack_8 = 0x2ee50000; break; case 5: uStack_8 = 0x2ee60000; } balance_items[sVar3][sVar2].global_idx = DAT_00451570; DAT_00451570 = DAT_00451570 + 1; paVar1 = (aseq_anim_state_struct *)load_aseq(uStack_8._2_2_); balance_puzzle_weights_on_the_balance_aseq[balance_items[sVar3][sVar2].global_idx] = paVar1; anim_state_xxx_list_insert_8004 ((undefined4 *) balance_puzzle_weights_on_the_balance_aseq [balance_items[sVar3][sVar2].global_idx]); } sVar2 = sVar2 + 1; } while (sVar2 < 3); sVar3 = sVar3 + 1; } while (sVar3 < 10); DAT_004514c2 = 12000; DAT_004514c4 = 12000; DAT_004514b4 = load_resource_item_0(12000,(int *)&text); return; } void __stdcall FUN_00434706(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if (sVar1 == 0xd) { if (balance_puzzle_is_beat != 0) { balance_puzzle_state = 8; } DAT_004514f6 = 1; } return; } void __stdcall FUN_00434734(void) { short sVar1; if (balance_puzzle_state == 4) { sVar1 = balance_num_weights_in_sidebar[balance_selected_weight]; balance_num_weights_in_sidebar[balance_selected_weight] = balance_num_weights_in_sidebar[balance_selected_weight] + 1; if (sVar1 == 0) { anim_state_xxx_list_insert_8004 ((undefined4 *)balance_puzzle_blue_weights_aseq[balance_selected_weight]); } FUN_0043487f(); balance_puzzle_state = 6; } else if (balance_puzzle_state == 6) { balance_puzzle_make_mouse_regions(); } FUN_0043479b(); balance_puzzle_make_mouse_regions(); return; } void __stdcall FUN_0043479b(void) { balance_draw_sidebar(); FUN_00430e33(balance_puzzle_is_beat); return; } void __stdcall FUN_004347b2(void) { short sVar1; DAT_00451568 = 1; if (balance_puzzle_state == 4) { sVar1 = balance_num_weights_in_sidebar[balance_selected_weight]; balance_num_weights_in_sidebar[balance_selected_weight] = balance_num_weights_in_sidebar[balance_selected_weight] + 1; if (sVar1 == 0) { anim_state_xxx_list_insert_8004 ((undefined4 *)balance_puzzle_blue_weights_aseq[balance_selected_weight]); } FUN_0043487f(); balance_puzzle_state = 6; return; } if (balance_puzzle_state != 6) { return; } return; } void __cdecl FUN_00434813(short param_1) { undefined2 *puVar1; if (param_1 == 0) { free_tracked_heap_block((int)DAT_004516a0); } puVar1 = (undefined2 *)alloc_tracked_heap_block(0x10); DAT_004516a0 = puVar1; *puVar1 = 0; puVar1[1] = 5; puVar1[3] = 0x17a; puVar1[2] = 0x1ff; *(aseq_cursor_struct **)(puVar1 + 6) = balance_hand_cursor; puVar1[5] = 0; set_cursor_override_regions((int)DAT_004516a0,1); return; } void __stdcall clear_cursor_override_regions(void) { set_cursor_override_regions(0,0); return; } void __stdcall FUN_0043487f(void) { FUN_00434813(0); return; } void __cdecl balance_draw_lhs_blue_xxx(short param_1) { short sVar1; short sVar2; bool bVar3; aseq_anim_state_struct *paVar4; short sVar5; bVar3 = false; sVar5 = 2; do { sVar1 = balance_items[param_1][sVar5].global_idx; if (sVar1 != -1) { sVar2 = *(short *)(param_1 * 0xc + 0x451628 + sVar5 * 4); if (bVar3) { paVar4 = (aseq_anim_state_struct *) free_aseq((int *)balance_puzzle_weights_on_the_balance_aseq[sVar1]); balance_puzzle_weights_on_the_balance_aseq[sVar1] = paVar4; paVar4 = (aseq_anim_state_struct *)load_aseq(sVar2 + 12100); balance_puzzle_weights_on_the_balance_aseq[sVar1] = paVar4; anim_state_xxx_list_insert_8004 ((undefined4 *)balance_puzzle_weights_on_the_balance_aseq[sVar1]); } else { bVar3 = true; paVar4 = (aseq_anim_state_struct *) free_aseq((int *)balance_puzzle_weights_on_the_balance_aseq[sVar1]); balance_puzzle_weights_on_the_balance_aseq[sVar1] = paVar4; paVar4 = (aseq_anim_state_struct *)load_aseq(sVar2 + 12007); balance_puzzle_weights_on_the_balance_aseq[sVar1] = paVar4; anim_state_xxx_list_insert_8004 ((undefined4 *)balance_puzzle_weights_on_the_balance_aseq[sVar1]); } } sVar5 = sVar5 + -1; } while (-1 < sVar5); return; } void __stdcall balance_position_all_weights_wrap(void) { balance_position_all_weights(); return; } void __cdecl FUN_0043497c(short param_1,short param_2) { aseq_set_pos_order((int)file_select_scroll_widget_aseq[0],param_1,param_2,5); return; } void __cdecl FUN_0043499b(short *param_1) { short sVar1; short sVar2; sVar1 = 0; do { anim_state_xxx_list_remove((int *)file_select_scroll_widget_aseq[sVar1]); sVar1 = sVar1 + 1; } while (sVar1 < 5); if (*(int *)(param_1 + 10) < 1) { sVar1 = 3; sVar2 = 4; } else { sVar1 = 1; sVar2 = 2; } aseq_set_pos_order((int)file_select_scroll_widget_aseq[sVar1],*param_1,param_1[2],0); aseq_anim_reset_and_play((undefined4 *)file_select_scroll_widget_aseq[sVar1]); aseq_set_pos_order((int)file_select_scroll_widget_aseq[sVar2],*param_1, param_1[2] + param_1[6] + -0x15,0); aseq_anim_reset_and_play((undefined4 *)file_select_scroll_widget_aseq[sVar2]); if (0 < *(int *)(param_1 + 10)) { sVar1 = (short)(((int)(short)(param_1[6] + -0x3b) * *(int *)(param_1 + 8)) / *(int *)(param_1 + 10)) + param_1[2] + 0x14; *(int *)(param_1 + 0x10) = (int)sVar1; FUN_0043497c(*param_1,sVar1); aseq_anim_reset_and_play((undefined4 *)file_select_scroll_widget_aseq[0]); } return; } void __cdecl FUN_00434a80(short *param_1,short param_2) { if (param_2 < 0) { param_2 = 0; } else if (*(int *)(param_1 + 10) < (int)param_2) { param_2 = param_1[10]; } if ((int)param_2 != *(int *)(param_1 + 8)) { *(int *)(param_1 + 8) = (int)param_2; FUN_0043499b(param_1); } return; } void __cdecl FUN_00434ab5(short *param_1,short param_2) { if (param_2 < 0) { param_2 = 0; } if ((int)param_2 != *(int *)(param_1 + 10)) { *(int *)(param_1 + 10) = (int)param_2; if ((int)param_2 < *(int *)(param_1 + 8)) { *(int *)(param_1 + 8) = (int)param_2; } FUN_0043499b(param_1); } return; } void __cdecl FUN_00434aea(short *param_1,uint param_2) { short sVar1; int iVar2; uint uVar3; int iVar4; short sVar5; bool bVar6; short local_14; short local_12; short local_10; short local_e; short local_c; short local_a; short local_8; short local_6; get_mouse_xy_relative(&local_14); if (0 < *(int *)(param_1 + 10)) { local_e = param_1[6] + -0x3b; bVar6 = (param_2 & 0x4000) != 0; if (bVar6) { iVar2 = get_time_ms(); *(int *)(param_1 + 0xe) = iVar2 + 0x1b; } uVar3 = get_time_ms(); if ((*(uint *)(param_1 + 0xe) < uVar3) || (bVar6)) { local_6 = *param_1; sVar1 = param_1[2]; local_8 = param_1[4]; local_a = param_1[6]; if ((int)local_12 < sVar1 + 0x13) { FUN_00434a80(param_1,param_1[8] + -1); } else if ((int)sVar1 + (int)local_a + -0x13 < (int)local_12) { FUN_00434a80(param_1,param_1[8] + 1); } else if ((int)local_12 < *(int *)(param_1 + 0x10)) { FUN_00434a80(param_1,param_1[8] - param_1[0xc]); } else if ((int)local_12 < *(int *)(param_1 + 0x10) + 0x15) { local_10 = local_12 - param_1[0x10]; sVar5 = local_12; do { if (((sVar5 != local_12) && (local_6 <= local_14)) && ((int)local_14 < (int)local_6 + (int)local_8)) { local_c = local_12 - local_10; if ((int)local_c < sVar1 + 0x12) { local_c = sVar1 + 0x12; } if ((int)sVar1 + (int)local_a + -0x25 < (int)local_c) { local_c = local_a + sVar1 + -0x25; } sVar5 = local_12; if (param_1[0x10] != local_c) { gfxish_copy_otherbuf_to_dest_and_invalidate(*param_1,param_1[2],param_1[4],param_1[6]) ; FUN_0043497c(local_6,local_c); } } } while ((param_2 & 0x8000) != 0); iVar2 = *(int *)(param_1 + 10); iVar4 = (int)local_e >> 1; if (iVar4 < 0) { iVar4 = iVar4 + (uint)(((int)local_e & 1U) != 0); } param_1[8] = -1; param_1[9] = -1; *(int *)(param_1 + 0x10) = (int)local_c; FUN_00434a80(param_1,(short)((((int)local_c - (sVar1 + 0x13)) * iVar2 + iVar4) / (int)local_e)); } else { FUN_00434a80(param_1,param_1[8] + param_1[0xc]); } iVar2 = get_time_ms(); *(int *)(param_1 + 0xe) = iVar2 + 0x1b; } } return; } void __stdcall file_select_load_scroll_widget_aseq(void) { aseq_anim_state_struct *paVar1; short sVar2; sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *)load_aseq(sVar2 + 6004); file_select_scroll_widget_aseq[sVar2] = paVar1; sVar2 = sVar2 + 1; } while (sVar2 < 5); return; } void __stdcall FUN_00434d1a(void) { aseq_anim_state_struct *paVar1; short sVar2; sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)file_select_scroll_widget_aseq[sVar2]); file_select_scroll_widget_aseq[sVar2] = paVar1; sVar2 = sVar2 + 1; } while (sVar2 < 5); return; } bool __stdcall FUN_00434d44(void) { return mouse_unk_0x6_idx == DAT_0045171c; } void __cdecl FUN_00434d58(word param_1) { short sVar1; if (DAT_00451718 == 0) { sVar1 = (short)((mouse_unk_0x6_idx + 1) % 100); if (sVar1 != DAT_0045171c) { mouse_unk_0x6_struct_ARRAY_0045171e[mouse_unk_0x6_idx].field0_0x0 = param_1; mouse_unk_0x6_idx = sVar1; } DAT_00451718 = 0; } return; } word __stdcall FUN_00434db0(void) { bool bVar1; undefined3 extraout_var; int iVar2; if (DAT_00451718 == 0) { bVar1 = FUN_00434d44(); if ((short)CONCAT31(extraout_var,bVar1) == 0) { iVar2 = (int)DAT_0045171c; DAT_004516e8 = mouse_unk_0x6_struct_ARRAY_0045171e[iVar2].x; DAT_004516ea = mouse_unk_0x6_struct_ARRAY_0045171e[iVar2].y; DAT_0045171c = DAT_0045171c + 1; DAT_0045171c = DAT_0045171c % 100; return mouse_unk_0x6_struct_ARRAY_0045171e[iVar2].field0_0x0; } } return 0; } void __stdcall FUN_00434e19(void) { undefined2 uVar1; uVar1 = pump_messages_and_get_key_(); FUN_00434d58(uVar1); return; } void __stdcall FUN_00434e2a(void) { FUN_00434d58(0x701); return; } void __cdecl file_select_button_cb(int param_1) { short sVar1; sVar1 = *(short *)(param_1 + 0x1e); if (file_select_0x12_struct_ARRAY_0044b1ca[sVar1].enabled_maybe != 0) { DAT_0044b1c8 = sVar1; aseq_anim_reset_and_play((undefined4 *)file_select_0x12_struct_ARRAY_0044b1ca[sVar1].anim_state) ; FUN_00434d58(file_select_0x12_struct_ARRAY_0044b1ca[DAT_0044b1c8].field3_0x6); } return; } void __cdecl FUN_00434e8d(short param_1) { anim_change_to_xxx((int *)file_select_0x12_struct_ARRAY_0044b1ca[param_1].anim_state, (ushort)(file_select_0x12_struct_ARRAY_0044b1ca[param_1].enabled_maybe == 0)); return; } void __cdecl FUN_00434ec0(int param_1) { short sVar1; int iVar2; undefined4 local_8; get_mouse_xy_relative((short *)&local_8); if (DAT_00451718 == 0) { sVar1 = (short)((mouse_unk_0x6_idx + 1) % 100); if (sVar1 != DAT_0045171c) { iVar2 = (int)mouse_unk_0x6_idx; mouse_unk_0x6_struct_ARRAY_0045171e[iVar2].field0_0x0 = *(word *)(param_1 + 0x1e); mouse_unk_0x6_struct_ARRAY_0045171e[iVar2].x = (word)local_8; mouse_unk_0x6_struct_ARRAY_0045171e[iVar2].y = local_8._2_2_; mouse_unk_0x6_idx = sVar1; } DAT_00451718 = 0; } return; } void __stdcall FUN_00434f3a(void) { return; } void __stdcall FUN_00434f3b(void) { return; } undefined4 __stdcall load_or_remake_save(void) { bool bVar1; short sVar2; undefined3 extraout_var; undefined3 extraout_var_00; word wVar3; undefined4 uVar4; uVar4 = 0; save_file = (save_file_beginning *)alloc_tracked_heap_block(0x8a0); sVar2 = open_ssgwin_dat(1,0); if (sVar2 == 0) { set_cursor(0xffff); open_ssgwin_dat(6,1); save_file->magic = L'\x1a525355'; save_file->ver = 0x11; save_file->num_players_maybe = 0; wVar3 = 0; do { memset((undefined4 *)(save_file->player_names + (short)wVar3),0,0x16); save_file->player_names[(short)wVar3].idx = wVar3; wVar3 = wVar3 + 1; } while ((short)wVar3 < 99); bVar1 = write_save_file_and_xxx((byte *)save_file,0x8a0); if ((short)CONCAT31(extraout_var,bVar1) == 0) { init_new_save_file_big(CONCAT31(extraout_var,bVar1)); close_ssgwin_dat(); DAT_00449914 = 0; DAT_00449916 = 1; wVar3 = 0; do { (save_file_big->player_entry).idx = wVar3; bVar1 = write_save_big_xxx(); if ((short)CONCAT31(extraout_var_00,bVar1) != 0) { uVar4 = 1; break; } wVar3 = wVar3 + 1; } while ((short)wVar3 < 99); DAT_00449916 = 0; DAT_00449914 = 1; } else { uVar4 = 1; } set_cursor(0); } else { readdatfile((char *)save_file,0x8a0,1); close_ssgwin_dat(); } return uVar4; } void __stdcall load_save_beginning(void) { open_ssgwin_dat(1,1); readdatfile((char *)save_file,0x8a0,1); close_ssgwin_dat(); return; } void __stdcall write_save_header(void) { open_ssgwin_dat(2,1); write_save_file_and_xxx((byte *)save_file,0x8a0); close_ssgwin_dat(); return; } void __stdcall file_select_load_background(void) { int *piVar1; load_rrgb_1(6000); piVar1 = load_aseq(6000); aseq_draw_to_both_fbs((int)piVar1,0,0,0); free_aseq(piVar1); piVar1 = load_aseq(6009); aseq_draw_to_both_fbs((int)piVar1,0x68,0x36,0); free_aseq(piVar1); return; } void __stdcall file_select_load_background_wrap(void) { file_select_load_background(); return; } bool __cdecl FUN_0043510b(short param_1) { word wVar1; word wVar2; short sVar3; short sVar4; word wVar5; int iVar6; char in_DL; save_file_player_entry *psVar7; save_file_player_entry *psVar8; bool bVar9; char local_5; wVar1 = save_file->num_players_maybe; if ((0 < (short)wVar1) && (save_file->player_names[selected_file_idx].score < 0)) { if ((0 < DAT_004516f6) && (save_file->player_names[selected_file_idx].score == -2)) { (&DAT_00451704)[DAT_004516f6] = 0x1f; DAT_004516f6 = DAT_004516f6 + 1; param_1 = 0x1f; } wVar2 = save_file->player_names[selected_file_idx].idx; save_file->num_players_maybe = save_file->num_players_maybe - 1; for (sVar3 = selected_file_idx; sVar3 < (short)save_file->num_players_maybe; sVar3 = sVar3 + 1) { psVar7 = save_file->player_names + sVar3 + 1; psVar8 = save_file->player_names + sVar3; for (iVar6 = 5; iVar6 != 0; iVar6 = iVar6 + -1) { *(undefined4 *)psVar8->name = *(undefined4 *)psVar7->name; psVar7 = (save_file_player_entry *)(psVar7->name + 4); psVar8 = (save_file_player_entry *)(psVar8->name + 4); } *(undefined2 *)psVar8->name = *(undefined2 *)psVar7->name; } save_file->player_names[(short)save_file->num_players_maybe].idx = wVar2; if ((short)save_file->num_players_maybe <= selected_file_idx) { selected_file_idx = save_file->num_players_maybe - 1; } } if (DAT_004516f6 < 1) { bVar9 = save_file->num_players_maybe != wVar1; } else { for (sVar3 = 0; sVar3 < (short)save_file->num_players_maybe; sVar3 = sVar3 + 1) { for (sVar4 = 0; sVar4 < DAT_004516f6; sVar4 = sVar4 + 1) { local_5 = (&DAT_00451704)[sVar4]; in_DL = save_file->player_names[sVar3].name[sVar4]; if ((in_DL == '\0') && (save_file->player_names[sVar3].score < 0)) { in_DL = (&DAT_00451704)[sVar4]; save_file->player_names[sVar3].name[sVar4] = in_DL; save_file->player_names[sVar3].name[sVar4 + 1] = '\0'; } if (in_DL != local_5) break; } if ((in_DL == '\0') && (local_5 == '\x1f')) break; if (in_DL == local_5) { selected_file_idx = sVar3; return save_file->num_players_maybe != wVar1; } if (local_5 < in_DL) break; } if ((sVar3 < (short)save_file->num_players_maybe) && (save_file->player_names[sVar3].score < 0)) { bVar9 = false; } else if ((short)save_file->num_players_maybe < 99) { wVar2 = save_file->player_names[(short)save_file->num_players_maybe].idx; for (wVar5 = save_file->num_players_maybe; sVar3 < (short)wVar5; wVar5 = wVar5 - 1) { psVar7 = save_file->player_names + (short)wVar5 + -1; psVar8 = save_file->player_names + (short)wVar5; for (iVar6 = 5; iVar6 != 0; iVar6 = iVar6 + -1) { *(undefined4 *)psVar8->name = *(undefined4 *)psVar7->name; psVar7 = (save_file_player_entry *)(psVar7->name + 4); psVar8 = (save_file_player_entry *)(psVar8->name + 4); } *(undefined2 *)psVar8->name = *(undefined2 *)psVar7->name; } save_file->player_names[sVar3].idx = wVar2; save_file->player_names[sVar3].score = -1; if (param_1 == 0x1f) { save_file->player_names[sVar3].score = -2; } (&DAT_00451704)[DAT_004516f6] = 0; while ((0 < DAT_004516f6 && (*(char *)((int)&DAT_00451702 + DAT_004516f6 + 1) < ' '))) { DAT_004516f6 = DAT_004516f6 + -1; (&DAT_00451704)[DAT_004516f6] = 0; } strcpy(save_file->player_names[sVar3].name,&DAT_00451704); save_file->num_players_maybe = save_file->num_players_maybe + 1; bVar9 = save_file->num_players_maybe != wVar1; selected_file_idx = sVar3; } else { FUN_00434f3a(); show_dialog_wait_continue_with_ids(0x3fa,0xffff); FUN_00434f3b(); DAT_004516f6 = DAT_004516f6 + -1; bVar9 = false; } } return bVar9; } void __stdcall FUN_00435488(int param_1) { short sVar1; short in_stack_00000008; short in_stack_0000000c; byte abStack_38 [52]; if (-1 < param_1) { int_to_dec_with_commas(param_1,(char *)abStack_38); sVar1 = nfnt_get_text_width(-1,abStack_38); FUN_00401206((in_stack_00000008 + 0xa8) - sVar1,in_stack_0000000c + 1,abStack_38); sVar1 = get_rank_for_score(param_1); FUN_00401206(in_stack_00000008 + 0xb2,in_stack_0000000c + 1,(&rankings_array)[sVar1]); } return; } void __stdcall FUN_0043548e(void) { undefined4 uVar1; int iVar2; uint uVar3; short sVar4; short sVar5; int unaff_EBP; uVar1 = *(undefined4 *)(unaff_EBP + 0x10); iVar2 = *(int *)(unaff_EBP + 0xc); uVar3 = *(uint *)(unaff_EBP + 8); if (-1 < (int)uVar3) { int_to_dec_with_commas(uVar3,(char *)(unaff_EBP + -0x34)); sVar5 = nfnt_get_text_width(-1,(byte *)(unaff_EBP + -0x34)); sVar4 = (short)uVar1; FUN_00401206((short)(iVar2 + 0xa8) - sVar5,sVar4 + 1,(byte *)(unaff_EBP + -0x34)); sVar5 = get_rank_for_score(uVar3); FUN_00401206((short)iVar2 + 0xb2,sVar4 + 1,(&rankings_array)[sVar5]); } return; } void __cdecl FUN_004354fc(short param_1,short param_2,short param_3) { short sVar1; word wVar2; short sVar3; short sVar4; short sVar5; char *pcVar6; char acStack_3d [51]; word local_a; short local_8; short local_6; local_8 = DAT_0044b210; local_a = save_file->num_players_maybe; if (8 < (short)local_a) { local_a = 8; } if ((-1 < param_3) && (local_a != 0)) { if (selected_file_idx < DAT_0044b210) { local_8 = selected_file_idx; FUN_00434a80((short *)&DAT_0044b200,selected_file_idx); param_3 = -1; } if (local_8 + 7 <= (int)selected_file_idx) { local_8 = selected_file_idx + -7; FUN_00434a80((short *)&DAT_0044b200,local_8); param_3 = -1; } } sVar4 = 0x43; local_6 = 0; sVar5 = 0x43; if (0 < (short)local_a) { do { sVar3 = local_6 + local_8; sVar4 = sVar5 + 0x15; if (((param_3 < 0) || (sVar3 == param_2)) || (sVar3 == param_3)) { if (sVar3 == selected_file_idx) { gfxish_fill_rect_wrap(99,sVar5 + 0x13,0x120,0x15,0); if (DAT_004516f6 < 1) { FUN_0043e1b5(0xefe); FUN_00401206(0x65,sVar5 + 0x16,(byte *)(save_file->player_names + sVar3)); FUN_00435488(save_file->player_names[sVar3].score); } else { strcpy(acStack_3d + 1,save_file->player_names[sVar3].name); acStack_3d[DAT_004516f6 + 1] = '\0'; if (acStack_3d[DAT_004516f6] == '\x1f') { acStack_3d[DAT_004516f6] = '\0'; } FUN_0043e1b5(0xbfb); FUN_00401206(0x65,sVar5 + 0x16,(byte *)(acStack_3d + 1)); FUN_0043e1b5(0xefe); pcVar6 = save_file->player_names[sVar3].name + DAT_004516f6; sVar5 = sVar5 + 0x16; sVar1 = nfnt_get_text_width(-1,(byte *)(acStack_3d + 1)); FUN_00401206(sVar1 + 0x65,sVar5,(byte *)pcVar6); FUN_00435488(save_file->player_names[sVar3].score); } } else { gfxish_copy_otherbuf_to_dest_and_invalidate(99,sVar5 + 0x13,0x120,0x15); FUN_0043e1b5(0xfff); FUN_00401206(0x65,sVar5 + 0x16,(byte *)(save_file->player_names + sVar3)); FUN_00435488(save_file->player_names[sVar3].score); } if (param_1 != 0) { gfxish_do_a_paint(); } } local_6 = local_6 + 1; sVar5 = sVar4; } while (local_6 < (short)local_a); } if (((param_3 == -1) || ((short)local_a < param_3)) && ((short)local_a < 8)) { gfxish_copy_otherbuf_to_dest_and_invalidate(99,sVar4 + 0x15,0x120,0x15); if (param_1 != 0) { gfxish_do_a_paint(); } } wVar2 = 0; if (((-1 < selected_file_idx) && (selected_file_idx < (short)save_file->num_players_maybe)) && ((save_file->player_names[selected_file_idx].score != -2 || (0 < DAT_004516f6)))) { wVar2 = 1; } if (wVar2 != file_select_0x12_struct_ARRAY_0044b1ca[0].enabled_maybe) { file_select_0x12_struct_ARRAY_0044b1ca[0].enabled_maybe = wVar2; FUN_00434e8d(0); } wVar2 = 1; if (((-1 < selected_file_idx) && (selected_file_idx < (short)save_file->num_players_maybe)) && (save_file->player_names[selected_file_idx].score < 0)) { wVar2 = 0; } if (wVar2 != file_select_0x12_struct_ARRAY_0044b1ca[1].enabled_maybe) { file_select_0x12_struct_ARRAY_0044b1ca[1].enabled_maybe = wVar2; FUN_00434e8d(1); } wVar2 = 0; if (local_a != 0) { wVar2 = (word)(file_select_0x12_struct_ARRAY_0044b1ca[1].enabled_maybe == 0); } if (wVar2 != file_select_0x12_struct_ARRAY_0044b1ca[2].enabled_maybe) { file_select_0x12_struct_ARRAY_0044b1ca[2].enabled_maybe = wVar2; FUN_00434e8d(2); } return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address undefined4 __cdecl FUN_004358b5(ushort param_1) { bool bVar1; bool bVar2; short sVar3; word wVar4; short sVar5; undefined4 uVar6; undefined3 extraout_var; undefined3 extraout_var_00; undefined3 extraout_var_01; int iVar7; short sVar8; char local_a; char local_9; sVar3 = selected_file_idx; bVar2 = false; bVar1 = false; if (param_1 == 0x26) { bVar2 = true; DAT_00451702 = 0; } else if (param_1 == 0x28) { bVar1 = true; DAT_00451702 = 0; } if (param_1 == 0x12) { if (((-1 < selected_file_idx) && (selected_file_idx < (short)save_file->num_players_maybe)) && (-1 < save_file->player_names[selected_file_idx].score)) { FUN_00434f3a(); sVar3 = ask_remove_player(); if (sVar3 == 1) { save_file->player_names[selected_file_idx].score = -1; DAT_004516f6 = 0; FUN_0043510b(8); FUN_00434ab5((short *)&DAT_0044b200,save_file->num_players_maybe - 8); FUN_004354fc(1,selected_file_idx,-1); write_save_header(); } FUN_00434f3b(); } uVar6 = 0; } else if ((param_1 & 0xfff) == 0x702) { DAT_004516f6 = 0; FUN_0043510b(8); FUN_00434ab5((short *)&DAT_0044b200,save_file->num_players_maybe - 8); FUN_004354fc(1,selected_file_idx,-1); uVar6 = 0; } else if ((param_1 & 0xfff) == 0x703) { if ((short)save_file->num_players_maybe < 99) { (&DAT_00451704)[DAT_004516f6] = 0x1f; DAT_004516f6 = DAT_004516f6 + 1; bVar2 = FUN_0043510b(0x1f); if ((short)CONCAT31(extraout_var,bVar2) != 0) { sVar3 = -1; FUN_00434ab5((short *)&DAT_0044b200,save_file->num_players_maybe - 8); if (selected_file_idx < DAT_0044b210) { FUN_00434a80((short *)&DAT_0044b200,selected_file_idx); } else if (DAT_0044b210 + 7 <= (int)selected_file_idx) { FUN_00434a80((short *)&DAT_0044b200,selected_file_idx + -6); } } FUN_004354fc(1,selected_file_idx,sVar3); uVar6 = 0; } else { FUN_00434f3a(); show_dialog_wait_continue_with_ids(0x3fa,0xffff); FUN_00434f3b(); uVar6 = 0; } } else { wVar4 = save_file->num_players_maybe; if (8 < (short)wVar4) { wVar4 = 8; } if ((param_1 & 0xfff) == 0x700) { if ((((DAT_004516e8 < 0x5f) || (0x182 < DAT_004516e8)) || (DAT_004516ea < 0x58)) || ((short)wVar4 * 0x15 + 0x58 <= (int)DAT_004516ea)) { DAT_004516f4 = 0; _DAT_004516f8 = 0; _DAT_004516fc = 0; } else { if (save_file->player_names[selected_file_idx].score < 0) { return 0; } sVar5 = (short)((DAT_004516ea + -0x58) / 0x15) + DAT_0044b210; if (DAT_004516ea < 0x58) { sVar5 = DAT_0044b210 + -1; } if ((sVar5 < 0) || ((short)save_file->num_players_maybe <= sVar5)) { DAT_004516f4 = 0; _DAT_004516f8 = 0; _DAT_004516fc = 0; return 0; } selected_file_idx = sVar5; _DAT_004516fc = get_time_ms(); if (sVar3 != selected_file_idx) { _DAT_004516f8 = get_time_ms(); _DAT_004516fc = 0; DAT_004516f6 = 0; FUN_004354fc(1,selected_file_idx,sVar3); DAT_004516f4 = 1; return 0; } param_1 = 0x704; } } else { DAT_004516f4 = 0; } sVar3 = selected_file_idx; if (bVar2) { if ((DAT_00451702 != 2) || (4 < DAT_00451700)) { DAT_00451700 = 0; DAT_00451702 = 2; if ((0 < selected_file_idx) && ((selected_file_idx < (short)save_file->num_players_maybe && (-1 < save_file->player_names[selected_file_idx].score)))) { DAT_004516f6 = 0; selected_file_idx = selected_file_idx + -1; FUN_004354fc(1,selected_file_idx,sVar3); } return 0; } } else if (DAT_00451702 == 2) { DAT_00451702 = 0; } if (bVar1) { if ((DAT_00451702 != 3) || (4 < DAT_00451700)) { DAT_00451700 = 0; DAT_00451702 = 3; if ((-1 < selected_file_idx) && (((int)selected_file_idx < (short)save_file->num_players_maybe + -1 && (-1 < save_file->player_names[selected_file_idx].score)))) { DAT_004516f6 = 0; selected_file_idx = selected_file_idx + 1; FUN_004354fc(1,selected_file_idx,sVar3); } return 0; } } else if (DAT_00451702 == 3) { DAT_00451702 = 0; } if (param_1 == 8) { if (DAT_004516f6 != 0) { DAT_004516f6 = DAT_004516f6 + -1; } bVar2 = FUN_0043510b(8); sVar5 = DAT_0044b210; if ((short)CONCAT31(extraout_var_00,bVar2) != 0) { sVar3 = -1; } if (selected_file_idx < DAT_0044b210) { sVar3 = -1; FUN_00434a80((short *)&DAT_0044b200,selected_file_idx); } if (sVar5 + 6 <= (int)selected_file_idx) { sVar3 = -1; FUN_00434a80((short *)&DAT_0044b200,selected_file_idx + -6); } FUN_00434ab5((short *)&DAT_0044b200,save_file->num_players_maybe - 8); if (sVar3 != selected_file_idx) { sVar3 = -1; } FUN_004354fc(1,selected_file_idx,sVar3); uVar6 = 0; } else if (((short)param_1 < 0x20) || (0x7f < (short)param_1)) { if ((selected_file_idx < 0) || ((short)save_file->num_players_maybe <= selected_file_idx)) { uVar6 = 0; } else { if ((param_1 & 0xfff) == 0x704) { param_1 = 0xd; } if (param_1 == 0xd) { iVar7 = selected_file_idx * 0xb; if (save_file->player_names[selected_file_idx].score < 0) { iVar7 = (int)DAT_004516f6; if (*(char *)((int)&DAT_00451702 + iVar7 + 1) == ' ') { while (sVar3 = DAT_0044b210, *(char *)((int)&DAT_00451702 + DAT_004516f6 + 1) == ' ') { DAT_004516f6 = DAT_004516f6 + -1; FUN_0043510b(8); } if (selected_file_idx < DAT_0044b210) { FUN_00434a80((short *)&DAT_0044b200,selected_file_idx); } if (sVar3 + 6 <= (int)selected_file_idx) { FUN_00434a80((short *)&DAT_0044b200,selected_file_idx + -6); } FUN_00434ab5((short *)&DAT_0044b200,save_file->num_players_maybe - 8); iVar7 = FUN_004354fc(1,selected_file_idx,-1); } if ((-1 < selected_file_idx) && (iVar7 = (int)selected_file_idx, iVar7 < (short)save_file->num_players_maybe + -1)) { for (iVar7 = 0; sVar3 = (short)iVar7, sVar3 <= DAT_004516f6; iVar7 = iVar7 + 1) { local_9 = (&DAT_00451704)[sVar3]; local_a = save_file->player_names[selected_file_idx + 1].name[sVar3]; if (local_9 != local_a) break; } iVar7 = CONCAT31((int3)((uint)iVar7 >> 8),local_9); if (local_9 == local_a) { FUN_00434f3a(); show_dialog_wait_continue_with_ids(0x3f9,0xffff); FUN_00434f3b(); return 0; } } } uVar6 = CONCAT22((short)((uint)iVar7 >> 0x10),0xd); } else { uVar6 = 0; } } } else if (DAT_004516f6 < 0xf) { if ((DAT_004516f6 == 0) || (DAT_00451704 == '\x1f')) { if ((0x60 < (short)param_1) && ((short)param_1 < 0x7b)) { param_1 = param_1 - 0x20; } if (((short)param_1 < 0x41) || (0x5a < (short)param_1)) { return 0; } } if ((0 < DAT_004516f6) && (*(char *)((int)&DAT_00451702 + DAT_004516f6 + 1) == '\x1f')) { DAT_004516f6 = DAT_004516f6 + -1; } (&DAT_00451704)[DAT_004516f6] = (char)param_1; DAT_004516f6 = DAT_004516f6 + 1; sVar5 = nfnt_get_text_width(-1,(byte *)&DAT_00451704); sVar3 = selected_file_idx; if (sVar5 < 0x57) { bVar2 = FUN_0043510b(param_1); if ((short)CONCAT31(extraout_var_01,bVar2) != 0) { sVar3 = -1; FUN_00434ab5((short *)&DAT_0044b200,save_file->num_players_maybe - 8); } sVar5 = selected_file_idx; sVar8 = DAT_0044b210; if (selected_file_idx < DAT_0044b210) { sVar3 = -1; FUN_00434a80((short *)&DAT_0044b200,selected_file_idx); sVar8 = sVar5; } if (sVar8 + 6 <= (int)selected_file_idx) { FUN_00434a80((short *)&DAT_0044b200,selected_file_idx + -6); } if (sVar3 != selected_file_idx) { sVar3 = -1; } FUN_004354fc(0,selected_file_idx,sVar3); uVar6 = 0; } else { DAT_004516f6 = DAT_004516f6 + -1; (&DAT_00451704)[DAT_004516f6] = 0; uVar6 = 0; } } else { uVar6 = 0; } } return uVar6; } void __stdcall file_select_load_buttons(void) { aseq_anim_state_struct *paVar1; int iVar2; mouse_region *pmVar3; short sVar4; sVar4 = 0; do { paVar1 = (aseq_anim_state_struct *) load_aseq(file_select_0x12_struct_ARRAY_0044b1ca[sVar4].aseq_idx); file_select_0x12_struct_ARRAY_0044b1ca[sVar4].anim_state = paVar1; aseq_set_pos_order((int)file_select_0x12_struct_ARRAY_0044b1ca[sVar4].anim_state, file_select_0x12_struct_ARRAY_0044b1ca[sVar4].x, file_select_0x12_struct_ARRAY_0044b1ca[sVar4].y,5); if (file_select_0x12_struct_ARRAY_0044b1ca[sVar4].enabled_maybe == 0) { aseq_select_anim((int)file_select_0x12_struct_ARRAY_0044b1ca[sVar4].anim_state,1); } iVar2 = (int)sVar4; pmVar3 = (mouse_region *) mouse_region_new_for_anim_wrapped ((int)file_select_0x12_struct_ARRAY_0044b1ca[sVar4].anim_state,1,0,0x434e3a); file_select_0x12_struct_ARRAY_0044b1ca[sVar4].mouse_region = pmVar3; mouse_region_set_extra_data((int)pmVar3,iVar2); aseq_anim_reset_and_play((undefined4 *)file_select_0x12_struct_ARRAY_0044b1ca[sVar4].anim_state) ; sVar4 = sVar4 + 1; } while (sVar4 < 3); return; } void __stdcall FUN_00436185(void) { aseq_anim_state_struct *paVar1; short sVar2; sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *) free_aseq((int *)file_select_0x12_struct_ARRAY_0044b1ca[sVar2].anim_state); file_select_0x12_struct_ARRAY_0044b1ca[sVar2].anim_state = paVar1; mouse_region_delete_from_2((int *)file_select_0x12_struct_ARRAY_0044b1ca[sVar2].mouse_region); sVar2 = sVar2 + 1; } while (sVar2 < 3); free_tracked_heap_block((int)save_file); return; } void __stdcall FUN_004361d2(void) { FUN_004354fc(1,selected_file_idx,-1); return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __stdcall file_select_onload(void) { short sVar1; undefined4 uVar2; int *piVar3; DAT_00449914 = 1; DAT_00449c4c = 0; DAT_00449c4a = 0; uVar2 = load_or_remake_save(); if ((short)uVar2 == 0) { file_select_0x12_struct_ARRAY_0044b1ca[2].enabled_maybe = (word)(save_file->num_players_maybe == 0); file_select_0x12_struct_ARRAY_0044b1ca[0].enabled_maybe = (word)(0 < (short)save_file->num_players_maybe); file_select_0x12_struct_ARRAY_0044b1ca[1].enabled_maybe = file_select_0x12_struct_ARRAY_0044b1ca[0].enabled_maybe; file_select_load_buttons(); file_select_load_background_wrap(); file_select_load_scroll_widget_aseq(); DAT_004516f4 = 0; selected_file_idx = 0; DAT_004516f6 = 0xffff; sVar1 = save_file->num_players_maybe - 8; if (sVar1 < 0) { sVar1 = 0; } _DAT_0044b214 = (int)sVar1; _DAT_0044b21c = get_time_ms(); _DAT_0044b210 = 0; FUN_004354fc(0,-1,-1); FUN_0043499b((short *)&DAT_0044b200); piVar3 = mouse_region_new_up(99,0x58,0x120,0xa8,4,0x434ec0); mouse_region_set_extra_data((int)piVar3,0x700); mouse_region_new_down(0x186,0x32,0x12,0xd1,4,0x434e2a); key_xxxxx_set(FUN_00434e19); DAT_00451716 = 0; FUN_0043d7c1(FUN_004361d2); FUN_00422170(); setup_default_enable_menus(); } return; } void __stdcall file_select_onremove(void) { FUN_0043d7c1(0); FUN_00434d1a(); set_bgm_enabled((ushort)(save_file_big->sounds_music_disabled == 0)); set_sfx_enabled((ushort)(save_file_big->sounds_music_disabled == 0)); set_voices_enabled((ushort)(save_file_big->voices_disabled == 0)); key_xxxxx_clear(); FUN_00436185(); mouse_region_delete_all_lists(); FUN_0042211c(); DAT_00449914 = 0; return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __stdcall file_select_on_periodic(void) { short sVar1; ushort uVar2; undefined2 extraout_var; int iVar4; undefined4 uVar5; uint uVar3; if ((DAT_004516f6 == -1) && (DAT_004516f6 = 0, save_file->num_players_maybe == 0)) { FUN_004358b5(0x703); } if (DAT_0044b1c8 != -1) { sVar1 = aseq_anim_get_flags((int)file_select_0x12_struct_ARRAY_0044b1ca[DAT_0044b1c8].anim_state ); if (sVar1 != 0x10) { return; } DAT_0044b1c8 = -1; } _DAT_004516fc = 0; uVar2 = FUN_00434db0(); uVar3 = CONCAT22(extraout_var,uVar2); iVar4 = (int)(short)uVar2; if (iVar4 < 0x4707) { if (iVar4 == 0x4706) goto LAB_004365a0; if (iVar4 < 0x704) { if (iVar4 == 0x703) { if (file_select_0x12_struct_ARRAY_0044b1ca[1].enabled_maybe != 0) { FUN_004358b5(uVar2); } goto LAB_004365a0; } if (iVar4 == 0xd) goto LAB_00436521; if (iVar4 == 0x1b) { FUN_00434f3a(); DAT_00449914 = 1; exit_game_handler(); DAT_00449914 = 0; FUN_00434f3b(); goto LAB_004365a0; } if (iVar4 == 0x702) { if (file_select_0x12_struct_ARRAY_0044b1ca[2].enabled_maybe != 0) { FUN_004358b5(uVar2); } goto LAB_004365a0; } } else { if (iVar4 == 0x704) { LAB_00436521: if ((file_select_0x12_struct_ARRAY_0044b1ca[0].enabled_maybe != 0) && (uVar5 = FUN_004358b5(uVar2), (short)uVar5 == 0xd)) { DAT_00451716 = 1; } goto LAB_004365a0; } if (iVar4 == 0x705) goto LAB_004365a0; } } else if (iVar4 < 0x8707) { if ((iVar4 == 0x8706) || ((iVar4 == 0x4707 || (iVar4 == 0x4708)))) goto LAB_004365a0; } else if ((iVar4 == 0x8707) || (iVar4 == 0x8708)) goto LAB_004365a0; if ((uVar2 & 0xfff) == 0x701) { FUN_00434aea((short *)&DAT_0044b200,uVar3); FUN_004354fc(1,-1,-1); } else { if (uVar2 == 8) { uVar3 = CONCAT22(extraout_var,8); } uVar5 = FUN_004358b5((ushort)uVar3); if ((short)uVar5 == 0xd) { DAT_00451716 = 1; } } LAB_004365a0: if (DAT_00451716 != 0) { if (save_file->player_names[selected_file_idx].score < 0) { init_new_save_file_big(selected_file_idx * 0xb); sVar1 = ask_about_chimps(); save_file_big->chimps_enabled = (ushort)(sVar1 != 0); save_file->player_names[selected_file_idx].score = 0; memcpy((undefined4 *)save_file_big,(undefined4 *)(save_file->player_names + selected_file_idx) ,0x16); DAT_00449914 = 0; write_save_big_xxx(); write_save_header(); DAT_00449914 = 1; } else { load_save_5999_xxx(save_file->player_names[selected_file_idx].idx); } xxxfunc_set(&save_loaded_parking_lot_funcs); } return; } undefined2 __stdcall ask_about_chimps(void) { undefined2 uVar1; undefined2 *puVar2; undefined4 uVar3; puVar2 = (undefined2 *)new_yesno_dialog(); uVar3 = load_resource_item_0(1009,(int *)PTR_text_0044ae14); *(undefined4 *)(puVar2 + 0x11) = uVar3; puVar2[7] = 1006; puVar2[8] = 0x3ef; uVar1 = show_dialog(puVar2); free_resource_item_with_data(*(int *)(puVar2 + 0x11)); free_tracked_heap_block((int)puVar2); return uVar1; } undefined2 __stdcall ask_remove_player(void) { undefined2 uVar1; undefined2 *puVar2; undefined4 uVar3; puVar2 = (undefined2 *)new_yesno_dialog(); uVar3 = load_resource_item_0(1019,(int *)PTR_text_0044ae14); *(undefined4 *)(puVar2 + 0xd) = uVar3; uVar3 = load_resource_item_0(1020,(int *)PTR_text_0044ae14); *(undefined4 *)(puVar2 + 0x11) = uVar3; *(char **)(puVar2 + 0xf) = s_to_go_Back_0044b230; uVar1 = show_dialog(puVar2); free_resource_item_with_data(*(int *)(puVar2 + 0xd)); free_resource_item_with_data(*(int *)(puVar2 + 0x11)); free_tracked_heap_block((int)puVar2); return uVar1; } void __cdecl wavemix_error(undefined4 param_1) { switch(param_1) { case 0: break; default: problem_with_wavemix(); } return; } void __cdecl wave_out_error(MMRESULT param_1) { CHAR local_104 [256]; if (param_1 != 0) { waveOutGetErrorTextA(param_1,local_104,0x100); alert_message(s_SM__Wave_____s_0044b3a9); } return; } undefined2 __cdecl _return_arg0(undefined2 param_1) { return param_1; } LRESULT __stdcall SoundWndProc(HWND param_1,UINT param_2,uint param_3,LPARAM param_4) { MCIERROR MVar1; LRESULT LVar2; sound_struct *psVar3; HWND local_18; undefined4 local_14; undefined4 local_10; undefined1 local_c [8]; // 0x367cc 3 SoundWndProc if (param_2 == MM_MCINOTIFY) { if (((param_3 == 1) && (currently_playing_midi != (sound_struct *)0x0)) && (currently_playing_midi->mci_dev_id == (word)param_4)) { if (currently_playing_midi->loop == 0) { midi_stop(currently_playing_midi->wave_idx); } else { MVar1 = mciSendCommandA((uint)currently_playing_midi->mci_dev_id,MCI_SEEK,0x102, (DWORD_PTR)local_c); _return_arg0((short)MVar1); local_18 = sound_window; local_10 = 0; local_14 = 0; MVar1 = mciSendCommandA((uint)currently_playing_midi->mci_dev_id,MCI_PLAY,1, (DWORD_PTR)&local_18); _return_arg0((short)MVar1); } } LVar2 = 0; } else if (param_2 == 0x3bd) { psVar3 = playing_sounds[1].sound_struct; if (((sound_type == 1) && (psVar3 = (sound_struct *)0x0, param_3 != 0)) && (param_3 < 5)) { psVar3 = playing_sounds[param_3].sound_struct; } if (psVar3 != (sound_struct *)0x0) { if (sound_type == 0) { stop_wave_now((int)psVar3); } playing_sounds[psVar3->playing_slot_idx].state = -1; playing_sounds[psVar3->playing_slot_idx].sound_struct = (sound_struct *)0x0; psVar3->is_playing = 0; } LVar2 = 0; } else { LVar2 = DefWindowProcA(param_1,param_2,param_3,param_4); } return LVar2; } short __cdecl find_play_slot(short param_1) { bool bVar1; short sVar2; short unaff_SI; short sVar3; bVar1 = false; sVar3 = -1; if (num_sound_pauses == 0) { for (sVar2 = 1; (!bVar1 && (sVar2 < max_waves)); sVar2 = sVar2 + 1) { if (playing_sounds[sVar2].state == -1) { bVar1 = true; unaff_SI = sVar2; } else if ((short)playing_sounds[sVar2].priority < param_1) { param_1 = playing_sounds[sVar2].priority; sVar3 = sVar2; } } if (!bVar1) { if (sVar3 == -1) { unaff_SI = -1; } else { stop_playing_wave((int)playing_sounds[sVar3].sound_struct,1); unaff_SI = sVar3; } } if (unaff_SI != -1) { playing_sounds[unaff_SI].field4_0xc = 0; } } else { unaff_SI = -1; } return unaff_SI; } void __cdecl wave_find_data(int param_1) { int iVar1; byte *pbVar2; bool bVar3; pbVar2 = (byte *)(*(int *)(param_1 + 8) + 0xc); bVar3 = false; while (!bVar3) { iVar1 = memcmp(pbVar2,fmt_chunk_hdr,8); bVar3 = iVar1 == 0; if (!bVar3) { pbVar2 = pbVar2 + 1; } } *(byte **)(param_1 + 0x20) = pbVar2 + 8; *(undefined4 *)(param_1 + 0x24) = *(undefined4 *)(pbVar2 + 0x1c); *(byte **)(param_1 + 0x28) = pbVar2 + 0x20; return; } void __cdecl find_wave(short param_1,ushort param_2) { int iVar1; for (iVar1 = deref_prev_if_not_null(waves_list); (iVar1 != 0 && ((param_1 != *(short *)(iVar1 + 0xc) || ((*(ushort *)(iVar1 + 0xe) & param_2) == 0)))); iVar1 = deref_prev(iVar1)) { } return; } void __stdcall FUN_00436a36(void) { undefined4 uVar1; if (sound_type == 1) { uVar1 = (*(code *)WaveMixActivate)(); wavemix_error(uVar1); } return; } void __stdcall FUN_00436a5a(void) { undefined4 uVar1; if (sound_type == 1) { uVar1 = (*(code *)WaveMixActivate)(); wavemix_error(uVar1); } return; } bool __stdcall load_wavemix(void) { bool bVar1; UINT uMode; uMode = SetErrorMode(0x8000); wavemix = LoadLibraryA(s_WAVEMIX_DLL_0044b3c1); SetErrorMode(uMode); bVar1 = 0x1f < (int)wavemix; if (bVar1) { WaveMixConfigureInit = GetProcAddress(wavemix,s_WaveMixConfigureInit_0044b3cd); WaveMixActivate = GetProcAddress(wavemix,s_WaveMixActivate_0044b3e2); WaveMixOpenWave = GetProcAddress(wavemix,s_WaveMixOpenWave_0044b3f2); WaveMixFlushChannel = GetProcAddress(wavemix,s_WaveMixFlushChannel_0044b402); WaveMixOpenChannel = GetProcAddress(wavemix,s_WaveMixOpenChannel_0044b416); WaveMixCloseChannel = GetProcAddress(wavemix,s_WaveMixCloseChannel_0044b429); WaveMixFreeWave = GetProcAddress(wavemix,s_WaveMixFreeWave_0044b43d); WaveMixCloseSession = GetProcAddress(wavemix,s_WaveMixCloseSession_0044b44d); WaveMixPlay = GetProcAddress(wavemix,s_WaveMixPlay_0044b461); WaveMixPump = GetProcAddress(wavemix,s_WaveMixPump_0044b46d); } return bVar1; } void __stdcall FUN_00436b67(void) { if (wavemix != (HMODULE)0x0) { FreeLibrary(wavemix); wavemix = (HMODULE)0x0; } return; } undefined4 __stdcall load_dsound(void) { UINT uMode; uMode = SetErrorMode(0x8000); dsound = LoadLibraryA(s_DSOUND_DLL_0044b479); SetErrorMode(uMode); if (dsound != (HMODULE)0x0) { DirectSoundCreate = GetProcAddress(dsound,s_DirectSoundCreate_0044b484); } return 0; } ushort __stdcall create_sound_window(void) { short sVar1; undefined4 uVar2; int iVar3; bool bVar4; WNDCLASSA local_38; undefined2 local_10; undefined4 local_e; undefined2 local_a; undefined2 local_8; if (DAT_0045197e == 0) { DAT_00451986 = 2; bVar4 = (DAT_0045197c & 1) != 0; voices_enabled = (word)bVar4; sfx_enabled = (word)bVar4; bgm_enabled = (word)((DAT_0045197c & 2) != 0); local_38.style = 0; local_38.lpfnWndProc = SoundWndProc; local_38.cbClsExtra = 0; local_38.cbWndExtra = 0; local_38.hInstance = instance; local_38.hIcon = (HICON)0x0; local_38.hCursor = (HCURSOR)0x0; local_38.hbrBackground = (HBRUSH)0x0; local_38.lpszMenuName = (LPCSTR)0x0; local_38.lpszClassName = PTR_s_SoundWindow_0044b2b4; RegisterClassA(&local_38); sound_window = CreateWindowExA(0,PTR_s_SoundWindow_0044b2b4,&DAT_0044b496,0x40000000,-0x80000000 ,-0x80000000,-0x80000000,-0x80000000,main_hwnd,(HMENU)0x0, instance,(LPVOID)0x0); if (sound_type == 0) { max_waves = 2; } else if (sound_type == 1) { local_10 = 10; local_e = 3; local_a = 1; local_8 = 0x16; wavemix_session = (*(code *)WaveMixConfigureInit)(); max_waves = 5; FUN_00436a36(); uVar2 = (*(code *)WaveMixOpenChannel)(); wavemix_error(uVar2); } else if (sound_type == 2) { max_waves = 5; iVar3 = (**(code **)(*(int *)dsound_obj + 0x18))(); if (iVar3 != 0) { alert_message(s_SetCooperativeLevel_failed_0044b497); } } waves_list = alloc_linked_list_marker(); currently_playing_midi = (sound_struct *)0x0; sVar1 = 0; do { playing_sounds[sVar1].state = -1; sVar1 = sVar1 + 1; } while (sVar1 < 5); DAT_0045197e = 1; } return DAT_0045197c; } void __stdcall FUN_00436d8b(void) { short sVar1; undefined4 *puVar2; undefined4 *puVar3; undefined4 *puVar4; undefined4 uVar5; undefined4 uVar6; MCIERROR MVar7; undefined4 extraout_EDX; undefined4 extraout_EDX_00; undefined4 extraout_EDX_01; undefined4 extraout_EDX_02; undefined4 extraout_EDX_03; undefined4 extraout_EDX_04; undefined1 local_8 [4]; if (DAT_0045197e != 0) { FUN_00437b5b(); puVar4 = waves_list; puVar3 = (undefined4 *)deref_next_if_not_null(waves_list); uVar5 = extraout_EDX; while (puVar2 = puVar3, puVar2 != (undefined4 *)0x0) { puVar4 = puVar2; puVar3 = (undefined4 *)deref_next(puVar2); sVar1 = *(short *)((int)puVar2 + 0xe); if (sVar1 == 1) { puVar4 = (undefined4 *)(uint)*(ushort *)(puVar2 + 3); free_wave_flag_1(*(ushort *)(puVar2 + 3)); uVar5 = extraout_EDX_01; } else if (sVar1 == 2) { puVar4 = (undefined4 *)(uint)*(ushort *)(puVar2 + 3); free_wave_flag_2(*(ushort *)(puVar2 + 3)); uVar5 = extraout_EDX_02; } else { uVar5 = extraout_EDX_00; if (sVar1 == 4) { puVar4 = (undefined4 *)(uint)*(ushort *)(puVar2 + 3); free_midi(*(ushort *)(puVar2 + 3)); uVar5 = extraout_EDX_03; } } } if (sound_type == 1) { uVar5 = (*(code *)WaveMixCloseChannel)(0,uVar5,puVar4,wavemix_session,0,1); uVar6 = wavemix_error(uVar5); (*(code *)WaveMixCloseSession)(uVar6,extraout_EDX_04,uVar5,wavemix_session); FUN_00436b67(); } else if ((sound_type == 2) && ((int *)dsound_obj != (int *)0x0)) { (**(code **)(*(int *)dsound_obj + 8))(); dsound_obj = (undefined *)0x0; } if (((byte)DAT_0045197c & 2) != 0) { MVar7 = mciSendCommandA(0xffffffff,MCI_CLOSE,2,(DWORD_PTR)local_8); _return_arg0((short)MVar7); } DestroyWindow(sound_window); UnregisterClassA(PTR_s_SoundWindow_0044b2b4,instance); free_tracked_heap_block_((int)waves_list); DAT_0045197e = 0; } return; } void __cdecl load_wave_xxx(ushort param_1,ushort param_2) { undefined2 uVar1; int iVar2; undefined4 *puVar3; undefined4 uVar4; HGLOBAL hMem; iVar2 = find_wave(param_1,param_2); if (iVar2 == 0) { puVar3 = (undefined4 *)alloc_tracked_heap_block(0x54); memset(puVar3,0,0x54); *(ushort *)((int)puVar3 + 0xe) = param_2; *(undefined2 *)(puVar3 + 4) = 1; uVar4 = load_resource_item_0(param_1,(int *)PTR_wave_0044ae1c); puVar3[2] = uVar4; if (puVar3[2] == 0) { free_tracked_heap_block((int)puVar3); } else { wave_find_data((int)puVar3); if (sound_type == 1) { get_handle_for_resource(param_1,(int *)PTR_wave_0044ae1c); memset(&MMIOINFO_004519f0.dwFlags,0,0x48); MMIOINFO_004519f0.pchBuffer = (HPSTR)puVar3[2]; hMem = (HGLOBAL)hglobal_for_resource_item_data(puVar3[2]); MMIOINFO_004519f0.cchBuffer = GlobalSize(hMem); MMIOINFO_004519f0.fccIOProc = L'\x204d454d'; *(undefined4 *)((int)puVar3 + 0x2e) = 0; (*(code *)WaveMixActivate)(); uVar4 = (*(code *)WaveMixOpenWave)(); *(undefined4 *)((int)puVar3 + 0x2e) = uVar4; (*(code *)WaveMixActivate)(); if (*(int *)((int)puVar3 + 0x2e) == 0) { alert_message(s_Error_with_WaveMixOpenWave_0044b4b2); } free_resource_item_with_idx_fourcc(param_1,PTR_wave_0044ae1c); } *(ushort *)(puVar3 + 3) = param_1; *(undefined2 *)((int)puVar3 + 0x16) = 0; *(undefined2 *)(puVar3 + 5) = 0; *(undefined2 *)((int)puVar3 + 0x1e) = 1; uVar1 = FUN_00426191(); *(undefined2 *)((int)puVar3 + 0x52) = uVar1; linked_list_insert(waves_list,puVar3,0xffff); } } else { *(short *)(iVar2 + 0x1e) = *(short *)(iVar2 + 0x1e) + 1; } return; } void __cdecl load_wave_flag_1(ushort param_1) { load_wave_xxx(param_1,1); return; } void __cdecl load_midi(short param_1) { undefined1 uVar1; undefined2 uVar2; undefined4 *puVar3; undefined4 uVar4; puVar3 = (undefined4 *)alloc_tracked_heap_block(0x54); *(undefined2 *)((int)puVar3 + 0xe) = 4; *(undefined2 *)(puVar3 + 4) = DAT_00451986; uVar4 = load_resource_item_0(param_1,(int *)PTR_text_0044ae14); puVar3[2] = uVar4; uVar1 = 'e'; if (midi_type == 0) { uVar1 = 0x62; } *(undefined1 *)puVar3[2] = uVar1; *(short *)(puVar3 + 3) = param_1; *(undefined2 *)((int)puVar3 + 0x16) = 0; *(undefined2 *)(puVar3 + 5) = 0; uVar2 = FUN_00426191(); *(undefined2 *)((int)puVar3 + 0x52) = uVar2; linked_list_insert(waves_list,puVar3,0xffff); return; } void __cdecl load_wave_flag_2(ushort param_1) { if (voices_enabled != 0) { load_wave_xxx(param_1,2); DAT_0044b24a = param_1; } return; } void __cdecl free_wave(short param_1,ushort param_2) { int *piVar1; undefined4 uVar2; undefined4 uVar3; undefined4 extraout_EDX; undefined4 uVar4; undefined4 uVar5; undefined4 uVar6; undefined4 uVar7; piVar1 = (int *)find_wave(param_1,param_2); if (piVar1 == (int *)0x0) { return; } if (*(short *)((int)piVar1 + 0x16) != 0) { stop_playing_wave((int)piVar1,1); } *(short *)((int)piVar1 + 0x1e) = *(short *)((int)piVar1 + 0x1e) + -1; if (*(short *)((int)piVar1 + 0x1e) != 0) { return; } if (sound_type != 0) { if (sound_type == 1) { uVar7 = 0; uVar6 = wavemix_session; (*(code *)WaveMixActivate)(); uVar5 = *(undefined4 *)((int)piVar1 + 0x2e); uVar4 = wavemix_session; uVar2 = (*(code *)WaveMixFreeWave)(); uVar3 = wavemix_error(uVar2); (*(code *)WaveMixActivate)(uVar3,extraout_EDX,uVar2,wavemix_session,1,uVar4,uVar5,uVar6,uVar7) ; goto LAB_0043714b; } if (sound_type != 2) goto LAB_0043714b; } free_resource_item_with_idx_fourcc(param_1,PTR_wave_0044ae1c); LAB_0043714b: linked_list_unlink(waves_list,piVar1); free_tracked_heap_block((int)piVar1); return; } void __cdecl free_wave_flag_1(short param_1) { free_wave(param_1,1); return; } void __cdecl free_midi(short param_1) { sound_struct *psVar1; psVar1 = (sound_struct *)find_wave(param_1,4); if (psVar1 != (sound_struct *)0x0) { midi_stop(psVar1->wave_idx); free_resource_item_with_idx_fourcc(param_1,PTR_text_0044ae14); linked_list_unlink(waves_list,(int *)psVar1); if (psVar1 == currently_playing_midi) { currently_playing_midi = (sound_struct *)0x0; } free_tracked_heap_block((int)psVar1); midi_current = 0xffff; } return; } void __stdcall FUN_004371de(void) { if (currently_playing_midi != (sound_struct *)0x0) { free_midi(currently_playing_midi->wave_idx); } return; } void __cdecl free_wave_flag_2(short param_1) { free_wave(param_1,2); DAT_0044b24a = 0xffff; return; } void __stdcall FUN_00437219(void) { if (DAT_0044b24a != -1) { free_wave_flag_2(DAT_0044b24a); } return; } void __cdecl play_wave(int param_1) { short sVar1; undefined4 uVar2; MMRESULT MVar3; int iVar4; undefined4 local_40; uint local_3c; undefined4 local_38; undefined4 local_30; undefined2 local_2c; undefined4 local_2a; int local_26; undefined4 local_22; HWND local_1e; undefined4 local_1a; undefined2 local_16; undefined4 local_c; undefined4 *local_8; if (sound_type == 0) { *(undefined4 *)(param_1 + 0x32) = *(undefined4 *)(param_1 + 0x28); *(undefined4 *)(param_1 + 0x36) = *(undefined4 *)(param_1 + 0x24); *(undefined4 *)(param_1 + 0x3e) = 0; if (*(short *)(param_1 + 0x18) == 0) { *(undefined4 *)(param_1 + 0x42) = 0; *(undefined4 *)(param_1 + 0x46) = 0; } else { *(undefined4 *)(param_1 + 0x42) = 0xc; *(undefined4 *)(param_1 + 0x46) = 0xffffffff; } MVar3 = waveOutOpen(&hwaveout,0xffffffff,*(LPCWAVEFORMATEX *)(param_1 + 0x20), (DWORD_PTR)sound_window,0,0x10000); wave_out_error(MVar3); MVar3 = waveOutPrepareHeader(hwaveout,(LPWAVEHDR)(param_1 + 0x32),0x20); wave_out_error(MVar3); MVar3 = waveOutWrite(hwaveout,(LPWAVEHDR)(param_1 + 0x32),0x20); wave_out_error(MVar3); } else if (sound_type == 1) { local_2c = 0x18; local_2a = wavemix_session; local_26 = (int)*(short *)(param_1 + 0x1c); local_22 = *(undefined4 *)(param_1 + 0x2e); local_1e = sound_window; local_1a = 5; local_16 = 0xffff; if (*(short *)(param_1 + 0x18) == 0) { local_16 = 0; } uVar2 = (*(code *)WaveMixPlay)(); wavemix_error(uVar2); } else if (sound_type == 2) { local_8 = (undefined4 *)0x0; local_c = 0; sVar1 = *(short *)(param_1 + 0x1c); memset(&local_40,0,0x14); local_40 = 0x14; local_3c = local_3c | 2; local_38 = *(undefined4 *)(param_1 + 0x24); local_30 = *(undefined4 *)(param_1 + 0x20); iVar4 = (**(code **)(*(int *)dsound_obj + 0xc))(); if (iVar4 == 0) { (**(code **)(*(int *)playing_sounds[sVar1].dsound_obj + 0x2c))(); memcpy(local_8,*(undefined4 **)(param_1 + 0x28),*(uint *)(param_1 + 0x24)); (**(code **)(*(int *)playing_sounds[sVar1].dsound_obj + 0x4c))(); iVar4 = (**(code **)(*(int *)playing_sounds[sVar1].dsound_obj + 0x30))(); if (iVar4 != 0) { alert_message(s_Play_failed_0044b4e6); } } else { alert_message(s_CreateSoundBuffer_failed_0044b4cd); } } return; } void __cdecl play_wave_flag1(short param_1,short param_2,ushort param_3) { short sVar1; sound_struct *psVar2; if (sfx_enabled != 0) { psVar2 = (sound_struct *)find_wave(param_1,1); if (psVar2 != (sound_struct *)0x0) { if ((psVar2->is_playing != 0) && ((param_3 & 2) != 0)) { stop_playing_wave_by_id_type1(param_1); } if (psVar2->is_playing == 0) { sVar1 = find_play_slot(param_2); if (sVar1 != -1) { psVar2->playing_slot_idx = sVar1; playing_sounds[sVar1].state = param_1; playing_sounds[sVar1].priority = param_2; psVar2->priority = param_2; playing_sounds[sVar1].sound_struct = psVar2; psVar2->loop = param_3; psVar2->is_playing = 1; psVar2->is_errored_flag = 0; play_wave((int)psVar2); } } } } return; } void __cdecl midi_play(int param_1) { short sVar1; MCIERROR MVar2; char local_45c [1080]; undefined1 local_24 [4]; undefined2 local_20; undefined4 local_1c; char *local_18; HWND local_10; undefined4 local_c; undefined4 local_8; strcpy(local_45c,midi_path); strcat(local_45c,*(char **)(param_1 + 8)); local_18 = local_45c; local_1c = MCI_DEVTYPE_SEQUENCER; MVar2 = mciSendCommandA(0,MCI_OPEN,0x202,(DWORD_PTR)local_24); sVar1 = _return_arg0((short)MVar2); if (sVar1 == 0) { *(undefined2 *)(param_1 + 0x2c) = local_20; local_10 = sound_window; local_8 = 0; local_c = 0; MVar2 = mciSendCommandA((uint)*(ushort *)(param_1 + 0x2c),MCI_PLAY,1,(DWORD_PTR)&local_10); _return_arg0((short)MVar2); } else { *(ushort *)(param_1 + 0x1a) = *(ushort *)(param_1 + 0x1a) | 0x2000; } return; } void __cdecl midi_stop_and_play(short param_1,word param_2) { sound_struct *psVar1; psVar1 = (sound_struct *)find_wave(param_1,4); if ((bgm_enabled != 0) && (psVar1 != (sound_struct *)0x0)) { midi_stop_current(); midi_current = param_1; psVar1->priority = 1; psVar1->loop = param_2; psVar1->is_errored_flag = 0; psVar1->playing_slot_idx = 0; midi_play((int)psVar1); if ((psVar1->is_errored_flag & 0x2000) == 0) { psVar1->is_playing = 1; playing_sounds[0].state = param_1; playing_sounds[0].priority = 1; currently_playing_midi = psVar1; playing_sounds[0].sound_struct = psVar1; } } return; } void __cdecl play_wave_flag2(short param_1) { short sVar1; sound_struct *psVar2; if (voices_enabled != 0) { stop_playing_all_waves(); psVar2 = (sound_struct *)find_wave(param_1,2); if (psVar2 != (sound_struct *)0x0) { sVar1 = find_play_slot(psVar2->priority); if (sVar1 != -1) { psVar2->playing_slot_idx = sVar1; playing_sounds[sVar1].state = param_1; playing_sounds[sVar1].priority = 1000; psVar2->priority = 1000; playing_sounds[sVar1].sound_struct = psVar2; psVar2->loop = 0; psVar2->is_playing = 1; psVar2->is_errored_flag = 0; play_wave((int)psVar2); } } } return; } void __stdcall nullsub(void) { return; } void __cdecl FUN_0043767e(ushort param_1) { int iVar1; if (voices_enabled != 0) { stop_playing_all_waves(); load_wave_flag_2(param_1); iVar1 = find_wave(param_1,2); *(ushort *)(iVar1 + 0x10) = *(ushort *)(iVar1 + 0x10) | 4; play_wave_flag2(param_1); DAT_0044b2ac = param_1; } return; } void __cdecl FUN_004376bc(undefined4 *param_1) { int iVar1; short sVar2; short sVar3; FUN_0043771a(); sVar2 = 0; do { sVar3 = sVar2 + 1; iVar1 = (int)sVar2; sVar2 = sVar3; } while (*(short *)((int)param_1 + iVar1 * 2) != -1); DAT_00451a90 = (ushort *)alloc_tracked_heap_block(sVar3 * 2); memcpy((undefined4 *)DAT_00451a90,param_1,sVar3 * 2); DAT_00451a94 = 0; FUN_0043767e(*DAT_00451a90); return; } void __stdcall FUN_0043771a(void) { if (DAT_00451a90 != 0) { if (*(short *)(DAT_00451a90 + DAT_00451a94 * 2) != -1) { FUN_00437afd(*(short *)(DAT_00451a90 + DAT_00451a94 * 2)); } free_tracked_heap_block(DAT_00451a90); DAT_00451a90 = 0; } return; } void __stdcall FUN_00437767(void) { short sVar1; short sVar2; if (DAT_00451a90 != 0) { sVar2 = wave_is_playing_(*(short *)(DAT_00451a90 + DAT_00451a94 * 2)); sVar1 = DAT_00451a94; if (sVar2 == 0) { DAT_00451a94 = DAT_00451a94 + 1; FUN_00437afd(*(short *)(DAT_00451a90 + sVar1 * 2)); if (*(short *)(DAT_00451a90 + DAT_00451a94 * 2) != -1) { FUN_0043767e(*(ushort *)(DAT_00451a90 + DAT_00451a94 * 2)); return; } FUN_0043771a(); } } return; } void __cdecl stop_wave_now(int param_1) { short sVar1; int iVar2; undefined4 uVar3; undefined4 uVar4; BOOL BVar5; MMRESULT MVar6; undefined4 extraout_EDX; undefined4 uVar7; undefined4 uVar8; undefined4 uVar9; undefined4 uVar10; tagMSG local_20; if (*(short *)(param_1 + 0x16) != 0) { if (sound_type == 0) { if (param_1 != 0) { MVar6 = waveOutReset(hwaveout); wave_out_error(MVar6); MVar6 = waveOutUnprepareHeader(hwaveout,(LPWAVEHDR)(param_1 + 0x32),0x20); wave_out_error(MVar6); MVar6 = waveOutClose(hwaveout); wave_out_error(MVar6); } do { BVar5 = PeekMessageA(&local_20,(HWND)0x0,0x3bd,0x3bd,3); } while (BVar5 != 0); } else if (sound_type == 1) { uVar10 = 0; uVar9 = wavemix_session; (*(code *)WaveMixActivate)(); uVar8 = 2; iVar2 = (int)*(short *)(param_1 + 0x1c); uVar7 = wavemix_session; uVar3 = (*(code *)WaveMixFlushChannel)(); uVar4 = wavemix_error(uVar3); (*(code *)WaveMixActivate) (uVar4,extraout_EDX,uVar3,wavemix_session,1,uVar7,iVar2,uVar8,uVar9,uVar10); do { BVar5 = PeekMessageA(&local_20,(HWND)0x0,0x3bd,0x3bd,3); } while (BVar5 != 0); } else if (sound_type == 2) { sVar1 = *(short *)(param_1 + 0x1c); (**(code **)(*(int *)playing_sounds[sVar1].dsound_obj + 0x48))(); (**(code **)(*(int *)playing_sounds[sVar1].dsound_obj + 8))(); } } return; } void __cdecl mci_stop(int param_1) { MCIERROR MVar1; undefined1 local_8 [4]; if ((*(ushort *)(param_1 + 0x1a) & 0x2000) == 0) { MVar1 = mciSendCommandA((uint)*(ushort *)(param_1 + 0x2c),MCI_STOP,2,(DWORD_PTR)local_8); _return_arg0((short)MVar1); MVar1 = mciSendCommandA((uint)*(ushort *)(param_1 + 0x2c),MCI_CLOSE,2,(DWORD_PTR)local_8); _return_arg0((short)MVar1); } return; } void __cdecl stop_playing_wave(int param_1,short param_2) { if ((param_1 != 0) && (*(short *)(param_1 + 0x16) != 0)) { if (param_2 != 0) { stop_wave_now(param_1); } playing_sounds[*(short *)(param_1 + 0x1c)].state = -1; playing_sounds[*(short *)(param_1 + 0x1c)].sound_struct = (sound_struct *)0x0; *(undefined2 *)(param_1 + 0x16) = 0; } return; } void __cdecl stop_playing_wave_by_id_type1(short param_1) { int iVar1; iVar1 = find_wave(param_1,1); if ((sfx_enabled != 0) && (iVar1 != 0)) { stop_playing_wave(iVar1,1); } return; } void __cdecl mark_sound_not_playing(int param_1) { playing_sounds[0].state = -1; *(undefined2 *)(param_1 + 0x16) = 0; return; } void __cdecl midi_stop(short param_1) { int iVar1; iVar1 = find_wave(param_1,4); if (((iVar1 != 0) && (*(short *)(iVar1 + 0x16) != 0)) && (bgm_enabled != 0)) { *(undefined2 *)(iVar1 + 0x16) = 2; mci_stop(iVar1); mark_sound_not_playing(iVar1); midi_current = 0; } return; } void __cdecl stop_playing_wave_by_id_type2(short param_1) { int iVar1; iVar1 = find_wave(param_1,2); if ((voices_enabled != 0) && (iVar1 != 0)) { stop_playing_wave(iVar1,1); } return; } void __stdcall stop_playing_all_waves(void) { short sVar1; for (sVar1 = 1; sVar1 < max_waves; sVar1 = sVar1 + 1) { if (playing_sounds[sVar1].state != -1) { stop_playing_wave((int)playing_sounds[sVar1].sound_struct,1); } } return; } void __stdcall midi_stop_current(void) { midi_stop(midi_current); return; } void __stdcall stop_playing_voice_slot1(void) { stop_playing_wave_by_id_type2(playing_sounds[1].state); return; } void __cdecl FUN_00437afd(short param_1) { int iVar1; iVar1 = find_wave(param_1,2); if ((iVar1 != 0) && ((*(byte *)(iVar1 + 0x10) & 4) != 0)) { DAT_0044b2ac = 0; free_wave_flag_2(param_1); } return; } void __stdcall FUN_00437b2c(void) { int iVar1; iVar1 = find_wave(DAT_0044b2ac,2); if ((iVar1 != 0) && ((*(byte *)(iVar1 + 0x10) & 4) != 0)) { FUN_00437afd(*(ushort *)(iVar1 + 0xc) & 0x7fff); } return; } void __stdcall FUN_00437b5b(void) { short sVar1; for (sVar1 = 1; sVar1 < max_waves; sVar1 = sVar1 + 1) { if (playing_sounds[sVar1].state != -1) { stop_playing_wave((int)playing_sounds[sVar1].sound_struct,1); } } midi_stop_current(); FUN_00437b2c(); return; } void __cdecl pause_wave(int param_1) { short sVar1; MMRESULT MVar2; undefined4 uVar3; if (sound_type == 0) { MVar2 = waveOutPause(hwaveout); wave_out_error(MVar2); } else if (sound_type == 1) { uVar3 = (*(code *)WaveMixActivate)(); wavemix_error(uVar3); } else if (sound_type == 2) { sVar1 = *(short *)(param_1 + 0x1c); uVar3 = (**(code **)(*(int *)playing_sounds[sVar1].dsound_obj + 0x10))(); playing_sounds[sVar1].field4_0xc = uVar3; (**(code **)(*(int *)playing_sounds[sVar1].dsound_obj + 0x48))(); } return; } void __stdcall FUN_00437c1c(void) { if (DAT_0045197e != 0) { midi_pause_current(); } return; } void __stdcall FUN_00437c30(void) { if (DAT_0045197e != 0) { restart_current_midi(0); } return; } void __cdecl restart_sound(int param_1) { short sVar1; undefined4 uVar2; MMRESULT MVar3; if (sound_type == 0) { MVar3 = waveOutRestart(hwaveout); wave_out_error(MVar3); return; } if (sound_type != 1) { if (sound_type != 2) { return; } sVar1 = *(short *)(param_1 + 0x1c); (**(code **)(*(int *)playing_sounds[sVar1].dsound_obj + 0x34))(); (**(code **)(*(int *)playing_sounds[sVar1].dsound_obj + 0x30))(); return; } uVar2 = (*(code *)WaveMixActivate)(); wavemix_error(uVar2); return; } void __cdecl midi_pause(int param_1) { MCIERROR MVar1; undefined4 local_8; if ((*(ushort *)(param_1 + 0x1a) & 0x2000) == 0) { local_8 = 0; MVar1 = mciSendCommandA((uint)*(ushort *)(param_1 + 0x2c),MCI_PAUSE,2,(DWORD_PTR)&local_8); _return_arg0((short)MVar1); } return; } void __stdcall midi_pause_current(void) { int iVar1; if (DAT_0044b2a4 == 0) { iVar1 = find_wave(midi_current,4); if ((iVar1 != 0) && (*(short *)(iVar1 + 0x16) != 0)) { midi_pause(iVar1); } } DAT_0044b2a4 = DAT_0044b2a4 + 1; return; } void __cdecl midi_replay(int param_1) { MCIERROR MVar1; HWND local_10 [3]; if ((*(ushort *)(param_1 + 0x1a) & 0x2000) == 0) { local_10[0] = sound_window; MVar1 = mciSendCommandA((uint)*(ushort *)(param_1 + 0x2c),MCI_PLAY,1,(DWORD_PTR)local_10); _return_arg0((short)MVar1); } return; } void __cdecl restart_current_midi(short param_1) { int iVar1; DAT_0044b2a4 = DAT_0044b2a4 + -1; if ((param_1 != 0) || (DAT_0044b2a4 < 0)) { DAT_0044b2a4 = 0; } if (DAT_0044b2a4 == 0) { iVar1 = find_wave(midi_current,4); if ((iVar1 != 0) && (*(short *)(iVar1 + 0x16) != 0)) { midi_replay(iVar1); } } return; } void __stdcall FUN_00437dcb(void) { return; } undefined4 __cdecl wave_is_playing(short param_1) { int iVar1; undefined4 uVar2; iVar1 = find_wave(param_1,3); if ((iVar1 == 0) || (*(short *)(iVar1 + 0x16) == 0)) { uVar2 = 0; } else { uVar2 = 1; } return uVar2; } undefined4 __stdcall FUN_00437e22(void) { undefined4 uVar1; short sVar2; sVar2 = 1; while( true ) { if (max_waves <= sVar2) { return 0; } if ((playing_sounds[sVar2].state != -1) && (uVar1 = wave_is_playing(playing_sounds[sVar2].state), (short)uVar1 != 0)) break; sVar2 = sVar2 + 1; } return CONCAT22((short)((uint)uVar1 >> 0x10),1); } void __cdecl wave_is_playing_(short param_1) { wave_is_playing(param_1); return; } undefined4 __stdcall FUN_00437e7b(void) { undefined4 uVar1; short sVar2; sVar2 = 1; while( true ) { if (max_waves <= sVar2) { return 0; } if ((playing_sounds[sVar2].state != -1) && (uVar1 = wave_is_playing_(playing_sounds[sVar2].state), (short)uVar1 != 0)) break; sVar2 = sVar2 + 1; } return CONCAT22((short)((uint)uVar1 >> 0x10),1); } undefined4 __cdecl midi_is_playing(short param_1) { if ((((bgm_enabled != 0) && (currently_playing_midi != (sound_struct *)0x0)) && (currently_playing_midi->wave_idx == param_1)) && (currently_playing_midi->is_playing != 0)) { return CONCAT22((short)((uint)currently_playing_midi >> 0x10),1); } return 0; } void __cdecl wave_is_playing_(short param_1) { wave_is_playing(param_1); return; } undefined4 __stdcall FUN_00437f0f(void) { undefined4 uVar1; short sVar2; sVar2 = 1; while( true ) { if (max_waves <= sVar2) { return 0; } if ((playing_sounds[sVar2].state != -1) && (uVar1 = wave_is_playing_(playing_sounds[sVar2].state), (short)uVar1 != 0)) break; sVar2 = sVar2 + 1; } return CONCAT22((short)((uint)uVar1 >> 0x10),1); } void __cdecl set_sfx_enabled(short param_1) { if ((param_1 != sfx_enabled) && (sfx_enabled = param_1, param_1 == 0)) { stop_playing_all_waves(); } return; } void __cdecl set_bgm_enabled(short param_1) { short sVar1; int iVar2; sVar1 = midi_current; midi_current = sVar1; if (bgm_enabled != param_1) { if (bgm_enabled == 0) { bgm_enabled = 1; iVar2 = find_wave(midi_current,4); if (iVar2 != 0) { midi_stop_and_play(midi_current,*(undefined2 *)(iVar2 + 0x18)); return; } } else { midi_stop_current(); bgm_enabled = 0; midi_current = sVar1; } } return; } word __stdcall is_bgm_enabled(void) { return bgm_enabled; } word __stdcall are_sfx_enabled(void) { return sfx_enabled; } word __stdcall are_voices_enabled(void) { return voices_enabled; } void __cdecl set_voices_enabled(short param_1) { if ((param_1 != voices_enabled) && (voices_enabled = param_1, param_1 == 0)) { stop_playing_voice_slot1(); } return; } void __stdcall open_midimap(void) { HFILE HVar1; char local_204 [256]; CHAR local_104 [256]; GetWindowsDirectoryA(local_104,0x90); strcpy(local_204,local_104); strcat(local_204,s__system__0044b4fe); strcat(local_204,PTR_s_midimap_cfg_0044b2c0); HVar1 = _lopen(local_204,0); if (HVar1 < 0) { strcpy(local_204,local_104); strcat(local_204,s__system32__0044b507); strcat(local_204,PTR_s_midimap_cfg_0044b2c0); _lopen(local_204,0); } return; } ushort __cdecl sound_initialize(short param_1) { bool bVar1; undefined3 extraout_var; undefined4 uVar2; UINT UVar3; MMRESULT MVar4; int iVar5; LONG LVar6; uint uVar7; char *pcVar8; short sVar9; tagMIDIOUTCAPSA local_13c; char local_108 [258]; short local_6; DAT_0045197c = 0; if (param_1 != 0) { if (param_1 == 1) { UVar3 = waveOutGetNumDevs(); if (UVar3 != 0) { DAT_0045197c = DAT_0045197c | 1; sound_type = 0; bVar1 = load_wavemix(); if ((short)CONCAT31(extraout_var,bVar1) != 0) { sound_type = 1; } } goto LAB_0043819d; } if (param_1 != 2) goto LAB_0043819d; DAT_0045197c = 1; uVar2 = load_dsound(); if ((short)uVar2 == 0) { sound_type = 0; } else { iVar5 = (*(code *)DirectSoundCreate)(); if (iVar5 == 0) { sound_type = 2; } else { sound_type = 0; } } } UVar3 = waveOutGetNumDevs(); if (UVar3 != 0) { DAT_0045197c = DAT_0045197c | 1; sound_type = 0; } LAB_0043819d: UVar3 = midiOutGetNumDevs(); if (((short)UVar3 != 0) && (MVar4 = midiOutGetDevCapsA(0xffffffff,&local_13c,0x34), MVar4 != 6)) { DAT_0045197c = DAT_0045197c | 2; iVar5 = open_midimap(); if (iVar5 < 0) { DAT_0045197c = DAT_0045197c & 0xfffd; } else { midi_type = 1; LVar6 = _llseek(iVar5,6,0); if ((((LVar6 == 6) && (UVar3 = _lread(iVar5,&local_6,2), UVar3 == 2)) && (LVar6 = _llseek(iVar5,(local_6 + -1) * 0x36 + 0x12,0), LVar6 != 0)) && (UVar3 = _lread(iVar5,local_108,0x10), UVar3 == 0x10)) { sVar9 = 0; do { uVar7 = toupper((int)local_108[sVar9]); local_108[sVar9] = (char)uVar7; sVar9 = sVar9 + 1; } while (sVar9 < 0x10); pcVar8 = strcmp(local_108,s_ADLIB_0044b512); if (pcVar8 == (char *)0x0) { pcVar8 = strcmp(local_108,s_AD_LIB_0044b518); if (pcVar8 == (char *)0x0) { pcVar8 = strcmp(local_108,s_MVI_PRO_0044b51f); if (pcVar8 == (char *)0x0) { pcVar8 = strcmp(local_108,s_BAS_0044b527); if (pcVar8 == (char *)0x0) { pcVar8 = strcmp(local_108,s_BASE_0044b52b); if (pcVar8 == (char *)0x0) { pcVar8 = strcmp(local_108,s_THUNDER_BOARD_0044b530); if (pcVar8 != (char *)0x0) { midi_type = 0; } } else { midi_type = 0; } } else { midi_type = 0; } } else { midi_type = 0; } } else { midi_type = 0; } } else { midi_type = 0; } } _lclose(iVar5); } } return DAT_0045197c; } int __cdecl load_wave_by_ints(short param_1) { int iVar1; short sVar2; iVar1 = load_resource_item_0(param_1,(int *)PTR_ints_0044ae18); sVar2 = 0; while ((*(short *)(iVar1 + sVar2 * 2) != -1 && (*(short *)(iVar1 + sVar2 * 2) != 0))) { load_wave_flag_1(*(ushort *)(iVar1 + sVar2 * 2)); find_wave(*(short *)(iVar1 + sVar2 * 2),1); sVar2 = sVar2 + 1; } return iVar1; } undefined4 __cdecl free_waves_from_list(int param_1) { short sVar1; if (param_1 != 0) { sVar1 = 0; while ((*(short *)(param_1 + sVar1 * 2) != -1 && (*(short *)(param_1 + sVar1 * 2) != 0))) { free_wave_flag_1(*(short *)(param_1 + sVar1 * 2)); sVar1 = sVar1 + 1; } free_resource_item_with_data(param_1); } return 0; } void __cdecl set_midi_type(undefined2 param_1) { midi_type = param_1; return; } void __stdcall FUN_004383d4(void) { int iVar1; int in_ECX; short sVar2; if (sound_type != 0) { if (sound_type == 1) { if ((DAT_0045197e != 0) && (num_sound_pauses == 0)) { (*(code *)WaveMixPump)(); } } else if (sound_type == 2) { for (sVar2 = 1; sVar2 < max_waves; sVar2 = sVar2 + 1) { if ((((playing_sounds[sVar2].state != -1) && ((playing_sounds[sVar2].sound_struct)->loop == 0)) && (iVar1 = (**(code **)(*(int *)playing_sounds[sVar2].dsound_obj + 0x24))(), iVar1 == 0)) && (in_ECX != 1)) { stop_playing_wave((int)playing_sounds[sVar2].sound_struct,1); } } } } FUN_00437767(); return; } void __cdecl unpause_all_sounds(short param_1) { short sVar1; num_sound_pauses = num_sound_pauses + -1; if (param_1 != 0) { num_sound_pauses = 0; } if (num_sound_pauses == 0) { for (sVar1 = 1; sVar1 < max_waves; sVar1 = sVar1 + 1) { if (playing_sounds[sVar1].state != -1) { restart_sound((int)playing_sounds[sVar1].sound_struct); } } restart_current_midi(0); } if (num_sound_pauses < 0) { num_sound_pauses = 0; } return; } void __stdcall pause_all_sounds(void) { short sVar1; if (num_sound_pauses == 0) { for (sVar1 = 1; sVar1 < max_waves; sVar1 = sVar1 + 1) { if (playing_sounds[sVar1].state != -1) { pause_wave((int)playing_sounds[sVar1].sound_struct); } } midi_pause_current(); } num_sound_pauses = num_sound_pauses + 1; return; } uint __cdecl FUN_00438554(int param_1) { if (param_1 == 0) { return 0; } return *(uint *)(param_1 + 0x24) / 0x16; } void __cdecl FUN_00438570(short param_1) { int iVar1; iVar1 = find_wave(param_1,2); FUN_00438554(iVar1); return; } void __cdecl FUN_0043858b(short param_1) { int iVar1; iVar1 = find_wave(param_1,1); FUN_00438554(iVar1); return; } void __stdcall FUN_004385a6(void) { FUN_00437b5b(); DAT_0044b2a4 = 0; num_sound_pauses = 0; midi_current = 0xffff; return; } void __cdecl set_midi_path(char *param_1) { int iVar1; iVar1 = strlen(param_1); if ((short)iVar1 < 0x100) { strcpy(midi_path,param_1); if (param_1[(short)iVar1 + -1] != '\\') { strcat(midi_path,s___0044b53e); } } return; } void __cdecl FUN_0043860d(ushort param_1) { short sVar1; load_wave_flag_2(param_1); play_wave_flag2(param_1); while( true ) { sVar1 = wave_is_playing_(param_1); if (sVar1 == 0) break; pump_messages_and_get_key(); } free_wave_flag_2(param_1); return; } void __cdecl FUN_0043863f(ushort param_1) { short sVar1; FUN_0043767e(param_1); while( true ) { sVar1 = wave_is_playing_(param_1); if (sVar1 == 0) break; pump_messages_and_get_key(); } FUN_00437afd(param_1); return; } void __stdcall nullsub(void) { return; } void __cdecl FUN_0043866f(short param_1) { short sVar1; while( true ) { sVar1 = wave_is_playing_(param_1); if (sVar1 == 0) break; pump_messages_and_get_key(); } return; } void __cdecl FUN_0043868c(short param_1) { undefined4 uVar1; while( true ) { uVar1 = midi_is_playing(param_1); if ((short)uVar1 == 0) break; pump_messages_and_get_key(); } return; } void __cdecl FUN_004386a9(short param_1) { short sVar1; while( true ) { sVar1 = wave_is_playing_(param_1); if (sVar1 == 0) break; pump_messages_and_get_key(); } return; } void __cdecl free_all_sounds(short param_1) { undefined4 *puVar1; undefined4 *puVar2; FUN_00437b2c(); puVar2 = (undefined4 *)deref_next_if_not_null(waves_list); while (puVar1 = puVar2, puVar1 != (undefined4 *)0x0) { puVar2 = (undefined4 *)deref_next(puVar1); if (param_1 <= *(short *)((int)puVar1 + 0x52)) { if (*(short *)((int)puVar1 + 0xe) == 4) { free_midi(*(short *)(puVar1 + 3)); } else { free_wave(*(short *)(puVar1 + 3),*(ushort *)((int)puVar1 + 0xe)); } } } DAT_00451a90 = 0; return; } void __stdcall problem_with_wavemix(void) { ushort uVar1; ushort uVar2; int iVar3; int iVar4; undefined4 uVar5; undefined4 uVar6; undefined4 extraout_EDX; undefined4 uVar7; undefined4 uVar8; undefined4 uVar9; alert_message(s_Problem_with_WaveMix___Convertin_0044b540); iVar4 = deref_prev_if_not_null(waves_list); while (iVar3 = iVar4, iVar3 != 0) { iVar4 = deref_prev(iVar3); if ((*(byte *)(iVar3 + 0xe) & 3) != 0) { uVar1 = *(ushort *)(iVar3 + 0xc); uVar2 = *(ushort *)(iVar3 + 0xe); sound_type = 1; free_wave(uVar1,uVar2); sound_type = 0; load_wave_xxx(uVar1,uVar2); } } sound_type = 1; uVar9 = 1; uVar8 = 0; uVar7 = wavemix_session; uVar5 = (*(code *)WaveMixCloseChannel)(); uVar6 = wavemix_error(uVar5); (*(code *)WaveMixCloseSession)(uVar6,extraout_EDX,uVar5,wavemix_session,uVar7,uVar8,uVar9); FUN_00436b67(); sound_type = 0; set_ini_wavemix(); return; } void __stdcall simple_machines_puzzle_on_load(void) { aseq_anim_state_struct *paVar1; aseq_cursor_struct *paVar2; short sVar3; DAT_00451e80 = 0; DAT_00451e7e = 0; wave_load_list[0] = 0x1f74; wave_load_list[1] = 0x1f5c; wave_load_list[2] = 0x1f5b; wave_load_list[3] = 0x4a75; wave_load_list[4] = 0x1fa7; wave_load_list[5] = 0x1f79; wave_load_list[6] = 0x1f77; wave_load_list[7] = 0x1f78; wave_load_list[8] = 0x4a5e; wave_load_list[9] = 0x1f75; wave_load_list[10] = 0x1f7d; wave_load_list[0xb] = 0x1f7e; wave_load_list[0xc] = 0x1f73; wave_load_list[0xd] = 0x4a77; wave_load_list[0xe] = -1; load_waves_from_list(0x451486); load_and_draw_score(); FUN_0043d7c1(FUN_0043be57); load_rrgb_1(16000); DAT_00451ec8 = load_aseq(16000); aseq_draw_to_both_fbs((int)DAT_00451ec8,0,0,0); free_aseq(DAT_00451ec8); DAT_00451ef4 = load_aseq(16066); key_xxxxx_set(FUN_00439440); simple_machine_load_puzzle(puzzle_idx); simple_machine_draw_sidebar_icons(); simple_machine_draw_sidebar_counts(); simple_machines_set_up_mouse_regions(); FUN_00430e33(DAT_0044b706); DAT_00451ef8 = load_aseq(15009); aseq_set_pos_order((int)DAT_00451ef8,0x18e,0x143,10); DAT_00451efc = load_aseq(15005); aseq_set_pos_order((int)DAT_00451efc,0x10,0x19,10); DAT_00451f00 = load_aseq(15010); aseq_set_pos_order((int)DAT_00451f00,0x10,0x120,10); sVar3 = 0; do { paVar1 = (aseq_anim_state_struct *)load_aseq(sVar3 + 16074); simple_machine_hand_cur_aseqs[sVar3] = paVar1; paVar2 = (aseq_cursor_struct *) aseq_setup_as_cursor((int)simple_machine_hand_cur_aseqs[sVar3],0,0); simple_machine_hand_curs[sVar3] = paVar2; simple_machine_hand_curs[sVar3]->enable_clip_cursor = 0; sVar3 = sVar3 + 1; } while (sVar3 < 9); sVar3 = 0; do { paVar1 = (aseq_anim_state_struct *)load_aseq(sVar3 + 16066); simple_machine_icon_cur_aseqs[sVar3] = paVar1; paVar2 = (aseq_cursor_struct *) aseq_setup_as_cursor((int)simple_machine_icon_cur_aseqs[sVar3],0,0); simple_machine_icon_curs[sVar3] = paVar2; sVar3 = sVar3 + 1; } while (sVar3 < 8); simple_machine_setup_mouse_shape_regions(1); on_deactivate_xtra_cb = FUN_0043c05f; FUN_00422170(); return; } void __stdcall simple_machines_puzzle_on_remove(void) { aseq_anim_state_struct *paVar1; short sVar2; if (DAT_004514b0 != 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; } sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)simple_machine_icon_cur_aseqs[sVar2]); simple_machine_icon_cur_aseqs[sVar2] = paVar1; aseq_free_cursor((int)simple_machine_icon_curs[sVar2]); sVar2 = sVar2 + 1; } while (sVar2 < 8); sVar2 = 0; do { paVar1 = (aseq_anim_state_struct *)free_aseq((int *)simple_machine_hand_cur_aseqs[sVar2]); simple_machine_hand_cur_aseqs[sVar2] = paVar1; aseq_free_cursor((int)simple_machine_hand_curs[sVar2]); sVar2 = sVar2 + 1; } while (sVar2 < 9); on_deactivate_xtra_cb = (undefined *)0x0; set_cursor_override_regions(0,0); FUN_00430ef4(0x451486); FUN_00431029(); DAT_004514ae = DAT_0044b706; FUN_0043d7c1(0); mouse_region_delete_all_lists(); FUN_0043950b(); key_xxxxx_clear(); free_resource_item_with_idx_fourcc(DAT_004514c2,(undefined1 *)&text); free_tracked_heap_block(DAT_00451a98); FUN_0042211c(); return; } void __stdcall simple_machines_puzzle_on_periodic(void) { short sVar1; int iVar2; undefined4 uVar3; new_player_hint(0xf); if (DAT_00451e7e == 0) { DAT_00451e7e = 1; DAT_004514b0 = DAT_004514c4; load_wave_flag_2(DAT_004514c4); play_wave_flag2(DAT_004514b0); } if (DAT_00451e80 != 0) { DAT_00451e80 = 0; simple_machines_set_up_mouse_regions(); simple_machine_draw_sidebar_icons(); simple_machine_draw_sidebar_counts(); } switch(simple_machines_state) { case 0: sVar1 = wave_is_playing_(DAT_004514b0); if (sVar1 == 0) { free_wave_flag_2(DAT_004514b0); DAT_004514b0 = 0; simple_machines_state = 1; return; } break; case 1: if (-1 < DAT_0044b6e4) { anim_state_xxx_list_insert_8004((undefined4 *)simple_machines_answer[DAT_0044b6e4].aseq); aseq_set_pos_order((int)simple_machines_answer[DAT_0044b6e4].aseq, simple_machines_answer[DAT_00451bb0].x + simple_machine_start_x, simple_machines_answer[DAT_0044b6e4].y + simple_machine_start_y,5); DAT_0044b6e4 = 0xffff; return; } break; case 2: simple_machines_state = 1; clear_cursor_override_regions(); solved_the_puzzle(0x4a77); simple_machine_setup_mouse_shape_regions_wrap(); inc_score_by_400(); simple_machines_set_up_mouse_regions(); break; case 3: sVar1 = aseq_anim_get_flags((int)DAT_00451ef4); if (sVar1 != 4) { if (DAT_00451bae < 10) { if (simple_machine_state_struct_ARRAY_00451ac8[DAT_00451bae].machine_type != 9) { if (-1 < DAT_0044b6e4) { anim_state_xxx_list_insert_8004((undefined4 *)simple_machines_answer[DAT_0044b6e4].aseq) ; aseq_set_pos_order((int)simple_machines_answer[DAT_0044b6e4].aseq, simple_machines_answer[DAT_0044b6e4].x + simple_machine_start_x, simple_machines_answer[DAT_0044b6e4].y + simple_machine_start_y,5); DAT_0044b6e4 = -1; } iVar2 = simple_machine_check_against_reference(DAT_00451bae); DAT_00451bb0 = (short)iVar2; if ((DAT_00451bb0 == -1) || (simple_machines_answer[DAT_00451bb0].type == 8)) { FUN_0043bcf5(DAT_00451bae); simple_machine_draw_sidebar_icons(); simple_machine_draw_sidebar_counts(); } else { play_wave_flag1(simple_machine_type_info_ARRAY_0044b62c [(short)simple_machine_state_struct_ARRAY_00451ac8[DAT_00451bae]. machine_type].sfx,5,0); free_aseq(DAT_00451ef4); DAT_00451ef4 = load_aseq(simple_machine_state_struct_ARRAY_00451ac8[DAT_00451bae]. machine_type + 0x3ec2); aseq_set_pos_order((int)DAT_00451ef4, simple_machine_state_struct_ARRAY_00451ac8[DAT_00451bae].mouse_rect.x ,simple_machine_state_struct_ARRAY_00451ac8[DAT_00451bae].mouse_rect. y,10); anim_state_xxx_list_insert_4(DAT_00451ef4); free_aseq((int *)simple_machine_state_struct_ARRAY_00451ac8[DAT_00451bae].aseq); simple_machine_state_struct_ARRAY_00451ac8[DAT_00451bae].machine_type = 9; simple_machines_answer[DAT_00451bb0].type = 8; DAT_0044b6e4 = DAT_00451bb0; simple_machines_set_up_mouse_regions(); } } } else if (DAT_0044b706 == 0) { simple_machines_state = 1; simple_machine_setup_mouse_shape_regions_wrap(); uVar3 = simple_machine_beat_game(); DAT_0044b706 = (short)uVar3; if (DAT_0044b706 != 0) { simple_machines_state = 2; } } DAT_00451bae = DAT_00451bae + 1; return; } break; case 4: get_mouse_xy_relative_(&simple_machine_mouse_x,&simple_machine_mouse_y); return; case 5: xxxfunc_set(&puzzle_choosing_funcset_xxx); return; } return; } void __stdcall simple_machines_go_back(void) { if (simple_machines_state != 0) { play_wave_flag1(0x1f5c,5,0); aseq_anim_reset_and_play(DAT_00451ef8); xxx_periodic_loop(); simple_machines_state = 5; } return; } void __stdcall simple_machines_set_up_mouse_regions(void) { mouse_region *pmVar1; short sVar2; mouse_region_delete_all_lists(); mouse_region_new_up(0x10,0x19,0x3a,0x1c,5,0x43931b); mouse_region_new_up(0x18e,0x144,100,0x32,5,0x438eca); mouse_region_new_up(0x10,0x120,0x3a,0x19,5,0x4392c1); mouse_region_new_up(0,0,0x200,0x180,0,0x43930d); DAT_00451aa4 = mouse_region_new_up(0x6c,0x1f,0x182,0x108,1,0x4390f1); *(undefined4 *)((int)DAT_00451aa4 + 0x1e) = 0x66; DAT_00451aa0 = mouse_region_new_up(6,0x5d,0x4d,0xbd,1,0x4390f1); *(undefined4 *)((int)DAT_00451aa0 + 0x1e) = 0x65; sVar2 = 0; do { if ('\0' < simple_machine_instances[sVar2]) { pmVar1 = (mouse_region *) mouse_region_new_up(gfx_rect_ARRAY_0044b6a4[sVar2].x,gfx_rect_ARRAY_0044b6a4[sVar2].y ,gfx_rect_ARRAY_0044b6a4[sVar2].w, gfx_rect_ARRAY_0044b6a4[sVar2].h,10,0x4390f1); PTR_ARRAY_00451aa8[sVar2] = pmVar1; PTR_ARRAY_00451aa8[sVar2]->extra_data = (int)sVar2; } sVar2 = sVar2 + 1; } while (sVar2 < 8); sVar2 = 0; do { if (simple_machine_state_struct_ARRAY_00451ac8[sVar2].machine_type != 9) { pmVar1 = (mouse_region *) mouse_region_new_up(simple_machine_state_struct_ARRAY_00451ac8[sVar2].mouse_rect.x, simple_machine_state_struct_ARRAY_00451ac8[sVar2].mouse_rect.y, simple_machine_state_struct_ARRAY_00451ac8[sVar2].mouse_rect.w, simple_machine_state_struct_ARRAY_00451ac8[sVar2].mouse_rect.h,5, 0x4390f1); simple_machine_state_struct_ARRAY_00451ac8[sVar2].mouse_rgn = pmVar1; (simple_machine_state_struct_ARRAY_00451ac8[sVar2].mouse_rgn)->extra_data = (int)sVar2 + 1000; } sVar2 = sVar2 + 1; } while (sVar2 < 10); if (DAT_0044b706 != 0) { mouse_region_new_up(10,0x140,0x14e,0x3c,0x19,0x4390de); } return; } void __stdcall FUN_004390de(void) { DAT_004514f6 = 1; simple_machines_state = 5; return; } int __cdecl simple_machines_mouse_handler(int param_1) { char cVar1; uint uVar2; int iVar3; if (simple_machines_state == 1) { uVar2 = *(uint *)(param_1 + 0x1e); if (uVar2 < 8) { play_wave_flag1(0x1f73,5,0); cur_selected_simple_machine = *(short *)(param_1 + 0x1e); clear_cursor_override_regions(); simple_machines_state = 4; cur_simple_machine_icon_cur = simple_machine_icon_curs[cur_selected_simple_machine]; set_custom_cursor((undefined4 *)simple_machine_icon_curs[cur_selected_simple_machine]); iVar3 = (int)cur_selected_simple_machine; simple_machine_instances[iVar3] = simple_machine_instances[iVar3] + -1; if (simple_machine_instances[iVar3] == '\0') { anim_state_xxx_list_remove((int *)simple_machine_icon_aseq[cur_selected_simple_machine]); } simple_machine_draw_sidebar_icons(); simple_machine_draw_sidebar_counts(); iVar3 = simple_machines_set_up_mouse_regions(); return iVar3; } iVar3 = uVar2 - 0x3f2; if (uVar2 - 1000 < 10) { play_wave_flag1(0x1f73,5,0); cur_selected_simple_machine = *(short *)(s_File_too_large_0044c4ca + *(int *)(param_1 + 0x1e) * 0x16 + 0xe); clear_cursor_override_regions(); simple_machines_state = 4; free_aseq(*(int **)(s_No_space_left_on_device_0044c4d9 + *(int *)(param_1 + 0x1e) * 0x16 + 0xd )); iVar3 = *(int *)(param_1 + 0x1e); (s_File_too_large_0044c4ca + iVar3 * 0x16 + 0xe)[0] = '\t'; (s_File_too_large_0044c4ca + iVar3 * 0x16 + 0xe)[1] = '\0'; cur_simple_machine_icon_cur = simple_machine_icon_curs[cur_selected_simple_machine]; set_custom_cursor((undefined4 *)simple_machine_icon_curs[cur_selected_simple_machine]); iVar3 = simple_machines_set_up_mouse_regions(); return iVar3; } } else { iVar3 = simple_machines_state + -4; if (iVar3 == 0) { uVar2 = *(uint *)(param_1 + 0x1e); if ((uVar2 < 8) || (uVar2 == 0x65)) { clear_cursor_override_regions(); simple_machines_state = 1; cVar1 = simple_machine_instances[cur_selected_simple_machine]; simple_machine_instances[cur_selected_simple_machine] = simple_machine_instances[cur_selected_simple_machine] + '\x01'; if (cVar1 == '\0') { anim_state_xxx_list_insert_8004 ((undefined4 *)simple_machine_icon_aseq[cur_selected_simple_machine]); } simple_machines_set_up_mouse_regions(); simple_machine_draw_sidebar_icons(); simple_machine_draw_sidebar_counts(); iVar3 = simple_machine_setup_mouse_shape_regions_wrap(); return iVar3; } if ((uVar2 == 0x66) || (iVar3 = uVar2 - 0x3f2, uVar2 - 1000 < 10)) { iVar3 = simple_machine_calc_mouse_xxxxx(mouse_region_hit_x,mouse_region_hit_y); return iVar3; } } } return iVar3; } void __stdcall simple_machines_check(void) { anim_state_xxx_list_insert_4(DAT_00451f00); if (simple_machines_state == 1) { if (DAT_0044b706 == 0) { DAT_0044b6e4 = 0xffff; DAT_00451bae = 0; clear_cursor_override_regions(); simple_machines_state = 3; } } else if (simple_machines_state == 3) { return; } return; } int __stdcall simple_machines_mouse_on_bg(void) { int iVar1; iVar1 = 0; if (simple_machines_state != 1) { iVar1 = simple_machines_state + -3; } return iVar1; } void __stdcall simple_machines_hint(void) { uint uVar1; char *pcVar2; short sVar3; char *apcStackY_20400 [32762]; char *local_400 [5]; char local_3ec [1000]; anim_state_xxx_list_insert_4(DAT_00451efc); xxx_periodic_loop(); anim_state_xxx_list_remove(DAT_00451efc); xxx_periodic_loop(); play_wave_flag1(0x1f5c,5,0); memset((undefined4 *)local_3ec,0,1000); local_400[0] = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[0],(int *)&text); uVar1 = strlen(local_400[0]); FUN_00440d70((undefined4 *)local_3ec,local_400[0],uVar1); for (sVar3 = 1; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { pcVar2 = (char *)load_resource_item_0(SHORT_ARRAY_004514ec[sVar3],(int *)&text); local_400[sVar3] = pcVar2; uVar1 = strlen(local_400[sVar3]); FUN_00440ce0(local_3ec,local_400[sVar3],uVar1); } FUN_004301cf(local_3ec); for (sVar3 = 0; sVar3 < DAT_004514c0; sVar3 = sVar3 + 1) { free_resource_item_with_idx_fourcc(SHORT_ARRAY_004514ec[sVar3],(undefined1 *)&text); } return; } void __stdcall FUN_00439440(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if (sVar1 == 0xd) { if (DAT_0044b706 != 0) { simple_machines_state = 5; } DAT_004514f6 = 1; } return; } undefined4 __stdcall simple_machine_beat_game(void) { undefined2 extraout_var; short sVar1; sVar1 = 0; do { if (simple_machines_answer[sVar1].type != 8) { return 0; } sVar1 = sVar1 + 1; } while (sVar1 < 10); sVar1 = 0; do { if (simple_machine_state_struct_ARRAY_00451ac8[sVar1].machine_type != 9) { anim_state_xxx_list_remove((int *)simple_machine_state_struct_ARRAY_00451ac8[sVar1].aseq); } sVar1 = sVar1 + 1; } while (sVar1 < 10); anim_state_xxx_list_remove((int *)simple_machine_grey); anim_state_xxx_list_insert_8004((undefined4 *)simple_machine_colored); aseq_set_pos_order((int)simple_machine_colored,simple_machine_start_x,simple_machine_start_y,0x14) ; play_wave_flag1(0x1f5b,5,0); return CONCAT22(extraout_var,1); } void __stdcall FUN_0043950b(void) { short sVar1; free_aseq(DAT_00451ef4); free_aseq((int *)simple_machine_grey); free_aseq((int *)simple_machine_colored); sVar1 = 0; do { free_aseq((int *)simple_machine_icon_aseq[sVar1]); sVar1 = sVar1 + 1; } while (sVar1 < 8); sVar1 = 0; do { if (simple_machines_answer[sVar1].aseq != (aseq_anim_state_struct *)0x0) { free_aseq((int *)simple_machines_answer[sVar1].aseq); } if (simple_machine_state_struct_ARRAY_00451ac8[sVar1].machine_type != 9) { free_aseq((int *)simple_machine_state_struct_ARRAY_00451ac8[sVar1].aseq); } sVar1 = sVar1 + 1; } while (sVar1 < 10); free_aseq(DAT_00451f00); free_aseq(DAT_00451efc); free_aseq(DAT_00451ef8); return; } void __cdecl simple_machine_load_puzzle(short param_1) { short sVar1; aseq_anim_state_struct *paVar2; undefined4 uVar3; short sVar4; simple_machine_start_x = 0xa0; simple_machine_start_y = 0x28; DAT_0044b6e4 = 0xffff; DAT_0044b706 = 0; cur_selected_simple_machine = 9; sVar4 = 0; do { simple_machine_state_struct_ARRAY_00451ac8[sVar4].machine_type = 9; sVar1 = 0; do { simple_machines_answer[sVar4].aseq = (aseq_anim_state_struct *)0x0; *(undefined2 *)(sVar4 * 0x46 + 0x451bca + sVar1 * 10) = 0; simple_machines_answer[sVar4].type = 8; sVar1 = sVar1 + 1; } while (sVar1 < 6); sVar4 = sVar4 + 1; } while (sVar4 < 10); sVar4 = 0; do { paVar2 = (aseq_anim_state_struct *)load_aseq(sVar4 + 16066); simple_machine_icon_aseq[sVar4] = paVar2; simple_machine_instances[sVar4] = '\0'; sVar4 = sVar4 + 1; } while (sVar4 < 8); simple_machines_state = 1; if (0x14 < param_1) { param_1 = 1; } switch(param_1) { case 1: DAT_004514be = 4; DAT_004514c0 = 2; SHORT_ARRAY_004514ec[0] = 0x3e88; SHORT_ARRAY_004514ec[1] = 0x3e89; SHORT_ARRAY_004514ce[0] = 0x3e8e; SHORT_ARRAY_004514ce[1] = 0x3e8f; SHORT_ARRAY_004514ce[2] = 0x3e90; SHORT_ARRAY_004514ce[3] = 0x3e91; SHORT_ARRAY_004514ce[4] = -1; simple_machine_start_x = 0x104; simple_machine_start_y = 0x28; simple_machines_answer[0].x = 0x10; simple_machines_answer[0].y = 0xc2; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3e84); simple_machines_answer[0].type = 2; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0x10; simple_machines_answer[0].inner[0].r.y = 0xc2; simple_machines_answer[0].inner[0].r.w = 0x28; simple_machines_answer[0].inner[0].r.h = 0x28; simple_machine_instances[2] = '\x01'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b37); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b38); break; case 2: DAT_004514be = 5; DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3e88; SHORT_ARRAY_004514ec[1] = 0x3e8b; SHORT_ARRAY_004514ec[2] = 16000; SHORT_ARRAY_004514ce[0] = 0x3e8e; SHORT_ARRAY_004514ce[1] = 0x3e8f; SHORT_ARRAY_004514ce[2] = 0x3e87; SHORT_ARRAY_004514ce[3] = 0x3e88; SHORT_ARRAY_004514ce[4] = 0x3e81; SHORT_ARRAY_004514ce[5] = -1; simple_machine_start_x = 0xb4; simple_machine_start_y = 0x50; simple_machines_answer[0].x = 0; simple_machines_answer[0].y = 0; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3e85); simple_machines_answer[0].type = 5; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0; simple_machines_answer[0].inner[0].r.y = 0x6c; simple_machines_answer[0].inner[0].r.w = 0x34; simple_machines_answer[0].inner[0].r.h = 0x2b; simple_machines_answer[0].inner[1].en = 1; simple_machines_answer[0].inner[1].r.x = 0x33; simple_machines_answer[0].inner[1].r.y = 0x5d; simple_machines_answer[0].inner[1].r.w = 0x24; simple_machines_answer[0].inner[1].r.h = 0x26; simple_machines_answer[0].inner[2].en = 1; simple_machines_answer[0].inner[2].r.x = 0x56; simple_machines_answer[0].inner[2].r.y = 0x49; simple_machines_answer[0].inner[2].r.w = 0x31; simple_machines_answer[0].inner[2].r.h = 0x2a; simple_machines_answer[0].inner[3].en = 1; simple_machines_answer[0].inner[3].r.x = 0x86; simple_machines_answer[0].inner[3].r.y = 0x3a; simple_machines_answer[0].inner[3].r.w = 0x20; simple_machines_answer[0].inner[3].r.h = 0x22; simple_machines_answer[0].inner[4].en = 1; simple_machines_answer[0].inner[4].r.x = 0xa5; simple_machines_answer[0].inner[4].r.y = 0x26; simple_machines_answer[0].inner[4].r.w = 0x2e; simple_machines_answer[0].inner[4].r.h = 0x29; simple_machines_answer[0].inner[5].en = 1; simple_machines_answer[0].inner[5].r.x = 0xd2; simple_machines_answer[0].inner[5].r.y = 0x13; simple_machines_answer[0].inner[5].r.w = 0x3b; simple_machines_answer[0].inner[5].r.h = 0x28; simple_machine_instances[5] = '\x01'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b4e); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b4f); break; case 3: DAT_004514be = 5; DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3e88; SHORT_ARRAY_004514ec[1] = 0x3e8b; SHORT_ARRAY_004514ce[0] = 0x3e8e; SHORT_ARRAY_004514ce[1] = 0x3e8f; SHORT_ARRAY_004514ce[2] = 0x3e87; SHORT_ARRAY_004514ce[3] = 0x3e88; SHORT_ARRAY_004514ec[2] = 16000; SHORT_ARRAY_004514ce[4] = 0x3e81; SHORT_ARRAY_004514ce[5] = -1; simple_machine_start_x = 0xa0; simple_machine_start_y = 0x50; simple_machines_answer[0].x = 0x3f; simple_machines_answer[0].y = 0x35; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3e86); simple_machines_answer[0].type = 5; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0x41; simple_machines_answer[0].inner[0].r.y = 0x37; simple_machines_answer[0].inner[0].r.w = 0xa2; simple_machines_answer[0].inner[0].r.h = 0x1e; simple_machine_instances[5] = '\x01'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b43); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b44); break; case 4: DAT_004514be = 3; DAT_004514c0 = 2; SHORT_ARRAY_004514ec[0] = 0x3e8b; SHORT_ARRAY_004514ce[0] = 0x3e87; SHORT_ARRAY_004514ce[1] = 0x3e88; SHORT_ARRAY_004514ec[1] = 0x3e87; SHORT_ARRAY_004514ce[2] = 0x3e84; SHORT_ARRAY_004514ce[3] = -1; simple_machine_start_x = 0xdd; simple_machine_start_y = 0x3c; simple_machines_answer[0].x = 0x27; simple_machines_answer[0].y = 0x3a; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3e87); simple_machines_answer[0].type = 7; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0x2f; simple_machines_answer[0].inner[0].r.y = 0x70; simple_machines_answer[0].inner[0].r.w = 0x44; simple_machines_answer[0].inner[0].r.h = 0x60; simple_machines_answer[0].inner[1].en = 1; simple_machines_answer[0].inner[1].r.x = 0x6c; simple_machines_answer[0].inner[1].r.y = 0x29; simple_machines_answer[0].inner[1].r.w = 0x3a; simple_machines_answer[0].inner[1].r.h = 0x55; simple_machine_instances[7] = '\x01'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b01); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b02); break; case 5: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x3e82; SHORT_ARRAY_004514ce[0] = 0x3e89; SHORT_ARRAY_004514ce[1] = 0x3e8a; SHORT_ARRAY_004514ce[2] = -1; simple_machine_start_x = 0xcf; simple_machine_start_y = 0x3a; simple_machines_answer[0].x = 0x14; simple_machines_answer[0].y = 0; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3e88); simple_machines_answer[0].type = 4; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0x14; simple_machines_answer[0].inner[0].r.y = 0; simple_machines_answer[0].inner[0].r.w = 0x1e; simple_machines_answer[0].inner[0].r.h = 0x1e; simple_machines_answer[1].x = 0x14; simple_machines_answer[1].y = 0x49; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3e89); simple_machines_answer[1].type = 4; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0x14; simple_machines_answer[1].inner[0].r.y = 0x49; simple_machines_answer[1].inner[0].r.w = 0x1e; simple_machines_answer[1].inner[0].r.h = 0x1e; simple_machine_instances[4] = '\x02'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b3d); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b3e); break; case 6: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x3e81; SHORT_ARRAY_004514ce[0] = 0x3e85; SHORT_ARRAY_004514ce[1] = 0x3e86; SHORT_ARRAY_004514ce[2] = -1; simple_machine_start_x = 0xb8; simple_machine_start_y = 0x41; simple_machines_answer[0].x = 0x52; simple_machines_answer[0].y = 0x18; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3e8a); simple_machines_answer[0].type = 1; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0x50; simple_machines_answer[0].inner[0].r.y = 0x1d; simple_machines_answer[0].inner[0].r.w = 0x4d; simple_machines_answer[0].inner[0].r.h = 0x34; simple_machines_answer[0].inner[1].en = 1; simple_machines_answer[0].inner[1].r.x = 0x62; simple_machines_answer[0].inner[1].r.y = 0x4f; simple_machines_answer[0].inner[1].r.w = 0x5e; simple_machines_answer[0].inner[1].r.h = 0x32; simple_machines_answer[0].inner[2].en = 1; simple_machines_answer[0].inner[2].r.x = 0x82; simple_machines_answer[0].inner[2].r.y = 0x81; simple_machines_answer[0].inner[2].r.w = 0xaa; simple_machines_answer[0].inner[2].r.h = 0x47; simple_machines_answer[1].x = 0; simple_machines_answer[1].y = 0x29; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3e8b); simple_machines_answer[1].type = 1; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 4; simple_machines_answer[1].inner[0].r.y = 0x5e; simple_machines_answer[1].inner[0].r.w = 0x23; simple_machines_answer[1].inner[0].r.h = 0x23; simple_machines_answer[1].inner[1].en = 1; simple_machines_answer[1].inner[1].r.x = 0x1a; simple_machines_answer[1].inner[1].r.y = 0x35; simple_machines_answer[1].inner[1].r.w = 0x24; simple_machines_answer[1].inner[1].r.h = 0x2a; simple_machine_instances[1] = '\x02'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b5c); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b5d); break; case 7: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x3e82; SHORT_ARRAY_004514ce[0] = 0x3e89; SHORT_ARRAY_004514ce[1] = 0x3e8a; SHORT_ARRAY_004514ce[2] = -1; simple_machine_start_x = 0x96; simple_machine_start_y = 0x50; simple_machines_answer[0].x = 2; simple_machines_answer[0].y = 0x4f; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3e8c); simple_machines_answer[0].type = 4; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 3; simple_machines_answer[0].inner[0].r.y = 0x4f; uVar3 = aseq_get_img_w((int)simple_machines_answer[0].aseq,0); simple_machines_answer[0].inner[0].r.w = (word)uVar3; uVar3 = aseq_get_img_h((int)simple_machines_answer[0].aseq,0); simple_machines_answer[0].inner[0].r.h = (word)uVar3; simple_machines_answer[1].x = 0x111; simple_machines_answer[1].y = 0x4f; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3e8d); simple_machines_answer[1].type = 4; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0x111; simple_machines_answer[1].inner[0].r.y = 0x4f; uVar3 = aseq_get_img_w((int)simple_machines_answer[1].aseq,0); simple_machines_answer[1].inner[0].r.w = (word)uVar3; uVar3 = aseq_get_img_h((int)simple_machines_answer[1].aseq,0); simple_machines_answer[1].inner[0].r.h = (word)uVar3; simple_machine_instances[4] = '\x02'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b19); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b1a); break; case 8: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x3e89; SHORT_ARRAY_004514ce[0] = 0x3e90; SHORT_ARRAY_004514ce[1] = 0x3e91; SHORT_ARRAY_004514ce[2] = -1; simple_machine_start_x = 200; simple_machine_start_y = 0x28; simple_machines_answer[0].x = 0x6b; simple_machines_answer[0].y = 0x54; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3e8e); simple_machines_answer[0].type = 2; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0x69; simple_machines_answer[0].inner[0].r.y = 0x50; simple_machines_answer[0].inner[0].r.w = 0x19; simple_machines_answer[0].inner[0].r.h = 0x19; simple_machines_answer[1].x = 0x5c; simple_machines_answer[1].y = 0x93; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3e8f); simple_machines_answer[1].type = 2; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0x5a; simple_machines_answer[1].inner[0].r.y = 0x8c; simple_machines_answer[1].inner[0].r.w = 0x19; simple_machines_answer[1].inner[0].r.h = 0x19; simple_machine_instances[2] = '\x02'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b32); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b33); break; case 9: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x3e89; SHORT_ARRAY_004514ce[0] = 0x3e90; SHORT_ARRAY_004514ce[1] = 0x3e91; SHORT_ARRAY_004514ce[2] = -1; simple_machine_start_x = 0xa0; simple_machine_start_y = 0x32; simple_machines_answer[0].x = 0x68; simple_machines_answer[0].y = 0x32; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3e91); simple_machines_answer[0].type = 2; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0x54; simple_machines_answer[0].inner[0].r.y = 0x32; simple_machines_answer[0].inner[0].r.w = 0x4a; simple_machines_answer[0].inner[0].r.h = 0x3b; simple_machines_answer[1].x = 0x13; simple_machines_answer[1].y = 0x68; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3e92); simple_machines_answer[1].type = 2; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0x13; simple_machines_answer[1].inner[0].r.y = 0x68; simple_machines_answer[1].inner[0].r.w = 0x35; simple_machines_answer[1].inner[0].r.h = 0x3a; simple_machines_answer[2].x = 0x5e; simple_machines_answer[2].y = 0xa0; simple_machines_answer[2].aseq = (aseq_anim_state_struct *)load_aseq(0x3e93); simple_machines_answer[2].type = 2; simple_machines_answer[2].inner[0].en = 1; simple_machines_answer[2].inner[0].r.x = 0x5e; simple_machines_answer[2].inner[0].r.y = 0xa0; simple_machines_answer[2].inner[0].r.w = 0x3f; simple_machines_answer[2].inner[0].r.h = 0x31; simple_machine_instances[2] = '\x03'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x3e90); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x3e94); break; case 10: DAT_004514be = 6; DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3e85; SHORT_ARRAY_004514ce[0] = 0x3e8b; SHORT_ARRAY_004514ce[1] = 0x3e8c; SHORT_ARRAY_004514ce[2] = 0x3e8d; SHORT_ARRAY_004514ec[1] = 0x3e8b; SHORT_ARRAY_004514ce[3] = 0x3e87; SHORT_ARRAY_004514ce[4] = 0x3e88; SHORT_ARRAY_004514ec[2] = 0x3e84; SHORT_ARRAY_004514ce[5] = 0x3e82; SHORT_ARRAY_004514ce[6] = -1; simple_machine_start_x = 0xa0; simple_machine_start_y = 0x50; simple_machines_answer[0].x = 0x30; simple_machines_answer[0].y = 0x66; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3e96); simple_machines_answer[0].type = 3; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0x30; simple_machines_answer[0].inner[0].r.y = 0x66; simple_machines_answer[0].inner[0].r.w = 0x1e; simple_machines_answer[0].inner[0].r.h = 0x1e; simple_machines_answer[1].x = 0; simple_machines_answer[1].y = 0; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3e97); simple_machines_answer[1].type = 6; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0; simple_machines_answer[1].inner[0].r.y = 0x46; simple_machines_answer[1].inner[0].r.w = 0x54; simple_machines_answer[1].inner[0].r.h = 0x57; simple_machines_answer[1].inner[1].en = 1; simple_machines_answer[1].inner[1].r.x = 0x53; simple_machines_answer[1].inner[1].r.y = 100; simple_machines_answer[1].inner[1].r.w = 0xca; simple_machines_answer[1].inner[1].r.h = 0x1b; simple_machine_instances[6] = '\x01'; simple_machine_instances[3] = '\x01'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x3e95); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x3e98); break; case 0xb: DAT_004514be = 5; DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3e8b; SHORT_ARRAY_004514ce[0] = 0x3e87; SHORT_ARRAY_004514ce[1] = 0x3e88; SHORT_ARRAY_004514ec[1] = 0x3e84; SHORT_ARRAY_004514ce[2] = 0x3e82; SHORT_ARRAY_004514ec[2] = 0x3e8a; SHORT_ARRAY_004514ce[3] = 0x3e92; SHORT_ARRAY_004514ce[4] = 0x3e93; SHORT_ARRAY_004514ce[5] = -1; simple_machine_start_x = 0x74; simple_machine_start_y = 0x40; simple_machines_answer[0].x = 0; simple_machines_answer[0].y = 0; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3e9a); simple_machines_answer[0].type = 6; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0; simple_machines_answer[0].inner[0].r.y = 0; simple_machines_answer[0].inner[0].r.w = 0x7f; simple_machines_answer[0].inner[0].r.h = 0x32; simple_machines_answer[0].inner[1].en = 1; simple_machines_answer[0].inner[1].r.x = 0x40; simple_machines_answer[0].inner[1].r.y = 0x32; simple_machines_answer[0].inner[1].r.w = 0x72; simple_machines_answer[0].inner[1].r.h = 0x3f; simple_machines_answer[0].inner[2].en = 1; simple_machines_answer[0].inner[2].r.x = 0xb1; simple_machines_answer[0].inner[2].r.y = 0x5f; simple_machines_answer[0].inner[2].r.w = 0x73; simple_machines_answer[0].inner[2].r.h = 0x32; simple_machines_answer[0].inner[3].en = 1; simple_machines_answer[0].inner[3].r.x = 0x122; simple_machines_answer[0].inner[3].r.y = 0x72; simple_machines_answer[0].inner[3].r.w = 0x49; simple_machines_answer[0].inner[3].r.h = 0x30; simple_machines_answer[1].x = 0xfa; simple_machines_answer[1].y = 0x5b; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3e9b); simple_machines_answer[1].type = 0; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0xfa; simple_machines_answer[1].inner[0].r.y = 0x5b; simple_machines_answer[1].inner[0].r.w = 0x5b; simple_machines_answer[1].inner[0].r.h = 0x70; simple_machine_instances[6] = '\x01'; simple_machine_instances[0] = '\x01'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x3e99); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x3e9c); break; case 0xc: DAT_004514be = 5; DAT_004514c0 = 2; SHORT_ARRAY_004514ec[0] = 0x3e85; SHORT_ARRAY_004514ce[0] = 0x3e8b; SHORT_ARRAY_004514ce[1] = 0x3e8c; SHORT_ARRAY_004514ce[2] = 0x3e8d; SHORT_ARRAY_004514ec[1] = 0x3e8a; SHORT_ARRAY_004514ce[3] = 0x3e92; SHORT_ARRAY_004514ce[4] = 0x3e93; SHORT_ARRAY_004514ce[5] = -1; simple_machine_start_x = 0xbc; simple_machine_start_y = 0x32; simple_machines_answer[0].x = 0x62; simple_machines_answer[0].y = 0x4b; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3e9d); simple_machines_answer[0].type = 3; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0x62; simple_machines_answer[0].inner[0].r.y = 0x4b; simple_machines_answer[0].inner[0].r.w = 0x32; simple_machines_answer[0].inner[0].r.h = 0x32; simple_machines_answer[1].x = 0x3b; simple_machines_answer[1].y = 0; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3e9f); simple_machines_answer[1].type = 0; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0x3b; simple_machines_answer[1].inner[0].r.y = 0; simple_machines_answer[1].inner[0].r.w = 0x3c; simple_machines_answer[1].inner[0].r.h = 0x32; simple_machine_instances[0] = '\x01'; simple_machine_instances[3] = '\x01'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b1e); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b1f); break; case 0xd: DAT_004514be = 5; DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3e8b; SHORT_ARRAY_004514ce[0] = 0x3e87; SHORT_ARRAY_004514ce[1] = 0x3e88; SHORT_ARRAY_004514ec[1] = 0x3e87; SHORT_ARRAY_004514ce[2] = 0x3e84; SHORT_ARRAY_004514ec[2] = 0x3e82; SHORT_ARRAY_004514ce[3] = 0x3e89; SHORT_ARRAY_004514ce[4] = 0x3e8a; SHORT_ARRAY_004514ce[5] = -1; simple_machine_start_x = 0x90; simple_machine_start_y = 0x50; simple_machines_answer[0].x = 0; simple_machines_answer[0].y = 0; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3ea0); simple_machines_answer[0].type = 7; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0; simple_machines_answer[0].inner[0].r.y = 0; simple_machines_answer[0].inner[0].r.w = 100; simple_machines_answer[0].inner[0].r.h = 0x1b; simple_machines_answer[0].inner[1].en = 1; simple_machines_answer[0].inner[1].r.x = 0x62; simple_machines_answer[0].inner[1].r.y = 0x16; simple_machines_answer[0].inner[1].r.w = 0x32; simple_machines_answer[0].inner[1].r.h = 0x28; simple_machines_answer[0].inner[2].en = 1; simple_machines_answer[0].inner[2].r.x = 0x93; simple_machines_answer[0].inner[2].r.y = 0x37; simple_machines_answer[0].inner[2].r.w = 0x44; simple_machines_answer[0].inner[2].r.h = 0x30; simple_machines_answer[0].inner[3].en = 1; simple_machines_answer[0].inner[3].r.x = 0xcc; simple_machines_answer[0].inner[3].r.y = 0x5f; simple_machines_answer[0].inner[3].r.w = 0x24; simple_machines_answer[0].inner[3].r.h = 0x29; simple_machines_answer[0].inner[4].en = 1; simple_machines_answer[0].inner[4].r.x = 0xf0; simple_machines_answer[0].inner[4].r.y = 0x71; simple_machines_answer[0].inner[4].r.w = 0x50; simple_machines_answer[0].inner[4].r.h = 0x3d; simple_machines_answer[1].x = 0xed; simple_machines_answer[1].y = 0x90; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3ea1); simple_machines_answer[1].type = 4; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0xec; simple_machines_answer[1].inner[0].r.y = 0x8f; simple_machines_answer[1].inner[0].r.w = 0x1d; simple_machines_answer[1].inner[0].r.h = 0x1a; simple_machine_instances[4] = '\x01'; simple_machine_instances[7] = '\x01'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b25); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b26); break; case 0xe: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x3e89; SHORT_ARRAY_004514ce[0] = 0x3e90; SHORT_ARRAY_004514ce[1] = 0x3e91; SHORT_ARRAY_004514ce[2] = -1; simple_machine_start_x = 0x7c; simple_machine_start_y = 0x39; simple_machines_answer[0].x = 0; simple_machines_answer[0].y = 0; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3ea3); simple_machines_answer[0].type = 2; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0; simple_machines_answer[0].inner[0].r.y = 0; simple_machines_answer[0].inner[0].r.w = 0x61; simple_machines_answer[0].inner[0].r.h = 0x5a; simple_machines_answer[1].x = 2; simple_machines_answer[1].y = 0x7c; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3ed3); simple_machines_answer[1].type = 2; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0; simple_machines_answer[1].inner[0].r.y = 0x7c; simple_machines_answer[1].inner[0].r.w = 99; simple_machines_answer[1].inner[0].r.h = 0x5a; simple_machine_instances[2] = '\x02'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x3ea2); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x3ed4); break; case 0xf: DAT_004514be = 5; DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3e8b; SHORT_ARRAY_004514ce[0] = 0x3e87; SHORT_ARRAY_004514ce[1] = 0x3e88; SHORT_ARRAY_004514ec[1] = 16000; SHORT_ARRAY_004514ce[2] = 0x3e81; SHORT_ARRAY_004514ec[2] = 0x3e8a; SHORT_ARRAY_004514ce[3] = 0x3e92; SHORT_ARRAY_004514ce[4] = 0x3e93; SHORT_ARRAY_004514ce[5] = -1; simple_machine_start_x = 0x96; simple_machine_start_y = 0x3c; simple_machines_answer[0].x = 0xb; simple_machines_answer[0].y = 0x49; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3ea4); simple_machines_answer[0].type = 5; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0xc; simple_machines_answer[0].inner[0].r.y = 0x4a; simple_machines_answer[0].inner[0].r.w = 0x90; simple_machines_answer[0].inner[0].r.h = 0x50; simple_machines_answer[0].inner[1].en = 1; simple_machines_answer[0].inner[1].r.x = 0x9b; simple_machines_answer[0].inner[1].r.y = 0x6f; simple_machines_answer[0].inner[1].r.w = 0xaa; simple_machines_answer[0].inner[1].r.h = 0x44; simple_machines_answer[1].x = 0; simple_machines_answer[1].y = 0x5b; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3ea5); simple_machines_answer[1].type = 0; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0; simple_machines_answer[1].inner[0].r.y = 0x5b; simple_machines_answer[1].inner[0].r.w = 0x5a; simple_machines_answer[1].inner[0].r.h = 0x34; simple_machines_answer[2].x = 0xce; simple_machines_answer[2].y = 0xa0; simple_machines_answer[2].aseq = (aseq_anim_state_struct *)load_aseq(0x3ea6); simple_machines_answer[2].type = 0; simple_machines_answer[2].inner[0].en = 1; simple_machines_answer[2].inner[0].r.x = 0xce; simple_machines_answer[2].inner[0].r.y = 0xa0; simple_machines_answer[2].inner[0].r.w = 0x58; simple_machines_answer[2].inner[0].r.h = 0x2d; simple_machine_instances[5] = '\x01'; simple_machine_instances[0] = '\x02'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b55); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b56); break; case 0x10: DAT_004514be = 6; DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3e89; SHORT_ARRAY_004514ce[0] = 0x3e90; SHORT_ARRAY_004514ce[1] = 0x3e91; SHORT_ARRAY_004514ec[1] = 0x3e8b; SHORT_ARRAY_004514ce[2] = 0x3e87; SHORT_ARRAY_004514ce[3] = 0x3e88; SHORT_ARRAY_004514ec[2] = 16000; SHORT_ARRAY_004514ce[4] = 0x3e81; SHORT_ARRAY_004514ec[3] = 0x3e87; SHORT_ARRAY_004514ce[5] = 0x3e84; SHORT_ARRAY_004514ce[6] = -1; simple_machine_start_x = 200; simple_machine_start_y = 0x32; simple_machines_answer[0].x = 0; simple_machines_answer[0].y = 0x7b; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3ea7); simple_machines_answer[0].type = 7; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0; simple_machines_answer[0].inner[0].r.y = 0x7b; simple_machines_answer[0].inner[0].r.w = 0x7c; simple_machines_answer[0].inner[0].r.h = 0x1f; simple_machines_answer[0].inner[1].en = 1; simple_machines_answer[0].inner[1].r.x = 0x18; simple_machines_answer[0].inner[1].r.y = 0x99; simple_machines_answer[0].inner[1].r.w = 0x78; simple_machines_answer[0].inner[1].r.h = 10; simple_machines_answer[0].inner[2].en = 1; simple_machines_answer[0].inner[2].r.x = 0x31; simple_machines_answer[0].inner[2].r.y = 0xa2; simple_machines_answer[0].inner[2].r.w = 0x9d; simple_machines_answer[0].inner[2].r.h = 0xc; simple_machines_answer[0].inner[3].en = 1; simple_machines_answer[0].inner[3].r.x = 0x52; simple_machines_answer[0].inner[3].r.y = 0xad; simple_machines_answer[0].inner[3].r.w = 0x27; simple_machines_answer[0].inner[3].r.h = 0x11; simple_machines_answer[0].inner[4].en = 1; simple_machines_answer[0].inner[4].r.x = 0x24; simple_machines_answer[0].inner[4].r.y = 0xbd; simple_machines_answer[0].inner[4].r.w = 0x2b; simple_machines_answer[0].inner[4].r.h = 0xd; simple_machines_answer[1].x = 0; simple_machines_answer[1].y = 0x96; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3ea8); simple_machines_answer[1].type = 7; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0; simple_machines_answer[1].inner[0].r.y = 0x99; simple_machines_answer[1].inner[0].r.w = 0x19; simple_machines_answer[1].inner[0].r.h = 0xf; simple_machines_answer[1].inner[1].en = 1; simple_machines_answer[1].inner[1].r.x = 0x18; simple_machines_answer[1].inner[1].r.y = 0xa2; simple_machines_answer[1].inner[1].r.w = 0x34; simple_machines_answer[1].inner[1].r.h = 0x22; simple_machines_answer[1].inner[2].en = 1; simple_machines_answer[1].inner[2].r.x = 0x4c; simple_machines_answer[1].inner[2].r.y = 0xb7; simple_machines_answer[1].inner[2].r.w = 0x58; simple_machines_answer[1].inner[2].r.h = 0x3b; simple_machines_answer[1].inner[3].en = 1; simple_machines_answer[1].inner[3].r.x = 0xa2; simple_machines_answer[1].inner[3].r.y = 200; simple_machines_answer[1].inner[3].r.w = 0x33; simple_machines_answer[1].inner[3].r.h = 0x28; simple_machines_answer[2].x = 0xb2; simple_machines_answer[2].y = 0xb4; simple_machines_answer[2].aseq = (aseq_anim_state_struct *)load_aseq(0x3ea9); simple_machines_answer[2].type = 2; simple_machines_answer[2].inner[0].en = 1; simple_machines_answer[2].inner[0].r.x = 0xb6; simple_machines_answer[2].inner[0].r.y = 0xb5; simple_machines_answer[2].inner[0].r.w = 0x27; simple_machines_answer[2].inner[0].r.h = 0x16; simple_machines_answer[3].x = 0xb7; simple_machines_answer[3].y = 0xca; simple_machines_answer[3].aseq = (aseq_anim_state_struct *)load_aseq(0x3eaa); simple_machines_answer[3].type = 2; simple_machines_answer[3].inner[0].en = 1; simple_machines_answer[3].inner[0].r.x = 0xba; simple_machines_answer[3].inner[0].r.y = 0xcf; simple_machines_answer[3].inner[0].r.w = 0x24; simple_machines_answer[3].inner[0].r.h = 0x1f; simple_machines_answer[4].x = 0x3d; simple_machines_answer[4].y = 0; simple_machines_answer[4].aseq = (aseq_anim_state_struct *)load_aseq(0x3eab); simple_machines_answer[4].type = 5; simple_machines_answer[4].inner[0].en = 1; simple_machines_answer[4].inner[0].r.x = 0x3e; simple_machines_answer[4].inner[0].r.y = 0; simple_machines_answer[4].inner[0].r.w = 0x2c; simple_machines_answer[4].inner[0].r.h = 0x51; simple_machines_answer[4].inner[1].en = 1; simple_machines_answer[4].inner[1].r.x = 0x67; simple_machines_answer[4].inner[1].r.y = 0x28; simple_machines_answer[4].inner[1].r.w = 0x21; simple_machines_answer[4].inner[1].r.h = 100; simple_machines_answer[4].inner[2].en = 1; simple_machines_answer[4].inner[2].r.x = 0x86; simple_machines_answer[4].inner[2].r.y = 0x5c; simple_machines_answer[4].inner[2].r.w = 0x1d; simple_machines_answer[4].inner[2].r.h = 0x58; simple_machines_answer[4].inner[3].en = 1; simple_machines_answer[4].inner[3].r.x = 0xa2; simple_machines_answer[4].inner[3].r.y = 0x87; simple_machines_answer[4].inner[3].r.w = 0x26; simple_machines_answer[4].inner[3].r.h = 0x2d; simple_machine_instances[5] = '\x01'; simple_machine_instances[7] = '\x02'; simple_machine_instances[2] = '\x02'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b12); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b13); break; case 0x11: DAT_004514be = 6; DAT_004514c0 = 3; SHORT_ARRAY_004514ec[0] = 0x3e85; SHORT_ARRAY_004514ce[0] = 0x3e8b; SHORT_ARRAY_004514ce[1] = 0x3e8c; SHORT_ARRAY_004514ce[2] = 0x3e8d; SHORT_ARRAY_004514ec[1] = 0x3e8b; SHORT_ARRAY_004514ce[3] = 0x3e87; SHORT_ARRAY_004514ce[4] = 0x3e88; SHORT_ARRAY_004514ec[2] = 16000; SHORT_ARRAY_004514ce[5] = 0x3e81; SHORT_ARRAY_004514ce[6] = -1; simple_machine_start_x = 0xaa; simple_machine_start_y = 0x50; simple_machines_answer[0].x = 7; simple_machines_answer[0].y = 0x21; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3eac); simple_machines_answer[0].type = 5; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 8; simple_machines_answer[0].inner[0].r.y = 0x2e; simple_machines_answer[0].inner[0].r.w = 0x34; simple_machines_answer[0].inner[0].r.h = 0x18; simple_machines_answer[0].inner[1].en = 1; simple_machines_answer[0].inner[1].r.x = 0x3c; simple_machines_answer[0].inner[1].r.y = 0x28; simple_machines_answer[0].inner[1].r.w = 0x29; simple_machines_answer[0].inner[1].r.h = 0x37; simple_machines_answer[0].inner[2].en = 1; simple_machines_answer[0].inner[2].r.x = 100; simple_machines_answer[0].inner[2].r.y = 0x45; simple_machines_answer[0].inner[2].r.w = 0x33; simple_machines_answer[0].inner[2].r.h = 0x3d; simple_machines_answer[0].inner[3].en = 1; simple_machines_answer[0].inner[3].r.x = 0x96; simple_machines_answer[0].inner[3].r.y = 0x69; simple_machines_answer[0].inner[3].r.w = 0x32; simple_machines_answer[0].inner[3].r.h = 0x38; simple_machines_answer[0].inner[4].en = 1; simple_machines_answer[0].inner[4].r.x = 0xc6; simple_machines_answer[0].inner[4].r.y = 0x85; simple_machines_answer[0].inner[4].r.w = 0x24; simple_machines_answer[0].inner[4].r.h = 0x29; simple_machines_answer[0].inner[5].en = 1; simple_machines_answer[0].inner[5].r.x = 0xea; simple_machines_answer[0].inner[5].r.y = 0x96; simple_machines_answer[0].inner[5].r.w = 0x2b; simple_machines_answer[0].inner[5].r.h = 0x22; simple_machines_answer[1].x = 0; simple_machines_answer[1].y = 0; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3ead); simple_machines_answer[1].type = 5; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0; simple_machines_answer[1].inner[0].r.y = 0; simple_machines_answer[1].inner[0].r.w = 0x48; simple_machines_answer[1].inner[0].r.h = 0x18; simple_machines_answer[1].inner[1].en = 1; simple_machines_answer[1].inner[1].r.x = 0x3c; simple_machines_answer[1].inner[1].r.y = 6; simple_machines_answer[1].inner[1].r.w = 0x2b; simple_machines_answer[1].inner[1].r.h = 0x2c; simple_machines_answer[1].inner[2].en = 1; simple_machines_answer[1].inner[2].r.x = 0x67; simple_machines_answer[1].inner[2].r.y = 0x12; simple_machines_answer[1].inner[2].r.w = 0x2c; simple_machines_answer[1].inner[2].r.h = 0x21; simple_machines_answer[1].inner[3].en = 1; simple_machines_answer[1].inner[3].r.x = 0x91; simple_machines_answer[1].inner[3].r.y = 0x1c; simple_machines_answer[1].inner[3].r.w = 0x73; simple_machines_answer[1].inner[3].r.h = 0x15; simple_machines_answer[2].x = 0x102; simple_machines_answer[2].y = 0x19; simple_machines_answer[2].aseq = (aseq_anim_state_struct *)load_aseq(0x3eae); simple_machines_answer[2].type = 3; simple_machines_answer[2].inner[0].en = 1; simple_machines_answer[2].inner[0].r.x = 0xfa; simple_machines_answer[2].inner[0].r.y = 0x14; simple_machines_answer[2].inner[0].r.w = 0x28; simple_machines_answer[2].inner[0].r.h = 0x28; simple_machine_instances[3] = '\x01'; simple_machine_instances[5] = '\x02'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b61); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b62); break; case 0x12: DAT_004514be = 8; DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3e89; SHORT_ARRAY_004514ec[1] = 0x3e8b; SHORT_ARRAY_004514ec[2] = 16000; SHORT_ARRAY_004514ec[3] = 0x3e85; SHORT_ARRAY_004514ce[0] = 0x3e90; SHORT_ARRAY_004514ce[1] = 0x3e91; SHORT_ARRAY_004514ce[2] = 0x3e87; SHORT_ARRAY_004514ce[3] = 0x3e88; SHORT_ARRAY_004514ce[4] = 0x3e81; SHORT_ARRAY_004514ce[5] = 0x3e8b; SHORT_ARRAY_004514ce[6] = 0x3e8c; SHORT_ARRAY_004514ce[7] = 0x3e8d; SHORT_ARRAY_004514ce[8] = -1; simple_machine_start_x = 0xa0; simple_machine_start_y = 0x46; simple_machines_answer[0].x = 0; simple_machines_answer[0].y = 0; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3eaf); simple_machines_answer[0].type = 5; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 5; simple_machines_answer[0].inner[0].r.y = 5; simple_machines_answer[0].inner[0].r.w = 0x37; simple_machines_answer[0].inner[0].r.h = 0x32; simple_machines_answer[0].inner[1].en = 1; simple_machines_answer[0].inner[1].r.x = 0x3c; simple_machines_answer[0].inner[1].r.y = 0x2a; simple_machines_answer[0].inner[1].r.w = 0x37; simple_machines_answer[0].inner[1].r.h = 0x1e; simple_machines_answer[0].inner[2].en = 1; simple_machines_answer[0].inner[2].r.x = 0x6f; simple_machines_answer[0].inner[2].r.y = 0x38; simple_machines_answer[0].inner[2].r.w = 0x47; simple_machines_answer[0].inner[2].r.h = 0x26; simple_machines_answer[0].inner[3].en = 1; simple_machines_answer[0].inner[3].r.x = 0xb5; simple_machines_answer[0].inner[3].r.y = 0x4c; simple_machines_answer[0].inner[3].r.w = 100; simple_machines_answer[0].inner[3].r.h = 0x1d; simple_machines_answer[1].x = 0; simple_machines_answer[1].y = 0x30; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3eb1); simple_machines_answer[1].type = 5; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 5; simple_machines_answer[1].inner[0].r.y = 100; simple_machines_answer[1].inner[0].r.w = 0x37; simple_machines_answer[1].inner[0].r.h = 0x32; simple_machines_answer[1].inner[1].en = 1; simple_machines_answer[1].inner[1].r.x = 0x39; simple_machines_answer[1].inner[1].r.y = 0x59; simple_machines_answer[1].inner[1].r.w = 0x38; simple_machines_answer[1].inner[1].r.h = 0x17; simple_machines_answer[1].inner[2].en = 1; simple_machines_answer[1].inner[2].r.x = 0x6f; simple_machines_answer[1].inner[2].r.y = 0x38; simple_machines_answer[1].inner[2].r.w = 0x47; simple_machines_answer[1].inner[2].r.h = 0x26; simple_machines_answer[1].inner[3].en = 1; simple_machines_answer[1].inner[3].r.x = 0xb6; simple_machines_answer[1].inner[3].r.y = 0x30; simple_machines_answer[1].inner[3].r.w = 100; simple_machines_answer[1].inner[3].r.h = 0x1d; simple_machines_answer[2].x = 0xaf; simple_machines_answer[2].y = 0x34; simple_machines_answer[2].aseq = (aseq_anim_state_struct *)load_aseq(0x3eb2); simple_machines_answer[2].type = 2; simple_machines_answer[2].inner[0].en = 1; simple_machines_answer[2].inner[0].r.x = 0xb6; simple_machines_answer[2].inner[0].r.y = 0x30; simple_machines_answer[2].inner[0].r.w = 100; simple_machines_answer[2].inner[0].r.h = 0x1d; simple_machines_answer[3].x = 0x9f; simple_machines_answer[3].y = 0x47; simple_machines_answer[3].aseq = (aseq_anim_state_struct *)load_aseq(0x3eb0); simple_machines_answer[3].type = 2; simple_machines_answer[3].inner[0].en = 1; simple_machines_answer[3].inner[0].r.x = 0xb5; simple_machines_answer[3].inner[0].r.y = 0x4c; simple_machines_answer[3].inner[0].r.w = 100; simple_machines_answer[3].inner[0].r.h = 0x1d; simple_machines_answer[4].x = 0x8c; simple_machines_answer[4].y = 0x49; simple_machines_answer[4].aseq = (aseq_anim_state_struct *)load_aseq(0x3eb3); simple_machines_answer[4].type = 3; simple_machines_answer[4].inner[0].en = 1; simple_machines_answer[4].inner[0].r.x = 0x8c; simple_machines_answer[4].inner[0].r.y = 0x49; simple_machines_answer[4].inner[0].r.w = 0x14; simple_machines_answer[4].inner[0].r.h = 0x14; simple_machine_instances[5] = '\x02'; simple_machine_instances[3] = '\x01'; simple_machine_instances[2] = '\x02'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b48); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b49); break; case 0x13: DAT_004514be = 2; DAT_004514c0 = 1; SHORT_ARRAY_004514ec[0] = 0x3e81; SHORT_ARRAY_004514ce[0] = 0x3e85; SHORT_ARRAY_004514ce[1] = 0x3e86; SHORT_ARRAY_004514ce[2] = -1; simple_machine_start_x = 0x96; simple_machine_start_y = 0x46; simple_machines_answer[0].x = 0x4b; simple_machines_answer[0].y = 0x72; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3eb4); simple_machines_answer[0].type = 1; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0x4b; simple_machines_answer[0].inner[0].r.y = 0x72; simple_machines_answer[0].inner[0].r.w = 0x14; simple_machines_answer[0].inner[0].r.h = 0x14; simple_machines_answer[1].x = 0x59; simple_machines_answer[1].y = 0x76; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3eb5); simple_machines_answer[1].type = 1; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0x59; simple_machines_answer[1].inner[0].r.y = 0x76; simple_machines_answer[1].inner[0].r.w = 0x14; simple_machines_answer[1].inner[0].r.h = 0x14; simple_machines_answer[2].x = 0x69; simple_machines_answer[2].y = 0x76; simple_machines_answer[2].aseq = (aseq_anim_state_struct *)load_aseq(0x3eb6); simple_machines_answer[2].type = 1; simple_machines_answer[2].inner[0].en = 1; simple_machines_answer[2].inner[0].r.x = 0x69; simple_machines_answer[2].inner[0].r.y = 0x76; simple_machines_answer[2].inner[0].r.w = 0x14; simple_machines_answer[2].inner[0].r.h = 0x14; simple_machines_answer[3].x = 0x79; simple_machines_answer[3].y = 0x7a; simple_machines_answer[3].aseq = (aseq_anim_state_struct *)load_aseq(0x3eb7); simple_machines_answer[3].type = 1; simple_machines_answer[3].inner[0].en = 1; simple_machines_answer[3].inner[0].r.x = 0x79; simple_machines_answer[3].inner[0].r.y = 0x7a; simple_machines_answer[3].inner[0].r.w = 0x14; simple_machines_answer[3].inner[0].r.h = 0x14; simple_machines_answer[4].x = 0x98; simple_machines_answer[4].y = 0x78; simple_machines_answer[4].aseq = (aseq_anim_state_struct *)load_aseq(0x3eb8); simple_machines_answer[4].type = 1; simple_machines_answer[4].inner[0].en = 1; simple_machines_answer[4].inner[0].r.x = 0x98; simple_machines_answer[4].inner[0].r.y = 0x78; simple_machines_answer[4].inner[0].r.w = 0x14; simple_machines_answer[4].inner[0].r.h = 0x14; simple_machines_answer[5].x = 0xa2; simple_machines_answer[5].y = 0x7a; simple_machines_answer[5].aseq = (aseq_anim_state_struct *)load_aseq(0x3eb9); simple_machines_answer[5].type = 1; simple_machines_answer[5].inner[0].en = 1; simple_machines_answer[5].inner[0].r.x = 0xa2; simple_machines_answer[5].inner[0].r.y = 0x7a; simple_machines_answer[5].inner[0].r.w = 0x14; simple_machines_answer[5].inner[0].r.h = 0x14; simple_machines_answer[6].x = 0xb2; simple_machines_answer[6].y = 0x74; simple_machines_answer[6].aseq = (aseq_anim_state_struct *)load_aseq(0x3eba); simple_machines_answer[6].type = 1; simple_machines_answer[6].inner[0].en = 1; simple_machines_answer[6].inner[0].r.x = 0xb2; simple_machines_answer[6].inner[0].r.y = 0x74; simple_machines_answer[6].inner[0].r.w = 0x14; simple_machines_answer[6].inner[0].r.h = 0x14; simple_machines_answer[7].x = 0xc1; simple_machines_answer[7].y = 0x77; simple_machines_answer[7].aseq = (aseq_anim_state_struct *)load_aseq(0x3ebb); simple_machines_answer[7].type = 1; simple_machines_answer[7].inner[0].en = 1; simple_machines_answer[7].inner[0].r.x = 0xc1; simple_machines_answer[7].inner[0].r.y = 0x77; simple_machines_answer[7].inner[0].r.w = 0x14; simple_machines_answer[7].inner[0].r.h = 0x14; simple_machines_answer[8].x = 0xd8; simple_machines_answer[8].y = 0x76; simple_machines_answer[8].aseq = (aseq_anim_state_struct *)load_aseq(0x3ebc); simple_machines_answer[8].type = 1; simple_machines_answer[8].inner[0].en = 1; simple_machines_answer[8].inner[0].r.x = 0xd8; simple_machines_answer[8].inner[0].r.y = 0x76; simple_machines_answer[8].inner[0].r.w = 0x14; simple_machines_answer[8].inner[0].r.h = 0x14; simple_machine_instances[1] = '\t'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(0x2b2c); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(0x2b2d); break; case 0x14: DAT_004514be = 6; DAT_004514c0 = 4; SHORT_ARRAY_004514ec[0] = 0x3e8b; SHORT_ARRAY_004514ce[0] = 0x3e87; SHORT_ARRAY_004514ce[1] = 0x3e88; SHORT_ARRAY_004514ec[1] = 16000; SHORT_ARRAY_004514ce[2] = 0x3e81; SHORT_ARRAY_004514ec[2] = 0x3e87; SHORT_ARRAY_004514ce[3] = 0x3e84; SHORT_ARRAY_004514ec[3] = 0x3e8a; SHORT_ARRAY_004514ce[4] = 0x3e92; SHORT_ARRAY_004514ce[5] = 0x3e93; SHORT_ARRAY_004514ce[6] = -1; simple_machine_start_x = 0xa0; simple_machine_start_y = 0x50; simple_machines_answer[0].x = 0x66; simple_machines_answer[0].y = 0x15; simple_machines_answer[0].aseq = (aseq_anim_state_struct *)load_aseq(0x3ebd); simple_machines_answer[0].type = 7; simple_machines_answer[0].inner[0].en = 1; simple_machines_answer[0].inner[0].r.x = 0x67; simple_machines_answer[0].inner[0].r.y = 0x35; simple_machines_answer[0].inner[0].r.w = 0x22; simple_machines_answer[0].inner[0].r.h = 0x46; simple_machines_answer[0].inner[1].en = 1; simple_machines_answer[0].inner[1].r.x = 0x73; simple_machines_answer[0].inner[1].r.y = 0x15; simple_machines_answer[0].inner[1].r.w = 0x3d; simple_machines_answer[0].inner[1].r.h = 0x21; simple_machines_answer[0].inner[2].en = 1; simple_machines_answer[0].inner[2].r.x = 0xae; simple_machines_answer[0].inner[2].r.y = 0x15; simple_machines_answer[0].inner[2].r.w = 0x4a; simple_machines_answer[0].inner[2].r.h = 0x12; simple_machines_answer[1].x = 0x99; simple_machines_answer[1].y = 0; simple_machines_answer[1].aseq = (aseq_anim_state_struct *)load_aseq(0x3ebe); simple_machines_answer[1].type = 5; simple_machines_answer[1].inner[0].en = 1; simple_machines_answer[1].inner[0].r.x = 0x9a; simple_machines_answer[1].inner[0].r.y = 0xe; simple_machines_answer[1].inner[0].r.w = 0x28; simple_machines_answer[1].inner[0].r.h = 7; simple_machines_answer[1].inner[1].en = 1; simple_machines_answer[1].inner[1].r.x = 0xb9; simple_machines_answer[1].inner[1].r.y = 5; simple_machines_answer[1].inner[1].r.w = 0x3c; simple_machines_answer[1].inner[1].r.h = 10; simple_machines_answer[1].inner[2].en = 1; simple_machines_answer[1].inner[2].r.x = 0xe9; simple_machines_answer[1].inner[2].r.y = 0; simple_machines_answer[1].inner[2].r.w = 0x1f; simple_machines_answer[1].inner[2].r.h = 0x48; simple_machines_answer[1].inner[3].en = 1; simple_machines_answer[1].inner[3].r.x = 0xf3; simple_machines_answer[1].inner[3].r.y = 0x47; simple_machines_answer[1].inner[3].r.w = 0x19; simple_machines_answer[1].inner[3].r.h = 0x4d; simple_machines_answer[2].x = 0xe8; simple_machines_answer[2].y = 0x21; simple_machines_answer[2].aseq = (aseq_anim_state_struct *)load_aseq(16063); simple_machines_answer[2].type = 5; simple_machines_answer[2].inner[0].en = 1; simple_machines_answer[2].inner[0].r.x = 0x106; simple_machines_answer[2].inner[0].r.y = 0x1f; simple_machines_answer[2].inner[0].r.w = 0x10; simple_machines_answer[2].inner[0].r.h = 0x78; simple_machines_answer[2].inner[1].en = 1; simple_machines_answer[2].inner[1].r.x = 0xe8; simple_machines_answer[2].inner[1].r.y = 0x96; simple_machines_answer[2].inner[1].r.w = 0x41; simple_machines_answer[2].inner[1].r.h = 0x34; simple_machines_answer[3].x = 8; simple_machines_answer[3].y = 0x8a; simple_machines_answer[3].aseq = (aseq_anim_state_struct *)load_aseq(16064); simple_machines_answer[3].type = 0; simple_machines_answer[3].inner[0].en = 1; simple_machines_answer[3].inner[0].r.x = 8; simple_machines_answer[3].inner[0].r.y = 0x8a; simple_machines_answer[3].inner[0].r.w = 0x1e; simple_machines_answer[3].inner[0].r.h = 0x1e; simple_machines_answer[4].x = 0x49; simple_machines_answer[4].y = 0x8a; simple_machines_answer[4].aseq = (aseq_anim_state_struct *)load_aseq(16065); simple_machines_answer[4].type = 0; simple_machines_answer[4].inner[0].en = 1; simple_machines_answer[4].inner[0].r.x = 0x49; simple_machines_answer[4].inner[0].r.y = 0x8a; simple_machines_answer[4].inner[0].r.w = 0x1e; simple_machines_answer[4].inner[0].r.h = 0x1e; simple_machine_instances[0] = '\x02'; simple_machine_instances[5] = '\x02'; simple_machine_instances[7] = '\x01'; simple_machine_grey = (aseq_anim_state_struct *)load_aseq(11020); simple_machine_colored = (aseq_anim_state_struct *)load_aseq(11021); } anim_state_xxx_list_insert_8004((undefined4 *)simple_machine_grey); aseq_set_pos_order((int)simple_machine_grey,simple_machine_start_x,simple_machine_start_y,1); DAT_004514c2 = 0x3e86; DAT_004514c4 = 16000; DAT_004514b4 = load_resource_item_0(0x3e86,(int *)&text); return; } void __stdcall simple_machine_draw_sidebar_icons(void) { short sVar1; short sVar2; short sVar3; gfxish_copy_otherbuf_to_dest_and_invalidate(6,0x5d,0x4d,0xbd); sVar3 = 0; do { if ('\0' < simple_machine_instances[sVar3]) { sVar1 = simple_machine_type_info_ARRAY_0044b62c[sVar3].sidebar_x; sVar2 = simple_machine_type_info_ARRAY_0044b62c[sVar3].sidebar_y; anim_state_xxx_list_remove((int *)simple_machine_icon_aseq[sVar3]); anim_state_xxx_list_insert_8004((undefined4 *)simple_machine_icon_aseq[sVar3]); aseq_set_pos_order((int)simple_machine_icon_aseq[sVar3],sVar1,sVar2,5); } sVar3 = sVar3 + 1; } while (sVar3 < 8); return; } void __stdcall simple_machine_draw_sidebar_counts(void) { ushort uVar1; short sVar2; short sVar3; byte local_10 [12]; load_nfnt(15000); sVar3 = 0; do { if ('\0' < simple_machine_instances[sVar3]) { uVar1 = simple_machine_type_info_ARRAY_0044b62c[sVar3].sidebar_text_x; sVar2 = simple_machine_type_info_ARRAY_0044b62c[sVar3].sidebar_text_y; sprintf(local_10); FUN_0043dc0b(15000,local_10,uVar1,sVar2,0); } sVar3 = sVar3 + 1; } while (sVar3 < 8); gfxish_invalidate_rect_wrap(6,0x5d,0x4d,0xbd); free_nfnt(15000); return; } void __cdecl simple_machine_calc_mouse_xxxxx(short param_1,short param_2) { short sVar1; short sVar2; undefined4 uVar3; undefined4 uVar4; aseq_anim_state_struct *paVar5; mouse_region *pmVar6; short sVar7; sVar7 = 0; do { if (simple_machine_state_struct_ARRAY_00451ac8[sVar7].machine_type == 9) break; sVar7 = sVar7 + 1; } while (sVar7 < 10); sVar1 = point_ARRAY_0044b57c[(short)cur_selected_simple_machine].x; sVar2 = point_ARRAY_0044b57c[(short)cur_selected_simple_machine].y; uVar3 = aseq_get_img_w((int)cur_simple_machine_icon_cur->anim_state,0); uVar4 = aseq_get_img_h((int)cur_simple_machine_icon_cur->anim_state,0); if ((((0x6b < param_1) && (0x1e < param_2)) && ((int)param_1 + (int)(short)(word)uVar3 < 0x1ef)) && ((int)param_2 + (int)(short)(word)uVar4 < 0x128)) { simple_machine_state_struct_ARRAY_00451ac8[sVar7].machine_type = cur_selected_simple_machine; simple_machine_state_struct_ARRAY_00451ac8[sVar7].mouse_rect.x = param_1; simple_machine_state_struct_ARRAY_00451ac8[sVar7].mouse_rect.y = param_2; simple_machine_state_struct_ARRAY_00451ac8[sVar7].mouse_rect.w = (word)uVar3; simple_machine_state_struct_ARRAY_00451ac8[sVar7].mouse_rect.h = (word)uVar4; simple_machine_state_struct_ARRAY_00451ac8[sVar7].x2 = sVar1 + param_1; simple_machine_state_struct_ARRAY_00451ac8[sVar7].y2 = sVar2 + param_2; paVar5 = (aseq_anim_state_struct *)load_aseq(cur_selected_simple_machine + 0x3ec2); simple_machine_state_struct_ARRAY_00451ac8[sVar7].aseq = paVar5; pmVar6 = (mouse_region *) mouse_region_new_up(simple_machine_state_struct_ARRAY_00451ac8[sVar7].mouse_rect.x, simple_machine_state_struct_ARRAY_00451ac8[sVar7].mouse_rect.y, simple_machine_state_struct_ARRAY_00451ac8[sVar7].mouse_rect.w, simple_machine_state_struct_ARRAY_00451ac8[sVar7].mouse_rect.h,5, 0x4390f1); simple_machine_state_struct_ARRAY_00451ac8[sVar7].mouse_rgn = pmVar6; (simple_machine_state_struct_ARRAY_00451ac8[sVar7].mouse_rgn)->extra_data = (int)sVar7 + 1000; anim_state_xxx_list_insert_8004 ((undefined4 *)simple_machine_state_struct_ARRAY_00451ac8[sVar7].aseq); aseq_set_pos_order((int)simple_machine_state_struct_ARRAY_00451ac8[sVar7].aseq, simple_machine_state_struct_ARRAY_00451ac8[sVar7].mouse_rect.x, simple_machine_state_struct_ARRAY_00451ac8[sVar7].mouse_rect.y,5); play_wave_flag1(0x1f74,5,0); simple_machines_state = 1; cur_selected_simple_machine = 9; simple_machine_setup_mouse_shape_regions_wrap(); } return; } void __stdcall FUN_0043bb28(void) { short sVar1; int iVar2; short sVar3; play_wave_flag1(0x1f5c,5,0); sVar3 = 0; do { if (simple_machine_state_struct_ARRAY_00451ac8[sVar3].machine_type != 9) { iVar2 = simple_machine_check_against_reference(sVar3); sVar1 = (short)iVar2; if ((sVar1 == -1) || (simple_machines_answer[sVar1].type == 8)) { FUN_0043bcf5(sVar3); simple_machine_draw_sidebar_icons(); simple_machine_draw_sidebar_counts(); } else { simple_machines_state = 1; simple_machine_state_struct_ARRAY_00451ac8[sVar3].machine_type = 9; simple_machines_answer[sVar1].type = 8; simple_machine_setup_mouse_shape_regions_wrap(); } } sVar3 = sVar3 + 1; } while (sVar3 < 10); return; } int __cdecl simple_machine_check_against_reference(short param_1) { undefined4 uVar1; short sVar2; short sVar3; int iVar4; iVar4 = 0; do { sVar3 = (short)iVar4; if (simple_machines_answer[sVar3].type == simple_machine_state_struct_ARRAY_00451ac8[param_1].machine_type) { sVar2 = 0; do { if ((*(short *)(sVar3 * 0x46 + 0x451bca + sVar2 * 10) != 0) && (uVar1 = point_within_rect(simple_machine_state_struct_ARRAY_00451ac8[param_1].x2, simple_machine_state_struct_ARRAY_00451ac8[param_1].y2, *(short *)(sVar3 * 0x46 + 0x451bc2 + sVar2 * 10) + simple_machine_start_x, *(short *)(sVar3 * 0x46 + 0x451bc4 + sVar2 * 10) + simple_machine_start_y, *(short *)(sVar3 * 0x46 + 0x451bc6 + sVar2 * 10), *(short *)(sVar3 * 0x46 + 0x451bc8 + sVar2 * 10)), (short)uVar1 != 0)) { return iVar4; } sVar2 = sVar2 + 1; } while (sVar2 < 6); } iVar4 = iVar4 + 1; if (9 < (short)iVar4) { return -1; } } while( true ); } undefined4 __cdecl point_within_rect(short param_1,short param_2,short param_3,short param_4,short param_5, short param_6) { if ((((param_3 <= param_1) && ((int)param_1 < (int)param_3 + (int)param_5)) && (param_4 <= param_2)) && ((int)param_2 < (int)param_4 + (int)param_6)) { return CONCAT22((short)((uint)((int)param_4 + (int)param_6) >> 0x10),1); } return 0; } void __cdecl FUN_0043bcf5(short param_1) { char cVar1; word wVar2; word wVar3; short sVar4; word wVar5; short sVar6; word wVar7; word wVar8; short local_6; wVar2 = simple_machine_state_struct_ARRAY_00451ac8[param_1].machine_type; wVar8 = simple_machine_state_struct_ARRAY_00451ac8[param_1].mouse_rect.x; wVar7 = simple_machine_state_struct_ARRAY_00451ac8[param_1].mouse_rect.y; wVar3 = simple_machine_state_struct_ARRAY_00451ac8[param_1].mouse_rect.x; sVar4 = simple_machine_type_info_ARRAY_0044b62c[(short)wVar2].sidebar_x; wVar5 = simple_machine_state_struct_ARRAY_00451ac8[param_1].mouse_rect.y; sVar6 = simple_machine_type_info_ARRAY_0044b62c[(short)wVar2].sidebar_y; simple_machine_state_struct_ARRAY_00451ac8[param_1].machine_type = 9; play_wave_flag1(0x4a75,5,0); local_6 = 0; do { anim_state_xxx_list_remove((int *)simple_machine_state_struct_ARRAY_00451ac8[param_1].aseq); anim_state_xxx_list_insert_8004 ((undefined4 *)simple_machine_state_struct_ARRAY_00451ac8[param_1].aseq); aseq_set_pos_order((int)simple_machine_state_struct_ARRAY_00451ac8[param_1].aseq,wVar8,wVar7,5); xxx_periodic_loop(); local_6 = local_6 + 1; wVar8 = wVar8 - (short)(((int)(short)wVar3 - (int)sVar4) / 5); wVar7 = wVar7 - (short)(((int)(short)wVar5 - (int)sVar6) / 5); } while (local_6 < 5); free_aseq((int *)simple_machine_state_struct_ARRAY_00451ac8[param_1].aseq); cVar1 = simple_machine_instances[(short)wVar2]; simple_machine_instances[(short)wVar2] = simple_machine_instances[(short)wVar2] + '\x01'; if (cVar1 == '\0') { anim_state_xxx_list_insert_8004((undefined4 *)simple_machine_icon_aseq[(short)wVar2]); } simple_machines_set_up_mouse_regions(); simple_machine_draw_sidebar_icons(); simple_machine_draw_sidebar_counts(); return; } void __stdcall FUN_0043be57(void) { char cVar1; if ((simple_machines_state != 3) && (simple_machines_state == 4)) { simple_machines_state = 1; clear_cursor_override_regions(); cVar1 = simple_machine_instances[cur_selected_simple_machine]; simple_machine_instances[cur_selected_simple_machine] = simple_machine_instances[cur_selected_simple_machine] + '\x01'; if (cVar1 == '\0') { anim_state_xxx_list_insert_8004 ((undefined4 *)simple_machine_icon_aseq[cur_selected_simple_machine]); } cur_selected_simple_machine = 9; simple_machine_setup_mouse_shape_regions_wrap(); } simple_machines_set_up_mouse_regions(); FUN_0043bebe(); return; } void __stdcall FUN_0043bebe(void) { simple_machine_draw_sidebar_icons(); FUN_00430e33(DAT_0044b706); simple_machine_draw_sidebar_counts(); return; } void __stdcall FUN_0043beda(void) { byte local_38 [52]; load_nfnt(15000); gfxish_copy_otherbuf_to_dest_and_invalidate(10,0x14a,0xfa,0x28); sprintf(local_38); FUN_0043dc0b(15000,local_38,10,0x16d,0); gfxish_invalidate_rect_wrap(10,0x14a,0x96,0x28); free_nfnt(15000); return; } void __cdecl simple_machine_setup_mouse_shape_regions(short param_1) { simple_machine_mouse_shape_region_info *psVar1; short sVar2; word *pwVar3; simple_machine_mouse_shape_region_info *psVar4; if (param_1 == 0) { free_tracked_heap_block((int)DAT_00451a98); } DAT_00451a9c = 0; sVar2 = 0; do { if (simple_machine_instances[sVar2] != 0) { DAT_00451a9c = DAT_00451a9c + 1; } sVar2 = sVar2 + 1; } while (sVar2 < 8); pwVar3 = (word *)alloc_tracked_heap_block((DAT_00451a9c + 1) * 0x10); sVar2 = 0; psVar1 = simple_machine_mouse_shape_region_info_ARRAY_0044b59c; DAT_00451a98 = pwVar3; do { psVar4 = psVar1; if (simple_machine_instances[sVar2] != '\0') { *pwVar3 = (psVar4->r).x; pwVar3[1] = (psVar4->r).y; pwVar3[3] = (psVar4->r).h; pwVar3[2] = (psVar4->r).w; *(aseq_cursor_struct **)(pwVar3 + 6) = simple_machine_hand_curs[sVar2]; pwVar3[5] = 0; pwVar3 = pwVar3 + 8; } sVar2 = sVar2 + 1; psVar1 = psVar4 + 1; } while (sVar2 < 8); *pwVar3 = psVar4[1].r.x; pwVar3[1] = psVar4[1].r.y; pwVar3[3] = psVar4[1].r.h; pwVar3[2] = psVar4[1].r.w; *(aseq_cursor_struct **)(pwVar3 + 6) = simple_machine_hand_curs[8]; pwVar3[5] = 0; set_cursor_override_regions((int)DAT_00451a98,DAT_00451a9c + 1); return; } void __stdcall clear_cursor_override_regions(void) { set_cursor_override_regions(0,0); return; } void __stdcall simple_machine_setup_mouse_shape_regions_wrap(void) { simple_machine_setup_mouse_shape_regions(0); return; } void __stdcall FUN_0043c05f(void) { char cVar1; DAT_00451e80 = 1; if (simple_machines_state != 3) { if (simple_machines_state != 4) { return; } simple_machines_state = 1; clear_cursor_override_regions(); cVar1 = simple_machine_instances[cur_selected_simple_machine]; simple_machine_instances[cur_selected_simple_machine] = simple_machine_instances[cur_selected_simple_machine] + '\x01'; if (cVar1 == '\0') { anim_state_xxx_list_insert_8004 ((undefined4 *)simple_machine_icon_aseq[cur_selected_simple_machine]); } cur_selected_simple_machine = 9; simple_machine_setup_mouse_shape_regions_wrap(); } return; } void __stdcall xxxfunc_run(void) { if (xxxfunc_disable == 0) { if (xxxfunc_thing0[xxxfunc_thing0_idx] == (xxxfunc_funcset *)0x0) { if (DAT_0044b744 != (code *)0x0) { (*DAT_0044b744)(); } if ((xxxfunc_is_shifting == 0) && (xxxfunc_thing1[xxxfunc_thing0_idx]->on_periodic != (undefined *)0x0)) { (*(code *)xxxfunc_thing1[xxxfunc_thing0_idx]->on_periodic)(); return; } } else if (xxxfunc_is_shifting == 0) { xxxfunc_is_shifting = 1; inc_repost_mouse_downup(); if ((xxxfunc_thing1[xxxfunc_thing0_idx] != (xxxfunc_funcset *)0x0) && (xxxfunc_thing1[xxxfunc_thing0_idx]->on_remove != (undefined *)0x0)) { (*(code *)xxxfunc_thing1[xxxfunc_thing0_idx]->on_remove)(); } xxxfunc_thing2[xxxfunc_thing0_idx] = xxxfunc_thing1[xxxfunc_thing0_idx]; xxxfunc_thing1[xxxfunc_thing0_idx] = xxxfunc_thing0[xxxfunc_thing0_idx]; xxxfunc_thing0[xxxfunc_thing0_idx] = (xxxfunc_funcset *)0x0; (*(code *)xxxfunc_thing1[xxxfunc_thing0_idx]->on_load)(); dec_clear_repost_mouse_downup(0); xxxfunc_is_shifting = 0; return; } } else { xxxfunc_disable = 1; } return; } void __cdecl xxxfunc_set(xxxfunc_funcset *param_1) { xxxfunc_thing0[xxxfunc_thing0_idx] = param_1; return; } void __cdecl xxxfunc_add_funcset(xxxfunc_funcset *param_1) { xxxfunc_thing0_idx = xxxfunc_thing0_idx + 1; xxxfunc_thing0[xxxfunc_thing0_idx] = param_1; return; } void __stdcall xxxfunc_remove(void) { short sVar1; sVar1 = xxxfunc_thing0_idx; xxxfunc_thing0_idx = xxxfunc_thing0_idx + -1; if ((xxxfunc_thing1[sVar1] != (xxxfunc_funcset *)0x0) && (xxxfunc_thing1[sVar1]->on_remove != (undefined *)0x0)) { (*(code *)xxxfunc_thing1[sVar1]->on_remove)(); } xxxfunc_thing1[sVar1] = (xxxfunc_funcset *)0x0; return; } void __cdecl xxxfunc_setup(short param_1,xxxfunc_funcset *param_2) { short sVar1; if (xxxfunc_is_set_up == 0) { xxxfunc_thing0 = (xxxfunc_funcset **)alloc_tracked_heap_block((int)param_1 << 2); xxxfunc_thing1 = (xxxfunc_funcset **)alloc_tracked_heap_block((int)param_1 << 2); xxxfunc_thing2 = (xxxfunc_funcset **)alloc_tracked_heap_block((int)param_1 << 2); sVar1 = 0; if (0 < param_1) { do { xxxfunc_thing1[sVar1] = (xxxfunc_funcset *)0x0; xxxfunc_thing0[sVar1] = (xxxfunc_funcset *)0x0; sVar1 = sVar1 + 1; } while (sVar1 < param_1); } *xxxfunc_thing0 = param_2; xxxfunc_is_set_up = 1; } return; } void __cdecl xxxfunc_set_disable(undefined2 param_1) { xxxfunc_disable = param_1; return; } void __stdcall xxxfunc_tear_down(void) { if (xxxfunc_is_set_up != 0) { free_tracked_heap_block((int)xxxfunc_thing0); free_tracked_heap_block((int)xxxfunc_thing1); free_tracked_heap_block((int)xxxfunc_thing2); xxxfunc_is_set_up = 0; } return; } undefined4 __stdcall dialog_proc_2(HWND param_1,short param_2,ushort param_3) { uint uVar1; int iVar2; int iVar3; tagRECT local_14; if (param_2 == 0x47) { return 0; } if (param_2 == 0x110) { GetWindowRect(param_1,&local_14); uVar1 = (desktop_rect.right - desktop_rect.left) - (int)(short)(((short)local_14.right - (short)local_14.left) + 1); iVar2 = (int)uVar1 >> 1; if (iVar2 < 0) { iVar2 = iVar2 + (uint)((uVar1 & 1) != 0); } uVar1 = (desktop_rect.bottom - desktop_rect.top) - (int)(short)(((short)local_14.bottom - (short)local_14.top) + 1); iVar3 = (int)uVar1 >> 1; if (iVar3 < 0) { iVar3 = iVar3 + (uint)((uVar1 & 1) != 0); } SetWindowPos(param_1,(HWND)0x0,(int)(short)((short)iVar2 + (short)desktop_rect.left), (int)(short)((short)iVar3 + (short)desktop_rect.top + WORD_0044cec4),0,0,5); return 1; } if (param_2 == 0x111) { if (param_3 < 0x3ea) { if ((param_3 == 0x3e9) || (param_3 == 1)) { EndDialog(param_1,1); return 1; } if (param_3 == 2) { LAB_0043c485: EndDialog(param_1,0); return 1; } } else { if (param_3 == 0x3ea) goto LAB_0043c485; if (param_3 == 0x641) { return 1; } } } return 0; } void __cdecl open_dialog_box_2(ushort param_1) { DialogBoxParamA(instance,(LPCSTR)(uint)param_1,main_hwnd,dialog_proc_2,0); return; } undefined4 __stdcall load_ini_settings(void) { bool bVar1; ushort uVar2; UINT UVar3; undefined3 extraout_var; undefined4 uVar4; int iVar5; char *pcVar6; short sVar7; byte bVar8; CHAR local_ac [80]; uint local_5c [22]; get_config_xxx_path_0(local_5c,0x50); strcat((char *)local_5c,s___0044b796); strcat((char *)local_5c,s_ssgwincd_ini_0044b798); GetVersion(); bVar8 = 0; sVar7 = 1; UVar3 = GetPrivateProfileIntA (PTR_s_Gizmos___Gadgets__CD_0044b74c,PTR_s_Graphics_0044b758,3,(LPCSTR)local_5c) ; gr_initialize((short)UVar3,sVar7,bVar8); bVar1 = is_16_colors(); if ((short)CONCAT31(extraout_var,bVar1) == 0) { UVar3 = GetPrivateProfileIntA (PTR_s_Gizmos___Gadgets__CD_0044b74c,s_Sound_0044b7a5,0,(LPCSTR)local_5c); uVar2 = sound_initialize((short)UVar3); if ((uVar2 & 1) == 0) { open_dialog_box_2(0xbe0); uVar4 = 0; } else { GetPrivateProfileStringA (PTR_s_Gizmos___Gadgets__CD_0044b74c,PTR_s_CDDrive_0044b750,PTR_s__0044b760,cddrive, 0x104,(LPCSTR)local_5c); GetPrivateProfileStringA (PTR_s_Gizmos___Gadgets__CD_0044b74c,PTR_s_MIDIPath_0044b754,s__0044b7ab,local_ac, 0x104,(LPCSTR)local_5c); iVar5 = strlen(local_ac); if (iVar5 == 0) { strcpy(local_ac,cddrive); strcat(local_ac,s_midi__0044b7ac); set_midi_path(local_ac); } else { set_midi_path(local_ac); } UVar3 = GetPrivateProfileIntA (PTR_s_Gizmos___Gadgets__CD_0044b74c,s_MIDIType_0044b7b2,-1,(LPCSTR)local_5c ); if ((short)UVar3 != -1) { set_midi_type((short)UVar3); } if ((uVar2 & 2) == 0) { open_dialog_box_2(0xbe1); uVar4 = 0; } else { UVar3 = GetPrivateProfileIntA (PTR_s_Gizmos___Gadgets__CD_0044b74c,s_CheatKeys_0044b7bb,0, (LPCSTR)local_5c); cheatkeys = (word)UVar3; UVar3 = GetDriveTypeA((LPCSTR)0x0); if (UVar3 == 5) { GetWindowsDirectoryA(windows_dir,0xff); pcVar6 = (char *)strlen(windows_dir); if (pcVar6[0x451f64] != '\\') { pcVar6 = strcat(windows_dir,s___0044b7c5); } } else { pcVar6 = strcat(windows_dir,s__0044b7c7); } uVar4 = CONCAT22((short)((uint)pcVar6 >> 0x10),1); } } } else { open_dialog_box_2(3035); uVar4 = 0; } return uVar4; } void __stdcall set_ini_wavemix(void) { uint local_60 [20]; CHAR local_10 [12]; get_config_xxx_path_0(local_60,0x50); strcat((char *)local_60,s___0044b7c8); strcat((char *)local_60,s_ssgwincd_ini_0044b7ca); sprintf(local_10); WritePrivateProfileStringA (PTR_s_Gizmos___Gadgets__CD_0044b74c,s_wavemix_0044b7da,local_10,(LPCSTR)local_60); return; } void __stdcall FUN_0043c734(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if (sVar1 == 0x14) { if (cheatkeys != 0) { DAT_0044b878 = DAT_0044b878 ^ 1; } } else if (sVar1 == 0x1b) { exit_game_handler(); return; } return; } void __stdcall go_file_select(void) { xxxfunc_set(&file_select_related_funcset_maybe); return; } void __stdcall go_building_1(void) { if (save_file_big->num_built_vehicles[1] != 4) { if (DAT_0044b878 != 0) { save_file_big->xxx[1] = 0; } save_file_big->building_idx = 1; xxxfunc_set(&enter_building_funcset); return; } show_dialog_wait_continue_with_ids(1016,0xffff); return; } void __stdcall go_building_2(void) { if (save_file_big->num_built_vehicles[2] != 4) { if (DAT_0044b878 != 0) { save_file_big->xxx[2] = 0; } save_file_big->building_idx = 2; xxxfunc_set(&enter_building_funcset); return; } show_dialog_wait_continue_with_ids(1016,0xffff); return; } void __stdcall go_building_0(void) { if (save_file_big->num_built_vehicles[0] != 4) { if (DAT_0044b878 != 0) { save_file_big->xxx[0] = 0; } save_file_big->building_idx = 0; xxxfunc_set(&enter_building_funcset); return; } show_dialog_wait_continue_with_ids(1016,0xffff); return; } void __stdcall save_loaded_parking_lot_on_load(void) { int *piVar1; int iVar2; int iVar3; aseq_anim_state_struct *paVar4; aseq_cursor_struct *paVar5; short sVar6; parking_lot_cursor_struct *ppVar7; short sVar8; short local_6; if (1 < DAT_0044b898) { nullishsub(); } DAT_0044b898 = DAT_0044b898 + 1; nullsub(); nullishsub(); DAT_0044b878 = 0; DAT_00449c4a = 0; DAT_00449c4c = 0; show_beat_the_game = 0; load_rrgb_1(1601); piVar1 = load_aseq(1600); aseq_draw_to_both_fbs((int)piVar1,0,0,0); free_aseq(piVar1); aseq_1601 = (aseq_anim_state_struct *)load_aseq(1601); aseq_1602 = (aseq_anim_state_struct *)load_aseq(1602); aseq_set_pos_order((int)aseq_1601,-0x8000,-0x8000,5); anim_state_xxx_list_insert_4((undefined4 *)aseq_1601); aseq_set_pos_order((int)aseq_1602,-0x8000,-0x8000,5); anim_state_xxx_list_insert_4((undefined4 *)aseq_1602); iVar2 = load_resource_item_0(1600,(int *)&ints); iVar3 = load_resource_item_0(1601,(int *)&ints); sVar8 = 0; do { sVar6 = sVar8 * 5; for (local_6 = 0; local_6 <= (short)save_file_big->num_built_vehicles[sVar8]; local_6 = local_6 + 1) { piVar1 = load_aseq((short)save_file_big->vehicle_colors_shapes[sVar6] + parking_lot_decorations[sVar6]); aseq_draw_gfx_and_xxx ((int)piVar1,*(short *)(iVar2 + sVar6 * 2),*(short *)(iVar3 + sVar6 * 2),0,6); free_aseq(piVar1); sVar6 = sVar6 + 1; } sVar8 = sVar8 + 1; } while (sVar8 < 3); free_resource_item_with_data(iVar2); free_resource_item_with_data(iVar3); sVar8 = 0; do { paVar4 = (aseq_anim_state_struct *)load_aseq(sVar8 + 1691); parking_lot_cursors[sVar8] = paVar4; paVar5 = (aseq_cursor_struct *)aseq_setup_as_cursor((int)parking_lot_cursors[sVar8],0,0); parking_lot_cursors_more[sVar8] = paVar5; parking_lot_cursors_more[sVar8]->enable_clip_cursor = 0; sVar8 = sVar8 + 1; } while (sVar8 < 4); ppVar7 = parking_lot_cursor_struct_ARRAY_0044b7e6; sVar8 = 0; do { mouse_region_new_up(ppVar7->x,ppVar7->y,ppVar7->w,ppVar7->h,5, (uint)PTR_ARRAY_0044b868[ppVar7->cb_func_idx]); ppVar7->thing_0x26 = parking_lot_cursors_more[ppVar7->cb_func_idx]; ppVar7->field5_0xa = 0; ppVar7 = ppVar7 + 1; sVar8 = sVar8 + 1; } while (sVar8 < 8); set_cursor_override_regions(0x44b7e6,8); show_beat_the_game = (ushort)(save_file_big->total_built_vehicles == 0xf); key_xxxxx_set(FUN_0043c734); load_midi(0x1784); midi_stop_and_play(0x1784,1); FUN_00422170(); setup_default_enable_menus(); return; } void __stdcall save_loaded_parking_lot_on_remove(void) { aseq_cursor_struct *paVar1; aseq_anim_state_struct *paVar2; short sVar3; free_midi(0x1784); set_cursor_override_regions(0,0); mouse_region_delete_all_lists(); sVar3 = 0; do { paVar1 = (aseq_cursor_struct *)aseq_free_cursor((int)parking_lot_cursors_more[sVar3]); parking_lot_cursors_more[sVar3] = paVar1; paVar2 = (aseq_anim_state_struct *)free_aseq((int *)parking_lot_cursors[sVar3]); parking_lot_cursors[sVar3] = paVar2; sVar3 = sVar3 + 1; } while (sVar3 < 4); aseq_1601 = (aseq_anim_state_struct *)free_aseq((int *)aseq_1601); aseq_1602 = (aseq_anim_state_struct *)free_aseq((int *)aseq_1602); FUN_0042211c(); return; } void __stdcall save_loaded_parking_lot_on_periodic(void) { if (show_beat_the_game != 0) { show_dialog_wait_continue_with_ids(1022,0xffff); show_beat_the_game = 0; } return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __cdecl FUN_0043cba0(int param_1,short param_2,short param_3,short param_4,byte param_5) { uint uVar1; ushort uVar2; word wVar3; short sVar4; word wVar5; int iVar6; short sVar7; short sVar8; int iVar9; short sVar10; word wVar11; word local_c; short local_a; short local_8; ushort local_6; wVar3 = param_3 + 0x14; sVar4 = 0; if ((param_5 & 1) != 0) { sVar4 = 0x15; } if ((param_5 & 2) != 0) { sVar4 = sVar4 + 0x15; } if ((param_5 & 4) != 0) { sVar4 = sVar4 + 0x32; } sVar4 = sVar4 + param_4; wVar5 = sVar4 + 0x14; FUN_00422b9d(&local_8,&local_a); if ((short)param_1 < 0) { iVar9 = (int)local_8 - (int)(short)wVar3 >> 1; if (iVar9 < 0) { iVar9 = iVar9 + (uint)(((int)local_8 - (int)(short)wVar3 & 1U) != 0); } } else { iVar9 = param_1 + -8; } if (param_2 < 0) { iVar6 = (int)local_a - (int)(short)wVar5 >> 1; if (iVar6 < 0) { iVar6 = iVar6 + (uint)(((int)local_a - (int)(short)wVar5 & 1U) != 0); } local_c = (word)iVar6; } else { local_c = param_2 - 8; } wVar11 = (word)iVar9; gfxish_fill_rect_wrap(wVar11,local_c,wVar3,wVar5,0xfff); dialog_related_rect_xxx.y = local_c; uVar1 = iVar9 + 4; local_8 = param_3 + 8; local_a = sVar4 + 8; sVar10 = 0; dialog_related_rect_xxx.x = wVar11; dialog_related_rect_xxx.w = wVar3; dialog_related_rect_xxx.h = wVar5; sVar7 = local_c + 4; do { local_6 = (ushort)uVar1; uVar2 = local_6; sVar8 = sVar7 + 1; local_6 = local_6 + 1; gfx_draw_box(uVar2,sVar7,local_8,local_a,0); uVar1 = (uint)local_6; local_8 = local_8 + -2; local_a = local_a + -2; sVar10 = sVar10 + 1; sVar7 = sVar8; } while (sVar10 < 4); DAT_00452094 = local_6; DAT_00452096 = sVar8; DAT_00452098 = local_8; DAT_0045209a = local_a; gfxish_fill_rect_wrap(wVar11 + 8,local_c + wVar5 + -8,param_3 + 8,4,0x8f7); gfxish_fill_rect_wrap(wVar3 + wVar11 + -8,local_c + 8,4,sVar4 + 8,0x8f7); uVar1 = (uint)_DAT_0045209c; if ((param_5 & 1) != 0) { gfxish_line_h_wrap(wVar11 + 4,local_c + 0x1d,param_3 + 8,0); gfxish_line_h_wrap(wVar11 + 4,local_c + 0x1c,param_3 + 8,0); DAT_00452096 = DAT_00452096 + 0x16; DAT_0045209a = DAT_0045209a + -0x16; uVar1 = iVar9 + 8; DAT_0045209e = local_c + 8; DAT_004520a0 = DAT_00452098; _DAT_004520a2 = 0x15; } _DAT_0045209c = (ushort)uVar1; if ((param_5 & 2) != 0) { sVar4 = local_c + wVar5; DAT_0045209a = DAT_0045209a + -0x15; gfxish_line_h_wrap(wVar11 + 4,sVar4 + -0x21,param_3 + 8,0); gfxish_line_h_wrap(wVar11 + 4,sVar4 + -0x22,param_3 + 8,0); dlg_bot_txt_x = wVar11 + 8; dlg_bot_txt_y = sVar4 + -0x20; dlg_bot_txt_w = DAT_00452098; dlg_bot_txt_h = 0x14; } if ((param_5 & 4) != 0) { DAT_0045209a = DAT_0045209a + -0x32; } return; } void __stdcall dialog_btn_0_click(void) { if (dialog_handlers_active != 0) { aseq_select_anim((int)current_dialog->anim_state[0],2); aseq_select_anim((int)current_dialog->anim_state[1],0); aseq_anim_reset_and_play((undefined4 *)current_dialog->anim_state[0]); aseq_anim_reset_and_play((undefined4 *)current_dialog->anim_state[1]); dialog_ret_value = 1; dialog_state = 4; dialog_handlers_active = 0; } return; } void __stdcall dialog_btn_1_click(void) { if (dialog_handlers_active != 0) { aseq_select_anim((int)current_dialog->anim_state[1],2); aseq_select_anim((int)current_dialog->anim_state[0],0); aseq_anim_reset_and_play((undefined4 *)current_dialog->anim_state[0]); aseq_anim_reset_and_play((undefined4 *)current_dialog->anim_state[1]); dialog_ret_value = 0; dialog_state = 4; dialog_handlers_active = 0; } return; } int __cdecl FUN_0043cf25(char *param_1) { char cVar1; int iVar2; iVar2 = 0; if (param_1 != (char *)0x0) { iVar2 = 1; while (*param_1 != '\0') { cVar1 = *param_1; param_1 = param_1 + 1; if (cVar1 == '\n') { iVar2 = iVar2 + 1; } } } return iVar2; } void __stdcall dialog_keyboard_handler(void) { short sVar1; word wVar2; word wVar3; sVar1 = pump_messages_and_get_key_(); wVar3 = current_dialog->highlighted_button; if (dialog_handlers_active != 0) { if (sVar1 < VK_ESCAPE + 1) { if (sVar1 == VK_ESCAPE) { dialog_state = 5; dialog_ret_value = 0; return; } if (sVar1 != 9) { if (sVar1 != 0xd) { return; } if (current_dialog->num_buttons == 0) { dialog_ret_value = 0; dialog_state = 5; return; } aseq_select_anim((int)current_dialog->anim_state[(short)wVar3],2); aseq_anim_reset_and_play((undefined4 *)current_dialog->anim_state[(short)wVar3]); dialog_ret_value = (ushort)(wVar3 == 0); dialog_state = 4; dialog_handlers_active = 0; return; } } else { if (sVar1 == VK_LEFT) { if (current_dialog->num_buttons == 0) { return; } aseq_select_anim((int)current_dialog->anim_state[(short)wVar3],0); aseq_anim_reset_and_play((undefined4 *)current_dialog->anim_state[(short)wVar3]); wVar2 = 0; if (wVar3 != 1) { wVar2 = current_dialog->num_buttons - 1; } aseq_select_anim((int)current_dialog->anim_state[(short)wVar2],1); aseq_anim_reset_and_play((undefined4 *)current_dialog->anim_state[(short)wVar2]); current_dialog->highlighted_button = wVar2; return; } if (sVar1 != 0x27) { return; } } if (current_dialog->num_buttons != 0) { aseq_select_anim((int)current_dialog->anim_state[(short)wVar3],0); aseq_anim_reset_and_play((undefined4 *)current_dialog->anim_state[(short)wVar3]); wVar3 = (short)(wVar3 + 1) % current_dialog->num_buttons; aseq_select_anim((int)current_dialog->anim_state[(short)wVar3],1); aseq_anim_reset_and_play((undefined4 *)current_dialog->anim_state[(short)wVar3]); current_dialog->highlighted_button = wVar3; } } return; } void __stdcall dialog_stop_playing_sounds(void) { short sVar1; sVar1 = wave_is_playing_(current_dialog->wave_idx); if (sVar1 != 0) { stop_playing_wave_by_id_type2(current_dialog->wave_idx); } if (current_dialog->wave_idx != 0) { free_wave_flag_2(current_dialog->wave_idx); current_dialog->wave_idx = 0; } dialog_state = 3; return; } void __stdcall dialog_bottom_click(void) { dialog_state = 5; dialog_ret_value = 0; return; } void __stdcall new_yesno_dialog(void) { undefined2 *puVar1; puVar1 = (undefined2 *)alloc_tracked_heap_block(0x3e); *puVar1 = 0xffff; puVar1[1] = 0xffff; puVar1[4] = 2; puVar1[7] = 1003; puVar1[8] = 0x3ec; puVar1[5] = 2; puVar1[6] = 3; *(undefined4 *)(puVar1 + 0x13) = 0; *(undefined4 *)(puVar1 + 0xf) = 0; *(undefined4 *)(puVar1 + 0x11) = 0; *(undefined4 *)(puVar1 + 0xd) = 0; puVar1[0x17] = 0; *(undefined4 *)(puVar1 + 0x1b) = 0; *(undefined4 *)(puVar1 + 0x19) = 0; return; } void __stdcall new_no_buttons_dialog(void) { undefined2 *puVar1; puVar1 = (undefined2 *)alloc_tracked_heap_block(0x3e); *puVar1 = 0xffff; puVar1[1] = 0xffff; puVar1[4] = 0; puVar1[7] = 0; puVar1[8] = 0; *(undefined4 *)(puVar1 + 0x13) = 0; *(undefined4 *)(puVar1 + 0xf) = 0; *(undefined4 *)(puVar1 + 0x11) = 0; *(undefined4 *)(puVar1 + 0xd) = 0; puVar1[0x17] = 0; *(undefined4 *)(puVar1 + 0x1b) = 0; *(undefined4 *)(puVar1 + 0x19) = 0; return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address short __cdecl show_dialog(undefined2 *param_1) { short sVar1; short sVar2; aseq_anim_state_struct *paVar3; undefined4 uVar4; int iVar5; BOOL BVar6; uint uVar7; int iVar8; word wVar9; tagMSG local_30; ushort local_12; short local_10; short local_e; short local_c; short local_a; short local_8; short local_6; local_6 = 0; disable_exiting_because_dialog_xxx = 1; if (on_deactivate_xtra_cb != (undefined *)0x0) { (*(code *)on_deactivate_xtra_cb)(); } anim_state_xxx_new_list(); mouse_region_stash_lists(); DAT_004520b8 = get_time_ms(); timers_pause(); disable_menus(0xff,0xffff,0); key_xxxxx_inc(); stop_playing_all_waves(); midi_pause_current(); DAT_004520bc = FUN_0043e1b5(0); key_xxxxx_set(dialog_keyboard_handler); current_dialog = (dialog_state_struct *)param_1; dialog_ret_value = -1; save_unset_custom_cursor(); xxx_periodic_loop(); FUN_0043e3fb(-1,(byte *)current_dialog->body_text,&local_e,&local_10); local_12 = (ushort)(current_dialog->top_text != (char *)0x0); if (current_dialog->bottom_text != (char *)0x0) { local_12 = local_12 | 2; } if (current_dialog->num_buttons != 0) { local_12 = local_12 | 4; } FUN_0043cba0(CONCAT22((short)((uint)current_dialog >> 0x10),current_dialog->field0_0x0), current_dialog->field1_0x2,local_e + 10,local_10 + 10,(byte)local_12); FUN_00401220(DAT_00452094 + 5,DAT_00452096 + 3,(byte *)current_dialog->body_text); for (wVar9 = 0; (short)wVar9 < current_dialog->num_buttons; wVar9 = wVar9 + 1) { if (current_dialog->xxx_button_pos_related[(short)wVar9] != 0) { paVar3 = (aseq_anim_state_struct *)load_aseq(current_dialog->aseq_idx[(short)wVar9]); current_dialog->anim_state[(short)wVar9] = paVar3; paVar3->removal_related = 1; uVar4 = aseq_get_img_h((int)paVar3,0); local_c = (short)uVar4; uVar4 = aseq_get_img_w((int)paVar3,0); iVar5 = (int)(0x32U - (int)local_c) >> 1; if (iVar5 < 0) { iVar5 = iVar5 + (uint)((0x32U - (int)local_c & 1) != 0); } local_a = (short)iVar5 + DAT_00452096 + DAT_0045209a; sVar2 = current_dialog->xxx_button_pos_related[(short)wVar9]; sVar1 = (short)uVar4; if (sVar2 == 1) { iVar5 = (int)DAT_00452098 - (int)sVar1 >> 1; if (iVar5 < 0) { iVar5 = iVar5 + (uint)(((int)DAT_00452098 - (int)sVar1 & 1U) != 0); } local_8 = (short)iVar5 + DAT_00452094; } else if (sVar2 == 2) { iVar5 = (int)DAT_00452098; if (iVar5 < 0) { iVar5 = iVar5 + 3; } iVar8 = (int)sVar1 >> 1; if (iVar8 < 0) { iVar8 = iVar8 + (uint)(((int)sVar1 & 1U) != 0); } local_8 = ((short)(iVar5 >> 2) + DAT_00452094) - (short)iVar8; } else if (sVar2 == 3) { iVar5 = (int)DAT_00452098; if (iVar5 < 0) { iVar5 = iVar5 + 3; } iVar8 = (int)sVar1 >> 1; if (iVar8 < 0) { iVar8 = iVar8 + (uint)(((int)sVar1 & 1U) != 0); } local_8 = ((DAT_00452094 + DAT_00452098) - (short)(iVar5 >> 2)) - (short)iVar8; } mouse_region_new_up(local_8,local_a,sVar1,local_c,5,(uint)PTR_ARRAY_0044b8bc[(short)wVar9]); aseq_set_pos_order((int)paVar3,local_8,local_a,205); aseq_select_anim((int)paVar3,(ushort)(wVar9 == current_dialog->highlighted_button)); anim_state_xxx_list_insert_4((undefined4 *)paVar3); } } if ((local_12 & 2) != 0) { iVar5 = (int)dlg_bot_txt_w >> 1; if (iVar5 < 0) { iVar5 = iVar5 + (uint)(((int)dlg_bot_txt_w & 1U) != 0); } FUN_0043dbb3(-1,(byte *)current_dialog->bottom_text,(short)iVar5 + dlg_bot_txt_x, dlg_bot_txt_y + 2,0xffff); mouse_region_new_up(dlg_bot_txt_x,dlg_bot_txt_y,dlg_bot_txt_w,dlg_bot_txt_h,5,0x43d161); } if ((local_12 & 1) != 0) { iVar5 = (int)DAT_004520a0 >> 1; if (iVar5 < 0) { iVar5 = iVar5 + (uint)(((int)DAT_004520a0 & 1U) != 0); } FUN_0043dbb3(-1,(byte *)current_dialog->top_text,(short)iVar5 + _DAT_0045209c,DAT_0045209e + 4, 0xffff); } if (current_dialog->num_buttons != 0) { DAT_004520b4 = DAT_004520b4 - (local_c + 5); } current_dialog->wave_idx = 0; if (current_dialog->wave_ints == (short *)0x0) { dialog_state = 3; } else { mouse_region_new_up_whole_screen(0x43d107); current_dialog->cur_wave_int = current_dialog->wave_ints; dialog_state = 1; } dialog_handlers_active = 1; while (local_6 == 0) { xxx_periodic_loop(); BVar6 = PeekMessageA(&local_30,(HWND)0x0,0,0,1); if (BVar6 != 0) { TranslateMessage(&local_30); DispatchMessageA(&local_30); } switch(dialog_state) { case 1: if (*current_dialog->cur_wave_int == -1) { dialog_state = 3; } else { current_dialog->wave_idx = *current_dialog->cur_wave_int; current_dialog->cur_wave_int = current_dialog->cur_wave_int + 1; load_wave_flag_2(current_dialog->wave_idx); play_wave_flag2(current_dialog->wave_idx); dialog_state = 2; } break; case 2: sVar2 = wave_is_playing_(current_dialog->wave_idx); if (sVar2 == 0) { iVar5 = get_time_ms(); do { uVar7 = get_time_ms(); } while (uVar7 < iVar5 + 25U); free_wave_flag_2(current_dialog->wave_idx); current_dialog->wave_idx = 0; dialog_state = 1; } break; case 4: sVar2 = aseq_anim_get_flags((int)current_dialog->anim_state[0]); if ((sVar2 == 0x10) && (sVar2 = aseq_anim_get_flags((int)current_dialog->anim_state[1]), sVar2 == 0x10)) { local_6 = 1; } break; case 5: local_6 = 1; } } dialog_stop_playing_sounds(); for (sVar2 = 0; sVar2 < current_dialog->num_buttons; sVar2 = sVar2 + 1) { free_aseq((int *)current_dialog->anim_state[sVar2]); } anim_engine_test_drawn_imgs_intersects_xxx((short *)&dialog_related_rect_xxx); restore_cursor_override_regions(); FUN_0043e1b5(DAT_004520bc); key_xxxxx_pop(); anim_state_xxx_restore_list(); mouse_region_unstash_list(); timers_resume(); restore_enable_menus(0xff,0xffff,0); restart_current_midi(0); current_dialog = (dialog_state_struct *)0x0; FUN_0043d7ce(); disable_exiting_because_dialog_xxx = 0; return dialog_ret_value; } void __cdecl show_dialog_wait_continue_with_ids(short param_1,undefined2 param_2) { int iVar1; iVar1 = load_resource_item_0(param_1,(int *)PTR_text_0044ae14); show_dialog_wait_continue(iVar1,param_2); free_resource_item_with_data(iVar1); return; } void __cdecl show_dialog_wait_continue(undefined4 param_1,undefined2 param_2) { undefined2 *puVar1; puVar1 = (undefined2 *)new_no_buttons_dialog(); *(undefined4 *)(puVar1 + 0x11) = param_1; *(char **)(puVar1 + 0xf) = s_Press_to_continue__0044b8c4; puVar1[1] = param_2; show_dialog(puVar1); free_tracked_heap_block((int)puVar1); return; } void __cdecl FUN_0043d7c1(undefined4 param_1) { DAT_0044b8b4 = param_1; return; } void __stdcall FUN_0043d7ce(void) { if (DAT_0044b8b4 != (code *)0x0) { (*DAT_0044b8b4)(); } return; } void __cdecl time_begin_period(short param_1) { MMRESULT MVar1; timecaps_tag local_c; if (time_begin_period_called == 0) { MVar1 = timeGetDevCaps(&local_c,8); if (MVar1 == 0x61) { alert_message(s_Oh_boy__0044b8e4); } timeBeginPeriod(1); time_xxx_secs_mul_maybe = param_1; DAT_004520c8 = (undefined2)(1000 / (longlong)(int)param_1); time_begin_period_called = 1; DAT_004520cc = 0; } return; } void __stdcall time_end_period(void) { if (time_begin_period_called != 0) { timeEndPeriod(1); time_begin_period_called = 0; } return; } int __stdcall get_time_ms(void) { DWORD DVar1; DVar1 = timeGetTime(); return DVar1 - time_base; } void __stdcall nullsub(void) { return; } undefined2 __stdcall time_get_secs_mul(void) { return time_xxx_secs_mul_maybe; } int __cdecl time_get_secs_count(short param_1) { return (int)time_xxx_secs_mul_maybe * (int)param_1; } uint __cdecl time_get_one_over_secs_count(short param_1) { return (uint)(int)time_xxx_secs_mul_maybe / (uint)(int)param_1; } int __cdecl get_new_time_ms(int param_1) { int iVar1; iVar1 = get_time_ms(); return iVar1 + param_1; } bool __cdecl time_not_yet_reached_ms(uint param_1) { uint uVar1; uVar1 = get_time_ms(); return param_1 <= uVar1; } void __cdecl FUN_0043d8ce(uint param_1) { uint uVar1; while( true ) { uVar1 = get_time_ms(); if (param_1 <= uVar1) break; pump_some_messages_(); } return; } void __stdcall timers_pause(void) { paused_time = get_time_ms(); return; } void __stdcall timers_resume(void) { int iVar1; iVar1 = get_time_ms(); time_base = time_base + (iVar1 - paused_time); return; } void __cdecl FUN_0043d90d(int param_1) { int iVar1; uint uVar2; iVar1 = get_time_ms(); while( true ) { uVar2 = get_time_ms(); if ((uint)(iVar1 + param_1) <= uVar2) break; pump_some_messages_(); } return; } void __cdecl FUN_0043d92e(int param_1) { int iVar1; iVar1 = get_time_ms(); DAT_004520d4 = iVar1 + param_1; return; } void __stdcall FUN_0043d940(void) { uint uVar1; while( true ) { uVar1 = get_time_ms(); if (DAT_004520d4 <= uVar1) break; pump_some_messages_(); } return; } void __cdecl find_nfnt(short param_1) { undefined4 *puVar1; if (param_1 == -1) { param_1 = default_nfnt; } for (puVar1 = (undefined4 *)deref_next_if_not_null(nfnt_list); (puVar1 != (undefined4 *)0x0 && (param_1 != *(short *)(puVar1 + 0xb))); puVar1 = (undefined4 *)deref_next(puVar1)) { } return; } void __cdecl free_nfnt(short param_1) { int *piVar1; piVar1 = (int *)find_nfnt(param_1); if (piVar1 != (int *)0x0) { linked_list_unlink(nfnt_list,piVar1); free_resource_item_with_data(piVar1[2]); free_tracked_heap_block((int)piVar1); } return; } ushort __cdecl FUN_0043d9cf(ushort param_1) { ushort uVar1; uVar1 = DAT_004520e0; if (param_1 != 0xffff) { uVar1 = clamp_color_idx(param_1); } return uVar1; } undefined4 __cdecl nfnt_get_max_asc(short param_1) { int iVar1; undefined4 uVar2; iVar1 = find_nfnt(param_1); if (iVar1 == 0) { uVar2 = 0; } else { uVar2 = CONCAT22((short)((uint)*(int *)(iVar1 + 8) >> 0x10), *(undefined2 *)(*(int *)(iVar1 + 8) + 0x12)); } return uVar2; } undefined4 __cdecl nfnt_get_max_height(short param_1) { int iVar1; undefined4 uVar2; iVar1 = find_nfnt(param_1); if (iVar1 == 0) { uVar2 = 0; } else { uVar2 = CONCAT22((short)((uint)*(int *)(iVar1 + 8) >> 0x10), *(short *)(*(int *)(iVar1 + 8) + 0x12) - *(short *)(*(int *)(iVar1 + 8) + 0x14) ); } return uVar2; } void __cdecl load_nfnt(short param_1) { int iVar1; undefined4 *puVar2; int iVar3; iVar1 = find_nfnt(param_1); if (iVar1 == 0) { iVar1 = load_resource_item_0(param_1,(int *)&nfnt); puVar2 = (undefined4 *)alloc_tracked_heap_block(0x2e); puVar2[2] = iVar1; iVar3 = nfnt_get_width_offset_table(iVar1); puVar2[4] = iVar3; iVar3 = nfnt_get_bitmap_location_table_maybe(iVar1); puVar2[3] = iVar3; nfnt_get_bit_image_info(iVar1,puVar2 + 5); *(short *)(puVar2 + 0xb) = param_1; linked_list_insert(nfnt_list,puVar2,0xffff); } return; } int __cdecl nfnt_get_width_offset_table(int param_1) { return param_1 + 0x10 + *(short *)(param_1 + 0x10) * 2; } int __cdecl nfnt_get_bitmap_location_table_maybe(int param_1) { return (param_1 + 0x10 + *(short *)(param_1 + 0x10) * 2) - (int)(short)(((*(short *)(param_1 + 4) - *(short *)(param_1 + 2)) + 3) * 2); } int __cdecl nfnt_get_bit_image_table(int param_1) { return param_1 + 0x1a; } void __cdecl nfnt_get_bit_image_info(int param_1,int *param_2) { int iVar1; int *piVar2; int *piVar3; int local_14 [4]; iVar1 = nfnt_get_bit_image_table(param_1); *param_2 = iVar1; *(short *)(param_2 + 1) = *(short *)(param_1 + 0x18) * 2; local_14[0] = 0; local_14[1] = 0; local_14[2] = (int)(short)param_2[1] << 3; local_14[3] = (int)*(short *)(param_1 + 0xe); piVar2 = local_14; piVar3 = (int *)((int)param_2 + 6); for (iVar1 = 4; iVar1 != 0; iVar1 = iVar1 + -1) { *piVar3 = *piVar2; piVar2 = piVar2 + 1; piVar3 = piVar3 + 1; } return; } short __cdecl nfnt_get_text_width(short param_1,byte *param_2) { byte bVar1; byte bVar2; int iVar3; short sVar4; sVar4 = 0; iVar3 = find_nfnt(param_1); if (iVar3 != 0) { while (*param_2 != 0) { bVar1 = *param_2; param_2 = param_2 + 1; bVar2 = bVar1; if (*(short *)(*(int *)(iVar3 + 0x10) + (uint)bVar1 * 2) == -1) { bVar2 = *(char *)(*(int *)(iVar3 + 8) + 4) - 1; } if (bVar1 == '\n') { sVar4 = sVar4 + 1000; } else { sVar4 = sVar4 + (ushort)*(byte *)(*(int *)(iVar3 + 0x10) + 1 + (uint)bVar2 * 2); } } } return sVar4; } void __cdecl FUN_0043dbb3(short param_1,byte *param_2,short param_3,short param_4,ushort param_5) { short sVar1; int iVar2; undefined4 uVar3; iVar2 = find_nfnt(param_1); if (iVar2 != 0) { sVar1 = nfnt_get_text_width(param_1,param_2); iVar2 = (int)sVar1 >> 1; if (iVar2 < 0) { iVar2 = iVar2 + (uint)(((int)sVar1 & 1U) != 0); } uVar3 = nfnt_get_max_height(default_nfnt); FUN_0043dc0b(param_1,param_2,param_3 - (short)iVar2,(short)uVar3 + param_4,param_5); } return; } void __cdecl FUN_0043dc0b(short param_1,byte *param_2,ushort param_3,short param_4,ushort param_5) { byte bVar1; int iVar2; undefined4 uVar3; ushort uVar4; iVar2 = find_nfnt(param_1); if (iVar2 == 0) { alert_message(s_Font__d_not_loaded_0044b8f7); } else { nullsub(); uVar4 = param_3; while (*param_2 != 0) { if (*param_2 == 10) { param_4 = param_4 + *(short *)(*(int *)(iVar2 + 8) + 0xe); param_2 = param_2 + 1; uVar4 = param_3; } else { bVar1 = *param_2; param_2 = param_2 + 1; uVar3 = FUN_0043dc8c(param_1,bVar1,uVar4,param_4,param_5); uVar4 = uVar4 + (short)uVar3; } } } return; } undefined4 __cdecl FUN_0043dc8c(short param_1,byte param_2,ushort param_3,short param_4,ushort param_5) { int iVar1; ushort uVar2; int iVar3; undefined2 extraout_var; undefined2 uVar4; short sVar5; short sVar6; undefined2 local_6; local_6 = 0; iVar3 = find_nfnt(param_1); uVar4 = 0; if (iVar3 != 0) { iVar1 = *(int *)(iVar3 + 8); sVar5 = *(short *)(iVar1 + 0x12) + *(short *)(iVar1 + 0x14); if (*(short *)(*(int *)(iVar3 + 0x10) + (uint)param_2 * 2) == -1) { param_2 = *(char *)(iVar1 + 4) - 1; } local_6 = (ushort)*(byte *)(*(int *)(iVar3 + 0x10) + 1 + (uint)param_2 * 2); sVar6 = *(short *)(*(int *)(iVar3 + 0xc) + 2 + (uint)param_2 * 2) - *(short *)(*(int *)(iVar3 + 0xc) + (uint)param_2 * 2); if (sVar6 != 0) { FUN_0043ddd5(iVar3,param_3,param_4,*(short *)(*(int *)(iVar3 + 0xc) + (uint)param_2 * 2),sVar6 ,sVar5,(ushort)*(byte *)(*(int *)(iVar3 + 0x10) + (uint)param_2 * 2) + *(short *)(iVar1 + 8),*(short *)(iVar1 + 0x12),param_5); if (DAT_0044b8ee != 0) { uVar2 = FUN_0043d9cf(param_5); gfxish_line_h_wrap(param_3,param_4 + *(short *)(iVar1 + 0x12) + 1,local_6 + 1,uVar2); } } gfxish_invalidate_rect_wrap(param_3,param_4 - *(short *)(iVar1 + 0x12),local_6,sVar5); uVar4 = extraout_var; } return CONCAT22(uVar4,local_6); } undefined1 __cdecl nfnt_get_width_offs(short param_1,byte param_2) { int iVar1; iVar1 = find_nfnt(param_1); if (iVar1 != 0) { return *(undefined1 *)(*(int *)(iVar1 + 0x10) + 1 + (uint)param_2 * 2); } return 0; } void __stdcall nullsub(void) { return; } void __cdecl FUN_0043ddd5(int param_1,ushort param_2,short param_3,short param_4,short param_5,short param_6, short param_7,short param_8,ushort param_9) { char cVar1; short sVar2; ushort uVar3; ushort uVar4; uint uVar5; short extraout_var; char *pcVar6; char *pcVar7; char *pcVar8; byte *pbVar9; byte *pbVar10; byte *pbVar11; byte bVar12; short sVar13; short sVar14; int iVar15; uint uVar16; byte *pbVar17; char *extraout_EDX; undefined3 uVar18; undefined3 uVar19; byte bVar20; char local_29; short local_24; short local_22; short local_20; short local_1e; byte *local_c; char *local_8; iVar15 = (int)param_4; if (iVar15 < 0) { iVar15 = iVar15 + 7; } sVar13 = (short)(iVar15 >> 3); uVar16 = (int)param_4 & 0x80000007; if ((int)uVar16 < 0) { uVar16 = (uVar16 - 1 | 0xfffffff8) + 1; } local_8 = (char *)(*(int *)(param_1 + 0x14) + (int)sVar13); sVar2 = param_5 + -1 + param_4; iVar15 = (int)sVar2; if (iVar15 < 0) { iVar15 = iVar15 + 7; } sVar14 = (short)(iVar15 >> 3); uVar5 = (int)sVar2 & 0x80000007; if ((int)uVar5 < 0) { uVar5 = (uVar5 - 1 | 0xfffffff8) + 1; } uVar3 = (ushort)uVar5; if ((sVar14 == sVar13) && (param_5 < 8)) { local_24 = param_5; } else { local_24 = 8 - (short)uVar16; } pbVar17 = (byte *)CONCAT22((short)(uVar5 >> 0x10),param_9); uVar4 = FUN_0043d9cf(param_9); cVar1 = (char)uVar4; if (DAT_004520dc == 0) { local_22 = param_3 - param_8; local_20 = 0; pcVar6 = extraout_EDX; sVar2 = extraout_var; if (0 < param_6) { do { if ((-1 < local_22) && (local_22 < paint_h)) { pbVar9 = (byte *)gfxish_fb_get_xy_ptr(CONCAT22(sVar2,local_22),pcVar6,pbVar17,0,local_22); iVar15 = (int)paint_w >> 1; if (iVar15 < 0) { iVar15 = iVar15 + (uint)(((int)paint_w & 1U) != 0); } pbVar10 = pbVar9 + iVar15 + -1; iVar15 = (int)(short)param_2 >> 1; if (iVar15 < 0) { iVar15 = iVar15 + (uint)(((int)(short)param_2 & 1U) != 0); } pbVar11 = pbVar9 + param_7 + iVar15; iVar15 = (param_2 & 1) - 1; if (iVar15 == 0) { pcVar6 = (char *)0xf0; local_29 = cVar1; } else { pcVar6 = (char *)CONCAT31((int3)((uint)iVar15 >> 8),0xf); local_29 = cVar1 << 4; } bVar20 = *local_8 << ((byte)uVar16 & 0x1f); sVar2 = 0; if (0 < local_24) { do { if ((((bVar20 & 0x80) != 0) && (pbVar9 <= pbVar11)) && (pbVar11 <= pbVar10)) { *pbVar11 = (*pbVar11 & (byte)pcVar6) + local_29; } uVar18 = (undefined3)((uint)pcVar6 >> 8); if ((byte)pcVar6 == 0xf0) { pbVar11 = pbVar11 + 1; pcVar6 = (char *)CONCAT31(uVar18,0xf); local_29 = cVar1 << 4; } else { pcVar6 = (char *)CONCAT31(uVar18,0xf0); local_29 = cVar1; } bVar20 = bVar20 * '\x02'; sVar2 = sVar2 + 1; } while (sVar2 < local_24); } local_c = (byte *)(local_8 + 1); iVar15 = ((int)sVar14 - (int)sVar13) + -1; if (iVar15 != 0 && 0 < (int)sVar14 - (int)sVar13) { for (local_1e = 0; iVar15 = ((int)sVar14 - (int)sVar13) + -1, local_1e < iVar15; local_1e = local_1e + 1) { bVar20 = *local_c; sVar2 = 0; do { if ((((bVar20 & 0x80) != 0) && (pbVar9 <= pbVar11)) && (pbVar11 <= pbVar10)) { *pbVar11 = (*pbVar11 & (byte)pcVar6) + local_29; } uVar18 = (undefined3)((uint)pcVar6 >> 8); if ((byte)pcVar6 == 0xf0) { pbVar11 = pbVar11 + 1; pcVar6 = (char *)CONCAT31(uVar18,0xf); local_29 = cVar1 << 4; } else { pcVar6 = (char *)CONCAT31(uVar18,0xf0); local_29 = cVar1; } bVar20 = bVar20 * '\x02'; sVar2 = sVar2 + 1; } while (sVar2 < 8); local_c = local_c + 1; } } pbVar17 = (byte *)CONCAT22((short)((uint)iVar15 >> 0x10),sVar14); if (sVar14 != sVar13) { bVar20 = *local_c; sVar2 = 0; pbVar17 = local_c; if (uVar3 < 0x8000) { do { if ((((bVar20 & 0x80) != 0) && (pbVar9 <= pbVar11)) && (pbVar11 <= pbVar10)) { bVar12 = (*pbVar11 & (byte)pcVar6) + local_29; pbVar17 = (byte *)CONCAT31((int3)((uint)pbVar17 >> 8),bVar12); *pbVar11 = bVar12; } uVar19 = (undefined3)((uint)pcVar6 >> 8); uVar18 = (undefined3)((uint)pbVar17 >> 8); if ((byte)pcVar6 == 0xf0) { pbVar11 = pbVar11 + 1; pcVar6 = (char *)CONCAT31(uVar19,0xf); pbVar17 = (byte *)(CONCAT31(uVar18,cVar1) << 4); local_29 = (char)pbVar17; } else { pcVar6 = (char *)CONCAT31(uVar19,0xf0); pbVar17 = (byte *)CONCAT31(uVar18,cVar1); local_29 = cVar1; } bVar20 = bVar20 * '\x02'; sVar2 = sVar2 + 1; } while (sVar2 <= (short)uVar3); } } } local_8 = local_8 + *(short *)(param_1 + 0x18); local_22 = local_22 + 1; local_20 = local_20 + 1; sVar2 = *(short *)(param_1 + 0x18) >> 0xf; } while (local_20 < param_6); } } else { local_22 = param_3 - param_8; local_20 = 0; pcVar6 = extraout_EDX; sVar2 = extraout_var; if (0 < param_6) { do { if ((-1 < local_22) && (local_22 < paint_h)) { pcVar6 = (char *)gfxish_fb_get_xy_ptr(CONCAT22(sVar2,local_22),pcVar6,pbVar17,0,local_22); pcVar7 = pcVar6 + paint_w + -1; pcVar8 = pcVar6 + (int)param_7 + (int)(short)param_2; bVar20 = *local_8 << ((byte)uVar16 & 0x1f); sVar2 = 0; if (0 < local_24) { do { if ((((bVar20 & 0x80) != 0) && (pcVar6 <= pcVar8)) && (pcVar8 <= pcVar7)) { *pcVar8 = cVar1; } bVar20 = bVar20 * '\x02'; pcVar8 = pcVar8 + 1; sVar2 = sVar2 + 1; } while (sVar2 < local_24); } local_c = (byte *)(local_8 + 1); iVar15 = ((int)sVar14 - (int)sVar13) + -1; if (iVar15 != 0 && 0 < (int)sVar14 - (int)sVar13) { for (local_1e = 0; iVar15 = ((int)sVar14 - (int)sVar13) + -1, local_1e < iVar15; local_1e = local_1e + 1) { bVar20 = *local_c; sVar2 = 0; do { if ((((bVar20 & 0x80) != 0) && (pcVar6 <= pcVar8)) && (pcVar8 <= pcVar7)) { *pcVar8 = cVar1; } bVar20 = bVar20 * '\x02'; pcVar8 = pcVar8 + 1; sVar2 = sVar2 + 1; } while (sVar2 < 8); local_c = local_c + 1; } } pbVar17 = (byte *)CONCAT22((short)((uint)iVar15 >> 0x10),sVar14); if (sVar14 != sVar13) { bVar20 = *local_c; sVar2 = 0; pbVar17 = local_c; if (uVar3 < 0x8000) { do { if ((((bVar20 & 0x80) != 0) && (pcVar6 <= pcVar8)) && (pcVar8 <= pcVar7)) { pbVar17 = (byte *)CONCAT31((int3)((uint)pbVar17 >> 8),cVar1); *pcVar8 = cVar1; } bVar20 = bVar20 * '\x02'; pcVar8 = pcVar8 + 1; sVar2 = sVar2 + 1; } while (sVar2 <= (short)uVar3); } } } local_8 = local_8 + *(short *)(param_1 + 0x18); local_22 = local_22 + 1; local_20 = local_20 + 1; sVar2 = *(short *)(param_1 + 0x18) >> 0xf; } while (local_20 < param_6); } } return; } undefined2 __cdecl set_default_nfnt(undefined2 param_1) { undefined2 uVar1; uVar1 = default_nfnt; default_nfnt = param_1; return uVar1; } undefined2 __cdecl FUN_0043e1b5(ushort param_1) { undefined2 uVar1; uVar1 = DAT_004520e2; DAT_004520e2 = param_1; DAT_004520e0 = clamp_color_idx(param_1); return uVar1; } void __stdcall setup_nfnt(void) { bool bVar1; undefined3 extraout_var; if (DAT_0044b8ec == 0) { nfnt_list = alloc_linked_list_marker(); DAT_0044b8ec = 1; bVar1 = is_256_color(); DAT_004520dc = (undefined2)CONCAT31(extraout_var,bVar1); } return; } void __stdcall free_all_nfnt(void) { undefined4 *puVar1; undefined4 *puVar2; if (DAT_0044b8ec != 0) { puVar1 = (undefined4 *)deref_next_if_not_null(nfnt_list); while (puVar1 != (undefined4 *)0x0) { puVar2 = (undefined4 *)deref_next(puVar1); free_nfnt(*(short *)(puVar1 + 0xb)); puVar1 = puVar2; } free_tracked_heap_block_((int)nfnt_list); DAT_0044b8ec = 0; } return; } int __cdecl FUN_0043e266(short param_1,ushort param_2,short param_3,short param_4,byte *param_5) { byte bVar1; byte bVar2; short sVar3; short sVar4; undefined4 uVar5; byte *pbVar6; byte *pbVar7; byte *pbVar8; bool bVar9; int local_10; bVar9 = -1 < (short)param_2; local_10 = 0; uVar5 = nfnt_get_max_height(param_1); sVar3 = (short)uVar5 + DAT_0044b8f0; uVar5 = nfnt_get_max_height(param_1); param_3 = param_3 + (short)uVar5; pbVar6 = param_5; pbVar8 = param_5; do { if (((((*pbVar6 == 0x20) || (*pbVar6 == 0)) || (*pbVar6 == 10)) || ((*pbVar6 == 0x2d || (*pbVar6 == 0x5e)))) || (*pbVar6 == 0xd)) { if ((*pbVar6 == 0x2d) || (*pbVar6 == 0x5e)) { pbVar6 = pbVar6 + 1; } bVar1 = *pbVar6; *pbVar6 = 0; sVar4 = nfnt_get_text_width(param_1,pbVar8); if (param_4 < sVar4) { bVar2 = *param_5; *param_5 = 0; if (bVar9) { FUN_0043dc0b(param_1,pbVar8,param_2,param_3,DAT_004520e0); } param_3 = param_3 + sVar3; local_10 = local_10 + 1; *param_5 = bVar2; *pbVar6 = bVar1; if ((*param_5 == 10) || (pbVar7 = param_5, *param_5 == 0xd)) { pbVar7 = param_5 + 1; } for (; param_5 = pbVar7, pbVar8 = pbVar7, *pbVar7 == 0x20; pbVar7 = pbVar7 + 1) { } } else { *pbVar6 = bVar1; pbVar7 = pbVar6 + 1; param_5 = pbVar6; } } else { pbVar7 = pbVar6 + 1; } pbVar6 = pbVar7; } while (*pbVar7 != 0); sVar4 = nfnt_get_text_width(param_1,pbVar8); if (param_4 < sVar4) { bVar1 = *param_5; *param_5 = 0; if (bVar9) { FUN_0043dc0b(param_1,pbVar8,param_2,param_3,DAT_004520e0); } local_10 = local_10 + 1; param_3 = param_3 + sVar3; *param_5 = bVar1; for (; pbVar8 = param_5, *param_5 == 0x20; param_5 = param_5 + 1) { } } if (pbVar8 != (byte *)0x0) { if (bVar9) { FUN_0043dc0b(param_1,pbVar8,param_2,param_3,DAT_004520e0); } local_10 = local_10 + 1; } return sVar3 * local_10; } short __cdecl FUN_0043e3fb(short param_1,byte *param_2,short *param_3,short *param_4) { byte bVar1; bool bVar2; undefined1 uVar3; undefined3 extraout_var; undefined4 uVar4; short sVar5; short local_8; short local_6; bVar2 = false; sVar5 = 0; local_8 = 0; local_6 = 0; LAB_0043e453: do { if (bVar2) { if (param_4 != (short *)0x0) { uVar4 = nfnt_get_max_height(-1); *param_4 = (short)uVar4 * local_6 + (local_6 + -1) * DAT_0044b8f0; } if (param_3 != (short *)0x0) { *param_3 = local_8; } return local_6; } bVar1 = *param_2; if (bVar1 == 0) { bVar2 = true; } else if ((bVar1 != 10) && (bVar1 != 0xd)) { uVar3 = nfnt_get_width_offs(param_1,bVar1); sVar5 = sVar5 + (short)CONCAT31(extraout_var,uVar3); param_2 = param_2 + 1; goto LAB_0043e453; } local_6 = local_6 + 1; if (local_8 < sVar5) { local_8 = sVar5; } sVar5 = 0; param_2 = param_2 + 1; } while( true ); } void __cdecl FUN_0043e4a1(ushort param_1,short param_2,byte *param_3) { undefined4 uVar1; ushort uVar2; uVar2 = DAT_004520e0; uVar1 = nfnt_get_max_height(default_nfnt); FUN_0043dc0b(default_nfnt,param_3,param_1,(short)uVar1 + param_2,uVar2); return; } undefined2 __stdcall FUN_0043e4d6(void) { return DAT_0044b8f0; } undefined2 __cdecl FUN_0043e4dd(undefined2 param_1) { undefined2 uVar1; uVar1 = DAT_0044b8f0; DAT_0044b8f0 = param_1; return uVar1; } void __cdecl FUN_0043e4f3(undefined2 param_1) { DAT_0044b8ee = param_1; return; } void __cdecl fill_rect_anim_w_h(int param_1) { undefined4 uVar1; uVar1 = aseq_get_img_w(*(int *)(param_1 + 10),0); *(short *)(param_1 + 4) = (short)uVar1; uVar1 = aseq_get_img_h(*(int *)(param_1 + 10),0); *(short *)(param_1 + 6) = (short)uVar1; return; } void __cdecl FUN_0043e538(short param_1) { int iVar1; uint uVar2; ushort uVar3; undefined2 uVar4; if (param_1 != 0) { iVar1 = area_screen_thing0_0_idx (actors[0].saved.screen_idx,actors[0].saved.idx_of_up_warp_related); if (*(short *)(iVar1 + 0x10) == 7) { uVar4 = 0xbc0; uVar2 = area_screen_type_b0(actors[0].saved.screen_idx); if ((short)uVar2 == 0) { uVar4 = 0xc26; } *(undefined2 *)(iVar1 + 0xe) = uVar4; *(undefined2 *)(iVar1 + 0x10) = 9; uVar3 = *(ushort *)(iVar1 + 0x12) & 0xf; if (DAT_004514f6 != 0) { actors[0].saved.screen_idx = uVar3; } *(undefined2 *)(iVar1 + 0x1e) = 4; iVar1 = screen_non_animated_warp_find_xxxxx(uVar3,*(short *)(iVar1 + 0x12)); uVar4 = 0xbc0; uVar2 = area_screen_type_b0(uVar3); if ((short)uVar2 == 0) { uVar4 = 0xc26; } *(undefined2 *)(iVar1 + 0xe) = uVar4; *(undefined2 *)(iVar1 + 0x10) = 9; *(undefined2 *)(iVar1 + 0x1e) = 4; } } return; } void __stdcall nullsub(void) { return; } void __cdecl FUN_0043e5e8(short param_1) { aseq_anim_state_struct *paVar1; short sVar2; aseq_anim_state_struct *unaff_ESI; paVar1 = workshop_race_light_green; sVar2 = 0; if (DAT_00452184 == 0) { if (loaded_area_parts->num_parts_needed == (save_file_big->basic_stats).parts_have) { sVar2 = 0x7de; unaff_ESI = paVar1; if ((save_file_big->basic_stats).xxx_built_vehicle_related != 0) { enqueue_new_player_hint(0x10,0,0); } } } else if (loaded_area_parts->num_parts_needed != (save_file_big->basic_stats).parts_have) { sVar2 = 0x7de; unaff_ESI = workshop_race_light_red; } if (sVar2 != 0) { aseq_set_pos_order((int)unaff_ESI,0x1ea,0xa0,5); anim_state_xxx_list_insert_4((undefined4 *)unaff_ESI); aseq_select_anim((int)workshop_racetrack_aseq,DAT_00452184); anim_state_xxx_list_insert_4((undefined4 *)workshop_racetrack_aseq); DAT_00452184 = DAT_00452184 ^ 1; if (param_1 != 0) { play_wave_flag1(workshop_waves_2000[0xc],3,0); if ((param_1 != 0) && (DAT_00452184 == 0)) { play_wave_flag1(workshop_waves_2000[0xd],4,0); } } } return; } void __cdecl part_find_all_on_conveyors(undefined4 *param_1) { undefined4 *puVar1; short sVar2; puVar1 = (undefined4 *)deref_next_if_not_null(&(actors[0].parts_linked_list)->next); *param_1 = 0; sVar2 = 0; for (; puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { if ((*(byte *)((int)puVar1 + 0x36) & 1) == 0) { param_1[sVar2] = puVar1; sVar2 = sVar2 + 1; } } return; } int __cdecl part_get_other_part_in_slot(int param_1) { int iVar1; if ((param_1 != 0) && (*(short *)(param_1 + 0x1c) != -1)) { iVar1 = part_get_chunk_by_file_idx(*(ushort *)(param_1 + 0x1c) & 0x7fff); return iVar1; } return 0; } void __stdcall FUN_0043e749(void) { gfxish_fill_rect_wrap(0x28,0x32,0x1ab,0x103,0xe08); gfxish_fill_rect_wrap(0x7d,0x1f,0x156,0x13,0xe08); gfxish_fill_rect_wrap(0x2a,0x1d,0x50,0x13,0xe08); return; } void __stdcall workshop_load_blueprint_expand(void) { workshop_blueprint_expand_aseq = (aseq_anim_state_struct *)load_aseq(2005); aseq_set_pos_order((int)workshop_blueprint_expand_aseq,-0x8000,-0x8000,0x32); anim_state_xxx_list_insert_4((undefined4 *)workshop_blueprint_expand_aseq); are_voices_enabled_for_workshop = are_voices_enabled(); if (are_voices_enabled_for_workshop != 0) { workshop_speak_button_aseq = (aseq_anim_state_struct *)load_aseq(2023); } return; } void __cdecl paint_vehicle_piece(int param_1,short param_2,short param_3) { int iVar1; iVar1 = (int)*(short *)(param_1 + 0x1a); if (iVar1 < 0) { iVar1 = iVar1 + 3; } if (loaded_area_parts->affected_by_paint[(short)(iVar1 >> 2)] != 0) { if (param_3 != 0) { anim_change_to_xxx(*(int **)(param_1 + 0x16),0); return; } anim_change_to_xxx(*(int **)(param_1 + 0x16),param_2 + 1); } return; } void __cdecl workshop_load_parts_for_conveyor(short param_1,short param_2) { undefined4 *puVar1; undefined4 *puVar2; workshop_conveyor_num_slots = 0; for (puVar1 = (undefined4 *)deref_next_if_not_null(&(actors[0].parts_linked_list)->next); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { *(undefined2 *)((int)puVar1 + 0x5e) = 0; *(undefined2 *)(puVar1 + 0x14) = 0; if (param_1 != 0) { puVar2 = load_aseq(*(short *)((int)puVar1 + 0x12)); *(undefined4 **)((int)puVar1 + 0x52) = puVar2; aseq_anim_state_set_which_rect_xxx(*(int *)((int)puVar1 + 0x52),1); } fill_rect_anim_w_h((int)(puVar1 + 0x12)); if ((*(byte *)((int)puVar1 + 0x1d) & 0x80) == 0) { *(short *)((int)puVar1 + 0x4a) = 0x9a - *(short *)((int)puVar1 + 0x4e); *(ushort *)((int)puVar1 + 0x36) = *(ushort *)((int)puVar1 + 0x36) | 1; *(word *)(puVar1 + 0x12) = loaded_parts[*(short *)(puVar1 + 7)].rect_and_anim_for_conveyor.rect.x; } else { *(short *)(puVar1 + 0x12) = param_2 - (*(short *)(puVar1 + 0x13) >> 1); *(short *)((int)puVar1 + 0x4a) = 0xdf - *(short *)((int)puVar1 + 0x4e); *(ushort *)((int)puVar1 + 0x36) = *(ushort *)((int)puVar1 + 0x36) & 0xfffe; param_2 = param_2 + -0xa0; workshop_conveyor_num_slots = workshop_conveyor_num_slots + 1; } *(ushort *)(puVar1 + 0x12) = *(ushort *)(puVar1 + 0x12) & 0xfffe; if ((param_1 != 0) && ((*(byte *)((int)puVar1 + 0x37) & 0x80) != 0)) { workshop_populate_veh_parts_struct((int)puVar1); *(ushort *)((int)puVar1 + 0x5e) = *(ushort *)((int)puVar1 + 0x5e) | 2; } } return; } void __stdcall FUN_0043e940(void) { undefined4 *puVar1; undefined4 uVar2; for (puVar1 = (undefined4 *)deref_next_if_not_null(&(actors[0].parts_linked_list)->next); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { uVar2 = free_aseq(*(int **)((int)puVar1 + 0x52)); *(undefined4 *)((int)puVar1 + 0x52) = uVar2; } return; } short __cdecl workshop_veh_parts_sort(int param_1,int param_2) { return *(short *)(param_2 + 10) - *(short *)(param_1 + 10); } void __cdecl workshop_pick_up_item_from_veh(int param_1) { if (repost_mouse_downup != 0) { repost_mouse_downup = 1; } if ((DAT_0044b926 != 0) && (DAT_0044b922 == 0xffff)) { DAT_0044b926 = 0; mouse_up_change_prio(DAT_00452118,10); workshop_currently_held_part = (part_chunk *)workshop_remove_parts_from_veh(*(short *)(param_1 + 0x1e) + -4000); workshop_currently_held_part->state_flags = workshop_currently_held_part->state_flags & 0x7fff; DAT_0044b922 = workshop_currently_held_part->state_flags & 0x7fff; workshop_pick_up_item_inner((int)workshop_currently_held_part); DAT_00452180 = 1; play_wave_flag1(workshop_waves_2000[3],1,0); } return; } void __cdecl workshop_pick_up_item_from_conveyor(int param_1) { part_chunk *ppVar1; part_chunk *ppVar2; if (DAT_0044b926 != 0) { DAT_0044b926 = 0; ppVar1 = workshop_conveyor_cur_part_b; ppVar2 = workshop_conveyor_cur_part_a; if (*(int *)(param_1 + 0x1e) == 0) { ppVar1 = workshop_conveyor_cur_part_a; ppVar2 = workshop_conveyor_cur_part_b; } if ((ppVar1 != (part_chunk *)0x0) && ((ppVar1->state_flags_2 & 2) == 0)) { mouse_up_change_prio(DAT_00452118,10); workshop_currently_held_part = ppVar1; workshop_pick_up_item_inner((int)ppVar1); DAT_0044b922 = 0; anim_state_xxx_list_remove((int *)(ppVar1->rect_and_anim_for_conveyor).anim); play_wave_flag1(*workshop_waves_2000,1,0); DAT_00452180 = 0; if ((ppVar2 == (part_chunk *)0x0) || (((int)(short)ppVar2->state_flags & 0x8000U) == 0)) { DAT_00452180 = 1; } } } return; } void __stdcall workshop_go_race(void) { if ((DAT_0044b926 != 0) && (DAT_0044b922 == -1)) { DAT_0044b926 = 0; if (loaded_area_parts->num_parts_needed == (save_file_big->basic_stats).parts_have) { go_race = 1; xxxfunc_set(&from_warehouse_modeswitch_funcset); return; } enqueue_new_player_hint(0x11,0,0); } return; } void __stdcall workshop_recycle_part(void) { word *pwVar1; word wVar2; undefined4 *puVar3; undefined4 uVar4; int iVar5; aseq_anim_state_struct *paVar6; if (DAT_0044b922 != -1) { play_wave_flag1(workshop_waves_2000[2],1,0); mouse_region_remove_by_filter_key(0x1f5); free_cur_cursor(); workshop_currently_held_part->state_flags_2 = 2; workshop_currently_held_part->state_flags = workshop_currently_held_part->state_flags | 0x4000; wVar2 = workshop_currently_held_part->idx_in_file; puVar3 = (undefined4 *)part_clear_status_and_find_xxxx(wVar2); uVar4 = part_get_is_not_decoration(wVar2); iVar5 = actor_take_part(0,wVar2,1); status_bar_remove_mouse_and_position_xxx(puVar3); place_item_randomly_on_random_screen(wVar2); paVar6 = (aseq_anim_state_struct *) free_aseq((int *)(workshop_currently_held_part->rect_and_anim_for_conveyor).anim); (workshop_currently_held_part->rect_and_anim_for_conveyor).anim = paVar6; mouse_up_change_prio(DAT_00452118,1); if (((short)iVar5 == 0) && ((short)uVar4 != 0)) { pwVar1 = &(save_file_big->basic_stats).parts_needed; *pwVar1 = *pwVar1 + 1; } DAT_0044b922 = -1; new_player_hint(6); status_bar_flags = status_bar_flags | 0x20; } return; } void __stdcall workshop_put_part_on_vehicle(void) { word *pwVar1; word wVar2; undefined4 *puVar3; if (DAT_0044b922 != -1) { if (workshop_currently_held_part->slot == 11) { // paint? wVar2 = workshop_currently_held_part->perf; for (puVar3 = (undefined4 *)deref_next_if_not_null(workshop_veh_parts_list); puVar3 != (undefined4 *)0x0; puVar3 = (undefined4 *)deref_next(puVar3)) { play_wave_flag1(workshop_waves_2000[0xb],1,0); paint_vehicle_piece((int)puVar3,wVar2,0); save_file_big->vehicle_colors_shapes[save_file_big->area] = (char)wVar2; } (save_file_big->basic_stats).vehicle_color = wVar2; workshop_currently_held_part->state_flags_2 = workshop_currently_held_part->state_flags_2 & 0xfffc; free_cur_cursor(); anim_state_xxx_list_insert_4 ((undefined4 *)(workshop_currently_held_part->rect_and_anim_for_conveyor).anim); } else { if (DAT_00452180 == 0) { return; } free_cur_cursor(); workshop_currently_held_part->state_flags_2 = 2; workshop_currently_held_part->state_flags = workshop_currently_held_part->state_flags | 0x8000 ; workshop_populate_veh_parts_struct((int)workshop_currently_held_part); if (workshop_currently_held_part->is_not_decoration != 0) { pwVar1 = &(save_file_big->basic_stats).parts_have; *pwVar1 = *pwVar1 + 1; } play_wave_flag1(workshop_waves_2000[1],1,0); } status_bar_flags = status_bar_flags | 0x20; mouse_region_remove_by_filter_key(501); DAT_0044b922 = -1; mouse_up_change_prio(DAT_00452118,1); if ((loaded_area_parts->num_parts_needed == (save_file_big->basic_stats).parts_have) && ((save_file_big->basic_stats).xxx_built_vehicle_related == 0)) { (save_file_big->basic_stats).xxx_built_vehicle_related = 1; increment_score(100,0); } } return; } void __cdecl workshop_populate_veh_parts_struct(int param_1) { word wVar1; short sVar2; aseq_anim_state_struct *paVar3; mouse_region *pmVar4; workshop_veh_parts_struct *unaff_EBX; short sVar5; short local_6; wVar1 = *(word *)(param_1 + 0x60); sVar2 = *(short *)(param_1 + 0x18); sVar5 = 0; local_6 = 0; if (0 < sVar2) { joined_r0x0043edc2: do { if (sVar5 < 0x1e) { if (workshop_veh_parts_structs[sVar5].inuse != 0) { sVar5 = sVar5 + 1; goto joined_r0x0043edc2; } unaff_EBX = workshop_veh_parts_structs + sVar5; } unaff_EBX->prio = *(word *)(param_1 + 0x2e + local_6 * 2); (unaff_EBX->anim).w = 0; unaff_EBX->inuse = 1; (unaff_EBX->anim).rect.x = *(word *)(param_1 + 0x1e + local_6 * 2); (unaff_EBX->anim).rect.y = *(word *)(param_1 + 0x26 + local_6 * 2); paVar3 = (aseq_anim_state_struct *)load_aseq(*(short *)(param_1 + 0x14)); (unaff_EBX->anim).anim = paVar3; unaff_EBX->part_idx_in_file = wVar1; unaff_EBX->part = (part_chunk *)param_1; aseq_set_pos_order((int)(unaff_EBX->anim).anim,(unaff_EBX->anim).rect.x, (unaff_EBX->anim).rect.y,unaff_EBX->prio); if ((save_file_big->basic_stats).vehicle_color == -1) { if ((short)wVar1 < 4) { save_file_big->vehicle_colors_shapes[save_file_big->area] = *(char *)(param_1 + 0x38); } } else { paint_vehicle_piece((int)unaff_EBX,(save_file_big->basic_stats).vehicle_color,0); save_file_big->vehicle_colors_shapes[save_file_big->area] = (char)(save_file_big->basic_stats).vehicle_color; } fill_rect_anim_w_h((int)&unaff_EBX->anim); pmVar4 = (mouse_region *) mouse_region_new_up((unaff_EBX->anim).rect.x,(unaff_EBX->anim).rect.y, (unaff_EBX->anim).rect.w,(unaff_EBX->anim).rect.h, unaff_EBX->prio + 0x14,0x43e985); unaff_EBX->mouse_struct = pmVar4; mouse_region_set_filter_key((int)unaff_EBX->mouse_struct,5); mouse_region_set_extra_data((int)unaff_EBX->mouse_struct,(short)wVar1 + 4000); anim_state_xxx_list_insert_4((undefined4 *)(unaff_EBX->anim).anim); linked_list_insert_sorted (workshop_veh_parts_list,(undefined4 *)unaff_EBX,workshop_veh_parts_sort); local_6 = local_6 + 1; } while (local_6 < sVar2); } return; } int __cdecl workshop_remove_parts_from_veh(short param_1) { word *pwVar1; int *piVar2; int iVar3; undefined4 uVar4; int *piVar5; int local_c; short local_6; piVar2 = (int *)deref_next_if_not_null(workshop_veh_parts_list); iVar3 = part_get_chunk_by_file_idx(param_1); if (*(short *)(iVar3 + 0xe) != 0) { pwVar1 = &(save_file_big->basic_stats).parts_have; *pwVar1 = *pwVar1 - 1; } local_6 = *(short *)(iVar3 + 0x18); while ((piVar5 = piVar2, piVar5 != (int *)0x0 && (local_6 != 0))) { piVar2 = (int *)deref_next(piVar5); if (*(short *)((int)piVar5 + 0x1a) == param_1) { if (((save_file_big->basic_stats).vehicle_color != -1) && (*(short *)(iVar3 + 0x14) == *(short *)(iVar3 + 0x12))) { paint_vehicle_piece((int)piVar5,(save_file_big->basic_stats).vehicle_color,1); } *(undefined2 *)(piVar5 + 2) = 0; mouse_region_delete_from_2((int *)piVar5[8]); linked_list_unlink(workshop_veh_parts_list,piVar5); uVar4 = free_aseq(*(int **)((int)piVar5 + 0x16)); *(undefined4 *)((int)piVar5 + 0x16) = uVar4; local_c = piVar5[7]; local_6 = local_6 + -1; } } return local_c; } void __stdcall workshop_veh_parts_load_aseqs(void) { undefined4 *puVar1; undefined4 *puVar2; for (puVar1 = (undefined4 *)deref_next_if_not_null(workshop_veh_parts_list); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { if (*(int *)((int)puVar1 + 0x16) == 0) { puVar2 = load_aseq(*(short *)(puVar1[7] + 0x14)); *(undefined4 **)((int)puVar1 + 0x16) = puVar2; fill_rect_anim_w_h((int)(puVar1 + 3)); } aseq_set_pos_order(*(int *)((int)puVar1 + 0x16),*(short *)(puVar1 + 3), *(short *)((int)puVar1 + 0xe),*(short *)((int)puVar1 + 10)); anim_state_xxx_list_insert_4(*(undefined4 **)((int)puVar1 + 0x16)); } return; } void __stdcall workshop_veh_parts_free_aseqs(void) { undefined4 *puVar1; undefined4 uVar2; for (puVar1 = (undefined4 *)deref_next_if_not_null(workshop_veh_parts_list); puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { if (*(int *)((int)puVar1 + 0x16) != 0) { uVar2 = free_aseq(*(int **)((int)puVar1 + 0x16)); *(undefined4 *)((int)puVar1 + 0x16) = uVar2; } } return; } void __stdcall workshop_conveyor_parts_position_aseqs(void) { undefined4 *puVar1; undefined4 uVar2; short local_c; undefined2 local_a; undefined2 local_8; undefined2 local_6; puVar1 = (undefined4 *)deref_next_if_not_null(&(actors[0].parts_linked_list)->next); local_c = 0x93; local_a = 0; local_8 = 0xda; local_6 = 0x200; for (; puVar1 != (undefined4 *)0x0; puVar1 = (undefined4 *)deref_next(puVar1)) { anim_state_xxx_list_remove(*(int **)((int)puVar1 + 0x52)); if (((((int)*(short *)((int)puVar1 + 0x36) & 0x8000U) == 0) && ((*(byte *)((int)puVar1 + 0x5e) & 3) == 0)) && (uVar2 = zomg_intersect_rect((short *)(puVar1 + 0x12),&local_c), (short)uVar2 != 0)) { aseq_set_pos_order(*(int *)((int)puVar1 + 0x52),*(short *)(puVar1 + 0x12), *(short *)((int)puVar1 + 0x4a),5); anim_state_xxx_list_insert_4(*(undefined4 **)((int)puVar1 + 0x52)); } } return; } undefined4 __stdcall FUN_0043f14c(void) { short sVar1; undefined4 *puVar2; short sVar3; undefined4 uVar4; puVar2 = (undefined4 *)deref_next_if_not_null(&(actors[0].parts_linked_list)->next); uVar4 = 0xffffffff; sVar1 = wave_is_playing_(workshop_waves_2000[4]); if ((sVar1 == 0) && (sVar1 = wave_is_playing_(workshop_waves_2000[5]), sVar1 == 0)) { play_wave_flag1(workshop_waves_2000[5],2,0); } sVar1 = DAT_004521d6; DAT_004521d6 = DAT_004521d6 + -6; sVar3 = 6; if (DAT_004521d6 < 0) { DAT_004521d6 = 0; uVar4 = 0; sVar3 = sVar1; } if (DAT_004521d6 == 0) { FUN_00404c80((int)workshop_upper_belt_rollers_aseq); FUN_00404c80((int)workshop_lower_belt_rollers_aseq); FUN_00404c80((int)workshop_upper_belt_surface_aseq); FUN_00404c80((int)workshop_lower_belt_surface_aseq); stop_playing_wave_by_id_type1(workshop_waves_2000[5]); play_wave_flag1(workshop_waves_2000[6],3,0); } for (; puVar2 != (undefined4 *)0x0; puVar2 = (undefined4 *)deref_next(puVar2)) { *(short *)(puVar2 + 0x12) = *(short *)(puVar2 + 0x12) - sVar3; } return uVar4; } bool __stdcall FUN_0043f24b(void) { short sVar1; undefined4 *puVar2; short sVar3; bool bVar4; puVar2 = (undefined4 *)deref_next_if_not_null(&(actors[0].parts_linked_list)->next); sVar1 = wave_is_playing_(workshop_waves_2000[4]); if ((sVar1 == 0) && (sVar1 = wave_is_playing_(workshop_waves_2000[5]), sVar1 == 0)) { play_wave_flag1(workshop_waves_2000[5],2,0); } sVar1 = DAT_004521d6; DAT_004521d6 = DAT_004521d6 + -6; bVar4 = -1 < DAT_004521d6; sVar3 = 6; if (!bVar4) { DAT_004521d6 = 0; sVar3 = sVar1; } if (DAT_004521d6 == 0) { FUN_00404c80((int)workshop_upper_belt_rollers_aseq); FUN_00404c80((int)workshop_lower_belt_rollers_aseq); FUN_00404c80((int)workshop_upper_belt_surface_aseq); FUN_00404c80((int)workshop_lower_belt_surface_aseq); stop_playing_wave_by_id_type1(workshop_waves_2000[5]); play_wave_flag1(workshop_waves_2000[6],3,0); } for (; puVar2 != (undefined4 *)0x0; puVar2 = (undefined4 *)deref_next(puVar2)) { *(short *)(puVar2 + 0x12) = *(short *)(puVar2 + 0x12) + sVar3; } return bVar4; } void __cdecl workshop_setup_mouse_regions_for_items_on_conveyor(int param_1) { int *piVar1; uint uVar2; if (param_1 != 0) { mouse_region_remove_by_filter_key(500); piVar1 = mouse_region_new_up(*(short *)(param_1 + 0x48),*(short *)(param_1 + 0x4a), *(short *)(param_1 + 0x4c),*(short *)(param_1 + 0x4e),5,0x43ea31); mouse_region_set_filter_key((int)piVar1,500); mouse_region_set_extra_data((int)piVar1,0); if (*(short *)(param_1 + 0x1c) != -1) { uVar2 = (int)*(short *)(param_1 + 0x1c) & 0x7fff; piVar1 = mouse_region_new_up(loaded_parts[uVar2].rect_and_anim_for_conveyor.rect.x, loaded_parts[uVar2].rect_and_anim_for_conveyor.rect.y, loaded_parts[uVar2].rect_and_anim_for_conveyor.rect.w, loaded_parts[uVar2].rect_and_anim_for_conveyor.rect.h,5,0x43ea31) ; mouse_region_set_filter_key((int)piVar1,500); mouse_region_set_extra_data((int)piVar1,1); } } return; } void __cdecl workshop_pick_up_item_inner(int param_1) { undefined4 *puVar1; int *piVar2; undefined2 uVar3; status_bar_set_text_flags_0x10(*(undefined4 *)(param_1 + 0x5a)); *(ushort *)(param_1 + 0x5e) = *(ushort *)(param_1 + 0x5e) | 1; puVar1 = (undefined4 *) aseq_setup_as_cursor (*(int *)(param_1 + 0x52),*(short *)(param_1 + 0x4c) >> 1, *(short *)(param_1 + 0x4e) >> 1); set_custom_cursor(puVar1); clip_cursor_enable(0,0x11,0x1ff,0x129); uVar3 = 501; piVar2 = mouse_region_new_up(0x73,0xe1,0x120,0x5c,0x32,0x43ec27); mouse_region_set_filter_key((int)piVar2,uVar3); return; } void __stdcall FUN_0043f47a(void) { if (DAT_0044b922 != -1) { mouse_up_change_prio(DAT_00452118,1); free_cur_cursor(); workshop_currently_held_part->state_flags_2 = workshop_currently_held_part->state_flags_2 & 0xfffc; mouse_region_remove_by_filter_key(0x1f5); DAT_0044b922 = -1; status_bar_flags = status_bar_flags | 0x20; aseq_set_pos_order((int)(workshop_currently_held_part->rect_and_anim_for_conveyor).anim, (workshop_currently_held_part->rect_and_anim_for_conveyor).rect.x, (workshop_currently_held_part->rect_and_anim_for_conveyor).rect.y,5); aseq_anim_reset_and_play ((undefined4 *)(workshop_currently_held_part->rect_and_anim_for_conveyor).anim); } return; } void __cdecl FUN_0043f4f8(int param_1) { if (workshop_periodic_state == 9) { DAT_004521ae = *(undefined2 *)(param_1 + 0x1e); workshop_periodic_state = 0xc; } return; } void __cdecl load_blue(short param_1) { short sVar1; short sVar2; short sVar3; short sVar4; short sVar5; undefined2 *puVar6; int iVar7; undefined4 *puVar8; short *psVar9; int *piVar10; char *pcVar11; puVar6 = (undefined2 *)load_resource_item_0(param_1,(int *)&blue); blue_loaded = puVar6; sVar1 = deref_word(puVar6); blue_word0_calc = (short)(((int)sVar1 << 4) / 10) + 29; sVar1 = deref_word(puVar6 + 1); blue_word1_calc = (short)((sVar1 * 0xc0) / 100) + 17; blue_objects_count = deref_word(puVar6 + 2); pcVar11 = (char *)(puVar6 + 3); blue_name = pcVar11; iVar7 = strlen(pcVar11); pcVar11 = pcVar11 + iVar7 + 1; blue_object_explanations = alloc_tracked_heap_block((int)blue_objects_count << 2); for (sVar1 = 0; sVar1 < blue_objects_count; sVar1 = sVar1 + 1) { *(char **)(blue_object_explanations + sVar1 * 4) = pcVar11; iVar7 = strlen(pcVar11); pcVar11 = pcVar11 + iVar7 + 1; } blue_aseq = alloc_tracked_heap_block((int)blue_objects_count << 2); blue_aseq_related_xxx = alloc_tracked_heap_block((int)blue_objects_count << 2); for (sVar1 = 0; sVar1 < blue_objects_count; sVar1 = sVar1 + 1) { sVar5 = deref_word((undefined2 *)pcVar11); puVar8 = load_aseq(sVar5); *(undefined4 **)(blue_aseq + sVar1 * 4) = puVar8; iVar7 = aseq_setup_as_cursor(*(int *)(blue_aseq + sVar1 * 4),0,0); *(int *)(blue_aseq_related_xxx + sVar1 * 4) = iVar7; pcVar11 = pcVar11 + 2; } blue_tooltip_text = alloc_tracked_heap_block((int)blue_objects_count << 2); for (sVar1 = 0; sVar1 < blue_objects_count; sVar1 = sVar1 + 1) { *(char **)(blue_tooltip_text + sVar1 * 4) = pcVar11; iVar7 = strlen(pcVar11); pcVar11 = pcVar11 + iVar7 + 1; } blue_another_count = deref_word((undefined2 *)pcVar11); pcVar11 = pcVar11 + 2; psVar9 = (short *)alloc_tracked_heap_block((int)blue_another_count << 4); blue_another_data = psVar9; for (sVar1 = 0; sVar1 < blue_another_count; sVar1 = sVar1 + 1) { sVar5 = deref_word((undefined2 *)(pcVar11 + 2)); sVar5 = (short)(((int)sVar5 << 4) / 10) + 29; *psVar9 = sVar5; sVar2 = deref_word((undefined2 *)(pcVar11 + 4)); sVar2 = (short)((sVar2 * 0xc0) / 100) + 17; psVar9[1] = sVar2; sVar3 = deref_word((undefined2 *)(pcVar11 + 6)); sVar3 = (short)(((int)sVar3 << 4) / 10); psVar9[2] = sVar3; sVar4 = deref_word((undefined2 *)(pcVar11 + 8)); sVar4 = (short)((sVar4 * 0xc0) / 100); psVar9[3] = sVar4; piVar10 = mouse_region_new_up(sVar5,sVar2,sVar3,sVar4,5,0x43f4f8); sVar5 = deref_word((undefined2 *)(pcVar11 + 10)); mouse_region_set_extra_data((int)piVar10,(int)sVar5); psVar9[4] = sVar5; *(undefined4 *)(psVar9 + 6) = *(undefined4 *)(blue_aseq_related_xxx + sVar5 * 4); psVar9[5] = (ushort)(sVar4 == 0); pcVar11 = pcVar11 + 0xc; psVar9 = psVar9 + 8; } blue_wave_idxs = alloc_tracked_heap_block((int)blue_objects_count << 2); for (sVar1 = 0; sVar1 < blue_objects_count; sVar1 = sVar1 + 1) { sVar5 = deref_word((undefined2 *)pcVar11); *(char **)(blue_wave_idxs + sVar1 * 4) = pcVar11; pcVar11 = pcVar11 + (sVar5 + 1) * 2; } return; } void __stdcall free_blue(void) { short sVar1; free_tracked_heap_block(blue_wave_idxs); for (sVar1 = 0; sVar1 < blue_objects_count; sVar1 = sVar1 + 1) { aseq_free_cursor(*(int *)(blue_aseq_related_xxx + sVar1 * 4)); free_aseq(*(int **)(blue_aseq + sVar1 * 4)); } free_tracked_heap_block(blue_aseq); free_tracked_heap_block(blue_another_data); free_tracked_heap_block(blue_aseq_related_xxx); free_tracked_heap_block(blue_tooltip_text); free_tracked_heap_block(blue_object_explanations); free_resource_item_with_data(blue_loaded); return; } void __stdcall FUN_0043f890(void) { aseq_anim_reset_and_play(blue_done_aseq); DAT_0044b960 = 1; if (DAT_00452112 != 0) { DAT_0044b910 = 0; free_wave_flag_2(DAT_00452112); DAT_00452112 = 0; workshop_periodic_state = 10; } return; } void __stdcall blue_xxx_load_aseq_stuff(void) { DAT_0044b960 = 0; DAT_0044b95c = 1; mouse_region_stash_lists(); (save_file_big->basic_stats).xxx_blueprint_related = 1; FUN_0043e1b5(0xfff); PTR_s_Level__0044b964[6] = (char)save_file_big->level_in_building + '1'; load_blue(blue_idx_list[save_file_big->area]); blue_done_aseq = load_aseq(2007); *(undefined2 *)((int)blue_done_aseq + 0x4e) = 1; aseq_set_pos_order((int)blue_done_aseq,0x18d,0x110,0x3c); anim_state_xxx_list_insert_4(blue_done_aseq); mouse_region_new_for_anim_wrapped((int)blue_done_aseq,1,0,0x43f890); midi_pause_current(); return; } void __stdcall workshop_clean_up_blue(void) { set_cursor_override_regions(0,0); restore_cursor_override_regions(); workshop_blueprint_bg_aseq = (aseq_anim_state_struct *)free_aseq((int *)workshop_blueprint_bg_aseq); workshop_blueprint_expand_aseq = (aseq_anim_state_struct *)free_aseq((int *)workshop_blueprint_expand_aseq); blue_done_aseq = (int *)free_aseq(blue_done_aseq); mouse_region_unstash_list(); DAT_0044b95c = 0; free_blue(); anim_state_xxx_restore_list(); restart_current_midi(0); return; } void __stdcall workshop_new_veh_parts_list(void) { workshop_veh_parts_list = alloc_linked_list_marker(); return; } void __stdcall workshop_roll_conveyor_left(void) { if ((((DAT_0044b926 != 0) && (DAT_004521d4 == 0)) && (DAT_0044b922 == -1)) && (workshop_conveyor_idx != 0)) { DAT_0044b926 = 0; play_wave_flag1(workshop_waves_2000[4],3,0); DAT_004521d6 = 0xa0; DAT_004521d4 = -1; workshop_conveyor_idx = workshop_conveyor_idx + -1; workshop_conveyor_cur_part_a = workshop_conveyor_parts[workshop_conveyor_idx]; workshop_conveyor_cur_part_b = (part_chunk *)part_get_other_part_in_slot((int)workshop_conveyor_cur_part_a); aseq_select_anim((int)workshop_upper_belt_rollers_aseq,0); aseq_select_anim((int)workshop_lower_belt_rollers_aseq,0); aseq_anim_reset_and_play((undefined4 *)workshop_upper_belt_rollers_aseq); aseq_anim_reset_and_play((undefined4 *)workshop_lower_belt_rollers_aseq); aseq_anim_reset_and_play((undefined4 *)workshop_upper_belt_surface_aseq); aseq_anim_reset_and_play((undefined4 *)workshop_lower_belt_surface_aseq); workshop_periodic_state = 6; } return; } void __stdcall workshop_roll_conveyor_right(void) { if ((((DAT_0044b926 != 0) && (DAT_004521d4 == 0)) && (DAT_0044b922 == -1)) && (workshop_conveyor_idx < workshop_conveyor_num_slots_minus_1)) { DAT_0044b926 = 0; play_wave_flag1(workshop_waves_2000[4],3,0); DAT_004521d6 = 0xa0; DAT_004521d4 = 1; workshop_conveyor_idx = workshop_conveyor_idx + 1; workshop_conveyor_cur_part_a = workshop_conveyor_parts[workshop_conveyor_idx]; workshop_conveyor_cur_part_b = (part_chunk *)part_get_other_part_in_slot((int)workshop_conveyor_cur_part_a); aseq_select_anim((int)workshop_upper_belt_rollers_aseq,1); aseq_select_anim((int)workshop_lower_belt_rollers_aseq,1); aseq_anim_reset_and_play((undefined4 *)workshop_upper_belt_rollers_aseq); aseq_anim_reset_and_play((undefined4 *)workshop_lower_belt_rollers_aseq); aseq_anim_reset_and_play((undefined4 *)workshop_upper_belt_surface_aseq); aseq_anim_reset_and_play((undefined4 *)workshop_lower_belt_surface_aseq); workshop_periodic_state = 5; } return; } void __stdcall workshop_open_blueprint(void) { if ((DAT_0044b926 != 0) && (DAT_0044b922 == -1)) { workshop_periodic_state = 7; DAT_0044b926 = 0; } return; } void __stdcall workshop_go_through_pipe(void) { if ((DAT_0044b926 != 0) && (DAT_0044b922 == -1)) { actors[0].saved.idx_of_up_warp_related = 0xffff; (*(code *)actors[0].eseq_action_11_cb_a)(); (save_file_big->basic_stats).green_tube_hint_flag = 1; workshop_periodic_state = 3; DAT_0044b926 = 0; } return; } void __stdcall workshop_key_handler(void) { short sVar1; sVar1 = pump_messages_and_get_key_(); if (sVar1 == VK_RETURN) { FUN_0043f890(); return; } if (sVar1 == 0x25) { workshop_roll_conveyor_left(); return; } if (sVar1 == 0x26) { workshop_go_through_pipe(); return; } if (sVar1 != 0x27) { return; } workshop_roll_conveyor_right(); return; } void __stdcall workshop_on_load(void) { int *piVar1; int iVar2; short sVar3; short sVar4; word *pwVar5; short local_6; nullishsub(); DAT_0044b926 = 0; DAT_0044b95e = 1; key_xxxxx_inc(); key_xxxxx_set(workshop_key_handler); anim_engine_set_custom_command_handler(custom_anim_command_handler); DAT_00449c4c = 0; DAT_00449c4a = 1; set_specific_gfx_rect(0x94,-1,0x16b,-1); on_deactivate_xtra_cb = FUN_0043f47a; DAT_00452184 = 0; linked_list_head_zero(workshop_veh_parts_list); workshop_veh_parts_structs = (workshop_veh_parts_struct *)alloc_tracked_heap_block(0x438); sVar4 = 0; do { workshop_veh_parts_structs[sVar4].inuse = 0; sVar4 = sVar4 + 1; } while (sVar4 < 0x1e); sVar4 = 0; do { local_6 = trophy_ypos[sVar4]; for (sVar3 = 0; sVar3 <= (short)save_file_big->num_built_vehicles[sVar4]; sVar3 = sVar3 + 1) { piVar1 = load_aseq(sVar3 + 2008); aseq_draw_to_both_fbs((int)piVar1,trophy_xpos[sVar3],local_6,0); free_aseq(piVar1); local_6 = local_6 + -4; } sVar4 = sVar4 + 1; } while (sVar4 < 3); building_name_aseq = (aseq_anim_state_struct *)load_aseq(save_file_big->building_idx + 2015); aseq_set_pos_order((int)building_name_aseq,8,0x38,5); anim_state_xxx_list_insert_4((undefined4 *)building_name_aseq); sector_aseq = load_aseq((save_file_big->basic_stats).building_sector + 2017); aseq_set_pos_order((int)sector_aseq,0xa6,0x36,5); anim_state_xxx_list_insert_4(sector_aseq); workshop_conveyor_idx = 0; wave_ints_xxxxxxxxx = (short *)load_wave_by_ints(2000); workshop_waves_2000 = wave_ints_xxxxxxxxx; load_midi(6034); midi_stop_and_play(6034,1); workshop_load_parts_for_conveyor(1,0x100); status_bar_flags = 0x20; draw_status_bar(0); workshop_conveyor_parts_position_aseqs(); workshop_veh_parts_load_aseqs(); workshop_upper_belt_surface_aseq = (aseq_anim_state_struct *)load_aseq(2003); anim_state_xxx_list_insert_8004((undefined4 *)workshop_upper_belt_surface_aseq); aseq_draw_gfx_and_xxx((int)workshop_upper_belt_surface_aseq,-0x8000,-0x8000,0,6); workshop_lower_belt_surface_aseq = (aseq_anim_state_struct *)load_aseq(2004); aseq_draw_gfx_and_xxx((int)workshop_lower_belt_surface_aseq,-0x8000,-0x8000,0,6); anim_state_xxx_list_insert_8004((undefined4 *)workshop_lower_belt_surface_aseq); workshop_upper_belt_rollers_aseq = (aseq_anim_state_struct *)load_aseq(2001); anim_state_xxx_list_insert_8004((undefined4 *)workshop_upper_belt_rollers_aseq); workshop_lower_belt_rollers_aseq = (aseq_anim_state_struct *)load_aseq(2002); anim_state_xxx_list_insert_8004((undefined4 *)workshop_lower_belt_rollers_aseq); DAT_004520e4 = 0; workshop_racetrack_aseq = (aseq_anim_state_struct *)load_aseq(2014); workshop_race_light_red = (aseq_anim_state_struct *)load_aseq(2021); workshop_race_light_green = (aseq_anim_state_struct *)load_aseq(2022); FUN_0043e5e8(0); workshop_green_tube_anim = (aseq_anim_state_struct *)load_aseq(2013); aseq_select_anim((int)workshop_green_tube_anim,1); aseq_anim_reset_and_play((undefined4 *)workshop_green_tube_anim); DAT_00452118 = mouse_region_new_up(0x93,0x56,0xda,0x89,7,0x43f47a); mouse_region_new_up(0xb5,0x49,0x36,0x1b,7,0x43fa0f); mouse_region_new_up(0x115,0x49,0x36,0x1b,7,0x43fb01); mouse_region_new_up(0x4d,0xc0,0x48,0x4f,5,0x43eb41); mouse_region_new_up(0x17b,0x4b,0x4a,0x3a,5,0x43fbf8); mouse_region_new_up(0x1da,0xd3,0x26,0x6c,5,0x43eae6); mouse_region_new_up(0x15,0x41,0x30,0xfa,5,0x43fc1f); workshop_periodic_state = 0; DAT_0044b922 = 0xffff; DAT_004521d4 = 0; workshop_conveyor_cur_part_a = (part_chunk *)deref_next_if_not_null(&(actors[0].parts_linked_list)->next); workshop_conveyor_cur_part_b = (part_chunk *)part_get_other_part_in_slot((int)workshop_conveyor_cur_part_a); mouse_up_change_prio(DAT_00452118,1); workshop_setup_mouse_regions_for_items_on_conveyor((int)workshop_conveyor_cur_part_a); part_find_all_on_conveyors(workshop_conveyor_parts); pwVar5 = &(save_file_big->basic_stats).green_tube_hint_flag; iVar2 = time_get_secs_count(8); enqueue_new_player_hint(3,(ushort)iVar2,pwVar5); iVar2 = linked_list_sz(&(actors[0].parts_linked_list)->next); if ((short)iVar2 != 0) { enqueue_new_player_hint(2,0,0); } workshop_conveyor_num_slots_minus_1 = workshop_conveyor_num_slots + -1; FUN_00422170(); return; } void __stdcall workshop_on_remove(void) { short sVar1; if (DAT_0044b95c != 0) { workshop_clean_up_blue(); } workshop_blueprint_expand_aseq = (aseq_anim_state_struct *)free_aseq((int *)workshop_blueprint_expand_aseq); workshop_speak_button_aseq = (aseq_anim_state_struct *)free_aseq((int *)workshop_speak_button_aseq); anim_engine_set_custom_command_handler(0); on_deactivate_xtra_cb = (undefined *)0x0; DAT_0044b95e = 0; wave_ints_xxxxxxxxx = (short *)free_waves_from_list((int)workshop_waves_2000); workshop_waves_2000 = wave_ints_xxxxxxxxx; free_midi(0x1792); set_specific_gfx_rect(0,-1,0x1ff,-1); workshop_upper_belt_surface_aseq = (aseq_anim_state_struct *)free_aseq((int *)workshop_upper_belt_surface_aseq); workshop_lower_belt_surface_aseq = (aseq_anim_state_struct *)free_aseq((int *)workshop_lower_belt_surface_aseq); workshop_upper_belt_rollers_aseq = (aseq_anim_state_struct *)free_aseq((int *)workshop_upper_belt_rollers_aseq); workshop_lower_belt_rollers_aseq = (aseq_anim_state_struct *)free_aseq((int *)workshop_lower_belt_rollers_aseq); building_name_aseq = (aseq_anim_state_struct *)free_aseq((int *)building_name_aseq); sector_aseq = (int *)free_aseq(sector_aseq); workshop_green_tube_anim = (aseq_anim_state_struct *)free_aseq((int *)workshop_green_tube_anim); workshop_racetrack_aseq = (aseq_anim_state_struct *)free_aseq((int *)workshop_racetrack_aseq); workshop_race_light_red = (aseq_anim_state_struct *)free_aseq((int *)workshop_race_light_red); workshop_race_light_green = (aseq_anim_state_struct *)free_aseq((int *)workshop_race_light_green); FUN_0043e940(); workshop_veh_parts_free_aseqs(); sVar1 = 0; do { workshop_veh_parts_structs[sVar1].inuse = 0; sVar1 = sVar1 + 1; } while (sVar1 < 0x1e); free_tracked_heap_block((int)workshop_veh_parts_structs); mouse_region_delete_all_lists(); key_xxxxx_clear(); key_xxxxx_pop(); FUN_0042211c(); return; } void __stdcall FUN_0044029d(void) { undefined2 *puVar1; aseq_anim_reset_and_play((undefined4 *)workshop_speak_button_aseq); DAT_0044b910 = DAT_0044b910 ^ 1; if (DAT_0044b910 != 0) { workshop_periodic_state = 0x10; puVar1 = *(undefined2 **)(blue_wave_idxs + DAT_004521ae * 4); DAT_00452110 = *puVar1; DAT_0045210c = puVar1 + 1; return; } if (DAT_00452112 != 0) { free_wave_flag_2(DAT_00452112); DAT_00452112 = 0; workshop_periodic_state = 10; } return; } void __stdcall FUN_0044031e(void) { short sVar1; int iVar2; short sVar3; byte *pbVar4; FUN_0043e1b5(0xfff); FUN_00401206(0x2a,0x1d,PTR_s_Level__0044b964); sVar3 = 0x1f; pbVar4 = blue_name; sVar1 = nfnt_get_text_width(-1,blue_name); iVar2 = (int)(0x156U - (int)sVar1) >> 1; if (iVar2 < 0) { iVar2 = iVar2 + (uint)((0x156U - (int)sVar1 & 1) != 0); } FUN_00401206((short)iVar2 + 0x7d,sVar3,pbVar4); return; } void __stdcall FUN_00440376(void) { short sVar1; int iVar2; short sVar3; byte *pbVar4; FUN_0043e1b5(0xfff); pbVar4 = *(byte **)(blue_tooltip_text + DAT_004521ae * 4); sVar3 = 0x1f; sVar1 = nfnt_get_text_width(-1,*(byte **)(blue_tooltip_text + DAT_004521ae * 4)); iVar2 = (int)(0x156U - (int)sVar1) >> 1; if (iVar2 < 0) { iVar2 = iVar2 + (uint)((0x156U - (int)sVar1 & 1) != 0); } FUN_00401206((short)iVar2 + 0x7d,sVar3,pbVar4); FUN_0043e266(-1,0x2a,0x36,0x1a1,*(byte **)(blue_object_explanations + DAT_004521ae * 4)); return; } void __stdcall workshop_on_periodic(void) { bool bVar1; short sVar2; undefined3 extraout_var; undefined4 uVar3; if (workshop_periodic_state == 1) { process_new_player_hints(); } FUN_0043e5e8(1); draw_status_bar(1); switch(workshop_periodic_state) { case 0: sVar2 = aseq_anim_get_flags((int)workshop_green_tube_anim); if (sVar2 == 0x10) { workshop_periodic_state = 1; if ((save_file_big->basic_stats).xxx_blueprint_related == 0) { workshop_periodic_state = 7; } return; } break; case 1: DAT_0044b926 = 1; return; case 3: aseq_select_anim((int)workshop_green_tube_anim,0); aseq_anim_reset_and_play((undefined4 *)workshop_green_tube_anim); workshop_periodic_state = 4; return; case 4: sVar2 = aseq_anim_get_flags((int)workshop_green_tube_anim); if (sVar2 == 0x10) { workshop_periodic_state = 0x11; return; } break; case 5: bVar1 = FUN_0043f24b(); DAT_004521d4 = (short)CONCAT31(extraout_var,bVar1); if (DAT_004521d4 == 0) { workshop_periodic_state = 1; workshop_setup_mouse_regions_for_items_on_conveyor((int)workshop_conveyor_cur_part_a); } workshop_conveyor_parts_position_aseqs(); return; case 6: uVar3 = FUN_0043f14c(); DAT_004521d4 = (short)uVar3; if (DAT_004521d4 == 0) { workshop_periodic_state = 1; workshop_setup_mouse_regions_for_items_on_conveyor((int)workshop_conveyor_cur_part_a); } workshop_conveyor_parts_position_aseqs(); return; case 7: anim_state_xxx_new_list(); workshop_load_blueprint_expand(); workshop_periodic_state = 8; return; case 8: sVar2 = aseq_anim_get_flags((int)workshop_blueprint_expand_aseq); if (sVar2 == 0x10) { workshop_periodic_state = 0xb; blue_xxx_load_aseq_stuff(); workshop_blueprint_bg_aseq = (aseq_anim_state_struct *)load_aseq(blue_bg_aseq_idx_list[save_file_big->area]); aseq_set_pos_order((int)workshop_blueprint_bg_aseq,blue_word0_calc,blue_word1_calc,0x37); set_cursor_override_regions(blue_another_data,blue_another_count); return; } break; case 9: new_player_hint(0); if (DAT_0044b960 == 1) { workshop_periodic_state = 0xf; set_cursor_override_regions(0,0); return; } break; case 10: if (DAT_0044b960 == 1) { if (DAT_00452112 != 0) { free_wave_flag_2(DAT_00452112); DAT_00452112 = 0; } workshop_periodic_state = 0xe; return; } break; case 0xb: aseq_anim_mark_all_drawn_invalidated((int)workshop_blueprint_expand_aseq); anim_set_flags_0x800_handler((int)workshop_blueprint_expand_aseq,0x44031e,1); anim_state_xxx_list_insert_4((undefined4 *)workshop_blueprint_bg_aseq); workshop_periodic_state = 9; return; case 0xc: anim_state_xxx_list_remove((int *)workshop_blueprint_bg_aseq); aseq_anim_mark_all_drawn_invalidated((int)workshop_blueprint_expand_aseq); anim_set_flags_0x800_handler((int)workshop_blueprint_expand_aseq,0x440376,1); workshop_periodic_state = 0xd; save_unset_custom_cursor(); case 0xd: workshop_periodic_state = 10; if (are_voices_enabled_for_workshop != 0) { aseq_set_pos_order((int)workshop_speak_button_aseq,0x27,0x1a,0x33); workshop_speak_button_aseq->removal_related = 1; anim_state_xxx_list_insert_4((undefined4 *)workshop_speak_button_aseq); DAT_00452108 = mouse_region_new_for_anim_wrapped((int)workshop_speak_button_aseq,1,0,0x44029d) ; return; } break; case 0xe: sVar2 = aseq_anim_get_flags(blue_done_aseq); if (sVar2 == 0x10) { anim_set_flags_0x800_handler((int)workshop_blueprint_expand_aseq,0,1); if (are_voices_enabled_for_workshop != 0) { anim_state_xxx_list_remove((int *)workshop_speak_button_aseq); mouse_region_delete_from_2(DAT_00452108); } workshop_periodic_state = 0xb; DAT_0044b960 = 0; restore_cursor_override_regions(); return; } break; case 0xf: sVar2 = aseq_anim_get_flags(blue_done_aseq); if (sVar2 == 0x10) { DAT_0044b960 = 0; workshop_clean_up_blue(); workshop_periodic_state = 1; workshop_speak_button_aseq = (aseq_anim_state_struct *)free_aseq((int *)workshop_speak_button_aseq); return; } break; case 0x10: sVar2 = wave_is_playing_(DAT_00452112); if (sVar2 == 0) { if (DAT_00452112 != 0) { free_wave_flag_2(DAT_00452112); DAT_00452112 = 0; } if (DAT_00452110 != 0) { DAT_00452112 = *DAT_0045210c; DAT_0045210c = DAT_0045210c + 1; load_wave_flag_2(DAT_00452112); play_wave_flag2(DAT_00452112); DAT_00452110 = DAT_00452110 + -1; return; } workshop_periodic_state = 10; DAT_0044b910 = DAT_0044b910 ^ 1; aseq_anim_reset_and_play((undefined4 *)workshop_speak_button_aseq); } break; case 0x11: xxxfunc_set(&from_warehouse_modeswitch_funcset); return; } return; } void __cdecl FUN_00440880(int *param_1,short param_2,short param_3) { *param_1 = *param_1 + (int)param_2; param_1[1] = param_1[1] + (int)param_3; param_1[2] = param_1[2] - (int)param_2; param_1[3] = param_1[3] - (int)param_3; return; } void __cdecl FUN_004408a7(int *param_1,short param_2,short param_3) { *param_1 = *param_1 + (int)param_2; param_1[1] = param_1[1] + (int)param_3; param_1[2] = param_1[2] + (int)param_2; param_1[3] = param_1[3] + (int)param_3; return; } bool __cdecl FUN_004408ce(short *param_1,int *param_2) { bool bVar1; if (((((int)*param_1 < *param_2) || (param_2[2] < (int)*param_1)) || ((int)param_1[1] < param_2[1])) || (param_2[3] < (int)param_1[1])) { bVar1 = true; } else { bVar1 = false; } return !bVar1; } void __cdecl get_mouse_xy_relative(short *param_1) { tagPOINT local_c; GetCursorPos(&local_c); ScreenToClient(main_hwnd,&local_c); *param_1 = (short)local_c.x - (short)mouse_xbase; param_1[1] = (short)local_c.y - (short)mouse_ybase; return; } ushort __stdcall is_left_button_down(void) { ushort uVar1; uVar1 = GetAsyncKeyState(VK_LBUTTON); return uVar1 & 0x8000; } uint __cdecl get_mouse_buttons(uint param_1) { ushort uVar1; uint uVar2; uVar2 = 0; if ((param_1 & 1) != 0) { uVar1 = GetAsyncKeyState(VK_LBUTTON); if ((uVar1 & 0x8000) != 0) { uVar2 = 1; } } if ((param_1 & 2) != 0) { uVar1 = GetAsyncKeyState(VK_RBUTTON); if ((uVar1 & 0x8000) != 0) { uVar2 = uVar2 | 2; } } return uVar2; } void __cdecl FUN_0044099f(short *param_1,ushort param_2) { gfxish_fill_rect_wrap(*param_1,param_1[2],param_1[4] - *param_1,param_1[6] - param_1[2],param_2); return; } short __cdecl FUN_004409cf(short *param_1) { return param_1[4] - *param_1; } short __cdecl FUN_004409e0(int param_1) { return *(short *)(param_1 + 0xc) - *(short *)(param_1 + 4); } void __stdcall FUN_004409f2(void) { short sVar1; do { sVar1 = pump_messages_and_get_key(); } while (sVar1 != 0); return; } undefined2 __cdecl deref_word(undefined2 *param_1) { return *param_1; } undefined4 __cdecl read_word_and_inc(int *param_1) { undefined2 uVar1; undefined2 *puVar2; puVar2 = (undefined2 *)*param_1; uVar1 = *puVar2; *param_1 = *param_1 + 2; return CONCAT22((short)((uint)puVar2 >> 0x10),uVar1); } undefined2 __cdecl FUN_00440a21(undefined2 *param_1) { return *param_1; } short __cdecl FUN_00440a2c(byte *param_1) { return (ushort)param_1[1] * 0x100 + (ushort)*param_1; } void __cdecl FUN_00440a44(undefined1 *param_1,short param_2) { undefined1 uVar1; short sVar2; sVar2 = 0; if (0 < param_2) { do { uVar1 = *param_1; *param_1 = param_1[1]; param_1[1] = uVar1; param_1 = param_1 + 2; sVar2 = sVar2 + 1; } while (sVar2 < param_2); } return; } void __cdecl endian_swap_words(undefined1 *param_1,short param_2) { undefined1 uVar1; short sVar2; sVar2 = 0; if (0 < param_2) { do { uVar1 = *param_1; *param_1 = param_1[1]; param_1[1] = uVar1; param_1 = param_1 + 2; sVar2 = sVar2 + 1; } while (sVar2 < param_2); } return; } void __cdecl FUN_00440a96(undefined1 *param_1,short param_2) { undefined1 uVar1; short sVar2; sVar2 = 0; if (0 < param_2) { do { uVar1 = *param_1; *param_1 = param_1[3]; param_1[3] = uVar1; uVar1 = param_1[1]; param_1[1] = param_1[2]; param_1[2] = uVar1; param_1 = param_1 + 4; sVar2 = sVar2 + 1; } while (sVar2 < param_2); } return; } void __cdecl endian_swap_dwords(undefined1 *param_1,short param_2) { undefined1 uVar1; short sVar2; sVar2 = 0; if (0 < param_2) { do { uVar1 = *param_1; *param_1 = param_1[3]; param_1[3] = uVar1; uVar1 = param_1[1]; param_1[1] = param_1[2]; param_1[2] = uVar1; param_1 = param_1 + 4; sVar2 = sVar2 + 1; } while (sVar2 < param_2); } return; } void __cdecl FUN_00440b00(undefined1 *param_1) { undefined1 uVar1; uVar1 = *param_1; *param_1 = param_1[1]; param_1[1] = uVar1; return; } void __cdecl endian_swap_one_word(undefined1 *param_1) { undefined1 uVar1; uVar1 = *param_1; *param_1 = param_1[1]; param_1[1] = uVar1; return; } void __cdecl endian_swap_one_dword(undefined1 *param_1) { undefined1 uVar1; uVar1 = *param_1; *param_1 = param_1[3]; param_1[3] = uVar1; uVar1 = param_1[1]; param_1[1] = param_1[2]; param_1[2] = uVar1; return; } char * __cdecl FUN_00440b44(char *param_1,char param_2,int param_3) { char *pcVar1; undefined1 in_ZF; if (param_3 != 0) { do { pcVar1 = param_1; if (param_3 == 0) break; param_3 = param_3 + -1; pcVar1 = param_1 + 1; in_ZF = param_2 == *param_1; param_1 = pcVar1; } while (!(bool)in_ZF); if ((bool)in_ZF) { return pcVar1 + -1; } } return (char *)0x0; } undefined4 * __cdecl memcpy(undefined4 *param_1,undefined4 *param_2,uint param_3) { uint uVar1; undefined4 *puVar2; puVar2 = param_1; for (uVar1 = param_3 >> 2; uVar1 != 0; uVar1 = uVar1 - 1) { *puVar2 = *param_2; param_2 = param_2 + 1; puVar2 = puVar2 + 1; } for (uVar1 = param_3 & 3; uVar1 != 0; uVar1 = uVar1 - 1) { *(undefined1 *)puVar2 = *(undefined1 *)param_2; param_2 = (undefined4 *)((int)param_2 + 1); puVar2 = (undefined4 *)((int)puVar2 + 1); } return param_1; } undefined4 * __cdecl memmove_maybe(undefined4 *param_1,undefined4 *param_2,uint param_3) { uint uVar1; undefined1 *puVar2; undefined4 *puVar3; undefined1 *puVar4; undefined4 *puVar5; if (param_1 < param_2) { puVar3 = param_1; for (uVar1 = param_3 >> 2; uVar1 != 0; uVar1 = uVar1 - 1) { *puVar3 = *param_2; param_2 = param_2 + 1; puVar3 = puVar3 + 1; } for (uVar1 = param_3 & 3; uVar1 != 0; uVar1 = uVar1 - 1) { *(undefined1 *)puVar3 = *(undefined1 *)param_2; param_2 = (undefined4 *)((int)param_2 + 1); puVar3 = (undefined4 *)((int)puVar3 + 1); } } else if (param_1 != param_2) { puVar2 = (undefined1 *)((int)param_2 + (param_3 - 1)); puVar4 = (undefined1 *)((int)param_1 + (param_3 - 1)); for (uVar1 = param_3 & 3; uVar1 != 0; uVar1 = uVar1 - 1) { *puVar4 = *puVar2; puVar2 = puVar2 + -1; puVar4 = puVar4 + -1; } puVar3 = (undefined4 *)(puVar2 + -3); puVar5 = (undefined4 *)(puVar4 + -3); for (uVar1 = param_3 >> 2; uVar1 != 0; uVar1 = uVar1 - 1) { *puVar5 = *puVar3; puVar3 = puVar3 + -1; puVar5 = puVar5 + -1; } } return param_1; } undefined4 * __cdecl memset(undefined4 *param_1,undefined1 param_2,uint param_3) { uint uVar1; undefined4 *puVar2; puVar2 = param_1; for (uVar1 = param_3 >> 2; uVar1 != 0; uVar1 = uVar1 - 1) { *puVar2 = CONCAT22(CONCAT11(param_2,param_2),CONCAT11(param_2,param_2)); puVar2 = puVar2 + 1; } for (uVar1 = param_3 & 3; uVar1 != 0; uVar1 = uVar1 - 1) { *(undefined1 *)puVar2 = param_2; puVar2 = (undefined4 *)((int)puVar2 + 1); } return param_1; } char * __cdecl strcat(char *param_1,char *param_2) { char cVar1; int iVar2; uint uVar3; uint uVar4; char *pcVar5; char *pcVar6; iVar2 = -1; pcVar5 = param_1; do { pcVar6 = pcVar5; if (iVar2 == 0) break; iVar2 = iVar2 + -1; pcVar6 = pcVar5 + 1; cVar1 = *pcVar5; pcVar5 = pcVar6; } while (cVar1 != '\0'); uVar3 = 0xffffffff; do { pcVar5 = param_2; if (uVar3 == 0) break; uVar3 = uVar3 - 1; pcVar5 = param_2 + 1; cVar1 = *param_2; param_2 = pcVar5; } while (cVar1 != '\0'); uVar3 = ~uVar3; pcVar5 = pcVar5 + -uVar3; pcVar6 = pcVar6 + -1; for (uVar4 = uVar3 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) { *(undefined4 *)pcVar6 = *(undefined4 *)pcVar5; pcVar5 = pcVar5 + 4; pcVar6 = pcVar6 + 4; } for (uVar3 = uVar3 & 3; uVar3 != 0; uVar3 = uVar3 - 1) { *pcVar6 = *pcVar5; pcVar5 = pcVar5 + 1; pcVar6 = pcVar6 + 1; } return param_1; } char * __cdecl FUN_00440c40(char *param_1,char param_2) { char *pcVar1; uint uVar2; bool bVar3; uVar2 = 0xffffffff; bVar3 = true; pcVar1 = param_1; do { if (uVar2 == 0) break; uVar2 = uVar2 - 1; bVar3 = *pcVar1 == '\0'; pcVar1 = pcVar1 + 1; } while (!bVar3); uVar2 = ~uVar2; do { pcVar1 = param_1; if (uVar2 == 0) break; uVar2 = uVar2 - 1; pcVar1 = param_1 + 1; bVar3 = param_2 == *param_1; param_1 = pcVar1; } while (!bVar3); if (bVar3) { pcVar1 = pcVar1 + -1; } else { pcVar1 = (char *)0x0; } return pcVar1; } int __cdecl strcmp2(char *param_1,char *param_2) { char cVar1; char cVar2; uint uVar3; char *pcVar4; char *pcVar5; uVar3 = 0xffffffff; pcVar4 = param_2; do { if (uVar3 == 0) break; uVar3 = uVar3 - 1; cVar1 = *pcVar4; pcVar4 = pcVar4 + 1; } while (cVar1 != '\0'); uVar3 = ~uVar3; do { pcVar4 = param_1; pcVar5 = param_2; if (uVar3 == 0) break; uVar3 = uVar3 - 1; pcVar5 = param_2 + 1; pcVar4 = param_1 + 1; cVar2 = *param_2; cVar1 = *param_1; param_1 = pcVar4; param_2 = pcVar5; } while (cVar1 == cVar2); return (uint)(byte)pcVar4[-1] - (uint)(byte)pcVar5[-1]; } char * __cdecl strcpy(char *param_1,char *param_2) { char cVar1; uint uVar2; uint uVar3; char *pcVar4; uVar2 = 0xffffffff; pcVar4 = param_2; do { if (uVar2 == 0) break; uVar2 = uVar2 - 1; cVar1 = *pcVar4; pcVar4 = pcVar4 + 1; } while (cVar1 != '\0'); pcVar4 = param_1; for (uVar3 = ~uVar2 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { *(undefined4 *)pcVar4 = *(undefined4 *)param_2; param_2 = param_2 + 4; pcVar4 = pcVar4 + 4; } for (uVar2 = ~uVar2 & 3; uVar2 != 0; uVar2 = uVar2 - 1) { *pcVar4 = *param_2; param_2 = param_2 + 1; pcVar4 = pcVar4 + 1; } return param_1; } int __cdecl strlen(char *param_1) { char cVar1; uint uVar2; uVar2 = 0xffffffff; do { if (uVar2 == 0) break; uVar2 = uVar2 - 1; cVar1 = *param_1; param_1 = param_1 + 1; } while (cVar1 != '\0'); return ~uVar2 - 1; } char * __cdecl FUN_00440ce0(char *param_1,char *param_2,uint param_3) { char cVar1; int iVar2; uint uVar3; uint uVar4; uint uVar5; char *pcVar6; char *pcVar7; iVar2 = -1; pcVar6 = param_1; do { pcVar7 = pcVar6; if (iVar2 == 0) break; iVar2 = iVar2 + -1; pcVar7 = pcVar6 + 1; cVar1 = *pcVar6; pcVar6 = pcVar7; } while (cVar1 != '\0'); uVar3 = 0xffffffff; do { pcVar6 = param_2; if (uVar3 == 0) break; uVar3 = uVar3 - 1; pcVar6 = param_2 + 1; cVar1 = *param_2; param_2 = pcVar6; } while (cVar1 != '\0'); uVar4 = ~uVar3 - 1; if (param_3 < uVar4) { uVar4 = param_3; } pcVar6 = pcVar6 + -~uVar3; pcVar7 = pcVar7 + -1; for (uVar5 = uVar4 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) { *(undefined4 *)pcVar7 = *(undefined4 *)pcVar6; pcVar6 = pcVar6 + 4; pcVar7 = pcVar7 + 4; } for (uVar4 = uVar4 & 3; uVar4 != 0; uVar4 = uVar4 - 1) { *pcVar7 = *pcVar6; pcVar6 = pcVar6 + 1; pcVar7 = pcVar7 + 1; } *pcVar7 = '\0'; return param_1; } int __cdecl memcmp(byte *param_1,byte *param_2,int param_3) { if (param_3 == 0) { return 0; } while( true ) { if (param_3 == 0) { return (uint)param_1[-1] - (uint)param_2[-1]; } if (*param_1 != *param_2) break; param_1 = param_1 + 1; param_2 = param_2 + 1; param_3 = param_3 + -1; } return (uint)*param_1 - (uint)*param_2; } undefined4 * __cdecl FUN_00440d70(undefined4 *param_1,char *param_2,uint param_3) { uint uVar1; uVar1 = strlen(param_2); if (param_3 < uVar1) { memcpy(param_1,(undefined4 *)param_2,param_3); } else { memcpy(param_1,(undefined4 *)param_2,uVar1); memset((undefined4 *)(uVar1 + (int)param_1),0,param_3 - uVar1); } return param_1; } int __cdecl FUN_00440dc0(char *param_1,char *param_2,int param_3) { uint uVar1; uint uVar2; int iVar3; while( true ) { uVar1 = toupper((int)*param_1); uVar2 = toupper((int)*param_2); if (((uVar1 != uVar2) || (*param_1 == '\0')) || (param_3 == 0)) break; param_3 = param_3 + -1; param_1 = param_1 + 1; param_2 = param_2 + 1; } if (param_3 == 0) { iVar3 = 0; } else { uVar1 = toupper((int)*param_1); uVar2 = toupper((int)*param_2); iVar3 = uVar1 - uVar2; } return iVar3; } char * __cdecl strrchr(char *param_1,char param_2) { int iVar1; char *pcVar2; iVar1 = strlen(param_1); pcVar2 = param_1 + iVar1; while( true ) { if (param_2 == *pcVar2) { return pcVar2; } if (param_1 == pcVar2) break; pcVar2 = pcVar2 + -1; } return (char *)0x0; } char * __cdecl strcmp(char *param_1,char *param_2) { int iVar1; int iVar2; int iVar3; int iVar4; char *pcVar5; int iVar6; char *local_10; iVar1 = strlen(param_1); iVar2 = strlen(param_2); if (iVar2 != 0) { if (iVar1 == 0) { param_1 = (char *)0x0; } else { iVar3 = 0; while( true ) { for (pcVar5 = param_1 + iVar3; (iVar3 < iVar1 && (*pcVar5 != *param_2)); pcVar5 = pcVar5 + 1 ) { iVar3 = iVar3 + 1; } if (iVar1 == iVar3) { return (char *)0x0; } iVar6 = 0; local_10 = param_2; iVar4 = iVar3; for (pcVar5 = param_1 + iVar3; ((iVar4 < iVar1 && (iVar6 < iVar2)) && (*pcVar5 == *local_10)); pcVar5 = pcVar5 + 1) { iVar4 = iVar4 + 1; iVar6 = iVar6 + 1; local_10 = local_10 + 1; } if (iVar6 == iVar2) { return param_1 + iVar3; } if (iVar1 == iVar4) break; iVar3 = iVar3 + 1; } param_1 = (char *)0x0; } } return param_1; } int __cdecl str_copy_ret_end(undefined4 *param_1,char *param_2) { int iVar1; iVar1 = strlen(param_2); memcpy(param_1,(undefined4 *)param_2,iVar1 + 1); return iVar1 + (int)param_1; } void __JumpToCatch__(undefined *UNRECOVERED_JUMPTABLE) { // WARNING: Could not recover jumptable at 0x00440f20. Too many branches // WARNING: Treating indirect jump as call (*(code *)UNRECOVERED_JUMPTABLE)(); return; } char * __cdecl __typeIDname(int param_1) { if (param_1 == 0) { return s__0044bab8; } return (char *)(param_1 + (uint)*(ushort *)(param_1 + 6)); } void __stdcall ___debuggerExcListChange_qv(void) { int *piVar1; char cVar2; int *piVar3; undefined4 uVar4; int iVar5; char *pcVar6; int in_FS_OFFSET; if (**(int **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0xc) != 0) { *(undefined4 *)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x30) = 0; *(undefined4 *)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x2c) = 0; if (**(int **)(*(int *)(in_FS_OFFSET + 4) + -8) == 0) { ___lockDebuggerData_qv(); *(undefined4 *)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x14) = 0xb; (**(code **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 8))(); ___unlockDebuggerData_qv(); return; } ___lockDebuggerData_qv(); for (piVar3 = (int *)**(undefined4 **)(*(int *)(in_FS_OFFSET + 4) + -8); piVar3 != (int *)0x0; piVar3 = (int *)*piVar3) { uVar4 = 10; if (*piVar3 == 0) { uVar4 = 9; } *(undefined4 *)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x14) = uVar4; if ((char)piVar3[0x11] == '\0') { iVar5 = 0; } else { iVar5 = (int)piVar3 + 0x46; } *(int *)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x18) = iVar5; if (piVar3[1] == 0) { pcVar6 = (char *)0x0; } else { pcVar6 = __typeIDname(piVar3[1]); } *(char **)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x28) = pcVar6; *(undefined4 *)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x24) = 0; pcVar6 = *(char **)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x28); while ((pcVar6 != (char *)0x0 && (cVar2 = *pcVar6, pcVar6 = pcVar6 + 1, cVar2 != '\0'))) { piVar1 = (int *)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x24); *piVar1 = *piVar1 + 1; } *(int **)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x20) = piVar3; (**(code **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 8))(); } ___unlockDebuggerData_qv(); } return; } undefined4 __cdecl __isSameTypeID(int *param_1,int *param_2) { char cVar1; char cVar2; char *pcVar3; char *pcVar4; if (param_2 == param_1) { return 1; } if (((short)param_1[1] == (short)param_2[1]) && (*param_1 == *param_2)) { if (((*(ushort *)(param_1 + 1) | *(ushort *)(param_2 + 1)) & 0x80) != 0) { return 0; } pcVar3 = (char *)((int)param_1 + (uint)*(ushort *)((int)param_1 + 6)); pcVar4 = (char *)((int)param_2 + (uint)*(ushort *)((int)param_2 + 6)); do { cVar1 = *pcVar3; cVar2 = *pcVar4; pcVar4 = pcVar4 + 1; pcVar3 = pcVar3 + 1; if (cVar2 != cVar1) { return 0; } } while (cVar1 != '\0'); return 1; } return 0; } undefined4 __cdecl FUN_004410f4(int param_1,int *param_2,undefined4 param_3,int param_4) { int *piVar1; int iVar2; int iVar3; undefined4 *puVar4; puVar4 = (undefined4 *)((uint)*(ushort *)(param_1 + 0x12) + param_1); do { piVar1 = (int *)*puVar4; if (piVar1 == (int *)0x0) { puVar4 = (undefined4 *)((uint)*(ushort *)(param_1 + 0x10) + param_1); while( true ) { piVar1 = (int *)*puVar4; if (piVar1 == (int *)0x0) { return 0; } if ((param_4 == 0) || ((puVar4[2] & 3) != 3)) { iVar3 = 0; } else { iVar3 = 1; } iVar2 = __isSameTypeID(param_2,piVar1); if ((iVar2 != 0) && (iVar3 != 0)) break; if (((*(byte *)(piVar1 + 3) & 4) != 0) && (iVar3 = FUN_004410f4((int)piVar1,param_2,param_3,iVar3), iVar3 != 0)) { return 1; } puVar4 = puVar4 + 3; } return 1; } if ((*(byte *)(puVar4 + 2) & 8) == 0) { if ((param_4 == 0) || ((puVar4[2] & 3) != 3)) { iVar3 = 0; } else { iVar3 = 1; } iVar2 = __isSameTypeID(param_2,piVar1); if ((iVar2 != 0) && (iVar3 != 0)) { return 1; } if (((*(byte *)(piVar1 + 3) & 4) != 0) && (iVar3 = FUN_004410f4((int)piVar1,param_2,param_3,iVar3), iVar3 != 0)) { return 1; } } puVar4 = puVar4 + 3; } while( true ); } undefined4 __cdecl __isCompatTypeID(int *param_1,int *param_2,int param_3,undefined4 param_4) { uint uVar1; ushort uVar2; ushort uVar3; int iVar4; undefined4 uVar5; uint uVar6; while( true ) { while( true ) { if (param_2 == param_1) { return 1; } uVar2 = *(ushort *)(param_1 + 1); uVar3 = *(ushort *)(param_2 + 1); if ((uVar3 & uVar2 & 0x10) == 0) break; uVar6 = uVar2 & 0x300; uVar1 = uVar3 & 0x300; if (uVar6 != uVar1) { if ((param_3 != 0) || (uVar6 == uVar1)) { return 0; } if ((byte)(~(byte)(uVar1 >> 8) & (byte)(uVar6 >> 8)) != 0) { return 0; } } param_3 = 1; param_1 = (int *)param_1[2]; param_2 = (int *)param_2[2]; } if ((uVar3 & uVar2 & 0x400) == 0) break; if ((param_1[3] != param_2[3]) && ((param_3 != 0 || (param_1[3] != 0 || param_2[3] != 0)))) { return 0; } param_3 = 1; param_1 = (int *)param_1[2]; param_2 = (int *)param_2[2]; } iVar4 = __isSameTypeID(param_1,param_2); if (iVar4 != 0) { return 1; } if ((((uVar2 & 2) != 0) && ((uVar3 & 1) != 0)) && ((*(byte *)(param_1 + 3) & 4) != 0)) { uVar5 = FUN_004410f4((int)param_1,param_2,param_4,1); return uVar5; } return 0; } uint * __cdecl allocExceptMem(uint param_1) { uint *puVar1; int in_FS_OFFSET; puVar1 = malloc(param_1); if (puVar1 == (uint *)0x0) { if ((0x80 < param_1) || ((*(byte *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 4) & 1) != 0)) { abort(); } puVar1 = (uint *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 4); *puVar1 = *puVar1 | 1; return *(uint **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x28); } return puVar1; } void __cdecl freeExceptMem(int param_1) { uint *puVar1; int in_FS_OFFSET; if (param_1 == *(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x28)) { puVar1 = (uint *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 4); *puVar1 = *puVar1 & 0xfffffffe; return; } free(param_1); return; } bool __cdecl typeIDcaught(int *param_1,undefined4 param_2,int *param_3,byte param_4) { ushort uVar1; ushort uVar2; int iVar3; iVar3 = __isCompatTypeID(param_1,param_3,0,param_2); if (iVar3 != 0) { return true; } uVar1 = *(ushort *)(param_1 + 1); uVar2 = *(ushort *)(param_3 + 1); if ((uVar2 & 0x20) != 0) { iVar3 = __isCompatTypeID(param_1,(int *)param_3[2],1,param_2); if (iVar3 != 0) { return true; } uVar2 = *(ushort *)((int *)param_3[2] + 1); if ((uVar2 & 0x10) == 0) { return false; } iVar3 = __isCompatTypeID(param_1,(int *)param_3[2],0,param_2); if (iVar3 != 0) { return true; } } if ((uVar2 & 0x10) != 0) { if ((param_4 & 1) != 0) { return true; } if ((uVar1 & 0x10) == 0) { return false; } if ((uVar2 & 0x40) != 0) { return (uVar1 & 0x300) == (uVar2 & 0x300); } } return false; } void __cdecl callCopyConstr(undefined4 param_1,undefined4 param_2,undefined *param_3,uint param_4) { uint uVar1; if ((param_4 & 0x1000) == 0) { uVar1 = param_4 & 7; if (uVar1 == 1) { (*(code *)param_3)(); return; } if (uVar1 == 2) { (*(code *)param_3)(); return; } if (uVar1 == 3) { (*(code *)param_3)(param_1,param_2); return; } if (uVar1 != 5) { return; } (*(code *)param_3)(); } else { uVar1 = param_4 & 7; if (uVar1 == 1) { (*(code *)param_3)(); return; } if (uVar1 == 2) { (*(code *)param_3)(); return; } if (uVar1 == 3) { (*(code *)param_3)(0,param_2,param_1); return; } if (uVar1 == 5) { (*(code *)param_3)(); return; } } return; } void __cdecl callDestructor(undefined4 param_1,int param_2,undefined *param_3,uint param_4,int param_5) { char *pcVar1; uint uVar2; undefined4 uVar3; int in_FS_OFFSET; uVar3 = 2; if (param_5 == 0) { uVar3 = 0; } if (**(int **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0xc) != 0) { ___lockDebuggerData_qv(); *(undefined4 *)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x14) = 3; *(undefined **)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x18) = param_3; pcVar1 = __typeIDname(param_2); *(char **)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x28) = pcVar1; *(undefined4 *)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x1c) = param_1; (**(code **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 8))(); ___unlockDebuggerData_qv(); } uVar2 = param_4 & 7; if (uVar2 == 1) { (*(code *)param_3)(); } else if (uVar2 == 2) { (*(code *)param_3)(); } else if (uVar2 == 3) { (*(code *)param_3)(uVar3,param_1); } else if (uVar2 == 5) { (*(code *)param_3)(); } return; } void __cdecl callMemberFunc(undefined4 param_1,undefined *param_2,uint param_3) { uint uVar1; uVar1 = param_3 & 7; if (uVar1 == 1) { (*(code *)param_2)(); return; } if (uVar1 == 2) { (*(code *)param_2)(); return; } if (uVar1 == 3) { (*(code *)param_2)(param_1); return; } if (uVar1 != 5) { return; } (*(code *)param_2)(); return; } void __cdecl tossAnException(uint *param_1,undefined4 *param_2,uint param_3,undefined *param_4,uint param_5, uint param_6,uint param_7,uint param_8,undefined4 param_9,int param_10) { int *piVar1; char cVar2; ushort uVar3; char *pcVar4; uint uVar5; undefined4 *in_FS_OFFSET; ULONG_PTR local_40; undefined4 local_3c; uint *local_38; undefined4 local_34; uint *local_30; uint local_2c; uint *local_28; undefined4 local_24; undefined2 local_14; __InitExceptBlock(0x44ba04); local_28 = param_1; *(uint *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x24) = (uint)*(ushort *)((int)param_1 + 6) + (int)param_1; *(uint *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x20) = param_7; *(uint *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x1c) = param_8; uVar5 = *param_1; uVar3 = (ushort)param_1[1]; if ((uVar3 & 2) == 0) { local_2c = 0; } else { local_2c = param_1[3]; } if ((uVar3 & 0x30) != 0) { param_1 = (uint *)param_1[2]; } local_30 = allocExceptMem(uVar5 + 0x46); *local_30 = **(uint **)(in_FS_OFFSET[1] + -8); **(undefined4 **)(in_FS_OFFSET[1] + -8) = local_30; local_30[1] = (uint)local_28; local_30[3] = param_6; local_30[4] = uVar5; *(ushort *)(local_30 + 6) = uVar3; *(undefined2 *)((int)local_30 + 0x1a) = (undefined2)local_2c; local_30[5] = (uint)param_1; local_30[2] = param_3; local_30[10] = 0; local_30[0xb] = 0; local_30[7] = (uint)freeExceptMem; local_30[0xd] = param_7; local_30[0xe] = param_8; local_30[8] = (uint)param_4; local_30[9] = param_5; *(undefined1 *)((int)local_30 + 0x45) = 0; *(undefined1 *)(local_30 + 0x11) = 1; memcpy((undefined4 *)((int)local_30 + 0x46),param_2,uVar5); if (**(int **)(*(int *)(in_FS_OFFSET[1] + -8) + 0xc) != 0) { ___debuggerExcListChange_qv(); if (param_10 == 0) { ___lockDebuggerData_qv(); *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x30) = 0; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x2c) = 0; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x14) = 1; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x18) = param_9; *(uint **)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x20) = local_30; pcVar4 = __typeIDname((int)local_28); *(char **)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x28) = pcVar4; if ((char)local_30[0x11] == '\0') { uVar5 = local_30[0x10]; } else { uVar5 = (int)local_30 + 0x46; } *(uint *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x1c) = uVar5; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x24) = 0; pcVar4 = *(char **)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x28); while (pcVar4 != (char *)0x0) { cVar2 = *pcVar4; pcVar4 = pcVar4 + 1; if (cVar2 == '\0') break; piVar1 = (int *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x24); *piVar1 = *piVar1 + 1; } (**(code **)(*(int *)(in_FS_OFFSET[1] + -8) + 8))(); ___unlockDebuggerData_qv(); } } if ((local_2c & 1) != 0) { local_34 = *__DestructorCountPtr; local_14 = 8; callCopyConstr((int)local_30 + 0x46,param_2,param_4,param_5); local_14 = 0; *__DestructorCountPtr = local_34; } if ((param_10 == 0) && ((local_2c & 2) != 0)) { local_14 = 0x14; callDestructor(param_2,(int)local_28,(undefined *)local_28[10],(uint)(ushort)local_28[0xb],1); local_14 = 0; } local_40 = *(ULONG_PTR *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x24); local_3c = param_9; local_38 = local_30; RaiseException(0xeefface,1,3,&local_40); *in_FS_OFFSET = local_24; return; } void __cdecl __ThrowException_qpvt1t1t1uiuiuipuc (uint *param_1,undefined4 *param_2,uint param_3,undefined *param_4,uint param_5, uint param_6,uint param_7,uint param_8) { undefined4 in_stack_00000000; tossAnException(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8,in_stack_00000000, 0); return; } void __cdecl __ReThrowException_quipuc(uint param_1,uint param_2) { int iVar1; undefined4 *puVar2; int in_FS_OFFSET; undefined4 in_stack_00000000; iVar1 = **(int **)(*(int *)(in_FS_OFFSET + 4) + -8); if (iVar1 == 0) { __call_terminate(); } if (*(char *)(iVar1 + 0x44) == '\0') { puVar2 = *(undefined4 **)(iVar1 + 0x40); } else { puVar2 = (undefined4 *)(iVar1 + 0x46); } tossAnException(*(uint **)(iVar1 + 4),puVar2,*(uint *)(iVar1 + 8),*(undefined **)(iVar1 + 0x20), *(uint *)(iVar1 + 0x24),*(uint *)(iVar1 + 0xc),param_1,param_2,in_stack_00000000,1 ); return; } void __cdecl _Global_unwind(PVOID param_1,PEXCEPTION_RECORD param_2) { EXCEPTION_RECORD local_54; if (param_2 == (PEXCEPTION_RECORD)0x0) { local_54.ExceptionCode = 0x26; local_54.ExceptionFlags = 2; param_2 = &local_54; local_54.NumberParameters = 0; } param_2->ExceptionFlags = param_2->ExceptionFlags | 2; __doGlobalUnwind(param_1,param_2); return; } void __cdecl destThrownValue(undefined4 param_1,int param_2,undefined *param_3,uint param_4) { undefined4 *in_FS_OFFSET; undefined4 local_24; __InitExceptBlock(0x44ba44); callDestructor(param_1,param_2,param_3,param_4,1); *in_FS_OFFSET = local_24; return; } void __cdecl exceptionHandled(int param_1) { undefined4 uVar1; int iVar2; int in_FS_OFFSET; if (*(char *)(param_1 + 0x44) != '\0') { if ((*(byte *)(param_1 + 0x1a) & 2) != 0) { uVar1 = *__DestructorCountPtr; destThrownValue(param_1 + 0x46,param_1,*(undefined **)(*(int *)(param_1 + 4) + 0x28), (uint)*(ushort *)(*(int *)(param_1 + 4) + 0x2c)); *__DestructorCountPtr = uVar1; } *(undefined1 *)(param_1 + 0x44) = 0; } if (*(char *)(param_1 + 0x45) != '\0') { iVar2 = *(int *)(param_1 + 0x3c); if (((*(byte *)(iVar2 + 4) & 2) != 0) && ((*(byte *)(iVar2 + 0xc) & 2) != 0)) { destThrownValue(*(undefined4 *)(param_1 + 0x40),iVar2,*(undefined **)(iVar2 + 0x28), (uint)*(ushort *)(iVar2 + 0x2c)); } *(undefined1 *)(param_1 + 0x45) = 0; } if (**(int **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0xc) != 0) { ___debuggerExcListChange_qv(); } return; } void __stdcall __CatchCleanup_qv(void) { undefined4 *puVar1; int iVar2; int in_FS_OFFSET; puVar1 = (undefined4 *)**(int **)(*(int *)(in_FS_OFFSET + 4) + -8); **(undefined4 **)(*(int *)(in_FS_OFFSET + 4) + -8) = *puVar1; if (**(int **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0xc) != 0) { ___debuggerExcListChange_qv(); } iVar2 = puVar1[10]; *(undefined2 *)(iVar2 + 0x10) = *(undefined2 *)(*(int *)(iVar2 + 8) + (uint)*(ushort *)(iVar2 + 0x10)); exceptionHandled((int)puVar1); (*(code *)puVar1[7])(); return; } undefined4 __cdecl locateBaseClass(undefined4 *param_1,int param_2,int *param_3,int *param_4) { int *piVar1; int iVar2; undefined4 *local_8; while( true ) { piVar1 = (int *)*param_1; if (piVar1 == (int *)0x0) { return 0; } local_8 = (undefined4 *)(*param_4 + param_1[1]); if (param_2 != 0) { local_8 = (undefined4 *)*local_8; } iVar2 = __isSameTypeID(piVar1,param_3); if (iVar2 != 0) break; if ((((*(byte *)(piVar1 + 1) & 2) != 0) && ((undefined4 *)((uint)*(ushort *)(piVar1 + 4) + (int)piVar1) != (undefined4 *)0x0)) && (iVar2 = locateBaseClass((undefined4 *)((uint)*(ushort *)(piVar1 + 4) + (int)piVar1),0, param_3,(int *)&local_8), iVar2 != 0)) { *param_4 = (int)local_8; return 1; } param_1 = param_1 + 3; } *param_4 = (int)local_8; return 1; } int __cdecl __adjustClassAdr(int param_1,int param_2,int *param_3) { int *piVar1; int iVar2; int iVar3; piVar1 = param_3; iVar3 = param_2; if (((param_1 != 0) && (iVar2 = locateBaseClass((undefined4 *)((uint)*(ushort *)(param_2 + 0x10) + param_2),0,param_3 ,¶m_1), iVar2 == 0)) && (iVar3 = locateBaseClass((undefined4 *)((uint)*(ushort *)(iVar3 + 0x12) + iVar3),1,piVar1, ¶m_1), iVar3 == 0)) { param_1 = 0; } return param_1; } void __cdecl initCatchArg(int param_1,undefined4 param_2,int param_3,int *param_4,int param_5) { ushort uVar1; uint uVar2; undefined4 *puVar3; int iVar4; ushort uVar5; uint *puVar6; int in_FS_OFFSET; bool bVar7; bool bVar8; undefined4 *local_8; puVar6 = *(uint **)(param_1 + 4); *(uint **)(param_3 + 0x3c) = puVar6; if ((puVar6 != (uint *)0x0) && ((*(byte *)(param_1 + 8) & 0x80) == 0)) { bVar7 = (*(byte *)(param_1 + 8) & 1) == 0; local_8 = (undefined4 *)(param_3 + 0x46); *(undefined1 *)(param_3 + 0x45) = 1; *(int *)(param_3 + 0x40) = *param_4 + param_5; uVar1 = (ushort)puVar6[1]; uVar2 = *puVar6; uVar5 = uVar1; if ((uVar1 & 0x30) != 0) { puVar6 = (uint *)puVar6[2]; uVar5 = (ushort)puVar6[1]; } if (((uVar1 & 0x10) == 0) || ((*(byte *)(param_3 + 0xc) & 1) == 0)) { if (((uVar5 & 1) == 0) || ((uVar1 & 0x30) == 0)) { if ((*(byte *)(param_3 + 0x18) & 1) == 0) { if ((uVar1 & 0x20) == 0) { memcpy(*(undefined4 **)(param_3 + 0x40),local_8,uVar2); } else { memcpy(*(undefined4 **)(param_3 + 0x40),&local_8,uVar2); bVar7 = true; } } else { iVar4 = __isSameTypeID(*(int **)(param_3 + 0x14),(int *)puVar6); if (iVar4 == 0) { local_8 = (undefined4 *) __adjustClassAdr((int)local_8,*(int *)(param_3 + 0x14),(int *)puVar6); } bVar7 = iVar4 == 0 || bVar7; if ((puVar6[3] & 1) == 0) { memcpy(*(undefined4 **)(param_3 + 0x40),local_8,uVar2); } else { callCopyConstr(*(undefined4 *)(param_3 + 0x40),local_8,*(undefined **)(param_1 + 0xc), *(uint *)(param_1 + 0x10)); bVar7 = true; } } } else { bVar8 = (uVar1 & 0x20) == 0; if (bVar8) { local_8 = (undefined4 *)*local_8; } bVar7 = !bVar8 || bVar7; iVar4 = __isSameTypeID(*(int **)(param_3 + 0x14),(int *)puVar6); puVar3 = local_8; if ((iVar4 == 0) && (local_8 = (undefined4 *) __adjustClassAdr((int)local_8,*(int *)(param_3 + 0x14),(int *)puVar6), local_8 != puVar3)) { bVar7 = true; } memcpy(*(undefined4 **)(param_3 + 0x40),&local_8,uVar2); } } else { memset(*(undefined4 **)(param_3 + 0x40),0,uVar2); bVar7 = true; } if (!bVar7) { if ((puVar6[3] & 2) != 0) { destThrownValue(local_8,(int)puVar6,(undefined *)puVar6[10],(uint)(ushort)puVar6[0xb]); } *(undefined1 *)(param_3 + 0x44) = 0; } if (**(int **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0xc) != 0) { ___debuggerExcListChange_qv(); } } return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __cdecl local_unwind(int param_1) { int *piVar1; int *piVar2; undefined4 uVar3; uint uVar4; uint uVar5; undefined1 *puVar6; uint uVar7; int in_FS_OFFSET; puVar6 = &stack0xfffffffc; uVar7 = (uint)*(ushort *)(param_1 + 0x10); do { while( true ) { do { while( true ) { uVar5 = uVar7; if ((uVar5 == 0) || (uVar5 == *(uint *)(puVar6 + 0xc))) { return; } uVar7 = (uint)*(ushort *)(*(int *)(puVar6 + -4) + uVar5); uVar4 = (uint)*(ushort *)(*(int *)(puVar6 + -4) + uVar5 + 2); *(ushort *)(*(int *)(puVar6 + 8) + 0x10) = *(ushort *)(*(int *)(puVar6 + -4) + uVar5); if (uVar4 != 0) break; _DAT_004521e4 = *(undefined4 *)(*(int *)(puVar6 + -4) + 4 + uVar5 + 4); *(undefined2 *)(*(int *)(puVar6 + 8) + 0x12) = 1; invokeHnd(); *(undefined2 *)(*(int *)(puVar6 + 8) + 0x12) = 0; } } while (uVar4 - 1 < 3); if (uVar4 == 4) break; if (uVar4 - 1 == 4) { uVar3 = dtorCleanup(*(int **)(*(int *)(puVar6 + -4) + uVar5 + 8), *(int *)(*(int *)(puVar6 + -4) + uVar5 + 4) + *(int *)(puVar6 + -0xc), *(int *)(puVar6 + 8),*(int *)(puVar6 + -8)); *(undefined4 *)(puVar6 + -0xc) = uVar3; } } piVar1 = *(int **)(*(int *)(in_FS_OFFSET + 4) + -8); do { piVar2 = piVar1; piVar1 = (int *)*piVar2; if (piVar1 == (int *)0x0) break; } while ((piVar1[10] != *(int *)(puVar6 + 8)) || (uVar5 != piVar1[0xc])); *piVar2 = *piVar1; if (**(int **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0xc) != 0) { ___debuggerExcListChange_qv(); } exceptionHandled((int)piVar1); (*(code *)piVar1[7])(); } while( true ); } void __cdecl _Local_unwind(int param_1) { local_unwind(param_1); return; } void __cdecl _Return_unwind(undefined4 *param_1) { undefined4 *in_FS_OFFSET; local_unwind((int)param_1); *in_FS_OFFSET = *param_1; return; } int * __cdecl findMatchingHandler(int param_1,int param_2) { bool bVar1; undefined3 extraout_var; int *piVar2; piVar2 = (int *)(param_1 + 8); while( true ) { if (*piVar2 == 0) { return (int *)0x0; } if ((int *)piVar2[1] == (int *)0x0) break; bVar1 = typeIDcaught(*(int **)(param_2 + 4),*(undefined4 *)(param_2 + 8),(int *)piVar2[1], (byte)*(undefined4 *)(param_2 + 0xc)); if (CONCAT31(extraout_var,bVar1) != 0) { return piVar2; } piVar2 = piVar2 + 5; } return piVar2; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address undefined4 __stdcall _ExceptionHandler(_EXCEPTION_RECORD *param_1,REGREC_BC *param_2,_CONTEXT *param_3,undefined *param_4 ) { ULONG_PTR UVar1; undefined4 uVar2; bool bVar3; undefined3 extraout_var; int *piVar4; char *pcVar5; int iVar6; int *piVar7; uint uVar8; undefined1 *puVar9; int iVar10; undefined *UNRECOVERED_JUMPTABLE; undefined4 *in_FS_OFFSET; puVar9 = &stack0xfffffffc; UVar1 = param_1->ExceptionInformation[2]; piVar7 = (int *)param_2->ERRcXtab; if ((param_1->ExceptionFlags & 6) == 0) { if ((param_1->ExceptionCode != 0xeefface) && (**(int **)(*(int *)(in_FS_OFFSET[1] + -8) + 0xc) != 0)) { ___lockDebuggerData_qv(); *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x14) = 0xc; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x18) = 0; *(REGREC_BC **)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x20) = param_2; *(DWORD *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x34) = param_1->ExceptionCode; (**(code **)(*(int *)(in_FS_OFFSET[1] + -8) + 8))(); ___unlockDebuggerData_qv(); } uVar8 = (uint)param_2->ERRcCCtx; while (uVar8 != 0) { *(uint *)(puVar9 + -0x14) = (uint)*(ushort *)((int)piVar7 + uVar8); *(uint *)(puVar9 + -0x20) = (uint)*(ushort *)((int)piVar7 + uVar8 + 2); iVar10 = uVar8 + 4; switch(*(undefined4 *)(puVar9 + -0x20)) { case 1: if (**(int **)(puVar9 + -4) != 0xeefface) { *(undefined4 *)(puVar9 + -0x34) = *(undefined4 *)(puVar9 + -4); *(undefined4 *)(puVar9 + -0x30) = *(undefined4 *)(puVar9 + -0xc); *(undefined4 *)(*(int *)(puVar9 + -8) + 0x14) = **(undefined4 **)(puVar9 + -4); *(undefined1 **)(*(int *)(puVar9 + -8) + 0x18) = puVar9 + -0x34; _DAT_004521e8 = *(undefined4 *)((int)piVar7 + iVar10); iVar6 = invokeHnd(); LAB_0044225e: if (iVar6 < 0) { if ((*(byte *)(*(int *)(puVar9 + -4) + 4) & 1) != 0) { *(undefined2 *)(*(int *)(puVar9 + -8) + 0x10) = *(undefined2 *)(puVar9 + -0x14); } return 0; } if (iVar6 != 0) { *(undefined4 *)(*(int *)(puVar9 + -8) + 0x18) = 0; *(undefined4 *)(puVar9 + -0x2c) = *(undefined4 *)(puVar9 + -0x14); if (**(int **)(*(int *)(in_FS_OFFSET[1] + -8) + 0xc) != 0) { ___lockDebuggerData_qv(); *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x14) = 0xd; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x18) = 0; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x20) = *(undefined4 *)(puVar9 + 0xc); *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x34) = **(undefined4 **)(puVar9 + -4); (**(code **)(*(int *)(in_FS_OFFSET[1] + -8) + 8))(); ___unlockDebuggerData_qv(); } UNRECOVERED_JUMPTABLE = *(undefined **)((int)piVar7 + iVar10 + 4); LAB_004420f6: _Global_unwind(*(PVOID *)(puVar9 + -8),*(PEXCEPTION_RECORD *)(puVar9 + -4)); local_unwind(*(int *)(puVar9 + -8)); *(undefined2 *)(*(int *)(puVar9 + -8) + 0x10) = *(undefined2 *)(puVar9 + -0x2c); if (*(int *)(puVar9 + -0x20) == 3) { initCatchArg(*(int *)(puVar9 + -0x24),*(undefined4 *)(puVar9 + -8), *(int *)(puVar9 + -0x10),*(int **)(puVar9 + -0x28), *(int *)(puVar9 + -0x18)); } if (**(int **)(*(int *)(in_FS_OFFSET[1] + -8) + 0xc) != 0) { ___lockDebuggerData_qv(); *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x14) = 2; *(undefined **)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x18) = UNRECOVERED_JUMPTABLE; pcVar5 = __typeIDname(*(int *)(*(int *)(puVar9 + -0x10) + 4)); *(char **)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x28) = pcVar5; if (*(char *)(*(int *)(puVar9 + -0x10) + 0x44) == '\0') { iVar10 = *(int *)(*(int *)(puVar9 + -0x10) + 0x40); } else { iVar10 = *(int *)(puVar9 + -0x10) + 0x46; } *(int *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x1c) = iVar10; (**(code **)(*(int *)(in_FS_OFFSET[1] + -8) + 8))(); ___unlockDebuggerData_qv(); } __JumpToCatch__(UNRECOVERED_JUMPTABLE); } } break; case 2: if (**(int **)(puVar9 + -4) != 0xeefface) { *(undefined4 *)(*(int *)(puVar9 + -8) + 0x14) = **(undefined4 **)(puVar9 + -4); iVar6 = *(int *)((int)piVar7 + iVar10); goto LAB_0044225e; } break; case 3: if (**(int **)(puVar9 + -4) == 0xeefface) { *(undefined4 *)(puVar9 + -0x28) = *(undefined4 *)((int)piVar7 + iVar10); piVar4 = findMatchingHandler(*(int *)(puVar9 + -0x28),*(int *)(puVar9 + -0x10)); *(int **)(puVar9 + -0x24) = piVar4; if (*(int *)(puVar9 + -0x24) != 0) { *(undefined4 *)(*(int *)(puVar9 + -0x10) + 0x28) = *(undefined4 *)(puVar9 + -8); *(undefined4 *)(*(int *)(puVar9 + -0x10) + 0x2c) = *(undefined4 *)(puVar9 + -0x24); *(uint *)(*(int *)(puVar9 + -0x10) + 0x30) = uVar8 + 8; *(uint *)(puVar9 + -0x2c) = uVar8 + 8; UNRECOVERED_JUMPTABLE = (undefined *)**(undefined4 **)(puVar9 + -0x24); goto LAB_004420f6; } } } uVar8 = *(uint *)(puVar9 + -0x14); } } else { local_unwind((int)param_2); if ((param_1->ExceptionCode == 0xeefface) && (piVar7 = (int *)*piVar7, piVar7 != (int *)0x0)) { for (; *piVar7 != 0; piVar7 = piVar7 + 1) { bVar3 = typeIDcaught(*(int **)(UVar1 + 4),*(undefined4 *)(UVar1 + 8),(int *)*piVar7, (byte)*(undefined4 *)(UVar1 + 0xc)); if (CONCAT31(extraout_var,bVar3) != 0) { return 1; } } uVar2 = *in_FS_OFFSET; *in_FS_OFFSET = param_2->ERRcNext; __call_unexpected(); *in_FS_OFFSET = uVar2; } } return 1; } // WARNING (jumptable): Unable to track spacebase fully for stack // WARNING: Globals starting with '_' overlap smaller symbols at the same address undefined4 __stdcall FUN_00441f21(void) { undefined4 uVar1; bool bVar2; undefined3 extraout_var; int *piVar3; char *pcVar4; int iVar5; int *piVar6; uint uVar7; int unaff_EBP; int iVar8; undefined *UNRECOVERED_JUMPTABLE; undefined4 *in_FS_OFFSET; *(undefined4 *)(unaff_EBP + -4) = *(undefined4 *)(unaff_EBP + 8); *(undefined4 *)(unaff_EBP + -8) = *(undefined4 *)(unaff_EBP + 0xc); *(undefined4 *)(unaff_EBP + -0xc) = *(undefined4 *)(unaff_EBP + 0x10); *(undefined4 *)(unaff_EBP + -0x10) = *(undefined4 *)(*(int *)(unaff_EBP + -4) + 0x1c); piVar6 = *(int **)(*(int *)(unaff_EBP + -8) + 8); *(int *)(unaff_EBP + -0x18) = *(int *)(unaff_EBP + -8) - piVar6[1]; *(undefined4 *)(unaff_EBP + -0x1c) = *(undefined4 *)(*(int *)(unaff_EBP + -8) + 0xc); if ((*(byte *)(*(int *)(unaff_EBP + -4) + 4) & 6) == 0) { if ((**(int **)(unaff_EBP + -4) != 0xeefface) && (**(int **)(*(int *)(in_FS_OFFSET[1] + -8) + 0xc) != 0)) { ___lockDebuggerData_qv(); *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x14) = 0xc; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x18) = 0; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x20) = *(undefined4 *)(unaff_EBP + 0xc); *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x34) = **(undefined4 **)(unaff_EBP + -4); (**(code **)(*(int *)(in_FS_OFFSET[1] + -8) + 8))(); ___unlockDebuggerData_qv(); } uVar7 = (uint)*(ushort *)(*(int *)(unaff_EBP + -8) + 0x10); while (uVar7 != 0) { *(uint *)(unaff_EBP + -0x14) = (uint)*(ushort *)((int)piVar6 + uVar7); *(uint *)(unaff_EBP + -0x20) = (uint)*(ushort *)((int)piVar6 + uVar7 + 2); iVar8 = uVar7 + 4; switch(*(undefined4 *)(unaff_EBP + -0x20)) { case 1: if (**(int **)(unaff_EBP + -4) != 0xeefface) { *(undefined4 *)(unaff_EBP + -0x34) = *(undefined4 *)(unaff_EBP + -4); *(undefined4 *)(unaff_EBP + -0x30) = *(undefined4 *)(unaff_EBP + -0xc); *(undefined4 *)(*(int *)(unaff_EBP + -8) + 0x14) = **(undefined4 **)(unaff_EBP + -4); *(int *)(*(int *)(unaff_EBP + -8) + 0x18) = unaff_EBP + -0x34; _DAT_004521e8 = *(undefined4 *)((int)piVar6 + iVar8); iVar5 = invokeHnd(); LAB_0044225e: if (iVar5 < 0) { if ((*(byte *)(*(int *)(unaff_EBP + -4) + 4) & 1) != 0) { *(undefined2 *)(*(int *)(unaff_EBP + -8) + 0x10) = *(undefined2 *)(unaff_EBP + -0x14); } return 0; } if (iVar5 != 0) { *(undefined4 *)(*(int *)(unaff_EBP + -8) + 0x18) = 0; *(undefined4 *)(unaff_EBP + -0x2c) = *(undefined4 *)(unaff_EBP + -0x14); if (**(int **)(*(int *)(in_FS_OFFSET[1] + -8) + 0xc) != 0) { ___lockDebuggerData_qv(); *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x14) = 0xd; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x18) = 0; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x20) = *(undefined4 *)(unaff_EBP + 0xc); *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x34) = **(undefined4 **)(unaff_EBP + -4); (**(code **)(*(int *)(in_FS_OFFSET[1] + -8) + 8))(); ___unlockDebuggerData_qv(); } UNRECOVERED_JUMPTABLE = *(undefined **)((int)piVar6 + iVar8 + 4); LAB_004420f6: _Global_unwind(*(PVOID *)(unaff_EBP + -8),*(PEXCEPTION_RECORD *)(unaff_EBP + -4)); local_unwind(*(int *)(unaff_EBP + -8)); *(undefined2 *)(*(int *)(unaff_EBP + -8) + 0x10) = *(undefined2 *)(unaff_EBP + -0x2c); if (*(int *)(unaff_EBP + -0x20) == 3) { initCatchArg(*(int *)(unaff_EBP + -0x24),*(undefined4 *)(unaff_EBP + -8), *(int *)(unaff_EBP + -0x10),*(int **)(unaff_EBP + -0x28), *(int *)(unaff_EBP + -0x18)); } if (**(int **)(*(int *)(in_FS_OFFSET[1] + -8) + 0xc) != 0) { ___lockDebuggerData_qv(); *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x14) = 2; *(undefined **)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x18) = UNRECOVERED_JUMPTABLE; pcVar4 = __typeIDname(*(int *)(*(int *)(unaff_EBP + -0x10) + 4)); *(char **)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x28) = pcVar4; if (*(char *)(*(int *)(unaff_EBP + -0x10) + 0x44) == '\0') { iVar8 = *(int *)(*(int *)(unaff_EBP + -0x10) + 0x40); } else { iVar8 = *(int *)(unaff_EBP + -0x10) + 0x46; } *(int *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x1c) = iVar8; (**(code **)(*(int *)(in_FS_OFFSET[1] + -8) + 8))(); ___unlockDebuggerData_qv(); } __JumpToCatch__(UNRECOVERED_JUMPTABLE); } } break; case 2: if (**(int **)(unaff_EBP + -4) != 0xeefface) { *(undefined4 *)(*(int *)(unaff_EBP + -8) + 0x14) = **(undefined4 **)(unaff_EBP + -4); iVar5 = *(int *)((int)piVar6 + iVar8); goto LAB_0044225e; } break; case 3: if (**(int **)(unaff_EBP + -4) == 0xeefface) { *(undefined4 *)(unaff_EBP + -0x28) = *(undefined4 *)((int)piVar6 + iVar8); piVar3 = findMatchingHandler(*(int *)(unaff_EBP + -0x28),*(int *)(unaff_EBP + -0x10)); *(int **)(unaff_EBP + -0x24) = piVar3; if (*(int *)(unaff_EBP + -0x24) != 0) { *(undefined4 *)(*(int *)(unaff_EBP + -0x10) + 0x28) = *(undefined4 *)(unaff_EBP + -8); *(undefined4 *)(*(int *)(unaff_EBP + -0x10) + 0x2c) = *(undefined4 *)(unaff_EBP + -0x24) ; *(uint *)(*(int *)(unaff_EBP + -0x10) + 0x30) = uVar7 + 8; *(uint *)(unaff_EBP + -0x2c) = uVar7 + 8; UNRECOVERED_JUMPTABLE = (undefined *)**(undefined4 **)(unaff_EBP + -0x24); goto LAB_004420f6; } } } uVar7 = *(uint *)(unaff_EBP + -0x14); } } else { local_unwind(*(int *)(unaff_EBP + -8)); if ((**(int **)(unaff_EBP + -4) == 0xeefface) && (piVar6 = (int *)*piVar6, piVar6 != (int *)0x0) ) { for (; *piVar6 != 0; piVar6 = piVar6 + 1) { bVar2 = typeIDcaught(*(int **)(*(int *)(unaff_EBP + -0x10) + 4), *(undefined4 *)(*(int *)(unaff_EBP + -0x10) + 8),(int *)*piVar6, (byte)*(undefined4 *)(*(int *)(unaff_EBP + -0x10) + 0xc)); if (CONCAT31(extraout_var,bVar2) != 0) { return 1; } } uVar1 = *in_FS_OFFSET; *in_FS_OFFSET = **(undefined4 **)(unaff_EBP + -8); __call_unexpected(); *in_FS_OFFSET = uVar1; } } return 1; } void __cdecl destroyOneObject(undefined4 param_1,int param_2,int param_3) { undefined4 *in_FS_OFFSET; undefined4 local_24; __InitExceptBlock(0x44ba98); callDestructor(param_1,param_2,*(undefined **)(param_2 + 0x28),(uint)*(ushort *)(param_2 + 0x2c), param_3); *in_FS_OFFSET = local_24; return; } void __cdecl destroyBases(int param_1,int *param_2,int *param_3) { undefined4 *puVar1; int *piVar2; uint in_stack_00000010; int in_stack_00000014; while (piVar2 = param_2 + -3, param_3 <= piVar2) { puVar1 = (undefined4 *)(param_2[-2] + param_1); if (in_stack_00000014 != 0) { puVar1 = (undefined4 *)*puVar1; } param_2 = piVar2; if ((*(byte *)(*piVar2 + 0xc) & 2) != 0) { destroyVariable(puVar1,*piVar2,in_stack_00000010,0); in_stack_00000010 = 0; } } return; } void __cdecl destroyVariable(int param_1,int param_2,uint param_3,int param_4) { int *piVar1; int iVar2; uint uVar3; int *piVar4; int *piVar5; int *piVar6; int *piVar7; uint local_18; int *local_10; if (param_4 == 0) { uVar3 = *(uint *)(param_2 + 0x24); } else { uVar3 = *(uint *)(param_2 + 0x20); } if ((param_3 == 0) || (uVar3 <= param_3)) { destroyOneObject(param_1,param_2,param_4); } else { piVar1 = (int *)((uint)*(ushort *)(param_2 + 0x12) + param_2); local_10 = piVar1; if (param_4 != 0) { for (; iVar2 = *local_10, iVar2 != 0; local_10 = local_10 + 3) { if ((*(byte *)(iVar2 + 0xc) & 2) != 0) { if (param_3 <= *(uint *)(iVar2 + 0x24)) { destroyBases(param_1,local_10 + 3,piVar1); return; } param_3 = param_3 - *(uint *)(iVar2 + 0x24); } } } piVar6 = (int *)((uint)*(ushort *)(param_2 + 0x10) + param_2); for (piVar7 = piVar6; iVar2 = *piVar7, iVar2 != 0; piVar7 = piVar7 + 3) { if ((*(byte *)(iVar2 + 0xc) & 2) != 0) { if (param_3 <= *(uint *)(iVar2 + 0x24)) { destroyBases(param_1,piVar7 + 3,piVar6); if (param_4 == 0) { return; } destroyBases(param_1,local_10,piVar1); return; } param_3 = param_3 - *(uint *)(iVar2 + 0x24); } } piVar4 = (int *)((uint)*(ushort *)(param_2 + 0x2e) + param_2); piVar5 = piVar4; while( true ) { iVar2 = *piVar5; local_18 = 1; if ((*(byte *)(iVar2 + 5) & 4) != 0) { local_18 = *(uint *)(iVar2 + 0xc); iVar2 = *(int *)(iVar2 + 8); } uVar3 = *(int *)(iVar2 + 0x20) * local_18; if (param_3 <= uVar3) break; param_3 = param_3 - uVar3; piVar5 = piVar5 + 2; } do { if (local_18 < 2) { destroyVariable(param_1 + piVar5[1],*piVar5,param_3,1); } else { destroyArray(param_1 + piVar5[1],*piVar5,param_3); } param_3 = 0; piVar5 = piVar5 + -2; } while (piVar4 <= piVar5); destroyBases(param_1,piVar7,piVar6); if (param_4 != 0) { destroyBases(param_1,local_10,piVar1); } } return; } void __cdecl destroyArray(int param_1,int param_2,uint param_3) { int *piVar1; uint uVar2; uint uVar3; int iVar4; uint local_8; piVar1 = *(int **)(param_2 + 8); uVar2 = piVar1[8]; if (param_3 == 0) { param_3 = uVar2 * *(int *)(param_2 + 0xc); } local_8 = param_3 / uVar2; uVar3 = param_3 - local_8 * uVar2; iVar4 = param_1 + local_8 * *piVar1; if (uVar3 != 0) { destroyVariable(iVar4,(int)piVar1,uVar3,1); } while (local_8 != 0) { iVar4 = iVar4 - *piVar1; destroyVariable(iVar4,(int)piVar1,uVar2,1); local_8 = local_8 - 1; } return; } int __cdecl findTrueTypeAndAddr(int param_1,int *param_2) { int iVar1; int iVar2; iVar1 = *param_2; if ((*(uint *)(iVar1 + 0xc) & 0x50) != 0x50) { return param_1; } if (*(int *)(iVar1 + 8) == -1) { return param_1; } iVar1 = *(int *)(*(int *)(iVar1 + 8) + param_1); iVar2 = *(int *)(iVar1 + -8); *param_2 = *(int *)((iVar1 - *(int *)(iVar1 + -4)) + -0xc); return param_1 - iVar2; } undefined4 __cdecl dtorCleanup(int *param_1,int param_2,int param_3,int param_4) { bool bVar1; undefined4 uVar2; int iVar3; int *piVar4; int iVar5; uint uVar6; uint uVar7; int local_1c; int *local_18; int local_14; int *local_10; int local_c; int local_8; local_8 = 0; if (param_1 == (int *)0x0) { uVar2 = 0; } else { uVar7 = (*__DestructorCountPtr - *(int *)(param_3 + 0x1c)) - param_2; if ((*(byte *)(param_1 + 1) & 0x20) != 0) { uVar7 = *(uint *)(*(int *)(*param_1 + 8) + 0x20); } if ((*(byte *)((int)param_1 + 5) & 1) == 0) { piVar4 = param_1; if ((int)uVar7 < 1) { if ((param_1[1] & 3U) != 3) { return 0; } local_8 = 1; } else { for (; *piVar4 != 0; piVar4 = piVar4 + 3) { local_c = *piVar4; iVar5 = 1; if (((((*(byte *)(local_c + 4) & 0x10) != 0) && (local_c = *(int *)(local_c + 8), (*(byte *)(local_c + 4) & 2) != 0)) && ((*(byte *)(local_c + 0xc) & 0x20) != 0)) && ((*(byte *)(piVar4 + 1) & 8) != 0)) { if ((*(byte *)(piVar4 + 1) & 4) == 0) { local_10 = (int *)piVar4[2]; } else { local_10 = (int *)(param_4 + piVar4[2]); } local_10 = (int *)*local_10; if ((*(byte *)(piVar4 + 1) & 0x40) != 0) { local_10 = (int *)((int)local_10 + 4); } local_10 = (int *)findTrueTypeAndAddr((int)local_10,&local_c); } iVar3 = local_c; if ((*(byte *)(local_c + 5) & 4) != 0) { iVar5 = *(int *)(local_c + 0xc); iVar3 = *(int *)(local_c + 8); } uVar6 = iVar5 * *(int *)(iVar3 + 0x20); if (uVar7 <= uVar6) goto LAB_00442753; uVar7 = uVar7 - uVar6; } piVar4 = piVar4 + -3; } LAB_00442753: do { local_14 = *piVar4; uVar6 = piVar4[1]; if ((uVar6 & 4) == 0) { local_18 = (int *)piVar4[2]; } else { local_18 = (int *)(param_4 + piVar4[2]); } if ((uVar6 & 0x11) != 0) { local_14 = *(int *)(local_14 + 8); local_1c = *local_18; local_18 = (int *)local_1c; if ((uVar6 & 0x48) == 0x40) { local_18 = (int *)(local_1c + 4); } if ((((*(byte *)(local_14 + 4) & 2) != 0) && ((*(byte *)(local_14 + 0xc) & 0x20) != 0)) && ((uVar6 & 8) != 0)) { local_18 = (int *)findTrueTypeAndAddr((int)local_18,&local_14); } } if (local_8 == 0) { if ((*(byte *)(local_14 + 5) & 4) == 0) { destroyVariable(local_18,local_14,uVar7,1); } else { destroyArray((int)local_18,local_14,uVar7); } } if ((uVar6 & 3) == 3) { if ((uVar6 & 0x48) == 0x48) { local_1c = local_1c + -4; } if ((*(byte *)(local_14 + 5) & 4) == 0) { if (*(int *)(local_14 + 0x14) == 0) { __bdele_qpv(local_1c); } else { callMemberFunc(local_1c,*(undefined **)(local_14 + 0x14), (uint)*(ushort *)(local_14 + 0x18)); } } else { local_14 = *(int *)(local_14 + 8); if (*(int *)(local_14 + 0x1c) == 0) { FUN_00446138(local_1c); } else { callMemberFunc(local_1c,*(undefined **)(local_14 + 0x1c), (uint)*(ushort *)(local_14 + 0x1a)); } } } uVar7 = 0; bVar1 = param_1 < piVar4; piVar4 = piVar4 + -3; } while (bVar1); uVar2 = 0; } else { uVar2 = *(undefined4 *)(*param_1 + 0x24); } } return uVar2; } uint __cdecl _CurrExcContext(int param_1) { int iVar1; if (param_1 == -1) { return 0xffffffff; } if (**(short **)(param_1 + 4) == 0x25ff) { iVar1 = **(int **)(*(int *)(param_1 + 4) + 2); } else { iVar1 = *(int *)(param_1 + 4); } iVar1 = memcmp((byte *)(iVar1 + -8),(byte *)s___BCCxh1_0044bac1,8); if (iVar1 != 0) { return 0xffffffff; } return (uint)*(ushort *)(param_1 + 0x10); } undefined4 __stdcall ___ThrowFileName_qv(void) { int in_FS_OFFSET; return *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x1c); } undefined4 __stdcall ___ThrowLineNumber_qv(void) { int in_FS_OFFSET; return *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x20); } undefined4 __stdcall ___ThrowExceptionName_qv(void) { int in_FS_OFFSET; return *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x24); } undefined4 * __cdecl _typeinfo__bctr_qrx8typeinfo(undefined4 *param_1) { undefined4 local_8; *param_1 = &PTR__typeinfo__bdtr_qv_0044bad8; local_8 = 0; __ThrowException_qpvt1t1t1uiuiuipuc((uint *)&__xt_p8typeinfo,&local_8,0,(undefined *)0x0,0,0,0,0); return param_1; } undefined4 __cdecl _typeinfo__basg_qrx8typeinfo(undefined4 param_1) { return param_1; } void __cdecl _typeinfo__bdtr_qv(undefined4 *param_1,byte param_2) { if ((param_1 != (undefined4 *)0x0) && (*param_1 = &PTR__typeinfo__bdtr_qv_0044bad8, (param_2 & 1) != 0)) { __bdele_qpv((int)param_1); } return; } bool __cdecl _typeinfo__beql_xqrx8typeinfo(int param_1,int param_2) { int iVar1; iVar1 = __isSameTypeID(*(int **)(param_1 + 4),*(int **)(param_2 + 4)); return iVar1 != 0; } bool __cdecl _typeinfo__bneq_xqrx8typeinfo(int param_1,int param_2) { bool bVar1; bVar1 = _typeinfo__beql_xqrx8typeinfo(param_1,param_2); return !bVar1; } bool __cdecl _typeinfo_before_xqrx8typeinfo(int param_1,int param_2) { int iVar1; bool bVar2; if (*(int *)(param_1 + 4) == 0) { bVar2 = false; } else if (*(int *)(param_2 + 4) == 0) { bVar2 = true; } else { iVar1 = strcmp2((char *)((uint)*(ushort *)(*(int *)(param_1 + 4) + 6) + *(int *)(param_1 + 4)), (char *)((uint)*(ushort *)(*(int *)(param_2 + 4) + 6) + *(int *)(param_2 + 4))); bVar2 = iVar1 < 0; } return bVar2; } void __cdecl _typeinfo_name_xqv(int param_1) { __typeIDname(*(int *)(param_1 + 4)); return; } int __cdecl ___GetTypeInfo_qpvt1t1t1(int param_1,int param_2,undefined4 param_3,int param_4) { if (param_1 == 0) { __ThrowException_qpvt1t1t1uiuiuipuc ((uint *)&__xt_10Bad_typeid,(undefined4 *)&DAT_004521ec,0,(undefined *)0x0,0,0,0,0); } *(undefined4 *)(param_4 + 4) = *(undefined4 *)((param_2 - *(int *)(param_2 + -4)) + -0xc); return param_4; } undefined4 * __cdecl FUN_00442a54(int param_1,int *param_2,undefined4 *param_3,int *param_4,int param_5,int *param_6, uint *param_7,int param_8) { int *piVar1; bool bVar2; int iVar3; undefined4 *puVar4; undefined4 *puVar5; undefined4 *puVar6; uint local_18; int local_14; undefined4 *local_10; uint local_c; local_c = 0; local_10 = (undefined4 *)0x0; local_14 = 0; if (((param_6 != (int *)0x0) && (iVar3 = __isSameTypeID(param_6,param_2), iVar3 != 0)) || ((*(byte *)(param_2 + 3) & 4) == 0)) { return (undefined4 *)0x0; } bVar2 = false; puVar5 = (undefined4 *)((uint)*(ushort *)((int)param_2 + 0x12) + (int)param_2); do { while (piVar1 = (int *)*puVar5, piVar1 == (int *)0x0) { if (bVar2) { *param_7 = local_c; if (local_14 != 1) { return (undefined4 *)0x0; } return local_10; } bVar2 = true; puVar5 = (undefined4 *)((uint)*(ushort *)(param_2 + 4) + (int)param_2); } if ((*(byte *)(puVar5 + 2) & 8) == 0) { if ((param_8 == 0) || ((puVar5[2] & 3) != 3)) { local_18 = 0; } else { local_18 = 1; } puVar6 = (undefined4 *)(param_1 + puVar5[1]); if ((*(byte *)(puVar5 + 2) & 4) != 0) { puVar6 = (undefined4 *)*puVar6; } iVar3 = __isSameTypeID(param_4,piVar1); if (iVar3 == 0) { if (((*(byte *)(piVar1 + 3) & 4) != 0) && (puVar6 = FUN_00442a54((int)puVar6,piVar1,param_3,param_4,param_5,param_6,param_7, local_18), puVar6 != (undefined4 *)0x0)) { local_18 = *param_7; LAB_00442b71: if ((local_14 == 0) || (puVar6 != local_10)) { local_14 = local_14 + 1; local_c = local_18; local_10 = puVar6; } else { local_c = local_c | local_18; } } } else if (param_3 == (undefined4 *)0x0) { if ((param_5 == 0) || (puVar4 = FUN_00442a54((int)puVar6,piVar1,(undefined4 *)param_5,param_6,0,(int *)0x0, param_7,0), puVar4 != (undefined4 *)0x0)) goto LAB_00442b71; } else if (puVar6 == param_3) { return puVar6; } } puVar5 = puVar5 + 3; } while( true ); } undefined4 * __cdecl ___DynamicCast_qpvt1t1t1i(int param_1,int param_2,int *param_3,int *param_4,int param_5) { int *piVar1; int iVar2; undefined4 *puVar3; undefined4 *puVar4; uint local_c; int *local_8; local_8 = param_3; if (param_1 != 0) { puVar4 = (undefined4 *)(param_1 - *(int *)(param_2 + -8)); piVar1 = *(int **)((param_2 - *(int *)(param_2 + -4)) + -0xc); if (param_4 == (int *)0x0) { return puVar4; } iVar2 = __isSameTypeID(param_4,piVar1); if (iVar2 != 0) { return puVar4; } iVar2 = __isSameTypeID(local_8,piVar1); if ((iVar2 == 0) && (puVar3 = FUN_00442a54((int)puVar4,piVar1,(undefined4 *)0x0,param_4,param_1,local_8,&local_c, 1), puVar3 != (undefined4 *)0x0)) { return puVar3; } puVar4 = FUN_00442a54((int)puVar4,piVar1,(undefined4 *)0x0,param_4,0,(int *)0x0,&local_c,1); if ((puVar4 != (undefined4 *)0x0) && (local_c != 0)) { return puVar4; } } if (param_5 != 0) { __ThrowException_qpvt1t1t1uiuiuipuc ((uint *)&__xt_8Bad_cast,(undefined4 *)&DAT_004521ed,0,(undefined *)0x0,0,0,0,0); } return (undefined4 *)0x0; } void __InitExceptBlock(int param_1) { undefined4 *puVar1; undefined4 *puVar2; int unaff_EBP; undefined2 in_FS; puVar2 = (undefined4 *)(unaff_EBP + *(int *)(param_1 + 4)); puVar2[2] = param_1; puVar2[3] = &stack0x00000004; puVar2[1] = _ExceptionHandler; puVar2[4] = 0; *(undefined4 *)((int)puVar2 + 0x12) = 0; puVar2[7] = *__DestructorCountPtr; puVar1 = (undefined4 *)segment(in_FS,0); *puVar2 = *puVar1; puVar1 = (undefined4 *)segment(in_FS,0); *puVar1 = puVar2; return; } void __stdcall _terminate_qv(void) { abort(); return; } undefined4 __cdecl _set_terminate_qpqv_v(int param_1) { undefined4 uVar1; int in_FS_OFFSET; uVar1 = *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x14); if (param_1 != 0) { *(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x14) = param_1; } return uVar1; } void __stdcall __call_terminate(void) { undefined4 *in_FS_OFFSET; undefined4 local_24; __InitExceptBlock(0x44bbac); if ((**(int **)(*(int *)(in_FS_OFFSET[1] + -8) + 0xc) != 0) && (__debuggerDisableTerminateCallback == 0)) { ___lockDebuggerData_qv(); *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x14) = 5; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x10) + 0x18) = *(undefined4 *)(*(int *)(in_FS_OFFSET[1] + -8) + 0x14); (**(code **)(*(int *)(in_FS_OFFSET[1] + -8) + 8))(); ___unlockDebuggerData_qv(); __debuggerDisableTerminateCallback = 0; } flushall(); (**(code **)(*(int *)(in_FS_OFFSET[1] + -8) + 0x14))(); abort(); *in_FS_OFFSET = local_24; return; } void __stdcall _unexpected_qv(void) { __call_terminate(); return; } undefined4 __cdecl _set_unexpected_qpqv_v(int param_1) { undefined4 uVar1; int in_FS_OFFSET; uVar1 = *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x18); if (param_1 != 0) { *(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x18) = param_1; } return uVar1; } void __stdcall __call_unexpected(void) { int in_FS_OFFSET; if (**(int **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0xc) != 0) { ___lockDebuggerData_qv(); *(undefined4 *)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x14) = 4; *(undefined4 *)(*(int *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) + 0x18) = *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x18); __debuggerDisableTerminateCallback = 1; (**(code **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 8))(); ___unlockDebuggerData_qv(); } (**(code **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x18))(); abort(); return; } undefined4 __cdecl ___GetPolymorphicDTC_qpvui(int param_1,int param_2) { if (param_1 == 0) { return 0; } return *(undefined4 *) (*(int *)((*(int *)(param_1 + param_2) - *(int *)(*(int *)(param_1 + param_2) + -4)) + -0xc) + 0x20); } void __cdecl _ExceptInit(int param_1) { HMODULE hModule; FARPROC pFVar1; int in_FS_OFFSET; bool bVar2; uint local_c; int local_8; bVar2 = param_1 == 0; if (param_1 == 0) { if (_isDll != 0) { pFVar1 = (FARPROC)0x0; hModule = GetModuleHandleA((LPCSTR)0x0); if (hModule != (HMODULE)0x0) { pFVar1 = GetProcAddress(hModule,s___GetExceptDLLinfo_0044bc3c); } if (((pFVar1 != (FARPROC)0x0) && ((*pFVar1)(), 0x82727348 < local_c)) && (local_c < 0x8272735a)) { param_1 = local_8; } } if (param_1 == 0) { _GetExceptDLLinfoInternal(&local_c); param_1 = local_8; } } else { *(code **)(param_1 + 0x14) = _terminate_qv; *(code **)(param_1 + 0x18) = _unexpected_qv; } *(int *)(*(int *)(in_FS_OFFSET + 4) + -8) = param_1; if (bVar2) { __DestructorCountPtr = *(int *)(in_FS_OFFSET + 4) + -4; } else { *(undefined **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0xc) = &DAT_0044bbd4; *(undefined **)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x10) = &__DebuggerHookData; } *(undefined4 *)(*(int *)(in_FS_OFFSET + 4) + -4) = 0; *(undefined4 *)(*(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 4) = 0; return; } void __stdcall nullsub(void) { return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __cdecl _GetExceptDLLinfoInternal(undefined4 *param_1) { int in_FS_OFFSET; ___exceptStaticBuffP = *(int *)(*(int *)(in_FS_OFFSET + 4) + -8) + 0x30; __debuggerWatchingP = (dword)&DAT_0044bbd4; __debuggerHookDataP = (dword)&__DebuggerHookData; *param_1 = 0x82727349; param_1[1] = &__CPPexceptionList; return; } void __stdcall ___lockDebuggerData_qv(void) { // 0x4302c 5 @__lockDebuggerData$qv if (dbgCSInitialized == 0) { dbgCSInitialized = 1; InitializeCriticalSection(&dbgDataCS); } EnterCriticalSection(&dbgDataCS); return; } void __stdcall ___unlockDebuggerData_qv(void) { // 0x43054 6 @__unlockDebuggerData$qv LeaveCriticalSection(&dbgDataCS); return; } undefined4 __stdcall __DefHandler(void) { return 1; } LONG __cdecl ExcHandler(PEXCEPTION_RECORD param_1,PVOID param_2,PCONTEXT param_3,PVOID param_4) { int iVar1; LONG LVar2; _EXCEPTION_POINTERS local_c; if (param_1->ExceptionCode == 0xeefface) { __doGlobalUnwind(param_2,param_1); __call_terminate(); } if ((param_1->ExceptionCode == 0xc00000fd) && (DAT_0044bc50 != 0)) { _ErrorExit(s_Stack_Overflow__0044bc54); } if ((_UserHandlerPtr != (undefined *)0x0) && (iVar1 = (*(code *)_UserHandlerPtr)(), iVar1 == 0)) { return 0; } if ((_HandlerPtr != (undefined *)0x0) && (iVar1 = (*(code *)_HandlerPtr)(), iVar1 == 0)) { return 0; } local_c.ExceptionRecord = param_1; local_c.ContextRecord = param_3; LVar2 = UnhandledExceptionFilter(&local_c); return LVar2; } void __cdecl _setexc(undefined4 *param_1) { *param_1 = 0; param_1[1] = ExcHandler; _SetExceptionHandler(param_1); return; } void __cdecl _unsetexc(undefined4 *param_1) { _UnsetExceptionHandler(param_1); return; } undefined * __cdecl _SetUserHandler(undefined *param_1) { undefined *puVar1; puVar1 = _UserHandlerPtr; _UserHandlerPtr = param_1; return puVar1; } void __stdcall _unsetuserhandler(void) { _UserHandlerPtr = __DefHandler; return; } void __stdcall _init_except(void) { _HandlerPtr = __DefHandler; _UserHandlerPtr = __DefHandler; return; } void __stdcall _exit_except(void) { if (_ExcRegPtr != (undefined4 *)0x0) { _unsetexc(_ExcRegPtr); } return; } void __stdcall _InitDefaultHander(void) { if (_ExcRegPtr != (undefined4 *)0x0) { _setexc(_ExcRegPtr); } return; } void __doGlobalUnwind(PVOID param_1,PEXCEPTION_RECORD param_2) { RtlUnwind(param_1,(PVOID)0x4431ab,param_2,(PVOID)0x0); return; } void __stdcall invokeHnd(void) { undefined4 *unaff_EBX; (*(code *)*unaff_EBX)(); return; } void __cdecl _SetExceptionHandler(undefined4 *param_1) { undefined4 *puVar1; undefined2 in_FS; puVar1 = (undefined4 *)segment(in_FS,0); *param_1 = *puVar1; puVar1 = (undefined4 *)segment(in_FS,0); *puVar1 = param_1; return; } void __cdecl _UnsetExceptionHandler(undefined4 *param_1) { undefined4 *puVar1; int *piVar2; undefined2 in_FS; piVar2 = (int *)segment(in_FS,0); piVar2 = (int *)*piVar2; if (param_1 == piVar2) { puVar1 = (undefined4 *)segment(in_FS,0); *puVar1 = *param_1; } else { for (; piVar2 != (int *)0xffffffff; piVar2 = (int *)*piVar2) { if ((undefined4 *)*piVar2 == param_1) { *piVar2 = *param_1; return; } } } return; } void __stdcall RtlUnwind(PVOID TargetFrame,PVOID TargetIp,PEXCEPTION_RECORD ExceptionRecord,PVOID ReturnValue) { // WARNING: Could not recover jumptable at 0x00447231. Too many branches // WARNING: Treating indirect jump as call RtlUnwind(TargetFrame,TargetIp,ExceptionRecord,ReturnValue); return; } int __stdcall flushall(void) { FILE *pFVar1; uint uVar2; int iVar3; iVar3 = 0; pFVar1 = _streams; uVar2 = _nfile; while (uVar2 != 0) { if (((pFVar1->flags & 3) != 0) && (pFVar1->level != 0)) { fflush((int *)pFVar1); iVar3 = iVar3 + 1; } pFVar1 = pFVar1 + 1; uVar2 = uVar2 - 1; } return iVar3; } undefined4 __cdecl _allocbuf(int *param_1,uint *param_2,int param_3,uint param_4) { if ((*(byte *)((int)param_1 + 0x12) & 4) != 0) { free(param_1[1]); } *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) & 0xfff3; param_1[3] = 0; param_1[1] = (int)param_1 + 0x17; *param_1 = (int)param_1 + 0x17; if ((param_3 != 2) && (param_4 != 0)) { _exitbuf = _xfflush; if (param_2 == (uint *)0x0) { param_2 = malloc(param_4); if (param_2 == (uint *)0x0) { return 0xffffffff; } *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) | 4; } *param_1 = (int)param_2; param_1[1] = (int)param_2; param_1[3] = param_4; if (param_3 == 1) { *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) | 8; } } return 0; } undefined4 __cdecl fclose(int *param_1) { undefined4 uVar1; int iVar2; char *pcVar3; if ((param_1 == (int *)0x0) || ((short)param_1[5] != (short)param_1)) { uVar1 = 0xffffffff; } else { if (param_1[3] != 0) { if ((param_1[2] < 0) && (iVar2 = fflush(param_1), iVar2 != 0)) { return 0xffffffff; } if ((*(byte *)((int)param_1 + 0x12) & 4) != 0) { free(param_1[1]); } } uVar1 = close((int)*(char *)((int)param_1 + 0x16)); *(undefined2 *)((int)param_1 + 0x12) = 0; param_1[3] = 0; param_1[2] = 0; *(undefined1 *)((int)param_1 + 0x16) = 0xff; if (*(ushort *)(param_1 + 4) != 0) { pcVar3 = make_temp_path((char *)0x0,(char *)0x0,*(ushort *)(param_1 + 4)); delete_file(pcVar3); *(undefined2 *)(param_1 + 4) = 0; } } return uVar1; } undefined4 __cdecl fflush(int *param_1) { undefined4 uVar1; char *pcVar2; char *pcVar3; if (param_1 == (int *)0x0) { _flushout(); uVar1 = 0; } else if ((short)param_1[5] == (short)param_1) { if (param_1[2] < 0) { pcVar3 = (char *)(param_1[3] + param_1[2] + 1); param_1[2] = param_1[2] - (int)pcVar3; *param_1 = param_1[1]; pcVar2 = __write((int)*(char *)((int)param_1 + 0x16),(char *)param_1[1],pcVar3); if ((pcVar3 == pcVar2) || ((*(byte *)((int)param_1 + 0x13) & 2) != 0)) { uVar1 = 0; } else { *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) | 0x10; uVar1 = 0xffffffff; } } else { if ((((*(byte *)((int)param_1 + 0x12) & 8) != 0) || ((int)param_1 + 0x17 == *param_1)) && (param_1[2] = 0, (int)param_1 + 0x17 == *param_1)) { *param_1 = param_1[1]; } uVar1 = 0; } } else { uVar1 = 0xffffffff; } return uVar1; } int __stdcall _flushout(void) { char *pcVar1; FILE *pFVar2; int iVar3; char *pcVar4; uint uVar5; iVar3 = 0; pFVar2 = _streams; uVar5 = _nfile; while (uVar5 != 0) { if (pFVar2->level < 0) { pcVar4 = (char *)(pFVar2->bsize + pFVar2->level + 1); pFVar2->level = pFVar2->level - (int)pcVar4; pFVar2->curp = pFVar2->buffer; pcVar1 = __write((int)pFVar2->fd,(char *)pFVar2->buffer,pcVar4); if ((pcVar4 != pcVar1) && ((pFVar2->flags & 0x200) == 0)) { pFVar2->flags = pFVar2->flags | 0x10; } iVar3 = iVar3 + 1; } pFVar2 = pFVar2 + 1; uVar5 = uVar5 - 1; } return iVar3; } void __cdecl _initfmode(undefined *param_1) { PTR_fmode_0044c1e4 = param_1; return; } uint __cdecl CheckOpenType(char *param_1,uint *param_2,undefined4 *param_3) { char cVar1; uint uVar2; uint uVar3; undefined4 uVar4; uVar4 = 0; cVar1 = *param_1; if (cVar1 == 'r') { uVar3 = 0; uVar2 = 1; } else if (cVar1 == 'w') { uVar3 = 0x301; uVar4 = 0x80; uVar2 = 2; } else { if (cVar1 != 'a') { return 0; } uVar3 = 0x901; uVar4 = 0x80; uVar2 = 2; } cVar1 = param_1[1]; if ((cVar1 == '+') || ((param_1[2] == '+' && ((cVar1 == 't' || (cVar1 == 'b')))))) { if (cVar1 == '+') { cVar1 = param_1[2]; } uVar4 = 0x180; uVar3 = uVar3 & 0xfffffffe | 2; uVar2 = 3; } if (cVar1 == 't') { uVar3 = uVar3 | 0x4000; } else if (cVar1 == 'b') { uVar3 = uVar3 | 0x8000; uVar2 = uVar2 | 0x40; } else { if ((cVar1 != '+') && (cVar1 != '\0')) { return 0; } uVar3 = uVar3 | *(uint *)PTR_fmode_0044c1e4 & 0xc000; if ((*(uint *)PTR_fmode_0044c1e4 & 0x8000) != 0) { uVar2 = uVar2 | 0x40; } } _exitfopen = _xfclose; *param_2 = uVar3; *param_3 = uVar4; return uVar2; } int * __cdecl __topenfp(int *param_1,LPCSTR param_2,char *param_3,uint param_4) { uint uVar1; int iVar2; uint local_c; uint local_8; uVar1 = CheckOpenType(param_3,&local_8,&local_c); *(short *)((int)param_1 + 0x12) = (short)uVar1; if ((short)uVar1 == 0) { LAB_0044352b: *(undefined1 *)((int)param_1 + 0x16) = 0xff; *(undefined2 *)((int)param_1 + 0x12) = 0; param_1 = (int *)0x0; } else { if (*(char *)((int)param_1 + 0x16) < '\0') { iVar2 = ___topen(param_2,local_8 | param_4,local_c); *(char *)((int)param_1 + 0x16) = (char)iVar2; if ((char)iVar2 < '\0') goto LAB_0044352b; } if ((*(byte *)((int)_openfd + *(char *)((int)param_1 + 0x16) * 4 + 1) & 0x20) != 0) { *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) | 0x200; } iVar2 = setvbuf(param_1,(uint *)0x0,(uint)((*(byte *)((int)param_1 + 0x13) & 2) != 0),0x200); if (iVar2 == 0) { *(undefined2 *)(param_1 + 4) = 0; } else { fclose(param_1); param_1 = (int *)0x0; } } return param_1; } undefined4 * __stdcall FUN_00443588(void) { FILE *pFVar1; pFVar1 = _streams; while( true ) { if (pFVar1->fd < '\0') { return &pFVar1->curp; } if (_streams + _nfile <= pFVar1) break; pFVar1 = pFVar1 + 1; } return (undefined4 *)0x0; } int * __cdecl fopen(LPCSTR param_1,char *param_2) { int *piVar1; int *piVar2; piVar1 = FUN_00443588(); piVar2 = (int *)0x0; if (piVar1 != (int *)0x0) { piVar2 = __topenfp(piVar1,param_1,param_2,0); } return piVar2; } void __cdecl fprintf(undefined4 param_1,char *param_2) { printfish(FUN_00443600,param_1,param_2,(uint *)&stack0x0000000c); return; } char * __cdecl FUN_00443600(byte *param_1,char *param_2,int *param_3) { uint uVar1; int iVar2; char *pcVar3; pcVar3 = param_2; if ((*(byte *)((int)param_3 + 0x12) & 8) == 0) { pcVar3 = (char *)param_3[3]; if ((pcVar3 == (char *)0x0) || (pcVar3 < param_2)) { if ((param_3[3] == 0) || ((param_3[2] == 0 || (iVar2 = fflush(param_3), iVar2 == 0)))) { pcVar3 = __write((int)*(char *)((int)param_3 + 0x16),(char *)param_1,param_2); if (pcVar3 < param_2) { param_2 = (char *)0x0; } } else { param_2 = (char *)0x0; } } else { if (-1 < (int)(param_2 + param_3[2])) { if (param_3[2] == 0) { param_3[2] = -1 - (int)pcVar3; } else { iVar2 = fflush(param_3); if (iVar2 != 0) { return (char *)0x0; } } } memcpy((undefined4 *)*param_3,(undefined4 *)param_1,(uint)param_2); param_3[2] = (int)(param_2 + param_3[2]); *param_3 = (int)(param_2 + *param_3); } } else { for (; pcVar3 != (char *)0x0; pcVar3 = pcVar3 + -1) { uVar1 = FUN_00443b80(*param_1,param_3); if (uVar1 == 0xffffffff) { return (char *)0x0; } param_1 = param_1 + 1; } } return param_2; } uint __cdecl FUN_004436d4(byte *param_1,int *param_2) { char *pcVar1; char *pcVar2; if ((param_1 != (byte *)0x0) && (pcVar1 = (char *)strlen((char *)param_1), pcVar1 != (char *)0x0)) { pcVar2 = FUN_00443600(param_1,pcVar1,param_2); if (pcVar2 != (char *)0x0) { return (uint)(param_1 + -1)[(int)pcVar1]; } return 0xffffffff; } return 0; } char * __cdecl FUN_00443714(char *param_1,char *param_2,int *param_3) { int *piVar1; byte *pbVar2; char *pcVar3; uint uVar4; char *unaff_ESI; char *pcVar5; char *local_c; uint local_8; local_c = param_1; if (param_3[3] != 0) { LAB_00443733: if (param_2 == (char *)0x0) { return unaff_ESI; } do { pcVar3 = (char *)param_3[2]; if (pcVar3 != (char *)0x0) { pcVar5 = param_2; if (pcVar3 < param_2) { pcVar5 = pcVar3; } memcpy((undefined4 *)local_c,(undefined4 *)*param_3,(uint)pcVar5); *param_3 = (int)(pcVar5 + *param_3); param_3[2] = param_3[2] - (int)pcVar5; if (param_2 == pcVar5) { return unaff_ESI; } local_c = local_c + (int)pcVar5; param_2 = param_2 + -(int)pcVar5; } if ((char *)param_3[3] <= param_2) { pcVar5 = param_2 + -((uint)param_2 % (uint)param_3[3]); pcVar3 = FUN_00444824((int)*(char *)((int)param_3 + 0x16),local_c,pcVar5); if (param_2 == pcVar3) { return unaff_ESI; } if (pcVar3 == (char *)0xffffffff) { *(ushort *)((int)param_3 + 0x12) = *(ushort *)((int)param_3 + 0x12) | 0x10; return unaff_ESI; } local_c = local_c + (int)pcVar3; param_2 = param_2 + -(int)pcVar3; if (pcVar5 != pcVar3) goto code_r0x004437c0; } uVar4 = FUN_00443ab0(param_3); if (uVar4 == 0xffffffff) { *(ushort *)((int)param_3 + 0x12) = *(ushort *)((int)param_3 + 0x12) | 0x20; return unaff_ESI; } local_8._0_1_ = (char)uVar4; *local_c = (char)local_8; local_c = local_c + 1; param_2 = param_2 + -1; if (param_2 == (char *)0x0) { return unaff_ESI; } } while( true ); } for (; param_2 != (char *)0x0; param_2 = param_2 + -1) { piVar1 = param_3 + 2; *piVar1 = *piVar1 + -1; if (*piVar1 < 0) { local_8 = FUN_00443a9c(param_3); } else { pbVar2 = (byte *)*param_3; *param_3 = *param_3 + 1; local_8 = (uint)*pbVar2; } if (local_8 == 0xffffffff) break; *local_c = (char)local_8; local_c = local_c + 1; } if (local_8 == 0xffffffff) { *(ushort *)((int)param_3 + 0x12) = *(ushort *)((int)param_3 + 0x12) | 0x20; } return unaff_ESI; code_r0x004437c0: if (((*(byte *)((int)param_3 + 0x12) & 0x40) != 0) || (pcVar3 == (char *)0x0)) { *(ushort *)((int)param_3 + 0x12) = *(ushort *)((int)param_3 + 0x12) | 0x20; return unaff_ESI; } goto LAB_00443733; } uint __cdecl fread(char *param_1,int param_2,int param_3,int *param_4) { uint uVar1; char *pcVar2; if (param_2 == 0) { uVar1 = 0; } else { pcVar2 = FUN_00443714(param_1,(char *)(param_2 * param_3),param_4); uVar1 = (uint)(param_2 * param_3 - (int)param_4) / (uint)pcVar2; } return uVar1; } int __cdecl Displacement(undefined4 *param_1) { char cVar1; int iVar2; int iVar3; int iVar4; int iVar5; char *pcVar6; iVar2 = param_1[2]; if (iVar2 < 0) { iVar2 = param_1[3] + iVar2 + 1; } if ((*(byte *)((int)param_1 + 0x12) & 0x40) == 0) { pcVar6 = (char *)*param_1; iVar3 = iVar2; iVar5 = iVar2; if ((int)param_1[2] < 0) { while (iVar3 = iVar2 + -1, iVar2 != 0) { pcVar6 = pcVar6 + -1; iVar2 = iVar3; if (*pcVar6 == '\n') { iVar5 = iVar5 + 1; } } } else { while (iVar4 = iVar3 + -1, iVar5 = iVar2, iVar3 != 0) { cVar1 = *pcVar6; pcVar6 = pcVar6 + 1; iVar3 = iVar4; if (cVar1 == '\n') { iVar2 = iVar2 + 1; } } } return iVar5; } return iVar2; } undefined4 __cdecl fseek(int *param_1,LONG param_2,int param_3) { int iVar1; undefined4 uVar2; DWORD DVar3; iVar1 = fflush(param_1); if (iVar1 == 0) { if ((param_3 == 1) && (0 < param_1[2])) { iVar1 = Displacement(param_1); param_2 = param_2 - iVar1; } *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) & 0xfe5f; param_1[2] = 0; *param_1 = param_1[1]; DVar3 = __lseek((int)*(char *)((int)param_1 + 0x16),param_2,param_3); if (DVar3 == 0xffffffff) { uVar2 = 0xffffffff; } else { uVar2 = 0; } } else { uVar2 = 0xffffffff; } return uVar2; } DWORD __cdecl FUN_00443938(undefined4 *param_1) { DWORD DVar1; DWORD DVar2; int iVar3; DVar1 = __lseek((int)*(char *)((int)param_1 + 0x16),0,1); if (DVar1 != 0xffffffff) { if ((int)param_1[2] < 0) { DVar2 = DVar1; if ((*(byte *)((int)_openfd + *(char *)((int)param_1 + 0x16) * 4 + 1) & 8) != 0) { DVar2 = __lseek((int)*(char *)((int)param_1 + 0x16),0,2); if (DVar2 == 0xffffffff) { return 0xffffffff; } DVar1 = __lseek((int)*(char *)((int)param_1 + 0x16),DVar1,0); if (DVar1 == 0xffffffff) { return 0xffffffff; } } iVar3 = Displacement(param_1); DVar1 = DVar2 + iVar3; } else { iVar3 = Displacement(param_1); DVar1 = DVar1 - iVar3; } } return DVar1; } uint __cdecl fwrite(byte *param_1,uint param_2,uint param_3,int *param_4) { char *pcVar1; if (param_2 != 0) { pcVar1 = FUN_00443600(param_1,(char *)(param_2 * param_3),param_4); param_3 = (uint)pcVar1 / param_2; } return param_3; } void __cdecl get_config_xxx_path_0(uint *param_1,uint param_2) { get_config_xxx_path(0,param_1,param_2); return; } void __stdcall FUN_00443a04(void) { FILE *pFVar1; int iVar2; pFVar1 = _streams; iVar2 = 0x32; while (iVar2 != 0) { if ((pFVar1->flags & 0x300) == 0x300) { fflush((int *)pFVar1); } pFVar1 = pFVar1 + 1; iVar2 = iVar2 + -1; } return; } undefined4 __cdecl FUN_00443a38(undefined4 *param_1) { char *pcVar1; if ((*(byte *)((int)param_1 + 0x13) & 2) != 0) { FUN_00443a04(); } *param_1 = (char *)param_1[1]; pcVar1 = FUN_00444824((int)*(char *)((int)param_1 + 0x16),(char *)param_1[1],(char *)param_1[3]); param_1[2] = pcVar1; if (0 < (int)pcVar1) { *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) & 0xffdf; return 0; } if (param_1[2] == 0) { *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) & 0xfe7f | 0x20; } else { param_1[2] = 0; *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) | 0x10; } return 0xffffffff; } void __cdecl FUN_00443a9c(int *param_1) { param_1[2] = param_1[2] + 1; FUN_00443ab0(param_1); return; } uint __cdecl FUN_00443ab0(int *param_1) { byte *pbVar1; int iVar2; char *pcVar3; uint uVar4; if (param_1 == (int *)0x0) { return 0xffffffff; } if (0 < param_1[2]) { param_1[2] = param_1[2] + -1; pbVar1 = (byte *)*param_1; *param_1 = *param_1 + 1; return (uint)*pbVar1; } if (((param_1[2] < 0) || ((*(ushort *)((int)param_1 + 0x12) & 0x110) != 0)) || ((*(byte *)((int)param_1 + 0x12) & 1) == 0)) { *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) | 0x10; return 0xffffffff; } *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) | 0x80; if (param_1[3] != 0) { iVar2 = FUN_00443a38(param_1); if (iVar2 != 0) { return 0xffffffff; } param_1[2] = param_1[2] + -1; pbVar1 = (byte *)*param_1; *param_1 = *param_1 + 1; return (uint)*pbVar1; } if ((*(byte *)((int)param_1 + 0x13) & 2) != 0) { FUN_00443a04(); } pcVar3 = FUN_00444824((int)*(char *)((int)param_1 + 0x16),(char *)&DAT_004523ac,(char *)0x1); if (pcVar3 == (char *)0x0) { uVar4 = FUN_00444730((int)*(char *)((int)param_1 + 0x16)); if (uVar4 == 1) { *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) & 0xfe7f | 0x20; } else { *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) | 0x10; } return 0xffffffff; } *(ushort *)((int)param_1 + 0x12) = *(ushort *)((int)param_1 + 0x12) & 0xffdf; return (uint)DAT_004523ac; } uint __cdecl FUN_00443b80(byte param_1,int *param_2) { byte *pbVar1; int iVar2; uint uVar3; char *pcVar4; byte local_5; local_5 = param_1; if (param_2[2] < -1) { param_2[2] = param_2[2] + 1; pbVar1 = (byte *)*param_2; *param_2 = *param_2 + 1; *pbVar1 = param_1; if ((((*(byte *)((int)param_2 + 0x12) & 8) != 0) && ((param_1 == 10 || (param_1 == 0xd)))) && (iVar2 = fflush(param_2), iVar2 != 0)) { return 0xffffffff; } uVar3 = (uint)local_5; } else if (((*(ushort *)((int)param_2 + 0x12) & 0x90) == 0) && ((*(ushort *)((int)param_2 + 0x12) & 2) != 0)) { *(ushort *)((int)param_2 + 0x12) = *(ushort *)((int)param_2 + 0x12) | 0x100; if (param_2[3] == 0) { pcVar4 = __write((int)*(char *)((int)param_2 + 0x16),(char *)&local_5,(char *)0x1); if ((pcVar4 == (char *)0x1) || ((*(byte *)((int)param_2 + 0x13) & 2) != 0)) { uVar3 = (uint)local_5; } else { *(ushort *)((int)param_2 + 0x12) = *(ushort *)((int)param_2 + 0x12) | 0x10; uVar3 = 0xffffffff; } } else { if ((param_2[2] != 0) && (iVar2 = fflush(param_2), iVar2 != 0)) { return 0xffffffff; } param_2[2] = -param_2[3]; pbVar1 = (byte *)*param_2; *param_2 = *param_2 + 1; *pbVar1 = local_5; if (((*(byte *)((int)param_2 + 0x12) & 8) != 0) && (((local_5 == 10 || (local_5 == 0xd)) && (iVar2 = fflush(param_2), iVar2 != 0)))) { return 0xffffffff; } uVar3 = (uint)local_5; } } else { *(ushort *)((int)param_2 + 0x12) = *(ushort *)((int)param_2 + 0x12) | 0x10; uVar3 = 0xffffffff; } return uVar3; } char * __cdecl make_temp_path(char *param_1,char *param_2,ushort param_3) { char *pcVar1; if (param_1 == (char *)0x0) { param_1 = &temp_dir; } if (param_2 == (char *)0x0) { param_2 = s_TMP_0044c1e8; } pcVar1 = (char *)str_copy_ret_end((undefined4 *)param_1,param_2); int_to_dec((uint)param_3,pcVar1); strcat(param_1,s______0044c1ec); return param_1; } char * __cdecl make_temp(char *param_1,ushort *param_2) { int iVar1; do { *param_2 = *param_2 + 1; if (*param_2 == 0) { *param_2 = 1; } param_1 = make_temp_path(param_1,(char *)0x0,*param_2); iVar1 = check_file_attribs(param_1,0); } while (iVar1 == 0); return param_1; } undefined4 __cdecl setvbuf(int *param_1,uint *param_2,int param_3,uint param_4) { undefined4 uVar1; if ((((short)param_1[5] == (short)param_1) && (param_3 < 3)) && (param_4 < 0x80000000)) { if (param_1[2] != 0) { fseek(param_1,0,1); } uVar1 = _allocbuf(param_1,param_2,param_3,param_4); } else { uVar1 = 0xffffffff; } return uVar1; } uint __cdecl FUN_00443dd8(undefined4 *param_1,uint param_2,int *param_3) { memcpy((undefined4 *)*param_3,param_1,param_2); *param_3 = *param_3 + param_2; *(undefined1 *)*param_3 = 0; return param_2; } void __cdecl sprintf(undefined1 *param_1) { char *in_stack_00000008; *param_1 = 0; printfish(FUN_00443dd8,¶m_1,in_stack_00000008,(uint *)&stack0x0000000c); return; } void __cdecl FUN_00443e24(undefined1 *param_1,char *param_2) { undefined1 *local_8; local_8 = param_1; *param_1 = 0; printfish(FUN_00443dd8,&local_8,param_2,(uint *)&local_8); return; } void __cdecl vsprintf(undefined1 *param_1,char *param_2,uint *param_3) { *param_1 = 0; printfish(FUN_00443dd8,¶m_1,param_2,param_3); return; } void __stdcall _init_streams(void) { int iVar1; uint uVar2; int iVar3; word *pwVar4; char *pcVar5; pwVar4 = &_streams[0].token; iVar3 = 0; do { iVar1 = iVar3 + 1; *pwVar4 = (short)iVar3 * 0x18 + 0xbc64; pwVar4 = pwVar4 + 0xc; iVar3 = iVar1; } while (iVar1 < 3); pcVar5 = &_streams[3].fd; for (uVar2 = 3; uVar2 < _nfile; uVar2 = uVar2 + 1) { *pcVar5 = -1; *(word *)(pcVar5 + -2) = (short)uVar2 * 0x18 + 0xbc64; pcVar5 = pcVar5 + 0x18; } if ((*(byte *)((int)_openfd + _streams[0].fd * 4 + 1) & 0x20) == 0) { _streams[0].flags = _streams[0].flags & 0xfdff; } _allocbuf((int *)_streams,(uint *)0x0,(uint)((_streams[0].flags & 0x200) != 0),0x200); if ((*(byte *)((int)_openfd + _streams[1].fd * 4 + 1) & 0x20) == 0) { _streams[1].flags = _streams[1].flags & 0xfdff; } iVar3 = 2; if ((_streams[1].flags & 0x200) == 0) { iVar3 = 0; } _allocbuf((int *)(_streams + 1),(uint *)0x0,iVar3,0x200); return; } void __stdcall FUN_00443f34(void) { if (((byte)_streams[0].flags & 4) != 0) { fflush((int *)_streams); free((int)_streams[0].buffer); _streams[0].bsize = 0; _streams[0].level = 0; } if (((byte)_streams[1].flags & 4) != 0) { fflush((int *)(_streams + 1)); free((int)_streams[1].buffer); _streams[1].bsize = 0; _streams[1].level = 0; } return; } void __cdecl FUN_00443f84(int param_1) { int iVar1; if (*(int *)(param_1 + 0x50) != 0) { iVar1 = (**(code **)(param_1 + 0x54))(); if (iVar1 == 0) { *(undefined4 *)(param_1 + 0x60) = 1; } *(undefined4 *)(param_1 + 0x50) = 0; } return; } void __cdecl FUN_00443fb4(undefined1 param_1,int param_2) { if (0x4f < *(int *)(param_2 + 0x50)) { FUN_00443f84(param_2); } *(undefined1 *)(param_2 + *(int *)(param_2 + 0x50)) = param_1; *(int *)(param_2 + 0x50) = *(int *)(param_2 + 0x50) + 1; *(int *)(param_2 + 0x5c) = *(int *)(param_2 + 0x5c) + 1; return; } void __cdecl FUN_00443fdc(uint param_1,int param_2) { char *pcVar1; int iVar2; char cVar3; iVar2 = 7; pcVar1 = (char *)(param_2 + 7); do { cVar3 = (char)(param_1 & 0xf); if ((param_1 & 0xf) < 10) { *pcVar1 = cVar3 + '0'; } else { *pcVar1 = cVar3 + '7'; } param_1 = param_1 >> 4; iVar2 = iVar2 + -1; pcVar1 = pcVar1 + -1; } while (-1 < iVar2); return; } undefined4 __cdecl printfish(undefined4 param_1,undefined4 param_2,char *param_3,uint *param_4) { uint *puVar1; int iVar2; uint uVar3; bool bVar4; bool bVar5; bool bVar6; bool bVar7; bool bVar8; uint uVar9; char cVar10; char *pcVar11; uint uVar12; bool bVar13; undefined1 local_c0 [80]; undefined4 local_70; undefined4 local_6c; undefined4 local_68; undefined4 local_64; int local_60; char local_5c [8]; undefined1 local_54; uint local_2c; uint local_28; uint local_24; char *local_20; char local_19; char *local_18; int local_14; char local_d; uint local_c; uint local_8; local_60 = 0; local_64 = 0; local_70 = 0; local_6c = param_1; local_68 = param_2; LAB_00444036: pcVar11 = param_3; cVar10 = *pcVar11; param_3 = pcVar11 + 1; if (cVar10 != '\0') { if (cVar10 == '%') { if (*param_3 != '%') { uVar9 = 0; local_d = '\0'; local_14 = 0; local_c = 0xffffffff; local_8 = 0xffffffff; uVar12 = 0; bVar7 = false; bVar13 = false; bVar6 = false; bVar5 = false; switchD_0044409d_caseD_18: bVar4 = false; cVar10 = *param_3; param_3 = param_3 + 1; local_18 = pcVar11; if (cVar10 < ' ') goto switchD_0044409d_caseD_13; switch(s_Filename_too_long_0044c648[cVar10 + 0xf]) { case '\0': local_18 = pcVar11; if (uVar9 != 0) goto switchD_0044409d_caseD_13; if (local_d != '+') { local_d = cVar10; } goto switchD_0044409d_caseD_18; case '\x01': local_18 = pcVar11; if (uVar9 != 0) goto switchD_0044409d_caseD_13; uVar12 = 1; goto switchD_0044409d_caseD_18; case '\x02': uVar3 = *param_4; if (uVar9 < 2) { local_8 = uVar3; if ((int)uVar3 < 0) { bVar5 = true; local_8 = -uVar3; } uVar9 = 3; param_4 = param_4 + 1; } else { local_18 = pcVar11; if (uVar9 != 4) goto switchD_0044409d_caseD_13; uVar9 = 5; param_4 = param_4 + 1; local_c = uVar3; } goto switchD_0044409d_caseD_18; case '\x03': local_18 = pcVar11; if (uVar9 != 0) goto switchD_0044409d_caseD_13; bVar5 = true; goto switchD_0044409d_caseD_18; case '\x04': local_18 = pcVar11; if (3 < uVar9) goto switchD_0044409d_caseD_13; uVar9 = 4; local_c = local_c + 1; goto switchD_0044409d_caseD_18; case '\x05': goto switchD_0044409d_caseD_5; case '\x06': bVar6 = true; uVar9 = 5; goto switchD_0044409d_caseD_18; case '\a': uVar9 = 5; bVar6 = false; goto switchD_0044409d_caseD_18; case '\b': uVar9 = 5; bVar7 = true; bVar6 = false; goto switchD_0044409d_caseD_18; case '\t': if (uVar9 == 0) { if (!bVar5) { bVar13 = true; uVar9 = 1; } } else { switchD_0044409d_caseD_5: cVar10 = cVar10 + -0x30; if (uVar9 < 3) { uVar9 = 2; if (local_8 == 0xffffffff) { local_8 = (uint)cVar10; } else { local_8 = local_8 * 10 + (int)cVar10; } } else { local_18 = pcVar11; if (uVar9 != 4) goto switchD_0044409d_caseD_13; local_c = local_c * 10 + (int)cVar10; } } goto switchD_0044409d_caseD_18; case '\n': goto switchD_0044409d_caseD_a; case '\v': local_24 = 8; break; case '\f': local_24 = 10; break; case '\r': local_24 = 0x10; local_19 = cVar10 + -0x17; break; case '\x0e': local_20 = (char *)*param_4; FUN_00443fdc((uint)local_20,(int)local_5c); local_54 = 0; local_20 = local_5c; param_4 = param_4 + 1; goto LAB_00444430; case '\x0f': local_20 = local_5c + 1; thunk_FUN_0044546c(); param_4 = (uint *)thunk_FUN_0044546c(); goto LAB_00444430; case '\x10': local_20 = local_5c; local_5c[0] = (char)*param_4; local_5c[1] = 0; local_2c = 1; param_4 = param_4 + 1; goto LAB_004444a1; case '\x11': puVar1 = param_4 + 1; local_20 = (char *)*param_4; if (local_20 == (char *)0x0) { local_20 = s__null__0044c670; } local_2c = strlen(local_20); param_4 = puVar1; if (((int)local_c < (int)local_2c) && (-1 < (int)local_c)) { local_2c = local_c; } goto LAB_004444a1; case '\x12': puVar1 = param_4 + 1; local_20 = (char *)*param_4; param_4 = puVar1; if (bVar6) { *(undefined4 *)local_20 = local_64; } else if (bVar7) { *(undefined2 *)local_20 = (undefined2)local_64; } else { *(undefined4 *)local_20 = local_64; } goto LAB_00444036; case '\x13': case '\x14': case '\x15': goto switchD_0044409d_caseD_13; case '\x16': uVar9 = 5; goto switchD_0044409d_caseD_18; case '\x17': uVar9 = 5; default: goto switchD_0044409d_caseD_18; } local_d = '\0'; bVar8 = false; goto LAB_0044427d; } param_3 = pcVar11 + 2; cVar10 = '%'; } FUN_00443fb4(cVar10,(int)local_c0); goto LAB_00444036; } goto LAB_0044464b; switchD_0044409d_caseD_a: local_24 = 10; bVar8 = true; LAB_0044427d: if (bVar6) { uVar9 = *param_4; } else if (bVar7) { if (bVar8) { uVar9 = (uint)(short)(ushort)*param_4; } else { uVar9 = (uint)(ushort)*param_4; } } else { uVar9 = *param_4; } param_4 = param_4 + 1; local_20 = local_5c + 1; if (uVar9 == 0) { if (local_c == 0) { local_5c[1] = 0; goto LAB_004442f1; } } else { uVar12 = uVar12 | 4; } int_to_str_helper(uVar9,local_20,local_24,bVar8,local_19); LAB_004442f1: if ((int)local_c < 0) { LAB_00444430: if ((bVar13) && (0 < (int)local_8)) { local_2c = strlen(local_20); if (*local_20 == '-') { local_2c = local_2c + -1; } if ((int)local_2c < (int)local_8) { local_14 = local_8 - local_2c; } } if ((*local_20 == '-') || (local_d != '\0')) { if (*local_20 != '-') { local_20 = local_20 + -1; *local_20 = local_d; } if ((0 < local_14) && ((int)local_c < 0)) { local_14 = local_14 + -1; } } local_2c = strlen(local_20); } else { local_28 = strlen(local_20); local_2c = local_28; if (*local_20 == '-') { local_28 = local_28 - 1; } else if (local_d != '\0') { local_2c = local_28 + 1; local_20 = local_20 + -1; *local_20 = local_d; } if ((int)local_28 < (int)local_c) { local_14 = local_c - local_28; } } LAB_004444a1: if (uVar12 == 5) { if (cVar10 == 'o') { if (local_14 < 1) { local_14 = 1; } } else if ((cVar10 == 'x') || (cVar10 == 'X')) { bVar4 = true; local_8 = local_8 - 2; local_14 = local_14 + -2; if (local_14 < 0) { local_14 = 0; } } } local_2c = local_2c + local_14; if ((!bVar5) && ((int)local_2c < (int)local_8)) { do { FUN_00443fb4(0x20,(int)local_c0); local_8 = local_8 - 1; } while ((int)local_2c < (int)local_8); } if (bVar4) { FUN_00443fb4(0x30,(int)local_c0); FUN_00443fb4(cVar10,(int)local_c0); } if (0 < local_14) { local_2c = local_2c - local_14; local_8 = local_8 - local_14; cVar10 = *local_20; if (((cVar10 == '-') || (cVar10 == ' ')) || (cVar10 == '+')) { cVar10 = *local_20; local_20 = local_20 + 1; FUN_00443fb4(cVar10,(int)local_c0); local_2c = local_2c + -1; local_8 = local_8 - 1; } while (iVar2 = local_14 + -1, bVar13 = local_14 != 0, local_14 = iVar2, bVar13) { FUN_00443fb4(0x30,(int)local_c0); } } if (local_2c != 0) { local_8 = local_8 - local_2c; while (local_2c != 0) { cVar10 = *local_20; local_2c = local_2c + -1; local_20 = local_20 + 1; FUN_00443fb4(cVar10,(int)local_c0); } local_2c = -1; } while (uVar12 = local_8 - 1, bVar13 = 0 < (int)local_8, local_8 = uVar12, bVar13) { FUN_00443fb4(0x20,(int)local_c0); } goto LAB_00444036; switchD_0044409d_caseD_13: while( true ) { pcVar11 = local_18 + 1; cVar10 = *local_18; local_18 = pcVar11; if (cVar10 == '\0') break; FUN_00443fb4(cVar10,(int)local_c0); } LAB_0044464b: FUN_00443f84((int)local_c0); if (local_60 != 0) { local_64 = 0xffffffff; } return local_64; } void __stdcall _xfclose(void) { FILE *pFVar1; uint uVar2; pFVar1 = _streams; for (uVar2 = 0; uVar2 < _nfile; uVar2 = uVar2 + 1) { if (((pFVar1->flags & 3) != 0) && (pFVar1->istemp != 0)) { fclose((int *)pFVar1); } pFVar1 = pFVar1 + 1; } return; } void __stdcall _xfflush(void) { FILE *pFVar1; uint uVar2; pFVar1 = _streams; for (uVar2 = 0; uVar2 < _nfile; uVar2 = uVar2 + 1) { if ((pFVar1->flags & 3) != 0) { fflush((int *)pFVar1); } pFVar1 = pFVar1 + 1; } return; } int __stdcall _flushall(void) { FILE *pFVar1; uint uVar2; int iVar3; iVar3 = 0; pFVar1 = _streams; uVar2 = _nfile; while (uVar2 != 0) { if (((pFVar1->flags & 3) != 0) && (pFVar1->level != 0)) { fflush((int *)pFVar1); iVar3 = iVar3 + 1; } pFVar1 = pFVar1 + 1; uVar2 = uVar2 - 1; } return iVar3; } uint __cdecl FUN_00444718(uint param_1) { uint uVar1; uVar1 = ~DAT_0044c6e0; DAT_0044c6e0 = ~param_1; return uVar1; } uint __cdecl FUN_00444730(uint param_1) { uint uVar1; DWORD DVar2; DWORD DVar3; DWORD DVar4; if (param_1 < _nfile) { if ((_openfd[param_1] & 0x200) == 0) { if ((_openfd[param_1] & 0x2000) == 0) { DVar2 = __lseek(param_1,0,1); if (DVar2 == 0xffffffff) { uVar1 = 0xffffffff; } else { DVar3 = __lseek(param_1,0,2); if (DVar3 == 0xffffffff) { uVar1 = 0xffffffff; } else { DVar4 = __lseek(param_1,DVar2,0); if (DVar4 == 0xffffffff) { uVar1 = 0xffffffff; } else { uVar1 = (uint)((int)DVar3 <= (int)DVar2); } } } } else { uVar1 = 0; } } else { uVar1 = 1; } } else { uVar1 = __IOerror(-6); } return uVar1; } char * __cdecl FUN_004447b8(char *param_1,int param_2) { char *pcVar1; char *pcVar2; uint uVar3; char *pcVar4; char *pcVar5; pcVar1 = param_1 + param_2; pcVar4 = param_1; pcVar5 = param_1; while( true ) { pcVar2 = FUN_00440b44(pcVar4,'\r',(int)pcVar1 - (int)pcVar4); if (pcVar2 == (char *)0x0) { pcVar2 = pcVar1; } uVar3 = (int)pcVar2 - (int)pcVar4; if (pcVar5 != pcVar4) { memcpy((undefined4 *)pcVar5,(undefined4 *)pcVar4,uVar3); } if (pcVar1 + -1 <= pcVar2) break; pcVar4 = pcVar2 + 1; pcVar5 = pcVar5 + uVar3; } return pcVar5 + (uVar3 - (int)param_1); } char * __cdecl FUN_00444824(uint param_1,char *param_2,char *param_3) { char *pcVar1; uint uVar2; char *pcVar3; int iVar4; char *pcVar5; uint uVar6; if (param_1 < _nfile) { if (param_3 + 1 < (char *)0x2) { pcVar1 = (char *)0x0; } else if ((*(byte *)((int)_openfd + param_1 * 4 + 1) & 0x40) == 0) { pcVar1 = (char *)read(param_1,param_2,(DWORD)param_3); } else if ((*(byte *)((int)_openfd + param_1 * 4 + 1) & 2) == 0) { pcVar1 = (char *)0x0; if (param_3 != (char *)0x0) { while( true ) { uVar6 = (int)param_3 - (int)pcVar1; uVar2 = read(param_1,param_2,uVar6); if (uVar2 == 0xffffffff) { return (char *)0xffffffff; } if (uVar2 == 0) { return pcVar1; } pcVar3 = FUN_00440b44(param_2,'\x1a',uVar2); if (pcVar3 != (char *)0x0) { _openfd[param_1] = _openfd[param_1] | 0x200; uVar2 = (int)pcVar3 - (int)param_2; if (uVar2 == 0) { return pcVar1; } } if ((param_2[uVar2 - 1] == '\r') && (iVar4 = read(param_1,param_2 + (uVar2 - 1),1), iVar4 == -1)) break; pcVar5 = FUN_004447b8(param_2,uVar2); pcVar1 = pcVar1 + (int)pcVar5; if ((uVar2 < uVar6) && ((*(byte *)((int)_openfd + param_1 * 4 + 1) & 0x20) != 0)) { return pcVar1; } if (pcVar3 != (char *)0x0) { return pcVar1; } if (pcVar5 != (char *)0x0) { return pcVar1; } if (param_3 <= pcVar1) { return pcVar1; } } pcVar1 = (char *)0xffffffff; } } else { pcVar1 = (char *)0x0; } } else { pcVar1 = (char *)__IOerror(-6); } return pcVar1; } // WARNING: Type propagation algorithm not settling int __cdecl FUN_00444954(char *param_1,int *param_2,undefined4 *param_3,int param_4) { int iVar1; char *pcVar2; char *pcVar3; char *pcVar4; undefined1 *puVar5; undefined4 *puVar6; char *pcVar7; int local_14; iVar1 = *param_2; *param_2 = 0; local_14 = 0; puVar6 = param_3; pcVar7 = param_1; while( true ) { pcVar4 = param_1 + (iVar1 - (int)pcVar7); pcVar2 = FUN_00440b44(pcVar7,'\n',(int)pcVar4); if (pcVar2 != (char *)0x0) { pcVar4 = pcVar2 + -(int)pcVar7; } pcVar3 = (char *)((int)param_3 + (param_4 - (int)puVar6)); if (pcVar3 < pcVar4) break; memcpy(puVar6,(undefined4 *)pcVar7,(uint)pcVar4); puVar5 = (undefined1 *)((int)puVar6 + (int)pcVar4); if ((pcVar2 == (char *)0x0) || ((int)param_3 + (param_4 - (int)puVar5) < 2)) { *param_2 = (int)(pcVar4 + *param_2); LAB_00444a04: return local_14 + (int)pcVar4; } *puVar5 = 0xd; puVar5[1] = 10; puVar6 = (undefined4 *)(puVar5 + 2); local_14 = local_14 + (int)(pcVar4 + 2); pcVar7 = pcVar7 + (int)(pcVar4 + 1); *param_2 = (int)(pcVar4 + 1 + *param_2); } memcpy(puVar6,(undefined4 *)pcVar7,(uint)pcVar3); *param_2 = (int)(pcVar3 + *param_2); pcVar4 = pcVar3; goto LAB_00444a04; } char * __cdecl __write(uint param_1,char *param_2,char *param_3) { char *pcVar1; char *pcVar2; DWORD DVar3; undefined4 local_8c [32]; DWORD local_c; char *local_8; if (param_1 < _nfile) { if (param_3 + 1 < (char *)0x2) { param_3 = (char *)0x0; } else { if ((*(byte *)((int)_openfd + param_1 * 4 + 1) & 8) != 0) { __lseek(param_1,0,2); } pcVar1 = param_2; pcVar2 = param_3; if ((*(byte *)((int)_openfd + param_1 * 4 + 1) & 0x40) == 0) { param_3 = (char *)_rtl_write(param_1,param_2,(DWORD)param_3); } else { for (; pcVar2 != (char *)0x0; pcVar2 = pcVar2 + -(int)local_8) { local_8 = pcVar2; DVar3 = FUN_00444954(pcVar1,(int *)&local_8,local_8c,0x80); local_c = _rtl_write(param_1,local_8c,DVar3); if (DVar3 != local_c) { if (local_c == 0xffffffff) { return (char *)0xffffffff; } return pcVar1 + (local_c - (int)param_2); } pcVar1 = pcVar1 + (int)local_8; } } } } else { param_3 = (char *)__IOerror(-6); } return param_3; } uint * __cdecl get_config_xxx_path(int param_1,uint *param_2,uint param_3) { code *pcVar1; DWORD DVar2; uint uVar3; uint uVar4; char cVar5; uint *puVar6; char *pcVar7; uint *puVar9; bool bVar10; byte bVar11; char local_110 [260]; LPSTR local_c; char local_8 [4]; char *pcVar8; bVar11 = 0; if (param_1 == 0) { DVar2 = GetCurrentDirectoryA(0x103,local_110); if ((DVar2 == 0) || ((int)param_3 < (int)DVar2)) { errno = 8; return (uint *)0x0; } } else { cVar5 = (char)param_1; if (_ostype == 2) { local_110[0] = cVar5 + '@'; bVar10 = (char *)0xfffffffc < local_110; local_110[1] = 0x3a; local_110[2] = 0x5c; local_110[3] = 0; pcVar1 = (code *)swi(0x21); (*pcVar1)(CONCAT11(0x47,cVar5),param_1,local_110 + 3); if (bVar10) { return (uint *)0x0; } } else { DVar2 = GetLogicalDrives(); if ((1 << (cVar5 - 1U & 0x1f) & DVar2) == 0) { return (uint *)0x0; } local_8[0] = cVar5 + '@'; local_8[1] = ':'; local_8[2] = 0; GetFullPathNameA(local_8,0x103,local_110,&local_c); } } uVar3 = strlen(local_110); if (uVar3 < param_3) { if ((param_2 == (uint *)0x0) && (param_2 = malloc(param_3), param_2 == (uint *)0x0)) { errno = 8; param_2 = (uint *)0x0; } else { uVar3 = 0xffffffff; pcVar8 = local_110; do { pcVar7 = pcVar8; if (uVar3 == 0) break; uVar3 = uVar3 - 1; pcVar7 = pcVar8 + (uint)bVar11 * -2 + 1; cVar5 = *pcVar8; pcVar8 = pcVar7; } while (cVar5 != '\0'); uVar3 = ~uVar3; puVar6 = (uint *)(pcVar7 + -uVar3); puVar9 = param_2; for (uVar4 = uVar3 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) { *puVar9 = *puVar6; puVar6 = puVar6 + (uint)bVar11 * -2 + 1; puVar9 = puVar9 + (uint)bVar11 * -2 + 1; } for (uVar3 = uVar3 & 3; uVar3 != 0; uVar3 = uVar3 - 1) { *(char *)puVar9 = (char)*puVar6; puVar6 = (uint *)((int)puVar6 + (uint)bVar11 * -2 + 1); puVar9 = (uint *)((int)puVar9 + (uint)bVar11 * -2 + 1); } } } else { errno = 0x22; param_2 = (uint *)0x0; } return param_2; } int __cdecl _get_handle(HANDLE param_1,dword param_2) { uint uVar1; dword *pdVar2; uVar1 = 0; for (pdVar2 = _openfd; ((int)uVar1 < (int)_nfile && (*pdVar2 != 0)); pdVar2 = pdVar2 + 1) { uVar1 = uVar1 + 1; } if (uVar1 == _nfile) { return -1; } _openfd[uVar1] = param_2; _handles[uVar1] = param_1; return uVar1; } uint __cdecl FUN_00444c68(uint param_1,uint param_2,HANDLE param_3) { dword *pdVar1; if (param_2 == 0xffffffff) { param_2 = 0; for (pdVar1 = _openfd; ((int)param_2 < (int)_nfile && (*pdVar1 != 0)); pdVar1 = pdVar1 + 1) { param_2 = param_2 + 1; } } if ((param_1 < _nfile) && (param_2 < _nfile)) { if ((_openfd[param_1] != 0) && (_openfd[param_2] == 0)) { _openfd[param_2] = _openfd[param_1]; _handles[param_2] = param_3; return param_2; } return 0xffffffff; } return 0xffffffff; } void __cdecl FUN_00444cd0(uint param_1) { if (param_1 < _nfile) { _openfd[param_1] = 0; } return; } int __cdecl FUN_00444cec(int *param_1) { uint uVar1; uint uVar2; int iVar3; byte bVar4; uint *puVar5; byte *pbVar6; dword *local_c; int local_8; uVar2 = _nfile; for (puVar5 = &_nfile + _nfile; (uVar2 != 0 && (*puVar5 == 0)); puVar5 = puVar5 + -1) { uVar2 = uVar2 - 1; } if (param_1 == (int *)0x0) { if (uVar2 == 0) { iVar3 = 0; } else { iVar3 = uVar2 * 5 + 4; } } else { *param_1 = uVar2; local_8 = 0; pbVar6 = (byte *)(param_1 + 1); local_c = _openfd; if (0 < (int)uVar2) { do { bVar4 = 1; uVar1 = *local_c; if ((uVar1 & 0x800) != 0) { bVar4 = 0x21; } if ((uVar1 & 0x8000) == 0) { bVar4 = bVar4 | 0x80; } if ((uVar1 & 0x2000) != 0) { bVar4 = bVar4 | 0x40; } *pbVar6 = bVar4; pbVar6 = pbVar6 + 1; local_8 = local_8 + 1; local_c = local_c + 1; } while (local_8 < (int)uVar2); } memcpy((undefined4 *)pbVar6,_handles,uVar2 << 2); iVar3 = 0; } return iVar3; } void __stdcall fds_init(void) { bool bVar1; UINT UVar2; uint uVar3; undefined3 extraout_var; int iVar4; uint uVar5; uint uVar6; uint *puVar7; dword *pdVar8; _STARTUPINFOA local_50; UVar2 = SetHandleCount(_nfile); if (UVar2 < _nfile) { _nfile = UVar2; } PTR_LAB_0044c6dc = FUN_00444cec; bVar1 = false; GetStartupInfoA(&local_50); if (local_50.cbReserved2 != 0) { uVar6 = *(uint *)local_50.lpReserved2; puVar7 = (uint *)((int)local_50.lpReserved2 + 4); if (uVar6 * 5 + 4 == (uint)local_50.cbReserved2) { bVar1 = true; iVar4 = 0; pdVar8 = _openfd; if (0 < (int)uVar6) { do { uVar5 = *puVar7; puVar7 = (uint *)((int)puVar7 + 1); uVar3 = 0; if ((uVar5 & 0x20) != 0) { uVar3 = 0x800; } if ((uVar5 & 0x40) != 0) { uVar3 = uVar3 | 0x2000; } if ((uVar5 & 0x80) == 0) { uVar3 = uVar3 | 0x8000; } else { uVar3 = uVar3 | 0x4000; } iVar4 = iVar4 + 1; *pdVar8 = *pdVar8 & 3 | uVar3; pdVar8 = pdVar8 + 1; } while (iVar4 < (int)uVar6); } pdVar8 = _openfd + uVar6; for (uVar5 = uVar6; uVar5 < _nfile; uVar5 = uVar5 + 1) { *pdVar8 = 0; pdVar8 = pdVar8 + 1; } memmove_maybe(_handles,puVar7,uVar6 << 2); } } if (!bVar1) { _handles[0] = GetStdHandle(0xfffffff6); _handles[1] = GetStdHandle(0xfffffff5); _handles[2] = GetStdHandle(0xfffffff4); uVar6 = 0; pdVar8 = _openfd; do { bVar1 = isatty(uVar6); if (CONCAT31(extraout_var,bVar1) == 0) { *pdVar8 = *pdVar8 & 0xffffdfff; } else { *pdVar8 = *pdVar8 | 0x2000; } uVar6 = uVar6 + 1; pdVar8 = pdVar8 + 1; } while ((int)uVar6 < 3); } return; } undefined4 __cdecl __IOerror(int param_1) { if (param_1 < 0) { if (-param_1 < _sys_nerr) { errno = -param_1; _doserrno = -1; return 0xffffffff; } } else if (param_1 < 299) goto LAB_00444ee2; param_1 = 1; LAB_00444ee2: _doserrno = param_1; errno = (int)(char)_dosErrorToSV[param_1]; return 0xffffffff; } void __stdcall __NTerror(void) { DWORD DVar1; DVar1 = GetLastError(); __IOerror(DVar1 & 0xffff); return; } undefined4 __cdecl read(uint param_1,LPVOID param_2,DWORD param_3) { undefined4 uVar1; BOOL BVar2; DWORD local_8; if (_nfile <= param_1) { uVar1 = __IOerror(6); return uVar1; } BVar2 = ReadFile(_handles[param_1],param_2,param_3,&local_8,(LPOVERLAPPED)0x0); if (BVar2 != 1) { uVar1 = __NTerror(); return uVar1; } return local_8; } void __cdecl FUN_00444f8c(uint param_1,LPVOID param_2,DWORD param_3) { read(param_1,param_2,param_3); return; } undefined4 __cdecl _rtl_write(uint param_1,LPCVOID param_2,DWORD param_3) { undefined4 uVar1; BOOL BVar2; DWORD local_8; if (_nfile <= param_1) { uVar1 = __IOerror(6); return uVar1; } BVar2 = WriteFile(_handles[param_1],param_2,param_3,&local_8,(LPOVERLAPPED)0x0); if (BVar2 != 1) { uVar1 = __NTerror(); return uVar1; } return local_8; } void __cdecl FUN_00444ff0(uint param_1,LPCVOID param_2,DWORD param_3) { _rtl_write(param_1,param_2,param_3); return; } undefined4 __cdecl check_file_attribs(LPCSTR param_1,byte param_2) { DWORD DVar1; undefined4 uVar2; DVar1 = GetFileAttributesA(param_1); if (DVar1 == 0xffffffff) { uVar2 = __NTerror(); return uVar2; } if (((param_2 & 2) != 0) && ((DVar1 & 1) != 0)) { errno = 5; return 0xffffffff; } return 0; } undefined4 __cdecl close(uint param_1) { undefined4 uVar1; BOOL BVar2; if (_nfile <= param_1) { uVar1 = __IOerror(6); return uVar1; } BVar2 = CloseHandle(_handles[param_1]); if (BVar2 == 1) { _openfd[param_1] = 0; _handles[param_1] = (HANDLE)0xffffffff; return 0; } uVar1 = __NTerror(); return uVar1; } bool __cdecl isatty(uint param_1) { DWORD DVar1; if (_nfile <= param_1) { return false; } DVar1 = GetFileType(_handles[param_1]); return DVar1 == 2; } bool __cdecl __isatty_osfhandle(HANDLE param_1) { DWORD DVar1; DVar1 = GetFileType(param_1); return DVar1 == 2; } DWORD __cdecl __lseek(uint param_1,LONG param_2,int param_3) { DWORD DVar1; if (param_1 < _nfile) { if (param_3 == 0) { DVar1 = 0; } else if (param_3 == 1) { DVar1 = 1; } else { if (param_3 != 2) { DVar1 = __IOerror(1); return DVar1; } DVar1 = 2; } _openfd[param_1] = _openfd[param_1] & 0xfffffdff; DVar1 = SetFilePointer(_handles[param_1],param_2,(PLONG)0x0,DVar1); if (DVar1 == 0xffffffff) { __NTerror(); } } else { DVar1 = __IOerror(6); } return DVar1; } int __cdecl ___topen(LPCSTR param_1,uint param_2,uint param_3) { bool bVar1; int iVar2; HANDLE hObject; undefined3 extraout_var; uint uVar3; DWORD dwFlagsAndAttributes; DWORD DVar4; _SECURITY_ATTRIBUTES local_18; DWORD local_c; DWORD local_8; if ((param_2 & 0xc000) == 0) { param_2 = param_2 | *(uint *)PTR_fmode_0044c1e4 & 0xc000; } if ((param_2 & 0x8000) == 0) { param_2 = param_2 | 0x4000; } uVar3 = param_2 & 0x700; if (uVar3 < 0x501) { if (uVar3 == 0x500) { LAB_004451bf: DVar4 = 1; goto LAB_004451e0; } if (uVar3 == 0x100) { DVar4 = 4; goto LAB_004451e0; } if (uVar3 != 0x200) { if (uVar3 == 0x300) { DVar4 = 2; goto LAB_004451e0; } goto LAB_004451db; } } else if (uVar3 != 0x600) { if (uVar3 != 0x700) { LAB_004451db: DVar4 = 3; goto LAB_004451e0; } goto LAB_004451bf; } DVar4 = 5; LAB_004451e0: if ((param_2 & 0x100) == 0) { dwFlagsAndAttributes = GetFileAttributesA(param_1); if (dwFlagsAndAttributes == 0xffffffff) { dwFlagsAndAttributes = 0; } } else if ((param_3 & DAT_0044c6e0 & 0x80) == 0) { dwFlagsAndAttributes = 1; } else { dwFlagsAndAttributes = 0x80; } uVar3 = param_2 & 3; if (uVar3 == 0) { local_8 = 0x80000000; } else if (uVar3 == 1) { local_8 = 0x40000000; } else { if (uVar3 != 2) { iVar2 = __IOerror(1); return iVar2; } local_8 = 0xc0000000; } uVar3 = param_2 & 0x70; if (uVar3 == 0x10) { local_c = 0; } else if (uVar3 == 0x20) { local_c = 1; } else if (uVar3 == 0x30) { local_c = 2; } else { local_c = 3; } local_18.nLength = 0xc; local_18.lpSecurityDescriptor = (LPVOID)0x0; local_18.bInheritHandle = (BOOL)((param_2 & 0x80) == 0); hObject = CreateFileA(param_1,local_8,local_c,&local_18,DVar4,dwFlagsAndAttributes,(HANDLE)0x0); if (hObject == (HANDLE)0xffffffff) { DVar4 = GetLastError(); uVar3 = DVar4 & 0xffff; if ((uVar3 == 0x6e) && (uVar3 = 0x50, (param_2 & 0x100) == 0)) { uVar3 = 2; } iVar2 = __IOerror(uVar3); } else { bVar1 = __isatty_osfhandle(hObject); if (CONCAT31(extraout_var,bVar1) != 0) { param_2 = param_2 | 0x2000; } iVar2 = _get_handle(hObject,param_2 & 0xfffff8ff); if (iVar2 == -1) { __IOerror(4); CloseHandle(hObject); } } return iVar2; } undefined4 __cdecl delete_file(LPCSTR param_1) { BOOL BVar1; undefined4 uVar2; BVar1 = DeleteFileA(param_1); if (BVar1 == 1) { uVar2 = 0; } else { uVar2 = __NTerror(); } return uVar2; } uint __cdecl toupper(uint param_1) { uint uVar1; if (param_1 == 0xffffffff) { return 0xffffffff; } uVar1 = param_1 & 0xff; if ((char_info[uVar1] & 8U) != 0) { return uVar1 - 0x20; } return uVar1; } undefined2 __stdcall _clear87(void) { undefined2 in_FPUStatusWord; return in_FPUStatusWord; } void __stdcall _control87(void) { return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address void __stdcall thunk_FUN_0044546c(void) { // WARNING: Could not recover jumptable at 0x004453d0. Too many branches // WARNING: Treating indirect jump as call (*_DAT_0044c91c)(); return; } void __stdcall thunk_FUN_0044546c(void) { // WARNING: Could not recover jumptable at 0x004453d6. Too many branches // WARNING: Treating indirect jump as call (*(code *)PTR_FUN_0044c920)(); return; } void __stdcall _fpreset(void) { _control87(); return; } int __cdecl FUN_00445400(char *param_1) { char cVar1; int iVar2; char *pcVar3; bool bVar4; iVar2 = 0; do { pcVar3 = param_1; cVar1 = *pcVar3; param_1 = pcVar3 + 1; } while ((char_info[cVar1] & 1U) != 0); if ((cVar1 == '+') || (cVar1 == '-')) { bVar4 = cVar1 == '-'; cVar1 = *param_1; param_1 = pcVar3 + 2; } else { bVar4 = false; } while (('/' < cVar1 && (cVar1 < ':'))) { iVar2 = iVar2 * 10 + (int)cVar1 + -0x30; cVar1 = *param_1; param_1 = param_1 + 1; } if (bVar4) { iVar2 = -iVar2; } return iVar2; } void __cdecl FUN_0044545c(char *param_1) { FUN_00445400(param_1); return; } void __stdcall FUN_0044546c(void) { _ErrorExit(s_printf___floating_point_formats_n_0044c92c); return; } char * __cdecl int_to_str_helper(uint param_1,char *param_2,uint param_3,char param_4,char param_5) { char cVar1; char *pcVar2; char *pcVar3; char local_28 [36]; pcVar3 = param_2; if ((1 < (int)param_3) && ((int)param_3 < 37)) { if (((int)param_1 < 0) && (param_4 != '\0')) { *param_2 = '-'; pcVar3 = param_2 + 1; param_1 = -param_1; } pcVar2 = local_28; do { *pcVar2 = (char)(param_1 % param_3); pcVar2 = pcVar2 + 1; param_1 = param_1 / param_3; } while (param_1 != 0); while (pcVar2 != local_28) { pcVar2 = pcVar2 + -1; cVar1 = *pcVar2; if (cVar1 < '\n') { *pcVar3 = cVar1 + '0'; pcVar3 = pcVar3 + 1; } else { *pcVar3 = cVar1 + param_5 + -10; pcVar3 = pcVar3 + 1; } } } *pcVar3 = '\0'; return param_2; } void __cdecl int_to_dec(uint param_1,char *param_2) { int_to_str_helper(param_1,param_2,10,'\0','a'); return; } void __cdecl itoa(uint param_1,char *param_2,uint param_3) { int_to_str_helper(param_1,param_2,param_3,'\0','a'); return; } void __cdecl int_to_dec_signed(uint param_1,char *param_2,uint param_3) { int_to_str_helper(param_1,param_2,param_3,param_3 == 10,'a'); return; } undefined4 __cdecl _matherr(int *param_1) { if (*param_1 == 4) { param_1[6] = 0; param_1[7] = 0; return 1; } if (*param_1 == 5) { return 1; } return 0; } undefined4 __cdecl _matherrl(int *param_1) { if (*param_1 == 4) { param_1[7] = 0; param_1[8] = 0; *(undefined2 *)(param_1 + 9) = 0; return 1; } if (*param_1 == 5) { return 1; } return 0; } void __cdecl _initmatherr(undefined *param_1,undefined *param_2) { PTR__matherr_0044c988 = param_1; PTR__matherrl_0044c98c = param_2; return; } void __cdecl srand(undefined4 param_1) { rand_state = param_1; rand_state_2 = 0; return; } uint __stdcall rand(void) { int iVar1; uint uVar2; iVar1 = 0; if (rand_state_2 != 0) { iVar1 = rand_state_2 * 0x4e35; } uVar2 = (uint)((ulonglong)rand_state * 0x4e35); rand_state_2 = (int)((ulonglong)rand_state * 0x4e35 >> 0x20) + rand_state * 0x15a4 + iVar1 + (uint)(0xfffffffe < uVar2); rand_state = uVar2 + 1; return rand_state_2 & 0x7fffffff; } uint * __cdecl calloc(int param_1,int param_2) { uint *puVar1; puVar1 = malloc(param_1 * param_2); if (puVar1 != (uint *)0x0) { memset(puVar1,0,param_1 * param_2); } return puVar1; } void __stdcall _table_init(void) { dword dVar1; undefined *puVar2; undefined *puVar3; uint uVar4; for (uVar4 = 0xc; puVar2 = _linktable, dVar1 = _smalloc_threshold, uVar4 < _smalloc_threshold; uVar4 = uVar4 + 4) { puVar3 = _linktable + uVar4 * 2 + -0xc; *(undefined **)(_linktable + uVar4 * 2 + -8) = puVar3; *(undefined **)(puVar2 + uVar4 * 2 + -4) = puVar3; } *(undefined4 *)(_linktable + _smalloc_threshold * 2 + -8) = 0; *(undefined4 *)(puVar2 + dVar1 * 2 + -4) = 0; return; } undefined4 __cdecl _vheapadd(uint *param_1,uint param_2,uint param_3) { undefined4 uVar1; undefined *puVar2; uint *puVar3; int iVar4; uint uVar5; iVar4 = 0; if (param_2 < 0x1000) { uVar1 = 0xffffffff; } else { param_1[2] = 1; param_1[3] = (uint)param_1; *param_1 = param_2; param_1[1] = param_3; param_1[0x23] = (uint)_firstHeap; param_1[0x24] = 0; if (_firstHeap == (undefined *)0x0) { _lastHeap = (undefined *)param_1; } else { *(uint **)(_firstHeap + 0x90) = param_1; } _firstHeap = (undefined *)param_1; param_1[0x25] = 0; puVar3 = param_1 + 0x26; if (_linktable == (undefined *)0x0) { uVar5 = _smalloc_threshold * 2 + 3 & 0xfffffffc; _linktable = (undefined *)(param_1 + 0x27); *puVar3 = uVar5; puVar3 = (uint *)((int)puVar3 + uVar5 + 4); _table_init(); iVar4 = uVar5 + 4; } uVar5 = (param_2 - 0xa0) - iVar4; *puVar3 = uVar5 + 1; *(undefined4 *)((int)puVar3 + (uVar5 + 1 & 0xfffffffc) + 4) = 2; puVar2 = PTR_DAT_0044c9cc; if (uVar5 < _smalloc_threshold) { puVar2 = _linktable + uVar5 * 2 + -0xc; } puVar3[1] = *(uint *)(puVar2 + 4); puVar3[2] = (uint)puVar2; *(uint **)(puVar3[1] + 8) = puVar3; *(uint **)(puVar2 + 4) = puVar3; *(uint *)((int)puVar3 + uVar5) = uVar5 + 4; uVar1 = 0; } return uVar1; } undefined4 __cdecl _heapresize(uint *param_1,uint param_2) { uint uVar1; int iVar2; uint *puVar3; uint uVar4; uVar4 = param_2 & 0xfffff000; uVar1 = *param_1; iVar2 = uVar1 + (int)param_1; puVar3 = (uint *)(iVar2 + -4); if (uVar4 < uVar1) { if ((*(byte *)puVar3 & 2) == 0) { return 0xffffffff; } puVar3 = (uint *)((int)puVar3 - *(int *)(iVar2 + -8)); if ((*puVar3 & 0xfffffffc) - 0xc < uVar1 - uVar4) { return 0xffffffff; } *puVar3 = *puVar3 - (uVar1 - uVar4); *(uint *)((int)puVar3 + (*puVar3 & 0xfffffffc)) = (*puVar3 & 0xfffffffc) + 4; *(undefined4 *)((int)puVar3 + (*puVar3 & 0xfffffffc) + 4) = 2; if ((*puVar3 & 0xfffffffc) < _smalloc_threshold) { uVar1 = puVar3[1]; *(uint *)(uVar1 + 8) = puVar3[2]; *(uint *)(puVar3[2] + 4) = uVar1; puVar3[1] = *(uint *)(_linktable + (*puVar3 & 0xfffffffc) * 2 + -8); puVar3[2] = (uint)(_linktable + (*puVar3 & 0xfffffffc) * 2 + -0xc); *(uint **)(puVar3[1] + 8) = puVar3; *(uint **)(_linktable + (*puVar3 & 0xfffffffc) * 2 + -8) = puVar3; } } else { uVar1 = *param_1; *puVar3 = *puVar3 + (uVar4 - uVar1) + -4; *(undefined4 *)(iVar2 + (*puVar3 & 0xfffffffc)) = 0; free(iVar2); *param_1 = *param_1 + (uVar4 - uVar1); } return 0; } undefined4 __cdecl _get_more_heap(int param_1) { uint uVar1; uint *puVar2; dword dVar3; int iVar4; undefined4 uVar5; int iVar6; dword dVar7; uint uVar8; uint local_c; uint *local_8; uVar8 = param_1 + 0xfffU & 0xfffff000; if (avail == 0) { avail = _phys_avail(); } puVar2 = (uint *)_firstHeap; if (_linktable == (undefined *)0x0) { uVar8 = uVar8 + (_smalloc_threshold * 2 + 0x109f & 0xfffff000); } for (; puVar2 != (uint *)0x0; puVar2 = (uint *)puVar2[0x23]) { if (uVar8 < puVar2[1] - *puVar2) { dVar3 = _virt_chunk_size2; if (__allocated + _virt_chunk_size < avail) { dVar3 = _virt_chunk_size; } dVar7 = _virt_chunk_size2; if (__allocated + _virt_chunk_size < avail) { dVar7 = _virt_chunk_size; } if (puVar2[1] < ((dVar3 - 1) + uVar8 & ~(dVar7 - 1)) + *puVar2) { uVar8 = puVar2[1]; } else { dVar3 = _virt_chunk_size2; if (__allocated + _virt_chunk_size < avail) { dVar3 = _virt_chunk_size; } dVar7 = _virt_chunk_size2; if (__allocated + _virt_chunk_size < avail) { dVar7 = _virt_chunk_size; } uVar8 = ((dVar3 - 1) + uVar8 & ~(dVar7 - 1)) + *puVar2; } iVar4 = _virt_commit((LPVOID)(*puVar2 + (int)puVar2),uVar8 - *puVar2); if (iVar4 != 0) { __allocated = __allocated + (uVar8 - *puVar2); _heapresize(puVar2,uVar8); return 0; } iVar4 = _virt_commit((LPVOID)(*puVar2 + (int)puVar2),0x1000); if (iVar4 != 0) { __allocated = __allocated + 0x1000; _heapresize(puVar2,*puVar2 + 0x1000); return 0; } return 0xffffffff; } } dVar3 = uVar8; if (uVar8 < _virt_heap_size) { dVar3 = _virt_heap_size; } iVar4 = _virt_reserve(dVar3,&local_8,&local_c); if (iVar4 == 0) { uVar5 = 0xffffffff; } else { dVar3 = _virt_chunk_size2; if (__allocated + _virt_chunk_size < avail) { dVar3 = _virt_chunk_size; } dVar7 = _virt_chunk_size2; if (__allocated + _virt_chunk_size < avail) { dVar7 = _virt_chunk_size; } uVar8 = uVar8 + dVar3 + 0xfff & ~(dVar7 - 1); for (puVar2 = (uint *)_firstHeap; puVar2 != (uint *)0x0; puVar2 = (uint *)puVar2[0x23]) { if (((uint *)(puVar2[1] + (int)puVar2) == local_8) && ((int)puVar2[2] < 0x20)) { iVar4 = puVar2[1] - *puVar2; if (iVar4 != 0) { iVar6 = _virt_commit((LPVOID)(*puVar2 + (int)puVar2),iVar4); if (iVar6 == 0) { return 0xffffffff; } __allocated = __allocated + iVar4; _heapresize(puVar2,puVar2[1]); } iVar6 = _virt_commit(local_8,uVar8 - iVar4); if (iVar6 != 0) { __allocated = __allocated + (uVar8 - iVar4); uVar1 = puVar2[2]; puVar2[2] = puVar2[2] + 1; puVar2[uVar1 + 3] = (uint)local_8; puVar2[1] = puVar2[1] + local_c; _heapresize(puVar2,(uVar8 + *puVar2) - iVar4); return 0; } return 0xffffffff; } } iVar4 = _virt_commit(local_8,uVar8); if (iVar4 == 0) { _virt_release(local_8); uVar5 = 0xffffffff; } else { __allocated = __allocated + uVar8; _vheapadd(local_8,uVar8,local_c); uVar5 = 0; } } return uVar5; } undefined4 __cdecl _release_heap_at(uint *param_1) { uint uVar1; uint *puVar2; dword dVar3; SIZE_T SVar4; uint uVar5; dVar3 = _virt_chunk_free2; if (__allocated < avail) { dVar3 = _virt_chunk_free; } if (dVar3 <= *param_1 - 0xc) { for (puVar2 = (uint *)_firstHeap; puVar2 != (uint *)0x0; puVar2 = (uint *)puVar2[0x23]) { if ((int)param_1 + (*param_1 & 0xfffffffc) + 4 == (int)puVar2 + (*puVar2 - 4)) { uVar5 = *puVar2 - (*param_1 - 0xc & ~(dVar3 - 1)); _heapresize(puVar2,uVar5); while (uVar5 + (int)puVar2 <= puVar2[puVar2[2] + 2]) { puVar2[2] = puVar2[2] - 1; SVar4 = *puVar2 - (puVar2[puVar2[2] + 3] - (int)puVar2); _virt_decommit((LPVOID)puVar2[puVar2[2] + 3],SVar4); __allocated = __allocated - SVar4; _virt_release((LPVOID)puVar2[puVar2[2] + 3]); uVar1 = puVar2[puVar2[2] + 3]; puVar2[1] = uVar1 - (int)puVar2; *puVar2 = uVar1 - (int)puVar2; } _virt_decommit((LPVOID)(puVar2[puVar2[2] + 2] + uVar5),*puVar2 - uVar5); __allocated = __allocated - (*puVar2 - uVar5); *puVar2 = uVar5; return 1; } } } return 0; } void __cdecl free(int param_1) { int iVar1; uint *puVar2; dword dVar3; uint uVar4; uint *puVar5; undefined *puVar6; if (param_1 != 0) { puVar2 = (uint *)(param_1 + -4); uVar4 = *puVar2; if ((uVar4 & 2) == 0) { *puVar2 = *puVar2 | 1; } else { puVar2 = (uint *)((int)puVar2 - *(int *)(param_1 + -8)); *puVar2 = *puVar2 + (uVar4 & 0xfffffffc) + 4; if (puVar2 == (uint *)PTR_DAT_0044c9cc) { PTR_DAT_0044c9cc = *(undefined **)(PTR_DAT_0044c9cc + 4); } uVar4 = puVar2[1]; *(uint *)(uVar4 + 8) = puVar2[2]; *(uint *)(puVar2[2] + 4) = uVar4; } uVar4 = *puVar2 & 0xfffffffc; puVar5 = (uint *)((int)puVar2 + uVar4 + 4); if ((*puVar5 & 1) != 0) { *puVar2 = *puVar2 + (*puVar5 & 0xfffffffc) + 4; if (puVar5 == (uint *)PTR_DAT_0044c9cc) { PTR_DAT_0044c9cc = *(undefined **)((int)puVar2 + uVar4 + 8); } iVar1 = *(int *)((int)puVar2 + uVar4 + 8); *(undefined4 *)(iVar1 + 8) = *(undefined4 *)((int)puVar2 + uVar4 + 0xc); *(int *)(*(int *)((int)puVar2 + uVar4 + 0xc) + 4) = iVar1; } puVar5 = (uint *)((int)puVar2 + (*puVar2 & 0xfffffffc) + 4); *puVar5 = *puVar5 | 2; uVar4 = *puVar2 & 0xfffffffc; if (uVar4 < _smalloc_threshold) { puVar6 = _linktable + uVar4 * 2 + -0xc; } else { puVar6 = *(undefined **)(PTR_DAT_0044c9cc + 4); } puVar2[1] = *(uint *)(puVar6 + 4); puVar2[2] = (uint)puVar6; *(uint **)(puVar2[1] + 8) = puVar2; *(uint **)(puVar6 + 4) = puVar2; *(uint *)((int)puVar2 + uVar4) = uVar4 + 4; if (*(int *)((int)puVar2 + (*puVar2 & 0xfffffffc) + 4) == 2) { dVar3 = _virt_chunk_free2; if (__allocated < avail) { dVar3 = _virt_chunk_free; } if (dVar3 < *puVar2) { _release_heap_at(puVar2); } } } return; } // WARNING: Restarted to delay deadcode elimination for space: ram uint * __cdecl malloc(uint param_1) { uint *puVar1; undefined *puVar2; undefined *puVar3; uint *puVar4; int iVar5; int *piVar6; uint uVar7; uint uVar8; uint uVar9; if (param_1 == 0) { puVar1 = (uint *)0x0; } else { if (param_1 < 0xc) { uVar7 = 0xc; } else { uVar7 = param_1 + 3 & 0xfffffffc; } if (_linktable == (undefined *)0x0) { _get_more_heap(1); } puVar2 = PTR_DAT_0044c9cc; puVar4 = (uint *)PTR_DAT_0044c9cc; if (uVar7 < _smalloc_threshold) { iVar5 = uVar7 * 2; puVar1 = *(uint **)(_linktable + iVar5 + -8); if ((uint *)(_linktable + iVar5 + -0xc) != puVar1) { *puVar1 = *puVar1 & 0xfffffffe; puVar4 = (uint *)((int)puVar1 + (*puVar1 & 0xfffffffc) + 4); *puVar4 = *puVar4 & 0xfffffffd; uVar7 = puVar1[1]; *(uint *)(uVar7 + 8) = puVar1[2]; *(uint *)(puVar1[2] + 4) = uVar7; return puVar1 + 1; } if ((undefined4 *)PTR_DAT_0044c9cc == &DAT_0044c9c0) { puVar4 = (uint *)PTR_DAT_0044c9c4; } if ((undefined4 *)PTR_DAT_0044c9c4 == &DAT_0044c9c0) { for (puVar2 = _linktable + iVar5 + -4; (((puVar3 = puVar2, puVar2 == *(undefined **)(puVar2 + 4) && (puVar3 = puVar2 + 8, puVar3 == *(undefined **)(puVar2 + 0xc))) && ((puVar3 = puVar2 + 0x10, puVar3 == *(undefined **)(puVar2 + 0x14) && ((((puVar3 = puVar2 + 0x18, puVar3 == *(undefined **)(puVar2 + 0x1c) && (puVar3 = puVar2 + 0x20, puVar3 == *(undefined **)(puVar2 + 0x24))) && (puVar3 = puVar2 + 0x28, puVar3 == *(undefined **)(puVar2 + 0x2c))) && ((puVar3 = puVar2 + 0x30, puVar3 == *(undefined **)(puVar2 + 0x34) && (puVar3 = puVar2 + 0x38, puVar3 == *(undefined **)(puVar2 + 0x3c))))))))) && (((puVar3 = puVar2 + 0x40, puVar3 == *(undefined **)(puVar2 + 0x44) && ((puVar3 = puVar2 + 0x48, puVar3 == *(undefined **)(puVar2 + 0x4c) && (puVar3 = puVar2 + 0x50, puVar3 == *(undefined **)(puVar2 + 0x54))))) && (((puVar3 = puVar2 + 0x58, puVar3 == *(undefined **)(puVar2 + 0x5c) && (((puVar3 = puVar2 + 0x60, puVar3 == *(undefined **)(puVar2 + 100) && (puVar3 = puVar2 + 0x68, puVar3 == *(undefined **)(puVar2 + 0x6c))) && (puVar3 = puVar2 + 0x70, puVar3 == *(undefined **)(puVar2 + 0x74))))) && (puVar3 = puVar2 + 0x78, puVar3 == *(undefined **)(puVar2 + 0x7c))))))); puVar2 = puVar2 + 0x80) { } puVar4 = (uint *)PTR_DAT_0044c9cc; if (*(uint **)(puVar3 + 4) != (uint *)0x0) { puVar4 = *(uint **)(puVar3 + 4); } } } else { uVar9 = *(uint *)PTR_DAT_0044c9cc; if (uVar9 < uVar7) { *(undefined4 *)PTR_DAT_0044c9cc = 0xfffffffd; puVar4 = *(uint **)(puVar2 + 4); while ((((((*puVar4 < uVar7 && (puVar4 = (uint *)puVar4[1], *puVar4 < uVar7)) && (puVar4 = (uint *)puVar4[1], *puVar4 < uVar7)) && (((puVar4 = (uint *)puVar4[1], *puVar4 < uVar7 && (puVar4 = (uint *)puVar4[1], *puVar4 < uVar7)) && ((puVar4 = (uint *)puVar4[1], *puVar4 < uVar7 && ((puVar4 = (uint *)puVar4[1], *puVar4 < uVar7 && (puVar4 = (uint *)puVar4[1], *puVar4 < uVar7)))))))) && ((puVar4 = (uint *)puVar4[1], *puVar4 < uVar7 && (((puVar4 = (uint *)puVar4[1], *puVar4 < uVar7 && (puVar4 = (uint *)puVar4[1], *puVar4 < uVar7)) && (puVar4 = (uint *)puVar4[1], *puVar4 < uVar7)))))) && (((puVar4 = (uint *)puVar4[1], *puVar4 < uVar7 && (puVar4 = (uint *)puVar4[1], *puVar4 < uVar7)) && ((puVar4 = (uint *)puVar4[1], *puVar4 < uVar7 && (puVar4 = (uint *)puVar4[1], *puVar4 < uVar7))))))) { puVar4 = (uint *)puVar4[1]; } *(uint *)PTR_DAT_0044c9cc = uVar9; if (puVar4 == (uint *)PTR_DAT_0044c9cc) { puVar4 = &DAT_0044c9c0; } } } if (puVar4 == &DAT_0044c9c0) { iVar5 = _get_more_heap(param_1 + 0x40); if (iVar5 == 0) { puVar1 = malloc(param_1); } else { puVar1 = (uint *)0x0; } } else { uVar9 = *puVar4; uVar8 = (uVar9 & 0xfffffffc) - uVar7; if (uVar8 < 0x10) { *puVar4 = *puVar4 & 0xfffffffe; puVar1 = (uint *)((int)puVar4 + (*puVar4 & 0xfffffffc) + 4); *puVar1 = *puVar1 & 0xfffffffd; if (_smalloc_threshold <= (uVar9 & 0xfffffffc)) { PTR_DAT_0044c9cc = (undefined *)puVar4[1]; } uVar7 = puVar4[1]; *(uint *)(uVar7 + 8) = puVar4[2]; puVar1 = puVar4 + 1; *(uint *)(puVar4[2] + 4) = uVar7; } else { uVar9 = uVar8 - 4; *puVar4 = uVar7; piVar6 = (int *)((int)puVar4 + uVar7 + 4); *piVar6 = uVar8 - 3; *(uint *)((int)piVar6 + uVar9) = uVar8; puVar2 = _linktable; if (uVar9 < _smalloc_threshold) { puVar3 = _linktable + uVar9 * 2 + -0xc; *(undefined4 *)((int)puVar4 + uVar7 + 8) = *(undefined4 *)(_linktable + uVar9 * 2 + -8); *(undefined **)((int)puVar4 + uVar7 + 0xc) = puVar3; *(int **)(*(int *)((int)puVar4 + uVar7 + 8) + 8) = piVar6; *(int **)(puVar2 + uVar9 * 2 + -8) = piVar6; if (puVar4 == (uint *)PTR_DAT_0044c9cc) { PTR_DAT_0044c9cc = (undefined *)puVar4[1]; } uVar7 = puVar4[1]; *(uint *)(uVar7 + 8) = puVar4[2]; *(uint *)(puVar4[2] + 4) = uVar7; } else { uVar9 = puVar4[2]; *(int **)(uVar9 + 4) = piVar6; *(uint *)((int)puVar4 + uVar7 + 0xc) = uVar9; uVar9 = puVar4[1]; *(int **)(uVar9 + 8) = piVar6; *(uint *)((int)puVar4 + uVar7 + 8) = uVar9; PTR_DAT_0044c9cc = (undefined *)piVar6; } puVar1 = puVar4 + 1; } } } return puVar1; } SIZE_T __stdcall _phys_avail(void) { _MEMORYSTATUS local_20; local_20.dwLength = 0x20; GlobalMemoryStatus(&local_20); return local_20.dwAvailPhys; } void __stdcall FUN_004460b0(void) { int *piVar1; LPVOID pvVar2; int iVar3; int iVar4; int *piVar5; int *piVar6; int *piVar7; int iVar8; piVar6 = (int *)_firstHeap; piVar1 = DAT_0044c9d8; while (piVar5 = piVar6, piVar1 != (int *)0x0) { piVar1 = (int *)piVar5[0x23]; piVar5[2] = piVar5[2] + -1; iVar8 = piVar5[2]; piVar7 = piVar5 + iVar8 + 3; for (; piVar6 = piVar1, -1 < iVar8; iVar8 = iVar8 + -1) { pvVar2 = (LPVOID)*piVar7; iVar3 = *piVar5; iVar4 = *piVar7; piVar5[1] = iVar4 - (int)piVar5; *piVar5 = iVar4 - (int)piVar5; _virt_decommit(pvVar2,iVar3 - ((int)pvVar2 - (int)piVar5)); _virt_release(pvVar2); piVar7 = piVar7 + -1; } } return; } void __stdcall FUN_0044611c(void) { DAT_0044c9d8 = 1; return; } void __cdecl __bdele_qpv(int param_1) { free(param_1); return; } void __cdecl FUN_00446138(int param_1) { __bdele_qpv(param_1); return; } undefined4 __cdecl _virt_reserve(int param_1,undefined4 *param_2,uint *param_3) { LPVOID pvVar1; uint dwSize; if (heap_size == 0) { if ((_ostype == 1) || (_ostype == 2)) { heap_size = 0x100000; } else { heap_size = 0x400000; } } dwSize = (param_1 + heap_size) - 1U & ~(heap_size - 1U); pvVar1 = VirtualAlloc((LPVOID)0x0,dwSize,MEM_RESERVE,1); *param_2 = pvVar1; if (pvVar1 == (LPVOID)0x0) { return 0; } *param_3 = dwSize; return 1; } undefined4 __cdecl _virt_commit(LPVOID param_1,int param_2) { LPVOID pvVar1; LPVOID lpAddress; lpAddress = param_1; while( true ) { if (param_2 == 0) { return 1; } pvVar1 = VirtualAlloc(lpAddress,0x1000,0x1000,PAGE_READWRITE); if (pvVar1 == (LPVOID)0x0) break; lpAddress = (LPVOID)((int)lpAddress + 0x1000); param_2 = param_2 + -0x1000; } _virt_decommit(param_1,(int)lpAddress - (int)param_1); return 0; } undefined4 __cdecl _virt_decommit(LPVOID param_1,SIZE_T param_2) { BOOL BVar1; BVar1 = VirtualFree(param_1,param_2,MEM_DECOMMIT); if (BVar1 != 1) { return 0; } return 1; } undefined4 __cdecl _virt_release(LPVOID param_1) { BOOL BVar1; BVar1 = VirtualFree(param_1,0,MEM_RELEASE); if (BVar1 != 1) { return 0; } return 1; } undefined4 __stdcall threadHasWnd(undefined4 param_1,undefined4 *param_2) { *param_2 = 1; return 0; } undefined4 __stdcall mbModalFlag(void) { DWORD DVar1; undefined4 uVar2; code *lpfn; int *lParam; int local_4; lParam = &local_4; local_4 = 0; DVar1 = GetVersion(); if ((DVar1 & 0x80000000) == 0) { return 0x2000; } lpfn = threadHasWnd; DVar1 = GetCurrentThreadId(); EnumThreadWindows(DVar1,lpfn,(LPARAM)lParam); uVar2 = 0x2000; if (local_4 == 0) { uVar2 = 0x1000; } return uVar2; } void __cdecl _ErrorMessage(char *param_1) { char *pcVar1; uint uVar2; HANDLE hFile; DWORD nNumberOfBytesToWrite; LPCSTR lpCaption; DWORD *lpNumberOfBytesWritten; LPOVERLAPPED lpOverlapped; CHAR local_58 [80]; DWORD local_8; if (_messagefile == (LPCSTR)0x0) { if (_isWindows != 0) { GetModuleFileNameA((HMODULE)0x0,local_58,0x50); pcVar1 = strrchr(local_58,'\\'); if ((pcVar1 == (char *)0x0) && (pcVar1 = strrchr(local_58,':'), pcVar1 == (char *)0x0)) { lpCaption = local_58; } else { lpCaption = pcVar1 + 1; } uVar2 = mbModalFlag(); MessageBoxA((HWND)0x0,param_1,lpCaption,uVar2 | 0x10010); return; } hFile = GetStdHandle(0xfffffff4); WriteFile(hFile,&DAT_0044c9e8,2,&local_8,(LPOVERLAPPED)0x0); lpOverlapped = (LPOVERLAPPED)0x0; lpNumberOfBytesWritten = &local_8; nNumberOfBytesToWrite = strlen(param_1); WriteFile(hFile,param_1,nNumberOfBytesToWrite,lpNumberOfBytesWritten,lpOverlapped); WriteFile(hFile,&DAT_0044c9eb,2,&local_8,(LPOVERLAPPED)0x0); return; } if (_messagefile == (LPCSTR)0xffffffff) { return; } if (_messagefile == (LPCSTR)0x0) { return; } if (*_messagefile == '\0') { return; } _ErrorMessageHelper(_messagefile,param_1); return; } void __cdecl __ErrorMessage(char *param_1) { _ErrorMessage(param_1); return; } void __cdecl _ErrorExit(char *param_1) { _ErrorMessage(param_1); _exit(1); return; } undefined * __stdcall DateTime(void) { undefined1 local_c [4]; uint local_8 [2]; getdate(local_8); gettime(local_c); sprintf(timestamp_buf); return timestamp_buf; } void __cdecl _ErrorMessageHelper(LPCSTR param_1,char *param_2) { uint uVar1; char *pcVar2; char *pcVar3; uVar1 = ___topen(param_1,0x4141,0600); if (uVar1 != 0xffffffff) { pcVar2 = DateTime(); pcVar3 = (char *)strlen(pcVar2); __write(uVar1,pcVar2,pcVar3); pcVar2 = (char *)strlen(param_2); __write(uVar1,param_2,pcVar2); close(uVar1); } return; } void __stdcall FUN_00446478(void) { HMODULE hModule; FARPROC pFVar1; int iVar2; DWORD DVar3; hModule = GetModuleHandleA(s_kernel32_dll_0044ca14); pFVar1 = GetProcAddress(hModule,s_GetProcAddress_0044ca21); iVar2 = (*pFVar1)(); if (iVar2 != 0) { _ostype = 2; return; } DVar3 = GetVersion(); if ((DVar3 & 0x80000000) != 0) { _ostype = 1; return; } _ostype = 0; return; } void __stdcall _abort(void) { _ErrorMessage(s_Abnormal_program_termination_0044ca3c); _exit(3); return; } void __stdcall abort(void) { raise(0x16); _abort(); return; } undefined4 __cdecl atexit(undefined4 param_1) { if (teardown_func_idx == 0x20) { return 1; } teardown_func_array[teardown_func_idx] = param_1; teardown_func_idx = teardown_func_idx + 1; return 0; } void __stdcall nullsub(void) { return; } void __cdecl __exit(int param_1,int param_2,UINT param_3) { if (param_1 == 0) { while (teardown_func_idx != 0) { teardown_func_idx = teardown_func_idx + -1; (*(code *)teardown_func_array[teardown_func_idx])(); } _cleanup(); (*(code *)_exitbuf)(); } if (param_2 == 0) { if (param_1 == 0) { (*(code *)_exitfopen)(); (*(code *)_exitopen)(); } _terminate(param_3); } return; } void __cdecl exit(UINT param_1) { __exit(0,0,param_1); return; } void __cdecl _exit(UINT param_1) { __exit(1,0,param_1); return; } char * __cdecl FUN_004465cc(char *param_1) { int iVar1; int iVar2; int *piVar3; char *pcVar4; iVar1 = strlen(param_1); for (piVar3 = (int *)_tenviron; *piVar3 != 0; piVar3 = piVar3 + 1) { iVar2 = FUN_00440dc0((char *)*piVar3,param_1,iVar1); if ((iVar2 == 0) && (*(char *)(*piVar3 + iVar1) == '=')) break; } if (*piVar3 == 0) { pcVar4 = (char *)0x0; } else { pcVar4 = (char *)(iVar1 + *piVar3 + 1); } return pcVar4; } void __stdcall _initwild(void) { return; } void __stdcall FUN_00446674(void) { if (_tenvcopy != (undefined *)0x0) { free((int)_tenvcopy); } if (_tenviron != (undefined *)0x0) { free((int)_tenviron); } _tenvcopy = (undefined *)0x0; _tenviron = (undefined *)0x0; return; } undefined4 __stdcall _texpandblock(void) { int iVar1; uint *puVar2; undefined4 uVar3; char *pcVar4; undefined4 *puVar5; uint *puVar6; int iVar7; uint *puVar8; int iVar9; if (_tenviron == (undefined *)0x0) { iVar7 = 0; iVar9 = 0; pcVar4 = _osenv; while (iVar1 = strlen(pcVar4), iVar1 != 0) { iVar9 = iVar9 + 1; iVar7 = iVar7 + iVar1 + 1; pcVar4 = pcVar4 + iVar1 + 1; } _tenvcopy = (undefined *)malloc(iVar7 + 1U); if ((uint *)_tenvcopy == (uint *)0x0) { return 0; } memcpy((undefined4 *)_tenvcopy,(undefined4 *)_osenv,iVar7 + 1U); } else { iVar9 = 0; for (puVar5 = (undefined4 *)_tenviron; (char *)*puVar5 != (char *)0x0; puVar5 = puVar5 + 1) { iVar7 = strlen((char *)*puVar5); if (iVar7 == 0) { iVar9 = iVar9 + -1; } iVar9 = iVar9 + 1; } } _tenvsize = iVar9 + 4; puVar2 = calloc(iVar9 + 5,4); if (puVar2 == (uint *)0x0) { uVar3 = 0; } else { puVar6 = (uint *)_tenviron; pcVar4 = _tenvcopy; puVar8 = puVar2; if (_tenviron == (undefined *)0x0) { while (iVar9 = strlen(pcVar4), iVar9 != 0) { *puVar8 = (uint)pcVar4; pcVar4 = pcVar4 + iVar9 + 1; puVar8 = puVar8 + 1; } } else { for (; (char *)*puVar6 != (char *)0x0; puVar6 = puVar6 + 1) { iVar9 = strlen((char *)*puVar6); if (iVar9 != 0) { *puVar8 = *puVar6; } puVar8 = puVar8 + 1; } } if (_tenviron != (undefined *)0x0) { free((int)_tenviron); } uVar3 = 1; _tenviron = (undefined *)puVar2; } return uVar3; } void __stdcall _setenvp(void) { int iVar1; iVar1 = _texpandblock(); if (iVar1 == 0) { _ErrorExit(s_Could_not_allocate_memory_for_en_0044ca70); } _C0environ = (char **)_tenviron; return; } int __cdecl GetIndex(int param_1) { int iVar1; int *piVar2; iVar1 = 0; piVar2 = IxGen; do { if (param_1 == *piVar2) { return iVar1; } iVar1 = iVar1 + 1; piVar2 = piVar2 + 1; } while (iVar1 < 10); return -1; } undefined4 __cdecl ExcHandler(int *param_1,undefined4 param_2,int param_3) { code *pcVar1; undefined4 uVar2; int iVar3; uint uVar4; uVar4 = 0; iVar3 = *param_1; if (iVar3 < -0x3fffff6e) { if (iVar3 == -0x3fffff6f) { iVar3 = 2; uVar4 = 8; } else if (iVar3 == -0x3ffffffb) { iVar3 = 3; } else if (iVar3 == -0x3fffffe3) { iVar3 = 1; } else if (iVar3 == -0x3fffff72) { iVar3 = 2; uVar4 = 4; } else { if (iVar3 != -0x3fffff70) { return 1; } iVar3 = 2; uVar4 = 1; } } else if (iVar3 == -0x3fffff6e) { iVar3 = 2; uVar4 = 0x49; } else if (iVar3 == -0x3fffff6d) { iVar3 = 2; uVar4 = 0x10; } else if (iVar3 == -0x3fffff6c) { iVar3 = 2; } else { if (iVar3 != -0x3fffff6a) { return 1; } iVar3 = 1; } pcVar1 = (code *)Dispatch[iVar3]; if (pcVar1 == (code *)0x1) { uVar2 = 0; } else if (pcVar1 == (code *)0x0) { uVar2 = 1; } else { Dispatch[iVar3] = (undefined *)0x0; if (((iVar3 == 1) || (iVar3 == 3)) || (iVar3 == 2)) { _clear87(); _control87(); (*pcVar1)(); *(uint *)(param_3 + 0x20) = *(uint *)(param_3 + 0x20) & ~uVar4; } else { (*pcVar1)(); } uVar2 = 0; } return uVar2; } undefined4 __stdcall controlc(int param_1) { int iVar1; iVar1 = 2; if (param_1 != 0) { iVar1 = 0x15; } raise(iVar1); return 1; } undefined4 __cdecl signal(int param_1,undefined *param_2) { undefined *puVar1; int iVar2; if (HandlerPtrSet == 0) { _HandlerPtr = ExcHandler; SetConsoleCtrlHandler(controlc,1); HandlerPtrSet = 1; } iVar2 = GetIndex(param_1); if (iVar2 == -1) { errno = 0x13; return 0xffffffff; } puVar1 = Dispatch[iVar2]; Dispatch[iVar2] = param_2; return puVar1; } undefined4 __cdecl raise(int param_1) { code *pcVar1; int iVar2; undefined4 uVar3; int iVar4; iVar4 = param_1; iVar2 = GetIndex(param_1); if (iVar2 == -1) { uVar3 = 1; } else { pcVar1 = (code *)Dispatch[iVar2]; if (pcVar1 != (code *)0x1) { if (pcVar1 == (code *)0x0) { if ((1 < param_1 - 0x10U) && (param_1 != 0x14)) { if (param_1 == 0x16) { _abort(); } else { _exit(3); } } } else { Dispatch[iVar2] = (undefined *)0x0; if (ExplicitVal[iVar2] == 0) { (*pcVar1)(pcVar1,0,iVar4,param_1); } else { (*pcVar1)(); } } } uVar3 = 0; } return uVar3; } undefined4 __stdcall _create_shmem(void) { return 0; } undefined4 __stdcall FUN_00446a7c(void) { return 0; } undefined4 __cdecl _init_exit_proc(int *param_1,uint param_2) { undefined4 *puVar1; char *pcVar2; undefined4 uVar3; uint uVar4; char *pcVar5; int *local_10; int local_c; char *local_8; uVar4 = 0; if (param_2 == 0) { uVar4 = 0xffff; } local_8 = (char *)0x0; local_10 = param_1; for (local_c = 0; local_10 = local_10 + 1, local_c < *param_1; local_c = local_c + 1) { puVar1 = (undefined4 *)*local_10; if (param_2 == 0) { pcVar2 = (char *)*puVar1; pcVar5 = (char *)puVar1[1]; } else { pcVar2 = (char *)puVar1[2]; pcVar5 = (char *)puVar1[3]; } for (; (pcVar2 < pcVar5 && (*(int *)(pcVar2 + 2) != 0)); pcVar2 = pcVar2 + 6) { if ((*pcVar2 == '\0') && (param_2 == uVar4 <= (byte)pcVar2[1])) { uVar4 = (uint)(byte)pcVar2[1]; local_8 = pcVar2; } } } if (local_8 == (char *)0x0) { uVar3 = 0; } else { *local_8 = '\x01'; uVar3 = *(undefined4 *)(local_8 + 2); } return uVar3; } void __cdecl _startup(int param_1) { char cVar1; int *piVar2; code *pcVar3; UINT UVar4; char cVar5; int *piVar6; char *pcVar7; int local_10; undefined1 local_c [8]; _isWindows = *(uint *)(param_1 + 0x10) & 1; _fpreset(); _initmatherr(*(undefined **)(param_1 + 0x1c),*(undefined **)(param_1 + 0x20)); _initfmode(*(undefined **)(param_1 + 0x28)); _exe_table_ntables = 1; _exe_table_table[0] = (MODULE_DATA *)param_1; _ExcRegPtr = local_c; _InitDefaultHander(); _osenv = GetEnvironmentStrings(); _oscmd = GetCommandLineA(); _initwild(); piVar2 = (int *)_create_shmem(); if (piVar2 != (int *)0x0) { piVar2[*piVar2 + 1] = -1; while (pcVar3 = (code *)_init_exit_proc(piVar2,0), pcVar3 != (code *)0x0) { (*pcVar3)(); } piVar6 = piVar2; for (local_10 = 0; piVar6 = piVar6 + 1, local_10 < *piVar2; local_10 = local_10 + 1) { (**(code **)(*piVar6 + 0x18))(); } } while (pcVar3 = (code *)_init_exit_proc(&_exe_table_ntables,0), pcVar3 != (code *)0x0) { (*pcVar3)(); } pcVar7 = _oscmd; if ((*(byte *)(param_1 + 0x10) & 1) == 0) { UVar4 = (**(code **)(param_1 + 0x18))(); exit(UVar4); } else { for (; (*pcVar7 == ' ' || (*pcVar7 == '\t')); pcVar7 = pcVar7 + 1) { } if (*pcVar7 == '\"') { cVar5 = '\"'; pcVar7 = pcVar7 + 1; } else { cVar5 = ' '; } for (; ((cVar1 = *pcVar7, cVar1 != '\0' && (cVar5 != cVar1)) && (cVar1 != '\t')); pcVar7 = pcVar7 + 1) { } if (*pcVar7 == '\"') { pcVar7 = pcVar7 + 1; } for (; ((cVar5 = *pcVar7, cVar5 != '\0' && (cVar5 == ' ')) || (cVar5 == '\t')); pcVar7 = pcVar7 + 1) { } GetModuleHandleA((LPCSTR)0x0); UVar4 = (**(code **)(param_1 + 0x18))(); exit(UVar4); } return; } void __stdcall _cleanup(void) { code *pcVar1; int *piVar2; int *piVar3; int iVar4; while (pcVar1 = (code *)_init_exit_proc(&_exe_table_ntables,1), pcVar1 != (code *)0x0) { (*pcVar1)(); } while (pcVar1 = (code *)_init_exit_proc((int *)&_dll_table,1), pcVar1 != (code *)0x0) { (*pcVar1)(); } piVar2 = (int *)FUN_00446a7c(); if (piVar2 != (int *)0x0) { while (pcVar1 = (code *)_init_exit_proc(piVar2,1), pcVar1 != (code *)0x0) { (*pcVar1)(); } piVar3 = piVar2; for (iVar4 = 0; piVar3 = piVar3 + 1, iVar4 < *piVar2; iVar4 = iVar4 + 1) { (**(code **)(*piVar3 + 0x18))(); } } return; } void __stdcall _terminate(UINT param_1) { // WARNING: Subroutine does not return ExitProcess(param_1); } void __stdcall nullsub(void) { return; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address undefined4 * __stdcall FUN_00446d24(void) { char cVar1; undefined *puVar2; char *pcVar3; uint uVar4; DWORD DVar5; int iVar6; undefined4 *puVar7; char *pcVar8; int iVar9; int local_bc; WCHAR local_68; pcVar3 = FUN_004465cc((char *)0x44ccd8); if ((((((pcVar3 == (char *)0x0) || (uVar4 = strlen(pcVar3), uVar4 < 4)) || ((char_info[*pcVar3] & 0xcU) == 0)) || (((char_info[pcVar3[1]] & 0xcU) == 0 || ((char_info[pcVar3[2]] & 0xcU) == 0)))) || ((cVar1 = pcVar3[3], cVar1 != '-' && ((cVar1 != '+' && ((char_info[cVar1] & 2U) == 0)))))) || (((char_info[pcVar3[3]] & 2U) == 0 && ((char_info[pcVar3[4]] & 2U) == 0)))) { DVar5 = GetTimeZoneInformation((LPTIME_ZONE_INFORMATION)&local_bc); DAT_0044ccd4 = (uint)(DVar5 == 2); _DAT_0044ccd0 = (local_bc + local_68) * 0x3c; *PTR_DAT_0044ccc8 = UNK_0044ccdb; puVar2 = PTR_DAT_0044cccc; *PTR_DAT_0044cccc = UNK_0044ccdc; return (undefined4 *)puVar2; } memset((undefined4 *)PTR_DAT_0044cccc,0,4); FUN_00440d70((undefined4 *)PTR_DAT_0044ccc8,pcVar3,3); PTR_DAT_0044ccc8[3] = 0; _DAT_0044ccd0 = FUN_00445400(pcVar3 + 3); iVar9 = 3; pcVar8 = pcVar3 + 3; iVar6 = 0; _DAT_0044ccd0 = _DAT_0044ccd0 * 0xe10; DAT_0044ccd4 = 0; while( true ) { cVar1 = *pcVar8; if (cVar1 == '\0') { DAT_0044ccd4 = 0; return (undefined4 *)CONCAT31((int3)((uint)iVar6 >> 8),cVar1); } iVar6 = (int)cVar1; if ((char_info[iVar6] & 0xcU) != 0) break; iVar9 = iVar9 + 1; pcVar8 = pcVar8 + 1; } puVar7 = (undefined4 *)strlen(pcVar3 + iVar9); if (puVar7 < (undefined4 *)0x3) { return puVar7; } if ((char_info[pcVar8[1]] & 0xcU) == 0) { return puVar7; } if ((*(byte *)(pcVar8[2] + 0x44c815) & 0xc) == 0) { return (undefined4 *)(int)pcVar8[2]; } puVar7 = FUN_00440d70((undefined4 *)PTR_DAT_0044cccc,pcVar3 + iVar9,3); PTR_DAT_0044cccc[3] = 0; DAT_0044ccd4 = 1; return puVar7; } bool __cdecl FUN_00446eb4(uint param_1,uint param_2,uint param_3,uint param_4) { uint *puVar1; int iVar2; uint uVar3; bool bVar4; uint local_8; if (param_3 == 0) { local_8 = param_2; if ((0x3a < param_2) && ((param_4 + 0x46 & 3) == 0)) { local_8 = param_2 - 1; } param_3 = 0; for (puVar1 = &DAT_0044cbb0; *puVar1 <= local_8; puVar1 = puVar1 + 1) { param_3 = param_3 + 1; } } else { param_2 = param_2 + (&DAT_0044cbac)[param_3]; if ((2 < param_3) && ((param_4 + 0x46 & 3) == 0)) { param_2 = param_2 + 1; } } if ((param_3 < 4) || (10 < param_3)) { bVar4 = false; } else if ((param_3 < 5) || (9 < param_3)) { if ((param_4 < 0x11) || (param_3 != 4)) { iVar2 = (&DAT_0044cbb0)[param_3]; } else { iVar2 = iRam0044cbbc + 7; } if ((param_4 + 0x46 & 3) != 0) { iVar2 = iVar2 + -1; } uVar3 = iVar2 - ((param_4 + 1 >> 2) + iVar2 + param_4 * 0x16d + 4) % 7; if (param_3 == 4) { if (uVar3 < param_2) { bVar4 = true; } else if (param_2 < uVar3) { bVar4 = false; } else { bVar4 = 1 < param_1; } } else if (param_2 < uVar3) { bVar4 = true; } else if (uVar3 < param_2) { bVar4 = false; } else { bVar4 = param_1 < 2; } } else { bVar4 = true; } return bVar4; } // WARNING: Globals starting with '_' overlap smaller symbols at the same address int __cdecl FUN_00446fc8(int param_1,int param_2,int param_3,int param_4,int param_5,int param_6) { int iVar1; char *pcVar2; bool bVar3; char *pcVar4; int iVar5; undefined3 extraout_var; uint uVar6; int iVar7; uint uVar8; uint uVar9; int local_8; if ((param_1 < 0x46) || (0x8a < param_1)) { local_8 = -1; } else { iVar1 = param_5 + param_6 / 0x3c; iVar5 = param_4 + iVar1 / 0x3c; uVar8 = param_3 + iVar5 / 0x18; uVar6 = iVar5 % 0x18; uVar9 = param_1 + param_2 / 0xc; pcVar2 = &DAT_0044cba4 + param_2 % 0xc; iVar5 = param_2 % 0xc; while (iVar7 = iVar5, pcVar4 = pcVar2, (int)*pcVar4 <= (int)uVar8) { if (((uVar9 & 3) == 0) && (iVar7 == 1)) { if ((int)uVar8 < 0x1d) break; iVar5 = -0x1d; } else { iVar5 = -(int)*pcVar4; } uVar8 = uVar8 + iVar5; pcVar2 = pcVar4 + 1; iVar5 = iVar7 + 1; if (0xb < iVar7 + 1) { uVar9 = uVar9 + 1; pcVar2 = pcVar4 + -0xb; iVar5 = iVar7 + -0xb; } } iVar5 = uVar9 - 0x44; if (iVar5 < 0) { iVar5 = uVar9 - 0x41; } iVar5 = iVar5 >> 2; if (((uVar9 & 3) == 0) && (iVar7 < 2)) { iVar5 = iVar5 + -1; } local_8 = (iVar5 + (uVar9 - 0x46) * 0x16d + (&DAT_0044cbb0)[iVar7] + uVar8) * 0x15180 + uVar6 * 0xe10 + (iVar1 % 0x3c) * 0x3c + param_6 % 0x3c + _DAT_0044ccd0; if ((DAT_0044ccd4 != 0) && (bVar3 = FUN_00446eb4(uVar6,uVar8,iVar7 + 1,uVar9 - 0x46), CONCAT31(extraout_var,bVar3) != 0) ) { local_8 = local_8 + -0xe10; } if (local_8 < 1) { local_8 = -1; } } return local_8; } void __cdecl getdate(uint *param_1) { _SYSTEMTIME local_14; GetLocalTime(&local_14); *(undefined1 *)(param_1 + 1) = (undefined1)local_14.wDay; *(undefined1 *)((int)param_1 + 5) = (undefined1)local_14.wMonth; *param_1 = (uint)local_14.wYear; return; } void __cdecl gettime(undefined1 *param_1) { _SYSTEMTIME local_14; GetLocalTime(&local_14); param_1[1] = (undefined1)local_14.wHour; *param_1 = (undefined1)local_14.wMinute; param_1[3] = (undefined1)local_14.wSecond; param_1[2] = (char)((ulonglong)local_14.wMilliseconds / 10); return; } void __cdecl time(int *param_1) { int iVar1; _SYSTEMTIME local_14; GetLocalTime(&local_14); iVar1 = FUN_00446fc8(local_14.wYear - 0x76c,local_14.wMonth - 1,local_14.wDay - 1, (uint)local_14.wHour,(uint)local_14.wMinute,(uint)local_14.wSecond); if (param_1 != (int *)0x0) { *param_1 = iVar1; } return; } HGLOBAL __stdcall GlobalAlloc(UINT uFlags,SIZE_T dwBytes) { HGLOBAL pvVar1; // WARNING: Could not recover jumptable at 0x004471ef. Too many branches // WARNING: Treating indirect jump as call pvVar1 = GlobalAlloc(uFlags,dwBytes); return pvVar1; } void __stdcall ExitProcess(UINT uExitCode) { // WARNING: Could not recover jumptable at 0x004471f5. Too many branches // WARNING: Subroutine does not return // WARNING: Treating indirect jump as call ExitProcess(uExitCode); return; } void __stdcall GetLocalTime(LPSYSTEMTIME lpSystemTime) { // WARNING: Could not recover jumptable at 0x004471fb. Too many branches // WARNING: Treating indirect jump as call GetLocalTime(lpSystemTime); return; } HGLOBAL __stdcall LoadResource(HMODULE hModule,HRSRC hResInfo) { HGLOBAL pvVar1; // WARNING: Could not recover jumptable at 0x00447201. Too many branches // WARNING: Treating indirect jump as call pvVar1 = LoadResource(hModule,hResInfo); return pvVar1; } BOOL __stdcall FreeLibrary(HMODULE hLibModule) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447207. Too many branches // WARNING: Treating indirect jump as call BVar1 = FreeLibrary(hLibModule); return BVar1; } BOOL __stdcall GlobalUnlock(HGLOBAL hMem) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044720d. Too many branches // WARNING: Treating indirect jump as call BVar1 = GlobalUnlock(hMem); return BVar1; } DWORD __stdcall GetFileType(HANDLE hFile) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x00447213. Too many branches // WARNING: Treating indirect jump as call DVar1 = GetFileType(hFile); return DVar1; } void __stdcall GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) { // WARNING: Could not recover jumptable at 0x00447219. Too many branches // WARNING: Treating indirect jump as call GlobalMemoryStatus(lpBuffer); return; } HMODULE __stdcall LoadLibraryA(LPCSTR lpLibFileName) { HMODULE pHVar1; // WARNING: Could not recover jumptable at 0x0044721f. Too many branches // WARNING: Treating indirect jump as call pHVar1 = LoadLibraryA(lpLibFileName); return pHVar1; } void __stdcall GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo) { // WARNING: Could not recover jumptable at 0x00447225. Too many branches // WARNING: Treating indirect jump as call GetStartupInfoA(lpStartupInfo); return; } DWORD __stdcall SetFilePointer(HANDLE hFile,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x0044722b. Too many branches // WARNING: Treating indirect jump as call DVar1 = SetFilePointer(hFile,lDistanceToMove,lpDistanceToMoveHigh,dwMoveMethod); return DVar1; } void __stdcall RtlUnwind(PVOID TargetFrame,PVOID TargetIp,PEXCEPTION_RECORD ExceptionRecord,PVOID ReturnValue) { // WARNING: Could not recover jumptable at 0x00447231. Too many branches // WARNING: Treating indirect jump as call RtlUnwind(TargetFrame,TargetIp,ExceptionRecord,ReturnValue); return; } DWORD __stdcall GetModuleFileNameA(HMODULE hModule,LPSTR lpFilename,DWORD nSize) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x00447237. Too many branches // WARNING: Treating indirect jump as call DVar1 = GetModuleFileNameA(hModule,lpFilename,nSize); return DVar1; } HGLOBAL __stdcall GlobalFree(HGLOBAL hMem) { HGLOBAL pvVar1; // WARNING: Could not recover jumptable at 0x0044723d. Too many branches // WARNING: Treating indirect jump as call pvVar1 = GlobalFree(hMem); return pvVar1; } void __stdcall InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection) { // WARNING: Could not recover jumptable at 0x00447243. Too many branches // WARNING: Treating indirect jump as call InitializeCriticalSection(lpCriticalSection); return; } LPVOID __stdcall GlobalLock(HGLOBAL hMem) { LPVOID pvVar1; // WARNING: Could not recover jumptable at 0x00447249. Too many branches // WARNING: Treating indirect jump as call pvVar1 = GlobalLock(hMem); return pvVar1; } UINT __stdcall GetWindowsDirectoryA(LPSTR lpBuffer,UINT uSize) { UINT UVar1; // WARNING: Could not recover jumptable at 0x0044724f. Too many branches // WARNING: Treating indirect jump as call UVar1 = GetWindowsDirectoryA(lpBuffer,uSize); return UVar1; } void __stdcall LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection) { // WARNING: Could not recover jumptable at 0x00447255. Too many branches // WARNING: Treating indirect jump as call LeaveCriticalSection(lpCriticalSection); return; } HFILE __stdcall _lopen(LPCSTR lpPathName,int iReadWrite) { HFILE HVar1; // WARNING: Could not recover jumptable at 0x0044725b. Too many branches // WARNING: Treating indirect jump as call HVar1 = _lopen(lpPathName,iReadWrite); return HVar1; } LPVOID __stdcall VirtualAlloc(LPVOID lpAddress,SIZE_T dwSize,DWORD flAllocationType,DWORD flProtect) { LPVOID pvVar1; // WARNING: Could not recover jumptable at 0x00447261. Too many branches // WARNING: Treating indirect jump as call pvVar1 = VirtualAlloc(lpAddress,dwSize,flAllocationType,flProtect); return pvVar1; } HFILE __stdcall _lclose(HFILE hFile) { HFILE HVar1; // WARNING: Could not recover jumptable at 0x00447267. Too many branches // WARNING: Treating indirect jump as call HVar1 = _lclose(hFile); return HVar1; } BOOL __stdcall VirtualFree(LPVOID lpAddress,SIZE_T dwSize,DWORD dwFreeType) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044726d. Too many branches // WARNING: Treating indirect jump as call BVar1 = VirtualFree(lpAddress,dwSize,dwFreeType); return BVar1; } LONG __stdcall UnhandledExceptionFilter(_EXCEPTION_POINTERS *ExceptionInfo) { LONG LVar1; // WARNING: Could not recover jumptable at 0x00447273. Too many branches // WARNING: Treating indirect jump as call LVar1 = UnhandledExceptionFilter(ExceptionInfo); return LVar1; } HANDLE __stdcall GetStdHandle(DWORD nStdHandle) { HANDLE pvVar1; // WARNING: Could not recover jumptable at 0x00447279. Too many branches // WARNING: Treating indirect jump as call pvVar1 = GetStdHandle(nStdHandle); return pvVar1; } UINT __stdcall SetErrorMode(UINT uMode) { UINT UVar1; // WARNING: Could not recover jumptable at 0x0044727f. Too many branches // WARNING: Treating indirect jump as call UVar1 = SetErrorMode(uMode); return UVar1; } UINT __stdcall GetPrivateProfileIntA(LPCSTR lpAppName,LPCSTR lpKeyName,INT nDefault,LPCSTR lpFileName) { UINT UVar1; // WARNING: Could not recover jumptable at 0x00447285. Too many branches // WARNING: Treating indirect jump as call UVar1 = GetPrivateProfileIntA(lpAppName,lpKeyName,nDefault,lpFileName); return UVar1; } HMODULE __stdcall GetModuleHandleA(LPCSTR lpModuleName) { HMODULE pHVar1; // WARNING: Could not recover jumptable at 0x0044728b. Too many branches // WARNING: Treating indirect jump as call pHVar1 = GetModuleHandleA(lpModuleName); return pHVar1; } LPVOID __stdcall LockResource(HGLOBAL hResData) { LPVOID pvVar1; // WARNING: Could not recover jumptable at 0x00447291. Too many branches // WARNING: Treating indirect jump as call pvVar1 = LockResource(hResData); return pvVar1; } LPSTR __stdcall GetCommandLineA(void) { LPSTR pCVar1; // WARNING: Could not recover jumptable at 0x00447297. Too many branches // WARNING: Treating indirect jump as call pCVar1 = GetCommandLineA(); return pCVar1; } HANDLE __stdcall CreateFileA(LPCSTR lpFileName,DWORD dwDesiredAccess,DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,HANDLE hTemplateFile) { HANDLE pvVar1; // WARNING: Could not recover jumptable at 0x0044729d. Too many branches // WARNING: Treating indirect jump as call pvVar1 = CreateFileA(lpFileName,dwDesiredAccess,dwShareMode,lpSecurityAttributes, dwCreationDisposition,dwFlagsAndAttributes,hTemplateFile); return pvVar1; } void __stdcall EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection) { // WARNING: Could not recover jumptable at 0x004472a3. Too many branches // WARNING: Treating indirect jump as call EnterCriticalSection(lpCriticalSection); return; } HRSRC __stdcall FindResourceA(HMODULE hModule,LPCSTR lpName,LPCSTR lpType) { HRSRC pHVar1; // WARNING: Could not recover jumptable at 0x004472a9. Too many branches // WARNING: Treating indirect jump as call pHVar1 = FindResourceA(hModule,lpName,lpType); return pHVar1; } DWORD __stdcall GetLastError(void) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x004472af. Too many branches // WARNING: Treating indirect jump as call DVar1 = GetLastError(); return DVar1; } DWORD __stdcall GetLogicalDrives(void) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x004472b5. Too many branches // WARNING: Treating indirect jump as call DVar1 = GetLogicalDrives(); return DVar1; } SIZE_T __stdcall GlobalSize(HGLOBAL hMem) { SIZE_T SVar1; // WARNING: Could not recover jumptable at 0x004472bb. Too many branches // WARNING: Treating indirect jump as call SVar1 = GlobalSize(hMem); return SVar1; } DWORD __stdcall GetFullPathNameA(LPCSTR lpFileName,DWORD nBufferLength,LPSTR lpBuffer,LPSTR *lpFilePart) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x004472c1. Too many branches // WARNING: Treating indirect jump as call DVar1 = GetFullPathNameA(lpFileName,nBufferLength,lpBuffer,lpFilePart); return DVar1; } BOOL __stdcall CloseHandle(HANDLE hObject) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004472c7. Too many branches // WARNING: Treating indirect jump as call BVar1 = CloseHandle(hObject); return BVar1; } BOOL __stdcall FreeResource(HGLOBAL hResData) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004472cd. Too many branches // WARNING: Treating indirect jump as call BVar1 = FreeResource(hResData); return BVar1; } DWORD __stdcall GetCurrentDirectoryA(DWORD nBufferLength,LPSTR lpBuffer) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x004472d3. Too many branches // WARNING: Treating indirect jump as call DVar1 = GetCurrentDirectoryA(nBufferLength,lpBuffer); return DVar1; } BOOL __stdcall GetVersionExA(LPOSVERSIONINFOA lpVersionInformation) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004472d9. Too many branches // WARNING: Treating indirect jump as call BVar1 = GetVersionExA(lpVersionInformation); return BVar1; } DWORD __stdcall GetVersion(void) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x004472df. Too many branches // WARNING: Treating indirect jump as call DVar1 = GetVersion(); return DVar1; } UINT __stdcall _lread(HFILE hFile,LPVOID lpBuffer,UINT uBytes) { UINT UVar1; // WARNING: Could not recover jumptable at 0x004472e5. Too many branches // WARNING: Treating indirect jump as call UVar1 = _lread(hFile,lpBuffer,uBytes); return UVar1; } DWORD __stdcall GetCurrentThreadId(void) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x004472eb. Too many branches // WARNING: Treating indirect jump as call DVar1 = GetCurrentThreadId(); return DVar1; } DWORD __stdcall GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x004472f1. Too many branches // WARNING: Treating indirect jump as call DVar1 = GetTimeZoneInformation(lpTimeZoneInformation); return DVar1; } BOOL __stdcall WritePrivateProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpString,LPCSTR lpFileName) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004472f7. Too many branches // WARNING: Treating indirect jump as call BVar1 = WritePrivateProfileStringA(lpAppName,lpKeyName,lpString,lpFileName); return BVar1; } BOOL __stdcall WriteFile(HANDLE hFile,LPCVOID lpBuffer,DWORD nNumberOfBytesToWrite,LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004472fd. Too many branches // WARNING: Treating indirect jump as call BVar1 = WriteFile(hFile,lpBuffer,nNumberOfBytesToWrite,lpNumberOfBytesWritten,lpOverlapped); return BVar1; } UINT __stdcall GetDriveTypeA(LPCSTR lpRootPathName) { UINT UVar1; // WARNING: Could not recover jumptable at 0x00447303. Too many branches // WARNING: Treating indirect jump as call UVar1 = GetDriveTypeA(lpRootPathName); return UVar1; } BOOL __stdcall DeleteFileA(LPCSTR lpFileName) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447309. Too many branches // WARNING: Treating indirect jump as call BVar1 = DeleteFileA(lpFileName); return BVar1; } FARPROC __stdcall GetProcAddress(HMODULE hModule,LPCSTR lpProcName) { FARPROC pFVar1; // WARNING: Could not recover jumptable at 0x0044730f. Too many branches // WARNING: Treating indirect jump as call pFVar1 = GetProcAddress(hModule,lpProcName); return pFVar1; } UINT __stdcall SetHandleCount(UINT uNumber) { UINT UVar1; // WARNING: Could not recover jumptable at 0x00447315. Too many branches // WARNING: Treating indirect jump as call UVar1 = SetHandleCount(uNumber); return UVar1; } LPCH __stdcall GetEnvironmentStrings(void) { LPCH pCVar1; // WARNING: Could not recover jumptable at 0x0044731b. Too many branches // WARNING: Treating indirect jump as call pCVar1 = GetEnvironmentStrings(); return pCVar1; } DWORD __stdcall GetPrivateProfileStringA (LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpDefault,LPSTR lpReturnedString,DWORD nSize, LPCSTR lpFileName) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x00447321. Too many branches // WARNING: Treating indirect jump as call DVar1 = GetPrivateProfileStringA(lpAppName,lpKeyName,lpDefault,lpReturnedString,nSize,lpFileName); return DVar1; } LONG __stdcall _llseek(HFILE hFile,LONG lOffset,int iOrigin) { LONG LVar1; // WARNING: Could not recover jumptable at 0x00447327. Too many branches // WARNING: Treating indirect jump as call LVar1 = _llseek(hFile,lOffset,iOrigin); return LVar1; } BOOL __stdcall SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine,BOOL Add) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044732d. Too many branches // WARNING: Treating indirect jump as call BVar1 = SetConsoleCtrlHandler(HandlerRoutine,Add); return BVar1; } DWORD __stdcall GetFileAttributesA(LPCSTR lpFileName) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x00447333. Too many branches // WARNING: Treating indirect jump as call DVar1 = GetFileAttributesA(lpFileName); return DVar1; } BOOL __stdcall ReadFile(HANDLE hFile,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447339. Too many branches // WARNING: Treating indirect jump as call BVar1 = ReadFile(hFile,lpBuffer,nNumberOfBytesToRead,lpNumberOfBytesRead,lpOverlapped); return BVar1; } void __stdcall RaiseException(DWORD dwExceptionCode,DWORD dwExceptionFlags,DWORD nNumberOfArguments, ULONG_PTR *lpArguments) { // WARNING: Could not recover jumptable at 0x0044733f. Too many branches // WARNING: Treating indirect jump as call RaiseException(dwExceptionCode,dwExceptionFlags,nNumberOfArguments,lpArguments); return; } BOOL __stdcall DeleteDC(HDC hdc) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447345. Too many branches // WARNING: Treating indirect jump as call BVar1 = DeleteDC(hdc); return BVar1; } HPALETTE __stdcall CreatePalette(LOGPALETTE *plpal) { HPALETTE pHVar1; // WARNING: Could not recover jumptable at 0x0044734b. Too many branches // WARNING: Treating indirect jump as call pHVar1 = CreatePalette(plpal); return pHVar1; } HBRUSH __stdcall CreateSolidBrush(COLORREF color) { HBRUSH pHVar1; // WARNING: Could not recover jumptable at 0x00447351. Too many branches // WARNING: Treating indirect jump as call pHVar1 = CreateSolidBrush(color); return pHVar1; } int __stdcall GetDeviceCaps(HDC hdc,int index) { int iVar1; // WARNING: Could not recover jumptable at 0x00447357. Too many branches // WARNING: Treating indirect jump as call iVar1 = GetDeviceCaps(hdc,index); return iVar1; } BOOL __stdcall DeleteObject(HGDIOBJ ho) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044735d. Too many branches // WARNING: Treating indirect jump as call BVar1 = DeleteObject(ho); return BVar1; } HGDIOBJ __stdcall GetStockObject(int i) { HGDIOBJ pvVar1; // WARNING: Could not recover jumptable at 0x00447363. Too many branches // WARNING: Treating indirect jump as call pvVar1 = GetStockObject(i); return pvVar1; } int __stdcall StretchDIBits(HDC hdc,int xDest,int yDest,int DestWidth,int DestHeight,int xSrc,int ySrc, int SrcWidth,int SrcHeight,void *lpBits,BITMAPINFO *lpbmi,UINT iUsage,DWORD rop) { int iVar1; // WARNING: Could not recover jumptable at 0x00447369. Too many branches // WARNING: Treating indirect jump as call iVar1 = StretchDIBits(hdc,xDest,yDest,DestWidth,DestHeight,xSrc,ySrc,SrcWidth,SrcHeight,lpBits, lpbmi,iUsage,rop); return iVar1; } UINT __stdcall SetPaletteEntries(HPALETTE hpal,UINT iStart,UINT cEntries,PALETTEENTRY *pPalEntries) { UINT UVar1; // WARNING: Could not recover jumptable at 0x0044736f. Too many branches // WARNING: Treating indirect jump as call UVar1 = SetPaletteEntries(hpal,iStart,cEntries,pPalEntries); return UVar1; } HPALETTE __stdcall SelectPalette(HDC hdc,HPALETTE hPal,BOOL bForceBkgd) { HPALETTE pHVar1; // WARNING: Could not recover jumptable at 0x00447375. Too many branches // WARNING: Treating indirect jump as call pHVar1 = SelectPalette(hdc,hPal,bForceBkgd); return pHVar1; } HGDIOBJ __stdcall SelectObject(HDC hdc,HGDIOBJ h) { HGDIOBJ pvVar1; // WARNING: Could not recover jumptable at 0x0044737b. Too many branches // WARNING: Treating indirect jump as call pvVar1 = SelectObject(hdc,h); return pvVar1; } UINT __stdcall RealizePalette(HDC hdc) { UINT UVar1; // WARNING: Could not recover jumptable at 0x00447381. Too many branches // WARNING: Treating indirect jump as call UVar1 = RealizePalette(hdc); return UVar1; } UINT __stdcall GetSystemPaletteUse(HDC hdc) { UINT UVar1; // WARNING: Could not recover jumptable at 0x00447387. Too many branches // WARNING: Treating indirect jump as call UVar1 = GetSystemPaletteUse(hdc); return UVar1; } BOOL __stdcall TextOutA(HDC hdc,int x,int y,LPCSTR lpString,int c) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044738d. Too many branches // WARNING: Treating indirect jump as call BVar1 = TextOutA(hdc,x,y,lpString,c); return BVar1; } UINT __stdcall GetSystemPaletteEntries(HDC hdc,UINT iStart,UINT cEntries,LPPALETTEENTRY pPalEntries) { UINT UVar1; // WARNING: Could not recover jumptable at 0x00447393. Too many branches // WARNING: Treating indirect jump as call UVar1 = GetSystemPaletteEntries(hdc,iStart,cEntries,pPalEntries); return UVar1; } HWND __stdcall SetActiveWindow(HWND hWnd) { HWND pHVar1; // WARNING: Could not recover jumptable at 0x00447399. Too many branches // WARNING: Treating indirect jump as call pHVar1 = SetActiveWindow(hWnd); return pHVar1; } BOOL __stdcall ScreenToClient(HWND hWnd,LPPOINT lpPoint) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044739f. Too many branches // WARNING: Treating indirect jump as call BVar1 = ScreenToClient(hWnd,lpPoint); return BVar1; } BOOL __stdcall RemoveMenu(HMENU hMenu,UINT uPosition,UINT uFlags) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004473a5. Too many branches // WARNING: Treating indirect jump as call BVar1 = RemoveMenu(hMenu,uPosition,uFlags); return BVar1; } ATOM __stdcall RegisterClassExA(WNDCLASSEXA *param_1) { ATOM AVar1; // WARNING: Could not recover jumptable at 0x004473ab. Too many branches // WARNING: Treating indirect jump as call AVar1 = RegisterClassExA(param_1); return AVar1; } ATOM __stdcall RegisterClassA(WNDCLASSA *lpWndClass) { ATOM AVar1; // WARNING: Could not recover jumptable at 0x004473b1. Too many branches // WARNING: Treating indirect jump as call AVar1 = RegisterClassA(lpWndClass); return AVar1; } void __stdcall PostQuitMessage(int nExitCode) { // WARNING: Could not recover jumptable at 0x004473b7. Too many branches // WARNING: Treating indirect jump as call PostQuitMessage(nExitCode); return; } BOOL __stdcall PeekMessageA(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax,UINT wRemoveMsg) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004473bd. Too many branches // WARNING: Treating indirect jump as call BVar1 = PeekMessageA(lpMsg,hWnd,wMsgFilterMin,wMsgFilterMax,wRemoveMsg); return BVar1; } int __stdcall MessageBoxA(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType) { int iVar1; // WARNING: Could not recover jumptable at 0x004473c3. Too many branches // WARNING: Treating indirect jump as call iVar1 = MessageBoxA(hWnd,lpText,lpCaption,uType); return iVar1; } int __stdcall LoadStringA(HINSTANCE hInstance,UINT uID,LPSTR lpBuffer,int cchBufferMax) { int iVar1; // WARNING: Could not recover jumptable at 0x004473c9. Too many branches // WARNING: Treating indirect jump as call iVar1 = LoadStringA(hInstance,uID,lpBuffer,cchBufferMax); return iVar1; } HMENU __stdcall LoadMenuA(HINSTANCE hInstance,LPCSTR lpMenuName) { HMENU pHVar1; // WARNING: Could not recover jumptable at 0x004473cf. Too many branches // WARNING: Treating indirect jump as call pHVar1 = LoadMenuA(hInstance,lpMenuName); return pHVar1; } HICON __stdcall LoadIconA(HINSTANCE hInstance,LPCSTR lpIconName) { HICON pHVar1; // WARNING: Could not recover jumptable at 0x004473d5. Too many branches // WARNING: Treating indirect jump as call pHVar1 = LoadIconA(hInstance,lpIconName); return pHVar1; } HCURSOR __stdcall LoadCursorA(HINSTANCE hInstance,LPCSTR lpCursorName) { HCURSOR pHVar1; // WARNING: Could not recover jumptable at 0x004473db. Too many branches // WARNING: Treating indirect jump as call pHVar1 = LoadCursorA(hInstance,lpCursorName); return pHVar1; } BOOL __stdcall IsIconic(HWND hWnd) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004473e1. Too many branches // WARNING: Treating indirect jump as call BVar1 = IsIconic(hWnd); return BVar1; } BOOL __stdcall IntersectRect(LPRECT lprcDst,RECT *lprcSrc1,RECT *lprcSrc2) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004473e7. Too many branches // WARNING: Treating indirect jump as call BVar1 = IntersectRect(lprcDst,lprcSrc1,lprcSrc2); return BVar1; } BOOL __stdcall InsertMenuA(HMENU hMenu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCSTR lpNewItem) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004473ed. Too many branches // WARNING: Treating indirect jump as call BVar1 = InsertMenuA(hMenu,uPosition,uFlags,uIDNewItem,lpNewItem); return BVar1; } BOOL __stdcall GetWindowRect(HWND hWnd,LPRECT lpRect) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004473f3. Too many branches // WARNING: Treating indirect jump as call BVar1 = GetWindowRect(hWnd,lpRect); return BVar1; } HMENU __stdcall GetSystemMenu(HWND hWnd,BOOL bRevert) { HMENU pHVar1; // WARNING: Could not recover jumptable at 0x004473f9. Too many branches // WARNING: Treating indirect jump as call pHVar1 = GetSystemMenu(hWnd,bRevert); return pHVar1; } HMENU __stdcall GetSubMenu(HMENU hMenu,int nPos) { HMENU pHVar1; // WARNING: Could not recover jumptable at 0x004473ff. Too many branches // WARNING: Treating indirect jump as call pHVar1 = GetSubMenu(hMenu,nPos); return pHVar1; } int __stdcall GetMenuStringA(HMENU hMenu,UINT uIDItem,LPSTR lpString,int cchMax,UINT flags) { int iVar1; // WARNING: Could not recover jumptable at 0x00447405. Too many branches // WARNING: Treating indirect jump as call iVar1 = GetMenuStringA(hMenu,uIDItem,lpString,cchMax,flags); return iVar1; } UINT __stdcall GetMenuItemID(HMENU hMenu,int nPos) { UINT UVar1; // WARNING: Could not recover jumptable at 0x0044740b. Too many branches // WARNING: Treating indirect jump as call UVar1 = GetMenuItemID(hMenu,nPos); return UVar1; } int __stdcall GetMenuItemCount(HMENU hMenu) { int iVar1; // WARNING: Could not recover jumptable at 0x00447411. Too many branches // WARNING: Treating indirect jump as call iVar1 = GetMenuItemCount(hMenu); return iVar1; } BOOL __stdcall GetKeyboardState(PBYTE lpKeyState) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447417. Too many branches // WARNING: Treating indirect jump as call BVar1 = GetKeyboardState(lpKeyState); return BVar1; } UINT __stdcall GetDlgItemTextA(HWND hDlg,int nIDDlgItem,LPSTR lpString,int cchMax) { UINT UVar1; // WARNING: Could not recover jumptable at 0x0044741d. Too many branches // WARNING: Treating indirect jump as call UVar1 = GetDlgItemTextA(hDlg,nIDDlgItem,lpString,cchMax); return UVar1; } HWND __stdcall GetDesktopWindow(void) { HWND pHVar1; // WARNING: Could not recover jumptable at 0x00447423. Too many branches // WARNING: Treating indirect jump as call pHVar1 = GetDesktopWindow(); return pHVar1; } HDC __stdcall GetDC(HWND hWnd) { HDC pHVar1; // WARNING: Could not recover jumptable at 0x00447429. Too many branches // WARNING: Treating indirect jump as call pHVar1 = GetDC(hWnd); return pHVar1; } BOOL __stdcall GetCursorPos(LPPOINT lpPoint) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044742f. Too many branches // WARNING: Treating indirect jump as call BVar1 = GetCursorPos(lpPoint); return BVar1; } BOOL __stdcall GetClipCursor(LPRECT lpRect) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447435. Too many branches // WARNING: Treating indirect jump as call BVar1 = GetClipCursor(lpRect); return BVar1; } SHORT __stdcall GetAsyncKeyState(int vKey) { SHORT SVar1; // WARNING: Could not recover jumptable at 0x0044743b. Too many branches // WARNING: Treating indirect jump as call SVar1 = GetAsyncKeyState(vKey); return SVar1; } HWND __stdcall GetActiveWindow(void) { HWND pHVar1; // WARNING: Could not recover jumptable at 0x00447441. Too many branches // WARNING: Treating indirect jump as call pHVar1 = GetActiveWindow(); return pHVar1; } HWND __stdcall FindWindowA(LPCSTR lpClassName,LPCSTR lpWindowName) { HWND pHVar1; // WARNING: Could not recover jumptable at 0x00447447. Too many branches // WARNING: Treating indirect jump as call pHVar1 = FindWindowA(lpClassName,lpWindowName); return pHVar1; } UINT __stdcall GetMenuState(HMENU hMenu,UINT uId,UINT uFlags) { UINT UVar1; // WARNING: Could not recover jumptable at 0x0044744d. Too many branches // WARNING: Treating indirect jump as call UVar1 = GetMenuState(hMenu,uId,uFlags); return UVar1; } int __stdcall FillRect(HDC hDC,RECT *lprc,HBRUSH hbr) { int iVar1; // WARNING: Could not recover jumptable at 0x00447453. Too many branches // WARNING: Treating indirect jump as call iVar1 = FillRect(hDC,lprc,hbr); return iVar1; } BOOL __stdcall EnumThreadWindows(DWORD dwThreadId,WNDENUMPROC lpfn,LPARAM lParam) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447459. Too many branches // WARNING: Treating indirect jump as call BVar1 = EnumThreadWindows(dwThreadId,lpfn,lParam); return BVar1; } BOOL __stdcall EndPaint(HWND hWnd,PAINTSTRUCT *lpPaint) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044745f. Too many branches // WARNING: Treating indirect jump as call BVar1 = EndPaint(hWnd,lpPaint); return BVar1; } int __stdcall GetSystemMetrics(int nIndex) { int iVar1; // WARNING: Could not recover jumptable at 0x00447465. Too many branches // WARNING: Treating indirect jump as call iVar1 = GetSystemMetrics(nIndex); return iVar1; } BOOL __stdcall EndDialog(HWND hDlg,INT_PTR nResult) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044746b. Too many branches // WARNING: Treating indirect jump as call BVar1 = EndDialog(hDlg,nResult); return BVar1; } BOOL __stdcall EnableMenuItem(HMENU hMenu,UINT uIDEnableItem,UINT uEnable) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447471. Too many branches // WARNING: Treating indirect jump as call BVar1 = EnableMenuItem(hMenu,uIDEnableItem,uEnable); return BVar1; } BOOL __stdcall DrawMenuBar(HWND hWnd) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447477. Too many branches // WARNING: Treating indirect jump as call BVar1 = DrawMenuBar(hWnd); return BVar1; } BOOL __stdcall InvalidateRect(HWND hWnd,RECT *lpRect,BOOL bErase) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044747d. Too many branches // WARNING: Treating indirect jump as call BVar1 = InvalidateRect(hWnd,lpRect,bErase); return BVar1; } LRESULT __stdcall DispatchMessageA(MSG *lpMsg) { LRESULT LVar1; // WARNING: Could not recover jumptable at 0x00447483. Too many branches // WARNING: Treating indirect jump as call LVar1 = DispatchMessageA(lpMsg); return LVar1; } INT_PTR __stdcall DialogBoxParamA(HINSTANCE hInstance,LPCSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc, LPARAM dwInitParam) { INT_PTR IVar1; // WARNING: Could not recover jumptable at 0x00447489. Too many branches // WARNING: Treating indirect jump as call IVar1 = DialogBoxParamA(hInstance,lpTemplateName,hWndParent,lpDialogFunc,dwInitParam); return IVar1; } BOOL __stdcall DestroyWindow(HWND hWnd) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044748f. Too many branches // WARNING: Treating indirect jump as call BVar1 = DestroyWindow(hWnd); return BVar1; } BOOL __stdcall DestroyMenu(HMENU hMenu) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447495. Too many branches // WARNING: Treating indirect jump as call BVar1 = DestroyMenu(hMenu); return BVar1; } BOOL __stdcall DestroyCursor(HCURSOR hCursor) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044749b. Too many branches // WARNING: Treating indirect jump as call BVar1 = DestroyCursor(hCursor); return BVar1; } BOOL __stdcall DeleteMenu(HMENU hMenu,UINT uPosition,UINT uFlags) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004474a1. Too many branches // WARNING: Treating indirect jump as call BVar1 = DeleteMenu(hMenu,uPosition,uFlags); return BVar1; } LRESULT __stdcall DefWindowProcA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam) { LRESULT LVar1; // WARNING: Could not recover jumptable at 0x004474a7. Too many branches // WARNING: Treating indirect jump as call LVar1 = DefWindowProcA(hWnd,Msg,wParam,lParam); return LVar1; } BOOL __stdcall PostMessageA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004474ad. Too many branches // WARNING: Treating indirect jump as call BVar1 = PostMessageA(hWnd,Msg,wParam,lParam); return BVar1; } HWND __stdcall CreateWindowExA(DWORD dwExStyle,LPCSTR lpClassName,LPCSTR lpWindowName,DWORD dwStyle,int X,int Y, int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam ) { HWND pHVar1; // WARNING: Could not recover jumptable at 0x004474b3. Too many branches // WARNING: Treating indirect jump as call pHVar1 = CreateWindowExA(dwExStyle,lpClassName,lpWindowName,dwStyle,X,Y,nWidth,nHeight,hWndParent, hMenu,hInstance,lpParam); return pHVar1; } BOOL __stdcall ClipCursor(RECT *lpRect) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004474b9. Too many branches // WARNING: Treating indirect jump as call BVar1 = ClipCursor(lpRect); return BVar1; } DWORD __stdcall CheckMenuItem(HMENU hMenu,UINT uIDCheckItem,UINT uCheck) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x004474bf. Too many branches // WARNING: Treating indirect jump as call DVar1 = CheckMenuItem(hMenu,uIDCheckItem,uCheck); return DVar1; } int __stdcall ReleaseDC(HWND hWnd,HDC hDC) { int iVar1; // WARNING: Could not recover jumptable at 0x004474c5. Too many branches // WARNING: Treating indirect jump as call iVar1 = ReleaseDC(hWnd,hDC); return iVar1; } HDC __stdcall BeginPaint(HWND hWnd,LPPAINTSTRUCT lpPaint) { HDC pHVar1; // WARNING: Could not recover jumptable at 0x004474cb. Too many branches // WARNING: Treating indirect jump as call pHVar1 = BeginPaint(hWnd,lpPaint); return pHVar1; } BOOL __stdcall ClientToScreen(HWND hWnd,LPPOINT lpPoint) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004474d1. Too many branches // WARNING: Treating indirect jump as call BVar1 = ClientToScreen(hWnd,lpPoint); return BVar1; } BOOL __stdcall AppendMenuA(HMENU hMenu,UINT uFlags,UINT_PTR uIDNewItem,LPCSTR lpNewItem) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004474d7. Too many branches // WARNING: Treating indirect jump as call BVar1 = AppendMenuA(hMenu,uFlags,uIDNewItem,lpNewItem); return BVar1; } HCURSOR __stdcall SetCursor(HCURSOR hCursor) { HCURSOR pHVar1; // WARNING: Could not recover jumptable at 0x004474dd. Too many branches // WARNING: Treating indirect jump as call pHVar1 = SetCursor(hCursor); return pHVar1; } HMENU __stdcall CreateMenu(void) { HMENU pHVar1; // WARNING: Could not recover jumptable at 0x004474e3. Too many branches // WARNING: Treating indirect jump as call pHVar1 = CreateMenu(); return pHVar1; } BOOL __stdcall UpdateWindow(HWND hWnd) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004474e9. Too many branches // WARNING: Treating indirect jump as call BVar1 = UpdateWindow(hWnd); return BVar1; } BOOL __stdcall UnregisterClassA(LPCSTR lpClassName,HINSTANCE hInstance) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004474ef. Too many branches // WARNING: Treating indirect jump as call BVar1 = UnregisterClassA(lpClassName,hInstance); return BVar1; } BOOL __stdcall TranslateMessage(MSG *lpMsg) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004474f5. Too many branches // WARNING: Treating indirect jump as call BVar1 = TranslateMessage(lpMsg); return BVar1; } BOOL __stdcall ShowWindow(HWND hWnd,int nCmdShow) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x004474fb. Too many branches // WARNING: Treating indirect jump as call BVar1 = ShowWindow(hWnd,nCmdShow); return BVar1; } int __stdcall ShowCursor(BOOL bShow) { int iVar1; // WARNING: Could not recover jumptable at 0x00447501. Too many branches // WARNING: Treating indirect jump as call iVar1 = ShowCursor(bShow); return iVar1; } BOOL __stdcall SetWindowPos(HWND hWnd,HWND hWndInsertAfter,int X,int Y,int cx,int cy,UINT uFlags) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447507. Too many branches // WARNING: Treating indirect jump as call BVar1 = SetWindowPos(hWnd,hWndInsertAfter,X,Y,cx,cy,uFlags); return BVar1; } BOOL __stdcall SetRect(LPRECT lprc,int xLeft,int yTop,int xRight,int yBottom) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044750d. Too many branches // WARNING: Treating indirect jump as call BVar1 = SetRect(lprc,xLeft,yTop,xRight,yBottom); return BVar1; } BOOL __stdcall SetMenu(HWND hWnd,HMENU hMenu) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447513. Too many branches // WARNING: Treating indirect jump as call BVar1 = SetMenu(hWnd,hMenu); return BVar1; } BOOL __stdcall SetForegroundWindow(HWND hWnd) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x00447519. Too many branches // WARNING: Treating indirect jump as call BVar1 = SetForegroundWindow(hWnd); return BVar1; } BOOL __stdcall SetDlgItemTextA(HWND hDlg,int nIDDlgItem,LPCSTR lpString) { BOOL BVar1; // WARNING: Could not recover jumptable at 0x0044751f. Too many branches // WARNING: Treating indirect jump as call BVar1 = SetDlgItemTextA(hDlg,nIDDlgItem,lpString); return BVar1; } MMRESULT __stdcall waveOutWrite(HWAVEOUT hwo,LPWAVEHDR pwh,UINT cbwh) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x00447525. Too many branches // WARNING: Treating indirect jump as call MVar1 = waveOutWrite(hwo,pwh,cbwh); return MVar1; } MMRESULT __stdcall waveOutUnprepareHeader(HWAVEOUT hwo,LPWAVEHDR pwh,UINT cbwh) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x0044752b. Too many branches // WARNING: Treating indirect jump as call MVar1 = waveOutUnprepareHeader(hwo,pwh,cbwh); return MVar1; } MMRESULT __stdcall waveOutRestart(HWAVEOUT hwo) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x00447531. Too many branches // WARNING: Treating indirect jump as call MVar1 = waveOutRestart(hwo); return MVar1; } MMRESULT __stdcall waveOutPrepareHeader(HWAVEOUT hwo,LPWAVEHDR pwh,UINT cbwh) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x00447537. Too many branches // WARNING: Treating indirect jump as call MVar1 = waveOutPrepareHeader(hwo,pwh,cbwh); return MVar1; } MMRESULT __stdcall waveOutPause(HWAVEOUT hwo) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x0044753d. Too many branches // WARNING: Treating indirect jump as call MVar1 = waveOutPause(hwo); return MVar1; } MMRESULT __stdcall waveOutOpen(LPHWAVEOUT phwo,UINT uDeviceID,LPCWAVEFORMATEX pwfx,DWORD_PTR dwCallback, DWORD_PTR dwInstance,DWORD fdwOpen) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x00447543. Too many branches // WARNING: Treating indirect jump as call MVar1 = waveOutOpen(phwo,uDeviceID,pwfx,dwCallback,dwInstance,fdwOpen); return MVar1; } UINT __stdcall waveOutGetNumDevs(void) { UINT UVar1; // WARNING: Could not recover jumptable at 0x00447549. Too many branches // WARNING: Treating indirect jump as call UVar1 = waveOutGetNumDevs(); return UVar1; } MMRESULT __stdcall waveOutGetErrorTextA(MMRESULT mmrError,LPSTR pszText,UINT cchText) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x0044754f. Too many branches // WARNING: Treating indirect jump as call MVar1 = waveOutGetErrorTextA(mmrError,pszText,cchText); return MVar1; } MMRESULT __stdcall waveOutClose(HWAVEOUT hwo) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x00447555. Too many branches // WARNING: Treating indirect jump as call MVar1 = waveOutClose(hwo); return MVar1; } DWORD __stdcall timeGetTime(void) { DWORD DVar1; // WARNING: Could not recover jumptable at 0x0044755b. Too many branches // WARNING: Treating indirect jump as call DVar1 = timeGetTime(); return DVar1; } MMRESULT __stdcall timeGetDevCaps(LPTIMECAPS ptc,UINT cbtc) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x00447561. Too many branches // WARNING: Treating indirect jump as call MVar1 = timeGetDevCaps(ptc,cbtc); return MVar1; } MMRESULT __stdcall timeEndPeriod(UINT uPeriod) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x00447567. Too many branches // WARNING: Treating indirect jump as call MVar1 = timeEndPeriod(uPeriod); return MVar1; } MMRESULT __stdcall waveOutReset(HWAVEOUT hwo) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x0044756d. Too many branches // WARNING: Treating indirect jump as call MVar1 = waveOutReset(hwo); return MVar1; } MMRESULT __stdcall timeBeginPeriod(UINT uPeriod) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x00447573. Too many branches // WARNING: Treating indirect jump as call MVar1 = timeBeginPeriod(uPeriod); return MVar1; } UINT __stdcall midiOutGetNumDevs(void) { UINT UVar1; // WARNING: Could not recover jumptable at 0x00447579. Too many branches // WARNING: Treating indirect jump as call UVar1 = midiOutGetNumDevs(); return UVar1; } MMRESULT __stdcall midiOutGetDevCapsA(UINT_PTR uDeviceID,LPMIDIOUTCAPSA pmoc,UINT cbmoc) { MMRESULT MVar1; // WARNING: Could not recover jumptable at 0x0044757f. Too many branches // WARNING: Treating indirect jump as call MVar1 = midiOutGetDevCapsA(uDeviceID,pmoc,cbmoc); return MVar1; } MCIERROR __stdcall mciSendCommandA(MCIDEVICEID mciId,UINT uMsg,DWORD_PTR dwParam1,DWORD_PTR dwParam2) { MCIERROR MVar1; // WARNING: Could not recover jumptable at 0x00447585. Too many branches // WARNING: Treating indirect jump as call MVar1 = mciSendCommandA(mciId,uMsg,dwParam1,dwParam2); return MVar1; }