2008-09-17 12:34:39 +10:00
|
|
|
#ifndef __DEFS_H
|
|
|
|
#define __DEFS_H
|
|
|
|
|
2008-09-26 19:51:17 +10:00
|
|
|
#include <SDL_mixer.h>
|
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
/* Macros */
|
2008-10-01 22:42:59 +10:00
|
|
|
//#define OPENGL
|
2008-09-17 12:34:39 +10:00
|
|
|
|
2008-09-28 15:02:30 +10:00
|
|
|
// sound channel numbers
|
2008-09-27 16:02:42 +10:00
|
|
|
#define CH_LASTCHANNEL 21
|
|
|
|
#define CH_HURRYUP 20
|
|
|
|
|
|
|
|
|
2008-10-01 17:27:44 +10:00
|
|
|
#define MAXDEATHTEXT 4
|
|
|
|
#define MAXBIFFTEXT 4
|
|
|
|
|
2008-09-28 15:02:30 +10:00
|
|
|
|
|
|
|
|
2008-09-27 16:02:42 +10:00
|
|
|
// size of flower straem when getting last flower
|
|
|
|
// (number of gems on each side)
|
2008-09-30 17:42:09 +10:00
|
|
|
#define STREAMWID 5
|
2008-09-27 16:02:42 +10:00
|
|
|
|
|
|
|
|
|
|
|
// 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
|
2008-09-17 12:34:39 +10:00
|
|
|
|
2008-10-03 17:37:05 +10:00
|
|
|
// sparkles
|
|
|
|
#define SPARKLEFRAMES 7
|
|
|
|
//#define SPARKLESPEED 3 // how fast it animates (smaller = faster)
|
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
// text sizes
|
|
|
|
#define TEXTSIZE_POINTS 10
|
2008-10-01 22:42:59 +10:00
|
|
|
#define TEXTSIZE_SCORE 14
|
2008-09-27 16:02:42 +10:00
|
|
|
#define TEXTSIZE_BONUS 20
|
2008-10-01 22:42:59 +10:00
|
|
|
#define TEXTSIZE_HELP 20
|
|
|
|
#define TEXTSIZE_DEATH 20
|
|
|
|
#define TEXTSIZE_LEVEL2 22
|
2008-10-01 17:27:44 +10:00
|
|
|
#define TEXTSIZE_BIFF 26
|
|
|
|
#define TEXTSIZE_LEVEL 32
|
2008-10-01 22:42:59 +10:00
|
|
|
#define TEXTSIZE_LIFE 36
|
|
|
|
#define TEXTSIZE_BOMB 36
|
|
|
|
#define TEXTSIZE_HURRY 50
|
2008-10-03 17:37:05 +10:00
|
|
|
#define TEXTSIZE_PAUSED 50
|
2008-10-01 22:42:59 +10:00
|
|
|
#define TEXTSIZE_GAMEOVER 50
|
2008-09-17 12:34:39 +10:00
|
|
|
|
|
|
|
// text delays
|
|
|
|
#define TEXTSPEED 2 // how fast text zooms in
|
|
|
|
|
|
|
|
// how long to keep various text on the screen
|
|
|
|
#define POINTSDELAY 40
|
2008-09-27 16:02:42 +10:00
|
|
|
#define BONUSDELAY 50
|
2008-09-17 12:34:39 +10:00
|
|
|
#define HURRYDELAY 50
|
2008-10-01 22:42:59 +10:00
|
|
|
#define LIFEDELAY 50
|
2008-10-01 17:27:44 +10:00
|
|
|
#define LEVELWINDELAY 80
|
|
|
|
#define DIEDELAY 80
|
2008-09-17 12:34:39 +10:00
|
|
|
#define HELPDELAY 80
|
2008-10-01 22:42:59 +10:00
|
|
|
#define LEVELDELAY 100
|
|
|
|
#define GAMEOVERDELAY 200
|
2008-09-17 12:34:39 +10:00
|
|
|
|
|
|
|
|
2008-09-28 15:02:30 +10:00
|
|
|
|
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
// 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)
|
|
|
|
|
|
|
|
|
2008-10-03 21:11:07 +10:00
|
|
|
// ice effect
|
|
|
|
#define ICE_NONE 0
|
|
|
|
#define ICE_INPROGRESS 1
|
|
|
|
#define ICE_COMPLETE 2
|
2008-09-17 12:34:39 +10:00
|
|
|
|
|
|
|
|
|
|
|
// Game mechanics
|
|
|
|
#define INVULNTIME 200 // how long player stays invulnerable for
|
2008-10-09 14:32:15 +11:00
|
|
|
#define SLUGINVULNTIME 50 // how long a new slug stays invulnerable for
|
2008-09-28 15:19:23 +10:00
|
|
|
#define SHIELDTIME 500 // how long a shield lasts
|
2008-09-17 12:34:39 +10:00
|
|
|
#define FALLSPEED 4 // terminal velocity of falling sprites
|
|
|
|
#define NETSPEED 9 // how fast the player's net moves
|
2008-09-28 15:19:23 +10:00
|
|
|
#define POWERUPTIME 15 // # secs before a powerup appears
|
2008-09-17 12:34:39 +10:00
|
|
|
|
2008-10-07 18:58:36 +11:00
|
|
|
#define PLAYERFAST 2 // how fast player goes with speed powerup
|
|
|
|
|
2008-10-09 14:32:15 +11:00
|
|
|
#define BUBBLETIME 200 // how oftem bubbles appear
|
|
|
|
|
2008-10-07 16:53:06 +11:00
|
|
|
|
|
|
|
#define CANNONSIZE 10
|
|
|
|
|
2008-10-03 21:11:07 +10:00
|
|
|
#define ICESPEED 2 // how fast a level turns to ice
|
|
|
|
|
2008-10-07 16:53:06 +11:00
|
|
|
#define MONJUMPSPEED 5 // how high monsters jump
|
|
|
|
|
|
|
|
#define BOMBSHAKETIME 100 // time for screen will shake after a bomb
|
|
|
|
#define RATSHAKETIME 50 // shake time when king rat is stunned
|
|
|
|
|
|
|
|
#define BOSSFLASHTIME 15 // how long bosses flash white for when hit
|
|
|
|
#define BOSSDIETIME 150 // how long bosses flash when dead
|
|
|
|
|
2008-10-03 21:11:07 +10:00
|
|
|
|
2008-10-03 17:37:05 +10:00
|
|
|
#define BELLTIME 20 // how long the bell flash lasts
|
|
|
|
#define CLOCKTIME 10 // how many seconds a clock lasts
|
|
|
|
|
|
|
|
|
2008-10-07 16:53:06 +11:00
|
|
|
// king rat
|
|
|
|
#define KR_WALKTIME 100
|
|
|
|
#define KR_STUNTIME 150
|
|
|
|
//#define KR_WALKTIME 30
|
|
|
|
#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
|
|
|
|
|
|
|
|
|
2008-10-03 17:37:05 +10:00
|
|
|
// bell states
|
|
|
|
#define BELL_DONESOUND 1
|
|
|
|
#define BELL_DONEFLASH 2
|
|
|
|
|
|
|
|
#define MACEEXPX 2 // X size of mace explosion
|
2008-09-30 17:42:09 +10:00
|
|
|
#define MACEEXPY 2 // Y size of mace explosion
|
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
|
|
|
|
// Limits
|
2008-09-30 17:42:09 +10:00
|
|
|
#define MAXLEVELS 100
|
2008-09-17 12:34:39 +10:00
|
|
|
#define MAXMAPPINGS 50
|
2008-10-09 14:32:15 +11:00
|
|
|
#define MAXMONSTERSPERLEVEL 60
|
2008-09-17 12:34:39 +10:00
|
|
|
#define MAXLETTERHEIGHT 100
|
2008-10-03 17:37:05 +10:00
|
|
|
#define MAXFRAMES 18 // max number of frames for sprites
|
2008-09-17 12:34:39 +10:00
|
|
|
#define MAXHELP 5
|
2008-09-26 19:51:17 +10:00
|
|
|
#define MAXTILEFRAMES 10 // max number of frames for animated tiles
|
2008-09-17 12:34:39 +10:00
|
|
|
|
|
|
|
// Fixed text buffer sizes
|
|
|
|
#define BUFLEN 512
|
|
|
|
#define MIDBUFLEN 64
|
|
|
|
#define SMALLBUFLEN 32
|
|
|
|
|
|
|
|
|
|
|
|
// Boolean values
|
|
|
|
#define B_TRUE -1
|
|
|
|
#define B_FALSE 0
|
|
|
|
|
2008-10-07 20:18:42 +11:00
|
|
|
// fruit types
|
|
|
|
#define FT_FRUIT 1
|
|
|
|
#define FT_PERM 2
|
|
|
|
#define FT_TEMP 3
|
|
|
|
#define FT_OTHER 4
|
|
|
|
|
|
|
|
// monster types
|
|
|
|
#define MT_MONSTER 1
|
|
|
|
#define MT_BOSS 2
|
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
// Other
|
2008-10-01 22:42:59 +10:00
|
|
|
#define WANTFPS 60 // try to run at this many frames per sec
|
2008-09-17 12:34:39 +10:00
|
|
|
|
|
|
|
|
|
|
|
/* enums */
|
|
|
|
|
2008-09-26 19:51:17 +10:00
|
|
|
/* sounds */
|
2008-10-09 14:32:15 +11:00
|
|
|
#define MAXFX 34
|
2008-09-26 19:51:17 +10:00
|
|
|
#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
|
2008-09-27 16:02:42 +10:00
|
|
|
#define FX_HURRYUP 9
|
|
|
|
#define FX_TOOSLOW 10
|
|
|
|
#define FX_BONUS 11
|
2008-09-28 14:09:12 +10:00
|
|
|
#define FX_MORPH 12
|
2008-09-28 14:42:09 +10:00
|
|
|
#define FX_BOOM 13
|
2008-09-29 18:32:56 +10:00
|
|
|
#define FX_SPRING 14
|
2008-09-30 17:42:09 +10:00
|
|
|
#define FX_TELEPORT 15
|
|
|
|
#define FX_SPLASH 16
|
|
|
|
#define FX_MACE 17
|
2008-10-01 22:42:59 +10:00
|
|
|
#define FX_LIFE 18
|
|
|
|
#define FX_GAMEOVER 19
|
2008-10-03 17:37:05 +10:00
|
|
|
#define FX_OW 20
|
|
|
|
#define FX_BELL 21
|
|
|
|
#define FX_CLOCK 22
|
|
|
|
#define FX_ARMOR 23
|
2008-10-03 21:11:07 +10:00
|
|
|
#define FX_FREEZE 24
|
|
|
|
#define FX_ICEBREAK 25
|
2008-10-07 16:53:06 +11:00
|
|
|
#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
|
2008-10-09 14:32:15 +11:00
|
|
|
#define FX_CRACK 33
|
2008-09-26 19:51:17 +10:00
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
// Slope types
|
|
|
|
#define S_NOTSOLID 0
|
|
|
|
#define S_SOLID 1
|
|
|
|
#define S_SLOPE 2
|
|
|
|
|
|
|
|
// Sprite types
|
2008-10-09 14:32:15 +11:00
|
|
|
#define MAXPTYPES 52
|
2008-09-17 12:34:39 +10:00
|
|
|
#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
|
2008-10-07 16:53:06 +11:00
|
|
|
#define P_BLACKCLOUD 8
|
2008-09-17 12:34:39 +10:00
|
|
|
#define P_ICECREAM 9
|
|
|
|
#define P_CHIPS 10
|
|
|
|
#define P_BURGER 11
|
|
|
|
#define P_SNAKE 12
|
|
|
|
#define P_SPIT 13
|
|
|
|
#define P_HELP 14
|
2008-09-26 19:51:17 +10:00
|
|
|
#define P_FLOWERYELLOW 15
|
|
|
|
#define P_FLOWERRED 16
|
|
|
|
#define P_FLOWERPURPLE 17
|
2008-10-07 16:53:06 +11:00
|
|
|
#define P_COKE 18
|
2008-09-27 16:02:42 +10:00
|
|
|
#define P_GEMRED 19
|
2008-10-07 16:53:06 +11:00
|
|
|
#define P_PUFF 20
|
2008-09-27 16:02:42 +10:00
|
|
|
#define P_GEMYELLOW 21
|
|
|
|
#define P_GEMPURPLE 22
|
2008-09-28 13:18:36 +10:00
|
|
|
#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
|
2008-09-28 14:09:12 +10:00
|
|
|
#define P_FTODIAMOND 27
|
|
|
|
#define P_FTOGEM 28
|
2008-09-28 14:42:09 +10:00
|
|
|
#define P_BOMB 29
|
2008-09-28 15:19:23 +10:00
|
|
|
#define P_SHIELD 30
|
2008-09-30 17:42:09 +10:00
|
|
|
#define P_MACEPOWERUP 31
|
|
|
|
#define P_MACE 32
|
2008-10-03 17:37:05 +10:00
|
|
|
#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
|
2008-10-03 21:11:07 +10:00
|
|
|
#define P_SNOWMAN 43
|
2008-10-07 16:53:06 +11:00
|
|
|
#define P_PINKCLOUD 44
|
|
|
|
#define P_KINGRAT 45
|
|
|
|
#define P_SPRAY 46
|
|
|
|
#define P_CANNONPOWERUP 47
|
|
|
|
#define P_CANNON 48
|
2008-10-09 14:32:15 +11:00
|
|
|
#define P_SNAIL 49
|
|
|
|
#define P_SLUG 50
|
|
|
|
#define P_BUBBLE 51
|
2008-09-28 13:18:36 +10:00
|
|
|
|
|
|
|
// powerups
|
|
|
|
#define PW_NONE 0
|
|
|
|
#define PW_BOXING 1 // boxing glove
|
2008-09-28 14:42:09 +10:00
|
|
|
#define PW_BOMB 2 // bomb
|
2008-10-03 17:37:05 +10:00
|
|
|
#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
|
2008-10-07 16:53:06 +11:00
|
|
|
#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
|
|
|
|
// "virtual" powerup for bosses
|
|
|
|
#define PW_RATSHAKE 20 // shake screen horizontally
|
2008-09-17 12:34:39 +10:00
|
|
|
|
|
|
|
// 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
|
2008-09-26 19:51:17 +10:00
|
|
|
#define F_SHOOT 10
|
2008-09-27 20:50:19 +10:00
|
|
|
#define F_SLAM1 11
|
|
|
|
#define F_SLAM2 12
|
|
|
|
#define F_SLAM3 13
|
|
|
|
#define F_SLAM4 14
|
|
|
|
#define F_SLAM5 15
|
2008-10-03 17:37:05 +10:00
|
|
|
#define F_SWIM1 16
|
|
|
|
#define F_SWIM2 17
|
2008-09-17 12:34:39 +10:00
|
|
|
|
2008-09-28 13:18:36 +10:00
|
|
|
|
|
|
|
// 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...
|
2008-10-07 18:58:36 +11:00
|
|
|
#define LV_CLOUD 4 // cloud appearing and tracking player
|
2008-10-07 16:53:06 +11:00
|
|
|
#define LV_CLOUDLOOP 6 // cloud looping
|
|
|
|
#define LV_NEXTLEV 7 // cloud done , nextlevel() in 5 seconds
|
|
|
|
#define LV_GAMEOVER 8 // No lives left.
|
2008-10-01 22:42:59 +10:00
|
|
|
|
2008-10-03 21:11:07 +10:00
|
|
|
// movement types
|
|
|
|
#define MV_NONE 0 // didn't move
|
|
|
|
#define MV_WALK 1 // walked/climbed on purpose
|
|
|
|
#define MV_ICE 3 // slid on ice
|
|
|
|
|
2008-09-28 13:18:36 +10:00
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
// 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
|
2008-09-26 19:51:17 +10:00
|
|
|
#define T_BRIDGE 17 // like land but you can drop down through it
|
2008-09-29 18:32:56 +10:00
|
|
|
#define T_TRAMPUP 18
|
|
|
|
#define T_TRAMPDOWN 19
|
2008-10-03 21:11:07 +10:00
|
|
|
#define T_ICETOP 20 // slippery
|
|
|
|
#define T_ICE 21 // slippery
|
2008-09-17 12:34:39 +10:00
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
2008-10-07 16:53:06 +11:00
|
|
|
/// 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
|
|
|
|
|
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
// 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)
|
2008-09-28 13:18:36 +10:00
|
|
|
#define D_UP (-2)
|
|
|
|
#define D_DOWN (2)
|
2008-09-17 12:34:39 +10:00
|
|
|
|
2008-10-07 16:53:06 +11:00
|
|
|
// 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
|
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
|
|
|
|
/* 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;
|
2008-09-17 21:16:19 +10:00
|
|
|
SDL_Surface *img[MAXTILEFRAMES];
|
|
|
|
int numframes;
|
|
|
|
int animspeed;
|
2008-09-17 12:34:39 +10:00
|
|
|
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;
|
2008-10-03 17:37:05 +10:00
|
|
|
char bgfile[MIDBUFLEN];
|
2008-10-07 16:53:06 +11:00
|
|
|
char name[MIDBUFLEN];
|
|
|
|
char filename[MIDBUFLEN];
|
2008-09-17 12:34:39 +10:00
|
|
|
int map[LEVELW*LEVELH];
|
2008-09-29 18:32:56 +10:00
|
|
|
int map2[LEVELW*LEVELH]; // second map layer
|
2008-09-17 21:16:19 +10:00
|
|
|
int tileframe[LEVELW*LEVELH]; // tracks frame numbers for tiles
|
|
|
|
int *animtiles; // array of offsets to map positions which are animated
|
2008-09-17 12:34:39 +10:00
|
|
|
struct level_s *next;
|
|
|
|
struct level_s *prev;
|
|
|
|
int p1x; /* player 1 start pos */
|
|
|
|
int p1y;
|
2008-09-28 13:18:36 +10:00
|
|
|
int powerupx; /* powerup position */
|
|
|
|
int powerupy; /* powerup position */
|
|
|
|
int gotpowerup; /* has the random powerup appeared yet? */
|
2008-10-03 17:37:05 +10:00
|
|
|
int poweruptype;/* what kind of powerup will appear? */
|
2008-09-28 13:18:36 +10:00
|
|
|
int exitdir; /* which way to scroll on level completion */
|
2008-09-17 12:34:39 +10:00
|
|
|
int nummonsters;
|
|
|
|
initialmonster_t initm[MAXMONSTERSPERLEVEL];
|
|
|
|
int hurryuptime;
|
2008-09-28 13:18:36 +10:00
|
|
|
int poweruptime;
|
2008-10-03 21:11:07 +10:00
|
|
|
int icey,iced; // for ice powerups
|
2008-09-17 12:34:39 +10:00
|
|
|
} level_t;
|
|
|
|
level_t *level;
|
|
|
|
|
2008-09-30 17:42:09 +10:00
|
|
|
typedef struct levelentry_s {
|
2008-10-01 17:27:44 +10:00
|
|
|
int id;
|
2008-10-07 16:53:06 +11:00
|
|
|
char filename[MIDBUFLEN];
|
|
|
|
char desc[MIDBUFLEN];
|
2008-09-30 17:42:09 +10:00
|
|
|
} levelentry_t;
|
|
|
|
|
2008-10-07 20:18:42 +11:00
|
|
|
typedef struct spriteinfo_s {
|
|
|
|
char *name;
|
|
|
|
char *desc;
|
|
|
|
char *file;
|
|
|
|
} spriteinfo_t;
|
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
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
|
2008-10-03 17:37:05 +10:00
|
|
|
int recoiling; // this happens after you get hit while wearing armour
|
2008-09-17 12:34:39 +10:00
|
|
|
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 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
|
2008-09-28 13:18:36 +10:00
|
|
|
int powerup; // what temp powerup does the player have?
|
2008-09-17 12:34:39 +10:00
|
|
|
|
2008-09-29 18:32:56 +10:00
|
|
|
int ontramp; // on a trampoline?
|
|
|
|
int trampx; // x,y coords for trampoline we are/were on
|
|
|
|
int trampy; //
|
2008-10-03 17:37:05 +10:00
|
|
|
// player permenant powerups
|
|
|
|
int armour; // does the player have armour?
|
|
|
|
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 ?
|
2008-09-29 18:32:56 +10:00
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
// monster only
|
2008-10-03 21:11:07 +10:00
|
|
|
int iced; // turned to ice?
|
|
|
|
SDL_Surface *iceimg; // Image to blit for ice
|
2008-09-17 12:34:39 +10:00
|
|
|
int willbecome; // what fruit this will become when dead
|
|
|
|
int angry; // is this sprite in ANGRY mode for its AI?
|
2008-10-07 16:53:06 +11:00
|
|
|
// 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.
|
2008-09-17 12:34:39 +10:00
|
|
|
struct sprite_s *caughtby; // who has us in their net? NULL if nobody
|
2008-09-28 13:18:36 +10:00
|
|
|
int quickdie; // die without bouncing?
|
2008-09-17 12:34:39 +10:00
|
|
|
int caughtstate; // are we caught by a net? being pulled in or caught?
|
|
|
|
int jumptimer; // delay before we will jump
|
2008-10-07 16:53:06 +11:00
|
|
|
int willjumpspeed; // how fast we'll jump when jumptimer expires
|
2008-09-17 12:34:39 +10:00
|
|
|
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
|
|
|
|
|
2008-10-07 16:53:06 +11:00
|
|
|
// pinkcloud only
|
|
|
|
double size;
|
|
|
|
double rotated;
|
|
|
|
double angle;
|
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
// player and monster
|
2008-10-07 16:53:06 +11:00
|
|
|
int lives; // only for player and bosses
|
2008-09-30 17:42:09 +10:00
|
|
|
int swimming; // are we in the water?
|
2008-09-17 12:34:39 +10:00
|
|
|
int falling; // are we falling?
|
2008-09-26 19:51:17 +10:00
|
|
|
int dropping; // are we purposely dropping through solid ground?
|
|
|
|
int dropx,dropy;// coords of tile we dropped from
|
2008-09-17 12:34:39 +10:00
|
|
|
int fallspeed; // how fast are we falling?
|
|
|
|
int jumping; // are we jumping?
|
2008-09-17 21:16:19 +10:00
|
|
|
int jumpdir; //which way are we jumping?
|
2008-09-17 12:34:39 +10:00
|
|
|
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?
|
2008-09-27 16:02:42 +10:00
|
|
|
int timer1; //
|
|
|
|
int timer2; //
|
|
|
|
int timer3; //
|
2008-10-09 14:32:15 +11:00
|
|
|
int watertimer; //
|
2008-09-17 12:34:39 +10:00
|
|
|
|
|
|
|
|
|
|
|
// 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;
|
2008-10-03 21:11:07 +10:00
|
|
|
extern SDL_Surface *screen, *temps, *levelbg, *head, *headsmall, *icecube;
|
2008-10-07 16:53:06 +11:00
|
|
|
extern SDL_Surface *healthbar[];
|
|
|
|
extern SDL_Surface *greenbox;
|
|
|
|
extern sprite_t *sprite, *lastsprite, *player, *boss;
|
2008-09-17 12:34:39 +10:00
|
|
|
extern level_t *curlevel;
|
|
|
|
extern tiletype_t fakeblock;
|
|
|
|
extern int gtime;
|
|
|
|
extern int timer;
|
|
|
|
extern SDL_Color red;
|
|
|
|
extern SDL_Color black;
|
2008-09-30 17:42:09 +10:00
|
|
|
extern SDL_Color blue;
|
2008-09-17 12:34:39 +10:00
|
|
|
extern SDL_Color white;
|
|
|
|
extern SDL_Color green;
|
|
|
|
extern SDL_Color yellow;
|
|
|
|
extern int vidargs;
|
|
|
|
extern int toggletimer;
|
|
|
|
extern TTF_Font *font[];
|
2008-09-27 16:02:42 +10:00
|
|
|
extern int musicplaying;
|
2008-10-09 14:32:15 +11:00
|
|
|
extern Mix_Music *music, *normalmusic, *fastmusic, *bossmusic;
|
2008-09-26 19:51:17 +10:00
|
|
|
extern Mix_Chunk *sfx[];
|
2008-09-28 13:18:36 +10:00
|
|
|
extern int oldexitdir;
|
|
|
|
extern int levelcomplete;
|
|
|
|
extern text_t *text, *lasttext;
|
2008-09-28 15:19:23 +10:00
|
|
|
extern int cheat;
|
2008-09-30 17:42:09 +10:00
|
|
|
extern int nexthurryup;
|
|
|
|
extern levelentry_t levelentry[];
|
2008-10-01 17:27:44 +10:00
|
|
|
extern int numlevels;
|
2008-10-07 16:53:06 +11:00
|
|
|
extern int maxlevid;
|
2008-10-01 17:27:44 +10:00
|
|
|
extern char *deathtext[];
|
|
|
|
extern char *bifftext[];
|
2008-10-07 20:18:42 +11:00
|
|
|
extern spriteinfo_t spriteinfo[];
|
2008-09-17 12:34:39 +10:00
|
|
|
|
2008-10-10 07:51:09 +11:00
|
|
|
extern char datadir[];
|
|
|
|
|
2008-09-17 12:34:39 +10:00
|
|
|
#endif
|