#ifndef _GAME_H #define _GAME_H #include "ships.h" /** * Ship Info Descriptor - High Level Description of Ships, including the type, * position, velocity, life and other flags. */ typedef struct { char type; // Ship Type. char xpix, ypix, theta; // current x, y and rotational positions. char xfrac, yfrac; // current fractional x and y position signed int vx, vy; // current x and y velocities. char accel; // current acceleration ON or OFF (1 or 0) signed int life; // remaining life of ship. unsigned int fireDelay1; // delay left to fire weapon 1 unsigned int fireDelay2; // delay for fire weap 2 char theta; // direction char W1type; //weapon 1 type (preloaded for easy access) char W2type; //weapon 2 type char _flags; // Miscellaneous flags. char boostcount; //booster counter //bullet stuff char activebullets; //number of active bullets; needs to be less than maxbullets char BulletType[MAX_BULLETS]; char BulletPosX[MAX_BULLETS]; char BulletPosY[MAX_BULLETS]; char BulletXFrac[MAX_BULLETS]; char BulletYFrac[MAX_BULLETS]; char BulletDirection[MAX_BULLETS]; char BulletActive[MAX_BULLETS]; char BulletLife[MAX_BULLETS]; char explodeActive[MAX_BULLETS]; char explodeLife[MAX_BULLETS]; char explodeX[MAX_BULLETS]; char explodeY[MAX_BULLETS]; }ShipInfoDesc; /** * Player Info Descriptor - High Level Description of Players, including the * current score, selected ship type, ready bit and various other flags. */ typedef struct { ShipInfoDesc* ship; // Ship Info that the user selected. }PlayerInfoDesc; typedef enum { GM_TITLE, // Title Selection Menu. GM_GAME, // Game Mode GM_GAMEOVER // Handle the Game Over Sequence }GameState; // Method Signatures // Initialize the port and interrupt settings of the game. void initialize(); // Initialize the ships void initializeShips(); // Decode the commands from user 1 (gamepad) void acquireCommandsP1(ShipInfoDesc* ship); // Decode the commands from user 2 (gamepad) void acquireCommandsP2(ShipInfoDesc* ship); //update bullet positions and life void deactBullets(ShipInfoDesc* ship); // Renders Ships void renderShip(); // Draws Bullets for given ship void drawBullets(ShipInfoDesc* ship, char player); // Draw Explosions onto screen for given ship. void drawExplosions(ShipInfoDesc* ship); // Returns the square of the distance between two given points unsigned int distanceSQ(char x1, char y1, char x2, char y2); // Triggers zoom mode, if appropriate void checkZoom (ShipInfoDesc* ship1, ShipInfoDesc* ship2); // Collision Detection. void hitOpponent(ShipInfoDesc* shipmain, ShipInfoDesc* shiptarg); #endif