Imported Upstream version 0.10
authorChris Butler <chrisb@debian.org>
Sun, 23 Sep 2012 19:05:20 +0000 (20:05 +0100)
committerChris Butler <chrisb@debian.org>
Sun, 23 Sep 2012 19:05:20 +0000 (20:05 +0100)
638 files changed:
.gitignore [deleted file]
AnimView/AnimView.ico [new file with mode: 0644]
AnimView/AnimView.rc [new file with mode: 0644]
AnimView/CMakeLists.txt [changed mode: 0755->0644]
AnimView/Makefile [changed mode: 0755->0644]
AnimView/VSPR-0.xml [changed mode: 0755->0644]
AnimView/app.cpp [changed mode: 0755->0644]
AnimView/app.h [changed mode: 0755->0644]
AnimView/backdrop.h [changed mode: 0755->0644]
AnimView/frmMain.cpp [changed mode: 0755->0644]
AnimView/frmMain.h [changed mode: 0755->0644]
AnimView/frmSprites.cpp [changed mode: 0755->0644]
AnimView/frmSprites.h [changed mode: 0755->0644]
AnimView/rnc.cpp [changed mode: 0755->0644]
AnimView/th.cpp [changed mode: 0755->0644]
AnimView/th.h [changed mode: 0755->0644]
AnimView/tinystr.cpp [changed mode: 0755->0644]
AnimView/tinystr.h [changed mode: 0755->0644]
AnimView/tinyxml.cpp [changed mode: 0755->0644]
AnimView/tinyxml.h [changed mode: 0755->0644]
AnimView/tinyxmlerror.cpp [changed mode: 0755->0644]
AnimView/tinyxmlparser.cpp [changed mode: 0755->0644]
CMakeLists.txt [changed mode: 0755->0644]
CorsixTH/Bitmap/aux_ui.dat [changed mode: 0755->0644]
CorsixTH/Bitmap/aux_ui.spec [changed mode: 0755->0644]
CorsixTH/Bitmap/aux_ui.tab [changed mode: 0755->0644]
CorsixTH/Bitmap/bootstrap_font.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/bootstrap_font.dat [changed mode: 0755->0644]
CorsixTH/Bitmap/bootstrap_font.pal [changed mode: 0755->0644]
CorsixTH/Bitmap/bootstrap_font.tab [changed mode: 0755->0644]
CorsixTH/Bitmap/build_room_dialog_close.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/flag_buildable.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/flag_hospital.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/flag_passable.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/flag_travel_east.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/flag_travel_north.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/flag_travel_south.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/flag_travel_west.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/flags32.png [changed mode: 0755->0644]
CorsixTH/Bitmap/fullscreen_border_bottom.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/fullscreen_border_bottomleft.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/fullscreen_border_bottomright.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/fullscreen_border_left.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/fullscreen_border_right.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/fullscreen_border_top.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/fullscreen_border_topleft.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/fullscreen_border_topright.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/lib_bmp.lua [changed mode: 0755->0644]
CorsixTH/Bitmap/lib_spritesheet.lua [changed mode: 0755->0644]
CorsixTH/Bitmap/mainmenu1080.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/mainmenu1080.dat [changed mode: 0755->0644]
CorsixTH/Bitmap/mainmenu1080.pal [changed mode: 0755->0644]
CorsixTH/Bitmap/map_cell_outline.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/map_cell_outline_east.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/map_cell_outline_north.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/map_cell_outline_south.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/map_cell_outline_west.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/mkbootstrap.lua [changed mode: 0755->0644]
CorsixTH/Bitmap/mkfont.lua [changed mode: 0755->0644]
CorsixTH/Bitmap/mkraw.lua [changed mode: 0755->0644]
CorsixTH/Bitmap/mksheet.lua [changed mode: 0755->0644]
CorsixTH/Bitmap/new32.png [changed mode: 0755->0644]
CorsixTH/Bitmap/open32.png [changed mode: 0755->0644]
CorsixTH/Bitmap/parcels32.png [changed mode: 0755->0644]
CorsixTH/Bitmap/positions32.png [new file with mode: 0644]
CorsixTH/Bitmap/readme.txt [changed mode: 0755->0644]
CorsixTH/Bitmap/save32.png [changed mode: 0755->0644]
CorsixTH/Bitmap/transparent_walls32.png [changed mode: 0755->0644]
CorsixTH/Bitmap/tree_collapsed.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/tree_ctrl.dat [changed mode: 0755->0644]
CorsixTH/Bitmap/tree_ctrl.pal [changed mode: 0755->0644]
CorsixTH/Bitmap/tree_ctrl.spec [changed mode: 0755->0644]
CorsixTH/Bitmap/tree_ctrl.tab [changed mode: 0755->0644]
CorsixTH/Bitmap/tree_expanded.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/tree_leaf.bmp [changed mode: 0755->0644]
CorsixTH/Bitmap/tree_level.bmp [changed mode: 0755->0644]
CorsixTH/CMakeLists.txt [changed mode: 0755->0644]
CorsixTH/CorsixTH.aps [changed mode: 0755->0644]
CorsixTH/CorsixTH.deproj [changed mode: 0755->0644]
CorsixTH/CorsixTH.ico [changed mode: 0755->0644]
CorsixTH/CorsixTH.lua [changed mode: 0755->0644]
CorsixTH/CorsixTH.rc [changed mode: 0755->0644]
CorsixTH/Icon.icns [changed mode: 0755->0644]
CorsixTH/LICENSE.txt [changed mode: 0755->0644]
CorsixTH/Levels/Example.map [changed mode: 0755->0644]
CorsixTH/Levels/avatar.level [changed mode: 0755->0644]
CorsixTH/Levels/avatar.map [changed mode: 0755->0644]
CorsixTH/Levels/demo.level [changed mode: 0755->0644]
CorsixTH/Levels/example.level [changed mode: 0755->0644]
CorsixTH/Levels/original05.level [changed mode: 0755->0644]
CorsixTH/Levels/original07.level [changed mode: 0755->0644]
CorsixTH/Levels/original11.level [changed mode: 0755->0644]
CorsixTH/Levels/original12.level [changed mode: 0755->0644]
CorsixTH/Lua/api_version.lua [changed mode: 0755->0644]
CorsixTH/Lua/app.lua [changed mode: 0755->0644]
CorsixTH/Lua/audio.lua [changed mode: 0755->0644]
CorsixTH/Lua/base_config.lua [changed mode: 0755->0644]
CorsixTH/Lua/calls_dispatcher.lua [changed mode: 0755->0644]
CorsixTH/Lua/class.lua [changed mode: 0755->0644]
CorsixTH/Lua/config_finder.lua [changed mode: 0755->0644]
CorsixTH/Lua/diagnosis/diag_blood_machine.lua [changed mode: 0755->0644]
CorsixTH/Lua/diagnosis/diag_cardiogram.lua [changed mode: 0755->0644]
CorsixTH/Lua/diagnosis/diag_general_diag.lua [changed mode: 0755->0644]
CorsixTH/Lua/diagnosis/diag_gp.lua [changed mode: 0755->0644]
CorsixTH/Lua/diagnosis/diag_psych.lua [changed mode: 0755->0644]
CorsixTH/Lua/diagnosis/diag_scanner.lua [changed mode: 0755->0644]
CorsixTH/Lua/diagnosis/diag_ultrascan.lua [changed mode: 0755->0644]
CorsixTH/Lua/diagnosis/diag_ward.lua [changed mode: 0755->0644]
CorsixTH/Lua/diagnosis/diag_x_ray.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/adviser.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/bottom_panel.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/build_room.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/confirm_dialog.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/edit_room.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/fullscreen.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/fullscreen/annual_report.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/fullscreen/bank_manager.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/fullscreen/drug_casebook.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/fullscreen/fax.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/fullscreen/graphs.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/fullscreen/hospital_policy.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/fullscreen/progress_report.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/fullscreen/research_policy.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/fullscreen/staff_management.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/fullscreen/town_map.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/furnish_corridor.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/hire_staff.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/information.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/jukebox.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/machine_dialog.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/map_editor.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/menu.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/message.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/patient.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/place_objects.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/place_staff.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/queue_dialog.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizable.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/calls_dispatcher.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/cheats.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/directory_browser.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/file_browser.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/file_browsers/load_game.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/file_browsers/save_game.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/lua_console.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/main_menu.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/menu_list_dialog.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/menu_list_dialogs/custom_game.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/menu_list_dialogs/make_debug_patient.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/new_game.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/options.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/resizables/tip_of_the_day.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/staff_dialog.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/staff_rise.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/tree_ctrl.lua [changed mode: 0755->0644]
CorsixTH/Lua/dialogs/watch.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/alien_dna.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/baldness.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/bloaty_head.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/broken_heart.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/broken_wind.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/chronic_nosehair.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/corrugated_ankles.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/discrete_itching.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/fake_blood.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/fractured_bones.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/gastric_ejections.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/golf_stones.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/gut_rot.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/hairyitis.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/heaped_piles.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/infectious_laughter.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/invisibility.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/iron_lungs.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/jellyitis.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/kidney_beans.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/king_complex.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/pregnant.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/ruptured_nodules.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/serious_radiation.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/slack_tongue.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/sleeping_illness.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/spare_ribs.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/sweaty_palms.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/the_squits.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/third_degree_sideburns.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/transparency.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/tv_personalities.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/uncommon_cold.lua [changed mode: 0755->0644]
CorsixTH/Lua/diseases/unexpected_swelling.lua [changed mode: 0755->0644]
CorsixTH/Lua/entities/humanoid.lua [changed mode: 0755->0644]
CorsixTH/Lua/entities/machine.lua [changed mode: 0755->0644]
CorsixTH/Lua/entities/object.lua [changed mode: 0755->0644]
CorsixTH/Lua/entities/patient.lua [changed mode: 0755->0644]
CorsixTH/Lua/entities/staff.lua [changed mode: 0755->0644]
CorsixTH/Lua/entities/vip.lua [changed mode: 0755->0644]
CorsixTH/Lua/entity.lua [changed mode: 0755->0644]
CorsixTH/Lua/filesystem.lua [changed mode: 0755->0644]
CorsixTH/Lua/game_ui.lua [changed mode: 0755->0644]
CorsixTH/Lua/graphics.lua [changed mode: 0755->0644]
CorsixTH/Lua/hospital.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/answer_call.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/call_checkpoint.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/check_watch.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/die.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/falling.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/get_up.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/idle.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/knock_door.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/meander.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/multi_use_object.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/on_ground.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/pee.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/pickup.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/queue.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/seek_reception.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/seek_room.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/seek_staffroom.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/seek_toilets.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/shake_fist.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/spawn.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/staff_reception.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/sweep_floor.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/tap_foot.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/use_object.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/use_screen.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/use_staffroom.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/vip_go_to_next_room.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/vomit.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/walk.lua [changed mode: 0755->0644]
CorsixTH/Lua/humanoid_actions/yawn.lua [changed mode: 0755->0644]
CorsixTH/Lua/key_mapping.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/czech.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/danish.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/developer.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/dutch.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/english.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/finnish.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/french.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/german.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/italian.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/norwegian.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/original_strings.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/polish.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/portuguese.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/russian.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/simplified_chinese.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/spanish.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/swedish.lua [changed mode: 0755->0644]
CorsixTH/Lua/languages/traditional_chinese.lua [changed mode: 0755->0644]
CorsixTH/Lua/map.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/analyser.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/autopsy.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/bed.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/bench.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/bin.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/bookcase.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/cabinet.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/chair.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/comfortable_chair.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/computer.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/console.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/couch.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/crash_trolley.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/desk.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/door.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/doors/entrance_left_door.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/doors/entrance_right_door.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/doors/swing_door_left.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/doors/swing_door_right.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/drinks_machine.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/fire_extinguisher.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/helicopter.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/lecture_chair.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/litter.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/loo.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/blood_machine.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/cardio.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/cast_remover.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/dna_fixer.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/electrolyser.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/hair_restorer.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/inflator.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/jelly_moulder.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/operating_table.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/operating_table_b.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/scanner.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/shower.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/slicer.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/ultrascanner.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/machines/x_ray.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/op_sink1.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/op_sink2.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/pharmacy_cabinet.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/plant.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/pool_table.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/projector.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/radiation_shield.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/radiation_shield_b.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/radiator.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/reception_desk.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/screen.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/sink.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/skeleton.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/sofa.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/surgeon_screen.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/tv.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/video_game.lua [changed mode: 0755->0644]
CorsixTH/Lua/objects/x_ray_viewer.lua [changed mode: 0755->0644]
CorsixTH/Lua/persistance.lua [changed mode: 0755->0644]
CorsixTH/Lua/queue.lua [changed mode: 0755->0644]
CorsixTH/Lua/research_department.lua [changed mode: 0755->0644]
CorsixTH/Lua/room.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/blood_machine_room.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/cardiogram.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/decontamination.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/dna_fixer.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/electrolysis.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/fracture_clinic.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/general_diag.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/gp.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/hair_restoration.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/inflation.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/jelly_vat.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/operating_theatre.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/pharmacy.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/psych.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/research.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/scanner_room.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/slack_tongue.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/staff_room.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/toilets.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/training.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/ultrascan.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/ward.lua [changed mode: 0755->0644]
CorsixTH/Lua/rooms/x_ray_room.lua [changed mode: 0755->0644]
CorsixTH/Lua/sprite_viewer.lua [changed mode: 0755->0644]
CorsixTH/Lua/staff_profile.lua [changed mode: 0755->0644]
CorsixTH/Lua/strict.lua [changed mode: 0755->0644]
CorsixTH/Lua/string_extensions.lua [changed mode: 0755->0644]
CorsixTH/Lua/strings.lua [changed mode: 0755->0644]
CorsixTH/Lua/ui.lua [changed mode: 0755->0644]
CorsixTH/Lua/utility.lua [changed mode: 0755->0644]
CorsixTH/Lua/walls/blue.lua [changed mode: 0755->0644]
CorsixTH/Lua/walls/external.lua [changed mode: 0755->0644]
CorsixTH/Lua/walls/green.lua [changed mode: 0755->0644]
CorsixTH/Lua/walls/white.lua [changed mode: 0755->0644]
CorsixTH/Lua/walls/yellow.lua [changed mode: 0755->0644]
CorsixTH/Lua/window.lua [changed mode: 0755->0644]
CorsixTH/Lua/world.lua [changed mode: 0755->0644]
CorsixTH/Original_Logo.svg [changed mode: 0755->0644]
CorsixTH/Original_Logo_Text.svg [changed mode: 0755->0644]
CorsixTH/README.txt [changed mode: 0755->0644]
CorsixTH/SDLMain/CMakeLists.txt [changed mode: 0755->0644]
CorsixTH/SDLMain/SDLMain.h [changed mode: 0755->0644]
CorsixTH/SDLMain/SDLMain.m [changed mode: 0755->0644]
CorsixTH/Src/bootstrap.cpp [changed mode: 0755->0644]
CorsixTH/Src/bootstrap.h [changed mode: 0755->0644]
CorsixTH/Src/config.h.in [changed mode: 0755->0644]
CorsixTH/Src/cp437_table.h [changed mode: 0755->0644]
CorsixTH/Src/cp936_table.h [changed mode: 0755->0644]
CorsixTH/Src/iso_fs.cpp [changed mode: 0755->0644]
CorsixTH/Src/iso_fs.h [changed mode: 0755->0644]
CorsixTH/Src/jit_opt.h [changed mode: 0755->0644]
CorsixTH/Src/lua.hpp [changed mode: 0755->0644]
CorsixTH/Src/lua_sdl.h [changed mode: 0755->0644]
CorsixTH/Src/main.cpp [changed mode: 0755->0644]
CorsixTH/Src/main.h [changed mode: 0755->0644]
CorsixTH/Src/persist_lua.cpp [changed mode: 0755->0644]
CorsixTH/Src/persist_lua.h [changed mode: 0755->0644]
CorsixTH/Src/random.c [changed mode: 0755->0644]
CorsixTH/Src/rnc.cpp [changed mode: 0755->0644]
CorsixTH/Src/rnc.h [changed mode: 0755->0644]
CorsixTH/Src/run_length_encoder.cpp [changed mode: 0755->0644]
CorsixTH/Src/run_length_encoder.h [changed mode: 0755->0644]
CorsixTH/Src/sdl_audio.cpp [changed mode: 0755->0644]
CorsixTH/Src/sdl_core.cpp [changed mode: 0755->0644]
CorsixTH/Src/sdl_wm.cpp [changed mode: 0755->0644]
CorsixTH/Src/th.cpp [changed mode: 0755->0644]
CorsixTH/Src/th.h [changed mode: 0755->0644]
CorsixTH/Src/th_gfx.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_gfx.h [changed mode: 0755->0644]
CorsixTH/Src/th_gfx_dx9.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_gfx_dx9.h [changed mode: 0755->0644]
CorsixTH/Src/th_gfx_font.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_gfx_font.h [changed mode: 0755->0644]
CorsixTH/Src/th_gfx_ogl.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_gfx_ogl.h [changed mode: 0755->0644]
CorsixTH/Src/th_gfx_sdl.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_gfx_sdl.h [changed mode: 0755->0644]
CorsixTH/Src/th_lua.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_lua.h [changed mode: 0755->0644]
CorsixTH/Src/th_lua_anims.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_lua_gfx.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_lua_internal.h [changed mode: 0755->0644]
CorsixTH/Src/th_lua_map.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_lua_sound.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_lua_strings.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_lua_ui.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_map.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_map.h [changed mode: 0755->0644]
CorsixTH/Src/th_map_overlays.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_map_overlays.h [changed mode: 0755->0644]
CorsixTH/Src/th_pathfind.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_pathfind.h [changed mode: 0755->0644]
CorsixTH/Src/th_sound.cpp [changed mode: 0755->0644]
CorsixTH/Src/th_sound.h [changed mode: 0755->0644]
CorsixTH/Src/xmi2mid.cpp [changed mode: 0755->0644]
CorsixTH/Src/xmi2mid.h [changed mode: 0755->0644]
CorsixTH/SrcUnshared/SDL_main_win32.c [changed mode: 0755->0644]
CorsixTH/SrcUnshared/main.cpp [changed mode: 0755->0644]
CorsixTH/__MACOSX/SDLMain/._SDLMain.m [changed mode: 0755->0644]
CorsixTH/changelog.txt [changed mode: 0755->0644]
CorsixTH/resource.h [changed mode: 0755->0644]
DebianPackage/control [changed mode: 0755->0644]
DebianPackage/debian-binary [changed mode: 0755->0644]
DebianPackage/readme.txt [changed mode: 0755->0644]
DebianPackage/usr/games/CorsixTH [changed from file to symlink]
DebianPackage/usr/share/applications/CorsixTH.desktop [changed mode: 0755->0644]
DebianPackage/usr/share/applications/MapEdit.desktop [changed mode: 0755->0644]
DebianPackage/usr/share/doc/corsix-th/copyright [changed mode: 0755->0644]
LDocGen/c_tokenise.lua [changed mode: 0755->0644]
LDocGen/helpers.lua [changed mode: 0755->0644]
LDocGen/lua_code_model.lua [changed mode: 0755->0644]
LDocGen/lua_scan.lua [changed mode: 0755->0644]
LDocGen/lua_tokenise.lua [changed mode: 0755->0644]
LDocGen/main.lua [changed mode: 0755->0644]
LDocGen/output/corner_right.gif [changed mode: 0755->0644]
LDocGen/output/logo.png [changed mode: 0755->0644]
LDocGen/output/main.css [changed mode: 0755->0644]
LDocGen/template.lua [changed mode: 0755->0644]
LDocGen/templates/class.htlua [changed mode: 0755->0644]
LDocGen/templates/class_inheritance.htlua [changed mode: 0755->0644]
LDocGen/templates/lua_class_hierarchy.htlua [changed mode: 0755->0644]
LDocGen/templates/lua_class_index.htlua [changed mode: 0755->0644]
LDocGen/templates/lua_class_list.htlua [changed mode: 0755->0644]
LDocGen/templates/lua_class_tree.htlua [changed mode: 0755->0644]
LDocGen/templates/lua_file_hierarchy.htlua [changed mode: 0755->0644]
LDocGen/templates/lua_file_tree.htlua [changed mode: 0755->0644]
LDocGen/templates/page.htlua [changed mode: 0755->0644]
LFS/README [changed mode: 0755->0644]
LFS/lfs.c [changed mode: 0755->0644]
LFS/lfs.def [changed mode: 0755->0644]
LFS/lfs.h [changed mode: 0755->0644]
LFS/lfs_ext.c [changed mode: 0755->0644]
LPEG/lpeg-128.gif [changed mode: 0755->0644]
LPEG/lpeg.c [changed mode: 0755->0644]
LPEG/lpeg.html [changed mode: 0755->0644]
MapEdit/CMakeLists.txt [changed mode: 0755->0644]
MapEdit/MapEdit.ico [new file with mode: 0644]
MapEdit/MapEdit.rc [new file with mode: 0644]
MapEdit/Src/app.cpp [changed mode: 0755->0644]
MapEdit/Src/app.h [changed mode: 0755->0644]
MapEdit/Src/block_gallery.cpp [changed mode: 0755->0644]
MapEdit/Src/block_gallery.h [changed mode: 0755->0644]
MapEdit/Src/embedded_game.cpp [changed mode: 0755->0644]
MapEdit/Src/embedded_game.h [changed mode: 0755->0644]
MapEdit/Src/frmLog.cpp [changed mode: 0755->0644]
MapEdit/Src/frmLog.h [changed mode: 0755->0644]
MapEdit/Src/frmMain.cpp [changed mode: 0755->0644]
MapEdit/Src/frmMain.h [changed mode: 0755->0644]
MapEdit/Src/game.h [changed mode: 0755->0644]
MapEdit/Src/scrollable_game.cpp [changed mode: 0755->0644]
MapEdit/Src/scrollable_game.h [changed mode: 0755->0644]
MapEdit/Src/th_map_wrapper.cpp [changed mode: 0755->0644]
MapEdit/Src/th_map_wrapper.h [changed mode: 0755->0644]
TestProcedure/Saves/issue 1119.sav [new file with mode: 0644]
TestProcedure/Saves/test-save-beta8.sav [new file with mode: 0644]
TestProcedure/procedure.txt [new file with mode: 0644]
WindowsInstaller/LanguageStrings.nsh [changed mode: 0755->0644]
WindowsInstaller/OptionsPage.ini [changed mode: 0755->0644]
WindowsInstaller/ReplaceInFile.nsh [changed mode: 0755->0644]
WindowsInstaller/StrRep.nsh [changed mode: 0755->0644]
WindowsInstaller/Win32Script.nsi [changed mode: 0755->0644]
WindowsInstaller/config_template.txt [changed mode: 0755->0644]
WindowsInstaller/readme.txt [changed mode: 0755->0644]
WindowsInstaller/welcome.bmp [changed mode: 0755->0644]
agg/ChangeLog [changed mode: 0755->0644]
agg/authors [changed mode: 0755->0644]
agg/copying [changed mode: 0755->0644]
agg/include/agg_alpha_mask_u8.h [changed mode: 0755->0644]
agg/include/agg_arc.h [changed mode: 0755->0644]
agg/include/agg_array.h [changed mode: 0755->0644]
agg/include/agg_arrowhead.h [changed mode: 0755->0644]
agg/include/agg_basics.h [changed mode: 0755->0644]
agg/include/agg_bezier_arc.h [changed mode: 0755->0644]
agg/include/agg_bitset_iterator.h [changed mode: 0755->0644]
agg/include/agg_blur.h [changed mode: 0755->0644]
agg/include/agg_bounding_rect.h [changed mode: 0755->0644]
agg/include/agg_bspline.h [changed mode: 0755->0644]
agg/include/agg_clip_liang_barsky.h [changed mode: 0755->0644]
agg/include/agg_color_gray.h [changed mode: 0755->0644]
agg/include/agg_color_rgba.h [changed mode: 0755->0644]
agg/include/agg_config.h [changed mode: 0755->0644]
agg/include/agg_conv_adaptor_vcgen.h [changed mode: 0755->0644]
agg/include/agg_conv_adaptor_vpgen.h [changed mode: 0755->0644]
agg/include/agg_conv_bspline.h [changed mode: 0755->0644]
agg/include/agg_conv_clip_polygon.h [changed mode: 0755->0644]
agg/include/agg_conv_clip_polyline.h [changed mode: 0755->0644]
agg/include/agg_conv_close_polygon.h [changed mode: 0755->0644]
agg/include/agg_conv_concat.h [changed mode: 0755->0644]
agg/include/agg_conv_contour.h [changed mode: 0755->0644]
agg/include/agg_conv_curve.h [changed mode: 0755->0644]
agg/include/agg_conv_dash.h [changed mode: 0755->0644]
agg/include/agg_conv_gpc.h [changed mode: 0755->0644]
agg/include/agg_conv_marker.h [changed mode: 0755->0644]
agg/include/agg_conv_marker_adaptor.h [changed mode: 0755->0644]
agg/include/agg_conv_segmentator.h [changed mode: 0755->0644]
agg/include/agg_conv_shorten_path.h [changed mode: 0755->0644]
agg/include/agg_conv_smooth_poly1.h [changed mode: 0755->0644]
agg/include/agg_conv_stroke.h [changed mode: 0755->0644]
agg/include/agg_conv_transform.h [changed mode: 0755->0644]
agg/include/agg_conv_unclose_polygon.h [changed mode: 0755->0644]
agg/include/agg_curves.h [changed mode: 0755->0644]
agg/include/agg_dda_line.h [changed mode: 0755->0644]
agg/include/agg_ellipse.h [changed mode: 0755->0644]
agg/include/agg_ellipse_bresenham.h [changed mode: 0755->0644]
agg/include/agg_embedded_raster_fonts.h [changed mode: 0755->0644]
agg/include/agg_font_cache_manager.h [changed mode: 0755->0644]
agg/include/agg_gamma_functions.h [changed mode: 0755->0644]
agg/include/agg_gamma_lut.h [changed mode: 0755->0644]
agg/include/agg_glyph_raster_bin.h [changed mode: 0755->0644]
agg/include/agg_gradient_lut.h [changed mode: 0755->0644]
agg/include/agg_gsv_text.h [changed mode: 0755->0644]
agg/include/agg_image_accessors.h [changed mode: 0755->0644]
agg/include/agg_image_filters.h [changed mode: 0755->0644]
agg/include/agg_line_aa_basics.h [changed mode: 0755->0644]
agg/include/agg_math.h [changed mode: 0755->0644]
agg/include/agg_math_stroke.h [changed mode: 0755->0644]
agg/include/agg_path_length.h [changed mode: 0755->0644]
agg/include/agg_path_storage.h [changed mode: 0755->0644]
agg/include/agg_path_storage_integer.h [changed mode: 0755->0644]
agg/include/agg_pattern_filters_rgba.h [changed mode: 0755->0644]
agg/include/agg_pixfmt_amask_adaptor.h [changed mode: 0755->0644]
agg/include/agg_pixfmt_gray.h [changed mode: 0755->0644]
agg/include/agg_pixfmt_rgb.h [changed mode: 0755->0644]
agg/include/agg_pixfmt_rgb_packed.h [changed mode: 0755->0644]
agg/include/agg_pixfmt_rgba.h [changed mode: 0755->0644]
agg/include/agg_pixfmt_transposer.h [changed mode: 0755->0644]
agg/include/agg_rasterizer_cells_aa.h [changed mode: 0755->0644]
agg/include/agg_rasterizer_compound_aa.h [changed mode: 0755->0644]
agg/include/agg_rasterizer_outline.h [changed mode: 0755->0644]
agg/include/agg_rasterizer_outline_aa.h [changed mode: 0755->0644]
agg/include/agg_rasterizer_scanline_aa.h [changed mode: 0755->0644]
agg/include/agg_rasterizer_sl_clip.h [changed mode: 0755->0644]
agg/include/agg_renderer_base.h [changed mode: 0755->0644]
agg/include/agg_renderer_markers.h [changed mode: 0755->0644]
agg/include/agg_renderer_mclip.h [changed mode: 0755->0644]
agg/include/agg_renderer_outline_aa.h [changed mode: 0755->0644]
agg/include/agg_renderer_outline_image.h [changed mode: 0755->0644]
agg/include/agg_renderer_primitives.h [changed mode: 0755->0644]
agg/include/agg_renderer_raster_text.h [changed mode: 0755->0644]
agg/include/agg_renderer_scanline.h [changed mode: 0755->0644]
agg/include/agg_rendering_buffer.h [changed mode: 0755->0644]
agg/include/agg_rendering_buffer_dynarow.h [changed mode: 0755->0644]
agg/include/agg_rounded_rect.h [changed mode: 0755->0644]
agg/include/agg_scanline_bin.h [changed mode: 0755->0644]
agg/include/agg_scanline_boolean_algebra.h [changed mode: 0755->0644]
agg/include/agg_scanline_p.h [changed mode: 0755->0644]
agg/include/agg_scanline_storage_aa.h [changed mode: 0755->0644]
agg/include/agg_scanline_storage_bin.h [changed mode: 0755->0644]
agg/include/agg_scanline_u.h [changed mode: 0755->0644]
agg/include/agg_shorten_path.h [changed mode: 0755->0644]
agg/include/agg_simul_eq.h [changed mode: 0755->0644]
agg/include/agg_span_allocator.h [changed mode: 0755->0644]
agg/include/agg_span_converter.h [changed mode: 0755->0644]
agg/include/agg_span_gouraud.h [changed mode: 0755->0644]
agg/include/agg_span_gouraud_gray.h [changed mode: 0755->0644]
agg/include/agg_span_gouraud_rgba.h [changed mode: 0755->0644]
agg/include/agg_span_gradient.h [changed mode: 0755->0644]
agg/include/agg_span_gradient_alpha.h [changed mode: 0755->0644]
agg/include/agg_span_image_filter.h [changed mode: 0755->0644]
agg/include/agg_span_image_filter_gray.h [changed mode: 0755->0644]
agg/include/agg_span_image_filter_rgb.h [changed mode: 0755->0644]
agg/include/agg_span_image_filter_rgba.h [changed mode: 0755->0644]
agg/include/agg_span_interpolator_adaptor.h [changed mode: 0755->0644]
agg/include/agg_span_interpolator_linear.h [changed mode: 0755->0644]
agg/include/agg_span_interpolator_persp.h [changed mode: 0755->0644]
agg/include/agg_span_interpolator_trans.h [changed mode: 0755->0644]
agg/include/agg_span_pattern_gray.h [changed mode: 0755->0644]
agg/include/agg_span_pattern_rgb.h [changed mode: 0755->0644]
agg/include/agg_span_pattern_rgba.h [changed mode: 0755->0644]
agg/include/agg_span_solid.h [changed mode: 0755->0644]
agg/include/agg_span_subdiv_adaptor.h [changed mode: 0755->0644]
agg/include/agg_trans_affine.h [changed mode: 0755->0644]
agg/include/agg_trans_bilinear.h [changed mode: 0755->0644]
agg/include/agg_trans_double_path.h [changed mode: 0755->0644]
agg/include/agg_trans_perspective.h [changed mode: 0755->0644]
agg/include/agg_trans_single_path.h [changed mode: 0755->0644]
agg/include/agg_trans_viewport.h [changed mode: 0755->0644]
agg/include/agg_trans_warp_magnifier.h [changed mode: 0755->0644]
agg/include/agg_vcgen_bspline.h [changed mode: 0755->0644]
agg/include/agg_vcgen_contour.h [changed mode: 0755->0644]
agg/include/agg_vcgen_dash.h [changed mode: 0755->0644]
agg/include/agg_vcgen_markers_term.h [changed mode: 0755->0644]
agg/include/agg_vcgen_smooth_poly1.h [changed mode: 0755->0644]
agg/include/agg_vcgen_stroke.h [changed mode: 0755->0644]
agg/include/agg_vcgen_vertex_sequence.h [changed mode: 0755->0644]
agg/include/agg_vertex_sequence.h [changed mode: 0755->0644]
agg/include/agg_vpgen_clip_polygon.h [changed mode: 0755->0644]
agg/include/agg_vpgen_clip_polyline.h [changed mode: 0755->0644]
agg/include/agg_vpgen_segmentator.h [changed mode: 0755->0644]
agg/include/util/agg_color_conv.h [changed mode: 0755->0644]
agg/include/util/agg_color_conv_rgb16.h [changed mode: 0755->0644]
agg/include/util/agg_color_conv_rgb8.h [changed mode: 0755->0644]
agg/news [changed mode: 0755->0644]
agg/readme [changed mode: 0755->0644]
agg/src/ChangeLog [changed mode: 0755->0644]
agg/src/agg_arc.cpp [changed mode: 0755->0644]
agg/src/agg_arrowhead.cpp [changed mode: 0755->0644]
agg/src/agg_bezier_arc.cpp [changed mode: 0755->0644]
agg/src/agg_bspline.cpp [changed mode: 0755->0644]
agg/src/agg_curves.cpp [changed mode: 0755->0644]
agg/src/agg_embedded_raster_fonts.cpp [changed mode: 0755->0644]
agg/src/agg_gsv_text.cpp [changed mode: 0755->0644]
agg/src/agg_image_filters.cpp [changed mode: 0755->0644]
agg/src/agg_line_aa_basics.cpp [changed mode: 0755->0644]
agg/src/agg_line_profile_aa.cpp [changed mode: 0755->0644]
agg/src/agg_rounded_rect.cpp [changed mode: 0755->0644]
agg/src/agg_sqrt_tables.cpp [changed mode: 0755->0644]
agg/src/agg_trans_affine.cpp [changed mode: 0755->0644]
agg/src/agg_trans_double_path.cpp [changed mode: 0755->0644]
agg/src/agg_trans_single_path.cpp [changed mode: 0755->0644]
agg/src/agg_trans_warp_magnifier.cpp [changed mode: 0755->0644]
agg/src/agg_vcgen_bspline.cpp [changed mode: 0755->0644]
agg/src/agg_vcgen_contour.cpp [changed mode: 0755->0644]
agg/src/agg_vcgen_dash.cpp [changed mode: 0755->0644]
agg/src/agg_vcgen_markers_term.cpp [changed mode: 0755->0644]
agg/src/agg_vcgen_smooth_poly1.cpp [changed mode: 0755->0644]
agg/src/agg_vcgen_stroke.cpp [changed mode: 0755->0644]
agg/src/agg_vpgen_clip_polygon.cpp [changed mode: 0755->0644]
agg/src/agg_vpgen_clip_polyline.cpp [changed mode: 0755->0644]
agg/src/agg_vpgen_segmentator.cpp [changed mode: 0755->0644]
agg/src/authors [changed mode: 0755->0644]
agg/src/copying [changed mode: 0755->0644]
agg/src/install [changed mode: 0755->0644]
agg/src/news [changed mode: 0755->0644]
agg/src/readme [changed mode: 0755->0644]

