Modifications to the code made on 7/28/06 by DragonsIOA

-Added checkbox in texture flags (create scenery OVL) to copy the settings to all meshes (useful when an ASE file has lots of little meshes in it)

-Fixed minor memory leak

-Fixed import of texture in ASE file to use per-vertex texturing (now complex meshes should import texture UVs just fine!)


Modifications by Belgabor (Starting August 2006):
Notes:
- I used Dev-C++ 4.9.9.2 (http://www.bloodshed.net/index.html) and ResEdit (http://www.resedit.net/)
- You need to get the devpacks libjpeg, libpng, libtiff and Zlib. The currently available devpak for devIL (1.6.7) is too old and won't work. The source distribution will contain a directory called Dev-C++ which contains all you need for devIL 1.6.8R2, just copy its contents to your Dev-C++ install dir.
- I don't know if this will still compile in MSVC, it might contain some functions specefic to glibc. I also had to circumvent a bug in ResEdit, so the menus are loaded in the code now.

Version 1.0
* Made the source compile in GCC/mingw/dev-c++ (everythings open source now)
* Fixed Bug: Need to click on 'Install Theme' multiple times to make it work.
* UNFIXED Bug: Texture file haldles left open. I mention that since ireported it fixed elsewhere. I had to revoke that as it crashed the importer (which it shouldn't, I have no ***** idea why )
* Reorganized several windows, mostly to make it look nicer and to show more text
* Added an option ('Fix Orientation') to the Create Scenery OVL dialog. If you check that the importer will fix the weired axis reorganization in RCT3. That means you can forget those rotations before you export the object, just model your object on the default x/y-plane with z up. Important:This influences the effect stuff explained below, if you need it checked be sure to do so before playing with that.
* Made adding effect points easier. See rct3imp.txt for long explanation.
* One of the open source things I did was replacing the closed source ATI texture compression library with devIL, an open source image library. Currently this means that you can use most common image formats as an icon texture (transparency will probaby still only work with png).

Version 1.1
* Fixed some Bugs
* The lightcolor effect point is automatically added for custom light color lightstart points.

Version 1.2
* Removed lightcolor effect point as it's not necessary. (Should have been lightcolour anyways :p )
* Rearranged open/save sid buttons
* Create Scenery OVL: Double clicks on texture, mesh and effect point lists now open the respective edit dialog.
* Create Scenery OVL, Texture options: Texture name autogenerated from file name if not set before (spaces are ok, I tested it).
* Create Scenery OVL, Textures: Now devIL is used to read textures, so you can use many image formats as input (in fact more than listed in the open file box, but I didn't want to clutter the file extension box). The image is automatically converted to 8bit indexed or grayscale for alpha. No special handling yet for recolorable textures, they still should be 8bit bmps with the special palette, if not results are likely to be random and unexpected :)

Version 1.2.1
* Fixed orientation bugs.
* Fixed palette conversion bug.
* Image info button for texture bitmaps.

Version 1.3
* More info on light effect point radius.
* Most lists now act on double clicks.
* Scenery Options: Location now is an editable combo box where you can select other locations from the theme.
* Scenery Options: Show which sid was loaded.
* Text editor: you can now copy name to text and vice versa.
* Icon textures: Name auto-generated from texture filename if not entered.
* Image info button for icon texture bitmaps.
* Scenery  Creator: Mesh list entries are now colored (gray: disbaled, light green: single vertex mesh, red: missing data).
* First implementation of an easier recolorable texture implementation. Make the first color shades of red, the second shades of green and the third shades of blue. Colors should be clean (eg no green in red). The darkest color should be still slightly colored, not completely black (eg RGB 1,0,0 for red is enough). The brightest color should be the full color (eg RGB 255,0,0), not the lightened color like in the original Blue/Magenta/Yellow scheme. See rct3imp.txt for a brief howto. Important: These textures need to be truecolor, indexed images will be used as-is and need to use the old Blue/Magenta/Yellow palette. Also the RGB textures are saved with the old palette, so don't be surprised if they look Blue/Magenta/Yellow in the RCT3 dumper =)

Version 1.3.1
* Bugfix for the location combobox

Version 1.4
* Text editor: The text from 'Text' is automatically copied to 'Name' if you leave that empty and click 'Ok'. Also the entry focus is on the 'Text' edit box so just type and press enter to add a new string =)
* Text editor: 'Ok' grayed if 'Text' and 'Name' are empty.
* Icon Editor: 'Ok' grayed if no texture selected
* Icon Manager: 'Auto' genereates 64x64 entries for all icon textures. Note that the numbering differs from the 'Icon Number' setting in the icon editor. It starts with '1' and goes like western writing, ie left to right first and then downwards. Seemed more intuitive to me =)
* Main Window: Simple Prefix support. It will be prepended to the theme name on install and to the proposed ovl name in 'Create Scenery OVL'. Note that no further letter or symbol (like '-' or '_') is added in between, if you want that, add it to the enterd prefix.
* Restored functionality to test texture ovls. The editable combo-box was butchered like the bug I fixed in 1.3.1. I have a test running reagrding this. If it turns out to work, I'll explain how I did it =)
* Fixed the 'fix orientation' flag to do what I now think is right (see The_Cook's post). I'm afraid that this introduces a slight incompatibility if you used this flag before. Your objects will turn up rotated 90 degrees. For most objects this probabsy won't matter, but if you used the wall positioning flag (and similar non-origin centered flags) you will now have to place them on the -y side of the x/z plane.
* Related to the last I also changed the way 'fix orientation' is applied to effect points. It no longer matters if you check it before or after editing them. This also means that you can manually enter effect points as measured in your modeller. It also means that you probably need to reset effect points if you used one-vertex meshes with fix orientation in earlier versions.

Version 1.4.5
* Bugfix: One letter missing from theme directory if no prefix is used.
* Bugfix: Problem with truecolor textures with less than 256 colors.
* Bugfix: Image info not really showing something useful.
* Create Scenery OVL: If you open a scn file and the importer can't find the ase file, you now can manually select it.
* Create Scenery OVL: Visual options. These allows to mimic the placement effects and swaying of the in-game 3D trees. Please press the 'Notes' button for more details.
* (Internal: Switched from Dev-C++/wxDev-C++ to Code::Blocks before being tempted to throw things around :) )
* The last point made me take a look at the compiler flags which led to reduced sizes of the importer and some of the dlls. It shouldn't matter, but to be on the safe side overwrite them all.

Version 1.4.6
* Static compile. You can delete all old dlls. The only one you still need is libovl and you have to use the one that comes with this version.
* Bugfix: Crash if RCT3 Install Directory couldn't be read from the registry. Asks for a directory to install to.
* Icon Manager: Auto Button moved. Added query on which textures auto should be applied to.
* Preliminary support for real texture ovls. How-to:
    1. The texture ovl
        - Open the create scenery ovl dialog
        - Do not open any ASE! Also refrain from adding references or effect points.
        - Add your textures. Give them easy to remember names as we will need them later.
        - Save to an easy to remember name.
    2. The actual Scenery OVL
        - Open the create scenery ovl dialog
        - Open your ASE
        - You're probably able to add textures, but I have not tested that. Do NOT add the texture you will reference to.
        - Add the filename of your texture ovl (without the .common.ovl) to the references. This is a relative path to where the texture ovl will be in relation to the scenery ovl. I used for my test "../belgabor-snowwalltexture". It may be fine to put it in the same directory, but I also didn't test that.
        - Set the mesh options. For the referenced texture, type the name into the texture combo box.
        - Finish the scenery ovl as usual
    3. The Theme
        - Create as usual. Do NOT add the texture ovl as scenery. This is probably the reason shyguy failed.
        - Install
        - Copy the texture ovl files to where RCT3 expects them to be (in my case, in the theme directory with the style.*.ovl files).
        - That's it :D
  You cannot save scn files yet, sorry (I DID say it was preliminay :p ). I will add that as soon as a few people report it works for them as well as for me.

Version 1.4.7
* You can now save texture ovl scns
* Bugfix: Texture OVLs with more than one texture didn't work
* Bugfix: Random stuff in texture ovl
* I created a small test suite for this & future releases. That doesn't mean there won't be buggy releases anymore, but at least the basics should work =)

