Adjust Rotations Of Large Animations Using XVI32

These are guides to help designers create their ZT1 objects beyond APE.
Post Reply
User avatar
Jay
african elephant keeper
Posts: 11552
Joined: Thu Jan 15, 2004 9:23 pm
Location: Orlando, FL (M:66)

Adjust Rotations Of Large Animations Using XVI32

Post by Jay »

Ideally, ZOOT or MAKHOR should be used to adjust rotation positions of ZT things. However, they will give overflow errors when trying to do so for large animations. MAKHOR gives an error trying to load the images; ZOOT gives an error when trying to resave the images. This guide will explain how to adjust rotation positions using a hex editor called XVI32. Any hex editor or binary editor could be used. XVI32 was chosen for this guide because it is free and well supported by the author.


WARNING

When using any hex or binary editor, it is easy to make an accidental change that makes the file unusable. In addition, when a file becomes unusable, it is not obvious where the mistake was made. Therefore, always be careful when making changes and always have a copy of the original file saved somewhere. Even I made an accidental change somewhere in my first attempt to create an example for this document. Fortunately, I never work directly on original files.


One Time Configuration Of XVI32

To get XVI32, go to the home page for it at: http://www.chmaas.handshake.de
Click on XVI32 and download the most recent release. It comes in a ".zip". Extract this into any folder you like. In my case, I extracted it into downloads\xvi32. To run it, you would go into the folder where you extracted it and double click on the XVI32.exe program icon.

There are some configuration changes that should be made in order to make it easier to work with ZT objects.
1. Inside XVI32, either click the third icon from the right (the Options icon) or click Tools->Options.
2. Click the Data Inspector tab and click in the box next to "byte", which will put a checkmark in the box.
3. Click the Appearance tab. Since most people are used to working in 10s, change the Number of columns to 10. Also, you might want to increase the Font size to make it easier to read. I set the font size of mine to 12.
4. Click OK.
5. Click Tools->Data inspector. This will open a Data Inspector window. Move this window so that it does not cover any of the XVI32 window.

All of these configuration changes and the position of the windows will be remembered when XVI32 is started again.


Adjusting Rotation Positions Of Large Animations

This guide will use the SE view of Oryx5.ztd as an example. The graphic and icon example were provided by drrick/ztdoctor and he has given permission for it to be made available with this guide. Here is the example used in this guide. It is 771 KB in size.
Download example here.

