=====================================================================
TextureAssign
Release Version 1.6.0				mod.: 2000/06/22
=====================================================================
The program is released now as realy completed.
SourceCode will be available from my zip site, around the end of the
 month, at the most.
---------------------------------------------------------------------
What is new: 
  Sprite Textures and Sprite Sequences can be edited.

The Texture Delete works now.
Deleting a texture from an existing level would sure grunge things up
 as the textures are refered to by number (offsets) in animations and
 in *all* rooms, in polygons after thousands of polygons.
But this function is essentail for building a lean new level file.
 Just be very carefull.
---------------------------------------------------------------------
This program works by making lists that have exactly the same format
 as the four lists in level files: Object Textures, Animated Textures,
 Sprite Textures and Sprite Sequences.

The first thing the program does is to either create a new list file
 from a specified level or open an existing list file.
Every time the work in progress is saved/saved as, all data are
 written to the active list file. 
The original level is always safe from any modifications, as nothing
 is ever written to it.
Inserting a list file content into the selected model level creates
 a new level file with the default name "templevel.tr2".
The list file is also preserved for further work or archiving.

The format description for this file is included in the install.
 The extension is *.TRL
---------------------------------------------------------------------
How to use

Preparation .........................................................
Extract a 24 bits bitmap from the level to be modified, using Jack.
Only TR2 (TR2 and TR3 level) files are supported for now.

Open the TextureAssign program.

Using the "File/ New List" to create a new list file.
You will be prompted to select a name for your new list file,
 to select a bitmap as basis for your textures and to select a level
 file as source for all list data.

If you want to create a completely new list from scratch, do not
 select any level file for the the model. You will be prompted
 for the version of TombRaider you want to make the list file for.
 Only TR2 and TR3 are available for now.

The picture box will fill with the complete strip at Zoom Factor 1.
You will note the first tile is numbered "zero."

If you selected a level file as model, all controls in the main form
 will now fill with all data from the level and the list will be saved
 under its name with those data.
If you selected an existing list file, all controls in the main form
 will fill with the content of that file. No saving back is necessary.

Making any changes to the data in the main form will mark the data for
 potential saving. On closing the file or opening another one, you
 will be prompted to save the modified data.

The Save and Save AS... menus work as usual.

Selecting the menu "Bitmap / Show Tiles" will outline each
 256 x 256 tiles in white. Reselecting it will erase them.

The menu List / Insert into Level will prompt you for a lsit file.
If the list was create from a level file model, this level file will
 be offered as target for the insertion. If required, select another
 one.
Clicking on the Insert will create a new level file "templevel.tr2"

---------------------------------------------------------------------
To Draw, un-Draw, Add or Edit an Object Texture
--------------------------------------------------------------------- 
Select the textures you want to draw in the "Texture List" list.
You have to select the item and not the check box (sorry) but if you
 want "all" or "none", you may select the check boxes.

After selecting, click the "Draw" button.
The "Selected Texture List with BitMap coordinates" will fill up with
 the selected areas to be outlined.

If some outlines are not too visible, click the "Color" button and
 select another one. This choice will not change the color of the
 tile outline, they stay white.

The picture will refresh at its zero position, this might take some time.
You will note that many textures are overlaid one over the other,
 a lot are parcelled out in triangles and collection of part of units.
This has to do with the size of the polygon the texture will cover.

You can find which area interests you by gliding the mouse over the
 texture strip: its whole strip coordinates are shown in the 
 "Mouse Position" frame. 

You will note that the white tile outline can be very obscured by the 
 multiple areas outlined. 

Selecting a texture in the "Complete Texture List" will bring up its
 coordinates in the "Texture Edition". 

Edition .............................................................

Editing textures works the same way for new list (completely new list)
 or for an existing list.

To add an Object Texture to the list, click the Add button.
Note its caption now read "Accept".
Note the edition buttons become enabled and the coordinate boxes take
 their default position: the Lo is set to the upper left corner and
 the Hi is set to the lower right corner. These refer to the relative
 position on the bitmap strip (Lo is low values, nearer the upper left
 corner).