Version 1.4.8
* Bugfix: Create Scenery OVL: Mesh list colors not updated if "Apply To All Meshes" was checked.
* Create Scenery OVL: Shift-Doubleclick on a mesh entry singles it out (activates it and deactivates all others). Useful if you tend to place several objects into one ASE file (like me).
* Scenery Settings: Shows the number of the currently edited scenery item in the title. Helps assigning icons references cretead with the auto button.
* Scenery Settings: Cost & Refund default to 0, Supports Type to 'None'.
* Limited automation for texture ovls:
    1. The Create Scenery dialog proposes PrefixThemename-texture as ovl name if no ase selected.
    2. The reference edit box in the Create Scenery OVL dialog comes prefilled with "../shared/PrefixThemename-texture", so you just need to press 'Add' to include the reference.
    3. If the importer finds an ovl named like proposed above (1) in the same directory as your theme file, it will be automatically installed to ThemeDir/shared. You will be notified if this happened.
* The exe now comes in two flavours, "RCT3 Importer.exe" defaults to 'Fix Orientation' checked, "RCT3 Importer NoFixOrient.exe" defaults to unchecked (like in the old versions).

Version 1.5.0
* Massive internal changes. You probably won't see much of them =)
** What may affect you is the new implementation of reading scenery files/3d object files. The new code tries to make sense of things the old one just discarded. If you get strange notices and think they are not justified, report it =)
** I also made ASE file loading more stable. If a mesh lacks uv-mapping, the importer won't crash anymore. Instead the mesh will be disabled automatically.
* The old "fix orientation" code as well as the effect point matrix has been replaced by a matrix transformation stack editor. Advantages:
** You can now add custom "fix orientation" matrices for your special modeler
** You can reuse the same model for several objects if they only differ in position/rotation/scale. Example: provide a wall with quad tile and wall placement
** Note: The model tranformation is also applied to the effect point matrices, just as the old "fix transformation" flag was.
** Note: All rotations are for a right-handed coordinate system and all transformation use the origin as reference.
** I'll post a tutorial about this soon. For now, refer to DRP's effect point tutorial on Atari (stickied in the Custom Scenery Forum) for some general hints.
* The importer can now load MS3D files directly.
** The correct fixup matrix for this is a Z mirror (If you didn't do any pre-importer fixups yourself :) )
** Single vertices that are not assigned to a group in MS are loaded as single-vertex meshes for effect point creation (and now also as reference points for translation matrices). As MS doesn't support names for these, they are named automatically based on their position.
** In contrast to what I said above about ASE files, MS3D files by design cannot lack uv-mapping information in a detectible way, so meshes that haven't been mapped in MS are not disabled.
* Limited configuration. You can save a default transformation matrix (Menu in Create Scenery OVL) and a default prefix (Main Menu). Note: the default matrix saved will be the result of the transformation matrix stack of the currently edited scenery item. Obviously this means I stop creating two binaries =)
* All across the Create Scenery OVL dialog sub-dialogs you can now load settings from other scn files
* Texture name cache. Fancy name for a simple thing =) It stores texture names of texture ovls so you have them available in the texture dropdown in the mesh settings. The cache is filled when you save a texture ovl or load a texture ovl scn via the special menu item. It is cleared when you start a new theme or clear it via the respective menu item.
* Tab-order cleanups
* Bugfix: Create Scenery OVL: Doubleclick on mesh list works again.

