5 * Copyright (C) 2003, 2007 Thomas Perl <thp@perli.net>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
30 typedef unsigned char bool;
49 unsigned char responsible
; /* responsible for the next fault (if any) */
66 #define GROUND_PHASE 0.4
69 #define BALL_JUMP_MIN 4
70 #define BALL_JUMP_MAX 10
71 #define BALL_DEFAULT_SPEED 3.0
73 #define RACKET_X_MID 15
74 #define RACKET_Y_MID 24
79 #define GAME_X_MIN 41.0*2
80 #define GAME_X_MAX 270.0*2
81 #define GAME_X_MID ((GAME_X_MIN+GAME_X_MAX)/2)
83 #define GAME_Y_MIN 20.0*2+75
84 #define GAME_Y_MAX 150.0*2+75
85 #define GAME_Y_MID ((GAME_Y_MIN+GAME_Y_MAX)/2)
87 #define PLAYER_Y_MIN 0.0
88 #define PLAYER_Y_MAX 1.0*HEIGHT
90 #define IS_OFFSCREEN_Y(y) (((y)<0) || ((y)>HEIGHT))
91 #define IS_OFFSCREEN_X(x) (((x)<0) || ((x)>WIDTH))
92 #define IS_OFFSCREEN(x,y) ((IS_OFFSCREEN_X(x)) || (IS_OFFSCREEN_Y(y)))
93 #define IS_OUT_Y(y) (y<GAME_Y_MIN || y>GAME_Y_MAX)
94 #define IS_OUT_X(x) (x<GAME_X_MIN || x>GAME_X_MAX)
96 #define PLAYER_AREA_Y RACKET_Y_MID
97 #define PLAYER_AREA_X RACKET_X_MID
98 #define IS_NEAR_Y(py,by) (fabsf(py-by)<PLAYER_AREA_Y)
99 #define IS_NEAR_X(px,bx) (fabsf(px-bx)<PLAYER_AREA_X)
101 #define PLAYER_STATE_MAX 5
102 #define PLAYER_POWERSHOT 8.2
105 void render( GameState
*);
106 bool step( GameState
*);
107 void limit_value( float*, float, float);
108 float get_phase( GameState
*);
109 float get_move_y( GameState
*, unsigned char);