Indent
Indent


Weasel Tools


IndentThese are a couple mini-programs I use all the time. You could write them for yourself very easily, but I wanted to add stuff to my web page to make it seem more purposeful, so I put these up here :) These do have source code with them, but be warned they were hacked out very quickly, and as such are very very poorly written. I take no responsibility for your use of these programs or their code. This page is the most complete documentation for these, so you might want to keep a copy local or even print it out if you're going to use these often. The programs will tell you the commands if you give them no input, but this page might help a little more :) Failing that, look at the source to see what's going on.


Line!

There are ten programs (in six distribution zip files):

Blit
This is just a simple utility to view 8 bit graphics in pcx, bmp and tga formats. It's exactly like one of the Allegro examples, with the addition that it displays the filename, width and height in the upper left corner, and it can accept more than one file to display, along with wildcards. So, "blit mysha.pcx" would show nice little Mysha. "blit *.pcx *.bmp *.tga" would display all the valid graphics in the directory. Simple, eh? Yep :)


Watch
This is just a little thing to display the time and date. I'm obsessed with the time, so this is very useful for me.


Compose
This is a little utility to place bitmaps on a grid in a larger bitmap. The output would then be able to be used with the grabber's box grab feature. It's command line based (might make a configgy file reader later, with more power). The commands are like so:
   compose result [switches] [filenames]
   	result is a valid filename, with the extension .pcx, .bmp or .tga
	The switches can go in any order, are optional and are:
   		-gColor allows you to specify the grid (background) color
	   	-gSize allows you to specify the grid size
	   	-w forces a width for the result file
	   	-h forces a height for the result file
	   	-sx forces the starting x co-ord
	   	-sy forces the starting y co-ord
	   	-noBorder removes the right and bottom grid lines
	filenames are the graphics to add - wildcards are valid
If the result file already exists, it will be wiped. However, if the result is one of the filenames listed, it will be added to the grid before being wiped and replaced by the new file. If no filenames are specified, a bitmap sized (0, 0) will be created unless a width and height are specified for it with the "-w" and "-h" commands. Fairly simple.


Showpal
This is just a simple little thing to display the palette and RGB values. You pass it a bitmap file to read (pcx, tga, lbm or pcx) on the command line and it grabs the palette from that. Then it draws the palette on screen, along with the mouse. As you move the mouse over the colors, it'll display the palette number and RGB value for that color. It's faster than loading up Neopaint or whatever to search for a color.


Paldef
This is a little thing that tries to identify various colors for you. It reads in a bitmap (pcx, lbm, tga or bmp) and outputs a series of #defines to a text file. Usage is like so:
	paldef bitmap header
Where header is the file to store the defines in (usually a .h). Fairly useful. I'm going to use it (just wrote it :) so I don't have to open up Neopaint or whatever, search for a good color, and then create some defines in order to draw circles, boxes or whatever in that color. This was a pain in my ass to write, because I misread the docs about makecol8(). See the Allegro Mailing List Archives for more info. Fortunately, it works ok now. Note that if the color doesn't exist it'll try to find a close match, but failing that you may get weird results. Such is life.


PalCopy
This is a little utility to copy a palette (or a sub-section of the palette) from one bitmap to another. It DOES NOT re-map the picture to the new palette, it just copies it there. You can use it like so:
      palcopy pic1 pic2 [-s n][-e n][-map n] [dest]
              -s specifies where to begin copying (default=0)
              -e specifies where to end copying (inclusive, default=255)
              -map lets you offset the copy index (default=0)
         If the last argument is a valid bitmap filename, then the
         result will be saved there instead of overtop pic2
Fairly simple. This was useful for stealing a portion of the Allegro Demo's palette in order to use its explosion effect in GWar. They look really cool :)


Enlarge
This is a very useful utility. It's used to manipulate the width and height of a bitmap in several ways. It does not scale the pre-exisiting bitmap in any way, just draws a border around it. For example, I put a border around sprites that are going to be rotated so they don't get clipped badly. In Corel I use the magic wand to select the object and then save that to its own file. I then run enlarge on it to make the bitmap square and give it a slight border. After that it's ready to be used in the grabber or whatever. Here's are the commands:
      enlarge source [-border n][-h n][-v n][-color n][-eq] [dest]
             source is a valid pcx, lbm, tga or bmp file
             -border specifies the border size (default=5)
             -h specifies the horizontal enlargement (default=5)
             -v specifies the vertical enlargement (default=5)
             -color specifies the border color (default=0)
             -eq first makes the bitmap square
             dest is the optional new filename