Version 1.5.1
* Bugfix: The model transformation was applied to the normals in a wrong way.
* Bugfix: A palette bug prevented alpha textures to work if you used a truecolor image as "normal" texture.
* Bugfix: Stability enhanced
* I started to convert the whole importer to wxWidgets, a C++ UI toolkit. I'm not finished and the first bug forced me to release this earlier than I originally intended. This (hopefully) doesn't mean instability or errors (except for the warning below).
** This makes the importer exe a lot larger. I hope in time the advandages will justify that =)
** Converted the texture and mesh settings dialog for creating scenery ovls. This means you can resize them =) This may not seem terribly useful in these cases, but as I'll convert other dialogs as well you get a glimpse at what will become possible.
** New dialog for opening texture files, so far only implemented for scenery ovl texture settings.
** Texture filenames in this texture settings dialog are now checked for validity when you close it.
** I reordered the texture styles in a way that seemed mor esensible to me. The basic styles are at the top, the less used more complicated ones below.
** Warning: If you have one of these windows open you can actually activate the create scenery dialog below. I cannot prevent this in the current half-state and it will almost certainly lead to a crash or corruption of your scenery data. In short, don't do it.

Note: From here on the original version numbering scheme will be followed

Version 15 (Jonwil)
* Support for Stalls and Special Attractions. See stalls.html for details of the settings for all the stock frontier stalls. The last 3 are the 3 special attractions (ATM, toilet, first aid). Also, right now, you are limited to only making shops that sell nothing at all (i.e. generic shops). You will probobly need the most recent patches to make use of this.
* If you have the stall or special attraction dialogs open, you can still activate the dialogs below. Dont do it, it could corrupt your theme.
* A change to the way that the importer displays items in the list of scenery items, it now displays a (hopefully) better name.
* Renamed the "flowers" checkbox to "disable shadows"
* Some code changes by Belgabor (splitting up the wxWidgets dialog resource file to make it easier to work with for example, nothing that would affect the use of the program though)
* The beginnings of a big cleanup of libovl that will (when complete) make it easier to work with (e.g. add new data types)

