BATTLE FOR THE THRONE: ABOUT THE PROGRAM The program was written in Personal Pascal version 1.11. The game could not have been written without the useful routines and all around neat stuff availiable on the OSS BBS, especially the Copy_Rect routine which allows you to copy a raster image from the screen to an area of memory and back again. These routines are also availiable from them on disk. The program is laid out in three sections, with the general purpose routines first. These procedures and functions could be used in any program. Next is the game itself and last is the outside framework containing the title page, save game, credits and other functions to give the game a more professional appearance. The first part of the program, right after the variable declarations, contains Init_Form, a procedure that initializes the screen variables and sets them up so that they can be found by Copy_Rect. Next are procedures for setting the height of characters printed with Draw_String and some conversion functions for converting between strings and integers. The title page and the map information are stored as .NEO picture files, so there are procedures for reading .NEO files and setting the color pallet to match the pictures. The procedures, appropriately named Set_Color_Registers and Read_Color_Registers are also used to save and restore the desktop colors so your desktop has the same colors when the program is finished as when you started. Another useful procedure is Fade_Color, used to gradually change from one pallet to another. Once all of the general purpose stuff is out of the way there is Initialize, a procedure that loads the screens, sets up the menu bar, the build troops dialog box and initializes the variables and sets things up for playing the game. The next section of the program contains the map generation. This was one of the hardest sections to get right. If the map was too random, too often one player had an advantage because of the surrounding terrain. On the other hand, if the map is too regular, every game looks the same. Next is the section for actually drawing the map. A pair of For loops scan across the terrain array and grab 'tiles' out of the stored picture file and put them on the appropriate place on the screen. The areas for each terrain type in the picture file is larger than the actual square on the map, so I added a little offset to each one as it is drawn. This makes it so that the villages, swamps, etc. don't all look the same. The procedure Play_Game handles each player's turn. There seems to be a bug in GEM or Personal Pascal that mangles the text in dialog boxes if you are using the small font and try to change the text. I got around this problem by writing procedures to draw my own dialog boxes and use TE_Height and Draw_String to get text in any size I wanted. I would have just used the large font and saved myself a lot of trouble but I could not make everything fit on the screen in low-res with the large font. The economic section contains the tax collection, buy troops and all of the nasty things that happen (plagues, curses, etc). It starts by calling Find_Castle to make sure you have a castle. The Move_Bandits section controls the movement of Crobvar's bandits. It works by scanning the map to find the place where the biggest pile of bandits is and moving them toward the place with the highest population and the least defense; underdefended villages and castles will attract the bandits. The Fate procedure controls the various plagues, unusual weather, population increases and curses that spice up the game from time to time. The Winner function checks to see if one player is the only one left with any troops. If it discovers this to be true then it puts up a dialog box proclaiming the new king and ends the game. The next section contains the dialog boxes that come up when you use the various pull-downs at the beginning of the game: the score, save game, 'About Battle for the Throne' box, instructions and playtester box. The playtester box contains credits given to all of the people who played the game and made suggestions that were used in the program. Lastly there is the main program that ties everything together and keeps you from running the program from the wrong resolution. COMPILING THE PROGRAM To compile the program you will need to edit the path names of the include files to conform with the way your system is set up. Then set the 'Additional Link Files' to include Addrstuf.o.