Note also, only two corners are enabled, their values will be propagated
 to the correct corner when modified. 

Now either 
-enter directly the coordinates in complete texture strip
 coordinates (using the mouse coordinates boxes to find the exact values)
 AND enter the tile number that texture lies in in the "Tile No" box,
 and click "Accept" to load the new texture in the list,
...or...
-using the mouse, draw by selecting an area on the bitmap.
 The selected coordinates will be transfered to the coordinate edit 
 boxes, no matter the direction of the mouse. If the selection is
 wrong, just re-select another area. The previous visual noise will
 vanish and will be replaced by the noise of the new selection.
 Releasing the mouse button will draw the selection cleanly.
 Note there are no texture number.

Note that since a texture cannot cross from one tile to another, trying
 to draw one that covers more than one tile will result in a clipped
 image. If it turns out to be too much to get an exact area, be sloppy
 and correct the new coordinates by hands.

Clicking the Accept button will load the new texture into the complete
 list.

To edit an Object Texture from the list, first select one from the
 "Complete Texture List". 
Note its coordinates are loaded in the coordinates boxes.
Now click the Edit button.
Note its caption now read "Accept".
Note the edition buttons become enabled and the coordinate boxes take
 their default position FOR THIS TEXTURE. 

Note that if you are editing the custom TR2 anonymous level, that some
 textures do not have the Lo and Hi values set. Do not try to edit those
 as those notation are needed to decide which boxes to enable.
I would guess they were entered by directly editing the hex values.

Proceed exactly as with a new texture. Click "Accept" to save your
 modifications into the list.
Verify your work by slecting it in the "Texture List" combobox and
 drawing it. Note it now has a number.

The Cancel button just reset all values to zero and all control to
 their disabled state.

Customizing Textures ................................................

While a texture is being added or edtited, the buttons Quad/Triad,
 Flip Horizontal and Flip Vertical are enabled.

We will now learn their correct use.

Quad/Triad: when a rectangular texture is load up, the button will
read "Make Triad". If the texture is triangular, it will read "Make
 Quad".

This button will toggle the textur from a triangle to a rectangle
 and back.
Note the fourth coordinate boxe changes color when a triangle is
 loaded. Thse values will be set to zero on Acceptation. For editing
 purpose, they have to have some values in. Just edit them the same way
 for either type of figure.

Flip buttons.
Texture are either right side up (Lo in upper left corner), flipped
 horizontally (Lo in upper RIGHT corner),
 flipped vertically (Lo in LOWER LEFT corner) or flipped both way
 (Lo in LOWER RIGHT corner).
Flipping horizontaly will pivot the texture around a vertical axis
 (I figured that out by flipping a visiting card, so...)
 and flipping vertically will pivot it around an horizontal axis.

When loading a texture, note some are already flipped. You will be 
 able to tell by the position of the Lo and HI and by the caption of the 
 Flip buttons. If it says "Unflip..." means it has been flipped.

Flipping twice will reset to not-flipped (try it).

What the flip button do, is make mirror images.
Flip Horizontally will give a right side up reversed image.
Flip vertically will give a right side down reversed image.
Flip both direction will make the image appear pivoted 180 degrees.

Combining the Triad and Flips .......................................

Let's walk through this as an exercise. 
 Add a rectangle.
 Turn it into a triangle. Accept it.
 Make another triangle (same way) but before accepting it, flip it
 horizontally. Accept.
 Make yet another and flip Vertically then accept.
 Again but flip both way.

Now select them in the combobox list and draw them.

Any questions ?

---------------------------------------------------------------------
To View, Add, Edit or Delete an Object Texture Animation
--------------------------------------------------------------------- 
To view any animation, select it in the "Complete Animation list".
The list of texture included will appear in the "One Animation List".
Note that if the texture being animated is triangular (only in TR3),
 the  "Triangular" check box will be checked. However the Animation
 player will stay square.

You will note that the list control in "Animation Edition" frame 
 will be also filled with all included texture.

