======================================================================== Hacking BurgerSpace ======================================================================== Last update: May 5th, 2001. SOURCE CODE The source code is in the `src' subdirectory. The following is a short description of each source file. sdlmain.cpp Contains the main() function. Interprets command-line arguments. Initializes the random number generator. Builds an instance of the BurgerSpaceEngine class. This class is derived from GameEngine, a class of the `gengameng' library (also written by Pierre Sarrazin). Calls the run() method on this instance. This method is inherited from GameEngine. Its function is to implement the double-buffering technique: - call the tick() pure virtual method on the game engine object every 50 milliseconds; - "flip" the two video pages. BurgerSpaceEngine.cpp BurgerSpaceEngine.h Object representing the double-buffering game engine. Its constructor initializes everything, then the tick() virtual method is called once for every animation frame. Its function is to: - manage the "pause" mode when applicable; - animate the player and respond to user commands; - animate the other characters; - restore the background tiles; - redraw the characters at their new positions; - detect collisions are respond accordingly. IngredientSprite.cpp IngredientSprite.h Every "ingredient" (bread, meat, etc) is represented as a horizontal sequence of four sprites. I don't like the term "ingredient" anymore, but I'm stuck with it... An IngredientSprite object knows to which IngredientGroup object it belongs. When the chef walks over an IngredientSprite, a check is made to see if all other members of the same IngredientGroup have been walked over. If so, the whole group is made to fall one or more floors. Derived from Sprite, a class of the `gengameng' library. A Sprite defines a sprite's position, speed, size, pixmap number, etc. IngredientGroup.cpp IngredientGroup.h Container that groups four IngredientSprite objects that form an ingredient. EnemySprite.cpp EnemySprite.h Derived from Sprite, a class of the `gengameng' library. May be attached to an IngredientGroup. Applies when an ingredient starts falling and the enemy was standing on it at the time. The enemy starts falling also. The EnemySprite object knows to which IngredientGroup object it is then attached. This object also contains timing counters to control to period of time when the enemy disappears temporarily or "agonizes" before dying. An enemy disappears temporarily when it lands after getting carried down by an ingredient. An enemy starts dying when it has been smashed by an ingredient that fell over it. Every Sprite object has the concept of a "time to live". It is in practice used as a timer for a temporary condition, like the two preceding conditions. The time-to-live of an EnemySprite is used to represent the paralysis time after an enemy has been sprayed with pepper by the chef. Makefile.am Makefile source processed by automake to produce Makefile.in. The bootstrap script is the one that calls automake; it also produces the configure script from the configure.in source. images Directory that contains all the images. It contains one .png file that is used as the GNOME menu icon. The others are XPM files that are used in the game, by being #included by the C++ sources. The configure script is then run, and it processes Makefile.in to produce Makefile. To learn more about the GNU Autotools, there is a book on the Web: http://sources.redhat.com/autobook/ burgerspace.desktop File that defines the BurgerSpace entry in a GNOME menu. Intended to be installed in /usr/share/gnome/apps/Games.