/*
* Froggix
*
* Nicholas DeClario 2009
* <nick@declario.com>
*
* This program is distributed under the GNU Public License
* <Insert GNU license blurb here>
*/
/*
* Our pretty standard includes
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <SDL.h>
#include <SDL_mixer.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
/*
* Set some basic definitions
*/
#define VER "$Id: talos.h,v 1.1.1.1 2009/06/30 01:53:13 nick Exp $";
#define TITLE "Unnamed Side-Scroller"
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
#define FALSE 0
#define TRUE 1
#define LIVES 3
#define COLORKEY 255, 0, 255
#define BGCOLOR 0, 0, 0
#define TALOS_START_X 290
#define TALOS_START_Y 425
#define UP 1
#define DOWN 2
#define LEFT 3
#define RIGHT 4
#define X 0
#define Y 1
#define FRAME 24
#define HFRAME 12
/* Point table */
#define HIGH_SCORE 4630
/* baddies */
#define VEHICLE 0
#define LOG 1
#define TURTLE 2
#define GATOR 3
#define SNAKE 4
#define BEAVER 5
/* Turtles */
#define DIVE_START_TIME 50
#define DIVE_PHASE_TIME 20
#define MAX_TURTLES 9
#define TURTLE_ANIM_TIME 5
/* Vehicles */
#define MAX_VEHICLES 40
/*
* Froggers dstruct
*/
typedef struct {
int placement[2];
int oldPlacement[2];
int direction;
int location;
int hopCount;
int currentRow;
int alive;
int riding;
int ridingIdx;
int ridingType;
int talosger; /* Are we talosger or bonus talos */
int deathType;
int deathCount;
SDL_Rect src;
SDL_Rect dst;
Mix_Chunk *s_hop;
Mix_Chunk *s_squash;
Mix_Chunk *s_splash;
Mix_Chunk *s_extra;
} talosgerObj;
/*
* Vehicles
*/
typedef struct {
int placement[2];
int oldPlacement[2];
int direction; // LEFT or RIGHT
int row; // row
int speed; // How fast are we traveling
int level; // Must be >= this level to display
SDL_Rect src;
} vehicleObj;
int keyEvents( SDL_Event event );
int mySDLInit( void );
void beginGame( void );
int loadMedia( void );
int heartbeat( void );
int updateGameState( void );
void checkFly( void );
void checkGator( void );
void configGameScreen( void );
void drawGameScreen( void );
void drawBackground( void );
int getRowPixel ( int row );
int collisionRow ( void );
int freeFrog( int score );
int collideFrogger ( int x, int y, int h, int w );
void checkFroggerBorder( void );
void levelUp( void );
int checkGoals( void );
void talosgerReset( void );
void moveFrogger( void );
void ridingFrogger( );
void drawTitleScreen( void );
void drawPauseScreen( void );
void drawGameOver( void );
int drawDeathSequence( int deathType );
int checkTimer( void );
void drawScore( int high, int score );
void drawNumbers( int num, int x, int y );
void drawGoals( void );
void drawTimer( int length );
void drawLives( int lives );
void drawLevel( int level );
void drawWood( void );
void drawTurtles( void );
void drawVehicles( void );
void drawImage(SDL_Surface *srcimg, int sx, int sy, int sw, int sh, SDL_Surface *dstimg, int dx, int dy, int alpha );
void playSound( Mix_Chunk *sound );
void setFullScreenMode( void );
int flyTimer = 0;
int gatorTimer = 0;
int level = 0;
int playing = 0;
int lives = 0;
int players = 0;
int score = 0;
int givenFreeFrog = 0;
int hScore = HIGH_SCORE;
int redraw_all = 0;
int fullscreen = 0;
int drawBG = 0;
int goDelay;
float timeLeft;
talosgerObj talosger;
Mix_Chunk *s_freeFrog;
SDL_Surface *gfx;
SDL_Surface *background; // This is the talosger back drop
SDL_Rect backgroundRect;
SDL_Surface *titleSurface; // Title 'Froggix' image
SDL_Surface *screen; //This pointer will reference the backbuffer
SDL_Rect leftBorderRect;
SDL_Rect rightBorderRect;
TTF_Font *font;
int debugBorder = 0;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>