diff --git a/.gitignore b/.gitignore
deleted file mode 100755 (executable)
index 21e01fc..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# These are from svn:ignore
-/DataRaw/
-/LuaJIT/
-/SDL/
-/SDL_mixer-1.2.8/
-config.txt
-CorsixTH/Src/config.h
-
-# This is for the CMake build output
-cmake_install.cmake
-*.build/
-CMakeScripts/
-CMakeFiles/
-CMakeCache.txt
-
-# This is for the CMake-generated XCode project and output
-/build/
-*.xcodeproj/
-Debug/
-Release/
-MinSizeRel/
-RelWithDebInfo/
diff --git a/AnimView/AnimView.ico b/AnimView/AnimView.ico
new file mode 100644 (file)
index 0000000..b5e3537
Binary files /dev/null and b/AnimView/AnimView.ico differ
diff --git a/AnimView/AnimView.rc b/AnimView/AnimView.rc
new file mode 100644 (file)
index 0000000..92f5cb2
--- /dev/null
@@ -0,0 +1,34 @@
+// Microsoft Visual C++ generated resource script.\r
+//\r
+\r
+#define APSTUDIO_READONLY_SYMBOLS\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Generated from the TEXTINCLUDE 2 resource.\r
+//\r
+#include "afxres.h"\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+#undef APSTUDIO_READONLY_SYMBOLS\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+// English (U.K.) resources\r
+\r
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)\r
+#ifdef _WIN32\r
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK\r
+#pragma code_page(1252)\r
+#endif //_WIN32\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Icon\r
+//\r
+\r
+// Icon with lowest ID value placed first to ensure application icon\r
+// remains consistent on all systems.\r
+IDI_AnimView            ICON                    "AnimView.ico"\r
+#endif    // English (U.K.) resources\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
old mode 100755 (executable)
new mode 100644 (file)
index 92f4d4a..c333932
@@ -20,6 +20,7 @@ SET(animview_source_files
   th.h\r
   tinystr.h\r
   tinyxml.h\r
+  AnimView.rc\r
 )\r
 \r
 # Declaration of the executable\r