Note that if "-eq" is set, the bitmap is squared before the borders are added. If the destination bitmap is to be different than the source, it has to be the last argument. "-border" is basically a shortcut for calling "-h" and "-v" with the same numbers. This has been very useful in the making of GWar, to create easily rotateable objects.


Snag
I just made Snag this morning, but it's going to be incredibly useful. Basically, it's a program to extract sprites out of large graphics. For example, you could use one of the SpriteLib files, and instead of drawing boxes around the objects you wanted and then grabbing the sprite with the grabber, you would just use this to click on them and extract the sprite to its own file. In the program, there are two ways to extract a sprite. You can either left click on an object, or right click and hold to draw a box around the object. The box will then be shrunk to fit the object. Both methods save the sprite to a numbered filename (the default is resXXXX.bmp). The filename and type can be changed by command line parameters:
      snag bitmap [result prefix] [result type]
             If you want to specify a new file type (default is bmp)
             you must specify a prefix, in the order above.
Hitting escape quits the Snagger :) Objects are defined as being surrounded by color 0 (transparent). Simple, very useful.


lCount (1/11/99)
lCount is a program I wrote the other day to count the amount of non-blank lines in Camel. Mr Gross had been inquiring, so I wrote this in order to give him an accurate measure. You use it simply:
	lCount [files]
[files] can have a wildcard or be a whole series of files or whatever. Knock yourself out. It'll spit out how many files it counted and the total amount of non-blank lines. Have fun!


BinWrite (1/17/99)
This writes binary files. It works like this:
	binwr.exe [.<file>][,<file>][/if][/s<number>][-help][-usage][-?]
		".<file>" sets the output filename. There should be no
			space after the period
		",<file>" sets the input filename. There should be no
			space after the comma
		"/if" prompts (shabbily) for an input file
		"/s<number>" sets the size of the numbers to be written
			(in bytes) The default is 1 byte (char). Short int
			is 2. Integer is 4. No others are valid right now.
			There should not be a space between the s and the
			number.
		"-usage" & "-?" & "-help" all show a help screen
	
If you specify no output file, it will ask for one. If you specify no input file, it will take input from the keyboard. Input files are just text files with a series of numbers which it converts to binary and saves in the output file. Basically, it's pretty simple. I'm using this to write some test scripts for my science project.


Line!


Installation Directions


As the number of tools added has grown, so has the distribution size. In order to spare people who already downloaded some tools the redundancy of having to download them again in order to get the others, I have split it up into five files. They are:

wwtools.zip (466k): Blit, Watch, PalDef, ShowPal
wwtools1.zip (218k): Enlarge, PalCopy
wwtools2.zip (319k): Snag
wwtools3.zip (115k): Compose (fixed version)
wwtools4.zip (27k): lCount
wwtools5.zip (27k): BinWrite

Unzip them to any directory. That's all you have to do, however, I find these most useful if they're in DOS' path list. To add them, open up your autoexec.bat file. Then look for the "PATH" line. Mine looked like:

	PATH C:\WINDOWS;C:\WINDOWS\COMMAND;e:\neopaint;d:\djgpp\bin;c:\pkzip\;d:\scaryc\;
So, to add the tools, simply put the directory you unzipped them into at the end, followed by a semi-colon:
	PATH C:\WINDOWS;C:\WINDOWS\COMMAND;e:\neopaint;d:\djgpp\bin;c:\pkzip\;d:\scaryc\;d:\tools;
After autoexec.bat has been run again (you shouldn't have to restart, just execute it) you can execute them from anywhere. If I update any of these, they'll be available here. As always, I can be reached at [email protected] (ICQ UIN 1783204) for more information, update info and/or help and questions. Cheers :)

Page last updated 3/29/1999 [ Back to Programs | Back to Main ]

Indent
Indent