Sprite Wizard - By David A. Visage (c) 1988 Message Software James Messa and David Visage GET THE MESSAGE! Welcome to SpriteWiz, possibly the best sprite editor for the Amiga! Before I go into detail about how SpriteWiz works, some of the available features are as follows : (1) Up to 26 sprite images can be edited at one sitting NOTE 1 (2) Each sprite can have it's own set of three colors (3) Sprite images can be saved as C or 68000 source code (4) Sprite binary data can be saved for later editing (5) Sprite images can be rotated 90 degrees left or right NOTE 1 (6) Sprite images can be flipped on the X or Y axis (7) Sprite images can be scrolled in all four directions NOTE 1 (8) An animation sequence can be entered and viewed (9) Sprite colors can be set to default colors at any time (10) As the RGB gadgets are moved, affected colors change instantly (11) Speed for the animation routine is user selectable (12) A buffer option for get and put operations (13) Sprite images can be negated. Also called "exclusive-or". (14) Continuous display of the current (X,Y) plotting coordinates (15) Continuous display of the current sprite number (A - Z). NOTE 1 - SpriteWiz has a feature not found in many programs. This feature is called repeat mode. For example, the scroll mode is activated by hitting either the scroll up, scroll down, scroll left, or scroll right gadget. Once this mode is active, the sprite will continue to scroll in the selected direction until the mouse select button is released. The features listed above that are marked with "NOTE 1", all have a repeat mode. The layout of the SpriteWiz screen is intuitive and user-friendly. The left side of the SpriteWiz screen is reserved for the edit grid. This grid is exactly 16 boxes high by 16 boxes wide. Version 2.0 of SpriteWiz will feature editable sprites up to 192 pixels tall. The upper right hand corner of the screen has an indicator that always shows the current pen color. Thus, if the mouse is positioned in the edit grid and the mouse select button is depressed, whatever color is shown in the current color indicator will be plotted at the point where the pointer is positioned. More importantly, a corresponding pixel will also be plotted within the current edit sprite. The current sprite image is in the lower right hand corner of the screen. As the image is drawn or erased or the edit grid, the new sprite image is automatically drawn or erased. Next to the current color indicator are the repeat gadgets. Starting from the right they are : (1) Sprite select gadgets - These are used for selecting which sprite image to edit. Hitting the plus gadget selects higher sprite numbers. Hitting the minus gadget selects lower sprite numbers. These are repeat gadgets. Thus, when they are selected, they will will continue to flip through each sprite until the mouse select button is released. These gadgets also feature a wrap-around mode. To see how this mode works, select sprite 'A' and continue to hold down the plus gadget. You may also select sprite 'Z' and hold down the minus gadget. (2) Scroll gadgets - These are used to scroll the current sprite image in all four directions. As long as one of the scroll gadgets is selected, the sprite image (and the grid image), will continue to scroll in the selected direction. This is probably one of the most eye-opening modes of SpriteWiz. (3) Rotate gadgets - These are used to rotate the current sprite image. Selecting the gadget on the right will rotate the current sprite image at 90 degree angles to the right. Selecting the gadget on the left will rotate the current sprite image at 90 degree angles to the left. As the sprite image is rotated, the grid image is also rotated. The current drawing pen color is selected by hitting one on the color select gadgets. Gadget labels and descriptions are as follows : COL0 - This gadget always selects the background color. Selecting this color is how SpriteWiz performs the erase operation. If COL0 is the active draw color and a point is plotted on the edit grid, that point will automatically be set to the background color. In addition, the corresponding point within the current edit sprite is erased. For interested people, selecting this color is the same as using bit pattern '00'. COL1 - This gadget always selects sprite color one. For interested people, this color is the same as using bit pattern '01'. COL2 - This gadget always selects sprite color two. For interested people, this color is the same as using bit pattern '10'. COL3 - This gadget always selects sprite color three. For interested people, this color is the same as using bit pattern '11'. Please see the Amiga hardware reference manual or the ROM kernal manuals for more details on how sprite colors are determined. When one of the color select gadgets is selected, the following happens : (1) The current color indicator changes to the selected color. This becomes the current draw color when a point is plotted within the edit grid. (2) The RGB gadgets (Labled with R,G, and B) show you the amount of red green and blue in that color. The RGB gadgets are directly below the color select gadgets and to the left of the current sprite image. As mentioned above, these gadgets show you the amount of red, geen and blue in the currently selected drawing color. These gadgets operate in two different ways. The knob on each gadget can be selected and dragged, or you may click within the gadget select box. Before going any futhur, let me provide you with a little background on how these colors are determined. The Amiga has the capability to display any of 4096 possible colors. Each color on the Amiga is determined by a certain amount of red, a certain amount of green, and a certain amount of blue. These colors are called the primary colors. That is, all possible colors are a mixture of these three colors. On the Amiga, each one of these primary colors must be within the range [0..15]. Below are examples of the amounts of red, green and blue and the color they determine : This is the color yellow RED - 15 GREEN - 15 BLUE - 0 This is the color purple RED - 15 GREEN - 0 BLUE - 15 This is the color orange RED - 15 GREEN - 8 BLUE - 0 When the amount of red, green and blue are at their maximum value (15), the color white is determined. When the amount of red, green and blue are at their minimum value (0), the color black is determined. The reason the Amiga palette has 4096 possible colors is that each primary color can have any one of 16 possible values. Thus, combinations of these three colors yield the following : 16 x 16 x 16 = 4096 colors. Oh well, enough is enough, lets get back to SpriteWiz. Assume the current color indicator is red. The RGB gadgets will have red at it's maximum value. Green and blue will be at their mimimum value. If the green gadget is clicked on, the amount of green in the current pen color will be increased by one. Selecting this gadget until it is at it's maximum value will change the current pen color to yellow. You may also select the knob in the green gadget and drag it in either direction. When you fiddle with the RGB gadgets, the following happens : (1) The current color indicator changes (2) The currently selected color gadget changes (3) Any boxes on the edit grid that have the selected color change (4) Any points in the edit sprite that have the selected color change (5) Certain intuition rendered things change colors too (Oh well). The last few lines of the screen are reserved for the speed gadget, the buffer gadget, and the current "mode". Labels and descriptions follow : SPEED - This is used to determine the speed at which the animate feature changes sprite images (See menu option ANIMATE). This gadget can be moved by clicking in the select box or by hitting the knob and dragging it to the left or right. Faster image changing takes place as the gadget is moved to the left. Slower image changing takes place as the gadget is moved to the right. BUFFER - This is really two gadgets in one. Descriptions follow : The gadget on the left has the text "GET". When this gadget is selected, whatever sprite was in the save buffer will be moved into the current edit sprite. The gadget on the right has the text "PUT". When this gadget is selected, the current edit sprite will be moved into the save buffer. The "GET" and "PUT" gadgets are useful for doing sequenced animation. For example, you can draw an image in sprite 'A'. When you are satisfied with it, the image can be "PUT" into the save buffer. The next step would be to select sprite 'B', make minor changes, and "PUT" this sprite into the save buffer. Repeating this series of steps over and over lets you draw a series of images that are similiar to each other. Sequenced animation is nothing more than a series of similiar images being flipped through. MODE - Indicates current range mode. (See menu option Mode). SpriteWiz has a number of menu options available. Starting from the left they are "Project","Edit", "Mode" and "Animate". You will notice that several options on the SpriteWiz menu are in bold text. What this means is that these options have the ability to work on multiple sprites. At the time of this writing, the following can work on multiple sprites : "Save", "Save As", "Clear", and "Reset". The default mode for options that work on multiple sprites is Current. This can be changed by selecting another choice from the mode menu. Please note that once a mode is selected, this mode will be used for all options that work on multiple sprites. Modes that are currently defined are : Current - The operation is performed on the current sprite only. All - The operation is performed on all 26 sprites. From - The operation is performed starting at the current sprite and ending at the last sprite. Up To - The operation is performed starting at the first sprite and ending at the current sprite. Except - The operation is performed on all sprites except the current sprite. Under the "Project" menu are the following items : "About" - This menu item has two sub-items associated with it : (1) Author - This will give you some background information about the author of SpriteWiz (Yours truely!). (2) Program - This will give you some background information about the SpriteWiz program. It also contains a small plug about SpriteWiz V2.0 "Open" - Selecting this menu item will load sprite binary data from the disk. Any sprite data that is to be loaded must have been saved by SpriteWiz using the "Save" option. Please note that SpriteWiz saves several vital pieces of information about each sprite. One of these pieces of information is the sprite number. Thus, saved sprite binary data is always loaded into the same place from which it was saved. If your current edit sprite is one of the saved images in the sprite binary data, the edit sprite image will change to the saved sprite image, all colors will be set to the saved sprite colors, the RGB gadgets will be reset to whatever the current pen color is, and the sprite will be recalculated on the edit grid. Do not try to load a non-existant file or data that was not saved using the SpriteWiz "Save" option. SpriteWiz is smart enough to know when you are not doing something right. (Trust me!). "Save" - This menu item will save sprite binary data to the disk. This sprite data can be retrieved at any time by selecting the "Open" option. Since this item is in bold text, it has the ability to work on mutiple sprite images. See the discussion concerning the same operation on multiple sprites. Again, do not try to save to a non-existant or invalid device. SpriteWiz will detect when you are doing something wrong. "Save As" - This menu item has two sub-items associated with it : (1) C Source - This option will allow you to save the indicated sprite data in a format that can be used in your own C programs. The generated C code was designed to be used with AZTEC 3.4, but should work with Lattice C as well. The example program SW_CDemo will show you how to use the generated code is your programs. (2) Assembler - This option will allow you to save the indicated sprite data in a format that can be used in your own assembler programs. The generated assembler source code was designed to be used with the Aztec 3.4 assembler, but should work with the MetaComco macro assembler as well. The example program SW_AsmDemo will show you how to use the generated code in your own programs. Please notice that the "Save As" menu item is in bold text. Thus, it has the ability to work with multiple sprite images. As mentioned above, SpriteWiz contains very extensive error checking. Do not try to save to an invalid or non-existant device. Also note that the example program SW_AsmDemo.asm will not assemble with any assembler but Aztec 3.4 If you wish to use another assembler, you must make the needed changes. "Quit" - Selecting this menu item will return you to the same place that SpriteWiz was called from (CLI or Workbench). You may also quit SpriteWiz by selecting the close gadget in the upper left hand corner of the screen. Under the "Edit" menu are the following items : "Flip" - This menu item has two sub-items associated with it : (1) X Axis - Selecting this sub-item will flip the current edit sprite on the X Axis. If you are unfamiliar with mathematics, this option will flip the sprite image vertically. (2) Y Axis - Selecting this sub-item will flip the current edit sprite on the Y Axis. If you are unfamiliar with mathematics, this option will flip the sprite image horizontally. When one of the "Flip" options is selected, the current sprite will be re-calculated on the edit grid. "Clear" - Selecting this menu-item will clear sprite image data. Note that this item is in bold text and has the ability to work on multiple sprite images. If your edit sprite is within the currently selected range, the sprite image will be erased and the edit grid will clear. "Reset" - Selecting this menu-item will reset sprite colors to the default colors (Red, Green, and Blue). Again, since this item is in bold text, it has the ability to work on multiple sprite images. If your edit sprite is within the currently selected range, several changes take place. For example, assume the current pen color is COL1 and this color gadget shows yellow. When the "Reset" option is selected, the following happens : (1) The color select gadgets change to the default colors. Thus, the COL1 gadget changes to red. (2) The current drawing color indicator is reset to red. (3) Any dots on the edit grid (And in the edit sprite) that are drawn in in COL1 are set to red. (4) The RGB gadgets are set to the values that determine the color red. "Negate" - This menu item will perform an exclusive-or on the current edit sprite image. Each sprite color is determined by a pair of bits. '00' - This combination determines COL0. '01' - This combination determines COL1. '10' - This combination determines COL2. '11' - This combination determines COL3. Performing an exclusive-or with pattern '11' has the following results : Before After Result ------ ----- ------- 00 11 All COL0 dots become COL3 dots. 01 10 All COL1 dots become COL2 dots. 10 01 All COL2 dots become COL1 dots. 11 00 All COL3 dots become COL0 dots. Please see the Amiga hardware manual for a more detailed description. Under the "Mode" menu are the following items : (1) Current (2) All (3) From (4) Up to (5) Except Selecting any one of these will set the range for any menu items that are in bold text. The mode indicator in the lower left hand screen always indicates what the current range is. Under the "Animate" menu are the following items : "Define" - Selecting this memu item will allow you to define an animation sequence. When you enter your seqeunce, each frame must be referred to by the sprite number. That is, when you enter your sequence, the only valid characters are 'A' through 'Z'. Both upper and lower case letters are accepted, as all input is converted to upper case. Do not try to enter an invalid character. Once again, SpriteWiz contains very extensive error checking and will inform you of any errors. "Start" - Selecting this menu item is one of the neatest parts of SpriteWiz. Basically, it will set the intuition pointer to each sprite that you have defined in your animation sequence. Not only does the image of the pointer change, but the colors change as well. As the animation sequence is being run through, you are free to move the mouse around. Please note that the pointer is not "active" when the animation sequence is being shown. That is, you cannot select any gadgets or use the menus while SpriteWiz is performing your animation sequence. To exit the animation sequence, press the left mouse button. When the left mouse button is depressed, the pointer changes back to it's default imagry and colors. The speed at which the animation sequence is performed depends on where the speed gadget is currently positioned. Before you can "Start" an animation sequence, you must "Define" one. SpriteWiz will inform you if an animation sequence has not been entered. Errata and general fun stuff : You might notice that several menu items are not active. Under the "Save As" menu, the "Modula II" and "Basic" options are ghosted. Under the "Mode" menu, the "Range" option is disabled. These options are reserved for future releases of SpriteWiz. When SpriteWiz first loads up, the imagry of the default intuition pointer is calculated on the edit grid. This becomes your current edit sprite. You can erase this image by selecting menu option "Clear". The colors for the edit sprite are set to the default colors of Red, Green, and Blue. The real pointer colors do not change. The default range mode is "CURRENT" (See discussion above). Default buffer imagry is blank. Colors are set to Red, Green, and Blue. The text that is displayed in information and error requester gadgets changes every so often. Do not be alarmed by this, I planned it to be that way. For example, try to "Start" an animation sequence without first entering one. You might get a different gadget message each time. Once in a while, it will appear that the repeat gadgets continue without your intervention. This is really not a program bug, but is caused by all the refreshing, updating, testing and caculating that needs to be done. Intuition does not offer anything called a repeat gadget. I had to develop my own code to make them work like repeat gadgets. Unfortunately, it would seem that sometimes my code is not fast enough to keep up with all the IntuiMessages (See intuition manual) that are coming in. If this happens, keep selecting the offending gadget until it stops. David A. Visage 7371 Power Inn Road #106 Sacramento, CA. 95826 Also by David Visage - Mind Expander (With full C source) Disk Wizard V1.0 Availble on finer B.B.S systems GET THE MESSAGE!