old mode 100755 (executable)
new mode 100644 (file)
index 54bfb2b..2782f4d
@@ -1,38 +1,38 @@
-# Makefile for building AnimViewer\r
-# This is quite a simple makefile and could probably do with some love from\r
-# someone who understands the *nix buildchain better than I do.\r
-\r
-CC= gcc\r
-CPP= g++\r
-RM= rm -f\r
-CFLAGS= `wx-config --cflags`\r
-LIBS= `wx-config --libs`\r
-\r
-ALL_T= AnimViewer\r
-ALL_O= app.o frmMain.o frmSprites.o rnc.o th.o\r
-\r
-default: all\r
-\r
-all: $(ALL_T)\r
-\r
-clean:\r
-       $(RM) $(ALL_O) $(ALL_T)\r
-\r
-AnimViewer: $(ALL_O)\r
-       $(CPP) -o $@ $(ALL_O) $(LIBS)\r
-\r
-app.o:\r
-       $(CPP) -c app.cpp $(CFLAGS)\r
-\r
-frmMain.o:\r
-       $(CPP) -c frmMain.cpp $(CFLAGS)\r
-\r
-frmSprites.o:\r
-       $(CPP) -c frmSprites.cpp $(CFLAGS)\r
-\r
-rnc.o:\r
-       $(CPP) -c rnc.cpp $(CFLAGS)\r
-\r
-th.o:\r
-       $(CPP) -c th.cpp $(CFLAGS)\r
-\r
+# Makefile for building AnimViewer
+# This is quite a simple makefile and could probably do with some love from
+# someone who understands the *nix buildchain better than I do.
+
+CC= gcc
+CPP= g++
+RM= rm -f
+CFLAGS= `wx-config --cflags`
+LIBS= `wx-config --libs`
+
+ALL_T= AnimViewer
+ALL_O= app.o frmMain.o frmSprites.o rnc.o th.o
+
+default: all
+
+all: $(ALL_T)
+
+clean:
+       $(RM) $(ALL_O) $(ALL_T)
+
+AnimViewer: $(ALL_O)
+       $(CPP) -o $@ $(ALL_O) $(LIBS)
+
+app.o:
+       $(CPP) -c app.cpp $(CFLAGS)
+
+frmMain.o:
+       $(CPP) -c frmMain.cpp $(CFLAGS)
+
+frmSprites.o:
+       $(CPP) -c frmSprites.cpp $(CFLAGS)
+
+rnc.o:
+       $(CPP) -c rnc.cpp $(CFLAGS)
+
+th.o:
+       $(CPP) -c th.cpp $(CFLAGS)
+
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 40c70c4..f074339
@@ -1,41 +1,41 @@
-/*\r
-Copyright (c) 2009 Peter "Corsix" Cawley\r
-\r
-Permission is hereby granted, free of charge, to any person obtaining a copy of\r
-this software and associated documentation files (the "Software"), to deal in\r
-the Software without restriction, including without limitation the rights to\r
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
-of the Software, and to permit persons to whom the Software is furnished to do\r
-so, subject to the following conditions:\r
-\r
-The above copyright notice and this permission notice shall be included in all\r
-copies or substantial portions of the Software.\r
-\r
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
-SOFTWARE.\r
-*/\r
-\r
-#include "app.h"\r
-#include "frmMain.h"\r
-#include "frmSprites.h"\r
-\r
-IMPLEMENT_APP(ThemeHospitalAnimViewApp)\r
-\r
-bool ThemeHospitalAnimViewApp::OnInit()\r
-{\r
-    wxTopLevelWindow *pForm;\r
-    if(::wxMessageBox(L"Launch animation viewer? (No -> sprite viewer)", L"AnimView", wxYES_NO) == wxYES)\r
-        pForm = new frmMain;\r
-    else\r
-        pForm = new frmSprites;\r
-\r
-    pForm->Show(true);\r
-    SetTopWindow(pForm);\r
-\r
-    return true;\r
-}\r
+/*
+Copyright (c) 2009 Peter "Corsix" Cawley
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#include "app.h"
+#include "frmMain.h"
+#include "frmSprites.h"
+
+IMPLEMENT_APP(ThemeHospitalAnimViewApp)
+
+bool ThemeHospitalAnimViewApp::OnInit()
+{
+    wxTopLevelWindow *pForm;
+    if(::wxMessageBox(L"Launch animation viewer? (No -> sprite viewer)", L"AnimView", wxYES_NO) == wxYES)
+        pForm = new frmMain;
+    else
+        pForm = new frmSprites;
+
+    pForm->Show(true);
+    SetTopWindow(pForm);
+
+    return true;
+}
old mode 100755 (executable)
new mode 100644 (file)
index 2fbc30f..8f956ce
@@ -1,43 +1,43 @@
-/*\r
-Copyright (c) 2009 Peter "Corsix" Cawley\r
-\r
-Permission is hereby granted, free of charge, to any person obtaining a copy of\r
-this software and associated documentation files (the "Software"), to deal in\r
-the Software without restriction, including without limitation the rights to\r
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
-of the Software, and to permit persons to whom the Software is furnished to do\r
-so, subject to the following conditions:\r
-\r
-The above copyright notice and this permission notice shall be included in all\r
-copies or substantial portions of the Software.\r
-\r
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
-SOFTWARE.\r
-*/\r
-\r
-#pragma once\r
-// For compilers that support precompilation, includes "wx/wx.h".\r
-#include "wx/wxprec.h"\r
-\r
-#ifdef __BORLANDC__\r
-    #pragma hdrstop\r
-#endif\r
-\r
-// for all others, include the necessary headers (this file is usually all you\r
-// need because it includes almost all "standard" wxWidgets headers)\r
-#ifndef WX_PRECOMP\r
-    #include "wx/wx.h"\r
-#endif\r
-// ----------------------------\r
-\r
-class ThemeHospitalAnimViewApp : public wxApp\r
-{\r
-    virtual bool OnInit();\r
-};\r
-\r
-DECLARE_APP(ThemeHospitalAnimViewApp)\r
+/*
+Copyright (c) 2009 Peter "Corsix" Cawley
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#pragma once
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWidgets headers)
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+#endif
+// ----------------------------
+
+class ThemeHospitalAnimViewApp : public wxApp
+{
+    virtual bool OnInit();
+};
+
+DECLARE_APP(ThemeHospitalAnimViewApp)
old mode 100755 (executable)
new mode 100644 (file)
index 673020d..601b376
@@ -1,80 +1,80 @@
-/* XPM */\r
-static const char *const backdrop_xpm[] = {\r
-"126 64 12 1",\r
-"f c #695D7D",\r
-"c c #6D6D6D",\r
-". c #797979",\r
-"j c #3561CA",\r
-"i c #797196",\r
-"d c #8275A2",\r
-"b c #867DAA",\r
-"e c Gray51",\r
-"a c #8E8E8E",\r
-"g c #A29A9E",\r
-"h c #AAAAAA",\r
-"  c None",\r
-"                              ..                                                              ..                              ",\r
-"                            abcccd                                                          abcccd                            ",\r
-"                          abccccccce                                                      abccccccce                          ",\r
-"                        abcfcfcfcfcfcb                                                  abcfcfcfcfcfcb                        ",\r
-"                      agacccccfcfcfcccag                                              agacccccfcfcfcccag                      ",\r
-"                    eahhhabfcfcfcfcfbahhha                                          eahhhabfcfcfcfcfbahhha                    ",\r
-"                  eahhhhhhhabfffffbahhhhhhha                                      eahhhhhhhabfffffbahhhhhhha                  ",\r
-"                iahhhhhhhhhhha.f.ahhhhhhhhhhha                                  iahhhhhhhhhhha.f.ahhhhhhhhhhha                ",\r
-"              ...hhhhhhhhhhhhh...hhhhhhhhhhhhh..                              ...hhhhhhhhhhhhh...hhhhhhhhhhhhh..              ",\r
-"            abcccdahhhhhhhhhadcccdahhhhhhhhhabcccd                          abcccdahhhhhhhhhadcccdahhhhhhhhhabcccd            ",\r
-"          abccccccceahhhhhaeccccccceahhhhhabccccccce                      abccccccceahhhhhaeccccccceahhhhhabccccccce          ",\r
-"        abcfcfcfcfcfcbahgbcfcfcfcfcfcbahabcfcfcfcfcfcb                  abcfcfcfcfcfcbahgbcfcfcfcfcfcbahabcfcfcfcfcfcb        ",\r
-"      agacccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcccag              agacccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcccag      ",\r
-"    eahhhabfcfcfcfcfbahhhabfcfcfcfcfeahhhabfcfcfcfcfbahhha          eahhhabfcfcfcfcfbahhhabfcfcfcfcfeahhhabfcfcfcfcfbahhha    ",\r
-"  eahhhhhhhabfffffbahhhhhhhabfffffeahhhhhhhabfffffbahhhhhhha      eahhhhhhhabfffffbahhhhhhhabfffffeahhhhhhhabfffffbahhhhhhha  ",\r
-"iahhhhhhhhhhha.f.ahhhhhhhhhhha.fiahhhhhhhhhhha.f.ahhhhhhhhhhha  iahhhhhhhhhhha.f.ahhhhhhhhhhha.fiahhhhhhhhhhha.f.ahhhhhhhhhhha",\r
-".hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhhjj.hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh",\r
-"  ahhhhhhhhhadcccdahhhhhhhhhabcccdahhhhhhhhhadcccdahhhhhhhhhjjccjjahhhhhhhhhadcccdahhhhhhhhhabcccdahhhhhhhhhadcccdahhhhhhhhh  ",\r
-"    ahhhhhaeccccccceahhhhhabccccccceahhhhhaeccccccceahhhhhjjccccccjjahhhhhaeccccccceahhhhhabccccccceahhhhhaeccccccceahhhhh    ",\r
-"      ahgbcfcfcfcfcfcbahabcfcfcfcfcfcbahgbcfcfcfcfcfcbahjjcfcfcfcfcfjjahgbcfcfcfcfcfcbahabcfcfcfcfcfcbahgbcfcfcfcfcfcbah      ",\r
-"        acccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcccjjacccccfcfcfcccjjacccccfcfcfcccagacccccfcfcfcccagacccccfcfcfccc        ",\r
-"          bfcfcfcfcfeahhhabfcfcfcfcfbahhhabfcfcfcfcfjjhhhabfcfcfcfcfbahhjjbfcfcfcfcfeahhhabfcfcfcfcfbahhhabfcfcfcfcf          ",\r
-"            bfffffeahhhhhhhabfffffbahhhhhhhabfffffjjhhhhhhhabfffffbahhhhhhjjbfffffeahhhhhhhabfffffbahhhhhhhabfffff            ",\r
-"              .fiahhhhhhhhhhha.f.ahhhhhhhhhhha.fjjhhhhhhhhhhha.f.ahhhhhhhhhhjj.fiahhhhhhhhhhha.f.ahhhhhhhhhhha.f              ",\r
-"                .hhhhhhhhhhhhh...hhhhhhhhhhhhhjj.hhhhhhhhhhhhh...hhhhhhhhhhhhhjj.hhhhhhhhhhhhh...hhhhhhhhhhhhh                ",\r
-"                  ahhhhhhhhhadcccdahhhhhhhhhjjcccdahhhhhhhhhadcccdahhhhhhhhhabccjjahhhhhhhhhadcccdahhhhhhhhh                  ",\r
-"                    ahhhhhaeccccccceahhhhhjjccccccceahhhhhaeccccccceahhhhhabccccccjjahhhhhaeccccccceahhhhh                    ",\r
-"                      ahgbcfcfcfcfcfcbahjjcfcfcfcfcfcbahgbcfcfcfcfcfcbahabcfcfcfcfcfjjahgbcfcfcfcfcfcbah                      ",\r
-"                        acccccfcfcfcccjjacccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcccjjacccccfcfcfccc                        ",\r
-"                          bfcfcfcfcfjjhhhabfcfcfcfcfbahhhabfcfcfcfcfeahhhabfcfcfcfcfbahhjjbfcfcfcfcf                          ",\r
-"                            bfffffjjhhhhhhhabfffffbahhhhhhhabfffffeahhhhhhhabfffffbahhhhhhjjbfffff                            ",\r
-"                              .fjjhhhhhhhhhhha.f.ahhhhhhhhhhha.fiahhhhhhhhhhha.f.ahhhhhhhhhhjj.f                              ",\r
-"                              ..jjhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhjj..                              ",\r
-"                            abcccdjjhhhhhhhhadcccdahhhhhhhhhabcccdahhhhhhhhhadcccdahhhhhhhjjabcccd                            ",\r
-"                          abcccccccejjhhhhaeccccccceahhhhhabccccccceahhhhhaeccccccceahhhjjabccccccce                          ",\r
-"                        abcfcfcfcfcfcbjjgbcfcfcfcfcfcbahabcfcfcfcfcfcbahgbcfcfcfcfcfcbjjabcfcfcfcfcfcb                        ",\r
-"                      agacccccfcfcfcccagjjccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcjjagacccccfcfcfcccag                      ",\r
-"                    eahhhabfcfcfcfcfbahhhajjcfcfcfcfeahhhabfcfcfcfcfbahhhabfcfcfcfjjeahhhabfcfcfcfcfbahhha                    ",\r
-"                  eahhhhhhhabfffffbahhhhhhhajjffffeahhhhhhhabfffffbahhhhhhhabfffjjeahhhhhhhabfffffbahhhhhhha                  ",\r
-"                iahhhhhhhhhhha.f.ahhhhhhhhhhhajjiahhhhhhhhhhha.f.ahhhhhhhhhhhajjiahhhhhhhhhhha.f.ahhhhhhhhhhha                ",\r
-"              ...hhhhhhhhhhhhh...hhhhhhhhhhhhh..jjhhhhhhhhhhhh...hhhhhhhhhhhjj...hhhhhhhhhhhhh...hhhhhhhhhhhhh..              ",\r
-"            abcccdahhhhhhhhhadcccdahhhhhhhhhabcccdjjhhhhhhhhadcccdahhhhhhhjjabcccdahhhhhhhhhadcccdahhhhhhhhhabcccd            ",\r
-"          abccccccceahhhhhaeccccccceahhhhhabcccccccejjhhhhaeccccccceahhhjjabccccccceahhhhhaeccccccceahhhhhabccccccce          ",\r
-"        abcfcfcfcfcfcbahgbcfcfcfcfcfcbahabcfcfcfcfcfcbjjgbcfcfcfcfcfcbjjabcfcfcfcfcfcbahgbcfcfcfcfcfcbahabcfcfcfcfcfcb        ",\r
-"      agacccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcccagjjccccfcfcfcjjagacccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcccag      ",\r
-"    eahhhabfcfcfcfcfbahhhabfcfcfcfcfeahhhabfcfcfcfcfbahhhajjcfcfcfjjeahhhabfcfcfcfcfbahhhabfcfcfcfcfeahhhabfcfcfcfcfbahhha    ",\r
-"  eahhhhhhhabfffffbahhhhhhhabfffffeahhhhhhhabfffffbahhhhhhhajjffjjeahhhhhhhabfffffbahhhhhhhabfffffeahhhhhhhabfffffbahhhhhhha  ",\r
-"iahhhhhhhhhhha.f.ahhhhhhhhhhha.fiahhhhhhhhhhha.f.ahhhhhhhhhhhajjiahhhhhhhhhhha.f.ahhhhhhhhhhha.fiahhhhhhhhhhha.f.ahhhhhhhhhhha",\r
-".hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh  .hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh",\r
-"  ahhhhhhhhhadcccdahhhhhhhhhabcccdahhhhhhhhhadcccdahhhhhhhhh      ahhhhhhhhhadcccdahhhhhhhhhabcccdahhhhhhhhhadcccdahhhhhhhhh  ",\r
-"    ahhhhhaeccccccceahhhhhabccccccceahhhhhaeccccccceahhhhh          ahhhhhaeccccccceahhhhhabccccccceahhhhhaeccccccceahhhhh    ",\r
-"      ahgbcfcfcfcfcfcbahabcfcfcfcfcfcbahgbcfcfcfcfcfcbah              ahgbcfcfcfcfcfcbahabcfcfcfcfcfcbahgbcfcfcfcfcfcbah      ",\r
-"        acccccfcfcfcccagacccccfcfcfcccagacccccfcfcfccc                  acccccfcfcfcccagacccccfcfcfcccagacccccfcfcfccc        ",\r
-"          bfcfcfcfcfeahhhabfcfcfcfcfbahhhabfcfcfcfcf                      bfcfcfcfcfeahhhabfcfcfcfcfbahhhabfcfcfcfcf          ",\r
-"            bfffffeahhhhhhhabfffffbahhhhhhhabfffff                          bfffffeahhhhhhhabfffffbahhhhhhhabfffff            ",\r
-"              .fiahhhhhhhhhhha.f.ahhhhhhhhhhha.f                              .fiahhhhhhhhhhha.f.ahhhhhhhhhhha.f              ",\r
-"                .hhhhhhhhhhhhh...hhhhhhhhhhhhh                                  .hhhhhhhhhhhhh...hhhhhhhhhhhhh                ",\r
-"                  ahhhhhhhhhadcccdahhhhhhhhh                                      ahhhhhhhhhadcccdahhhhhhhhh                  ",\r
-"                    ahhhhhaeccccccceahhhhh                                          ahhhhhaeccccccceahhhhh                    ",\r
-"                      ahgbcfcfcfcfcfcbah                                              ahgbcfcfcfcfcfcbah                      ",\r
-"                        acccccfcfcfccc                                                  acccccfcfcfccc                        ",\r
-"                          bfcfcfcfcf                                                      bfcfcfcfcf                          ",\r
-"                            bfffff                                                          bfffff                            ",\r
-"                              .f                                                              .f                              "\r
-};\r
+/* XPM */
+static const char *const backdrop_xpm[] = {
+"126 64 12 1",
+"f c #695D7D",
+"c c #6D6D6D",
+". c #797979",
+"j c #3561CA",
+"i c #797196",
+"d c #8275A2",
+"b c #867DAA",
+"e c Gray51",
+"a c #8E8E8E",
+"g c #A29A9E",
+"h c #AAAAAA",
+"  c None",
+"                              ..                                                              ..                              ",
+"                            abcccd                                                          abcccd                            ",
+"                          abccccccce                                                      abccccccce                          ",
+"                        abcfcfcfcfcfcb                                                  abcfcfcfcfcfcb                        ",
+"                      agacccccfcfcfcccag                                              agacccccfcfcfcccag                      ",
+"                    eahhhabfcfcfcfcfbahhha                                          eahhhabfcfcfcfcfbahhha                    ",
+"                  eahhhhhhhabfffffbahhhhhhha                                      eahhhhhhhabfffffbahhhhhhha                  ",
+"                iahhhhhhhhhhha.f.ahhhhhhhhhhha                                  iahhhhhhhhhhha.f.ahhhhhhhhhhha                ",
+"              ...hhhhhhhhhhhhh...hhhhhhhhhhhhh..                              ...hhhhhhhhhhhhh...hhhhhhhhhhhhh..              ",
+"            abcccdahhhhhhhhhadcccdahhhhhhhhhabcccd                          abcccdahhhhhhhhhadcccdahhhhhhhhhabcccd            ",
+"          abccccccceahhhhhaeccccccceahhhhhabccccccce                      abccccccceahhhhhaeccccccceahhhhhabccccccce          ",
+"        abcfcfcfcfcfcbahgbcfcfcfcfcfcbahabcfcfcfcfcfcb                  abcfcfcfcfcfcbahgbcfcfcfcfcfcbahabcfcfcfcfcfcb        ",
+"      agacccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcccag              agacccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcccag      ",
+"    eahhhabfcfcfcfcfbahhhabfcfcfcfcfeahhhabfcfcfcfcfbahhha          eahhhabfcfcfcfcfbahhhabfcfcfcfcfeahhhabfcfcfcfcfbahhha    ",
+"  eahhhhhhhabfffffbahhhhhhhabfffffeahhhhhhhabfffffbahhhhhhha      eahhhhhhhabfffffbahhhhhhhabfffffeahhhhhhhabfffffbahhhhhhha  ",
+"iahhhhhhhhhhha.f.ahhhhhhhhhhha.fiahhhhhhhhhhha.f.ahhhhhhhhhhha  iahhhhhhhhhhha.f.ahhhhhhhhhhha.fiahhhhhhhhhhha.f.ahhhhhhhhhhha",
+".hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhhjj.hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh",
+"  ahhhhhhhhhadcccdahhhhhhhhhabcccdahhhhhhhhhadcccdahhhhhhhhhjjccjjahhhhhhhhhadcccdahhhhhhhhhabcccdahhhhhhhhhadcccdahhhhhhhhh  ",
+"    ahhhhhaeccccccceahhhhhabccccccceahhhhhaeccccccceahhhhhjjccccccjjahhhhhaeccccccceahhhhhabccccccceahhhhhaeccccccceahhhhh    ",
+"      ahgbcfcfcfcfcfcbahabcfcfcfcfcfcbahgbcfcfcfcfcfcbahjjcfcfcfcfcfjjahgbcfcfcfcfcfcbahabcfcfcfcfcfcbahgbcfcfcfcfcfcbah      ",
+"        acccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcccjjacccccfcfcfcccjjacccccfcfcfcccagacccccfcfcfcccagacccccfcfcfccc        ",
+"          bfcfcfcfcfeahhhabfcfcfcfcfbahhhabfcfcfcfcfjjhhhabfcfcfcfcfbahhjjbfcfcfcfcfeahhhabfcfcfcfcfbahhhabfcfcfcfcf          ",
+"            bfffffeahhhhhhhabfffffbahhhhhhhabfffffjjhhhhhhhabfffffbahhhhhhjjbfffffeahhhhhhhabfffffbahhhhhhhabfffff            ",
+"              .fiahhhhhhhhhhha.f.ahhhhhhhhhhha.fjjhhhhhhhhhhha.f.ahhhhhhhhhhjj.fiahhhhhhhhhhha.f.ahhhhhhhhhhha.f              ",
+"                .hhhhhhhhhhhhh...hhhhhhhhhhhhhjj.hhhhhhhhhhhhh...hhhhhhhhhhhhhjj.hhhhhhhhhhhhh...hhhhhhhhhhhhh                ",
+"                  ahhhhhhhhhadcccdahhhhhhhhhjjcccdahhhhhhhhhadcccdahhhhhhhhhabccjjahhhhhhhhhadcccdahhhhhhhhh                  ",
+"                    ahhhhhaeccccccceahhhhhjjccccccceahhhhhaeccccccceahhhhhabccccccjjahhhhhaeccccccceahhhhh                    ",
+"                      ahgbcfcfcfcfcfcbahjjcfcfcfcfcfcbahgbcfcfcfcfcfcbahabcfcfcfcfcfjjahgbcfcfcfcfcfcbah                      ",
+"                        acccccfcfcfcccjjacccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcccjjacccccfcfcfccc                        ",
+"                          bfcfcfcfcfjjhhhabfcfcfcfcfbahhhabfcfcfcfcfeahhhabfcfcfcfcfbahhjjbfcfcfcfcf                          ",
+"                            bfffffjjhhhhhhhabfffffbahhhhhhhabfffffeahhhhhhhabfffffbahhhhhhjjbfffff                            ",
+"                              .fjjhhhhhhhhhhha.f.ahhhhhhhhhhha.fiahhhhhhhhhhha.f.ahhhhhhhhhhjj.f                              ",
+"                              ..jjhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhjj..                              ",
+"                            abcccdjjhhhhhhhhadcccdahhhhhhhhhabcccdahhhhhhhhhadcccdahhhhhhhjjabcccd                            ",
+"                          abcccccccejjhhhhaeccccccceahhhhhabccccccceahhhhhaeccccccceahhhjjabccccccce                          ",
+"                        abcfcfcfcfcfcbjjgbcfcfcfcfcfcbahabcfcfcfcfcfcbahgbcfcfcfcfcfcbjjabcfcfcfcfcfcb                        ",
+"                      agacccccfcfcfcccagjjccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcjjagacccccfcfcfcccag                      ",
+"                    eahhhabfcfcfcfcfbahhhajjcfcfcfcfeahhhabfcfcfcfcfbahhhabfcfcfcfjjeahhhabfcfcfcfcfbahhha                    ",
+"                  eahhhhhhhabfffffbahhhhhhhajjffffeahhhhhhhabfffffbahhhhhhhabfffjjeahhhhhhhabfffffbahhhhhhha                  ",
+"                iahhhhhhhhhhha.f.ahhhhhhhhhhhajjiahhhhhhhhhhha.f.ahhhhhhhhhhhajjiahhhhhhhhhhha.f.ahhhhhhhhhhha                ",
+"              ...hhhhhhhhhhhhh...hhhhhhhhhhhhh..jjhhhhhhhhhhhh...hhhhhhhhhhhjj...hhhhhhhhhhhhh...hhhhhhhhhhhhh..              ",
+"            abcccdahhhhhhhhhadcccdahhhhhhhhhabcccdjjhhhhhhhhadcccdahhhhhhhjjabcccdahhhhhhhhhadcccdahhhhhhhhhabcccd            ",
+"          abccccccceahhhhhaeccccccceahhhhhabcccccccejjhhhhaeccccccceahhhjjabccccccceahhhhhaeccccccceahhhhhabccccccce          ",
+"        abcfcfcfcfcfcbahgbcfcfcfcfcfcbahabcfcfcfcfcfcbjjgbcfcfcfcfcfcbjjabcfcfcfcfcfcbahgbcfcfcfcfcfcbahabcfcfcfcfcfcb        ",
+"      agacccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcccagjjccccfcfcfcjjagacccccfcfcfcccagacccccfcfcfcccagacccccfcfcfcccag      ",
+"    eahhhabfcfcfcfcfbahhhabfcfcfcfcfeahhhabfcfcfcfcfbahhhajjcfcfcfjjeahhhabfcfcfcfcfbahhhabfcfcfcfcfeahhhabfcfcfcfcfbahhha    ",
+"  eahhhhhhhabfffffbahhhhhhhabfffffeahhhhhhhabfffffbahhhhhhhajjffjjeahhhhhhhabfffffbahhhhhhhabfffffeahhhhhhhabfffffbahhhhhhha  ",
+"iahhhhhhhhhhha.f.ahhhhhhhhhhha.fiahhhhhhhhhhha.f.ahhhhhhhhhhhajjiahhhhhhhhhhha.f.ahhhhhhhhhhha.fiahhhhhhhhhhha.f.ahhhhhhhhhhha",
+".hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh  .hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh...hhhhhhhhhhhhh",
+"  ahhhhhhhhhadcccdahhhhhhhhhabcccdahhhhhhhhhadcccdahhhhhhhhh      ahhhhhhhhhadcccdahhhhhhhhhabcccdahhhhhhhhhadcccdahhhhhhhhh  ",
+"    ahhhhhaeccccccceahhhhhabccccccceahhhhhaeccccccceahhhhh          ahhhhhaeccccccceahhhhhabccccccceahhhhhaeccccccceahhhhh    ",
+"      ahgbcfcfcfcfcfcbahabcfcfcfcfcfcbahgbcfcfcfcfcfcbah              ahgbcfcfcfcfcfcbahabcfcfcfcfcfcbahgbcfcfcfcfcfcbah      ",
+"        acccccfcfcfcccagacccccfcfcfcccagacccccfcfcfccc                  acccccfcfcfcccagacccccfcfcfcccagacccccfcfcfccc        ",
+"          bfcfcfcfcfeahhhabfcfcfcfcfbahhhabfcfcfcfcf                      bfcfcfcfcfeahhhabfcfcfcfcfbahhhabfcfcfcfcf          ",
+"            bfffffeahhhhhhhabfffffbahhhhhhhabfffff                          bfffffeahhhhhhhabfffffbahhhhhhhabfffff            ",
+"              .fiahhhhhhhhhhha.f.ahhhhhhhhhhha.f                              .fiahhhhhhhhhhha.f.ahhhhhhhhhhha.f              ",
+"                .hhhhhhhhhhhhh...hhhhhhhhhhhhh                                  .hhhhhhhhhhhhh...hhhhhhhhhhhhh                ",
+"                  ahhhhhhhhhadcccdahhhhhhhhh                                      ahhhhhhhhhadcccdahhhhhhhhh                  ",
+"                    ahhhhhaeccccccceahhhhh                                          ahhhhhaeccccccceahhhhh                    ",
+"                      ahgbcfcfcfcfcfcbah                                              ahgbcfcfcfcfcfcbah                      ",
+"                        acccccfcfcfccc                                                  acccccfcfcfccc                        ",
+"                          bfcfcfcfcf                                                      bfcfcfcfcf                          ",
+"                            bfffff                                                          bfffff                            ",
+"                              .f                                                              .f                              "
+};
old mode 100755 (executable)
new mode 100644 (file)
index 5518315..bff6d07
-/*\r
-Copyright (c) 2009 Peter "Corsix" Cawley\r
-\r
-Permission is hereby granted, free of charge, to any person obtaining a copy of\r
-this software and associated documentation files (the "Software"), to deal in\r
-the Software without restriction, including without limitation the rights to\r
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
-of the Software, and to permit persons to whom the Software is furnished to do\r
-so, subject to the following conditions:\r
-\r
-The above copyright notice and this permission notice shall be included in all\r
-copies or substantial portions of the Software.\r
-\r
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
-SOFTWARE.\r
-*/\r
-\r
-#include "frmMain.h"\r
-#include <wx/radiobut.h>\r
-#include <wx/sizer.h>\r
-#include <wx/stattext.h>\r
-#include <wx/filename.h>\r
-#include <wx/msgdlg.h>\r
-#include <wx/numdlg.h>\r
-#include <wx/dcclient.h>\r
-#include <wx/dcmemory.h>\r
-#include <wx/dirdlg.h>\r
-#include <wx/image.h>\r
-#include <wx/bitmap.h>\r
-#include <wx/wfstream.h>\r
-#include <wx/dir.h>\r
-#include <wx/tokenzr.h>\r
-#include "backdrop.h"\r
-#include "tinyxml.h"\r
-\r
-BEGIN_EVENT_TABLE(frmMain, wxFrame)\r
-  EVT_BUTTON(ID_LOAD      , frmMain::_onLoad)\r
-  EVT_BUTTON(ID_BROWSE    , frmMain::_onBrowse)\r
-  EVT_BUTTON(ID_EXPORT    , frmMain::_onExport)\r
-  EVT_BUTTON(ID_FIRST_ANIM, frmMain::_onFirstAnim)\r
-  EVT_BUTTON(ID_PREV_ANIM , frmMain::_onPrevAnim)\r
-  EVT_BUTTON(ID_NEXT_ANIM , frmMain::_onNextAnim)\r
-  EVT_BUTTON(ID_LAST_ANIM , frmMain::_onLastAnim)\r
-  EVT_BUTTON(ID_PREV_FRAME, frmMain::_onPrevFrame)\r
-  EVT_BUTTON(ID_NEXT_FRAME, frmMain::_onNextFrame)\r
-  EVT_BUTTON(ID_PLAY_PAUSE, frmMain::_onPlayPause)\r
-  EVT_BUTTON(ID_SEARCH_LAYER_ID, frmMain::_onSearchLayerId)\r
-  EVT_BUTTON(ID_SEARCH_FRAME, frmMain::_onSearchFrame)\r
-  EVT_BUTTON(ID_SEARCH_SOUND, frmMain::_onSearchSoundIndex)\r
-  EVT_LISTBOX(ID_SEARCH_RESULTS, frmMain::_onGotoSearchResult)\r
-  EVT_RADIOBUTTON(ID_GHOST_0, frmMain::_onGhostFileChange)\r
-  EVT_RADIOBUTTON(ID_GHOST_1, frmMain::_onGhostFileChange)\r
-  EVT_RADIOBUTTON(ID_GHOST_2, frmMain::_onGhostFileChange)\r
-  EVT_RADIOBUTTON(ID_GHOST_3, frmMain::_onGhostFileChange)\r
-  EVT_SPINCTRL(wxID_ANY, frmMain::_onGhostIndexChange)\r
-  EVT_TEXT(ID_ANIM_INDEX, frmMain::_onAnimChar)\r
-  EVT_TIMER(ID_TIMER_ANIMATE, frmMain::_onTimer)\r
-  EVT_CHECKBOX(ID_DRAW_MOOD, frmMain::_onToggleDrawMood)\r
-  EVT_CHECKBOX(ID_DRAW_COORDINATES, frmMain::_onToggleDrawCoordinates)\r
-END_EVENT_TABLE()\r
-\r
-frmMain::frmMain()\r
-  : wxFrame(NULL, wxID_ANY, L"Theme Hospital Animation Viewer")\r
-{\r
-    wxSizer* pMainSizer = new wxBoxSizer(wxHORIZONTAL);\r
-\r
-    wxSizer* pSidebarSizer = new wxBoxSizer(wxVERTICAL);\r
-\r
-#define def wxDefaultPosition, wxDefaultSize\r
-    wxStaticBoxSizer *pThemeHospital = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Theme Hospital");\r
-    pThemeHospital->Add(new wxStaticText(this, wxID_ANY, L"Directory:"), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pThemeHospital->Add(m_txtTHPath = new wxTextCtrl(this, wxID_ANY, L"", def, wxTE_CENTRE), 1, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pThemeHospital->Add(new wxButton(this, ID_BROWSE, L"Browse..."), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pThemeHospital->Add(new wxButton(this, ID_LOAD, L"Load"), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pThemeHospital->Add(m_btnExport = new wxButton(this, ID_EXPORT, L"Export"), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pSidebarSizer->Add(pThemeHospital, 0, wxEXPAND | wxALL, 0);\r
-\r
-    wxStaticBoxSizer *pPalette = new wxStaticBoxSizer(wxVERTICAL, this, L"Palette");\r
-    wxBoxSizer *pPaletteTop = new wxBoxSizer(wxHORIZONTAL);\r
-    pPaletteTop->Add(new wxRadioButton(this, ID_GHOST_0, L"Standard"), 1);\r
-    pPaletteTop->Add(new wxRadioButton(this, ID_GHOST_1, L"Ghost 1"), 1);\r
-    pPaletteTop->Add(new wxRadioButton(this, ID_GHOST_2, L"Ghost 2"), 1);\r
-    pPaletteTop->Add(new wxRadioButton(this, ID_GHOST_3, L"Ghost 66"), 1);\r
-    m_iGhostFile = 0;\r
-    m_iGhostIndex = 0;\r
-    pPalette->Add(pPaletteTop, 0, wxEXPAND | wxALL, 1);\r
-    pPalette->Add(new wxSpinCtrl(this, wxID_ANY, wxEmptyString, def, wxSP_ARROW_KEYS | wxSP_WRAP, 0, 255), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pSidebarSizer->Add(pPalette, 0, wxEXPAND | wxALL, 0);\r
-\r
-    wxStaticBoxSizer *pAnimation = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Animation");\r
-    pAnimation->Add(new wxButton(this, ID_FIRST_ANIM, L"<<", def, wxBU_EXACTFIT), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pAnimation->Add(new wxButton(this, ID_PREV_ANIM, L"<", def, wxBU_EXACTFIT), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pAnimation->Add(m_txtAnimIndex = new wxTextCtrl(this, ID_ANIM_INDEX, L"0", def, wxTE_CENTRE), 1, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pAnimation->Add(new wxStaticText(this, wxID_ANY, L"of"), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pAnimation->Add(m_txtAnimCount = new wxTextCtrl(this, wxID_ANY, L"?", def, wxTE_CENTRE | wxTE_READONLY), 1, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pAnimation->Add(new wxButton(this, ID_NEXT_ANIM, L">", def, wxBU_EXACTFIT), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pAnimation->Add(new wxButton(this, ID_LAST_ANIM, L">>", def, wxBU_EXACTFIT), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pSidebarSizer->Add(pAnimation, 0, wxEXPAND | wxALL, 0);\r
-\r
-    wxStaticBoxSizer *pFrame = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Frame");\r
-    pFrame->Add(new wxButton(this, ID_PREV_FRAME, L"<", def, wxBU_EXACTFIT), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pFrame->Add(m_txtFrameIndex = new wxTextCtrl(this, wxID_ANY, L"0", def, wxTE_CENTRE), 1, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pFrame->Add(new wxStaticText(this, wxID_ANY, L"of", def, wxALIGN_CENTRE), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pFrame->Add(m_txtFrameCount = new wxTextCtrl(this, wxID_ANY, L"?", def, wxTE_CENTRE | wxTE_READONLY), 1, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pFrame->Add(new wxButton(this, ID_NEXT_FRAME, L">", def, wxBU_EXACTFIT), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    pFrame->Add(m_btnPlayPause = new wxButton(this, ID_PLAY_PAUSE, L"Pause"), 1, wxALIGN_CENTER_VERTICAL | wxALL, 1);\r
-    m_bPlayingAnimation = true;\r
-    //m_bPlayingAnimation = false;\r
-    pSidebarSizer->Add(pFrame, 0, wxEXPAND | wxALL, 0);\r
-    \r
-#define ID(layer, id) (ID_LAYER_CHECKS + (layer) * 25 + (id))\r
-    wxStaticBoxSizer *pLayer0 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 0 (Patient Head)");\r
-    pLayer0->Add(new wxCheckBox(this, ID(0,  0), L"0"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer0->Add(new wxCheckBox(this, ID(0,  2), L"2"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer0->Add(new wxCheckBox(this, ID(0,  4), L"4"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer0->Add(new wxCheckBox(this, ID(0,  6), L"6"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer0->Add(new wxCheckBox(this, ID(0,  8), L"8"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer0->Add(new wxCheckBox(this, ID(0, 10), L"10"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer0->Add(new wxCheckBox(this, ID(0, 12), L"12"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer0->Add(new wxCheckBox(this, ID(0, 14), L"14"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer0->Add(new wxCheckBox(this, ID(0, 16), L"16"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer0->Add(new wxCheckBox(this, ID(0, 18), L"18"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer0->Add(new wxCheckBox(this, ID(0, 20), L"20"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer0->Add(new wxCheckBox(this, ID(0, 22), L"22"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pSidebarSizer->Add(pLayer0, 0, wxEXPAND | wxALL, 0);\r
-\r
-    wxStaticBoxSizer *pLayer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 1 (Patient Clothes)");\r
-    pLayer1->Add(new wxCheckBox(this, ID(1, 0), L"0"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer1->Add(new wxCheckBox(this, ID(1, 2), L"2 (A)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer1->Add(new wxCheckBox(this, ID(1, 4), L"4 (B)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer1->Add(new wxCheckBox(this, ID(1, 6), L"6 (C)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer1->Add(new wxCheckBox(this, ID(1, 8), L"8"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer1->Add(new wxCheckBox(this, ID(1, 10), L"10"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pSidebarSizer->Add(pLayer1, 0, wxEXPAND | wxALL, 0);\r
-\r
-    wxStaticBoxSizer *pLayer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 2 (Bandages / Patient Accessory)");\r
-    pLayer2->Add(new wxCheckBox(this, ID(2, 2), L"2 (Head / Alt Shoes)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer2->Add(new wxCheckBox(this, ID(2, 4), L"4 (Arm / Hat)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer2->Add(new wxCheckBox(this, ID(2, 6), L"6"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pSidebarSizer->Add(pLayer2, 0, wxEXPAND | wxALL, 0);\r
-\r
-    wxStaticBoxSizer *pLayer3 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 3 (Bandages / Colour)");\r
-    pLayer3->Add(new wxCheckBox(this, ID(3, 0), L"0"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer3->Add(new wxCheckBox(this, ID(3, 2), L"2 (? / Yellow)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer3->Add(new wxCheckBox(this, ID(3, 4), L"4 (L Foot / Blue)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer3->Add(new wxCheckBox(this, ID(3, 6), L"6 (? / White)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer3->Add(new wxCheckBox(this, ID(3, 8), L"8 (R Arm)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer3->Add(new wxCheckBox(this, ID(3, 10), L"10 (R Foot)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pSidebarSizer->Add(pLayer3, 0, wxEXPAND | wxALL, 0);\r
-\r
-    wxStaticBoxSizer *pLayer4 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 4 (Bandages / Repair)");\r
-    pLayer4->Add(new wxCheckBox(this, ID(4, 0), L"0"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer4->Add(new wxCheckBox(this, ID(4, 2), L"2 (Head / Repair)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer4->Add(new wxCheckBox(this, ID(4, 4), L"4 (L Root)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer4->Add(new wxCheckBox(this, ID(4, 6), L"6"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer4->Add(new wxCheckBox(this, ID(4, 8), L"8 (R Arm)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer4->Add(new wxCheckBox(this, ID(4, 10), L"10 (R Foot)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pSidebarSizer->Add(pLayer4, 0, wxEXPAND | wxALL, 0);\r
-\r
-    wxStaticBoxSizer *pLayer5 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 5 (Staff Head)");\r
-    pLayer5->Add(new wxCheckBox(this, ID(5, 0), L"0"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer5->Add(new wxCheckBox(this, ID(5, 2), L"2 (W1)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer5->Add(new wxCheckBox(this, ID(5, 4), L"4 (B1)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer5->Add(new wxCheckBox(this, ID(5, 6), L"6 (W2)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer5->Add(new wxCheckBox(this, ID(5, 8), L"8 (B2)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer5->Add(new wxCheckBox(this, ID(5, 10), L"10"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pSidebarSizer->Add(pLayer5, 0, wxEXPAND | wxALL, 0);\r
-\r
-    wxStaticBoxSizer *pLayer10 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 10 (Wall Colour / Smoke)");\r
-    pLayer10->Add(new wxCheckBox(this, ID(10, 2), L"2 (Yellow / Smoke)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer10->Add(new wxCheckBox(this, ID(10, 4), L"4 (Blue)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer10->Add(new wxCheckBox(this, ID(10, 6), L"6 (White)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pSidebarSizer->Add(pLayer10, 0, wxEXPAND | wxALL, 0);\r
-\r
-    wxStaticBoxSizer *pLayer11 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 11 (Wall Colour / Smoke / Screen)");\r
-    pLayer11->Add(new wxCheckBox(this, ID(11, 2), L"2 (Yellow / Smoke / On)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer11->Add(new wxCheckBox(this, ID(11, 4), L"4 (Blue)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pLayer11->Add(new wxCheckBox(this, ID(11, 6), L"6 (Green)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pSidebarSizer->Add(pLayer11, 0, wxEXPAND | wxALL, 0);\r
-\r
-    wxStaticBoxSizer *pLayer12 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 12 (Smoke)");\r
-    pLayer12->Add(new wxCheckBox(this, ID(12, 2), L"2 (Smoke)"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pSidebarSizer->Add(pLayer12, 0, wxEXPAND | wxALL, 0);\r
-\r
-    wxStaticBoxSizer *pMoodOverlay = new wxStaticBoxSizer(wxVERTICAL, this, L"Overlays");\r
-    pMoodOverlay->Add(new wxCheckBox(this, ID_DRAW_MOOD, L"Draw mood overlay"), 0, wxEXPAND | wxALL, 1);\r
-    wxBoxSizer *pMoodRow = new wxBoxSizer(wxHORIZONTAL);\r
-    pMoodRow->Add(new wxStaticText(this, wxID_ANY, L"Marker position (click to move it):"), 0, wxEXPAND | wxRIGHT | wxALIGN_CENTER_VERTICAL, 2);\r
-    pMoodRow->Add(m_txtMoodPosition[0] = new wxTextCtrl(this, wxID_ANY, L"{0, 0}"), 1, wxEXPAND | wxRIGHT | wxALIGN_CENTER_VERTICAL, 1);\r
-    pMoodRow->Add(m_txtMoodPosition[1] = new wxTextCtrl(this, wxID_ANY, L"{0, 0, \"px\"}"), 1, wxEXPAND | wxALIGN_CENTER_VERTICAL);\r
-    pMoodOverlay->Add(pMoodRow, 1, wxEXPAND | wxALL, 2);\r
-    pMoodOverlay->Add(new wxCheckBox(this, ID_DRAW_COORDINATES, L"Draw tile coodinates"), 0, wxEXPAND | wxALL, 0);\r
-    pSidebarSizer->Add(pMoodOverlay, 0, wxEXPAND | wxALL, 0);\r
-    m_bDrawMood = false;\r
-    m_bDrawCoordinates = false;\r
-    m_iMoodDrawX = 0;\r
-    m_iMoodDrawY = 0;\r
-\r
-    for(int iLayer = 0; iLayer < 13; ++iLayer)\r
-    {\r
-        wxCheckBox *pCheck = wxDynamicCast(FindWindow(ID(iLayer, 0)), wxCheckBox);\r
-        if(pCheck != NULL)\r
-        {\r
-            pCheck->SetValue(true);\r
-            m_mskLayers.set(iLayer, 0);\r
-        }\r
-    }\r
-\r
-    Connect(ID(0, 0), ID(12, 24), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&frmMain::_onToggleMask);\r
-#undef ID\r
-\r
-    wxStaticBoxSizer *pSearch = new wxStaticBoxSizer(wxVERTICAL, this, L"Search");\r
-    wxBoxSizer *pSearchButtons = new wxBoxSizer(wxHORIZONTAL);\r
-    pSearchButtons->Add(new wxButton(this, ID_SEARCH_LAYER_ID, L"Layer/ID"), 0, wxALL, 1);\r
-    pSearchButtons->Add(new wxButton(this, ID_SEARCH_FRAME, L"Frame"), 0, wxALL, 1);\r
-    pSearchButtons->Add(new wxButton(this, ID_SEARCH_SOUND, L"Sound"), 0, wxALL, 1);\r
-    pSearch->Add(pSearchButtons, 0);\r
-    pSearch->Add(m_lstSearchResults = new wxListBox(this, ID_SEARCH_RESULTS), 1, wxEXPAND | wxALL, 1);\r
-\r
-    wxStaticBoxSizer *pFrameFlags = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Frame Flags");\r
-    wxBoxSizer *pFlags1 = new wxBoxSizer(wxVERTICAL);\r
-    pFlags1->Add(m_txtFrameFlags[0] = new wxTextCtrl(this, wxID_ANY), 0, wxEXPAND | wxALL, 2);\r
-    pFlags1->Add(m_chkFrameFlags[0] = new wxCheckBox(this, wxID_ANY, L"2^0"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags1->Add(m_chkFrameFlags[1] = new wxCheckBox(this, wxID_ANY, L"2^1"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags1->Add(m_chkFrameFlags[2] = new wxCheckBox(this, wxID_ANY, L"2^2"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags1->Add(m_chkFrameFlags[3] = new wxCheckBox(this, wxID_ANY, L"2^3"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags1->Add(m_chkFrameFlags[4] = new wxCheckBox(this, wxID_ANY, L"2^4"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags1->Add(m_chkFrameFlags[5] = new wxCheckBox(this, wxID_ANY, L"2^5"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags1->Add(m_chkFrameFlags[6] = new wxCheckBox(this, wxID_ANY, L"2^6"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags1->Add(m_chkFrameFlags[7] = new wxCheckBox(this, wxID_ANY, L"2^7"), 0, wxEXPAND | wxALL, 2);\r
-    pFrameFlags->Add(pFlags1, 1, wxEXPAND);\r
-    wxBoxSizer *pFlags2 = new wxBoxSizer(wxVERTICAL);\r
-    pFlags2->Add(m_txtFrameFlags[1] = new wxTextCtrl(this, wxID_ANY), 0, wxEXPAND | wxALL, 2);\r
-    pFlags2->Add(m_chkFrameFlags[8] = new wxCheckBox(this, wxID_ANY, L"2^8 (Animation Start)"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags2->Add(m_chkFrameFlags[9] = new wxCheckBox(this, wxID_ANY, L"2^9"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags2->Add(m_chkFrameFlags[10] = new wxCheckBox(this, wxID_ANY, L"2^10"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags2->Add(m_chkFrameFlags[11] = new wxCheckBox(this, wxID_ANY, L"2^11"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags2->Add(m_chkFrameFlags[12] = new wxCheckBox(this, wxID_ANY, L"2^12"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags2->Add(m_chkFrameFlags[13] = new wxCheckBox(this, wxID_ANY, L"2^13"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags2->Add(m_chkFrameFlags[14] = new wxCheckBox(this, wxID_ANY, L"2^14"), 0, wxEXPAND | wxALL, 2);\r
-    pFlags2->Add(m_chkFrameFlags[15] = new wxCheckBox(this, wxID_ANY, L"2^15"), 0, wxEXPAND | wxALL, 2);\r
-    pFrameFlags->Add(pFlags2, 1, wxEXPAND);\r
-\r
-    pMainSizer->Add(pSidebarSizer, 0, wxEXPAND | wxALL, 2);\r
-\r
-    wxSizer* pRightHandSizer = new wxBoxSizer(wxVERTICAL);\r
-    pRightHandSizer->AddSpacer(1);\r
-\r
-    pRightHandSizer->Add(m_panFrame = new wxPanel(this, wxID_ANY, def, wxBORDER_SIMPLE), 0, wxEXPAND | wxALL, 2);\r
-    m_panFrame->Connect(wxEVT_PAINT, (wxObjectEventFunction)&frmMain::_onPanelPaint, NULL, this);\r
-    m_panFrame->Connect(wxEVT_LEFT_UP, (wxObjectEventFunction)&frmMain::_onPanelClick, NULL, this);\r
-    m_panFrame->SetMinSize(m_panFrame->ClientToWindowSize(wxSize(402, 402)));\r
-\r
-    pRightHandSizer->AddSpacer(1);\r
-    pRightHandSizer->Add(pSearch, 1, wxEXPAND | wxALL, 0);\r
-    pRightHandSizer->Add(pFrameFlags, 0, wxEXPAND | wxALL, 0);\r
-    pMainSizer->Add(pRightHandSizer, 1, wxEXPAND | wxALL, 0);\r
-\r
-    SetBackgroundColour(m_btnPlayPause->GetBackgroundColour());\r
-    SetSizer(pMainSizer);\r
-    \r
-    SetMinSize(ClientToWindowSize(pMainSizer->CalcMin()));\r
-    SetSize(GetMinSize());\r
-\r
-    load();\r
-\r
-    m_tmrAnimate.SetOwner(this, ID_TIMER_ANIMATE);\r
-    m_tmrAnimate.Start(100);\r
-}\r
-\r
-void frmMain::_onBrowse(wxCommandEvent& WXUNUSED(evt))\r
-{\r
-    m_txtTHPath->SetValue(::wxDirSelector(L"Choose Theme Hospital root folder",\r
-        m_txtTHPath->GetValue(), 0, wxDefaultPosition, this));\r
-}\r
-\r
-void frmMain::_onLoad(wxCommandEvent& WXUNUSED(evt))\r
-{\r
-    ::wxInitAllImageHandlers();\r
-    load();\r
-}\r
-\r
-void frmMain::_onExport(wxCommandEvent& WXUNUSED(evt))\r
-{\r
-    m_tmrAnimate.Stop();\r
-    ::wxInitAllImageHandlers();\r
-    export_png();\r
-}\r
-\r
-void frmMain::load()\r
-{\r
-    wxBusyCursor oBusy;\r
-    wxString sPath = m_txtTHPath->GetValue();\r
-    if(sPath.IsEmpty())\r
-        return;\r
-    if(sPath.Mid(sPath.Len() - 1) != wxFileName::GetPathSeparator())\r
-    {\r
-        sPath += wxFileName::GetPathSeparator();\r
-    }\r
-    if(!wxFileName::DirExists(sPath))\r
-    {\r
-        ::wxMessageBox(L"Theme Hospital path non-existant", L"Load Animations", wxOK | wxICON_ERROR, this);\r
-        return;\r
-    }\r
-    sPath = _getCaseSensitivePath(L"DATA", sPath);\r
-    sPath += wxFileName::GetPathSeparator();\r
-    wxString aPath = _getCaseSensitivePath(L"VSPR-0", sPath);\r
-    aPath += wxFileName::GetPathSeparator();\r
-    m_oAnims.setSpritePath(aPath);\r
-\r
-    bool bXmlLoaded = false;\r
-    wxString xmlFile = _getCaseSensitivePath(L"VSPR-0.xml", sPath);\r
-    TiXmlDocument xmlDocument((const char*)xmlFile.mb_str());\r
-    if(wxFileName::FileExists(xmlFile) && xmlDocument.LoadFile())\r
-    {\r
-        m_oAnims.loadXMLFile(&xmlDocument);\r
-        m_oAnims.loadPaletteFile(_getCaseSensitivePath(L"MPALETTE.DAT", sPath));\r
-        m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST1.DAT", sPath), 1);\r
-        m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST2.DAT", sPath), 2);\r
-        m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST66.DAT", sPath), 3);\r
-        bXmlLoaded = true;\r
-        m_btnExport->Disable();\r
-    }\r
-    else if(!m_oAnims.loadAnimationFile(_getCaseSensitivePath(L"VSTART-1.ANI", sPath))\r
-      ||!m_oAnims.loadFrameFile(_getCaseSensitivePath(L"VFRA-1.ANI", sPath))\r
-     ||!m_oAnims.loadListFile(_getCaseSensitivePath(L"VLIST-1.ANI", sPath))\r
-     ||!m_oAnims.loadElementFile(_getCaseSensitivePath(L"VELE-1.ANI", sPath))\r
-     ||!m_oAnims.loadTableFile(_getCaseSensitivePath(L"VSPR-0.TAB", sPath))\r
-     ||!m_oAnims.loadSpriteFile(_getCaseSensitivePath(L"VSPR-0.DAT", sPath))\r
-     ||!m_oAnims.loadPaletteFile(_getCaseSensitivePath(L"MPALETTE.DAT", sPath))\r
-     ||!m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST1.DAT", sPath), 1)\r
-     ||!m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST2.DAT", sPath), 2)\r
-     ||!m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST66.DAT", sPath), 3))\r
-    {\r
-        ::wxMessageBox(L"Cannot load one or more data files", L"Load Animations", wxOK | wxICON_ERROR, this);\r
-    }\r
-    if(!bXmlLoaded) { m_oAnims.markDuplicates(); }\r
-\r
-    m_txtAnimCount->SetValue(wxString::Format(L"%u", (int)m_oAnims.getAnimationCount()));\r
-\r
-    m_imgBackground.Create(400, 400);\r
-    {\r
-        unsigned char* pData = m_imgBackground.GetData();\r
-        unsigned char cPrimary = 0xFF;\r
-        unsigned char cSecondary = 0xE0;\r
-        for(int y = 0; y < 400; ++y)\r
-        {\r
-            for(int x = 0; x < 400; x += 8)\r
-            {\r
-                memset(pData, cPrimary  , 4 * 3);\r
-                pData += 4 * 3;\r
-                memset(pData, cSecondary, 4 * 3);\r
-                pData += 4 * 3;\r
-            }\r
-            if(y % 4 == 3)\r
-            {\r
-                cPrimary ^= cSecondary;\r
-                cSecondary ^= cPrimary;\r
-                cPrimary ^= cSecondary;\r
-            }\r
-        }\r
-        wxBitmap bmpBackdrop(backdrop_xpm);\r
-        wxBitmap bmpBackground(m_imgBackground);\r
-        {\r
-            wxMemoryDC dcBlit;\r
-            dcBlit.SelectObject(bmpBackground);\r
-            dcBlit.DrawBitmap(bmpBackdrop, 78, 170, true);\r
-        }\r
-        m_imgBackground = bmpBackground.ConvertToImage();\r
-    }\r
-\r
-    _onAnimChange(0);\r
-}\r
-\r
-void frmMain::export_png()\r
-{\r
-    wxBusyCursor oBusy;\r
-    wxString sPath = m_txtTHPath->GetValue();\r
-    if(sPath.IsEmpty())\r
-        return;\r
-    if(sPath.Mid(sPath.Len() - 1) != wxFileName::GetPathSeparator())\r
-    {\r
-        sPath += wxFileName::GetPathSeparator();\r
-    }\r
-    if(!wxFileName::DirExists(sPath))\r
-    {\r
-        ::wxMessageBox(L"Theme Hospital path non-existant", L"Load Animations", wxOK | wxICON_ERROR, this);\r
-        return;\r
-    }\r
-    wxString sdPath = _getCaseSensitivePath(L"DATA", sPath);\r
-    sdPath += wxFileName::GetPathSeparator();\r
-\r
-    //wxDialog warnDialog(this, wxID_ANY, L"Export Warning");\r
-    //warnDialog::CreateButtonSizer(wxOK|wxCANCEL);\r
-    bool bWriteFrames = false;\r
-    int response = ::wxMessageBox(L"If you click Yes, the export process will write animation frames \n \\r
-in separate folders and will run for about 20 minutes, and will create about 18,000 files on \n \\r
-your hard disk (~250MB). \n If you click No, it will write the XML and element files only. This will create \n \\r
-2,950 files (~80MB) and is everything you need to modify graphics. As long as the XML file is present in \n \\r
-the DATA folder, the Animation Viewer will use PNG sprites instead of Theme Hospital data files.",\r
-        L"Export Warning", wxYES_NO | wxCANCEL);\r
-    if( response == wxYES) { bWriteFrames = true; }\r
-    if( response != wxCANCEL) \r
-    {\r
-        //Start with animations, then move on to sprite sheets (map tiles)\r
-        if(!m_oAnims.loadAnimationFile(_getCaseSensitivePath(L"VSTART-1.ANI", sdPath))\r
-         ||!m_oAnims.loadFrameFile(_getCaseSensitivePath(L"VFRA-1.ANI", sdPath))\r
-         ||!m_oAnims.loadListFile(_getCaseSensitivePath(L"VLIST-1.ANI", sdPath))\r
-         ||!m_oAnims.loadElementFile(_getCaseSensitivePath(L"VELE-1.ANI", sdPath))\r
-         ||!m_oAnims.loadTableFile(_getCaseSensitivePath(L"VSPR-0.TAB", sdPath))\r
-         ||!m_oAnims.loadSpriteFile(_getCaseSensitivePath(L"VSPR-0.DAT",sdPath))\r
-         ||!m_oAnims.loadPaletteFile(_getCaseSensitivePath(L"MPALETTE.DAT", sdPath))\r
-         ||!m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST1.DAT", sdPath), 1)\r
-         ||!m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST2.DAT", sdPath), 2)\r
-         ||!m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST66.DAT", sdPath), 3))\r
-        {\r
-            ::wxMessageBox(L"Cannot load one or more data files", L"Load Animations", wxOK | wxICON_ERROR, this);\r
-        }\r
-        m_oAnims.markDuplicates();\r
-        wxString aPath = _getCaseSensitivePath(L"VSPR-0", sdPath);\r
-        aPath += wxFileName::GetPathSeparator();\r
-        if(!wxFileName::DirExists(aPath))\r
-        {\r
-            wxFileName::Mkdir(aPath);\r
-        }\r
-        size_t iExportCount = m_oAnims.getAnimationCount();\r
-        wxFile f(_getCaseSensitivePath(L"VSPR-0export.log", sdPath), wxFile::write_append);\r
-        wxFileOutputStream fos(f);\r
-        wxTextOutputStream outputLog(fos);\r
-        outputLog.WriteString(wxString::Format(L"File\tIndex\tFrame\tLayer\tID\tWidth\tHeight\tUnknown\n"));\r
-        m_oAnims.writeTableDataHeader(&outputLog);\r
-        wxFile fxml(_getCaseSensitivePath(L"VSPR-0.xml", sdPath), wxFile::write);\r
-        wxFileOutputStream fosxml(fxml);\r
-        wxTextOutputStream outputXml(fosxml);\r
-        outputXml.WriteString(wxString::Format(L"<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>\n"));\r
-        outputXml.WriteString(wxString::Format(L"<theme_hospital_graphics scale_factor='1'>\n"));\r
-    \r
-        int iAnimationCount = 0;\r
-        int iFrameCountTotal = 1;\r
-        int iElementCount = 0;\r
-        int iSpriteCount = 0;\r
-        int iListIndex = 0;\r
-        for(size_t iAnimation = 0; iAnimation < iExportCount; ++iAnimation)\r
-        {\r
-            if(!m_oAnims.isAnimationDuplicate(iAnimation) && m_oAnims.getFrameField(iAnimation) >= iFrameCountTotal)\r
-            {\r
-                wxString aiPath = aPath + wxString::Format(L"a%04u", iAnimation);\r
-                if(!wxFileName::DirExists(aiPath))\r
-                {\r
-                    wxFileName::Mkdir(aiPath);\r
-                }\r
-                outputXml.WriteString(wxString::Format(L"<an id='%u' fr='%u' un='%u'>\n", \r
-                    iAnimation, m_oAnims.getFrameField(iAnimation), m_oAnims.getUnknownField(iAnimation)));\r
-                aiPath += wxFileName::GetPathSeparator();\r
-                size_t iFrameCount = m_oAnims.getFrameCount(iAnimation);\r
-                for(size_t iFrame = 0; iFrame < iFrameCount; ++iFrame)\r
-                {\r
-                    wxImage imgCanvas;\r
-                    th_frame_t* pFrame = m_oAnims.getFrameStruct(iAnimation,iFrame);\r
-                    outputXml.WriteString(wxString::Format(L"\t<fr id='%u' li='%u' w='%u' h='%u' fl='%u' nx='%u'>\n", \r
-                        iFrameCountTotal, iListIndex, pFrame->width, pFrame->height, pFrame->flags, pFrame->next));\r
-\r
-                    wxSize oSize;\r
-                    m_oAnims.writeElementData(aPath, &outputLog, &outputXml, iAnimation, iFrame, &m_mskLayers, oSize, &iListIndex);\r
-\r
-                    if( bWriteFrames && oSize.x > 0 && oSize.y > 0 )\r
-                    {\r
-                        if(!imgCanvas.IsOk())\r
-                        {\r
-                            imgCanvas.Create(oSize.x, oSize.y, true);\r
-                            if(!imgCanvas.HasAlpha())\r
-                            {\r
-                                imgCanvas.SetAlpha();\r
-                            }\r
-                            for(int iX = 0; iX < oSize.x; ++iX)\r
-                            {\r
-                                for(int iY = 0; iY < oSize.y; ++iY)\r
-                                {\r
-                                    //set completely transparent\r
-                                    imgCanvas.SetAlpha(iX,iY,(unsigned char)0);\r
-                                }\r
-                            }\r
-                        }\r
-\r
-                        m_oAnims.drawFrame(imgCanvas, iAnimation, iFrame, &m_mskLayers, oSize, 0, 0);\r
-                        outputLog.WriteString(wxString::Format(L"%s\t%u\t%u\t%u\t%u\t%u\n", L"VSPR-0", iAnimation, iFrame, \r
-                                oSize.x, oSize.y, m_oAnims.getUnknownField(iAnimation)));\r
-                    }\r
-\r
-                    outputXml.WriteString(wxString::Format(L"\t</fr>\n"));\r
-                    iFrameCountTotal++;\r
-\r
-                    if( bWriteFrames && imgCanvas.IsOk() )\r
-                    {\r
-                        if(!imgCanvas.SaveFile(aiPath + wxString::Format(L"a%u_f%u.png", iAnimation, iFrame),wxBITMAP_TYPE_PNG))\r
-                            return;\r
-                        imgCanvas.Destroy();\r
-                    }\r
-                }\r
-                outputXml.WriteString(wxString::Format(L"</an>\n"));\r
-                iAnimationCount++;\r
-            }\r
-        }\r
-        //outputXml.WriteString(wxString::Format(L"\t<graphics_totals animations='%u' frames='%u' elements='%u' sprites='%u'>\n", \r
-        //    iAnimationCount, iFrameCount, iElementCount, iSpriteCount));\r
-        outputXml.WriteString(wxString::Format(L"</theme_hospital_graphics>\n"));\r
-\r
-        //Sprite sheet code for Data directory\r
-        exportSpritesPage(false, sdPath, L"MONEY01V");\r
-        exportSpritesPage(false, sdPath, L"MPOINTER");\r
-        exportSpritesPage(true, sdPath, L"PANEL02V");\r
-        exportSpritesPage(true, sdPath, L"PANEL04V");\r
-        exportSpritesPage(true, sdPath, L"PULLDV");\r
-        exportSpritesPage(false, sdPath, L"VBLK-0");\r
-        exportSpritesPage(true, sdPath, L"WATCH01V");\r
-        //Skip DataM directory because it appears to be low-res versions of same\r
-\r
-        //Sprite sheet code for QData directory \r
-        wxString sqPath = _getCaseSensitivePath(L"QDATA", sPath);\r
-        sqPath += wxFileName::GetPathSeparator();\r
-        exportSpritesPage(true, sqPath, L"AWARD03V", L"", L"AWARD02V.PAL");\r
-        exportSpritesPage(true, sqPath, L"BANK02V", L"", L"BANK01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"DRUGN02V", L"", L"DRUGN01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"FAME02V", L"", L"FAME01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"FAX02V", L"", L"FAX01V.PAL");\r
-        exportSpritesPage(false, sqPath, L"FONT00V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT01V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT02V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT04V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT05V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT09V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT16V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT18V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT19V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT24V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT25V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT26V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT31V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT34V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT35V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT36V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT37V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT38V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT39V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT40V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT43V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT44V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT45V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT46V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT47V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT50V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT51V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT60V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT74V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT100V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT101V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT102V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT105V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT106V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT110V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT111V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT112V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT113V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT115V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT120V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT121V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT122V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT124V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT250V", sdPath);\r
-        exportSpritesPage(false, sqPath, L"FONT502V", sdPath);\r
-        exportSpritesPage(true, sqPath, L"GRAPH02V", L"", L"GRAPH01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"LETTR02V", L"", L"REP01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"LOAD02V", L"", L"LOAD01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"MAIN02M", L"", L"MAIN01M.PAL");\r
-        exportSpritesPage(true, sqPath, L"POL02V", L"", L"POL01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"PREF02V", L"", L"PREF01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"REP02V", L"", L"REP01V.PAL");\r
-        //exportSpritesPage(true, sqPath, L"REQ00V", sdPath);\r
-        //exportSpritesPage(true, sqPath, L"REQ01V", sdPath);\r
-        //exportSpritesPage(true, sqPath, L"REQ02V", sdPath);\r
-        //exportSpritesPage(true, sqPath, L"REQ03V", sdPath);\r
-        //exportSpritesPage(true, sqPath, L"REQ04V", sdPath);\r
-        //exportSpritesPage(true, sqPath, L"REQ05V", sdPath);\r
-        //exportSpritesPage(true, sqPath, L"REQ06V", sdPath);\r
-        //exportSpritesPage(true, sqPath, L"REQ09V", sdPath);\r
-        //exportSpritesPage(true, sqPath, L"REQ10V", sdPath);\r
-        //exportSpritesPage(true, sqPath, L"REQ11V", sdPath);\r
-        //exportSpritesPage(true, sqPath, L"REQ12V", sdPath);\r
-        //exportSpritesPage(true, sqPath, L"REQ13V", sdPath);\r
-        exportSpritesPage(true, sqPath, L"RES02V", L"", L"RES01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"REP02V", L"", L"REP01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"SPOINTER", sdPath);\r
-        exportSpritesPage(true, sqPath, L"STAFF02V", L"", L"STAFF01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"STAT02V", L"", L"STAT01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"TOWN02V", L"", L"TOWN01V.PAL");\r
-        exportSpritesPage(true, sqPath, L"VER00V", L"", L"REP01V.PAL");\r
-    }\r
-}\r
-\r
-void frmMain::exportSpritesPage(bool bComplex, wxString sPath, wxString sFilename, wxString spPath, wxString sPalette)\r
-{\r
-    if(spPath.length() == 0) \r
-    {\r
-        spPath = sPath;\r
-    }\r
-    if(!m_oAnims.loadTableFile(_getCaseSensitivePath(wxString::Format(L"%s.TAB",sFilename.wx_str()), sPath))\r
-     ||!m_oAnims.loadSpriteFile(_getCaseSensitivePath(wxString::Format(L"%s.DAT",sFilename.wx_str()), sPath))\r
-     ||!m_oAnims.loadPaletteFile(_getCaseSensitivePath(sPalette, spPath)))\r
-    {\r
-        return;\r
-    }\r
-\r
-    wxFile f(_getCaseSensitivePath(sFilename + L"export.log", sPath), wxFile::write);\r
-    wxFileOutputStream fos(f);\r
-    wxTextOutputStream outputLog(fos);\r
-    outputLog.WriteString(wxString::Format(L"File\tIndex\tPalette\tComplex\tWidth\tHeight\n"));\r
-\r
-    wxString aPath = _getCaseSensitivePath(sFilename, sPath);\r
-    aPath += wxFileName::GetPathSeparator();\r
-    if(!wxFileName::DirExists(aPath))\r
-    {\r
-        wxFileName::Mkdir(aPath);\r
-        for(size_t i = 0; i < m_oAnims.getSpriteCount(); ++i)\r
-        {\r
-            Bitmap* pSpriteBitmap = m_oAnims.getSpriteBitmap(i, bComplex);\r
-            if(pSpriteBitmap->getWidth() * pSpriteBitmap->getHeight() > 0)\r
-            {\r
-                wxImage imgSprite(pSpriteBitmap->getWidth(), pSpriteBitmap->getHeight(), false);\r
-                pSpriteBitmap->blit(imgSprite, 0, 0, NULL, m_oAnims.getPalette(), 0x8000);\r
-                if(!imgSprite.HasAlpha())\r
-                {\r
-                    imgSprite.SetAlpha();\r
-                }\r
-                for(int iX = 0; iX < pSpriteBitmap->getWidth(); ++iX)\r
-                {\r
-                    for(int iY = 0; iY < pSpriteBitmap->getHeight(); ++iY)\r
-                    {\r
-                        if(imgSprite.GetRed(iX,iY) == 255 && imgSprite.GetBlue(iX,iY) == 255) {\r
-                            imgSprite.SetAlpha(iX,iY,(unsigned char)0);\r
-                        } else {\r
-                            imgSprite.SetAlpha(iX,iY,(unsigned char)255);\r
-                        }\r
-                    }\r
-                }\r
-                if(!imgSprite.SaveFile(_getCaseSensitivePath(wxString::Format(L"s%u.png", i), aPath),wxBITMAP_TYPE_PNG))\r
-                    return;\r
-                outputLog.WriteString(wxString::Format(L"%s\t%u\t%s\t%u\t%u\n", sFilename.wx_str(), i, sPalette.wx_str(), pSpriteBitmap->getWidth(),pSpriteBitmap->getHeight()));\r
-            }\r
-        }\r
-    }\r
-}\r
-\r
-void frmMain::_onToggleMask(wxCommandEvent& evt)\r
-{\r
-    int iID = evt.GetId() - ID_LAYER_CHECKS;\r
-    int iLayer = iID / 25;\r
-    iID %= 25;\r
-    \r
-    if(evt.IsChecked())\r
-        m_mskLayers.set(iLayer, iID);\r
-    else\r
-        m_mskLayers.clear(iLayer, iID);\r
-\r
-    m_panFrame->Refresh(false);\r
-}\r
-\r
-frmMain::~frmMain()\r
-{\r
-}\r
-\r
-void frmMain::_onFirstAnim(wxCommandEvent& evt)\r
-{\r
-    if(m_iCurrentAnim > 0)\r
-        _onAnimChange(0);\r
-}\r
-\r
-void frmMain::_onPrevAnim(wxCommandEvent& evt)\r
-{\r
-    size_t iAnim = m_iCurrentAnim;\r
-    while(iAnim > 0)\r
-    {\r
-        --iAnim;\r
-        if(!m_oAnims.isAnimationDuplicate(iAnim))\r
-        {\r
-            _onAnimChange(iAnim);\r
-            break;\r
-        }\r
-    }\r
-}\r
-\r
-void frmMain::_onNextAnim(wxCommandEvent& evt)\r
-{\r
-    size_t iAnim = m_iCurrentAnim + 1;\r
-    while(iAnim < m_oAnims.getAnimationCount())\r
-    {\r
-        if(!m_oAnims.isAnimationDuplicate(iAnim))\r
-        {\r
-            _onAnimChange(iAnim);\r
-            break;\r
-        }\r
-        iAnim++;\r
-    }\r
-}\r
-\r
-void frmMain::_onLastAnim(wxCommandEvent& evt)\r
-{\r
-    if(m_iCurrentAnim < m_oAnims.getAnimationCount() - 1)\r
-        _onAnimChange(m_oAnims.getAnimationCount() - 1);\r
-}\r
-\r
-void frmMain::_onAnimChar(wxCommandEvent& evt)\r
-{\r
-    long iAnim;\r
-    if(evt.GetString().ToLong(&iAnim))\r
-    {\r
-        if(iAnim >= 0 && iAnim < (long)m_oAnims.getAnimationCount())\r
-        {\r
-            _onAnimChange((size_t)iAnim);\r
-        }\r
-    }\r
-}\r
-\r
-void frmMain::_onGhostFileChange(wxCommandEvent& evt)\r
-{\r
-    m_iGhostFile = evt.GetId() - ID_GHOST_0;\r
-    m_oAnims.setGhost(m_iGhostFile, m_iGhostIndex);\r
-    m_panFrame->Refresh(false);\r
-}\r
-\r
-void frmMain::_onGhostIndexChange(wxSpinEvent& evt)\r
-{\r
-    m_iGhostIndex = evt.GetPosition();\r
-    m_oAnims.setGhost(m_iGhostFile, m_iGhostIndex);\r
-    m_panFrame->Refresh(false);\r
-}\r
-\r
-void frmMain::_onAnimChange(size_t iIndex)\r
-{\r
-    m_iCurrentAnim = iIndex;\r
-    m_txtAnimIndex->ChangeValue(wxString::Format(L"%u", (int)iIndex));\r
-    m_iCurrentFrame = 0;\r
-\r
-    THLayerMask oMask;\r
-    m_oAnims.getAnimationMask(iIndex, oMask);\r
-    for(int iLayer = 0; iLayer < 13; ++iLayer)\r
-    {\r
-        for(int iId = 0; iId < 32; ++iId)\r
-        {\r
-            wxCheckBox *pCheck = wxDynamicCast(FindWindow(ID_LAYER_CHECKS + iLayer * 25 + iId), wxCheckBox);\r
-            if(pCheck)\r
-            {\r
-                pCheck->Enable(oMask.isSet(iLayer, iId));\r
-            }\r
-        }\r
-    }\r
-\r
-    m_panFrame->Refresh(false);\r
-    m_txtFrameIndex->SetValue(wxString::Format(L"0"));\r
-    m_txtFrameCount->SetValue(wxString::Format(L"%u", (int)m_oAnims.getFrameCount(iIndex)));\r
-}\r
-\r
-void frmMain::_onPlayPause(wxCommandEvent& evt)\r
-{\r
-    m_bPlayingAnimation = !m_bPlayingAnimation;\r
-    if(m_bPlayingAnimation)\r
-        m_btnPlayPause->SetLabel(L"Pause");\r
-    else\r
-        m_btnPlayPause->SetLabel(L"Play");\r
-}\r
-\r
-void frmMain::_onPrevFrame(wxCommandEvent& evt)\r
-{\r
-    if(m_oAnims.getAnimationCount() == 0)\r
-        return;\r
-\r
-    if(m_iCurrentFrame == 0)\r
-        m_iCurrentFrame = m_oAnims.getFrameCount(m_iCurrentAnim) - 1;\r
-    else\r
-        m_iCurrentFrame = (m_iCurrentFrame - 1) % m_oAnims.getFrameCount(m_iCurrentAnim);\r
-    m_txtFrameIndex->SetValue(wxString::Format(L"%u", m_iCurrentFrame));\r
-    m_panFrame->Refresh(false);\r
-}\r
-\r
-void frmMain::_onNextFrame(wxCommandEvent& evt)\r
-{\r
-    if(m_oAnims.getAnimationCount() == 0)\r
-        return;\r
-\r
-    m_iCurrentFrame = (m_iCurrentFrame + 1) % m_oAnims.getFrameCount(m_iCurrentAnim);\r
-    m_txtFrameIndex->SetValue(wxString::Format(L"%u", m_iCurrentFrame));\r
-    m_panFrame->Refresh(false);\r
-}\r
-\r
-void frmMain::_onTimer(wxTimerEvent& evt)\r
-{\r
-    if(m_bPlayingAnimation)\r
-    {\r
-        if(m_oAnims.getAnimationCount() == 0)\r
-            return;\r
-\r
-        m_iCurrentFrame = (m_iCurrentFrame + 1) % m_oAnims.getFrameCount(m_iCurrentAnim);\r
-        m_txtFrameIndex->SetValue(wxString::Format(L"%u", m_iCurrentFrame));\r
-        m_panFrame->Refresh(false);\r
-    }\r
-}\r
-\r
-void frmMain::_onToggleDrawMood(wxCommandEvent& evt)\r
-{\r
-    m_bDrawMood = evt.IsChecked();\r
-    m_panFrame->Refresh(false);\r
-}\r
-\r
-void frmMain::_onToggleDrawCoordinates(wxCommandEvent& evt)\r
-{\r
-    m_bDrawCoordinates = evt.IsChecked();\r
-    m_panFrame->Refresh(false);\r
-}\r
-\r
-void frmMain::_onPanelPaint(wxPaintEvent& evt)\r
-{\r
-    wxPaintDC DC(m_panFrame);\r
-\r
-    wxImage imgCanvas(400, 400, false);\r
-    if(m_imgBackground.IsOk())\r
-    {\r
-        memcpy(imgCanvas.GetData(), m_imgBackground.GetData(), 400 * 400 * 3);\r
-    }\r
-    else\r
-    {\r
-        memset(imgCanvas.GetData(), 0xFF, 400 * 400 * 3);\r
-    }\r
-    if(!imgCanvas.HasAlpha())\r
-    {\r
-        imgCanvas.InitAlpha();\r
-    }\r
-    for(int iX = 0; iX < 400; ++iX)\r
-    {\r
-        for(int iY = 0; iY < 400; ++iY)\r
-        {\r
-            //set completely opaque\r
-            imgCanvas.SetAlpha(iX,iY,(unsigned char)255);\r
-        }\r
-    }\r
-    wxSize oSize;\r
-    m_oAnims.drawFrame(imgCanvas, m_iCurrentAnim, m_iCurrentFrame, &m_mskLayers, oSize);\r
-    if(m_bDrawMood)\r
-    {\r
-        m_oAnims.drawFrame(imgCanvas, 4048, 0, &m_mskLayers, oSize, m_iMoodDrawX - 1, m_iMoodDrawY - 80);\r
-    }\r
-    th_frame_t *pFrame = m_oAnims.getFrameStruct(m_iCurrentAnim, m_iCurrentFrame);\r
-    uint16_t iFlags = 0;\r
-    if(pFrame) {\r
-        iFlags = pFrame->flags;\r
-    }\r
-    int iFlags1 = (int)(iFlags & 0xFF);\r
-    int iFlags2 = (int)(iFlags >> 8);\r
-    m_txtFrameFlags[0]->SetValue(wxString::Format(L"0x%02x (%03i)", iFlags1, iFlags1));\r
-    m_txtFrameFlags[1]->SetValue(wxString::Format(L"0x%02x00 (256 * %03i)", iFlags2, iFlags2));\r
-    for(int i = 0; i < 16; ++i)\r
-        m_chkFrameFlags[i]->SetValue((iFlags & (1 << i)) != 0);\r
-\r
-    wxBitmap bmpCanvas(imgCanvas);\r
-\r
-    DC.DrawBitmap(bmpCanvas, 1, 1, false);\r
-\r
-    // Draw relative tile coordinates\r
-    if (m_bDrawCoordinates) {\r
-        for (int i = -1; i <= 1; ++i) {\r
-            for (int j = -1; j <= 1; ++j) {\r
-                _drawCoordinates(DC, i, j);\r
-            }\r
-        }\r
-    }\r
-}\r
-\r
-void frmMain::_onPanelClick(wxMouseEvent& evt)\r
-{\r
-    m_iMoodDrawX = evt.GetX() - 143;\r
-    m_iMoodDrawY = evt.GetY() - 203;\r
-    {\r
-        double fX = (double)m_iMoodDrawX;\r
-        double fY = (double)m_iMoodDrawY;\r
-        fY = fY / 32.0;\r
-        fX = fX / 64.0;\r
-        fY -= fX;\r
-        fX *= 2.0;\r
-        fX += fY;\r
-        m_txtMoodPosition[0]->SetValue(wxString::Format(L"{%.2f, %.2f}", fX, fY));\r
-    }\r
-    m_txtMoodPosition[1]->SetValue(wxString::Format(L"{%i, %i, \"px\"}", m_iMoodDrawX, m_iMoodDrawY));\r
-    if(m_bDrawMood)\r
-        m_panFrame->Refresh(false);\r
-}\r
-\r
-void frmMain::_onSearchLayerId(wxCommandEvent& evt)\r
-{\r
-    int iLayer = ::wxGetNumberFromUser(L"Enter the layer number to search in (0 - 12)", L"Layer:", L"Search for Layer / ID Combo", 0, 0, 13, this);\r
-    if(iLayer == -1)\r
-        return;\r
-    int iID = ::wxGetNumberFromUser(L"Enter the ID number to search for (0 - 24)", L"ID:", L"Search for Layer / ID Combo", 0, 0, 24, this);\r
-    if(iID == -1)\r
-        return;\r
-\r
-    m_lstSearchResults->Clear();\r
-    wxBusyCursor oBusy;\r
-    for(size_t i = 0; i < m_oAnims.getAnimationCount(); ++i)\r
-    {\r
-        if(m_oAnims.isAnimationDuplicate(i))\r
-            continue;\r
-\r
-        THLayerMask mskAnim;\r
-        m_oAnims.getAnimationMask(i, mskAnim);\r
-        if(mskAnim.isSet(iLayer, iID))\r
-        {\r
-            m_lstSearchResults->Append(wxString::Format(L"%i", (int)i));\r
-        }\r
-    }\r
-}\r
-\r
-void frmMain::_onSearchFrame(wxCommandEvent& evt)\r
-{\r
-    int iFrame = ::wxGetNumberFromUser(L"Enter the frame number to search for.", L"Frame:", L"Search for frame", 0, 0, 20000, this);\r
-    if(iFrame == -1)\r
-        return;\r
-\r
-    m_lstSearchResults->Clear();\r
-    wxBusyCursor oBusy;\r
-    for(size_t i = 0; i < m_oAnims.getAnimationCount(); ++i)\r
-    {\r
-        if(m_oAnims.isAnimationDuplicate(i))\r
-            continue;\r
-        if(m_oAnims.doesAnimationIncludeFrame(i, iFrame))\r
-        {\r
-            m_lstSearchResults->Append(wxString::Format(L"%i", (int)i));\r
-        }\r
-    }\r
-}\r
-\r
-void frmMain::_onSearchSoundIndex(wxCommandEvent& evt)\r
-{\r
-    int iFrame = ::wxGetNumberFromUser(L"Enter the sound index to search for.", L"Sound index:", L"Search for sound", 0, 0, 256, this);\r
-    if(iFrame == -1)\r
-        return;\r
-\r
-    m_lstSearchResults->Clear();\r
-    wxBusyCursor oBusy;\r
-    for(size_t i = 0; i < m_oAnims.getAnimationCount(); ++i)\r
-    {\r
-        if(m_oAnims.isAnimationDuplicate(i))\r
-            continue;\r
-        size_t iCount = m_oAnims.getFrameCount(i);\r
-        for(size_t j = 0; j < iCount; ++j)\r
-        {\r
-            if((m_oAnims.getFrameStruct(i, j)->flags & 0xFF) == iFrame)\r
-            {\r
-                m_lstSearchResults->Append(wxString::Format(L"%i", (int)i));\r
-                break;\r
-            }\r
-        }\r
-    }\r
-}\r
-\r
-void frmMain::_onGotoSearchResult(wxCommandEvent& evt)\r
-{\r
-    long iAnim;\r
-    evt.GetString().ToLong(&iAnim);\r
-    _onAnimChange(iAnim);\r
-}\r
-\r
-void frmMain::_drawCoordinates(wxPaintDC& DC, int i, int j)\r
-{\r
-    int x = 122; // tile (0, 0) text start x-coordinate\r
-    int y = 226; // tile (0, 0) text start y-coordinate\r
-    wxString s;\r
-    s.Printf(_T("(%2d,%2d)"), i, j);\r
-    DC.DrawText(s, 32 * (i - j) + x, 16 * (i + j - 2) + y);\r
-}\r
-\r
-wxString frmMain::_getCaseSensitivePath(const wxString& sInsensitivePathPart, const wxString& sPath)\r
-{\r
-  bool found;\r
-  bool cont;\r
-  \r
-  if(!wxFileName::IsCaseSensitive()) { return sPath + sInsensitivePathPart; }\r
-  \r
-  wxString retStr(sPath);\r
-  \r
-  wxStringTokenizer pathTokenizer(sInsensitivePathPart, wxFileName::GetPathSeparator());\r
-  while(pathTokenizer.HasMoreTokens())\r
-  {\r
-    wxDir dir(retStr);\r
-    if(!dir.IsOpened())\r
-    {\r
-      break;\r
-    }\r
-    \r
-    wxString pathPart = pathTokenizer.GetNextToken();\r
-    \r
-    wxString realName;\r
-    cont = dir.GetFirst(&realName, wxEmptyString, wxDIR_DIRS|wxDIR_FILES|wxDIR_HIDDEN|wxDIR_DOTDOT);\r
-    found = false;\r
-    while(cont)\r
-    {\r
-      if(realName.Upper() == pathPart.Upper())\r
-      {\r
-        if(retStr.Last() != wxFileName::GetPathSeparator())\r
-        {\r
-          retStr += wxFileName::GetPathSeparator();\r
-        }\r
-        retStr += realName;\r
-        found = true;\r
-        break;\r
-      }\r
-      cont = dir.GetNext(&realName);\r
-    }\r
-    \r
-    if(!found)\r
-    {\r
-      retStr += wxFileName::GetPathSeparator();\r
-      retStr += pathPart;\r
-      break;\r
-    }\r
-  }\r
-  \r
-  while(pathTokenizer.HasMoreTokens())\r
-  {\r
-    wxString pathPart = pathTokenizer.GetNextToken();\r
-    if(retStr.Last() != wxFileName::GetPathSeparator())\r
-    {\r
-      retStr += wxFileName::GetPathSeparator();\r
-    }\r
-    retStr += pathPart;\r
-  }\r
-  \r
-  return retStr;\r
-}\r
+/*
+Copyright (c) 2009 Peter "Corsix" Cawley
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#include "frmMain.h"
+#include <wx/radiobut.h>
+#include <wx/sizer.h>
+#include <wx/stattext.h>
+#include <wx/filename.h>
+#include <wx/msgdlg.h>
+#include <wx/numdlg.h>
+#include <wx/dcclient.h>
+#include <wx/dcmemory.h>
+#include <wx/dirdlg.h>
+#include <wx/image.h>
+#include <wx/bitmap.h>
+#include <wx/wfstream.h>
+#include <wx/dir.h>
+#include <wx/tokenzr.h>
+#include "backdrop.h"
+#include "tinyxml.h"
+
+BEGIN_EVENT_TABLE(frmMain, wxFrame)
+  EVT_BUTTON(ID_LOAD      , frmMain::_onLoad)
+  EVT_BUTTON(ID_BROWSE    , frmMain::_onBrowse)
+  EVT_BUTTON(ID_EXPORT    , frmMain::_onExport)
+  EVT_BUTTON(ID_FIRST_ANIM, frmMain::_onFirstAnim)
+  EVT_BUTTON(ID_PREV_ANIM , frmMain::_onPrevAnim)
+  EVT_BUTTON(ID_NEXT_ANIM , frmMain::_onNextAnim)
+  EVT_BUTTON(ID_LAST_ANIM , frmMain::_onLastAnim)
+  EVT_BUTTON(ID_PREV_FRAME, frmMain::_onPrevFrame)
+  EVT_BUTTON(ID_NEXT_FRAME, frmMain::_onNextFrame)
+  EVT_BUTTON(ID_PLAY_PAUSE, frmMain::_onPlayPause)
+  EVT_BUTTON(ID_SEARCH_LAYER_ID, frmMain::_onSearchLayerId)
+  EVT_BUTTON(ID_SEARCH_FRAME, frmMain::_onSearchFrame)
+  EVT_BUTTON(ID_SEARCH_SOUND, frmMain::_onSearchSoundIndex)
+  EVT_LISTBOX(ID_SEARCH_RESULTS, frmMain::_onGotoSearchResult)
+  EVT_RADIOBUTTON(ID_GHOST_0, frmMain::_onGhostFileChange)
+  EVT_RADIOBUTTON(ID_GHOST_1, frmMain::_onGhostFileChange)
+  EVT_RADIOBUTTON(ID_GHOST_2, frmMain::_onGhostFileChange)
+  EVT_RADIOBUTTON(ID_GHOST_3, frmMain::_onGhostFileChange)
+  EVT_SPINCTRL(wxID_ANY, frmMain::_onGhostIndexChange)
+  EVT_TEXT(ID_ANIM_INDEX, frmMain::_onAnimChar)
+  EVT_TIMER(ID_TIMER_ANIMATE, frmMain::_onTimer)
+  EVT_CHECKBOX(ID_DRAW_MOOD, frmMain::_onToggleDrawMood)
+  EVT_CHECKBOX(ID_DRAW_COORDINATES, frmMain::_onToggleDrawCoordinates)
+END_EVENT_TABLE()
+
+frmMain::frmMain()
+  : wxFrame(NULL, wxID_ANY, L"Theme Hospital Animation Viewer")
+{
+    wxSizer* pMainSizer = new wxBoxSizer(wxHORIZONTAL);
+
+    wxSizer* pSidebarSizer = new wxBoxSizer(wxVERTICAL);
+
+#define def wxDefaultPosition, wxDefaultSize
+    wxStaticBoxSizer *pThemeHospital = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Theme Hospital");
+    pThemeHospital->Add(new wxStaticText(this, wxID_ANY, L"Directory:"), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pThemeHospital->Add(m_txtTHPath = new wxTextCtrl(this, wxID_ANY, L"", def, wxTE_CENTRE), 1, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pThemeHospital->Add(new wxButton(this, ID_BROWSE, L"Browse..."), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pThemeHospital->Add(new wxButton(this, ID_LOAD, L"Load"), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pThemeHospital->Add(m_btnExport = new wxButton(this, ID_EXPORT, L"Export"), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pSidebarSizer->Add(pThemeHospital, 0, wxEXPAND | wxALL, 0);
+
+    wxStaticBoxSizer *pPalette = new wxStaticBoxSizer(wxVERTICAL, this, L"Palette");
+    wxBoxSizer *pPaletteTop = new wxBoxSizer(wxHORIZONTAL);
+    pPaletteTop->Add(new wxRadioButton(this, ID_GHOST_0, L"Standard"), 1);
+    pPaletteTop->Add(new wxRadioButton(this, ID_GHOST_1, L"Ghost 1"), 1);
+    pPaletteTop->Add(new wxRadioButton(this, ID_GHOST_2, L"Ghost 2"), 1);
+    pPaletteTop->Add(new wxRadioButton(this, ID_GHOST_3, L"Ghost 66"), 1);
+    m_iGhostFile = 0;
+    m_iGhostIndex = 0;
+    pPalette->Add(pPaletteTop, 0, wxEXPAND | wxALL, 1);
+    pPalette->Add(new wxSpinCtrl(this, wxID_ANY, wxEmptyString, def, wxSP_ARROW_KEYS | wxSP_WRAP, 0, 255), 0, wxALIGN_CENTER | wxALL, 1);
+    pSidebarSizer->Add(pPalette, 0, wxEXPAND | wxALL, 0);
+
+    wxStaticBoxSizer *pAnimation = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Animation");
+    pAnimation->Add(new wxButton(this, ID_FIRST_ANIM, L"<<", def, wxBU_EXACTFIT), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pAnimation->Add(new wxButton(this, ID_PREV_ANIM, L"<", def, wxBU_EXACTFIT), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pAnimation->Add(m_txtAnimIndex = new wxTextCtrl(this, ID_ANIM_INDEX, L"0", def, wxTE_CENTRE), 1, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pAnimation->Add(new wxStaticText(this, wxID_ANY, L"of"), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pAnimation->Add(m_txtAnimCount = new wxTextCtrl(this, wxID_ANY, L"?", def, wxTE_CENTRE | wxTE_READONLY), 1, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pAnimation->Add(new wxButton(this, ID_NEXT_ANIM, L">", def, wxBU_EXACTFIT), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pAnimation->Add(new wxButton(this, ID_LAST_ANIM, L">>", def, wxBU_EXACTFIT), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pSidebarSizer->Add(pAnimation, 0, wxEXPAND | wxALL, 0);
+
+    wxStaticBoxSizer *pFrame = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Frame");
+    pFrame->Add(new wxButton(this, ID_PREV_FRAME, L"<", def, wxBU_EXACTFIT), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pFrame->Add(m_txtFrameIndex = new wxTextCtrl(this, wxID_ANY, L"0", def, wxTE_CENTRE), 1, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pFrame->Add(new wxStaticText(this, wxID_ANY, L"of", def, wxALIGN_CENTRE), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pFrame->Add(m_txtFrameCount = new wxTextCtrl(this, wxID_ANY, L"?", def, wxTE_CENTRE | wxTE_READONLY), 1, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pFrame->Add(new wxButton(this, ID_NEXT_FRAME, L">", def, wxBU_EXACTFIT), 0, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    pFrame->Add(m_btnPlayPause = new wxButton(this, ID_PLAY_PAUSE, L"Pause"), 1, wxALIGN_CENTER_VERTICAL | wxALL, 1);
+    m_bPlayingAnimation = true;
+    //m_bPlayingAnimation = false;
+    pSidebarSizer->Add(pFrame, 0, wxEXPAND | wxALL, 0);
+    
+#define ID(layer, id) (ID_LAYER_CHECKS + (layer) * 25 + (id))
+    wxStaticBoxSizer *pLayer0 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 0 (Patient Head)");
+    pLayer0->Add(new wxCheckBox(this, ID(0,  0), L"0"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer0->Add(new wxCheckBox(this, ID(0,  2), L"2"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer0->Add(new wxCheckBox(this, ID(0,  4), L"4"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer0->Add(new wxCheckBox(this, ID(0,  6), L"6"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer0->Add(new wxCheckBox(this, ID(0,  8), L"8"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer0->Add(new wxCheckBox(this, ID(0, 10), L"10"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer0->Add(new wxCheckBox(this, ID(0, 12), L"12"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer0->Add(new wxCheckBox(this, ID(0, 14), L"14"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer0->Add(new wxCheckBox(this, ID(0, 16), L"16"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer0->Add(new wxCheckBox(this, ID(0, 18), L"18"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer0->Add(new wxCheckBox(this, ID(0, 20), L"20"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer0->Add(new wxCheckBox(this, ID(0, 22), L"22"), 0, wxALIGN_CENTER | wxALL, 1);
+    pSidebarSizer->Add(pLayer0, 0, wxEXPAND | wxALL, 0);
+
+    wxStaticBoxSizer *pLayer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 1 (Patient Clothes)");
+    pLayer1->Add(new wxCheckBox(this, ID(1, 0), L"0"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer1->Add(new wxCheckBox(this, ID(1, 2), L"2 (A)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer1->Add(new wxCheckBox(this, ID(1, 4), L"4 (B)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer1->Add(new wxCheckBox(this, ID(1, 6), L"6 (C)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer1->Add(new wxCheckBox(this, ID(1, 8), L"8"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer1->Add(new wxCheckBox(this, ID(1, 10), L"10"), 0, wxALIGN_CENTER | wxALL, 1);
+    pSidebarSizer->Add(pLayer1, 0, wxEXPAND | wxALL, 0);
+
+    wxStaticBoxSizer *pLayer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 2 (Bandages / Patient Accessory)");
+    pLayer2->Add(new wxCheckBox(this, ID(2, 2), L"2 (Head / Alt Shoes)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer2->Add(new wxCheckBox(this, ID(2, 4), L"4 (Arm / Hat)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer2->Add(new wxCheckBox(this, ID(2, 6), L"6"), 0, wxALIGN_CENTER | wxALL, 1);
+    pSidebarSizer->Add(pLayer2, 0, wxEXPAND | wxALL, 0);
+
+    wxStaticBoxSizer *pLayer3 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 3 (Bandages / Colour)");
+    pLayer3->Add(new wxCheckBox(this, ID(3, 0), L"0"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer3->Add(new wxCheckBox(this, ID(3, 2), L"2 (? / Yellow)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer3->Add(new wxCheckBox(this, ID(3, 4), L"4 (L Foot / Blue)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer3->Add(new wxCheckBox(this, ID(3, 6), L"6 (? / White)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer3->Add(new wxCheckBox(this, ID(3, 8), L"8 (R Arm)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer3->Add(new wxCheckBox(this, ID(3, 10), L"10 (R Foot)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pSidebarSizer->Add(pLayer3, 0, wxEXPAND | wxALL, 0);
+
+    wxStaticBoxSizer *pLayer4 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 4 (Bandages / Repair)");
+    pLayer4->Add(new wxCheckBox(this, ID(4, 0), L"0"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer4->Add(new wxCheckBox(this, ID(4, 2), L"2 (Head / Repair)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer4->Add(new wxCheckBox(this, ID(4, 4), L"4 (L Root)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer4->Add(new wxCheckBox(this, ID(4, 6), L"6"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer4->Add(new wxCheckBox(this, ID(4, 8), L"8 (R Arm)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer4->Add(new wxCheckBox(this, ID(4, 10), L"10 (R Foot)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pSidebarSizer->Add(pLayer4, 0, wxEXPAND | wxALL, 0);
+
+    wxStaticBoxSizer *pLayer5 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 5 (Staff Head)");
+    pLayer5->Add(new wxCheckBox(this, ID(5, 0), L"0"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer5->Add(new wxCheckBox(this, ID(5, 2), L"2 (W1)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer5->Add(new wxCheckBox(this, ID(5, 4), L"4 (B1)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer5->Add(new wxCheckBox(this, ID(5, 6), L"6 (W2)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer5->Add(new wxCheckBox(this, ID(5, 8), L"8 (B2)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer5->Add(new wxCheckBox(this, ID(5, 10), L"10"), 0, wxALIGN_CENTER | wxALL, 1);
+    pSidebarSizer->Add(pLayer5, 0, wxEXPAND | wxALL, 0);
+
+    wxStaticBoxSizer *pLayer10 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 10 (Wall Colour / Smoke)");
+    pLayer10->Add(new wxCheckBox(this, ID(10, 2), L"2 (Yellow / Smoke)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer10->Add(new wxCheckBox(this, ID(10, 4), L"4 (Blue)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer10->Add(new wxCheckBox(this, ID(10, 6), L"6 (White)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pSidebarSizer->Add(pLayer10, 0, wxEXPAND | wxALL, 0);
+
+    wxStaticBoxSizer *pLayer11 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 11 (Wall Colour / Smoke / Screen)");
+    pLayer11->Add(new wxCheckBox(this, ID(11, 2), L"2 (Yellow / Smoke / On)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer11->Add(new wxCheckBox(this, ID(11, 4), L"4 (Blue)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pLayer11->Add(new wxCheckBox(this, ID(11, 6), L"6 (Green)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pSidebarSizer->Add(pLayer11, 0, wxEXPAND | wxALL, 0);
+
+    wxStaticBoxSizer *pLayer12 = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Layer 12 (Smoke)");
+    pLayer12->Add(new wxCheckBox(this, ID(12, 2), L"2 (Smoke)"), 0, wxALIGN_CENTER | wxALL, 1);
+    pSidebarSizer->Add(pLayer12, 0, wxEXPAND | wxALL, 0);
+
+    wxStaticBoxSizer *pMoodOverlay = new wxStaticBoxSizer(wxVERTICAL, this, L"Overlays");
+    pMoodOverlay->Add(new wxCheckBox(this, ID_DRAW_MOOD, L"Draw mood overlay"), 0, wxEXPAND | wxALL, 1);
+    wxBoxSizer *pMoodRow = new wxBoxSizer(wxHORIZONTAL);
+    pMoodRow->Add(new wxStaticText(this, wxID_ANY, L"Marker position (click to move it):"), 0, wxEXPAND | wxRIGHT | wxALIGN_CENTER_VERTICAL, 2);
+    pMoodRow->Add(m_txtMoodPosition[0] = new wxTextCtrl(this, wxID_ANY, L"{0, 0}"), 1, wxEXPAND | wxRIGHT | wxALIGN_CENTER_VERTICAL, 1);
+    pMoodRow->Add(m_txtMoodPosition[1] = new wxTextCtrl(this, wxID_ANY, L"{0, 0, \"px\"}"), 1, wxEXPAND | wxALIGN_CENTER_VERTICAL);
+    pMoodOverlay->Add(pMoodRow, 1, wxEXPAND | wxALL, 2);
+    pMoodOverlay->Add(new wxCheckBox(this, ID_DRAW_COORDINATES, L"Draw tile coodinates"), 0, wxEXPAND | wxALL, 0);
+    pSidebarSizer->Add(pMoodOverlay, 0, wxEXPAND | wxALL, 0);
+    m_bDrawMood = false;
+    m_bDrawCoordinates = false;
+    m_iMoodDrawX = 0;
+    m_iMoodDrawY = 0;
+
+    for(int iLayer = 0; iLayer < 13; ++iLayer)
+    {
+        wxCheckBox *pCheck = wxDynamicCast(FindWindow(ID(iLayer, 0)), wxCheckBox);
+        if(pCheck != NULL)
+        {
+            pCheck->SetValue(true);
+            m_mskLayers.set(iLayer, 0);
+        }
+    }
+
+    Connect(ID(0, 0), ID(12, 24), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&frmMain::_onToggleMask);
+#undef ID
+
+    wxStaticBoxSizer *pSearch = new wxStaticBoxSizer(wxVERTICAL, this, L"Search");
+    wxBoxSizer *pSearchButtons = new wxBoxSizer(wxHORIZONTAL);
+    pSearchButtons->Add(new wxButton(this, ID_SEARCH_LAYER_ID, L"Layer/ID"), 0, wxALL, 1);
+    pSearchButtons->Add(new wxButton(this, ID_SEARCH_FRAME, L"Frame"), 0, wxALL, 1);
+    pSearchButtons->Add(new wxButton(this, ID_SEARCH_SOUND, L"Sound"), 0, wxALL, 1);
+    pSearch->Add(pSearchButtons, 0);
+    pSearch->Add(m_lstSearchResults = new wxListBox(this, ID_SEARCH_RESULTS), 1, wxEXPAND | wxALL, 1);
+
+    wxStaticBoxSizer *pFrameFlags = new wxStaticBoxSizer(wxHORIZONTAL, this, L"Frame Flags");
+    wxBoxSizer *pFlags1 = new wxBoxSizer(wxVERTICAL);
+    pFlags1->Add(m_txtFrameFlags[0] = new wxTextCtrl(this, wxID_ANY), 0, wxEXPAND | wxALL, 2);
+    pFlags1->Add(m_chkFrameFlags[0] = new wxCheckBox(this, wxID_ANY, L"2^0"), 0, wxEXPAND | wxALL, 2);
+    pFlags1->Add(m_chkFrameFlags[1] = new wxCheckBox(this, wxID_ANY, L"2^1"), 0, wxEXPAND | wxALL, 2);
+    pFlags1->Add(m_chkFrameFlags[2] = new wxCheckBox(this, wxID_ANY, L"2^2"), 0, wxEXPAND | wxALL, 2);
+    pFlags1->Add(m_chkFrameFlags[3] = new wxCheckBox(this, wxID_ANY, L"2^3"), 0, wxEXPAND | wxALL, 2);
+    pFlags1->Add(m_chkFrameFlags[4] = new wxCheckBox(this, wxID_ANY, L"2^4"), 0, wxEXPAND | wxALL, 2);
+    pFlags1->Add(m_chkFrameFlags[5] = new wxCheckBox(this, wxID_ANY, L"2^5"), 0, wxEXPAND | wxALL, 2);
+    pFlags1->Add(m_chkFrameFlags[6] = new wxCheckBox(this, wxID_ANY, L"2^6"), 0, wxEXPAND | wxALL, 2);
+    pFlags1->Add(m_chkFrameFlags[7] = new wxCheckBox(this, wxID_ANY, L"2^7"), 0, wxEXPAND | wxALL, 2);
+    pFrameFlags->Add(pFlags1, 1, wxEXPAND);
+    wxBoxSizer *pFlags2 = new wxBoxSizer(wxVERTICAL);
+    pFlags2->Add(m_txtFrameFlags[1] = new wxTextCtrl(this, wxID_ANY), 0, wxEXPAND | wxALL, 2);
+    pFlags2->Add(m_chkFrameFlags[8] = new wxCheckBox(this, wxID_ANY, L"2^8 (Animation Start)"), 0, wxEXPAND | wxALL, 2);
+    pFlags2->Add(m_chkFrameFlags[9] = new wxCheckBox(this, wxID_ANY, L"2^9"), 0, wxEXPAND | wxALL, 2);
+    pFlags2->Add(m_chkFrameFlags[10] = new wxCheckBox(this, wxID_ANY, L"2^10"), 0, wxEXPAND | wxALL, 2);
+    pFlags2->Add(m_chkFrameFlags[11] = new wxCheckBox(this, wxID_ANY, L"2^11"), 0, wxEXPAND | wxALL, 2);
+    pFlags2->Add(m_chkFrameFlags[12] = new wxCheckBox(this, wxID_ANY, L"2^12"), 0, wxEXPAND | wxALL, 2);
+    pFlags2->Add(m_chkFrameFlags[13] = new wxCheckBox(this, wxID_ANY, L"2^13"), 0, wxEXPAND | wxALL, 2);
+    pFlags2->Add(m_chkFrameFlags[14] = new wxCheckBox(this, wxID_ANY, L"2^14"), 0, wxEXPAND | wxALL, 2);
+    pFlags2->Add(m_chkFrameFlags[15] = new wxCheckBox(this, wxID_ANY, L"2^15"), 0, wxEXPAND | wxALL, 2);
+    pFrameFlags->Add(pFlags2, 1, wxEXPAND);
+
+    pMainSizer->Add(pSidebarSizer, 0, wxEXPAND | wxALL, 2);
+
+    wxSizer* pRightHandSizer = new wxBoxSizer(wxVERTICAL);
+    pRightHandSizer->AddSpacer(1);
+
+    pRightHandSizer->Add(m_panFrame = new wxPanel(this, wxID_ANY, def, wxBORDER_SIMPLE), 0, wxEXPAND | wxALL, 2);
+    m_panFrame->Connect(wxEVT_PAINT, (wxObjectEventFunction)&frmMain::_onPanelPaint, NULL, this);
+    m_panFrame->Connect(wxEVT_LEFT_UP, (wxObjectEventFunction)&frmMain::_onPanelClick, NULL, this);
+    m_panFrame->SetMinSize(m_panFrame->ClientToWindowSize(wxSize(402, 402)));
+
+    pRightHandSizer->AddSpacer(1);
+    pRightHandSizer->Add(pSearch, 1, wxEXPAND | wxALL, 0);
+    pRightHandSizer->Add(pFrameFlags, 0, wxEXPAND | wxALL, 0);
+    pMainSizer->Add(pRightHandSizer, 1, wxEXPAND | wxALL, 0);
+
+    SetBackgroundColour(m_btnPlayPause->GetBackgroundColour());
+    SetSizer(pMainSizer);
+    
+    SetMinSize(ClientToWindowSize(pMainSizer->CalcMin()));
+    SetSize(GetMinSize());
+
+    load();
+
+    m_tmrAnimate.SetOwner(this, ID_TIMER_ANIMATE);
+    m_tmrAnimate.Start(100);
+}
+
+void frmMain::_onBrowse(wxCommandEvent& WXUNUSED(evt))
+{
+    m_txtTHPath->SetValue(::wxDirSelector(L"Choose Theme Hospital root folder",
+        m_txtTHPath->GetValue(), 0, wxDefaultPosition, this));
+}
+
+void frmMain::_onLoad(wxCommandEvent& WXUNUSED(evt))
+{
+    ::wxInitAllImageHandlers();
+    load();
+}
+
+void frmMain::_onExport(wxCommandEvent& WXUNUSED(evt))
+{
+    m_tmrAnimate.Stop();
+    ::wxInitAllImageHandlers();
+    export_png();
+}
+
+void frmMain::load()
+{
+    wxBusyCursor oBusy;
+    wxString sPath = m_txtTHPath->GetValue();
+    if(sPath.IsEmpty())
+        return;
+    if(sPath.Mid(sPath.Len() - 1) != wxFileName::GetPathSeparator())
+    {
+        sPath += wxFileName::GetPathSeparator();
+    }
+    if(!wxFileName::DirExists(sPath))
+    {
+        ::wxMessageBox(L"Theme Hospital path non-existant", L"Load Animations", wxOK | wxICON_ERROR, this);
+        return;
+    }
+    sPath = _getCaseSensitivePath(L"DATA", sPath);
+    sPath += wxFileName::GetPathSeparator();
+    wxString aPath = _getCaseSensitivePath(L"VSPR-0", sPath);
+    aPath += wxFileName::GetPathSeparator();
+    m_oAnims.setSpritePath(aPath);
+
+    bool bXmlLoaded = false;
+    wxString xmlFile = _getCaseSensitivePath(L"VSPR-0.xml", sPath);
+    TiXmlDocument xmlDocument((const char*)xmlFile.mb_str());
+    if(wxFileName::FileExists(xmlFile) && xmlDocument.LoadFile())
+    {
+        m_oAnims.loadXMLFile(&xmlDocument);
+        m_oAnims.loadPaletteFile(_getCaseSensitivePath(L"MPALETTE.DAT", sPath));
+        m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST1.DAT", sPath), 1);
+        m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST2.DAT", sPath), 2);
+        m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST66.DAT", sPath), 3);
+        bXmlLoaded = true;
+        m_btnExport->Disable();
+    }
+    else if(!m_oAnims.loadAnimationFile(_getCaseSensitivePath(L"VSTART-1.ANI", sPath))
+      ||!m_oAnims.loadFrameFile(_getCaseSensitivePath(L"VFRA-1.ANI", sPath))
+     ||!m_oAnims.loadListFile(_getCaseSensitivePath(L"VLIST-1.ANI", sPath))
+     ||!m_oAnims.loadElementFile(_getCaseSensitivePath(L"VELE-1.ANI", sPath))
+     ||!m_oAnims.loadTableFile(_getCaseSensitivePath(L"VSPR-0.TAB", sPath))
+     ||!m_oAnims.loadSpriteFile(_getCaseSensitivePath(L"VSPR-0.DAT", sPath))
+     ||!m_oAnims.loadPaletteFile(_getCaseSensitivePath(L"MPALETTE.DAT", sPath))
+     ||!m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST1.DAT", sPath), 1)
+     ||!m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST2.DAT", sPath), 2)
+     ||!m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST66.DAT", sPath), 3))
+    {
+        ::wxMessageBox(L"Cannot load one or more data files", L"Load Animations", wxOK | wxICON_ERROR, this);
+    }
+    if(!bXmlLoaded) { m_oAnims.markDuplicates(); }
+
+    m_txtAnimCount->SetValue(wxString::Format(L"%u", (int)m_oAnims.getAnimationCount()));
+
+    m_imgBackground.Create(400, 400);
+    {
+        unsigned char* pData = m_imgBackground.GetData();
+        unsigned char cPrimary = 0xFF;
+        unsigned char cSecondary = 0xE0;
+        for(int y = 0; y < 400; ++y)
+        {
+            for(int x = 0; x < 400; x += 8)
+            {
+                memset(pData, cPrimary  , 4 * 3);
+                pData += 4 * 3;
+                memset(pData, cSecondary, 4 * 3);
+                pData += 4 * 3;
+            }
+            if(y % 4 == 3)
+            {
+                cPrimary ^= cSecondary;
+                cSecondary ^= cPrimary;
+                cPrimary ^= cSecondary;
+            }
+        }
+        wxBitmap bmpBackdrop(backdrop_xpm);
+        wxBitmap bmpBackground(m_imgBackground);
+        {
+            wxMemoryDC dcBlit;
+            dcBlit.SelectObject(bmpBackground);
+            dcBlit.DrawBitmap(bmpBackdrop, 78, 170, true);
+        }
+        m_imgBackground = bmpBackground.ConvertToImage();
+    }
+
+    _onAnimChange(0);
+}
+
+void frmMain::export_png()
+{
+    wxBusyCursor oBusy;
+    wxString sPath = m_txtTHPath->GetValue();
+    if(sPath.IsEmpty())
+        return;
+    if(sPath.Mid(sPath.Len() - 1) != wxFileName::GetPathSeparator())
+    {
+        sPath += wxFileName::GetPathSeparator();
+    }
+    if(!wxFileName::DirExists(sPath))
+    {
+        ::wxMessageBox(L"Theme Hospital path non-existant", L"Load Animations", wxOK | wxICON_ERROR, this);
+        return;
+    }
+    wxString sdPath = _getCaseSensitivePath(L"DATA", sPath);
+    sdPath += wxFileName::GetPathSeparator();
+
+    //wxDialog warnDialog(this, wxID_ANY, L"Export Warning");
+    //warnDialog::CreateButtonSizer(wxOK|wxCANCEL);
+    bool bWriteFrames = false;
+    int response = ::wxMessageBox(L"If you click Yes, the export process will write animation frames \n \
+in separate folders and will run for about 20 minutes, and will create about 18,000 files on \n \
+your hard disk (~250MB). \n If you click No, it will write the XML and element files only. This will create \n \
+2,950 files (~80MB) and is everything you need to modify graphics. As long as the XML file is present in \n \
+the DATA folder, the Animation Viewer will use PNG sprites instead of Theme Hospital data files.",
+        L"Export Warning", wxYES_NO | wxCANCEL);
+    if( response == wxYES) { bWriteFrames = true; }
+    if( response != wxCANCEL) 
+    {
+        //Start with animations, then move on to sprite sheets (map tiles)
+        if(!m_oAnims.loadAnimationFile(_getCaseSensitivePath(L"VSTART-1.ANI", sdPath))
+         ||!m_oAnims.loadFrameFile(_getCaseSensitivePath(L"VFRA-1.ANI", sdPath))
+         ||!m_oAnims.loadListFile(_getCaseSensitivePath(L"VLIST-1.ANI", sdPath))
+         ||!m_oAnims.loadElementFile(_getCaseSensitivePath(L"VELE-1.ANI", sdPath))
+         ||!m_oAnims.loadTableFile(_getCaseSensitivePath(L"VSPR-0.TAB", sdPath))
+         ||!m_oAnims.loadSpriteFile(_getCaseSensitivePath(L"VSPR-0.DAT",sdPath))
+         ||!m_oAnims.loadPaletteFile(_getCaseSensitivePath(L"MPALETTE.DAT", sdPath))
+         ||!m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST1.DAT", sdPath), 1)
+         ||!m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST2.DAT", sdPath), 2)
+         ||!m_oAnims.loadGhostFile(_getCaseSensitivePath(L"../QDATA/GHOST66.DAT", sdPath), 3))
+        {
+            ::wxMessageBox(L"Cannot load one or more data files", L"Load Animations", wxOK | wxICON_ERROR, this);
+        }
+        m_oAnims.markDuplicates();
+        wxString aPath = _getCaseSensitivePath(L"VSPR-0", sdPath);
+        aPath += wxFileName::GetPathSeparator();
+        if(!wxFileName::DirExists(aPath))
+        {
+            wxFileName::Mkdir(aPath);
+        }
+        size_t iExportCount = m_oAnims.getAnimationCount();
+        wxFile f(_getCaseSensitivePath(L"VSPR-0export.log", sdPath), wxFile::write_append);
+        wxFileOutputStream fos(f);
+        wxTextOutputStream outputLog(fos);
+        outputLog.WriteString(wxString::Format(L"File\tIndex\tFrame\tLayer\tID\tWidth\tHeight\tUnknown\n"));
+        m_oAnims.writeTableDataHeader(&outputLog);
+        wxFile fxml(_getCaseSensitivePath(L"VSPR-0.xml", sdPath), wxFile::write);
+        wxFileOutputStream fosxml(fxml);
+        wxTextOutputStream outputXml(fosxml);
+        outputXml.WriteString(wxString::Format(L"<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>\n"));
+        outputXml.WriteString(wxString::Format(L"<theme_hospital_graphics scale_factor='1'>\n"));
+    
+        int iAnimationCount = 0;
+        int iFrameCountTotal = 1;
+        int iElementCount = 0;
+        int iSpriteCount = 0;
+        int iListIndex = 0;
+        for(size_t iAnimation = 0; iAnimation < iExportCount; ++iAnimation)
+        {
+            if(!m_oAnims.isAnimationDuplicate(iAnimation) && m_oAnims.getFrameField(iAnimation) >= iFrameCountTotal)
+            {
+                wxString aiPath = aPath + wxString::Format(L"a%04u", iAnimation);
+                if(!wxFileName::DirExists(aiPath))
+                {
+                    wxFileName::Mkdir(aiPath);
+                }
+                outputXml.WriteString(wxString::Format(L"<an id='%u' fr='%u' un='%u'>\n", 
+                    iAnimation, m_oAnims.getFrameField(iAnimation), m_oAnims.getUnknownField(iAnimation)));
+                aiPath += wxFileName::GetPathSeparator();
+                size_t iFrameCount = m_oAnims.getFrameCount(iAnimation);
+                for(size_t iFrame = 0; iFrame < iFrameCount; ++iFrame)
+                {
+                    wxImage imgCanvas;
+                    th_frame_t* pFrame = m_oAnims.getFrameStruct(iAnimation,iFrame);
+                    outputXml.WriteString(wxString::Format(L"\t<fr id='%u' li='%u' w='%u' h='%u' fl='%u' nx='%u'>\n", 
+                        iFrameCountTotal, iListIndex, pFrame->width, pFrame->height, pFrame->flags, pFrame->next));
+
+                    wxSize oSize;
+                    m_oAnims.writeElementData(aPath, &outputLog, &outputXml, iAnimation, iFrame, &m_mskLayers, oSize, &iListIndex);
+
+                    if( bWriteFrames && oSize.x > 0 && oSize.y > 0 )
+                    {
+                        if(!imgCanvas.IsOk())
+                        {
+                            imgCanvas.Create(oSize.x, oSize.y, true);
+                            if(!imgCanvas.HasAlpha())
+                            {
+                                imgCanvas.SetAlpha();
+                            }
+                            for(int iX = 0; iX < oSize.x; ++iX)
+                            {
+                                for(int iY = 0; iY < oSize.y; ++iY)
+                                {
+                                    //set completely transparent
+                                    imgCanvas.SetAlpha(iX,iY,(unsigned char)0);
+                                }
+                            }
+                        }
+
+                        m_oAnims.drawFrame(imgCanvas, iAnimation, iFrame, &m_mskLayers, oSize, 0, 0);
+                        outputLog.WriteString(wxString::Format(L"%s\t%u\t%u\t%u\t%u\t%u\n", L"VSPR-0", iAnimation, iFrame, 
+                                oSize.x, oSize.y, m_oAnims.getUnknownField(iAnimation)));
+                    }
+
+                    outputXml.WriteString(wxString::Format(L"\t</fr>\n"));
+                    iFrameCountTotal++;
+
+                    if( bWriteFrames && imgCanvas.IsOk() )
+                    {
+                        if(!imgCanvas.SaveFile(aiPath + wxString::Format(L"a%u_f%u.png", iAnimation, iFrame),wxBITMAP_TYPE_PNG))
+                            return;
+                        imgCanvas.Destroy();
+                    }
+                }
+                outputXml.WriteString(wxString::Format(L"</an>\n"));
+                iAnimationCount++;
+            }
+        }
+        //outputXml.WriteString(wxString::Format(L"\t<graphics_totals animations='%u' frames='%u' elements='%u' sprites='%u'>\n", 
+        //    iAnimationCount, iFrameCount, iElementCount, iSpriteCount));
+        outputXml.WriteString(wxString::Format(L"</theme_hospital_graphics>\n"));
+
+        //Sprite sheet code for Data directory
+        exportSpritesPage(false, sdPath, L"MONEY01V");
+        exportSpritesPage(false, sdPath, L"MPOINTER");
+        exportSpritesPage(true, sdPath, L"PANEL02V");
+        exportSpritesPage(true, sdPath, L"PANEL04V");
+        exportSpritesPage(true, sdPath, L"PULLDV");
+        exportSpritesPage(false, sdPath, L"VBLK-0");
+        exportSpritesPage(true, sdPath, L"WATCH01V");
+        //Skip DataM directory because it appears to be low-res versions of same
+
+        //Sprite sheet code for QData directory 
+        wxString sqPath = _getCaseSensitivePath(L"QDATA", sPath);
+        sqPath += wxFileName::GetPathSeparator();
+        exportSpritesPage(true, sqPath, L"AWARD03V", L"", L"AWARD02V.PAL");
+        exportSpritesPage(true, sqPath, L"BANK02V", L"", L"BANK01V.PAL");
+        exportSpritesPage(true, sqPath, L"DRUGN02V", L"", L"DRUGN01V.PAL");
+        exportSpritesPage(true, sqPath, L"FAME02V", L"", L"FAME01V.PAL");
+        exportSpritesPage(true, sqPath, L"FAX02V", L"", L"FAX01V.PAL");
+        exportSpritesPage(false, sqPath, L"FONT00V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT01V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT02V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT04V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT05V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT09V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT16V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT18V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT19V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT24V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT25V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT26V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT31V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT34V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT35V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT36V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT37V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT38V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT39V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT40V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT43V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT44V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT45V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT46V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT47V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT50V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT51V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT60V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT74V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT100V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT101V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT102V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT105V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT106V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT110V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT111V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT112V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT113V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT115V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT120V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT121V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT122V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT124V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT250V", sdPath);
+        exportSpritesPage(false, sqPath, L"FONT502V", sdPath);
+        exportSpritesPage(true, sqPath, L"GRAPH02V", L"", L"GRAPH01V.PAL");
+        exportSpritesPage(true, sqPath, L"LETTR02V", L"", L"REP01V.PAL");
+        exportSpritesPage(true, sqPath, L"LOAD02V", L"", L"LOAD01V.PAL");
+        exportSpritesPage(true, sqPath, L"MAIN02M", L"", L"MAIN01M.PAL");
+        exportSpritesPage(true, sqPath, L"POL02V", L"", L"POL01V.PAL");
+        exportSpritesPage(true, sqPath, L"PREF02V", L"", L"PREF01V.PAL");
+        exportSpritesPage(true, sqPath, L"REP02V", L"", L"REP01V.PAL");
+        //exportSpritesPage(true, sqPath, L"REQ00V", sdPath);
+        //exportSpritesPage(true, sqPath, L"REQ01V", sdPath);
+        //exportSpritesPage(true, sqPath, L"REQ02V", sdPath);
+        //exportSpritesPage(true, sqPath, L"REQ03V", sdPath);
+        //exportSpritesPage(true, sqPath, L"REQ04V", sdPath);
+        //exportSpritesPage(true, sqPath, L"REQ05V", sdPath);
+        //exportSpritesPage(true, sqPath, L"REQ06V", sdPath);
+        //exportSpritesPage(true, sqPath, L"REQ09V", sdPath);
+        //exportSpritesPage(true, sqPath, L"REQ10V", sdPath);
+        //exportSpritesPage(true, sqPath, L"REQ11V", sdPath);
+        //exportSpritesPage(true, sqPath, L"REQ12V", sdPath);
+        //exportSpritesPage(true, sqPath, L"REQ13V", sdPath);
+        exportSpritesPage(true, sqPath, L"RES02V", L"", L"RES01V.PAL");
+        exportSpritesPage(true, sqPath, L"REP02V", L"", L"REP01V.PAL");
+        exportSpritesPage(true, sqPath, L"SPOINTER", sdPath);
+        exportSpritesPage(true, sqPath, L"STAFF02V", L"", L"STAFF01V.PAL");
+        exportSpritesPage(true, sqPath, L"STAT02V", L"", L"STAT01V.PAL");
+        exportSpritesPage(true, sqPath, L"TOWN02V", L"", L"TOWN01V.PAL");
+        exportSpritesPage(true, sqPath, L"VER00V", L"", L"REP01V.PAL");
+    }
+}
+
+void frmMain::exportSpritesPage(bool bComplex, wxString sPath, wxString sFilename, wxString spPath, wxString sPalette)
+{
+    if(spPath.length() == 0) 
+    {
+        spPath = sPath;
+    }
+    if(!m_oAnims.loadTableFile(_getCaseSensitivePath(wxString::Format(L"%s.TAB",sFilename.wx_str()), sPath))
+     ||!m_oAnims.loadSpriteFile(_getCaseSensitivePath(wxString::Format(L"%s.DAT",sFilename.wx_str()), sPath))
+     ||!m_oAnims.loadPaletteFile(_getCaseSensitivePath(sPalette, spPath)))
+    {
+        return;
+    }
+
+    wxFile f(_getCaseSensitivePath(sFilename + L"export.log", sPath), wxFile::write);
+    wxFileOutputStream fos(f);
+    wxTextOutputStream outputLog(fos);
+    outputLog.WriteString(wxString::Format(L"File\tIndex\tPalette\tComplex\tWidth\tHeight\n"));
+
+    wxString aPath = _getCaseSensitivePath(sFilename, sPath);
+    aPath += wxFileName::GetPathSeparator();
+    if(!wxFileName::DirExists(aPath))
+    {
+        wxFileName::Mkdir(aPath);
+        for(size_t i = 0; i < m_oAnims.getSpriteCount(); ++i)
+        {
+            Bitmap* pSpriteBitmap = m_oAnims.getSpriteBitmap(i, bComplex);
+            if(pSpriteBitmap->getWidth() * pSpriteBitmap->getHeight() > 0)
+            {
+                wxImage imgSprite(pSpriteBitmap->getWidth(), pSpriteBitmap->getHeight(), false);
+                pSpriteBitmap->blit(imgSprite, 0, 0, NULL, m_oAnims.getPalette(), 0x8000);
+                if(!imgSprite.HasAlpha())
+                {
+                    imgSprite.SetAlpha();
+                }
+                for(int iX = 0; iX < pSpriteBitmap->getWidth(); ++iX)
+                {
+                    for(int iY = 0; iY < pSpriteBitmap->getHeight(); ++iY)
+                    {
+                        if(imgSprite.GetRed(iX,iY) == 255 && imgSprite.GetBlue(iX,iY) == 255) {
+                            imgSprite.SetAlpha(iX,iY,(unsigned char)0);
+                        } else {
+                            imgSprite.SetAlpha(iX,iY,(unsigned char)255);
+                        }
+                    }
+                }
+                if(!imgSprite.SaveFile(_getCaseSensitivePath(wxString::Format(L"s%u.png", i), aPath),wxBITMAP_TYPE_PNG))
+                    return;
+                outputLog.WriteString(wxString::Format(L"%s\t%u\t%s\t%u\t%u\n", sFilename.wx_str(), i, sPalette.wx_str(), pSpriteBitmap->getWidth(),pSpriteBitmap->getHeight()));
+            }
+        }
+    }
+}
+
+void frmMain::_onToggleMask(wxCommandEvent& evt)
+{
+    int iID = evt.GetId() - ID_LAYER_CHECKS;
+    int iLayer = iID / 25;
+    iID %= 25;
+    
+    if(evt.IsChecked())
+        m_mskLayers.set(iLayer, iID);
+    else
+        m_mskLayers.clear(iLayer, iID);
+
+    m_panFrame->Refresh(false);
+}
+
+frmMain::~frmMain()
+{
+}
+
+void frmMain::_onFirstAnim(wxCommandEvent& evt)
+{
+    if(m_iCurrentAnim > 0)
+        _onAnimChange(0);
+}
+
+void frmMain::_onPrevAnim(wxCommandEvent& evt)
+{
+    size_t iAnim = m_iCurrentAnim;
+    while(iAnim > 0)
+    {
+        --iAnim;
+        if(!m_oAnims.isAnimationDuplicate(iAnim))
+        {
+            _onAnimChange(iAnim);
+            break;
+        }
+    }
+}
+
+void frmMain::_onNextAnim(wxCommandEvent& evt)
+{
+    size_t iAnim = m_iCurrentAnim + 1;
+    while(iAnim < m_oAnims.getAnimationCount())
+    {
+        if(!m_oAnims.isAnimationDuplicate(iAnim))
+        {
+            _onAnimChange(iAnim);
+            break;
+        }
+        iAnim++;
+    }
+}
+
+void frmMain::_onLastAnim(wxCommandEvent& evt)
+{
+    if(m_iCurrentAnim < m_oAnims.getAnimationCount() - 1)
+        _onAnimChange(m_oAnims.getAnimationCount() - 1);
+}
+
+void frmMain::_onAnimChar(wxCommandEvent& evt)
+{
+    long iAnim;
+    if(evt.GetString().ToLong(&iAnim))
+    {
+        if(iAnim >= 0 && iAnim < (long)m_oAnims.getAnimationCount())
+        {
+            _onAnimChange((size_t)iAnim);
+        }
+    }
+}
+
+void frmMain::_onGhostFileChange(wxCommandEvent& evt)
+{
+    m_iGhostFile = evt.GetId() - ID_GHOST_0;
+    m_oAnims.setGhost(m_iGhostFile, m_iGhostIndex);
+    m_panFrame->Refresh(false);
+}
+
+void frmMain::_onGhostIndexChange(wxSpinEvent& evt)
+{
+    m_iGhostIndex = evt.GetPosition();
+    m_oAnims.setGhost(m_iGhostFile, m_iGhostIndex);
+    m_panFrame->Refresh(false);
+}
+
+void frmMain::_onAnimChange(size_t iIndex)
+{
+    m_iCurrentAnim = iIndex;
+    m_txtAnimIndex->ChangeValue(wxString::Format(L"%u", (int)iIndex));
+    m_iCurrentFrame = 0;
+
+    THLayerMask oMask;
+    m_oAnims.getAnimationMask(iIndex, oMask);
+    for(int iLayer = 0; iLayer < 13; ++iLayer)
+    {
+        for(int iId = 0; iId < 32; ++iId)
+        {
+            wxCheckBox *pCheck = wxDynamicCast(FindWindow(ID_LAYER_CHECKS + iLayer * 25 + iId), wxCheckBox);
+            if(pCheck)
+            {
+                pCheck->Enable(oMask.isSet(iLayer, iId));
+            }
+        }
+    }
+
+    m_panFrame->Refresh(false);
+    m_txtFrameIndex->SetValue(wxString::Format(L"0"));
+    m_txtFrameCount->SetValue(wxString::Format(L"%u", (int)m_oAnims.getFrameCount(iIndex)));
+}
+
+void frmMain::_onPlayPause(wxCommandEvent& evt)
+{
+    m_bPlayingAnimation = !m_bPlayingAnimation;
+    if(m_bPlayingAnimation)
+        m_btnPlayPause->SetLabel(L"Pause");
+    else
+        m_btnPlayPause->SetLabel(L"Play");
+}
+
+void frmMain::_onPrevFrame(wxCommandEvent& evt)
+{
+    if(m_oAnims.getAnimationCount() == 0)
+        return;
+
+    if(m_iCurrentFrame == 0)
+        m_iCurrentFrame = m_oAnims.getFrameCount(m_iCurrentAnim) - 1;
+    else
+        m_iCurrentFrame = (m_iCurrentFrame - 1) % m_oAnims.getFrameCount(m_iCurrentAnim);
+    m_txtFrameIndex->SetValue(wxString::Format(L"%u", m_iCurrentFrame));
+    m_panFrame->Refresh(false);
+}
+
+void frmMain::_onNextFrame(wxCommandEvent& evt)
+{
+    if(m_oAnims.getAnimationCount() == 0)
+        return;
+
+    m_iCurrentFrame = (m_iCurrentFrame + 1) % m_oAnims.getFrameCount(m_iCurrentAnim);
+    m_txtFrameIndex->SetValue(wxString::Format(L"%u", m_iCurrentFrame));
+    m_panFrame->Refresh(false);
+}
+
+void frmMain::_onTimer(wxTimerEvent& evt)
+{
+    if(m_bPlayingAnimation)
+    {
+        if(m_oAnims.getAnimationCount() == 0)
+            return;
+
+        m_iCurrentFrame = (m_iCurrentFrame + 1) % m_oAnims.getFrameCount(m_iCurrentAnim);
+        m_txtFrameIndex->SetValue(wxString::Format(L"%u", m_iCurrentFrame));
+        m_panFrame->Refresh(false);
+    }
+}
+
+void frmMain::_onToggleDrawMood(wxCommandEvent& evt)
+{
+    m_bDrawMood = evt.IsChecked();
+    m_panFrame->Refresh(false);
+}
+
+void frmMain::_onToggleDrawCoordinates(wxCommandEvent& evt)
+{
+    m_bDrawCoordinates = evt.IsChecked();
+    m_panFrame->Refresh(false);
+}
+
+void frmMain::_onPanelPaint(wxPaintEvent& evt)
+{
+    wxPaintDC DC(m_panFrame);
+
+    wxImage imgCanvas(400, 400, false);
+    if(m_imgBackground.IsOk())
+    {
+        memcpy(imgCanvas.GetData(), m_imgBackground.GetData(), 400 * 400 * 3);
+    }
+    else
+    {
+        memset(imgCanvas.GetData(), 0xFF, 400 * 400 * 3);
+    }
+    if(!imgCanvas.HasAlpha())
+    {
+        imgCanvas.InitAlpha();
+    }
+    for(int iX = 0; iX < 400; ++iX)
+    {
+        for(int iY = 0; iY < 400; ++iY)
+        {
+            //set completely opaque
+            imgCanvas.SetAlpha(iX,iY,(unsigned char)255);
+        }
+    }
+    wxSize oSize;
+    m_oAnims.drawFrame(imgCanvas, m_iCurrentAnim, m_iCurrentFrame, &m_mskLayers, oSize);
+    if(m_bDrawMood)
+    {
+        m_oAnims.drawFrame(imgCanvas, 4048, 0, &m_mskLayers, oSize, m_iMoodDrawX - 1, m_iMoodDrawY - 80);
+    }
+    th_frame_t *pFrame = m_oAnims.getFrameStruct(m_iCurrentAnim, m_iCurrentFrame);
+    uint16_t iFlags = 0;
+    if(pFrame) {
+        iFlags = pFrame->flags;
+    }
+    int iFlags1 = (int)(iFlags & 0xFF);
+    int iFlags2 = (int)(iFlags >> 8);
+    m_txtFrameFlags[0]->SetValue(wxString::Format(L"0x%02x (%03i)", iFlags1, iFlags1));
+    m_txtFrameFlags[1]->SetValue(wxString::Format(L"0x%02x00 (256 * %03i)", iFlags2, iFlags2));
+    for(int i = 0; i < 16; ++i)
+        m_chkFrameFlags[i]->SetValue((iFlags & (1 << i)) != 0);
+
+    wxBitmap bmpCanvas(imgCanvas);
+
+    DC.DrawBitmap(bmpCanvas, 1, 1, false);
+
+    // Draw relative tile coordinates
+    if (m_bDrawCoordinates) {
+        for (int i = -1; i <= 1; ++i) {
+            for (int j = -1; j <= 1; ++j) {
+                _drawCoordinates(DC, i, j);
+            }
+        }
+    }
+}
+
+void frmMain::_onPanelClick(wxMouseEvent& evt)
+{
+    m_iMoodDrawX = evt.GetX() - 143;
+    m_iMoodDrawY = evt.GetY() - 203;
+    {
+        double fX = (double)m_iMoodDrawX;
+        double fY = (double)m_iMoodDrawY;
+        fY = fY / 32.0;
+        fX = fX / 64.0;
+        fY -= fX;
+        fX *= 2.0;
+        fX += fY;
+        m_txtMoodPosition[0]->SetValue(wxString::Format(L"{%.2f, %.2f}", fX, fY));
+    }
+    m_txtMoodPosition[1]->SetValue(wxString::Format(L"{%i, %i, \"px\"}", m_iMoodDrawX, m_iMoodDrawY));
+    if(m_bDrawMood)
+        m_panFrame->Refresh(false);
+}
+
+void frmMain::_onSearchLayerId(wxCommandEvent& evt)
+{
+    int iLayer = ::wxGetNumberFromUser(L"Enter the layer number to search in (0 - 12)", L"Layer:", L"Search for Layer / ID Combo", 0, 0, 13, this);
+    if(iLayer == -1)
+        return;
+    int iID = ::wxGetNumberFromUser(L"Enter the ID number to search for (0 - 24)", L"ID:", L"Search for Layer / ID Combo", 0, 0, 24, this);
+    if(iID == -1)
+        return;
+
+    m_lstSearchResults->Clear();
+    wxBusyCursor oBusy;
+    for(size_t i = 0; i < m_oAnims.getAnimationCount(); ++i)
+    {
+        if(m_oAnims.isAnimationDuplicate(i))
+            continue;
+
+        THLayerMask mskAnim;
+        m_oAnims.getAnimationMask(i, mskAnim);
+        if(mskAnim.isSet(iLayer, iID))
+        {
+            m_lstSearchResults->Append(wxString::Format(L"%i", (int)i));
+        }
+    }
+}
+
+void frmMain::_onSearchFrame(wxCommandEvent& evt)
+{
+    int iFrame = ::wxGetNumberFromUser(L"Enter the frame number to search for.", L"Frame:", L"Search for frame", 0, 0, 20000, this);
+    if(iFrame == -1)
+        return;
+
+    m_lstSearchResults->Clear();
+    wxBusyCursor oBusy;
+    for(size_t i = 0; i < m_oAnims.getAnimationCount(); ++i)
+    {
+        if(m_oAnims.isAnimationDuplicate(i))
+            continue;
+        if(m_oAnims.doesAnimationIncludeFrame(i, iFrame))
+        {
+            m_lstSearchResults->Append(wxString::Format(L"%i", (int)i));
+        }
+    }
+}
+
+void frmMain::_onSearchSoundIndex(wxCommandEvent& evt)
+{
+    int iFrame = ::wxGetNumberFromUser(L"Enter the sound index to search for.", L"Sound index:", L"Search for sound", 0, 0, 256, this);
+    if(iFrame == -1)
+        return;
+
+    m_lstSearchResults->Clear();
+    wxBusyCursor oBusy;
+    for(size_t i = 0; i < m_oAnims.getAnimationCount(); ++i)
+    {
+        if(m_oAnims.isAnimationDuplicate(i))
+            continue;
+        size_t iCount = m_oAnims.getFrameCount(i);
+        for(size_t j = 0; j < iCount; ++j)
+        {
+            if((m_oAnims.getFrameStruct(i, j)->flags & 0xFF) == iFrame)
+            {
+                m_lstSearchResults->Append(wxString::Format(L"%i", (int)i));
+                break;
+            }
+        }
+    }
+}
+
+void frmMain::_onGotoSearchResult(wxCommandEvent& evt)
+{
+    long iAnim;
+    evt.GetString().ToLong(&iAnim);
+    _onAnimChange(iAnim);
+}
+
+void frmMain::_drawCoordinates(wxPaintDC& DC, int i, int j)
+{
+    int x = 122; // tile (0, 0) text start x-coordinate
+    int y = 226; // tile (0, 0) text start y-coordinate
+    wxString s;
+    s.Printf(_T("(%2d,%2d)"), i, j);
+    DC.DrawText(s, 32 * (i - j) + x, 16 * (i + j - 2) + y);
+}
+
+wxString frmMain::_getCaseSensitivePath(const wxString& sInsensitivePathPart, const wxString& sPath)
+{
+  bool found;
+  bool cont;
+  
+  if(!wxFileName::IsCaseSensitive()) { return sPath + sInsensitivePathPart; }
+  
+  wxString retStr(sPath);
+  
+  wxStringTokenizer pathTokenizer(sInsensitivePathPart, wxFileName::GetPathSeparator());
+  while(pathTokenizer.HasMoreTokens())
+  {
+    wxDir dir(retStr);
+    if(!dir.IsOpened())
+    {
+      break;
+    }
+    
+    wxString pathPart = pathTokenizer.GetNextToken();
+    
+    wxString realName;
+    cont = dir.GetFirst(&realName, wxEmptyString, wxDIR_DIRS|wxDIR_FILES|wxDIR_HIDDEN|wxDIR_DOTDOT);
+    found = false;
+    while(cont)
+    {
+      if(realName.Upper() == pathPart.Upper())
+      {
+        if(retStr.Last() != wxFileName::GetPathSeparator())
+        {
+          retStr += wxFileName::GetPathSeparator();
+        }
+        retStr += realName;
+        found = true;
+        break;
+      }
+      cont = dir.GetNext(&realName);
+    }
+    
+    if(!found)
+    {
+      retStr += wxFileName::GetPathSeparator();
+      retStr += pathPart;
+      break;
+    }
+  }
+  
+  while(pathTokenizer.HasMoreTokens())
+  {
+    wxString pathPart = pathTokenizer.GetNextToken();
+    if(retStr.Last() != wxFileName::GetPathSeparator())
+    {
+      retStr += wxFileName::GetPathSeparator();
+    }
+    retStr += pathPart;
+  }
+  
+  return retStr;
+}
old mode 100755 (executable)
new mode 100644 (file)
index 3ef36c8..b0089f5
-/*\r
-Copyright (c) 2009 Peter "Corsix" Cawley\r
-\r
-Permission is hereby granted, free of charge, to any person obtaining a copy of\r
-this software and associated documentation files (the "Software"), to deal in\r
-the Software without restriction, including without limitation the rights to\r
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
-of the Software, and to permit persons to whom the Software is furnished to do\r
-so, subject to the following conditions:\r
-\r
-The above copyright notice and this permission notice shall be included in all\r
-copies or substantial portions of the Software.\r
-\r
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
-SOFTWARE.\r
-*/\r
-\r
-#pragma once\r
-#include <wx/frame.h>\r
-#include <wx/button.h>\r
-#include <wx/spinctrl.h>\r
-#include <wx/checkbox.h>\r
-#include <wx/textctrl.h>\r
-#include <wx/panel.h>\r
-#include <wx/timer.h>\r
-#include <wx/listbox.h>\r
-#include <wx/dcclient.h>\r
-#include <wx/txtstrm.h>\r
-#include "th.h"\r
-//#include <vector>\r
-\r
-class frmMain : public wxFrame\r
-{\r
-public:\r
-    frmMain();\r
-    ~frmMain();\r
-\r
-    enum\r
-    {\r
-        ID_FIRST_ANIM = wxID_HIGHEST + 1,\r
-        ID_PREV_ANIM,\r
-        ID_ANIM_INDEX,\r
-        ID_NEXT_ANIM,\r
-        ID_LAST_ANIM,\r
-        ID_PREV_FRAME,\r
-        ID_NEXT_FRAME,\r
-        ID_PLAY_PAUSE,\r
-        ID_TIMER_ANIMATE,\r
-        ID_SEARCH_LAYER_ID,\r
-        ID_SEARCH_FRAME,\r
-        ID_SEARCH_SOUND,\r
-        ID_SEARCH_RESULTS,\r
-        ID_GHOST_0,\r
-        ID_GHOST_1,\r
-        ID_GHOST_2,\r
-        ID_GHOST_3,\r
-        ID_LOAD,\r
-        ID_BROWSE,\r
-        ID_EXPORT,\r
-        ID_DRAW_MOOD,\r
-        ID_DRAW_COORDINATES,\r
-        ID_LAYER_CHECKS, // Must be last ID\r
-    };\r
-\r
-    void load();\r
-    void export_png();\r
-    void exportSpritesPage(bool bComplex, wxString sPath, wxString sFilename, wxString spPath=L"", wxString sPalette=L"MPALETTE.DAT");\r
-    //std::vector<_sprite_t> m_vSprites;\r
-\r
-protected:\r
-    void _onLoad(wxCommandEvent& evt);\r
-    void _onBrowse(wxCommandEvent& evt);\r
-    void _onExport(wxCommandEvent& evt);\r
-    void _onFirstAnim(wxCommandEvent& evt);\r
-    void _onPrevAnim(wxCommandEvent& evt);\r
-    void _onNextAnim(wxCommandEvent& evt);\r
-    void _onLastAnim(wxCommandEvent& evt);\r
-    void _onPrevFrame(wxCommandEvent& evt);\r
-    void _onNextFrame(wxCommandEvent& evt);\r
-    void _onPlayPause(wxCommandEvent& evt);\r
-    void _onToggleMask(wxCommandEvent& evt);\r
-    void _onToggleDrawMood(wxCommandEvent& evt);\r
-    void _onToggleDrawCoordinates(wxCommandEvent& evt);\r
-    void _onSearchLayerId(wxCommandEvent& evt);\r
-    void _onSearchFrame(wxCommandEvent& evt);\r
-    void _onSearchSoundIndex(wxCommandEvent& evt);\r
-    void _onGotoSearchResult(wxCommandEvent& evt);\r
-    void _onAnimChar(wxCommandEvent& evt);\r
-    void _onGhostFileChange(wxCommandEvent& evt);\r
-    void _onGhostIndexChange(wxSpinEvent& evt);\r
-    void _onPanelPaint(wxPaintEvent& evt);\r
-    void _onPanelClick(wxMouseEvent& evt);\r
-    void _onTimer(wxTimerEvent& evt);\r
-\r
-    void _onAnimChange(size_t iIndex);\r
-\r
-    void _drawCoordinates(wxPaintDC& DC, int i, int j);\r
-    wxString _getCaseSensitivePath(const wxString& sInsensitivePathPart, const wxString& sPath);\r
-\r
-    THAnimations m_oAnims;\r
-    THLayerMask m_mskLayers;\r
-    wxImage m_imgBackground;\r
-    wxTimer m_tmrAnimate;\r
-    size_t m_iCurrentAnim;\r
-    size_t m_iCurrentFrame;\r
-    int m_iGhostFile;\r
-    int m_iGhostIndex;\r
-    int m_iMoodDrawX;\r
-    int m_iMoodDrawY;\r
-    bool m_bPlayingAnimation;\r
-    bool m_bDrawMood;\r
-    bool m_bDrawCoordinates;\r
-\r
-    wxButton* m_btnPlayPause;\r
-    wxButton* m_btnExport;\r
-    wxTextCtrl* m_txtTHPath;\r
-    wxTextCtrl* m_txtAnimIndex;\r
-    wxTextCtrl* m_txtAnimCount;\r
-    wxTextCtrl* m_txtFrameIndex;\r
-    wxTextCtrl* m_txtFrameCount;\r
-    wxTextCtrl* m_txtFrameFlags[2];\r
-    wxTextCtrl* m_txtMoodPosition[2];\r
-    wxCheckBox* m_chkFrameFlags[16];\r
-    wxListBox* m_lstSearchResults;\r
-    wxPanel* m_panFrame;\r
-    DECLARE_EVENT_TABLE();\r
-};\r
+/*
+Copyright (c) 2009 Peter "Corsix" Cawley
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#pragma once
+#include <wx/frame.h>
+#include <wx/button.h>
+#include <wx/spinctrl.h>
+#include <wx/checkbox.h>
+#include <wx/textctrl.h>
+#include <wx/panel.h>
+#include <wx/timer.h>
+#include <wx/listbox.h>
+#include <wx/dcclient.h>
+#include <wx/txtstrm.h>
+#include "th.h"
+//#include <vector>
+
+class frmMain : public wxFrame
+{
+public:
+    frmMain();
+    ~frmMain();
+
+    enum
+    {
+        ID_FIRST_ANIM = wxID_HIGHEST + 1,
+        ID_PREV_ANIM,
+        ID_ANIM_INDEX,
+        ID_NEXT_ANIM,
+        ID_LAST_ANIM,
+        ID_PREV_FRAME,
+        ID_NEXT_FRAME,
+        ID_PLAY_PAUSE,
+        ID_TIMER_ANIMATE,
+        ID_SEARCH_LAYER_ID,
+        ID_SEARCH_FRAME,
+        ID_SEARCH_SOUND,
+        ID_SEARCH_RESULTS,
+        ID_GHOST_0,
+        ID_GHOST_1,
+        ID_GHOST_2,
+        ID_GHOST_3,
+        ID_LOAD,
+        ID_BROWSE,
+        ID_EXPORT,
+        ID_DRAW_MOOD,
+        ID_DRAW_COORDINATES,
+        ID_LAYER_CHECKS, // Must be last ID
+    };
+
+    void load();
+    void export_png();
+    void exportSpritesPage(bool bComplex, wxString sPath, wxString sFilename, wxString spPath=L"", wxString sPalette=L"MPALETTE.DAT");
+    //std::vector<_sprite_t> m_vSprites;
+
+protected:
+    void _onLoad(wxCommandEvent& evt);
+    void _onBrowse(wxCommandEvent& evt);
+    void _onExport(wxCommandEvent& evt);
+    void _onFirstAnim(wxCommandEvent& evt);
+    void _onPrevAnim(wxCommandEvent& evt);
+    void _onNextAnim(wxCommandEvent& evt);
+    void _onLastAnim(wxCommandEvent& evt);
+    void _onPrevFrame(wxCommandEvent& evt);
+    void _onNextFrame(wxCommandEvent& evt);
+    void _onPlayPause(wxCommandEvent& evt);
+    void _onToggleMask(wxCommandEvent& evt);
+    void _onToggleDrawMood(wxCommandEvent& evt);
+    void _onToggleDrawCoordinates(wxCommandEvent& evt);
+    void _onSearchLayerId(wxCommandEvent& evt);
+    void _onSearchFrame(wxCommandEvent& evt);
+    void _onSearchSoundIndex(wxCommandEvent& evt);
+    void _onGotoSearchResult(wxCommandEvent& evt);
+    void _onAnimChar(wxCommandEvent& evt);
+    void _onGhostFileChange(wxCommandEvent& evt);
+    void _onGhostIndexChange(wxSpinEvent& evt);
+    void _onPanelPaint(wxPaintEvent& evt);
+    void _onPanelClick(wxMouseEvent& evt);
+    void _onTimer(wxTimerEvent& evt);
+
+    void _onAnimChange(size_t iIndex);
+
+    void _drawCoordinates(wxPaintDC& DC, int i, int j);
+    wxString _getCaseSensitivePath(const wxString& sInsensitivePathPart, const wxString& sPath);
+
+    THAnimations m_oAnims;
+    THLayerMask m_mskLayers;
+    wxImage m_imgBackground;
+    wxTimer m_tmrAnimate;
+    size_t m_iCurrentAnim;
+    size_t m_iCurrentFrame;
+    int m_iGhostFile;
+    int m_iGhostIndex;
+    int m_iMoodDrawX;
+    int m_iMoodDrawY;
+    bool m_bPlayingAnimation;
+    bool m_bDrawMood;
+    bool m_bDrawCoordinates;
+
+    wxButton* m_btnPlayPause;
+    wxButton* m_btnExport;
+    wxTextCtrl* m_txtTHPath;
+    wxTextCtrl* m_txtAnimIndex;
+    wxTextCtrl* m_txtAnimCount;
+    wxTextCtrl* m_txtFrameIndex;
+    wxTextCtrl* m_txtFrameCount;
+    wxTextCtrl* m_txtFrameFlags[2];
+    wxTextCtrl* m_txtMoodPosition[2];
+    wxCheckBox* m_chkFrameFlags[16];
+    wxListBox* m_lstSearchResults;
+    wxPanel* m_panFrame;
+    DECLARE_EVENT_TABLE();
+};
old mode 100755 (executable)
new mode 100644 (file)
index 28dd4f8..2d8d3a4
-/*\r
-Copyright (c) 2009 Peter "Corsix" Cawley\r
-\r
-Permission is hereby granted, free of charge, to any person obtaining a copy of\r
-this software and associated documentation files (the "Software"), to deal in\r
-the Software without restriction, including without limitation the rights to\r
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
-of the Software, and to permit persons to whom the Software is furnished to do\r
-so, subject to the following conditions:\r
-\r
-The above copyright notice and this permission notice shall be included in all\r
-copies or substantial portions of the Software.\r
-\r
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
-SOFTWARE.\r
-*/\r
-\r
-#include "frmSprites.h"\r
-#include <wx/sizer.h>\r
-#include <wx/stattext.h>\r
-#include <wx/msgdlg.h>\r
-#include <wx/dirdlg.h>\r
-#include <wx/filedlg.h>\r
-#include <wx/dcclient.h>\r
-\r
-BEGIN_EVENT_TABLE(frmSprites, wxFrame)\r
-  EVT_BUTTON(ID_LOAD, frmSprites::_onLoad)\r
-  EVT_BUTTON(ID_BROWSE_TABLE, frmSprites::_onBrowseTable)\r
-  EVT_BUTTON(ID_BROWSE_DATA, frmSprites::_onBrowseData)\r
-  EVT_BUTTON(ID_BROWSE_PALETTE, frmSprites::_onBrowsePalette)\r
-  EVT_BUTTON(ID_LOAD_COMPLEX, frmSprites::_onLoadComplex)\r
-  EVT_BUTTON(ID_NEXT, frmSprites::_onNext)\r
-END_EVENT_TABLE()\r
-\r
-frmSprites::frmSprites()\r
-  : wxFrame(NULL, wxID_ANY, L"Theme Hospital Sprite Viewer")\r
-{\r
-    wxBoxSizer *pMainSizer = new wxBoxSizer(wxVERTICAL);\r
-\r
-    wxStaticBoxSizer *pFiles = new wxStaticBoxSizer(wxVERTICAL, this, L"Files");\r
-    wxFlexGridSizer *pFilesGrid = new wxFlexGridSizer(4, 3, 2, 1);\r
-    pFilesGrid->AddGrowableCol(1, 1);\r
-    pFilesGrid->Add(new wxStaticText(this, wxID_ANY, L"Table:"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);\r
-    pFilesGrid->Add(m_txtTable = new wxTextCtrl(this, wxID_ANY, L"X:\\ThemeHospital\\hospital\\QData\\Font00V.tab"), 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);\r
-    pFilesGrid->Add(new wxButton(this, ID_BROWSE_TABLE, L"Browse..."), 0, wxALIGN_CENTER_VERTICAL);\r
-    pFilesGrid->Add(new wxStaticText(this, wxID_ANY, L"Data:"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);\r
-    pFilesGrid->Add(m_txtData = new wxTextCtrl(this, wxID_ANY, L""), 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);\r
-    pFilesGrid->Add(new wxButton(this, ID_BROWSE_DATA, L"Browse..."), 0, wxALIGN_CENTER_VERTICAL);\r
-    pFilesGrid->Add(new wxStaticText(this, wxID_ANY, L"Palette:"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);\r
-    pFilesGrid->Add(m_txtPalette = new wxTextCtrl(this, wxID_ANY, L"X:\\ThemeHospital\\hospital\\Data\\MPalette.dat"), 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);\r
-    pFilesGrid->Add(new wxButton(this, ID_BROWSE_PALETTE, L"Browse..."), 0, wxALIGN_CENTER_VERTICAL);\r
-    pFiles->Add(pFilesGrid, 0, wxEXPAND | wxALL, 1);\r
-    wxButton *pTmp;\r
-    pFiles->Add(pTmp = new wxButton(this, ID_LOAD, L"Load Simple"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pFiles->Add(pTmp = new wxButton(this, ID_LOAD_COMPLEX, L"Load Complex"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    pFiles->Add(pTmp = new wxButton(this, ID_NEXT, L"Next"), 0, wxALIGN_CENTER | wxALL, 1);\r
-    SetBackgroundColour(pTmp->GetBackgroundColour());\r
-    pMainSizer->Add(pFiles, 0, wxEXPAND | wxALL, 2);\r
-\r
-    wxStaticBoxSizer *pSprites = new wxStaticBoxSizer(wxVERTICAL, this, L"Sprites");\r
-    pSprites->Add(m_panFrame = new wxPanel(this, wxID_ANY), 1, wxEXPAND);\r
-    pMainSizer->Add(pSprites, 1, wxEXPAND | wxALL, 2);\r
-    m_panFrame->Connect(wxEVT_PAINT, (wxObjectEventFunction)&frmSprites::_onPanelPaint, NULL, this);\r
-\r
-    SetSizer(pMainSizer);\r
-\r
-    load(true);\r
-}\r
-\r
-frmSprites::~frmSprites()\r
-{\r
-}\r
-\r
-void frmSprites::_onLoad(wxCommandEvent& evt)\r
-{\r
-    load(false);\r
-}\r
-\r
-void frmSprites::_onLoadComplex(wxCommandEvent& evt)\r
-{\r
-    load(true);\r
-}\r
-\r
-void frmSprites::_onNext(wxCommandEvent& evt)\r
-{\r
-    wxString s = m_txtTable->GetValue();\r
-    while(true)\r
-    {\r
-        const wxChar* sc = s.c_str();\r
-        for(size_t i = s.Length(); i > 0;)\r
-        {\r
-            --i;\r
-            if('0' <= sc[i] && sc[i] <= '9')\r
-            {\r
-                s.SetChar(i, sc[i] + 1);\r
-                if(sc[i] > '9')\r
-                {\r
-                    s.SetChar(i, '0');\r
-                    if(sc[i - 1] == '9')\r
-                    {\r
-                        s.SetChar(i - 1, '0');\r
-                        return;\r
-                    }\r
-                    s.SetChar(i - 1, sc[i - 1] + 1);\r
-                }\r
-                break;\r
-            }\r
-        }\r
-        if(::wxFileExists(s))\r
-        {\r
-            m_txtTable->SetValue(s);\r
-            return;\r
-        }\r
-    }\r
-}\r
-\r
-void frmSprites::load(bool bComplex)\r
-{\r
-    if(!m_oAnims.loadTableFile(m_txtTable->GetValue())\r
-     ||!m_oAnims.loadSpriteFile(m_txtData->GetValue().IsEmpty() ? m_txtTable->GetValue().BeforeLast('.')+L".DAT" : m_txtData->GetValue())\r
-     ||!m_oAnims.loadPaletteFile(m_txtPalette->GetValue()))\r
-    {\r
-        ::wxMessageBox(L"Cannot load files");\r
-        return;\r
-    }\r
-\r
-    m_vSprites.clear();\r
-    for(size_t i = 0; i < m_oAnims.getSpriteCount(); ++i)\r
-    {\r
-        _sprite_t oSprite;\r
-        Bitmap* pSpriteBitmap = m_oAnims.getSpriteBitmap(i, bComplex);\r
-        oSprite.caption = wxString::Format(L"#%i (%ix%i)", (int)i, pSpriteBitmap->getWidth(), pSpriteBitmap->getHeight());\r
-        if(pSpriteBitmap->getWidth() * pSpriteBitmap->getHeight() > 0)\r
-        {\r
-            wxImage imgSprite(pSpriteBitmap->getWidth(), pSpriteBitmap->getHeight(), false);\r
-            pSpriteBitmap->blit(imgSprite, 0, 0, NULL, m_oAnims.getPalette(), 0x8000);\r
-            oSprite.bitmap = wxBitmap(imgSprite);\r
-        }\r
-        m_vSprites.push_back(oSprite);\r
-    }\r
-\r
-    m_panFrame->Refresh();\r
-}\r
-\r
-void frmSprites::_onPanelPaint(wxPaintEvent& evt)\r
-{\r
-    wxPaintDC dc(m_panFrame);\r
-\r
-    int iAvailableWidth, iAvailableHeight;\r
-    m_panFrame->GetClientSize(&iAvailableWidth, &iAvailableHeight);\r
-    int iX = 0, iY = 0, iTallest = 0;\r
-\r
-    for(std::vector<_sprite_t>::iterator itr = m_vSprites.begin(), itrEnd = m_vSprites.end();\r
-        itr != itrEnd; ++itr)\r
-    {\r
-        wxSize szLabel = dc.GetTextExtent(itr->caption);\r
-        int iWidth = wxMax(szLabel.GetWidth(), itr->bitmap.IsOk() ? itr->bitmap.GetWidth() : 0);\r
-        if(iWidth + iX > iAvailableWidth)\r
-        {\r
-            iY += iTallest;\r
-            iX = iTallest = 0;\r
-            if(iY > iAvailableHeight)\r
-                break;\r
-        }\r
-\r
-        dc.DrawText(itr->caption, iX, iY);\r
-        if(itr->bitmap.IsOk())\r
-            dc.DrawBitmap(itr->bitmap, iX, iY + szLabel.GetHeight() + 1);\r
-\r
-        int iHeight = (itr->bitmap.IsOk() ? itr->bitmap.GetHeight() : 0) + szLabel.GetHeight() + 2;\r
-        iTallest = wxMax(iTallest, iHeight);\r
-        iX += iWidth + 2;\r
-    }\r
-}\r
-\r
-void frmSprites::_onBrowseTable(wxCommandEvent& WXUNUSED(evt))\r
-{\r
-    m_txtTable->SetValue(::wxFileSelector(L"Select location of Font00V.tab (DATA)",\r
-        m_txtTable->GetValue(),L"Font00V.tab",L"tab",L"Tab files (*.tab)|*.tab"\r
-        ,0, this));\r
-}\r
-void frmSprites::_onBrowseData(wxCommandEvent& WXUNUSED(evt))\r
-{\r
-    m_txtData->SetValue(::wxFileSelector(L"Choose Theme Hospital data file",\r
-        m_txtData->GetValue(),L"",L"dat",L"Dat files (*.dat)|*.dat", 0, this));\r
-}\r
-void frmSprites::_onBrowsePalette(wxCommandEvent& WXUNUSED(evt))\r
-{\r
-    m_txtPalette->SetValue(::wxFileSelector(L"Select location of MPalette.dat (QDATA)",\r
-        m_txtPalette->GetValue(),L"MPalette.dat",L"dat",L"Dat or Pal files (*.dat, *.pal)|*.dat;*.pal", 0, this));\r
-}\r
+/*
+Copyright (c) 2009 Peter "Corsix" Cawley
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#include "frmSprites.h"
+#include <wx/sizer.h>
+#include <wx/stattext.h>
+#include <wx/msgdlg.h>
+#include <wx/dirdlg.h>
+#include <wx/filedlg.h>
+#include <wx/dcclient.h>
+
+BEGIN_EVENT_TABLE(frmSprites, wxFrame)
+  EVT_BUTTON(ID_LOAD, frmSprites::_onLoad)
+  EVT_BUTTON(ID_BROWSE_TABLE, frmSprites::_onBrowseTable)
+  EVT_BUTTON(ID_BROWSE_DATA, frmSprites::_onBrowseData)
+  EVT_BUTTON(ID_BROWSE_PALETTE, frmSprites::_onBrowsePalette)
+  EVT_BUTTON(ID_LOAD_COMPLEX, frmSprites::_onLoadComplex)
+  EVT_BUTTON(ID_NEXT, frmSprites::_onNext)
+END_EVENT_TABLE()
+
+frmSprites::frmSprites()
+  : wxFrame(NULL, wxID_ANY, L"Theme Hospital Sprite Viewer")
+{
+    wxBoxSizer *pMainSizer = new wxBoxSizer(wxVERTICAL);
+
+    wxStaticBoxSizer *pFiles = new wxStaticBoxSizer(wxVERTICAL, this, L"Files");
+    wxFlexGridSizer *pFilesGrid = new wxFlexGridSizer(4, 3, 2, 1);
+    pFilesGrid->AddGrowableCol(1, 1);
+    pFilesGrid->Add(new wxStaticText(this, wxID_ANY, L"Table:"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);
+    pFilesGrid->Add(m_txtTable = new wxTextCtrl(this, wxID_ANY, L"X:\\ThemeHospital\\hospital\\QData\\Font00V.tab"), 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);
+    pFilesGrid->Add(new wxButton(this, ID_BROWSE_TABLE, L"Browse..."), 0, wxALIGN_CENTER_VERTICAL);
+    pFilesGrid->Add(new wxStaticText(this, wxID_ANY, L"Data:"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);
+    pFilesGrid->Add(m_txtData = new wxTextCtrl(this, wxID_ANY, L""), 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);
+    pFilesGrid->Add(new wxButton(this, ID_BROWSE_DATA, L"Browse..."), 0, wxALIGN_CENTER_VERTICAL);
+    pFilesGrid->Add(new wxStaticText(this, wxID_ANY, L"Palette:"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);
+    pFilesGrid->Add(m_txtPalette = new wxTextCtrl(this, wxID_ANY, L"X:\\ThemeHospital\\hospital\\Data\\MPalette.dat"), 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);
+    pFilesGrid->Add(new wxButton(this, ID_BROWSE_PALETTE, L"Browse..."), 0, wxALIGN_CENTER_VERTICAL);
+    pFiles->Add(pFilesGrid, 0, wxEXPAND | wxALL, 1);
+    wxButton *pTmp;
+    pFiles->Add(pTmp = new wxButton(this, ID_LOAD, L"Load Simple"), 0, wxALIGN_CENTER | wxALL, 1);
+    pFiles->Add(pTmp = new wxButton(this, ID_LOAD_COMPLEX, L"Load Complex"), 0, wxALIGN_CENTER | wxALL, 1);
+    pFiles->Add(pTmp = new wxButton(this, ID_NEXT, L"Next"), 0, wxALIGN_CENTER | wxALL, 1);
+    SetBackgroundColour(pTmp->GetBackgroundColour());
+    pMainSizer->Add(pFiles, 0, wxEXPAND | wxALL, 2);
+
+    wxStaticBoxSizer *pSprites = new wxStaticBoxSizer(wxVERTICAL, this, L"Sprites");
+    pSprites->Add(m_panFrame = new wxPanel(this, wxID_ANY), 1, wxEXPAND);
+    pMainSizer->Add(pSprites, 1, wxEXPAND | wxALL, 2);
+    m_panFrame->Connect(wxEVT_PAINT, (wxObjectEventFunction)&frmSprites::_onPanelPaint, NULL, this);
+
+    SetSizer(pMainSizer);
+
+    load(true);
+}
+
+frmSprites::~frmSprites()
+{
+}
+
+void frmSprites::_onLoad(wxCommandEvent& evt)
+{
+    load(false);
+}
+
+void frmSprites::_onLoadComplex(wxCommandEvent& evt)
+{
+    load(true);
+}
+
+void frmSprites::_onNext(wxCommandEvent& evt)
+{
+    wxString s = m_txtTable->GetValue();
+    while(true)
+    {
+        const wxChar* sc = s.c_str();
+        for(size_t i = s.Length(); i > 0;)
+        {
+            --i;
+            if('0' <= sc[i] && sc[i] <= '9')
+            {
+                s.SetChar(i, sc[i] + 1);
+                if(sc[i] > '9')
+                {
+                    s.SetChar(i, '0');
+                    if(sc[i - 1] == '9')
+                    {
+                        s.SetChar(i - 1, '0');
+                        return;
+                    }
+                    s.SetChar(i - 1, sc[i - 1] + 1);
+                }
+                break;
+            }
+        }
+        if(::wxFileExists(s))
+        {
+            m_txtTable->SetValue(s);
+            return;
+        }
+    }
+}
+
+void frmSprites::load(bool bComplex)
+{
+    if(!m_oAnims.loadTableFile(m_txtTable->GetValue())
+     ||!m_oAnims.loadSpriteFile(m_txtData->GetValue().IsEmpty() ? m_txtTable->GetValue().BeforeLast('.')+L".DAT" : m_txtData->GetValue())
+     ||!m_oAnims.loadPaletteFile(m_txtPalette->GetValue()))
+    {
+        ::wxMessageBox(L"Cannot load files");
+        return;
+    }
+
+    m_vSprites.clear();
+    for(size_t i = 0; i < m_oAnims.getSpriteCount(); ++i)
+    {
+        _sprite_t oSprite;
+        Bitmap* pSpriteBitmap = m_oAnims.getSpriteBitmap(i, bComplex);
+        oSprite.caption = wxString::Format(L"#%i (%ix%i)", (int)i, pSpriteBitmap->getWidth(), pSpriteBitmap->getHeight());
+        if(pSpriteBitmap->getWidth() * pSpriteBitmap->getHeight() > 0)
+        {
+            wxImage imgSprite(pSpriteBitmap->getWidth(), pSpriteBitmap->getHeight(), false);
+            pSpriteBitmap->blit(imgSprite, 0, 0, NULL, m_oAnims.getPalette(), 0x8000);
+            oSprite.bitmap = wxBitmap(imgSprite);
+        }
+        m_vSprites.push_back(oSprite);
+    }
+
+    m_panFrame->Refresh();
+}
+
+void frmSprites::_onPanelPaint(wxPaintEvent& evt)
+{
+    wxPaintDC dc(m_panFrame);
+
+    int iAvailableWidth, iAvailableHeight;
+    m_panFrame->GetClientSize(&iAvailableWidth, &iAvailableHeight);
+    int iX = 0, iY = 0, iTallest = 0;
+
+    for(std::vector<_sprite_t>::iterator itr = m_vSprites.begin(), itrEnd = m_vSprites.end();
+        itr != itrEnd; ++itr)
+    {
+        wxSize szLabel = dc.GetTextExtent(itr->caption);
+        int iWidth = wxMax(szLabel.GetWidth(), itr->bitmap.IsOk() ? itr->bitmap.GetWidth() : 0);
+        if(iWidth + iX > iAvailableWidth)
+        {
+            iY += iTallest;
+            iX = iTallest = 0;
+            if(iY > iAvailableHeight)
+                break;
+        }
+
+        dc.DrawText(itr->caption, iX, iY);
+        if(itr->bitmap.IsOk())
+            dc.DrawBitmap(itr->bitmap, iX, iY + szLabel.GetHeight() + 1);
+
+        int iHeight = (itr->bitmap.IsOk() ? itr->bitmap.GetHeight() : 0) + szLabel.GetHeight() + 2;
+        iTallest = wxMax(iTallest, iHeight);
+        iX += iWidth + 2;
+    }
+}
+
+void frmSprites::_onBrowseTable(wxCommandEvent& WXUNUSED(evt))
+{
+    m_txtTable->SetValue(::wxFileSelector(L"Select location of Font00V.tab (DATA)",
+        m_txtTable->GetValue(),L"Font00V.tab",L"tab",L"Tab files (*.tab)|*.tab"
+        ,0, this));
+}
+void frmSprites::_onBrowseData(wxCommandEvent& WXUNUSED(evt))
+{
+    m_txtData->SetValue(::wxFileSelector(L"Choose Theme Hospital data file",
+        m_txtData->GetValue(),L"",L"dat",L"Dat files (*.dat)|*.dat", 0, this));
+}
+void frmSprites::_onBrowsePalette(wxCommandEvent& WXUNUSED(evt))
+{
+    m_txtPalette->SetValue(::wxFileSelector(L"Select location of MPalette.dat (QDATA)",
+        m_txtPalette->GetValue(),L"MPalette.dat",L"dat",L"Dat or Pal files (*.dat, *.pal)|*.dat;*.pal", 0, this));
+}
old mode 100755 (executable)
new mode 100644 (file)
index e469e63..334c211
@@ -1,75 +1,75 @@
-/*\r
-Copyright (c) 2009 Peter "Corsix" Cawley\r
-\r
-Permission is hereby granted, free of charge, to any person obtaining a copy of\r
-this software and associated documentation files (the "Software"), to deal in\r
-the Software without restriction, including without limitation the rights to\r
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
-of the Software, and to permit persons to whom the Software is furnished to do\r
-so, subject to the following conditions:\r
-\r
-The above copyright notice and this permission notice shall be included in all\r
-copies or substantial portions of the Software.\r
-\r
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
-SOFTWARE.\r
-*/\r
-\r
-#pragma once\r
-#include <wx/bitmap.h>\r
-#include <wx/frame.h>\r
-#include <wx/button.h>\r
-#include <wx/checkbox.h>\r
-#include <wx/textctrl.h>\r
-#include <wx/panel.h>\r
-#include <wx/timer.h>\r
-#include <wx/listbox.h>\r
-#include "th.h"\r
-#include <vector>\r
-\r
-class frmSprites : public wxFrame\r
-{\r
-public:\r
-    frmSprites();\r
-    ~frmSprites();\r
-\r
-    enum\r
-    {\r
-        ID_LOAD = wxID_HIGHEST + 1,\r
-        ID_BROWSE_TABLE,\r
-        ID_BROWSE_DATA,\r
-        ID_BROWSE_PALETTE,\r
-        ID_LOAD_COMPLEX,\r
-        ID_NEXT,\r
-    };\r
-\r
-    void load(bool bComplex);\r
-protected:\r
-    struct _sprite_t\r
-    {\r
-        wxBitmap bitmap;\r
-        wxString caption;\r
-    };\r
-\r
-    void _onNext(wxCommandEvent& evt);\r
-    void _onLoad(wxCommandEvent& evt);\r
-    void _onLoadComplex(wxCommandEvent& evt);\r
-    void _onPanelPaint(wxPaintEvent& evt);\r
-    void _onBrowseData(wxCommandEvent& evt);\r
-    void _onBrowsePalette(wxCommandEvent& evt);\r
-    void _onBrowseTable(wxCommandEvent& evt);\r
-\r
-    std::vector<_sprite_t> m_vSprites;\r
-    THAnimations m_oAnims;\r
-    \r
-    wxTextCtrl* m_txtTable;\r
-    wxTextCtrl* m_txtData;\r
-    wxTextCtrl* m_txtPalette;\r
-    wxPanel* m_panFrame;\r
-    DECLARE_EVENT_TABLE();\r
-};\r
+/*
+Copyright (c) 2009 Peter "Corsix" Cawley
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#pragma once
+#include <wx/bitmap.h>
+#include <wx/frame.h>
+#include <wx/button.h>
+#include <wx/checkbox.h>
+#include <wx/textctrl.h>
+#include <wx/panel.h>
+#include <wx/timer.h>
+#include <wx/listbox.h>
+#include "th.h"
+#include <vector>
+
+class frmSprites : public wxFrame
+{
+public:
+    frmSprites();
+    ~frmSprites();
+
+    enum
+    {
+        ID_LOAD = wxID_HIGHEST + 1,
+        ID_BROWSE_TABLE,
+        ID_BROWSE_DATA,
+        ID_BROWSE_PALETTE,
+        ID_LOAD_COMPLEX,
+        ID_NEXT,
+    };
+
+    void load(bool bComplex);
+protected:
+    struct _sprite_t
+    {
+        wxBitmap bitmap;
+        wxString caption;
+    };
+
+    void _onNext(wxCommandEvent& evt);
+    void _onLoad(wxCommandEvent& evt);
+    void _onLoadComplex(wxCommandEvent& evt);
+    void _onPanelPaint(wxPaintEvent& evt);
+    void _onBrowseData(wxCommandEvent& evt);
+    void _onBrowsePalette(wxCommandEvent& evt);
+    void _onBrowseTable(wxCommandEvent& evt);
+
+    std::vector<_sprite_t> m_vSprites;
+    THAnimations m_oAnims;
+    
+    wxTextCtrl* m_txtTable;
+    wxTextCtrl* m_txtData;
+    wxTextCtrl* m_txtPalette;
+    wxPanel* m_panFrame;
+    DECLARE_EVENT_TABLE();
+};
old mode 100755 (executable)
new mode 100644 (file)
index e984867..b7cea36
-/*\r
-    RNC decompression library. Copyright and ownership status unknown.\r
-\r
-    Original code was from http://www.yoda.arachsys.com/dk/utils.html, but that\r
-    site nor the code itself states any ownership or copyright claims.\r
-    Modifications made to the original code include:\r
-      * Const correctness\r
-      * Prebuilt CRC table\r
-      * Indentation and code style\r
-*/\r
-\r
-#include "th.h"\r
-\r
-#define RNC_OK                  0\r
-#define RNC_FILE_IS_NOT_RNC    -1\r
-#define RNC_HUF_DECODE_ERROR   -2\r
-#define RNC_FILE_SIZE_MISMATCH -3\r
-#define RNC_PACKED_CRC_ERROR   -4\r
-#define RNC_UNPACKED_CRC_ERROR -5\r
-#define RNC_SIGNATURE 0x524E4301       /* "RNC\001" */\r
-\r
-static const unsigned short rnc_crc_table[256] = {\r
-    0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,\r
-    0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,\r
-    0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,\r
-    0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,\r
-    0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,\r
-    0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,\r
-    0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,\r
-    0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,\r
-    0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,\r
-    0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,\r
-    0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,\r
-    0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,\r
-    0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,\r
-    0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,\r
-    0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,\r
-    0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,\r
-    0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,\r
-    0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,\r
-    0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,\r
-    0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,\r
-    0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,\r
-    0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,\r
-    0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,\r
-    0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,\r
-    0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,\r
-    0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,\r
-    0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,\r
-    0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,\r
-    0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,\r
-    0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,\r
-    0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,\r
-    0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040,\r
-};\r
-\r
-struct bit_stream\r
-{\r
-    unsigned long bitbuf;           /* holds between 16 and 32 bits */\r
-    int bitcount;               /* how many bits does bitbuf hold? */\r
-};\r
-\r
-struct huf_table\r
-{\r
-    int num;                   /* number of nodes in the tree */\r
-    struct\r
-    {\r
-        unsigned long code;\r
-        int codelen;\r
-        int value;\r
-    } table[32];\r
-};\r
-\r
-/*\r
- * Calculate a CRC, the RNC way.\r
- */\r
-static long rnc_crc(const unsigned char* data, long len)\r
-{\r
-    unsigned short val = 0;\r
-\r
-    while(len--)\r
-    {\r
-        val ^= *data++;\r
-        val = (val >> 8) ^ rnc_crc_table[val & 0xFF];\r
-    }\r
-\r
-    return val;\r
-}\r
-\r
-\r
-/*\r
- * Return the big-endian longword at p.\r
- */\r
-static unsigned long blong (const unsigned char *p)\r
-{\r
-    unsigned long n;\r
-    n = p[0];\r
-    n = (n << 8) + p[1];\r
-    n = (n << 8) + p[2];\r
-    n = (n << 8) + p[3];\r
-    return n;\r
-}\r
-\r
-/*\r
- * Return the little-endian longword at p.\r
- */\r
-static unsigned long llong (const unsigned char *p)\r
-{\r
-    unsigned long n;\r
-    n = p[3];\r
-    n = (n << 8) + p[2];\r
-    n = (n << 8) + p[1];\r
-    n = (n << 8) + p[0];\r
-    return n;\r
-}\r
-\r
-/*\r
- * Return the big-endian word at p.\r
- */\r
-static unsigned long bword (const unsigned char *p)\r
-{\r
-    unsigned long n;\r
-    n = p[0];\r
-    n = (n << 8) + p[1];\r
-    return n;\r
-}\r
-\r
-/*\r
- * Return the little-endian word at p.\r
- */\r
-static unsigned long lword (const unsigned char *p)\r
-{\r
-    unsigned long n;\r
-    n = p[1];\r
-    n = (n << 8) + p[0];\r
-    return n;\r
-}\r
-\r
-/*\r
- * Mirror the bottom n bits of x.\r
- */\r
-static unsigned long mirror (unsigned long x, int n)\r
-{\r
-    unsigned long top = 1 << (n-1), bottom = 1;\r
-    while (top > bottom)\r
-    {\r
-        unsigned long mask = top | bottom;\r
-        unsigned long masked = x & mask;\r
-        if (masked != 0 && masked != mask)\r
-        {\r
-            x ^= mask;\r
-        }\r
-        top >>= 1;\r
-        bottom <<= 1;\r
-    }\r
-    return x;\r
-}\r
-\r
-\r
-/*\r
- * Initialises a bit stream with the first two bytes of the packed\r
- * data.\r
- */\r
-static void bitread_init (bit_stream *bs, const unsigned char **p)\r
-{\r
-    bs->bitbuf = lword (*p);\r
-    bs->bitcount = 16;\r
-}\r
-\r
-/*\r
- * Fixes up a bit stream after literals have been read out of the\r
- * data stream.\r
- */\r
-static void bitread_fix (bit_stream *bs, const unsigned char **p)\r
-{\r
-    bs->bitcount -= 16;\r
-    bs->bitbuf &= (1<<bs->bitcount)-1; /* remove the top 16 bits */\r
-    bs->bitbuf |= (lword(*p)<<bs->bitcount);/* replace with what's at *p */\r
-    bs->bitcount += 16;\r
-}\r
-\r
-/*\r
- * Returns some bits.\r
- */\r
-static unsigned long bit_peek (bit_stream *bs, const unsigned long mask)\r
-{\r
-    return bs->bitbuf & mask;\r
-}\r
-\r
-/*\r
- * Advances the bit stream.\r
- */\r
-static void bit_advance (bit_stream *bs, int n, const unsigned char **p)\r
-{\r
-    bs->bitbuf >>= n;\r
-    bs->bitcount -= n;\r
-    if (bs->bitcount < 16)\r
-    {\r
-        (*p) += 2;\r
-        bs->bitbuf |= (lword(*p)<<bs->bitcount);\r
-        bs->bitcount += 16;\r
-    }\r
-}\r
-\r
-/*\r
- * Reads some bits in one go (ie the above two routines combined).\r
- */\r
-static unsigned long bit_read (bit_stream *bs, unsigned long mask, int n, const unsigned char **p)\r
-{\r
-    unsigned long result = bit_peek(bs, mask);\r
-    bit_advance(bs, n, p);\r
-    return result;\r
-}\r
-\r
-/*\r
- * Read a Huffman table out of the bit stream and data stream given.\r
- */\r
-static void read_huftable(huf_table *h, bit_stream *bs, const unsigned char **p)\r
-{\r
-    int i, j, k, num;\r
-    int leaflen[32];\r
-    int leafmax;\r
-    unsigned long codeb;           /* big-endian form of code */\r
-\r
-    num = bit_read(bs, 0x1F, 5, p);\r
-\r
-    if(num == 0)\r
-    {\r
-        return;\r
-    }\r
-\r
-    leafmax = 1;\r
-    for(i = 0; i < num; i++)\r
-    {\r
-        leaflen[i] = bit_read(bs, 0x0F, 4, p);\r
-        if (leafmax < leaflen[i])\r
-        {\r
-            leafmax = leaflen[i];\r
-        }\r
-    }\r
-\r
-    codeb = 0L;\r
-    k = 0;\r
-    for(i = 1; i <= leafmax; i++)\r
-    {\r
-        for(j = 0; j < num; j++)\r
-        {\r
-            if(leaflen[j] == i)\r
-            {\r
-                h->table[k].code = mirror(codeb, i);\r
-                h->table[k].codelen = i;\r
-                h->table[k].value = j;\r
-                codeb++;\r
-                k++;\r
-            }\r
-        }\r
-        codeb <<= 1;\r
-    }\r
-    h->num = k;\r
-}\r
-\r
-/*\r
- * Read a value out of the bit stream using the given Huffman table.\r
- */\r
-static unsigned long huf_read(huf_table *h, bit_stream *bs, const unsigned char **p)\r
-{\r
-    int i;\r
-    unsigned long val;\r
-\r
-    for (i = 0; i < h->num; i++)\r
-    {\r
-        unsigned long mask = (1 << h->table[i].codelen) - 1;\r
-        if(bit_peek(bs, mask) == h->table[i].code)\r
-        {\r
-            break;\r
-        }\r
-    }\r
-    if(i == h->num)\r
-    {\r
-        return -1;\r
-    }\r
-    bit_advance(bs, h->table[i].codelen, p);\r
-\r
-    val = h->table[i].value;\r
-\r
-    if (val >= 2)\r
-    {\r
-        val = 1 << (val-1);\r
-        val |= bit_read(bs, val-1, h->table[i].value - 1, p);\r
-    }\r
-    return val;\r
-}\r
-\r
-static int rnc_unpack(const unsigned char* input, unsigned char* output)\r
-{\r
-    const unsigned char *inputend;\r
-    unsigned char *outputend;\r
-    bit_stream bs;\r
-    huf_table raw, dist, len;\r
-    unsigned long ch_count;\r
-    unsigned long ret_len;\r
-    unsigned out_crc;\r
-    if(blong(input) != RNC_SIGNATURE)\r
-    {\r
-        return RNC_FILE_IS_NOT_RNC;\r
-    }\r
-    ret_len = blong(input + 4);\r
-    outputend = output + ret_len;\r
-    inputend = input + 18 + blong(input + 8);\r
-\r
-    input += 18;               /* skip header */\r
-\r
-    /*\r
-     * Check the packed-data CRC. Also save the unpacked-data CRC\r
-     * for later.\r
-     */\r
-    if(rnc_crc(input, inputend-input) != bword(input - 4))\r
-    {\r
-        return RNC_PACKED_CRC_ERROR;\r
-    }\r
-    out_crc = bword(input - 6);\r
-\r
-    bitread_init(&bs, &input);\r
-    bit_advance(&bs, 2, &input);      /* discard first two bits */\r
-\r
-    /*\r
-     * Process chunks.\r
-     */\r
-    while (output < outputend)\r
-    {\r
-        read_huftable(&raw, &bs, &input);\r
-        read_huftable(&dist, &bs, &input);\r
-        read_huftable(&len, &bs, &input);\r
-        ch_count = bit_read(&bs, 0xFFFF, 16, &input);\r
-\r
-        while(true)\r
-        {\r
-            long length, posn;\r
-\r
-            length = huf_read(&raw, &bs, &input);\r
-            if(length == -1)\r
-            {\r
-                return RNC_HUF_DECODE_ERROR;\r
-            }\r
-            if(length)\r
-            {\r
-                while(length--)\r
-                    *output++ = *input++;\r
-                bitread_fix(&bs, &input);\r
-            }\r
-            if(--ch_count <= 0)\r
-            {\r
-                break;\r
-            }\r
-\r
-            posn = huf_read(&dist, &bs, &input);\r
-            if(posn == -1)\r
-            {\r
-                return RNC_HUF_DECODE_ERROR;\r
-            }\r
-            length = huf_read(&len, &bs, &input);\r
-            if(length == -1)\r
-            {\r
-                return RNC_HUF_DECODE_ERROR;\r
-            }\r
-            posn += 1;\r
-            length += 2;\r
-            while(length--)\r
-            {\r
-                *output = output[-posn];\r
-                output++;\r
-            }\r
-        }\r
-    }\r
-\r
-    if(outputend != output)\r
-    {\r
-        return RNC_FILE_SIZE_MISMATCH;\r
-    }\r
-\r
-    /*\r
-     * Check the unpacked-data CRC.\r
-     */\r
-    if(rnc_crc(outputend - ret_len, ret_len) != out_crc)\r
-    {\r
-        return RNC_UNPACKED_CRC_ERROR;\r
-    }\r
-\r
-    return RNC_OK;\r
-}\r
-\r
-unsigned char* THAnimations::Decompress(unsigned char* pData, size_t& iLength)\r
-{\r
-    unsigned long outlen = blong(pData + 4);\r
-    unsigned char* outbuf = new unsigned char[outlen];\r
-    if(rnc_unpack(pData, outbuf) == RNC_OK)\r
-    {\r
-        delete[] pData;\r
-        iLength = outlen;\r
-        return outbuf;\r
-    }\r
-    else\r
-    {\r
-        delete[] pData;\r
-        delete[] outbuf;\r
-        iLength = 0;\r
-        return NULL;\r
-    }\r
-}\r
+/*
+    RNC decompression library. Copyright and ownership status unknown.
+
+    Original code was from http://www.yoda.arachsys.com/dk/utils.html, but that
+    site nor the code itself states any ownership or copyright claims.
+    Modifications made to the original code include:
+      * Const correctness
+      * Prebuilt CRC table
+      * Indentation and code style
+*/
+
+#include "th.h"
+
+#define RNC_OK                  0
+#define RNC_FILE_IS_NOT_RNC    -1
+#define RNC_HUF_DECODE_ERROR   -2
+#define RNC_FILE_SIZE_MISMATCH -3
+#define RNC_PACKED_CRC_ERROR   -4
+#define RNC_UNPACKED_CRC_ERROR -5
+#define RNC_SIGNATURE 0x524E4301       /* "RNC\001" */
+
+static const unsigned short rnc_crc_table[256] = {
+    0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
+    0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
+    0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
+    0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
+    0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
+    0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
+    0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
+    0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
+    0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
+    0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
+    0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
+    0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
+    0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
+    0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
+    0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
+    0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
+    0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
+    0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
+    0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
+    0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
+    0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
+    0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
+    0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
+    0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
+    0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
+    0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
+    0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
+    0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
+    0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
+    0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
+    0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
+    0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040,
+};
+
+struct bit_stream
+{
+    unsigned long bitbuf;           /* holds between 16 and 32 bits */
+    int bitcount;               /* how many bits does bitbuf hold? */
+};
+
+struct huf_table
+{
+    int num;                   /* number of nodes in the tree */
+    struct
+    {
+        unsigned long code;
+        int codelen;
+        int value;
+    } table[32];
+};
+
+/*
+ * Calculate a CRC, the RNC way.
+ */
+static long rnc_crc(const unsigned char* data, long len)
+{
+    unsigned short val = 0;
+
+    while(len--)
+    {
+        val ^= *data++;
+        val = (val >> 8) ^ rnc_crc_table[val & 0xFF];
+    }
+
+    return val;
+}
+
+
+/*
+ * Return the big-endian longword at p.
+ */
+static unsigned long blong (const unsigned char *p)
+{
+    unsigned long n;
+    n = p[0];
+    n = (n << 8) + p[1];
+    n = (n << 8) + p[2];
+    n = (n << 8) + p[3];
+    return n;
+}
+
+/*
+ * Return the little-endian longword at p.
+ */
+static unsigned long llong (const unsigned char *p)
+{
+    unsigned long n;
+    n = p[3];
+    n = (n << 8) + p[2];
+    n = (n << 8) + p[1];
+    n = (n << 8) + p[0];
+    return n;
+}
+
+/*
+ * Return the big-endian word at p.
+ */
+static unsigned long bword (const unsigned char *p)
+{
+    unsigned long n;
+    n = p[0];
+    n = (n << 8) + p[1];
+    return n;
+}
+
+/*
+ * Return the little-endian word at p.
+ */
+static unsigned long lword (const unsigned char *p)
+{
+    unsigned long n;
+    n = p[1];
+    n = (n << 8) + p[0];
+    return n;
+}
+
+/*
+ * Mirror the bottom n bits of x.
+ */
+static unsigned long mirror (unsigned long x, int n)
+{
+    unsigned long top = 1 << (n-1), bottom = 1;
+    while (top > bottom)
+    {
+        unsigned long mask = top | bottom;
+        unsigned long masked = x & mask;
+        if (masked != 0 && masked != mask)
+        {
+            x ^= mask;
+        }
+        top >>= 1;
+        bottom <<= 1;
+    }
+    return x;
+}
+
+
+/*
+ * Initialises a bit stream with the first two bytes of the packed
+ * data.
+ */
+static void bitread_init (bit_stream *bs, const unsigned char **p)
+{
+    bs->bitbuf = lword (*p);
+    bs->bitcount = 16;
+}
+
+/*
+ * Fixes up a bit stream after literals have been read out of the
+ * data stream.
+ */
+static void bitread_fix (bit_stream *bs, const unsigned char **p)
+{
+    bs->bitcount -= 16;
+    bs->bitbuf &= (1<<bs->bitcount)-1; /* remove the top 16 bits */
+    bs->bitbuf |= (lword(*p)<<bs->bitcount);/* replace with what's at *p */
+    bs->bitcount += 16;
+}
+
+/*
+ * Returns some bits.
+ */
+static unsigned long bit_peek (bit_stream *bs, const unsigned long mask)
+{
+    return bs->bitbuf & mask;
+}
+
+/*
+ * Advances the bit stream.
+ */
+static void bit_advance (bit_stream *bs, int n, const unsigned char **p)
+{
+    bs->bitbuf >>= n;
+    bs->bitcount -= n;
+    if (bs->bitcount < 16)
+    {
+        (*p) += 2;
+        bs->bitbuf |= (lword(*p)<<bs->bitcount);
+        bs->bitcount += 16;
+    }
+}
+
+/*
+ * Reads some bits in one go (ie the above two routines combined).
+ */
+static unsigned long bit_read (bit_stream *bs, unsigned long mask, int n, const unsigned char **p)
+{
+    unsigned long result = bit_peek(bs, mask);
+    bit_advance(bs, n, p);
+    return result;
+}
+
+/*
+ * Read a Huffman table out of the bit stream and data stream given.
+ */
+static void read_huftable(huf_table *h, bit_stream *bs, const unsigned char **p)
+{
+    int i, j, k, num;
+    int leaflen[32];
+    int leafmax;
+    unsigned long codeb;           /* big-endian form of code */
+
+    num = bit_read(bs, 0x1F, 5, p);
+
+    if(num == 0)
+    {
+        return;
+    }
+
+    leafmax = 1;
+    for(i = 0; i < num; i++)
+    {
+        leaflen[i] = bit_read(bs, 0x0F, 4, p);
+        if (leafmax < leaflen[i])
+        {
+            leafmax = leaflen[i];
+        }
+    }
+
+    codeb = 0L;
+    k = 0;
+    for(i = 1; i <= leafmax; i++)
+    {
+        for(j = 0; j < num; j++)
+        {
+            if(leaflen[j] == i)
+            {
+                h->table[k].code = mirror(codeb, i);
+                h->table[k].codelen = i;
+                h->table[k].value = j;
+                codeb++;
+                k++;
+            }
+        }
+        codeb <<= 1;
+    }
+    h->num = k;
+}
+
+/*
+ * Read a value out of the bit stream using the given Huffman table.
+ */
+static unsigned long huf_read(huf_table *h, bit_stream *bs, const unsigned char **p)
+{
+    int i;
+    unsigned long val;
+
+    for (i = 0; i < h->num; i++)
+    {
+        unsigned long mask = (1 << h->table[i].codelen) - 1;
+        if(bit_peek(bs, mask) == h->table[i].code)
+        {
+            break;
+        }
+    }
+    if(i == h->num)
+    {
+        return -1;
+    }
+    bit_advance(bs, h->table[i].codelen, p);
+
+    val = h->table[i].value;
+
+    if (val >= 2)
+    {
+        val = 1 << (val-1);
+        val |= bit_read(bs, val-1, h->table[i].value - 1, p);
+    }
+    return val;
+}
+
+static int rnc_unpack(const unsigned char* input, unsigned char* output)
+{
+    const unsigned char *inputend;
+    unsigned char *outputend;
+    bit_stream bs;
+    huf_table raw, dist, len;
+    unsigned long ch_count;
+    unsigned long ret_len;
+    unsigned out_crc;
+    if(blong(input) != RNC_SIGNATURE)
+    {
+        return RNC_FILE_IS_NOT_RNC;
+    }
+    ret_len = blong(input + 4);
+    outputend = output + ret_len;
+    inputend = input + 18 + blong(input + 8);
+
+    input += 18;               /* skip header */
+
+    /*
+     * Check the packed-data CRC. Also save the unpacked-data CRC
+     * for later.
+     */
+    if(rnc_crc(input, inputend-input) != bword(input - 4))
+    {
+        return RNC_PACKED_CRC_ERROR;
+    }
+    out_crc = bword(input - 6);
+
+    bitread_init(&bs, &input);
+    bit_advance(&bs, 2, &input);      /* discard first two bits */
+
+    /*
+     * Process chunks.
+     */
+    while (output < outputend)
+    {
+        read_huftable(&raw, &bs, &input);
+        read_huftable(&dist, &bs, &input);
+        read_huftable(&len, &bs, &input);
+        ch_count = bit_read(&bs, 0xFFFF, 16, &input);
+
+        while(true)
+        {
+            long length, posn;
+
+            length = huf_read(&raw, &bs, &input);
+            if(length == -1)
+            {
+                return RNC_HUF_DECODE_ERROR;
+            }
+            if(length)
+            {
+                while(length--)
+                    *output++ = *input++;
+                bitread_fix(&bs, &input);
+            }
+            if(--ch_count <= 0)
+            {
+                break;
+            }
+
+            posn = huf_read(&dist, &bs, &input);
+            if(posn == -1)
+            {
+                return RNC_HUF_DECODE_ERROR;
+            }
+            length = huf_read(&len, &bs, &input);
+            if(length == -1)
+            {
+                return RNC_HUF_DECODE_ERROR;
+            }
+            posn += 1;
+            length += 2;
+            while(length--)
+            {
+                *output = output[-posn];
+                output++;
+            }
+        }
+    }
+
+    if(outputend != output)
+    {
+        return RNC_FILE_SIZE_MISMATCH;
+    }
+
+    /*
+     * Check the unpacked-data CRC.
+     */
+    if(rnc_crc(outputend - ret_len, ret_len) != out_crc)
+    {
+        return RNC_UNPACKED_CRC_ERROR;
+    }
+
+    return RNC_OK;
+}
+
+unsigned char* THAnimations::Decompress(unsigned char* pData, size_t& iLength)
+{
+    unsigned long outlen = blong(pData + 4);
+    unsigned char* outbuf = new unsigned char[outlen];
+    if(rnc_unpack(pData, outbuf) == RNC_OK)
+    {
+        delete[] pData;
+        iLength = outlen;
+        return outbuf;
+    }
+    else
+    {
+        delete[] pData;
+        delete[] outbuf;
+        iLength = 0;
+        return NULL;
+    }
+}
old mode 100755 (executable)
new mode 100644 (file)
index d705246..84b7fb0
-/*\r
-Copyright (c) 2009 Peter "Corsix" Cawley\r
-\r
-Permission is hereby granted, free of charge, to any person obtaining a copy of\r
-this software and associated documentation files (the "Software"), to deal in\r
-the Software without restriction, including without limitation the rights to\r
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
-of the Software, and to permit persons to whom the Software is furnished to do\r
-so, subject to the following conditions:\r
-\r
-The above copyright notice and this permission notice shall be included in all\r
-copies or substantial portions of the Software.\r
-\r
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
-SOFTWARE.\r
-*/\r
-\r
-#include "th.h"\r
-#include <wx/app.h>\r
-#include <wx/toplevel.h>\r
-#include <wx/filename.h>\r
-#include <map>\r
-\r
-static const unsigned char palette_upscale_map[0x40] = {\r
-    0x00, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C,\r
-    0x20, 0x24, 0x28, 0x2D, 0x31, 0x35, 0x39, 0x3D,\r
-    0x41, 0x45, 0x49, 0x4D, 0x51, 0x55, 0x59, 0x5D,\r
-    0x61, 0x65, 0x69, 0x6D, 0x71, 0x75, 0x79, 0x7D,\r
-    0x82, 0x86, 0x8A, 0x8E, 0x92, 0x96, 0x9A, 0x9E,\r
-    0xA2, 0xA6, 0xAA, 0xAE, 0xB2, 0xB6, 0xBA, 0xBE,\r
-    0xC2, 0xC6, 0xCA, 0xCE, 0xD2, 0xD7, 0xDB, 0xDF,\r
-    0xE3, 0xE7, 0xEB, 0xEF, 0xF3, 0xF7, 0xFB, 0xFF,\r
-};\r
-\r
-class ChunkRenderer\r
-{\r
-public:\r
-    ChunkRenderer(int width, int height, unsigned char *buffer = NULL)\r
-    {\r
-        m_data = buffer ? buffer : new unsigned char[width * height];\r
-        m_ptr = m_data;\r
-        m_end = m_data + width * height;\r
-        m_x = 0;\r
-        m_y = 0;\r
-        m_width = width;\r
-        m_height = height;\r
-        m_skip_eol = false;\r
-    }\r
-\r
-    ~ChunkRenderer()\r
-    {\r
-        delete[] m_data;\r
-    }\r
-\r
-    bool isDone() const\r
-    {\r
-        return m_ptr == m_end;\r