1. Extract Oryx5.ztd from Oryx5.zip. The contents of the ".ztd" also need to be extracted in order to adjust its rotation positions using XVI32. I created an Oryx5 subfolder in my xvi32 folder and extracted the ".ztd" contents into that subfolder.
2. We need to know how far the graphics image needs to be moved. There are many ways to accomplish this. Before ZOOT came along, people would take a screenshot of the image in APE, load it into a graphics program, zoom in, and count the pixels. Others would use a trial and error approach by making an adjustment, look in ZT, and make another adjustment. But using ZOOT is the easiest approach. Although ZOOT cannot save large animations, it can be used to view them. So run ZOOT and open the subfolder (in this case, Oryx5) as the Project. Then go to the objects->26FED051->idle->SE file. (26FED051 is the 8-character ID used by Oryx5.ztd.) Click ZOOT's "Fix rotations" icon. Set the Footprint numbers properly for this image and for this view. In the case of Oryx5, this was 12 x 12. Change the magnification number from 1 to 5. To make the rotation window larger, you can grab its edges with the mouse cursor and pull to expand. If you have a slow computer, you might have to count the pixels to know how much the image needs to be moved. But on a reasonably fast computer, you can just slowly drag the image to where it should be. Then, write down the Current offsets. In the case of the SE image of Oryx5, the offsets of the adjusted image were 196 x 188. Since ZOOT cannot be used to save large animations, close the "Fixing rotations" window by clicking Cancel. We also need to know how many frames are in the image. Click on ZOOT's "Edit" icon. Write down the "# of frames" number. Oryx5 has 19 frames. Click Cancel to close the Editing window and close ZOOT.
3. Start XVI32 and Open (the second icon or File->Open) the image file you want to adjust. In my case, I opened Oryx5's objects->26FED051->idle->SE image.
4. The file is shown in three sections. The leftmost section has 1 column containing the row address. We do not need to worry about this section. The middle section shows the file in hexadecimal format. The rightmost section shows the file in Text format. Since we set the number of columns to 10, each of these other sections has 10 columns in it.
5. We want to find the first area that needs changing. Look for ".pal" in the rightmost section. Usually this will be in the 4th row. In the rightmost section, click on the 14th character after ".pal". For things created with APE, this will be the 50th character, which is the last character of the 5th row.
6. The first character that will need to be changed should now be highlighted. We will also want to change the character that is 2 characters past this one. These are the ones for the first frame of the image. In order to change the other frames, we want to highlight the characters here so that they can be used to find the other frames. So click Edit->Block <n> chars, click decimal, type "3" into the box, and click OK.
7. The 3 characters are now highlighted. In order to use these 3 characters in searches, click Edit->Clipboard->Copy as hex string.
8. Ideally, we want to change all frames of the animation as fast as possible. In order to do so, we want to first make sure that XVI32 knows where all of the frames are. Click Search->Count. Click "Hex string". Remove anything in the box below "Hex string". Then right click on the box and click Paste. This will insert the hexadecimal values for what we want to find. Then click OK. XVI32 will say how many times it found those values together in the file. This should match the number of frames in the image. If it does not, then a longer approach would be needed to find and replace the proper locations in the file, which would be the same distances apart from one another. This guide assumes that XVI32 matches the number of frames in the image. Click OK to remove the count information window.
9. Scroll back to the top of the file. Click on the first character to change again, which should be the 50th character (last character in the 5th row) for things created with APE. Now that the character is highlighted, double click on the number to the right of "byte" in the Data Inspector window. An "Encode number" window appears.
10. Look at the offset numbers you wrote when you adjusted the image in ZOOT. It is the second offset number that we want. Change the number in the "Encode number" window to this second offset number. In the case of Oryx5, I changed the number to 188. Click "Overwrite at current adress" and click OK. The first part of the first frame is now changed.
11. Click 2 characters past the previous change, which should be the 52nd character (2nd character in the 6th row of the rightmost section) for things created with APE. Now that the character is highlighted, double click on the number to the right of "byte" in the Data Inspector window. An "Encode number" window appears.
12. Look at the offset numbers you wrote when you adjusted the image in ZOOT. This time, it is the first offset number that we want. Change the number in the "Encode number" window to this first offset number. In the case of Oryx5, I changed the number to 196. Click "Overwrite at current adress" and click OK. The second part of the first frame is now changed.
13. Now we want XVI32 to change the remaining frames for us. So we need to tell XVI32 what we just changed. Click on the first character that was changed again, which should be the 50th character (last character in the 5th row) for things created with APE. Click Edit->Block <n> chars, click decimal, type "3" into the box, and click OK. Click Edit->Clipboard->Copy as hex string.
14. Now we can have XVI32 change the remaining frames. Click Search->Replace. Remove anything in the box beneath the second "Hex string". Note that this is the second "Hex string" and not the first. Then right click in that box and click Paste. Click "Replace all". XVI32 will change the rest of the frames and tell us how many it changed. This will be 1 less than the total number of frames because we changed the first frame ourselves. Click OK to remove the Information box.
15. Click File->Save to save the changes into the file and close XVI32.
16. If needed, use steps 2-15 for the other 3 ZT views (idle->SW, idle->NE, idle->NW). In the case of Oryx5, these other 3 views are dummy views using the icon in order to keep the download smaller. If you want 4 reasonable views of Oryx5, follow the instructions in the next section. In any case, once you have finished with the views, zip the object back into a ".ztd" and test it inside ZT to make sure it is adjusted properly with the grid lines on and that the image does not appear to jump as it does the animations. I usually use a torch to go around the image inside ZT to make sure ZT thinks it is where it looks like it is.


Making The Three Other Views Of Oryx5

The Oryx5 has only 1 view. If you have been using it to go through this guide and would like to use it in your game, you can copy the 1 view into the remaining 3 views. Although this is not realistic, it will at least let you use the object in your own zoos. The following instructions say how to copy the views.

1. In "My Computer" or "Windows Explorer", go into the objects->26FED051->idle folder. Delete the NE, NW, SW, NE.pal, NW.pal, and SW.pal files. Copy the SE file and paste it 3 times into that folder. Rename the "Copy of SE" files to NE, NW, and SW. Copy the SE.pal file and paste it 3 times into that folder. Rename the "Copy of SE.pal" files to NE.pal, NW.pal, and SW.pal.
2. Although the other views will work properly at this point, it is preferred that each of the graphic files refers to the proper color (".pal") file. We will use XVI32 to change them to do so. Start XVI32 and Open the NE file. In the rightmost section, click character 31 (first character of the 4th row). It is a "S". Type "N" and the "S" will be changed to a "N". Click File->Save.
3. Open the NW file in XVI32. In the rightmost section, click character 31 (first character of the 4th row). Type "NW" and the "SE" will be changed to a "NW". Click File->Save.
4. Open the SW file in XVI32. In the rightmost section, click character 32 (second character of the 4th row). It is an "E". Type "W" and the "E" will be changed to a "W". Click File->Save.
5. Exit XVI32, zip the object back into a ".ztd", and test it inside ZT.

-----

The above guide may be copied to any web site. But, except for formatting changes or changing the location of Oryx5.zip, the contents may not be changed, including the credits. If there are any suggestions for changes, please post them at Zookeeper's Lounge. That is where this guide will be kept up-to-date. drrick/ztdoctor has also graciously given permission to allow the Oryx5.zip graphics to be copied to any site that copies this guide.

Adjust Rotations Of Large Animations Using XVI32 in the Designer Guides section at the Zookeeper's Lounge web site:
index.php
- written by Jay; graphics by drrick/ztdoctor
Post Reply