/* * CSE 142 Spring 2001 * Homework 4, Part A * * tron.h * * This header file contains symbolic constants and function prototypes for * those constants which are used in multiple files, and those functions which * are used in a file other than the one they're defined in. * */ /****************************************************************************** * Symbolic constants ******************************************************************************/ #define TRUE 1 #define FALSE 0 /* Definitions of directions. Observe the convention that an object * with a negative direction is stopped, facing in the direction you * would get if you removed the minus sign. * For example, if the player's direction is -LEFT, the player is * facing left but not moving. */ #define DOWN_LEFT 1 #define DOWN 2 #define DOWN_RIGHT 3 #define LEFT 4 #define RIGHT 6 #define UP_RIGHT 9 #define UP 8 #define UP_LEFT 7 /* Various object dimensions */ #define PLAYER_WIDTH 20 #define PLAYER_HEIGHT 20 #define PLAYER_DOT_RADIUS 2 #define ENEMY_WIDTH 20 #define ENEMY_HEIGHT 20 #define BULLET_WIDTH 5 #define BULLET_HEIGHT 5 /* Dimensions of the frame around the screen. */ #define BANNER_HEIGHT 25 /* Banner at top of screen */ #define BOUNDARY_WIDTH 5 /* Size of the "wall" around the playing field. */ /* Object status indicators */ #define BULLET_DEAD 0 /* Bullet is not in the air */ #define BULLET_ALIVE 1 /* Bullet is in the air */ #define ENEMY_DEAD 0 #define ENEMY_ALIVE 1 /* Game Status */ #define GAME_FLASH_SCREEN 4 #define GAME_LEVEL_START 0 #define GAME_PLAYING 1 #define GAME_PLAYER_DIED 5 #define GAME_LEVEL_END 2 #define GAME_OVER 3 /****************************************************************************** * Function prototypes. See the function definitions for * descriptions of what they do. ******************************************************************************/ void moveObject(int *x, int *y, int width, int height, int direction, int speed); void movePlayer(int *x, int *y, int playerFacing); void moveEnemy(int *x, int *y, int playerX, int playerY); void moveBullet(int *x, int *y, int *bulletStatus, int bulletFacing); void drawBackground(void); void drawMessage(char message[]); void drawPlayer(int x, int y, int playerFacing); void drawEnemy(int x, int y, int enemyStatus); void drawBullet(int x, int y, int bulletStatus, int bulletFacing); void drawBanner(int level, int numLives, int score); int rectanglesOverlap(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2); int rectangleHitByBullet(int rectX, int rectY, int width, int height, int bulletX1, int bulletY1, int bulletX2, int bulletY2, int bulletFacing); int xComponent(int direction); int yComponent(int direction);