#ifndef __DEFS_H #define __DEFS_H #include /* files */ #define FILE_LEVELMAP "map.dat" #define FILE_TILEDEFS "tiledefs.dat" #define DIR_LEVELS "levels" // sizes #define SCREENW 640 #define SCREENH 480 #define B_CLEAR -1 #define B_NOCLEAR 0 /* Macros */ //#define OPENGL // joysticks #define J_PLAYSTATION 1 #define J_WII 2 #define J_OTHER 3 // sound channel numbers #define CH_LASTCHANNEL 21 #define CH_HURRYUP 20 // max number of regrowing tiles #define MAXREGROW 200 #define MAXWORLDS 5 // time a tile takes to regrow #define REGROWTIMER_SHORT 350 #define REGROWTIMER_LONG 500 #define MAXCREDITS 5 #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 // explosion #define EXPFRAMES 7 // shuriken #define STARFRAMES 5 #define STARSPEED 3 // meteor #define METEORMAXSPEED 3 // sparkles #define SPARKLEFRAMES 7 //#define SPARKLESPEED 3 // how fast it animates (smaller = faster) // text sizes #define TEXTSIZE_POINTS 10 #define TEXTSIZE_VER 13 #define TEXTSIZE_SCORE 14 #define TEXTSIZE_BONUS 20 #define TEXTSIZE_HELP 20 #define TEXTSIZE_CLOVER 20 #define TEXTSIZE_DEATH 20 #define TEXTSIZE_TITLE 20 #define TEXTSIZE_TITLE2 16 #define TEXTSIZE_CREDIT 14 #define TEXTSIZE_LEVEL2 22 #define TEXTSIZE_YUM 24 #define TEXTSIZE_BIFF 26 #define TEXTSIZE_MULTI 26 #define TEXTSIZE_LEVEL 32 #define TEXTSIZE_LIFE 36 #define TEXTSIZE_BOMB 36 #define TEXTSIZE_POKER 40 #define TEXTSIZE_HURRY 50 #define TEXTSIZE_PAUSED 50 #define TEXTSIZE_GAMEOVER 50 #define TEXTSIZE_HISCORE 16 #define TEXTSIZE_ENDING 16 #define TEXTSIZE_CREDITS 16 // text tuypes #define TT_NORM 0 #define TT_HELP 1 #define TT_HELPSHADOW 2 #define TT_INTROTEXT 3 #define TT_GAMEOVER 4 #define TT_ENDING 5 // intro states #define IS_START 0 #define IS_YUM 1 #define IS_YUMWAIT 2 #define IS_JUMP 3 #define IS_RATS 4 #define IS_RATS2 5 #define IS_FINISH 6 // intro variables #define INTRO_RATSPEED 12 #define INTRO_LEVELNUM 101 #define TEST_LEVELNUM 102 #define GAMEOVERWAIT 3 // # of seconds to wait before going back to title // 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 MULTIDELAY 50 #define HURRYDELAY 50 #define LIFEDELAY 50 #define CLOVERDELAY 50 #define YUMDELAY 80 #define POKERMSGDELAY 80 #define LEVELWINDELAY 80 #define DIEDELAY 80 #define HELPDELAY 80 #define LEVELDELAY 100 #define ENDTEXTTIME 200 #define GAMEOVERDELAY 200 #define POKERDELAY 170 #define ICEDRIPSPEED 0.5 enum ENDGAMETYPE { EG_FRUITFALL = 1, EG_FADEPAUSE, EG_FADETOWHITE, EG_FADETOBLACK, EG_FINAL, }; // 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) // keys #define KEY_RIGHT SDLK_j #define KEY_LEFT SDLK_g #define KEY_UP SDLK_y #define KEY_DOWN SDLK_h #define KEY_SHOOT SDLK_z #define KEY_JUMP SDLK_x #define KEY_SLAM SDLK_c #define KEY2_RIGHT SDLK_RIGHT #define KEY2_LEFT SDLK_LEFT #define KEY2_UP SDLK_UP #define KEY2_DOWN SDLK_DOWN #define KEY2_SHOOT SDLK_m #define KEY2_JUMP SDLK_COMMA #define KEY2_SLAM SDLK_PERIOD // ice effect #define ICE_NONE 0 #define ICE_INPROGRESS 1 #define ICE_COMPLETE 2 #define WATER_NONE 0 #define WATER_INPROGRESS 3 #define WATER_COMPLETE 4 // Game mechanics #define INVULNTIME 200 // how long player stays invulnerable for #define SLUGINVULNTIME 50 // how long a new slug stays invulnerable for #define FLYINVULNTIME 15 // how long a new fly from kingfly stays invulnerable #define SHIELDTIME 600 // how long a shield lasts #define FALLSPEED 4 // terminal velocity of falling sprites #define UMBFALLSPEED 1 // terminal velocity of falling sprites with umbrella #define ENDGAMEFALLSPEED 6 // terminal velocity of falling fruit // at end of game #define SMALLNETSPEED 6 // how fast the player's net moves with skull #define NETSPEED 9 // how fast the player's net moves #define BIGNETSPEED 12 // how fast the player's net moves with bignet #define ACCNETSPEED 28 // how fast the player's net moves with accordion #define POWERUPTIME 15 // # secs before a powerup appears #define POWERUPTIME2 10 // # secs before a powerup appears #define DEFAULTSPEED 1 #define PLAYERSLOW 1.2 // how fast player goes initially #define PLAYERFAST 2 // how fast player goes with speed powerup #define PLAYERPILL 4 // how fast player goes with pill powerup #define BUBBLETIME 200 // how oftem bubbles appear #define FLOODSPEED 4 // how fast flood effect acts #define LUCKYFLASH 10 // how fast score flashes during lucky mode #define MASKOFFSETX 8 #define MASKOFFSETY -12 #define MASKOFFSETSLAMX 1 #define MASKOFFSETSLAMY -17 #define POKERWAITTIME 150 // how long to display poker msg #define CANNONSIZE 10 #define ICESPEED 2 // how fast a level turns to ice #define MONJUMPSPEED 5 // how high monsters jump #define FROGJUMPSPEED1 3 // how high frogs jump #define FROGJUMPSPEED2 6 // how high frogs jump #define FROGPAUSE 20 // how long frog waits in between jumps #define BOMBSHAKETIME 100 // time for screen will shake after a bomb #define RATSHAKETIME 50 // shake time when king rat is stunned #define SNAILSHAKETIME 35 // shake time when king snail jumps #define BOSSFLASHTIME 15 // how long bosses flash white for when hit #define BOSSDIETIME 150 // how long bosses flash when dead #define BELLTIME 20 // how long the bell flash lasts #define CLOCKTIME 10 // how many seconds a clock lasts #define RAYGUNSPEED 9 // how fast ray gun bullet travels // ice #define ICEACCEL 0.1 #define ICEDECCEL 0.03 #define STICKYACCEL 0.02 // blackcloud #define CLOUDGROWSPEED 25 // lower is faster #define CLOUDGROWAMT 0.01 // lower is faster // king rat #define KR_WALKTIME 100 #define KR_STUNTIME 150 #define KR_MAXJUMP 15 // max initial jumpspeed #define KR_NUMJUMPS 5 #define KR_CHARGESPEED 8 // king rat states #define KRS_WALK 0 #define KRS_JUMP 1 #define KRS_WAITFORTOP 2 #define KRS_FALL 3 #define KRS_CHARGEWAIT 4 #define KRS_CHARGE 5 #define KRS_STUN 6 // king snail #define KS_WALKTIME 300 #define KS_SHOOTWAIT 80 // how long to pause between shooting #define KS_JUMPWAIT 30 // how long to pause before jumping #define KS_RELOADWAIT 100 // how long to pause after jumping // king snail states #define KSS_WALK1 0 // walk back & forth #define KSS_PAUSE1 1 // smoke comes out of shell #define KSS_SHOOT 2 // shell cracks, shoot out snails #define KSS_REGEN 3 // shell coming back #define KSS_WALK2 4 // walks again #define KSS_PAUSE2 5 // delay before jumping #define KSS_JUMPING 6 // jumping, snails turn to slugs #define KSS_PAUSE3 7 // pause after jumping // king fly #define KF_FLYTIME 300 #define KF_HOVERTIME 75 // king fly states #define KFS_FLY1 0 #define KFS_HORZWAIT 1 #define KFS_HORZPUSH 2 #define KFS_HORZ 3 #define KFS_FLY2 5 #define KFS_VERTWAIT 6 #define KFS_VERTPUSH 7 #define KFS_VERT 8 // king ant #define KA_WALKTIME 400 #define KA_SHOOTTIME 50 // king ant stats #define KAS_WALK1 0 #define KAS_JUMP1 1 #define KAS_WAITFORTOP1 2 #define KAS_WAITFORTOP2 3 #define KAS_FALL1 4 #define KAS_FALL2 5 #define KAS_WALK2 6 #define KAS_JUMP2 7 // king cat #define KC_WALKTIME 100 #define KC_SPELLPAUSETIME 100 #define KC_SPELLCASTTIME 102 #define KC_TELETIME 75 #define KC_BRICKTIME 10 // king cat states #define KCS_WALK 0 #define KCS_SPELLPAUSE 1 #define KCS_SPELLCAST 2 #define KCS_STUN 3 // king cat spells enum SPELL { SPL_NONE = -1, SPL_TELEPORT = 0, SPL_SUMMON, SPL_FIREBALLS, SPL_WIND, SPL_BRICKS, SPL_LAST, }; #define MAXSPELLS 5 // moth #define BAT_PAUSE 20 #define BAT_FIRESPACE 3 // space between shots // moth states #define BS_FLY 0 #define BS_PAUSE1 1 #define BS_PAUSE2 2 // bell states #define BELL_DONESOUND 1 #define BELL_DONEFLASH 2 #define MACEEXPX 2 // X size of mace explosion #define MACEEXPY 2 // Y size of mace explosion // Limits #define MAXLEVELS 103 #define MAXMAPPINGS 50 #define MAXMONSTERSPERLEVEL 150 #define MAXLETTERHEIGHT 100 #define MAXFRAMES 18 // max number of frames for sprites #define MAXHELP 5 #define MAXTILEFRAMES 100 // max number of frames for animated tiles #define MAXCARDS 5 // how many cards a player can have #define MAXJOYBUTTONS 20 #define JOYTHRESH_ANA 30000 // how far you have to move the analogue stick #define JOYTHRESH_DIG 6000 // how far you have to move the analogue stick #define MAXHISCORES 10 #define MAXHISCORENAME 12 #define MAXWAYPOINTS 30 #define HISCORE_DISPLAYTIME 10 // how many secs to display hiscores for // Fixed text buffer sizes #define BUFLEN 512 #define MIDBUFLEN 64 #define SMALLBUFLEN 32 // Boolean values #define B_TRUE -1 #define B_FALSE 0 #define B_PUFF (B_TRUE) #define B_NOPUFF (B_FALSE) #define ALL -1 #define FOREVER -23 // reasons for not being able to move #define NM_SIDE -1 #define NM_BELOW -2 // fruit types #define FT_FRUIT 1 #define FT_PERM 2 #define FT_TEMP 3 #define FT_GEM 4 #define FT_CARD 5 #define FT_SUPER 6 #define FT_OTHER 10 // monster types #define MT_MONSTER 1 #define MT_BOSS 2 // Other #define WANTFPS 60 // try to run at this many frames per sec /* enums */ /* sounds */ #define MAXFX 65 #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_COIN 18 #define FX_GAMEOVER 19 #define FX_OW 20 #define FX_BELL 21 #define FX_CLOCK 22 #define FX_ARMOR 23 #define FX_FREEZE 24 #define FX_ICEBREAK 25 #define FX_BOSSWINDUP 26 #define FX_BOSSCHARGE 27 #define FX_BOSSDIE 28 #define FX_BOSSHIT 29 #define FX_BOSSWALL 30 #define FX_SPRAY 31 #define FX_CANNON 32 #define FX_CRACK 33 #define FX_PHONE 34 #define FX_STAR 35 #define FX_STARHIT 36 #define FX_METEOR 37 #define FX_ENGAGED 38 #define FX_FLOOD 39 #define FX_CARD 40 #define FX_POKER 41 #define FX_SKULL 42 #define FX_KEYPRESS 43 #define FX_CATCH 44 #define FX_GUN 45 #define FX_ALARM 46 #define FX_ZAP 47 #define FX_SNAILPREPARE 48 #define FX_WHOOSH 49 #define FX_BOOM2 50 #define FX_WAND 51 #define FX_WHISTLE 52 #define FX_EVILLAUGH 53 #define FX_BIRDS 54 #define FX_EXTRALIFE 55 #define FX_WARP 56 #define FX_JETPACK 57 #define FX_CAMERA 58 #define FX_LASER 59 #define FX_HISS 60 #define FX_CHOMP 61 #define FX_GROWL 62 #define FX_LAMP 63 #define FX_SONAR 64 // card suits #define CS_HEART 1 #define CS_DIAMOND 2 #define CS_SPADE 3 #define CS_CLUB 4 // poker effects #define PE_HIGHCARD 1 #define PE_PAIR 2 #define PE_TWOPAIR 3 #define PE_TRIPLE 4 #define PE_STRAIGHT 5 #define PE_FLUSH 6 #define PE_FULLHOUSE 7 #define PE_FOUR 8 #define PE_STRAIGHTFLUSH 9 #define PE_ROYALFLUSH 10 // Slope types #define S_NOTSOLID 0 #define S_SOLID 1 #define S_SLOPE 2 // Sprite types #define MAXPTYPES 182 #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_BLACKCLOUD 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_TICK 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 #define P_SMASH 33 // explosion from a mace smash #define P_HELMET 34 // helmet powerup #define P_ARMOUR 35 // player wearing armour #define P_GEMBOOST 36 #define P_TROPHY 37 #define P_RINGSILVER 38 #define P_RINGGOLD 39 #define P_SPARKLE 40 #define P_BELL 41 #define P_CLOCK 42 #define P_SNOWMAN 43 #define P_PINKCLOUD 44 #define P_KINGRAT 45 #define P_SPRAY 46 #define P_CANNONPOWERUP 47 #define P_CANNON 48 #define P_SNAIL 49 #define P_SLUG 50 #define P_BUBBLE 51 #define P_PHONE 52 #define P_HONEY 53 #define P_LIFE 54 #define P_STARPOWERUP 55 #define P_STAR 56 #define P_UFO 57 #define P_METEOR 58 #define P_BIGSPEED 59 #define P_FISH 60 #define P_TAP 61 #define P_MASK 62 #define P_MASKPOWERUP 63 #define P_FIRSTCARD 64 // IMPORTANT! #define P_FIRSTHEART 64 // IMPORTANT! #define P_CARDH1 64 #define P_CARDH2 65 #define P_CARDH3 66 #define P_CARDH4 67 #define P_CARDH5 68 #define P_CARDH6 69 #define P_CARDH7 70 #define P_CARDH8 71 #define P_CARDH9 72 #define P_CARDH10 73 #define P_CARDHJ 74 #define P_CARDHQ 75 #define P_CARDHK 76 #define P_FIRSTDIAMOND 77 // IMPORTANT! #define P_CARDD1 77 #define P_CARDD2 78 #define P_CARDD3 79 #define P_CARDD4 80 #define P_CARDD5 81 #define P_CARDD6 82 #define P_CARDD7 83 #define P_CARDD8 84 #define P_CARDD9 85 #define P_CARDD10 86 #define P_CARDDJ 87 #define P_CARDDQ 88 #define P_CARDDK 89 #define P_FIRSTSPADE 90 // IMPORTANT! #define P_CARDS1 90 #define P_CARDS2 91 #define P_CARDS3 92 #define P_CARDS4 93 #define P_CARDS5 94 #define P_CARDS6 95 #define P_CARDS7 96 #define P_CARDS8 97 #define P_CARDS9 98 #define P_CARDS10 99 #define P_CARDSJ 100 #define P_CARDSQ 101 #define P_CARDSK 102 #define P_FIRSTCLUB 103 // IMPORTANT! #define P_CARDC1 103 #define P_CARDC2 104 #define P_CARDC3 105 #define P_CARDC4 106 #define P_CARDC5 107 #define P_CARDC6 108 #define P_CARDC7 109 #define P_CARDC8 110 #define P_CARDC9 111 #define P_CARDC10 112 #define P_CARDCJ 113 #define P_CARDCQ 114 #define P_CARDCK 115 #define P_MOVINGCARD 116 #define P_FIVECARDS 117 #define P_CLOVER 118 #define P_ACCORDION 119 #define P_UMBRELLA 120 #define P_SKULL 121 #define P_WINGLEFT 122 #define P_WINGRIGHT 123 #define P_PLANT 124 #define P_GUN 125 #define P_ZAPPOWERUP 126 #define P_ZAPPER 127 #define P_KINGSNAIL 128 #define P_KSSHELL 129 #define P_BIGSCUBA 130 #define P_RANDOM 131 #define P_PLATFORM 132 #define P_FLY 133 #define P_PLAYER2 134 #define P_ARMOUR2 135 // player 2 wearing armour #define P_GNOME 136 #define P_WAND 137 #define P_WHISTLE 138 #define P_CANDLE 139 #define P_PIZZA 140 #define P_SUNDAE 141 #define P_CAKE 142 #define P_CHOCOLATE 143 #define P_ANCHOR 144 #define P_SMALLANCHOR 145 #define P_MAGNET 146 #define P_BADMAGNET 147 #define P_JETPACK 148 #define P_CAMERA 149 #define P_WINGBOOTS 150 #define P_BIGUMBRELLA 151 #define P_KINGFLY 152 #define P_SUPERUMBRELLA 153 #define P_PILL 154 #define P_RAYGUN 155 #define P_RAYGUNBULLET 156 #define P_FROG 157 #define P_ANT1 158 #define P_ANT2 159 #define P_ANT3 160 #define P_FIREBALL 161 #define P_TOPHAT 162 #define P_KINGANT 163 #define P_FLAME 164 // like mace smash but harmless #define P_BIGFIREBALL 165 #define P_EGG 166 #define P_BIGHELMET 167 #define P_GOLDCOIN 168 #define P_LAMP 169 #define P_GOLDBAR 170 #define P_WSPIDER 171 #define P_BAT 172 #define P_SONAR 173 #define P_KINGCAT 174 #define P_LEAF 175 #define P_FALLINGBRICK 176 #define P_BIGCHEST 177 #define P_FIREUP 178 #define P_NET 179 #define P_UPSTAR 180 #define P_DRIP 181 #define FLY_FLYTIME 150 #define FLY_WALKTIME 300 #define F_WALK 0 #define F_FLYHORZ 1 #define F_FLYVERT 2 #define PLATFORMPAUSE 30 #define PLATFORMDELAY 4 #define PLATFORM_ACCEL 0.5 // how fast platforms accelerate/decellerate #define PLATFORM_MINSPEED 0.3 #define PLATFORM_MAXSPEED 3 // cards #define CARDFONTX 4 #define CARDFONTY 6 #define CARDFONTSIZE 10 // score display #define P1SCOREX 20 #define P1LIVESX 20 #define SCOREY 7 #define LIVESY 25 // card display (in top left of main screen) #define CARDX 20 #define CARDY 55 // how fast cards move towards the corner #define CARDSPEED 8 #define FIVECARDSPEED 8 // how many cards in a deck #define DECKSIZE 52 #define SHUFFLEQUALITY 100 // powerups #define PW_NONE 0 #define PW_BOXING 1 // boxing glove #define PW_BOMB 2 // bomb #define PW_MACE 3 // mace #define PW_RINGWALK 4 // points for walking #define PW_RINGJUMP 5 // points for jumping #define PW_CLOCK 6 // freeze time #define PW_SPRAYUP 7 // fly spray #define PW_SPRAYDOWN 8 // fly spray #define PW_CANNON 9 // fusion cannon #define PW_CANNONFIRE 10 // fusion cannon firing #define PW_PHONE 11 // skip level #define PW_ACCORDION 12 // super long net #define PW_GUNNER 13 // machine gunner #define PW_WHISTLE 14 // whistle #define PW_CANDLE 15 // candle #define PW_ANCHOR 16 // anchor #define PW_MAGNET 17 // magnet #define PW_BADMAGNET 18 // badmagnet #define PW_JETPACK 19 // kangaroo #define PW_CAMERA 20 // camera #define PW_SMALLNET 21 // skull #define PW_PILL 22 // pill #define PW_RAYGUN 23 // ray gun #define PW_TOPHAT 24 // top hat #define PW_LAMP 25 // magic lamp // "virtual" powerup for bosses #define PW_RATSHAKE 50 // shake screen horizontally #define PW_SNAILSHAKE 51 // shake screen vertically #define PW_CATWIND 52 // blow players left/right #define PW_CATBRICKS 53 // falling bricks from top // end of game #define PW_ENDGAME 54 #define MINUPSTARS 50 #define GUNNERSPEED 2.5 // speed crosshair moves in gunner mode #define GUNNERDELAY 10 // how fast gunner powerup shoots #define ZAPPERDELAY 10 // animation speed for zapper #define ZAPPERTIME 15 // how long the zap lasts // 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 #define F_SWIM1 16 #define F_SWIM2 17 // Title screen states #define TS_INSERTCOIN 0 #define TS_WAIT1UP 1 #define TS_SELECTMODE 2 #define TS_HISCORES 3 #define TS_CREDITS 4 #define TTIME 5 // time between state switches in title screen #define INITPLAYERLIVES 3 // Game modes #define GM_EASY 0 #define GM_NORM 1 // 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_CLOUD 4 // cloud appearing and tracking player #define LV_CLOUDLOOP 6 // cloud looping #define LV_NEXTLEV 7 // cloud done , nextlevel() in 5 seconds #define LV_GAMEOVER 8 // No lives left. #define LV_DOPOKER 9 // Got a full set of cards! #define LV_HELPFREEZE 10 // Freeze after help text // movement types #define MV_NONE 0 // didn't move #define MV_WALK 1 // walked/climbed on purpose #define MV_ICE 3 // slid on ice #define MV_FLY 4 // flying #define MV_CONVEY 5 // moved by conveyorbelt #define MV_SWIM 64 // swum somewhere - OR this // 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 #define T_ICETOP 20 // slippery #define T_ICE 21 // slippery #define T_WATERRIGHT 22 #define T_WATERLEFT 23 #define T_WATERDOWN 24 #define T_WARP 25 // hidden warp point - jump to reveal #define T_ICEBRIDGE 26 // like land but you can drop down through it #define T_ICEBRIDGETH 27 // thicker version of ice bridge which doesn't melt #define T_ANIMSPIKE 28 // 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 /// pink cloud #define PCGROWSPEED (0.02) // how much to grow each turn (0.1 - 0.999) #define PCSHRINKSPEED (0.06) // how much to shrink each turn (0.1 - 0.999) #define PCTURN (5) // turn speed while looping // 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) #define D_NONE (0) // boss health bar #define HEALTHBARY 480-100 // y position of health bar #define HEALTHBARGAP 2 // gap between health bars // frames of the bar #define HEALTHFRAMES 3 #define HF_GREEN 0 #define HF_YELLOW 1 #define HF_RED 2 // white spider timers #define WS_DROPDELAY 40 // how long whitetail pauses before dropping /* 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; int sticky; int stopnet; int slippery; int walkvanish; // -1 means 'don't vanish' SDL_Surface *img[MAXTILEFRAMES]; int killframe[MAXTILEFRAMES]; int spikeframe[MAXTILEFRAMES]; int numframes; int animspeed; int animsync; struct tiletype_s *next; struct tiletype_s *prev; } tiletype_t; tiletype_t *tiletype; typedef struct initialmonster_s { int startx; int starty; int id; int wayx[MAXWAYPOINTS]; int wayy[MAXWAYPOINTS]; int numwaypoints; char *help; } initialmonster_t; typedef struct text_s { int x,y; int size; int maxsize; int state; int type; 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 bgfile[BUFLEN]; char name[BUFLEN]; char filename[BUFLEN]; int map[LEVELW*LEVELH]; int map2[LEVELW*LEVELH]; // second map layer int map3[LEVELW*LEVELH]; // third map layer int tileframe[LEVELW*LEVELH]; // tracks frame numbers for tiles int tilewalkvanish[LEVELW*LEVELH]; // tracks how long before tiles disappear int *animtiles; // array of offsets to map positions which are animated int *l3tiles; // array of layer 3 tiles struct level_s *next; struct level_s *prev; int bottomopen; // can you fall through the bottom of the level? int p1x; /* player 1 start pos */ int p1y; int p2x; /* player 2 start pos */ int p2y; int powerupx; /* powerup position */ int powerupy; /* powerup position */ int gotpowerup; /* has the random powerup appeared yet? */ int poweruptype;/* what kind of powerup will appear? */ int exitdir; /* which way to scroll on level completion */ int nummonsters; initialmonster_t initm[MAXMONSTERSPERLEVEL]; int hurryuptime; int poweruptime; int icey,iced; // for ice powerups } level_t; level_t *level; typedef struct levelentry_s { int id; char filename[MIDBUFLEN]; char desc[MIDBUFLEN]; } levelentry_t; typedef struct hiscore_s { char name[MIDBUFLEN]; int level; long score; } hiscore_t; typedef struct spriteinfo_s { char *name; char *desc; char *file; } spriteinfo_t; typedef struct sprite_s { int id; // what kind of sprite? (eg. player, cheese, rat) long score; // player's score, for monsters how much they are worth // ATTRIBUTES double speed; // how fast this sprite moves // CURRENT STATE // player only int recoiling; // this happens after you get hit while wearing armour 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 lostlife; // lost any lives? 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 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 when netting/slamming int netsticky; // can net pick up powerups? int powerup; // what temp powerup does the player have? int umbrellaup; // umbrella being held up? int oncloud; // on cloud at end of level? int permspeed; // got the permenant speed powerup? int permnumnets; // got the permenant numnets powerup? int permbignet; // got the permenant bignets powerup? int permsticky; // got the permenant sticky net powerup? int permdoublejump;// got the permenant dbljump powerup? int permarmour;// got the permenant armour powerup? int permumbrella;// got the permenant umbrella powerup? int permmask; // got the permenant scuba mask powerup? int ontramp; // on a trampoline? int trampx; // x,y coords for trampoline we are/were on int trampy; // int tramplayer; // which layer was the trampoline on? 1 or 2. // player permenant powerups int armour; // does the player have armour? int umbrella; // does the player have umbrella? int gemboost; // how many extra gems do you get in a bonus int netbig; // have we collected a BIG NET powerup? int hasbell; // got a bell ? int hasmask; // got scuba mask? int doublejump; // have we collected a doublejump powerup? int useddoublejump; int doublejumpready; // player cards int numcards; int card[MAXCARDS]; int usedcard[MAXCARDS]; // for moving platforms double wayx[MAXWAYPOINTS]; double wayy[MAXWAYPOINTS]; int numwaypoints; int curwaypoint; // monster only int iced; // turned to ice? SDL_Surface *iceimg; // Image to blit for ice int willbecome; // what fruit this will become when dead int angry; // is this sprite in ANGRY mode for its AI? // normally this is a bool, but for monsters we // it for flashing them when they are hit. in this // case it will be a number. struct sprite_s *caughtby; // who has us in their net? NULL if nobody struct sprite_s *zapping; // who we are zapping 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 willjumpspeed; // how fast we'll jump when jumptimer expires 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 // pinkcloud only double rotated; double angle; // pink/black cloud only double size; // both player and monster struct sprite_s *onplatform;// are we on platform? int antigrav; // don't fall int lives; // only for player and bosses 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 double fallspeed; // how fast are we falling? int jumping; // are we jumping? double 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; // int timer4; // int timer5; // int newx,newy; // for bosses int watertimer; // double dbltimer; int frame; // 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 int allocimg; // have we allocated a special image? int caughtdelay; // LINKED LIST STUFF struct sprite_s *next; struct sprite_s *prev; } sprite_t; typedef struct regrow_s { int tx; int ty; int origid; int timer; } regrow_t; typedef struct imageset_s { SDL_Surface *img[MAXFRAMES*4]; int numimages; } imageset_t; imageset_t imageset[MAXPTYPES]; typedef struct levscrollinfo_s { int dstx[2],dsty[2],xdis[2],ydis[2]; double pspeed[2]; sprite_t *player, *player2; sprite_t *cloud, *cloud2; } levscrollinfo_t; /* external globals */ extern char progname[]; extern SDL_Color black; extern SDL_Surface *screen, *temps, *levelbg, *head, *head5, *icecube; extern SDL_Surface *head2,*head52; extern SDL_Surface *grave; extern SDL_Surface *healthbar[]; extern SDL_Surface *greenbox, *redbox; extern sprite_t *sprite, *lastsprite, *player, *player2, *boss; extern level_t *curlevel; extern tiletype_t fakeblock; extern int gtime; extern int timer; extern int gamemode; extern int showhelp; extern SDL_Color red; extern SDL_Color black; extern SDL_Color blue; extern SDL_Color white; extern SDL_Color green; extern SDL_Color purple; extern SDL_Color yellow; extern int vidargs; extern int toggletimer; extern TTF_Font *font[]; extern TTF_Font *cardfont; extern int musicplaying; extern Mix_Music *music, *normalmusic[], *fastmusic[], *bossmusic,*hiscoremusic; 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 int maxlevid; extern char *deathtext[]; extern char *bifftext[]; extern spriteinfo_t spriteinfo[]; extern int want1up,want2up,swapplayers; extern int gotcard; extern int curcard; extern int deck[]; extern int forcegoodcard; extern int nextforcegoodcard; extern int forcegold; extern int globpowerup; extern int globtimer; extern int endgame; extern int curlevelnum; extern char *datadir; // pointer to drawpixel function extern void (*drawpixel)(SDL_Surface *s, int x, int y, SDL_Color c); #endif