#ifndef __DEFS_H #define __DEFS_H #include /* Macros */ //#define OPENGL // sound channel numbers #define CH_LASTCHANNEL 21 #define CH_HURRYUP 20 #define MAXDEATHTEXT 4 #define MAXBIFFTEXT 4 // size of flower straem when getting last flower // (number of gems on each side) #define STREAMWID 5 // puff of smoke #define PUFFFRAMES 6 #define PUFFSPEED 4 // how fast it animates (smaller = faster) #define PUFFAPPEAR 4 // frame at which puff will turn into a gem // text sizes #define TEXTSIZE_POINTS 10 #define TEXTSIZE_SCORE 14 #define TEXTSIZE_BONUS 20 #define TEXTSIZE_HELP 20 #define TEXTSIZE_DEATH 20 #define TEXTSIZE_LEVEL2 22 #define TEXTSIZE_BIFF 26 #define TEXTSIZE_LEVEL 32 #define TEXTSIZE_LIFE 36 #define TEXTSIZE_BOMB 36 #define TEXTSIZE_HURRY 50 #define TEXTSIZE_GAMEOVER 50 // text delays #define TEXTSPEED 2 // how fast text zooms in // how long to keep various text on the screen #define POINTSDELAY 40 #define BONUSDELAY 50 #define HURRYDELAY 50 #define LIFEDELAY 50 #define LEVELWINDELAY 80 #define DIEDELAY 80 #define HELPDELAY 80 #define LEVELDELAY 100 #define GAMEOVERDELAY 200 // Sizes #define TILEH 16 // tile width (in pixels) #define TILEW 16 // tile height (in pixels) #define LEVELW 40 // level width (in tiles) #define LEVELH 30 // level height (in tiles) // Game mechanics #define INVULNTIME 200 // how long player stays invulnerable for #define SHIELDTIME 500 // how long a shield lasts #define FALLSPEED 4 // terminal velocity of falling sprites #define NETSPEED 9 // how fast the player's net moves #define POWERUPTIME 15 // # secs before a powerup appears #define MACEEXPX 4 // X size of mace explosion #define MACEEXPY 2 // Y size of mace explosion // Limits #define MAXLEVELS 100 #define MAXMAPPINGS 50 #define MAXMONSTERSPERLEVEL 40 #define MAXLETTERHEIGHT 100 #define MAXFRAMES 16 // max number of frames for sprites #define MAXHELP 5 #define MAXTILEFRAMES 10 // max number of frames for animated tiles // Fixed text buffer sizes #define BUFLEN 512 #define MIDBUFLEN 64 #define SMALLBUFLEN 32 // Boolean values #define B_TRUE -1 #define B_FALSE 0 // Other #define WANTFPS 60 // try to run at this many frames per sec /* enums */ /* sounds */ #define MAXFX 19 #define FX_SHOOT 0 #define FX_SLAM 1 #define FX_KILL 2 #define FX_MULTIKILL 3 #define FX_JUMP 4 #define FX_FRUIT 5 #define FX_POWERUP 6 #define FX_DIE 7 #define FX_WINLEVEL 8 #define FX_HURRYUP 9 #define FX_TOOSLOW 10 #define FX_BONUS 11 #define FX_MORPH 12 #define FX_BOOM 13 #define FX_SPRING 14 #define FX_TELEPORT 15 #define FX_SPLASH 16 #define FX_MACE 17 #define FX_LIFE 18 #define FX_GAMEOVER 19 // Slope types #define S_NOTSOLID 0 #define S_SOLID 1 #define S_SLOPE 2 // Sprite types #define MAXPTYPES 33 #define P_PLAYER 0 #define P_RAT 1 #define P_CHEESE 2 #define P_SPEED 3 #define P_NUMNETS 4 #define P_BIGNET 5 #define P_BEE 6 #define P_SPIDER 7 #define P_CLOUD 8 #define P_ICECREAM 9 #define P_CHIPS 10 #define P_BURGER 11 #define P_SNAKE 12 #define P_SPIT 13 #define P_HELP 14 #define P_FLOWERYELLOW 15 #define P_FLOWERRED 16 #define P_FLOWERPURPLE 17 #define P_COKE 18 #define P_GEMRED 19 #define P_PUFF 20 #define P_GEMYELLOW 21 #define P_GEMPURPLE 22 #define P_POWERUPPOS 23 #define P_BOXING 24 // this is the powerup #define P_GLOVE 25 // this is the glove on the end of the net #define P_DIAMOND 26 #define P_FTODIAMOND 27 #define P_FTOGEM 28 #define P_BOMB 29 #define P_SHIELD 30 #define P_MACEPOWERUP 31 #define P_MACE 32 // powerups #define PW_NONE 0 #define PW_BOXING 1 // boxing glove #define PW_BOMB 2 // bomb #define PW_MACE 3 // made // Frame names #define F_WALK1 0 #define F_JUMP 1 #define F_FALL 2 #define F_CAUGHT 3 #define F_DEAD 4 #define F_DEAD2 5 #define F_DEAD3 6 #define F_DEAD4 7 #define F_CLIMB1 8 #define F_CLIMB2 9 #define F_SHOOT 10 #define F_SLAM1 11 #define F_SLAM2 12 #define F_SLAM3 13 #define F_SLAM4 14 #define F_SLAM5 15 // Level states #define LV_INIT 5 // just loaded, waiting for monsters to appear #define LV_INPROGRESS 0 // regular game play #define LV_CLEAR 1 // all monsters dead #define LV_WAIT 2 // LEVEL COMPLETE displayed, delay to collect fruits #define LV_FINAL 3 // delay 5 seconds more... #define LV_NEXTLEV 4 // end of delay, nextlevel() in 5 seconds #define LV_GAMEOVER 6 // No lives left. // Tile types #define T_BLANK 0 #define T_LAND 1 #define T_SLOPEUP 2 #define T_SLOPEDOWN 3 #define T_FULL 4 #define T_SKY 5 #define T_LADDER 6 #define T_LADDERTOP 7 #define T_RIGHT 8 #define T_LEFT 9 #define T_SPIKES 10 #define T_TELEPORT 11 #define T_TELEPORT2 12 #define T_TELEPORTDEST 13 #define T_WATER 14 #define T_WATERTOP 15 #define T_WATERSPIKES 16 #define T_BRIDGE 17 // like land but you can drop down through it #define T_TRAMPUP 18 #define T_TRAMPDOWN 19 // death states #define D_INITIAL (1) // Need to trigger death sequence #define D_BOUNCING (2) // Corpse is bouncing around the screen #define D_LASTBOUNCE (3) // Final descent, about to turn to fruit(or respawn for player) #define D_FINAL (4) // ACTUALLY dead, remove the sprite // teleporting states #define TP_SHRINKING (1) // entering teleporter // caught by net states #define C_NETTING (1) // being pulled in to player #define C_NETTED (2) // being held by player // directions #define D_RIGHT (1) #define D_LEFT (-1) #define D_UP (-2) #define D_DOWN (2) /* data structures */ typedef struct mapping_s { char ch; int tnum; } mapping_t; typedef struct tiletype_s { int uniqid; int id; char name[SMALLBUFLEN]; int lowness[TILEW]; int solid; int water; int spikes; SDL_Surface *img[MAXTILEFRAMES]; int numframes; int animspeed; struct tiletype_s *next; struct tiletype_s *prev; } tiletype_t; tiletype_t *tiletype; typedef struct initialmonster_s { int startx; int starty; int id; char *help; } initialmonster_t; typedef struct text_s { int x,y; int size; int maxsize; int state; int delay; // how long to stay on screen char txt[BUFLEN]; SDL_Rect bgarea; SDL_Surface *bg; SDL_Surface *img; SDL_Color *c; struct text_s *next; struct text_s *prev; } text_t; typedef struct level_s { int id; int bgtileid; char *tileset; char name[SMALLBUFLEN]; int map[LEVELW*LEVELH]; int map2[LEVELW*LEVELH]; // second map layer int tileframe[LEVELW*LEVELH]; // tracks frame numbers for tiles int *animtiles; // array of offsets to map positions which are animated struct level_s *next; struct level_s *prev; int p1x; /* player 1 start pos */ int p1y; int powerupx; /* powerup position */ int powerupy; /* powerup position */ int gotpowerup; /* has the random powerup appeared yet? */ int exitdir; /* which way to scroll on level completion */ int nummonsters; initialmonster_t initm[MAXMONSTERSPERLEVEL]; int hurryuptime; int poweruptime; } level_t; level_t *level; typedef struct levelentry_s { int id; char *filename; char *desc; } levelentry_t; typedef struct sprite_s { int id; // what kind of sprite? (eg. player, cheese, rat) int score; // player's score, for monsters how much they are worth // ATTRIBUTES double speed; // how fast this sprite moves // CURRENT STATE // player only int lives; int slamming; // are we slamming our net (player only) double slamangle;// are what point around is our net? int netting; // are we shooting our net out? int climbing; // are we climbing a laddder int invuln; // are we invulnerable (ie. just after player respawning) int netcaught; // how many monsters are in our net? int netmax; // how many monsters can our net hold? int netspeed; // how fast does our net shoot out? int netdir; // which way is our net going (left/right) int netlen; // how far our is our net? int netbig; // have we collected a BIG NET powerup? int nety; // y position of end of net (used when shooting >1 net) int netxstart; // x position of start of net int netystart; // y position of start of net int powerup; // what temp powerup does the player have? int ontramp; // on a trampoline? int trampx; // x,y coords for trampoline we are/were on int trampy; // // monster only int willbecome; // what fruit this will become when dead int angry; // is this sprite in ANGRY mode for its AI? struct sprite_s *caughtby; // who has us in their net? NULL if nobody int quickdie; // die without bouncing? int caughtstate; // are we caught by a net? being pulled in or caught? int jumptimer; // delay before we will jump int flies; // can we fly? double xs,ys; // bounce direction after death struct sprite_s *bullet; // pointer to our bullet struct sprite_s *owner; // if we ARE a bullet, pointer to the sprite who made us char name[MIDBUFLEN]; // Help text for help icons, otherwise not really used outside of debugging // player and monster int swimming; // are we in the water? int falling; // are we falling? int dropping; // are we purposely dropping through solid ground? int dropx,dropy;// coords of tile we dropped from int fallspeed; // how fast are we falling? int jumping; // are we jumping? int jumpdir; //which way are we jumping? int jumpspeed; // how fast we are moving upwards int teleporting;// are we inside a teleporter? >0 is entering, <0 is exitting int dead; // is this sprite dead? if so, what dying state? int bounces; // how many time have we bounced after dying int doomcount; // sprites dies when this reaches zero int moved; // did we move this loop cycle? int timer1; // int timer2; // int timer3; // // GAME MECHANICS double x,y; // current position int dir; // which way we are facing (1=right,-1=left) SDL_Surface *img; // current graphic image SDL_Surface *netbg; // temp storage for area behind net // LINKED LIST STUFF struct sprite_s *next; struct sprite_s *prev; } sprite_t; typedef struct imageset_s { SDL_Surface *img[MAXFRAMES*4]; int numimages; } imageset_t; imageset_t imageset[MAXPTYPES]; /* external globals */ extern SDL_Color black; extern SDL_Surface *screen, *temps, *levelbg, *head, *headsmall; extern sprite_t *sprite, *lastsprite, *player; extern level_t *curlevel; extern tiletype_t fakeblock; extern int gtime; extern int timer; extern SDL_Color red; extern SDL_Color black; extern SDL_Color blue; extern SDL_Color white; extern SDL_Color green; extern SDL_Color yellow; extern int vidargs; extern int toggletimer; extern TTF_Font *font[]; extern int musicplaying; extern Mix_Music *music, *normalmusic, *fastmusic; extern Mix_Chunk *sfx[]; extern int oldexitdir; extern int levelcomplete; extern text_t *text, *lasttext; extern int cheat; extern int nexthurryup; extern levelentry_t levelentry[]; extern int numlevels; extern char *deathtext[]; extern char *bifftext[]; #endif