// *********************************************************************************** // Program written by B. Swan - BURROWINGGERBIL@HOTMAIL.COM // *********************************************************************************** // **** include files **************************************************************** #include // include standard Yaroze lib #include // include standard C lib #include "pad.h" // include pad reading lib //#include "scrngrab.h" // **** definitions ****************************************************************** #define BLOCK_ADDRESS (0x80090000) // location of block data in memory #define LEVEL_ADDRESS (0x80090200) // location of level data in memory #define TIM_ADDRESS1 (0x80091970) // location of front blocks in memory #define TIM_ADDRESS2 (0x800a1b90) // back blocks #define TIM_ADDRESS3 (0x800a9db0) // glows #define TIM_ADDRESS4 (0x800b1fd0) // player #define TIM_ADDRESS5 (0x800b5b70) // enemies #define VB_ADDRESS (0x800c5d90) #define VH_ADDRESS (0x80117890) #define SCREEN_WIDTH (320) #define SCREEN_HEIGHT (240) #define NUMBER_OF_ENEMIES (50) // maximum number of enemies at once #define NUMBER_OF_BULLETS (10) // maximum number of bulets per player #define NUMBER_OF_TRIGGERS (1000) // maximum number of triggers #define OTABLE_LENGTH (8) // define length of OTable #define MAX_PACKETS (128000) // guess at length for scratchpad #define HOLDTIME (50) // how long hold fire before charges up #define MAX(a, b) \ (a > b ? a : b) #define MIN(a, b) \ (a > b ? b : a) // **** prototypes ***************************************************************** void Initialise(void); // triggers all initialisation routines void InitialiseScreen(void); // setups screen resolution etc. void UpdateWorld(void); // move, colour etc all sprites void RenderStart(void); // initialise frame variables and screen void RenderWorld(void); // draw the screen scene :) void DrawFront(void); // draw front layer of parallax void DrawBack(void); // draw back layer of parallax void DrawStars(void); // draw stars void DrawInfo(void); // draw information void DrawPlayers(void); // draw both player ships void UpdatePlayers(void); // react to player input void DrawSplash(u_short tPlayer, u_short tX); // draw splash when under waterfall void DrawSplash2(u_short tPlayer, u_short tY); // draw splash when in water void UpdatePlayerBullets(void); // update all player bullets void DrawPlayerBullets(void); // draw all player bullets void CreatePlayerBullet(u_short tPlayer, short tType); // create new bullets if necessary void KillPlayer(u_short tPlayer); // deal with death void PlaySound(u_short tS, u_short tVol, u_short tX); // play sound short PlayBackSound(void); void GetVolume(u_short tVol, u_short tX, short *tLeft, short *tRight); // get stereo value u_short LevelCollision(u_short tPlayer); // check if player has hit the walls void LoadTIMData(u_long tMemAddress); // copies TIM from main memory to vram void SetSpriteInfo(GsSPRITE *tSprite, u_long tMemAddress, long tX, long tY); // setup up a sprite structure with // the correct information void SetBlocksInfo(GsSPRITE *tSprite, RECT *tRect, long tX, long tY, u_char tCol); // Chop blocks up correctly into // sprites from more specific data void AnimateScenery(void); // Alter block frames u_short Hit(short x1, short y1, short w1, short h1, short x2, short y2, short w2, short h2); // Check for collision with two rectangles void NewEnemies(void); // do new enemies as level scrolls void UpdateEnemies(void); // general enemy update handler void CreateNewComet(short tX, short tY, short tSpeed); // create comet void CreateNewVolcano(short tX, short tY); // create volcano void CreateNewRock(short tX, short tY, short tSpeedX, short tSpeedY); // create volcano rock void CreateNewWorm(short tAngle, short tPos, short tTime, short tSAngle); // create worm void CreateNewPowerUp(short tY, short tType); // powerup void CreateSmallExplosion(short tX, short tY); // small explosion u_short UpdateBigExplosion(u_short tEnemyNumber); // update explosion u_short UpdateMediumExplosion(u_short tEnemyNumber); // update explosion u_short UpdateSmallExplosion(u_short tEnemyNumber); // update explosion u_short UpdateComet(u_short tEnemyNumber); // update comet u_short UpdateVolcano(u_short tEnemyNumber); // update volcano u_short UpdateRock(u_short tEnemyNumber); // update volcano rock u_short UpdateWormHead(u_short tEnemyNumber); // update worm parts u_short UpdateWormBody(u_short tEnemyNumber); u_short UpdateWormTail(u_short tEnemyNumber); u_short UpdatePowerUp(u_short tEnemyNumber); // update powerup u_short UpdatePowerUpGlow(u_short tEnemyNumber); // update powerup glow void DeleteEnemy(u_short tEnemy); // remove all references to enemy from array u_short EnemyAgainstPlayer(short tX, short tY, short tW, short tH); // deal with enemy collision with player u_short EnemyAgainstBullets(u_short tEnemy, short tX, short tY, short tW, short tH); // deal with enemy collision with bullets void CreateLevelTriggers(void); // Set up where enemies appear in level