Version 16 (Belgabor)
* The Create Scenery OVL dialog was converted to wxWidgets. This means too many changes to list all here, I'll try list the most important ones.
** I tried to make everything as stable and user-friendly as possible. This includes tooltips for almost every control and a uniform UI. If you feel something is missing, please tell me.
** Support for LOD levels
** Support for animated textures. I also made the recolorable options fully available. The old one, two and three choice map to first activated, first and second activated avd all activated respectively. (If you're confused reading this, take a look at it in the importer, it should be clear then)
** To circumvent a limitation of wxWidgets the menu was replaced by a toolbar. There are now two save icons, a "save" and a "save as" icon like you're probably used to in other applications. The first one saves the scenery file without asking for a file name.
** As said before, this version writes scn files in a new way. This means two things:
*** Old importer versions will crash if they try to read scn files written by this version.
*** All file names (textures, models) are now stored relative to the scn file.
** I rewrote the create ovl function to be much more tolerant of user errors. If you get warnings be sure to read them, as otherwise you might get a working ovl, but not the desired one ;)
* Jonwil and I (hopefully) fixed all libovl related bugs.
* Resizing the shop and special attraction windows should now work.
* If you have the stall or special attraction dialogs open, you can still activate the dialogs below. Dont do it, it could corrupt your theme. This also somewhat applies to the create scenery ovl dialog, but it shouldn't hurt your theme. (Better don't do it nevertheless)
* Made the create ovl button in the scenery settings more useful (like in the olden times :p )
* FIX1: A few bugs regarding the visual options
* FIX1: Open in edit model settings not working
* FIX1: Memory holes
* FIX2: Some confusion in the stored ovl name led to broken scenery ovls, fixed
* FIX3: Hopefully no more broken alpha texture paths appearing out of nowhere
* FIX3: Crashes if you press delete in the theme management dialogs when nothing is selected.
* FIX3: Deleting a texture frame could cause a crash.
* FIX3: Adding references didn't work.
* FIX3: If you delete a reference, the edit box will be set to it, so to edit a reference, delete it, edit in in the box and readd
* FIX3: A few minor inconsistencies The_Cook noticed
* FIX3: Recolorable choices
* FIX3: Made adding textures in the create scenery ovl window easier. Here is how it works now:
** When you press add, you will be immediately asked to open a texture bitmap.
** If you press 'Cancel' here you'll get the advanced texture interface you got before fix 3
** If you select a texture bitmap and press 'Ok' you'll get the old, simple texture settings window.
** Should you need the advanced interface at this point, you can press the 'Advanced' button to switch.
** Note: editing of texture settings is unchanged, you always get the advanced interface.
* FIX4: Effect point matrices are now transformed correctly by the model transformation matrix.
* FIX4: The importer now rejects non-AscII prefixes, theme names, locations and ovl filenames. This caused problems on systems where the character in question is not available.
* FIX4: Better names for "Show texture while placing" options.
* FIX4: Added a few checks to make sure an icon texture is valid before you close the add/edit window.
* FIX4: Fixed .scn appearing for new scenery items in the create ovl save dialog
* FIX4: Enforce invalid meshes to be disabled
* FIX4: Particleend now also asks for the particle name
* FIX5: Added possibility to transfer model name and orientation to the c3DLoader interface. Currently affects the MS3D loader which now auto-sets the correct transformation matrix.
* FIX5: The model orientation is checked against the current model transformation matrix when opening a new 3D model file in the model settings window.
* FIX5: Added warning capabilities to loaders
* FIX5: Fool-proofed the ase-loader by try-catch blocks & an ASE check
* FIX5: Redesigned the stall window and added a default button for the unknowns.
* FIX5: Doubleclick editing now works in the stall and special attraction manager.
* FIX5: Create OVL Window: Renamed from Create Scenery OVL window.
* FIX5: Create OVL Window: Warn when an enabled mesh is invalid on loading a scn file.
* FIX5: Create OVL Window: Made the success message of the creating an ovl less annoying. Click anywhere outside to close it.
* FIX5: Create OVL Window: SCN file name and ovl name are now shown in the Create OVL window.
* FIX5: Create OVL Window: Texture list now shows presence of an alpha texture.
* FIX5: Fixed Bug 1598473: Space at the end of the theme name prevents successful install.
* FIX5: Fixed Bug 1598664: Visual options do not work
* FIX5: Fixed Bug 1596179: Reference field not being filled in from scenery settings window
* FIX5: Fixed Bug 1596228: Typing name into icon window doesn't enable OK button
* FIX5: Fixed Bug 1596408: List boxes reset to the top after editing an item
* FIX5: Fixed Bug 1599068: "radius" missing from flexi lights

