00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef HEADER
00017 #define HEADER
00018
00019 #include <locale.h>
00020 #include <libintl.h>
00021 #define PACKAGE "xtratego"
00022 #define VERSION "0.2"
00023 #define VERSION_NAME "Living Daylight"
00024 #define _(s) (gettext((char*)s)) // gettext(s)
00025 #define _n(s) s // aka gettext_noop in the gettext texinfo
00026
00027
00028 #include "iostream"
00029 #include "fstream"
00030 #include "string"
00031 #include <stdio.h>
00032 #include <stdlib.h>
00033 #include <time.h>
00034 #include <signal.h>
00035 #include <pthread.h>
00036
00037 #include <sofont.h>
00038 #include <SDL.h>
00039 #include <SDL_audio.h>
00040 #include <SDL_mixer.h>
00041 #include <SDL_image.h>
00042 #include <SDL_net.h>
00043
00044
00045
00046
00047
00048
00049
00050 using namespace std;
00051
00052 #define abs(x) (x>0?(x):-(x))
00053 #define SSL 32
00054 #define LSL 256
00055
00056 extern int argc;
00057 extern char *argv[];
00058
00059 typedef enum{
00060 NONE,
00061 FORM,
00062 GAME,
00063 } mode;
00064 extern mode game_mode;
00065
00066
00067
00068 class piece;
00069 class caze;
00070 class field;
00071
00072 extern bool DEBUGG;
00073 extern char LOCDIR[LSL];
00074 extern char PRGDIR[LSL];
00075 extern char DATDIR[LSL];
00076 extern char IMGDIR[LSL];
00077 extern char SNDDIR[LSL];
00078 extern char FNTDIR[LSL];
00079 extern char HOMDIR[LSL];
00080
00081 extern SDL_Rect r_bg;
00082 extern SDL_Rect r_logo_i;
00083 extern SDL_Rect r_logo_o;
00084 extern SDL_Rect r_caze_i;
00085 extern SDL_Rect r_status;
00086
00087 extern SDL_Surface *screen;
00088 extern SDL_Surface *screenbak;
00089 extern SDL_Surface *s_bg;
00090 extern SDL_Surface *s_button;
00091 extern SDL_Surface *s_logo;
00092 extern SDL_Surface *s_board;
00093 extern SDL_Surface *s_board_grid;
00094 extern SDL_Surface *s_armies;
00095 extern SDL_Surface *s_piece;
00096 extern SDL_Surface *s_camp;
00097 extern SDL_Surface *s_camp_grid;
00098 extern SDL_Surface *s_cimetery;
00099 extern SDL_Surface *s_cimetery_grid;
00100
00101 extern SDL_Cursor curs;
00102
00103 extern Uint32 rmask, gmask, bmask, amask;
00104
00105 extern SoFont *font;
00106 extern SoFont *sfont;
00107
00108 class piece{
00109 public:
00110 int internal;
00111 int type;
00112 SDL_Rect r_i;
00113 char name[SSL];
00114 int power;
00115 bool alive;
00116 int deathnr;
00117 caze *position;
00118 piece(int _internal, int _team);
00119 };
00120
00121 class caze{
00122 public:
00123 field *master;
00124 int i;
00125 int j;
00126 SDL_Rect r_o;
00127 SDL_Surface *s;
00128 bool free;
00129 bool playable;
00130 piece *onit;
00131 void set(piece *p, int plus=0);
00132 void clear(int plus=0);
00133 void update();
00134 };
00135
00136 class field{
00137 public:
00138 int w;
00139 int h;
00140 SDL_Rect eigen;
00141 SDL_Rect visible;
00142 caze *array;
00143 SDL_Surface **s;
00144 SDL_Surface **sg;
00145 void init (int _w, int _h, SDL_Rect _eigen, SDL_Rect _visible, caze *_array, SDL_Surface **_s, SDL_Surface **_sg);
00146 void clear();
00147 void update();
00148 int pos (int i, int j){return i+j*w;}
00149 };
00150
00151 extern piece *army[82];
00152 extern field board;
00153 extern field camp;
00154 extern field cimetery;
00155
00156 void initdirs();
00157 void initarmies();
00158 void initsdl();
00159 void initchildfilter();
00160 void initfilter();
00161 void initcursor();
00162 void loadimages();
00163 void initfonts();
00164
00165
00166
00167 void debug(char *msg);
00168 SDL_Surface *LoadImage (char *ImageFile, SDL_Surface *surf, bool isfont=false);
00169 void Display (SDL_Surface *surf, SDL_Rect *r_in, SDL_Rect *r_out);
00170 void savescreen();
00171 void restorescreen();
00172 caze *whereami(int x, int y);
00173 caze *dragdrop (caze *c);
00174 void wstatus(const char *msg, bool append=false);
00175 void cstatus();
00176 void bye(int ret);
00177
00178
00179
00180 void formedit();
00181 void new_formation();
00182 void load_formation(char *file);
00183 void save_formation(char *file);
00184
00185
00186
00187 extern bool opt_doublebuffering;
00188 extern bool opt_fullscreen;
00189 extern bool opt_nowindow;
00190
00191 void loadcfg();
00192 void savecfg();
00193 void displaycfg();
00194
00195
00196
00197 void game(bool server);
00198
00199
00200
00201 extern TCPsocket csck;
00202
00203 #endif // HEADER
00204