Add N900 Feedback list to TODO
[tennix.git] / tennix.h
bloba951a9bdc84cbbdb423f128e7386219ad4e3f067
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>
30 #include <SDL/SDL_net.h>
32 typedef unsigned char bool;
33 enum {
34 false,
35 true
38 typedef struct {
39 unsigned char x;
40 unsigned char y;
41 unsigned char keys; /* bitfield (0 = key pressed, 1 = not pressed) */
42 } NetworkInputData;
45 typedef struct {
46 UDPsocket send_socket;
47 UDPsocket recv_input_socket;
48 UDPsocket recv_state_socket;
50 UDPpacket* input_packet;
51 UDPpacket* state_packet;
53 IPaddress peer;
55 bool input_available;
56 bool state_available;
58 Uint16 base_port_local;
59 Uint16 base_port_remote;
61 NetworkInputData input_data;
63 bool master;
64 } TennixNet;
66 #ifdef DELUXE_EDITION
67 # define HAVE_VOICE_FILES
68 # define NONFREE_LOCATIONS
69 #endif
71 #if defined(__MACH__) && defined(__APPLE__)
72 # define MACOSX
73 #endif
75 #define ARCHIVE_FILE "tennix.tnx"
76 #ifdef MACOSX
77 # define ARCHIVE_FILE_INSTALLED "Tennix.app/Contents/Resources/" ARCHIVE_FILE
78 #else
79 # define ARCHIVE_FILE_INSTALLED "/" PREFIX "/share/games/tennix/" ARCHIVE_FILE
80 #endif
82 #ifdef WIN32
83 # define GAMESTATE_FILE "current_match-" VERSION ".tennix"
84 #else
85 # define GAMESTATE_FILE ".tennix-current_match-" VERSION
86 #endif
88 #define COPYRIGHT "Copyright 2003, 2007, 2008, 2009 Thomas Perl"
89 #define URL "http://icculus.org/tennix/"
91 #define WIDTH 640
92 #define HEIGHT 480
94 #define MENU_BUTTON_HEIGHT 62
95 #define MENU_BUTTON_WIDTH 185
97 #define MENU_START_YPOS 150
98 #define MENU_RESUME_YPOS 230
99 #define MENU_QUIT_YPOS 350
101 #define M_POS_XPOS(x) (x>WIDTH-MENU_BUTTON_WIDTH)
102 #define M_POS_START(y) (y>MENU_START_YPOS && y<MENU_START_YPOS+MENU_BUTTON_HEIGHT)
103 #define M_POS_RESUME(y) (y>MENU_RESUME_YPOS && y<MENU_RESUME_YPOS+MENU_BUTTON_HEIGHT)
104 #define M_POS_QUIT(y) (y>MENU_QUIT_YPOS && y<MENU_QUIT_YPOS+MENU_BUTTON_HEIGHT)
106 #define MENU_OPTIONS_BORDER 20
107 #define MENU_OPTIONS_BUTTON_HEIGHT 25
108 #define MENU_OPTIONS_BUTTON_WIDTH 150
110 /* Menu items */
111 enum {
112 MENU_NONE = 0,
113 MENU_START = 1,
114 MENU_RESUME = 2,
115 MENU_COURT_CHANGE = 4,
116 MENU_PLAYER1 = 8,
117 MENU_PLAYER2 = 16,
118 MENU_QUIT = 32
121 #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))
123 /* Menu states */
124 enum {
125 MENU_STATE_STARTED = 0,
126 MENU_STATE_SLIDE_TO_MAINMENU,
127 MENU_STATE_SLIDE_TO_MAINMENU_IN_PROGRESS,
128 MENU_STATE_MAINMENU,
129 MENU_STATE_SLIDE_TO_LOCATION,
130 MENU_STATE_SLIDE_TO_LOCATION_IN_PROGRESS,
131 MENU_STATE_FADE_TO_LOCATION,
132 MENU_STATE_LOCATION,
133 MENU_STATE_FADE_TO_OPTIONS,
134 MENU_STATE_OPTIONS,
135 MENU_STATE_SLIDE_TO_GAME,
136 MENU_STATE_SLIDE_TO_GAME_IN_PROGRESS,
137 MENU_STATE_GAME,
138 MENU_STATE_SLIDE_TO_RESUME,
139 MENU_STATE_SLIDE_TO_RESUME_IN_PROGRESS,
140 MENU_STATE_RESUME,
141 MENU_STATE_SLIDE_TO_QUIT,
142 MENU_STATE_SLIDE_TO_QUIT_IN_PROGRESS,
143 MENU_STATE_QUIT
146 /* Comment the following #define to disable FPS limiting */
147 /*#define ENABLE_FPS_LIMIT*/
148 #define DEFAULT_FPS 33
151 extern SDL_Surface *screen;
153 typedef struct {
154 const char *text;
155 int x;
156 int y;
157 int w;
158 int h;
159 Uint8 r;
160 Uint8 g;
161 Uint8 b;
162 unsigned int image_id;
163 } MenuButton;
165 void menu_button_init(MenuButton*);
167 #define CONTROLLER_SETUP_BORDER 50
168 #define CONTROLLER_SETUP_SIZE 200
170 #define M_POS_BUTTON(button,mx,my) (mx>=(button).x && mx<=(button).x+(button).w && my>=(button).y && my<=(button).y+(button).h)
172 #define SQUARE_DISTANCE(xdiff, ydiff) (((xdiff)*(xdiff)) + ((ydiff)*(ydiff)))
174 #endif