Annotation of talos/src/talos.h, revision 1.1

1.1     ! nick        1: /*
        !             2:  * Froggix 
        !             3:  *
        !             4:  * Nicholas DeClario 2009
        !             5:  * <nick@declario.com>
        !             6:  *
        !             7:  * This program is distributed under the GNU Public License
        !             8:  *   <Insert GNU license blurb here>
        !             9:  */
        !            10: 
        !            11: 
        !            12: /*
        !            13:  * Our pretty standard includes
        !            14:  */
        !            15: #include <stdio.h>
        !            16: #include <stdlib.h>
        !            17: #include <unistd.h>
        !            18: #include <time.h>
        !            19: 
        !            20: #include <SDL.h>
        !            21: #include <SDL_mixer.h>
        !            22: #include <SDL_image.h>
        !            23: #include <SDL_ttf.h>
        !            24: 
        !            25: /* 
        !            26:  * Set some basic definitions
        !            27:  */
        !            28: #define VER "$Id$";
        !            29: #define TITLE "Unnamed Side-Scroller"
        !            30: #define SCREEN_WIDTH 640
        !            31: #define SCREEN_HEIGHT 480
        !            32: #define FALSE 0
        !            33: #define TRUE 1
        !            34: #define LIVES 3
        !            35: #define COLORKEY 255, 0, 255
        !            36: #define BGCOLOR 0, 0, 0
        !            37: #define TALOS_START_X 290
        !            38: #define TALOS_START_Y 425
        !            39: #define UP 1
        !            40: #define DOWN 2
        !            41: #define LEFT 3
        !            42: #define RIGHT 4
        !            43: #define X 0
        !            44: #define Y 1
        !            45: #define FRAME 24
        !            46: #define HFRAME 12
        !            47: 
        !            48: /* Point table */
        !            49: #define HIGH_SCORE 4630
        !            50: 
        !            51: /* baddies */
        !            52: #define VEHICLE 0
        !            53: #define LOG 1
        !            54: #define TURTLE 2
        !            55: #define GATOR 3
        !            56: #define SNAKE 4
        !            57: #define BEAVER 5
        !            58: 
        !            59: /* Turtles */
        !            60: #define DIVE_START_TIME 50
        !            61: #define DIVE_PHASE_TIME 20
        !            62: #define MAX_TURTLES 9
        !            63: #define TURTLE_ANIM_TIME 5
        !            64: 
        !            65: /* Vehicles */
        !            66: #define MAX_VEHICLES 40
        !            67: 
        !            68: 
        !            69: /*
        !            70:  * Froggers dstruct
        !            71:  */
        !            72: typedef struct {
        !            73:        int placement[2];
        !            74:        int oldPlacement[2];
        !            75:        int direction;
        !            76:        int location; 
        !            77:        int hopCount;
        !            78:        int currentRow;
        !            79:        int alive;
        !            80:        int riding;
        !            81:        int ridingIdx;
        !            82:        int ridingType;
        !            83:        int talosger;   /* Are we talosger or bonus talos */
        !            84:        int deathType;
        !            85:        int deathCount;
        !            86: 
        !            87:        SDL_Rect src;
        !            88:        SDL_Rect dst;
        !            89: 
        !            90:        Mix_Chunk *s_hop;
        !            91:        Mix_Chunk *s_squash;
        !            92:        Mix_Chunk *s_splash;
        !            93:        Mix_Chunk *s_extra;
        !            94: } talosgerObj;
        !            95: 
        !            96: /*
        !            97:  * Vehicles
        !            98:  */
        !            99: typedef struct {
        !           100:        int placement[2];
        !           101:        int oldPlacement[2];
        !           102:        int direction;  // LEFT or RIGHT
        !           103:        int row;        // row
        !           104:        int speed;      // How fast are we traveling
        !           105:        int level;      // Must be >= this level to display
        !           106:                
        !           107:        SDL_Rect src;
        !           108: } vehicleObj;
        !           109: 
        !           110: int keyEvents( SDL_Event event );
        !           111: int mySDLInit( void );
        !           112: void beginGame( void );
        !           113: int loadMedia( void );
        !           114: int heartbeat( void );
        !           115: int updateGameState( void );
        !           116: void checkFly( void );
        !           117: void checkGator( void );
        !           118: void configGameScreen( void );
        !           119: void drawGameScreen( void );
        !           120: void drawBackground( void );
        !           121: int getRowPixel ( int row );
        !           122: int collisionRow ( void );
        !           123: int freeFrog( int score );
        !           124: int collideFrogger ( int x, int y, int h, int w );
        !           125: void checkFroggerBorder( void );
        !           126: void levelUp( void );
        !           127: int checkGoals( void );
        !           128: void talosgerReset( void );
        !           129: void moveFrogger( void );
        !           130: void ridingFrogger( );
        !           131: void drawTitleScreen( void );
        !           132: void drawPauseScreen( void );
        !           133: void drawGameOver( void );
        !           134: int drawDeathSequence( int deathType );
        !           135: int checkTimer( void );
        !           136: void drawScore( int high, int score );
        !           137: void drawNumbers( int num, int x, int y );
        !           138: void drawGoals( void );
        !           139: void drawTimer( int length );
        !           140: void drawLives( int lives );
        !           141: void drawLevel( int level );
        !           142: void drawWood( void );
        !           143: void drawTurtles( void );
        !           144: void drawVehicles( void );
        !           145: void drawImage(SDL_Surface *srcimg, int sx, int sy, int sw, int sh, SDL_Surface *dstimg, int dx, int dy, int alpha );
        !           146: void playSound( Mix_Chunk *sound );
        !           147: void setFullScreenMode( void );
        !           148: 
        !           149: int flyTimer = 0;
        !           150: int gatorTimer = 0;
        !           151: int level = 0;
        !           152: int playing = 0;
        !           153: int lives = 0;
        !           154: int players = 0;
        !           155: int score = 0;
        !           156: int givenFreeFrog = 0;
        !           157: int hScore = HIGH_SCORE;
        !           158: int redraw_all = 0;
        !           159: int fullscreen = 0;
        !           160: int drawBG = 0;
        !           161: int goDelay;
        !           162: float timeLeft;
        !           163: talosgerObj talosger;
        !           164: 
        !           165: Mix_Chunk  *s_freeFrog;
        !           166: SDL_Surface *gfx;
        !           167: SDL_Surface *background; // This is the talosger back drop
        !           168: SDL_Rect backgroundRect;
        !           169: SDL_Surface *titleSurface; // Title 'Froggix' image
        !           170: SDL_Surface *screen; //This pointer will reference the backbuffer 
        !           171: SDL_Rect leftBorderRect;
        !           172: SDL_Rect rightBorderRect;
        !           173: TTF_Font *font;
        !           174: 
        !           175: int debugBorder = 0;
        !           176: 
        !           177: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>