Clicking "Add" button will clear that list and enable both lists.
 Its caption will now read "Accept".
Clicking the "Edit" button will only enable both lists. Its 
 caption will also read "Accept".
Only one button works at a time.

Clicking "Cancel" just reset the set-up but also clears the edition
 list. Reselect an animation for further work.

To add a texture, select a texture in the "Available Texture" list.
The ">" button becomes enabled. This will add the texture to the 
 list of texture to be animated, ast the bottom of the list.
Note the animation will play in descending order.

To delete a texture, select it in the "animation" lsit. The "<"
 becomes enabled. This will remove it from this list.

To change the order of play of a texture, click in the "Animation"
 list: "/\" and "\/" become enabled. The first will push the texture
 one position up, the second one position down. You have to
 reselect to do it another time.

Clicking "Accept" will load all info back into the low lists.
The animation is immediatly available for viewing.

While an animation is selected, cliking the "Delete" button will
 remove it from the existing animation lsit. This operation
 cannot be reversed.
What will happen is that the TR engine will now interpret this
 as a non-animated texture. Stagant water, anyone ?

Likewise, if a new animation is to be played by the engine,
 the first texture of it must be the texture decorating the
 palying polygon.

No animation will be accepted unless there
 are at least two textures in it.

Animation can be made using repeat of the same texture.

Clicking the "Draw Anim" button will simply draw the selected
 series of textures on the bitmap. Usefull to see if you got it right.

---------------------------------------------------------------------
To Add, modify or Delete a Sprite Texture and Sprite Sequence.
---------------------------------------------------------------------
First, a stern warning.
The sprites, to be shown in the lvel, must be part of a Sequence.
This Sequence series does not work like the Texture or texture
 animation list: it seems *all* sprite textures have to be assinged
 in order, that is, from number zero to the last one assinged with no
 gap.

To prevent any inadvertent sabotage, ample error message boxes have
 been provided to tell exactly what might go wrong.
Likewise, numerous data validation routines have been put in place
 to insure all data for the sprites and their sequences are valid.

To do a complete sprite texture list, assign (that is add or edit)
 every sprites you want to before attempting any Sequence edition.

All controls in the two tabs that touch the spites are self evident:
 they work exactly like the texture and animation tabs.

One difference the user must note.
The sprite sequence edit boxes only show the first sprite of the
 sequence and the last sprite that ends it. All texture that are 
 between those two are part of that sequence.

I do not know the why certain objects serve as screen for the
 sequence and not others. I leave that to others to acertain.


---------------------------------------------------------------------
Modifying your level, finally.
---------------------------------------------------------------------

Save your list a last time. 
You can now take a well deserved break. The insert operation works 
 independently of any editing and can be done without opening any
 other files.

Select the menu List/Insert List Into Level.
A dialog will pop up, prompting you to select some list.
Select one.
When a list is selected, the name of the level the information came
 from is shown. If you want to insert the list into another level, 
 select one now. Your selected level file will be untouched since
 a new level file will be created "templevel.tr2". Where do I get
 those name ?... amazing.
Note the Insert button is now enabled. Click it. The action is so fast
 the progress bar does not even have the time to show any.

That's it. Copy that level to some demo TR exe directory. For the TR2,
 use the TRII Level1 Gold demo. Save the original level somewhere (d'Oh)
 rename the new level "level1.tr2" into the data directory and play it.

What does not work and why ..........................................

All functions now work.
Some are pretty powerfull and are sure to mess up your file real good
 if you do not plan in advance. Editing an existing level is
 especially risky.

What's next and When ................................................

The Assignation Tab.
 Note for this I would have to "walk" the whole level. This would be
 a longish operation. Its only use would be for syntatistic reason
 or for making sure the level file is as compact as possible.
 This will be implemented when I finally do my own level editor.

=====================================================================
Program written by BitShifter, copylefted 2000/04/24,
in Microsoft Visual Basic 6 Enterprise edition.
The source code of the full version will be released.
=====================================================================