Version 17 (Belgabor):
* Uses icons to show whether an input is valid in many cases
* New controls for text entry/button combinations (Mostly when file names are involved)
* Grid Control for groups/meshes. Usage should be mostly intuitive.
** Here is the tooltip:
    List of the meshes/groups/objects in your model file.

    Icon (Name Colours):
    Green Led (black) - Mesh activated and ready for import.
    Yellow Led (red) - Mesh activated but lacks data needed for import.
    Red Led (grey) - Deactivatet mesh.
    Red Star (dark red) - Mesh is invalid/broken.
    Green Star (green) - One-vertex mesh that can be used for matrices (e.g. effect points).

    Clicking on the icon or on the name will activate/deactivate the mesh.
    Clicking other values will let you edit them (Press Escape to cancel the edit).
    Shift-Click on the name will single it out.
    Ctrl-Click on the name will copy that mesh's settings to all others.

    Press 'F5' to refresh the list.
** You can maximize the group grid with the button in the upper right corner.
** Known problems:
*** When editing, using the mouse-wheel will not work properly
*** Widths do not auto-update. Press F5 to do that.
*** Horizontal mouse-wheels do not work. That's a wxWidgets problem and probably unfixable.
*** Small display glitch in the bottom-right corner
** Planned improvements:
*** Tabbing through the editable values
*** Right-click context menu for singeling out/copying settings
* Lots of renaming:
** "Meshes" to "Groups"
** "Size Flag" to "Placement Flag"
** "Unknown" in mesh settings to "Faces" and selections to "Single-Sided" (default) and "Double-Sided" (see separate point).
** "Alpha texture" to "Alpha channel"
** Several other unknowns were renamed to their internal values/names
  Usually the old names are added in parenthesis to reduce confision
* Separator to allow discrimination of other model modification matrices from the one/those that fix the coordinate system. This is needed for correct transformation of effect points.
  A bit of explanation: To correctly use effect point matrices for peeps/vendors in modeller space they need to be transformed from in-game space first using the inverse of the fix-up matrix. Older versions of the importer applied the inverse of the complete model transformation matrix, so if you used the model transformation matrix to move around your object in addition to the fix-up, it had no effect on effect points.
  Usage: In the stack, put matrices to move/rotate your object first, then a separator and the modeller coordinate system fix-up matrix/matrices last
