Move weather settings to Location from GameState
[tennix.git] / tennix.h
blobb85eea7e9d1a617fe96bc9e328cfbb19afadb18a
2 /**
4 * Tennix! SDL Port
5 * Copyright (C) 2003, 2007, 2008, 2009 Thomas Perl <thp@thpinfo.com>
6 *
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,
20 * MA 02110-1301, USA.
22 **/
24 #ifndef __TENNIX_H
25 #define __TENNIX_H
27 #include <sys/param.h>
29 #include <SDL/SDL.h>
31 #ifdef DELUXE_EDITION
32 # define HAVE_VOICE_FILES
33 # define NONFREE_LOCATIONS
34 #endif
36 #if defined(__MACH__) && defined(__APPLE__)
37 # define MACOSX
38 #endif
40 #define ARCHIVE_FILE "tennix.tnx"
41 #ifdef MACOSX
42 # define ARCHIVE_FILE_INSTALLED "Tennix.app/Contents/Resources/" ARCHIVE_FILE
43 #else
44 # define ARCHIVE_FILE_INSTALLED "/" PREFIX "/share/games/tennix/" ARCHIVE_FILE
45 #endif
47 #ifdef WIN32
48 # define GAMESTATE_FILE "current_match-" VERSION ".tennix"
49 #else
50 # define GAMESTATE_FILE ".tennix-current_match-" VERSION
51 #endif
53 #define COPYRIGHT "Copyright 2003, 2007, 2008, 2009 Thomas Perl"
54 #define URL "http://icculus.org/tennix/"
56 #define WIDTH 640
57 #define HEIGHT 480
59 #define MENU_BUTTON_HEIGHT 62
60 #define MENU_BUTTON_WIDTH 185
62 #define MENU_START_YPOS 150
63 #define MENU_RESUME_YPOS 230
64 #define MENU_QUIT_YPOS 350
66 #define M_POS_XPOS(x) (x>WIDTH-MENU_BUTTON_WIDTH)
67 #define M_POS_START(y) (y>MENU_START_YPOS && y<MENU_START_YPOS+MENU_BUTTON_HEIGHT)
68 #define M_POS_RESUME(y) (y>MENU_RESUME_YPOS && y<MENU_RESUME_YPOS+MENU_BUTTON_HEIGHT)
69 #define M_POS_QUIT(y) (y>MENU_QUIT_YPOS && y<MENU_QUIT_YPOS+MENU_BUTTON_HEIGHT)
71 #define MENU_OPTIONS_BORDER 20
72 #define MENU_OPTIONS_BUTTON_HEIGHT 25
73 #define MENU_OPTIONS_BUTTON_WIDTH 150
75 /* Menu items */
76 enum {
77 MENU_NONE = 0,
78 MENU_START = 1,
79 MENU_RESUME = 2,
80 MENU_COURT_CHANGE = 4,
81 MENU_PLAYER1 = 8,
82 MENU_PLAYER2 = 16,
83 MENU_QUIT = 32
86 #define M_POS_DECODE(x,y) (M_POS_XPOS(x)?((M_POS_START(y))?(MENU_START):((M_POS_QUIT(y))?(MENU_QUIT):((M_POS_RESUME(y))?(MENU_RESUME):(MENU_NONE)))):(MENU_NONE))
88 /* Menu states */
89 enum {
90 MENU_STATE_STARTED = 0,
91 MENU_STATE_SLIDE_TO_MAINMENU,
92 MENU_STATE_SLIDE_TO_MAINMENU_IN_PROGRESS,
93 MENU_STATE_MAINMENU,
94 MENU_STATE_SLIDE_TO_LOCATION,
95 MENU_STATE_SLIDE_TO_LOCATION_IN_PROGRESS,
96 MENU_STATE_FADE_TO_LOCATION,
97 MENU_STATE_LOCATION,
98 MENU_STATE_FADE_TO_OPTIONS,
99 MENU_STATE_OPTIONS,
100 MENU_STATE_SLIDE_TO_GAME,
101 MENU_STATE_SLIDE_TO_GAME_IN_PROGRESS,
102 MENU_STATE_GAME,
103 MENU_STATE_SLIDE_TO_RESUME,
104 MENU_STATE_SLIDE_TO_RESUME_IN_PROGRESS,
105 MENU_STATE_RESUME,
106 MENU_STATE_SLIDE_TO_QUIT,
107 MENU_STATE_SLIDE_TO_QUIT_IN_PROGRESS,
108 MENU_STATE_QUIT
111 /* Comment the following #define to disable FPS limiting */
112 /*#define ENABLE_FPS_LIMIT*/
113 #define DEFAULT_FPS 33
116 extern SDL_Surface *screen;
118 typedef struct {
119 const char *text;
120 int x;
121 int y;
122 int w;
123 int h;
124 Uint8 r;
125 Uint8 g;
126 Uint8 b;
127 unsigned int image_id;
128 } MenuButton;
130 void menu_button_init(MenuButton*);
132 #define CONTROLLER_SETUP_BORDER 50
133 #define CONTROLLER_SETUP_SIZE 200
135 #define M_POS_BUTTON(button,mx,my) (mx>=(button).x && mx<=(button).x+(button).w && my>=(button).y && my<=(button).y+(button).h)
137 #define SQUARE_DISTANCE(xdiff, ydiff) (((xdiff)*(xdiff)) + ((ydiff)*(ydiff)))
139 #endif