1 /* $Id: ttinc.h,v 1.41 2003/07/28 17:04:14 nan Exp $ */
2 
3 // Copyright (C) 2000-2003  ���� �ȹ�(Kanna Yoshihiro)
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 
19 #ifndef _ttinc_
20 #define _ttinc_
21 
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25 
26 #ifdef _WIN32
27 # define WIN32
28 # if (_MSC_VER >= 1200)
29 #  pragma warning(disable: 4786)	/* Symbol trucated to 255chars */
30 # endif
31 #endif
32 
33 //#define SCREENSHOT
34 
35 #define MAJOR_VERSION	0
36 #define MIDDLE_VERSION	6
37 #define MINOR_VERSION	6
38 
39 #define CSMASH_PORT	3573	// TCP Port num.
40 
41 // Window size
42 #define WINXSIZE	800
43 #define WINYSIZE	600
44 // Field size
45 #define AREAXSIZE	8.0F
46 #define AREAYSIZE	12.0F
47 #define AREAZSIZE	6.0F
48 
49 // Player size
50 #define UPPERARM	0.25F
51 #define FOREARM		0.30F
52 
53 // Table size
54 #define TABLELENGTH	((float)(2.74))
55 #define TABLEWIDTH	((float)(1.525))
56 #define TABLEHEIGHT	((float)(0.76))
57 #define	TABLETHICK	((float)(0.1))
58 // Net height
59 #define NETHEIGHT	((float)(0.1525))
60 // Ball R
61 #define BALL_R		((float)(0.019))
62 
63 #define TABLE_E		((float)(0.8))
64 #define PHY		((float)(0.15))
65 
66 // Image size
67 #define IMAGE_WIDTH	256
68 #define IMAGE_HEIGHT	256
69 
70 #define GRAV		((float)(9.8+m_spin*5))
71 #define GRAVITY(spin)	((float)(9.8+spin*5))
72 
73 #define	TICK		(0.01F)		// Turn length (in second)
74 
75 // Key
76 #define KEY_LEFT    (1<<0)
77 #define KEY_RIGHT   (1<<1)
78 #define KEY_FORWARD (1<<2)
79 #define KEY_BACK    (1<<3)
80 #define KEY_UP      (1<<4)
81 #define KEY_DOWN    (1<<5)
82 #define KEY_HIT     (1<<6)
83 
84 // Mouse
85 #define BUTTON_LEFT   (1<<0)
86 #define BUTTON_MIDDLE (1<<1)
87 #define BUTTON_RIGHT  (1<<2)
88 
89 #define MAX_HISTORY (1024)
90 
91 // Self Model mode
92 #define MODEL_TRANSPARENT   (0)
93 #define MODEL_WIREFRAME     (1)
94 #define MODEL_ARMONLY       (2)
95 
96 // Graphics mode
97 #define GMODE_FULL          (0)
98 #define GMODE_SIMPLE        (1)
99 #define GMODE_2D            (2)
100 
101 // Play mode
102 #define MODE_SOLOPLAY       (1)	// Play VS COM
103 #define MODE_MULTIPLAY      (2)	// Play VS MAN
104 #define MODE_SELECT         (3)	// Player Select
105 #define MODE_TITLE          (4)	// Title
106 #define MODE_HOWTO          (5)	// How to Play
107 #define MODE_TRAININGSELECT (6)	// Training Select
108 #define MODE_TRAINING       (7)	// Training
109 #define MODE_OPENING        (8)	// Opening
110 #define MODE_PRACTICESELECT (9)	// Practice Select
111 #define MODE_PRACTICE       (10)// Practice
112 #define MODE_MULTIPLAYSELECT (11)// Play VS MAN Select
113 
114 // Sound
115 #define SOUND_RACKET (0)
116 #define SOUND_TABLE  (1)
117 #define SOUND_CLICK  (2)
118 #define SOUND_OPENING (3)
119 #define SOUND_LOVEALL (4)
120 #define SOUND_ALL (5)
121 
122 // protocol
123 #define IPv4 (0)
124 #define IPv6 (1)
125 
126 #define OPENINGFILENAME "danslatristesse2-48.ogg"
127 
128 // Communication
129 #define DATA_PV      (0)
130 #define DATA_PS      (1)
131 #define DATA_BT      (2)
132 #define DATA_BV      (3)
133 #define DATA_PT      (4)
134 
135 // Sound
136 #define SOUND_NONE	0
137 #define SOUND_SDL	1
138 
139 // Others
140 #define RAND(N) ((int)((float)(N)*rand()/RAND_MAX))
141 
142 // Player::m_swingError
143 #define SWING_PERFECT	0
144 #define SWING_GREAT	1
145 #define SWING_GOOD	2
146 #define SWING_BOO	3
147 #define SWING_MISS	4
148 
149 #define PLAYERS 3
150 #define TRAININGPLAYERS 2
151 
152 // Game level and mode
153 enum level {LEVEL_EASY, LEVEL_NORMAL, LEVEL_HARD, LEVEL_TSUBORISH};
154 enum mode  {GAME_5PTS, GAME_11PTS, GAME_21PTS};
155 
156 // Log
157 #define LOGGING
158 
159 #ifndef MKDEP_IGN_SYSINC
160 
161 #ifdef WIN32
162 #define NOMINMAX
163 #define VC_EXTRALEAN
164 #include <winsock2.h>
165 #ifdef ENABLE_IPV6
166 #include <WS2tcpip.h>
167 #endif
168 #include <windows.h>
169 #endif
170 
171 #ifdef HAVE_UNISTD_H
172 #include <unistd.h>
173 #endif
174 #include <stdio.h>
175 #include <stdlib.h>
176 #include <sys/types.h>
177 #include <sys/timeb.h>
178 #include <sys/stat.h>
179 #include <fcntl.h>
180 #include <string.h>
181 #include <ctype.h>
182 #include <math.h>
183 #include <float.h>
184 
185 #ifndef WIN32
186 #include <sys/time.h>
187 #include <sys/socket.h>
188 #include <netinet/in.h>
189 #include <arpa/inet.h>
190 #include <netdb.h>
191 
192 #define SOCKET int
193 #define closesocket(A) close(A)
194 #else /* WIN32 */
195 #include <io.h>
196 #include <direct.h>
197 
198 #define F_OK 0 /* stat, file is exist */
199 #define snprintf _snprintf
200 #define vsnprintf _vsnprintf
201 typedef int socklen_t;		/* mimic Penguin's socklen type */
202 #endif   /* !WIN32 */
203 
204 #include <GL/gl.h>
205 #include <GL/glu.h>
206 
207 #include <SDL.h>
208 #include <SDL_image.h>
209 #include <SDL_thread.h>
210 
211 #ifdef HAVE_LIBSDL_MIXER
212 #include <SDL_mixer.h>
213 #endif
214 
215 #include <libintl.h>
216 #define  gettext_noop(String)  (String)
217 #define _(String) gettext (String)
218 #define N_(String) gettext_noop (String)
219 
220 #endif /* MKDEP_IGN_SYSINC */
221 
222 #ifdef HAVE_LIBZ
223 #include "z.h"
224 #endif
225 
226 void xerror(const char *str, ...);
227 
228 #endif // _ttinc_
229