* The Unknown group/mesh setting was discovered to make faces textured single- or double-sided. If you set it to double-sided this will also get rid of the x-ray effect.
* Create OVL/LODs: Saving issues of unknowns fixed (Fixes Bug #1612254)
* Create OVL/LODs: Unknown warning removed
* Create OVL: "Set Unknown Flags" renamed to "Unknown Flags" and the box has a somewhat descriptive tool tip
* Create OVL: Texture cache entries are now shown in the texture list in gray
* Made the stall and special attractions window more user-friendly.
** Name and string/scenery item choice boxes are now (truly) validated.
** The name is set to the name string if empty when you select it.
* Implemented support for png transparency in object textures. You can now choose between no alpha channel, an internal alpha channel (as in pngs) and an external alpha channel from a separate file (the classic alpha texture)
* The simple texture window now also appears when you edit a texture as long as you don't make any changes that require the advanced view.
* Added credits file
* The recolorable texture zip now also contains a palette file for The Gimp
* Now using Crystal Clear icons (see credits.txt)
* Fixed Bug 1606248: Setting the title in the Create OVL window: Doesn't update on save scn/save ovl.
* Fixed Bug 1606383: Importer crashes when you try to select a jpeg file
* Fixed Bug 1611229: Some controls in Create OVL stay enabled on New
* FIX1: Fixed Bug: Internal alpha channel in PNGs flipped upside-down
* FIX1: Fixed crash when trying to edit a texture with no frames.
* FIX1: You can now select multiple files when adding textures or texture frames.
* FIX1: When quick-adding (through the file dialog that comes up when you press add) textures or texture frames, internal alpha channels are automatically detected and activated.
* FIX1: Advanced Texture Window: Add multiple frames at once to the animation list.
* FIX1: Advanced Texture Window: Multiple consecutive frames are now summed up in the animation list. Note: The delete button will delete all summed up frames (ie the complete selected entry). There is a new spin control to change the number of repetitions.
* FIX2: The name of stalls and special attractions is now set to the scenery ovl base name if empty and the corresponding scenery item is selected.
* FIX2: Tried to make ms3d loading more stable.
* FIX2: Removed a few inconsistencies in the dis-/enabling of controls in the advanced texture window
* FIX2: Fixed a bug relating to storing Z position in the Scenery Item Settings
* FIX3: Fixed bug that caused scenery visual options to be wrongly written in some circumstances (reported for the no shadows flag).
* FIX3: Added 'None' to theme types. The set will be always visible, no matter which types are filtered (like in the cathegory changer).
* FIX3: Added Extra Parameters for pool items. Ramps don't seem to work and the Life Guard can currently not be done fully (requires two extra parameters, which the importer cannot do).
* FIX3: Replaced Unknowns 3-5 with Def.Color 1-3

Version 18b1 (Belgabor):
* Too much to list

Version 18b2 (Belgabor):
Importer
* [Added] Right double-click on A to re-auto model bones without confirmation
* [Added] Toggle for the animation display on LODs
* [Added] Detect Problems menu command to find some issues that can lead to a 60% crash or a no sid for svd.
* [Added] More visual flags
* [Added] Some support for moving theme files around. The importer is able to fix the paths of all files if the directory structure did not change.
* [Added] Busy notice while loading or saving scenery files.
* [Added] When changing a bone name in a model window, ask the user if he wants to change the name in other animated models or animations.
* [Fixed] Show selected item in list boxes after update
* [Fixed] Load error for empty matrix stacks
* [Fixed] Prefix missing on returned filename if creating from scenery settings dialog
* [Fixed] Clear prefix when loading old scn file
* [Fixed] Make auto coordinate system from file button work. Also gives somewhat helpful suggestion when no coordinate system information is available.
* [Fixed] Up/down spin controls no longer activated if nothing is selected
* [Fixed] Bugs when trying to load broken modxml files.
* [Fixed] OK and Cancel buttons hidden in bone settings window if the assigend meshes list was too long.
* [Fixed] Prevent errors due to size in squares being set to more than 1.
* [Fixed] Update parents of bones when changing the parent's name.
* [Removed] The fix orientation matrix is now gone for good as it created a lot of confusion. That removes the use of a default matrix, so that's gone as well.

engine
* [Added] Partial workaround for the 31 mesh limit. Meshes with the same settings will be merged on import.
* [Added] Support for bone weights and meshes assigned to more than one bone
* [Added] Option to automatically update from model fires and/or sort bones
* [Added] Reject Blender default animation, bone, texture and spline names
* [Fixed] Sense of rotation matrices corrected for right handed coordinate system
* [Fixed] Animation import from ms3d
* [Fixed] Crash on broken modxml
* [Fixed] Rare-occurring bug that lead to creation of broken ovls
* [Cleaned] Fixed a lot of compiler warnings
