From 35185452d7546ab56aa0040d7c2d68795c3f813f Mon Sep 17 00:00:00 2001 From: oroborus Date: Sun, 6 Apr 2008 17:25:52 +0000 Subject: - synchronizuju sa aj veci - preklady obsahuju aj font a velkost pismen - upravy aby to slo ( po stahnut tejto verzii sa hra musi odinstalovat a znova naonstalovat ) git-svn-id: http://opensvn.csie.org/tuxanci_ng@43 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- Makefile | 3 +- conf/keytable.conf | 289 +++++++++++++++++++++++++++++++++++++++++++++++++++++ config.h | 2 +- data/keytable.conf | 289 ----------------------------------------------------- include/item.h | 6 ++ include/language.h | 4 +- include/server.h | 5 +- include/tux.h | 3 +- lang/cs.lang | 2 + lang/en.lang | 2 + lang/sk.lang | 2 + src/client.c | 112 +-------------------- src/gun.c | 11 +- src/item.c | 14 +++ src/keytable.c | 2 +- src/language.c | 76 +++++++++++++- src/main.c | 10 +- src/proto.c | 5 +- src/screen_world.c | 18 ++++ src/server.c | 26 +++-- src/tux.c | 24 ++++- 21 files changed, 467 insertions(+), 438 deletions(-) create mode 100755 conf/keytable.conf delete mode 100755 data/keytable.conf diff --git a/Makefile b/Makefile index 536b610..7bc05b7 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ server: install: mkdir -p $(DESTDIR)/bin - mkdir -p $(DESTDIR)/share/tuxanci-ng/{arena,data,font,image,lang,music,sound} + mkdir -p $(DESTDIR)/share/tuxanci-ng/{arena,data,font,image,lang,music,sound,conf} cp ./src/tuxanci-ng $(DESTDIR)/bin/ cp -rf ./arena/* $(DESTDIR)/share/tuxanci-ng/arena/ @@ -59,6 +59,7 @@ install: cp -rf ./music/* $(DESTDIR)/share/tuxanci-ng/music/ cp -rf ./sound/* $(DESTDIR)/share/tuxanci-ng/sound/ cp -rf ./data/* $(DESTDIR)/share/tuxanci-ng/data/ + cp -rf ./conf/* $(DESTDIR)/share/tuxanci-ng/conf/ uninstall: rm -rf $(DESTDIR)/{bin,share}/tuxanci-ng diff --git a/conf/keytable.conf b/conf/keytable.conf new file mode 100755 index 0000000..1e349f4 --- /dev/null +++ b/conf/keytable.conf @@ -0,0 +1,289 @@ + +#******************************************** + +# +# Key table : +# + +#******************************************** + +keycode SDLK_FIRST = 0 +keycode SDLK_BACKSPACE = 8 +keycode SDLK_TAB = 9 +keycode SDLK_CLEAR = 12 +keycode SDLK_RETURN = 13 +keycode SDLK_PAUSE = 19 +keycode SDLK_ESCAPE = 27 +keycode SDLK_SPACE = 32 +keycode SDLK_EXCLAIM = 33 +keycode SDLK_QUOTEDBL = 34 +keycode SDLK_HASH = 35 +keycode SDLK_DOLLAR = 36 +keycode SDLK_AMPERSAND = 38 +keycode SDLK_QUOTE = 39 +keycode SDLK_LEFTPAREN = 40 +keycode SDLK_RIGHTPAREN = 41 +keycode SDLK_ASTERISK = 42 +keycode SDLK_PLUS = 43 +keycode SDLK_COMMA = 44 +keycode SDLK_MINUS = 45 +keycode SDLK_PERIOD = 46 +keycode SDLK_SLASH = 47 + +#******************************************** + +keycode SDLK_0 = 48 +keycode SDLK_1 = 49 +keycode SDLK_2 = 50 +keycode SDLK_3 = 51 +keycode SDLK_4 = 52 +keycode SDLK_5 = 53 +keycode SDLK_6 = 54 +keycode SDLK_7 = 55 +keycode SDLK_8 = 56 +keycode SDLK_9 = 57 + +#******************************************** + +keycode SDLK_COLON = 58 +keycode SDLK_SEMICOLON = 59 +keycode SDLK_LESS = 60 +keycode SDLK_EQUALS = 61 +keycode SDLK_GREATER = 62 +keycode SDLK_QUESTION = 63 +keycode SDLK_AT = 64 + +#******************************************** + +keycode SDLK_LEFTBRACKET = 91 +keycode SDLK_BACKSLASH = 92 +keycode SDLK_RIGHTBRACKET = 93 +keycode SDLK_CARET = 94 +keycode SDLK_UNDERSCORE = 95 +keycode SDLK_BACKQUOTE = 96 + +#******************************************** + +keycode SDLK_a = 97 +keycode SDLK_b = 98 +keycode SDLK_c = 99 +keycode SDLK_d = 100 +keycode SDLK_e = 101 +keycode SDLK_f = 102 +keycode SDLK_g = 103 +keycode SDLK_h = 104 +keycode SDLK_i = 105 +keycode SDLK_j = 106 +keycode SDLK_k = 107 +keycode SDLK_l = 108 +keycode SDLK_m = 1 +keycode SDLK_n = 110 +keycode SDLK_o = 111 +keycode SDLK_p = 112 +keycode SDLK_q = 113 +keycode SDLK_r = 114 +keycode SDLK_s = 115 +keycode SDLK_t = 116 +keycode SDLK_u = 117 +keycode SDLK_v = 118 +keycode SDLK_w = 119 +keycode SDLK_x = 120 +keycode SDLK_y = 121 +keycode SDLK_z = 122 +keycode SDLK_DELETE = 127 + +#******************************************** + +keycode SDLK_WORLD_0 = 160 +keycode SDLK_WORLD_1 = 161 +keycode SDLK_WORLD_2 = 162 +keycode SDLK_WORLD_3 = 163 +keycode SDLK_WORLD_4 = 164 +keycode SDLK_WORLD_5 = 165 +keycode SDLK_WORLD_6 = 166 +keycode SDLK_WORLD_7 = 167 +keycode SDLK_WORLD_8 = 168 +keycode SDLK_WORLD_9 = 169 +keycode SDLK_WORLD_10 = 170 +keycode SDLK_WORLD_11 = 171 +keycode SDLK_WORLD_12 = 172 +keycode SDLK_WORLD_13 = 173 +keycode SDLK_WORLD_14 = 174 +keycode SDLK_WORLD_15 = 175 +keycode SDLK_WORLD_16 = 176 +keycode SDLK_WORLD_17 = 177 +keycode SDLK_WORLD_18 = 178 +keycode SDLK_WORLD_19 = 179 +keycode SDLK_WORLD_20 = 180 +keycode SDLK_WORLD_21 = 181 +keycode SDLK_WORLD_22 = 182 +keycode SDLK_WORLD_23 = 183 +keycode SDLK_WORLD_24 = 184 +keycode SDLK_WORLD_25 = 185 +keycode SDLK_WORLD_26 = 186 +keycode SDLK_WORLD_27 = 187 +keycode SDLK_WORLD_28 = 188 +keycode SDLK_WORLD_29 = 189 +keycode SDLK_WORLD_30 = 190 +keycode SDLK_WORLD_31 = 191 +keycode SDLK_WORLD_32 = 192 +keycode SDLK_WORLD_33 = 193 +keycode SDLK_WORLD_34 = 194 +keycode SDLK_WORLD_35 = 195 +keycode SDLK_WORLD_36 = 196 +keycode SDLK_WORLD_37 = 197 +keycode SDLK_WORLD_38 = 198 +keycode SDLK_WORLD_39 = 199 +keycode SDLK_WORLD_40 = 200 +keycode SDLK_WORLD_41 = 201 +keycode SDLK_WORLD_42 = 202 +keycode SDLK_WORLD_43 = 203 +keycode SDLK_WORLD_44 = 204 +keycode SDLK_WORLD_45 = 205 +keycode SDLK_WORLD_46 = 206 +keycode SDLK_WORLD_47 = 207 +keycode SDLK_WORLD_48 = 208 +keycode SDLK_WORLD_49 = 2 +keycode SDLK_WORLD_50 = 210 +keycode SDLK_WORLD_51 = 211 +keycode SDLK_WORLD_52 = 212 +keycode SDLK_WORLD_53 = 213 +keycode SDLK_WORLD_54 = 214 +keycode SDLK_WORLD_55 = 215 +keycode SDLK_WORLD_56 = 216 +keycode SDLK_WORLD_57 = 217 +keycode SDLK_WORLD_58 = 218 +keycode SDLK_WORLD_59 = 219 +keycode SDLK_WORLD_60 = 220 +keycode SDLK_WORLD_61 = 221 +keycode SDLK_WORLD_62 = 222 +keycode SDLK_WORLD_63 = 223 +keycode SDLK_WORLD_64 = 224 +keycode SDLK_WORLD_65 = 225 +keycode SDLK_WORLD_66 = 226 +keycode SDLK_WORLD_67 = 227 +keycode SDLK_WORLD_68 = 228 +keycode SDLK_WORLD_69 = 229 +keycode SDLK_WORLD_70 = 230 +keycode SDLK_WORLD_71 = 231 +keycode SDLK_WORLD_72 = 232 +keycode SDLK_WORLD_73 = 233 +keycode SDLK_WORLD_74 = 234 +keycode SDLK_WORLD_75 = 235 +keycode SDLK_WORLD_76 = 236 +keycode SDLK_WORLD_77 = 237 +keycode SDLK_WORLD_78 = 238 +keycode SDLK_WORLD_79 = 239 +keycode SDLK_WORLD_80 = 240 +keycode SDLK_WORLD_81 = 241 +keycode SDLK_WORLD_82 = 242 +keycode SDLK_WORLD_83 = 243 +keycode SDLK_WORLD_84 = 244 +keycode SDLK_WORLD_85 = 245 +keycode SDLK_WORLD_86 = 246 +keycode SDLK_WORLD_87 = 247 +keycode SDLK_WORLD_88 = 248 +keycode SDLK_WORLD_89 = 249 +keycode SDLK_WORLD_90 = 250 +keycode SDLK_WORLD_91 = 251 +keycode SDLK_WORLD_92 = 252 +keycode SDLK_WORLD_93 = 253 +keycode SDLK_WORLD_94 = 254 +keycode SDLK_WORLD_95 = 255 + +#******************************************** + +keycode SDLK_KP0 = 256 +keycode SDLK_KP1 = 257 +keycode SDLK_KP2 = 258 +keycode SDLK_KP3 = 259 +keycode SDLK_KP4 = 260 +keycode SDLK_KP5 = 261 +keycode SDLK_KP6 = 262 +keycode SDLK_KP7 = 263 +keycode SDLK_KP8 = 264 +keycode SDLK_KP9 = 265 +keycode SDLK_KP_PERIOD = 266 +keycode SDLK_KP_DIVIDE = 267 +keycode SDLK_KP_MULTIPLY = 268 +keycode SDLK_KP_MINUS = 269 +keycode SDLK_KP_PLUS = 270 +keycode SDLK_KP_ENTER = 271 +keycode SDLK_KP_EQUALS = 272 + +#******************************************** + +keycode SDLK_UP = 273 +keycode SDLK_DOWN = 274 +keycode SDLK_RIGHT = 275 +keycode SDLK_LEFT = 276 +keycode SDLK_INSERT = 277 +keycode SDLK_HOME = 278 +keycode SDLK_END = 279 +keycode SDLK_PAGEUP = 280 +keycode SDLK_PAGEDOWN = 281 + +#******************************************** + +keycode SDLK_F1 = 282 +keycode SDLK_F2 = 283 +keycode SDLK_F3 = 284 +keycode SDLK_F4 = 285 +keycode SDLK_F5 = 286 +keycode SDLK_F6 = 287 +keycode SDLK_F7 = 288 +keycode SDLK_F8 = 289 +keycode SDLK_F9 = 290 +keycode SDLK_F10 = 291 +keycode SDLK_F11 = 292 +keycode SDLK_F12 = 293 +keycode SDLK_F13 = 294 +keycode SDLK_F14 = 295 +keycode SDLK_F15 = 296 + +#******************************************** + +keycode SDLK_NUMLOCK = 300 +keycode SDLK_CAPSLOCK = 301 +keycode SDLK_SCROLLOCK = 302 +keycode SDLK_RSHIFT = 303 +keycode SDLK_LSHIFT = 304 +keycode SDLK_RCTRL = 305 +keycode SDLK_LCTRL = 306 +keycode SDLK_RALT = 307 +keycode SDLK_LALT = 308 +keycode SDLK_RMETA = 3 +keycode SDLK_LMETA = 310 +keycode SDLK_LSUPER = 311 +keycode SDLK_RSUPER = 312 +keycode SDLK_MODE = 313 +keycode SDLK_COMPOSE = 314 + +#******************************************** + +keycode SDLK_HELP = 315 +keycode SDLK_PRINT = 316 +keycode SDLK_SYSREQ = 317 +keycode SDLK_BREAK = 318 +keycode SDLK_MENU = 319 +keycode SDLK_POWER = 320 +keycode SDLK_EURO = 321 +keycode SDLK_UNDO = 322 + +#******************************************** + +TUX_RIGHT_MOVE_UP = SDLK_KP8 SDLK_UP +TUX_RIGHT_MOVE_RIGHT = SDLK_KP6 SDLK_RIGHT +TUX_RIGHT_MOVE_LEFT = SDLK_KP4 SDLK_LEFT +TUX_RIGHT_MOVE_DOWN = SDLK_KP5 SDLK_DOWN +TUX_RIGHT_SHOOT = SDLK_KP0 +TUX_RIGHT_SWITCH_WEAPON = SDLK_KP1 + +TUX_LEFT_MOVE_UP = SDLK_w +TUX_LEFT_MOVE_RIGHT = SDLK_d +TUX_LEFT_MOVE_LEFT = SDLK_a +TUX_LEFT_MOVE_DOWN = SDLK_s +TUX_LEFT_SHOOT = SDLK_q +TUX_LEFT_SWITCH_WEAPON = SDLK_TAB + +#******************************************** diff --git a/config.h b/config.h index d9c71a3..17f4604 100644 --- a/config.h +++ b/config.h @@ -6,7 +6,7 @@ #define DEBUG_CLIENT_RECV */ -#define TUXANCI_NG_VERSION "svn42" +#define TUXANCI_NG_VERSION "svn43" #define DESTDIR "/usr/local/" #define SUPPORT_NET_SDL_UDP diff --git a/data/keytable.conf b/data/keytable.conf deleted file mode 100755 index 1e349f4..0000000 --- a/data/keytable.conf +++ /dev/null @@ -1,289 +0,0 @@ - -#******************************************** - -# -# Key table : -# - -#******************************************** - -keycode SDLK_FIRST = 0 -keycode SDLK_BACKSPACE = 8 -keycode SDLK_TAB = 9 -keycode SDLK_CLEAR = 12 -keycode SDLK_RETURN = 13 -keycode SDLK_PAUSE = 19 -keycode SDLK_ESCAPE = 27 -keycode SDLK_SPACE = 32 -keycode SDLK_EXCLAIM = 33 -keycode SDLK_QUOTEDBL = 34 -keycode SDLK_HASH = 35 -keycode SDLK_DOLLAR = 36 -keycode SDLK_AMPERSAND = 38 -keycode SDLK_QUOTE = 39 -keycode SDLK_LEFTPAREN = 40 -keycode SDLK_RIGHTPAREN = 41 -keycode SDLK_ASTERISK = 42 -keycode SDLK_PLUS = 43 -keycode SDLK_COMMA = 44 -keycode SDLK_MINUS = 45 -keycode SDLK_PERIOD = 46 -keycode SDLK_SLASH = 47 - -#******************************************** - -keycode SDLK_0 = 48 -keycode SDLK_1 = 49 -keycode SDLK_2 = 50 -keycode SDLK_3 = 51 -keycode SDLK_4 = 52 -keycode SDLK_5 = 53 -keycode SDLK_6 = 54 -keycode SDLK_7 = 55 -keycode SDLK_8 = 56 -keycode SDLK_9 = 57 - -#******************************************** - -keycode SDLK_COLON = 58 -keycode SDLK_SEMICOLON = 59 -keycode SDLK_LESS = 60 -keycode SDLK_EQUALS = 61 -keycode SDLK_GREATER = 62 -keycode SDLK_QUESTION = 63 -keycode SDLK_AT = 64 - -#******************************************** - -keycode SDLK_LEFTBRACKET = 91 -keycode SDLK_BACKSLASH = 92 -keycode SDLK_RIGHTBRACKET = 93 -keycode SDLK_CARET = 94 -keycode SDLK_UNDERSCORE = 95 -keycode SDLK_BACKQUOTE = 96 - -#******************************************** - -keycode SDLK_a = 97 -keycode SDLK_b = 98 -keycode SDLK_c = 99 -keycode SDLK_d = 100 -keycode SDLK_e = 101 -keycode SDLK_f = 102 -keycode SDLK_g = 103 -keycode SDLK_h = 104 -keycode SDLK_i = 105 -keycode SDLK_j = 106 -keycode SDLK_k = 107 -keycode SDLK_l = 108 -keycode SDLK_m = 1 -keycode SDLK_n = 110 -keycode SDLK_o = 111 -keycode SDLK_p = 112 -keycode SDLK_q = 113 -keycode SDLK_r = 114 -keycode SDLK_s = 115 -keycode SDLK_t = 116 -keycode SDLK_u = 117 -keycode SDLK_v = 118 -keycode SDLK_w = 119 -keycode SDLK_x = 120 -keycode SDLK_y = 121 -keycode SDLK_z = 122 -keycode SDLK_DELETE = 127 - -#******************************************** - -keycode SDLK_WORLD_0 = 160 -keycode SDLK_WORLD_1 = 161 -keycode SDLK_WORLD_2 = 162 -keycode SDLK_WORLD_3 = 163 -keycode SDLK_WORLD_4 = 164 -keycode SDLK_WORLD_5 = 165 -keycode SDLK_WORLD_6 = 166 -keycode SDLK_WORLD_7 = 167 -keycode SDLK_WORLD_8 = 168 -keycode SDLK_WORLD_9 = 169 -keycode SDLK_WORLD_10 = 170 -keycode SDLK_WORLD_11 = 171 -keycode SDLK_WORLD_12 = 172 -keycode SDLK_WORLD_13 = 173 -keycode SDLK_WORLD_14 = 174 -keycode SDLK_WORLD_15 = 175 -keycode SDLK_WORLD_16 = 176 -keycode SDLK_WORLD_17 = 177 -keycode SDLK_WORLD_18 = 178 -keycode SDLK_WORLD_19 = 179 -keycode SDLK_WORLD_20 = 180 -keycode SDLK_WORLD_21 = 181 -keycode SDLK_WORLD_22 = 182 -keycode SDLK_WORLD_23 = 183 -keycode SDLK_WORLD_24 = 184 -keycode SDLK_WORLD_25 = 185 -keycode SDLK_WORLD_26 = 186 -keycode SDLK_WORLD_27 = 187 -keycode SDLK_WORLD_28 = 188 -keycode SDLK_WORLD_29 = 189 -keycode SDLK_WORLD_30 = 190 -keycode SDLK_WORLD_31 = 191 -keycode SDLK_WORLD_32 = 192 -keycode SDLK_WORLD_33 = 193 -keycode SDLK_WORLD_34 = 194 -keycode SDLK_WORLD_35 = 195 -keycode SDLK_WORLD_36 = 196 -keycode SDLK_WORLD_37 = 197 -keycode SDLK_WORLD_38 = 198 -keycode SDLK_WORLD_39 = 199 -keycode SDLK_WORLD_40 = 200 -keycode SDLK_WORLD_41 = 201 -keycode SDLK_WORLD_42 = 202 -keycode SDLK_WORLD_43 = 203 -keycode SDLK_WORLD_44 = 204 -keycode SDLK_WORLD_45 = 205 -keycode SDLK_WORLD_46 = 206 -keycode SDLK_WORLD_47 = 207 -keycode SDLK_WORLD_48 = 208 -keycode SDLK_WORLD_49 = 2 -keycode SDLK_WORLD_50 = 210 -keycode SDLK_WORLD_51 = 211 -keycode SDLK_WORLD_52 = 212 -keycode SDLK_WORLD_53 = 213 -keycode SDLK_WORLD_54 = 214 -keycode SDLK_WORLD_55 = 215 -keycode SDLK_WORLD_56 = 216 -keycode SDLK_WORLD_57 = 217 -keycode SDLK_WORLD_58 = 218 -keycode SDLK_WORLD_59 = 219 -keycode SDLK_WORLD_60 = 220 -keycode SDLK_WORLD_61 = 221 -keycode SDLK_WORLD_62 = 222 -keycode SDLK_WORLD_63 = 223 -keycode SDLK_WORLD_64 = 224 -keycode SDLK_WORLD_65 = 225 -keycode SDLK_WORLD_66 = 226 -keycode SDLK_WORLD_67 = 227 -keycode SDLK_WORLD_68 = 228 -keycode SDLK_WORLD_69 = 229 -keycode SDLK_WORLD_70 = 230 -keycode SDLK_WORLD_71 = 231 -keycode SDLK_WORLD_72 = 232 -keycode SDLK_WORLD_73 = 233 -keycode SDLK_WORLD_74 = 234 -keycode SDLK_WORLD_75 = 235 -keycode SDLK_WORLD_76 = 236 -keycode SDLK_WORLD_77 = 237 -keycode SDLK_WORLD_78 = 238 -keycode SDLK_WORLD_79 = 239 -keycode SDLK_WORLD_80 = 240 -keycode SDLK_WORLD_81 = 241 -keycode SDLK_WORLD_82 = 242 -keycode SDLK_WORLD_83 = 243 -keycode SDLK_WORLD_84 = 244 -keycode SDLK_WORLD_85 = 245 -keycode SDLK_WORLD_86 = 246 -keycode SDLK_WORLD_87 = 247 -keycode SDLK_WORLD_88 = 248 -keycode SDLK_WORLD_89 = 249 -keycode SDLK_WORLD_90 = 250 -keycode SDLK_WORLD_91 = 251 -keycode SDLK_WORLD_92 = 252 -keycode SDLK_WORLD_93 = 253 -keycode SDLK_WORLD_94 = 254 -keycode SDLK_WORLD_95 = 255 - -#******************************************** - -keycode SDLK_KP0 = 256 -keycode SDLK_KP1 = 257 -keycode SDLK_KP2 = 258 -keycode SDLK_KP3 = 259 -keycode SDLK_KP4 = 260 -keycode SDLK_KP5 = 261 -keycode SDLK_KP6 = 262 -keycode SDLK_KP7 = 263 -keycode SDLK_KP8 = 264 -keycode SDLK_KP9 = 265 -keycode SDLK_KP_PERIOD = 266 -keycode SDLK_KP_DIVIDE = 267 -keycode SDLK_KP_MULTIPLY = 268 -keycode SDLK_KP_MINUS = 269 -keycode SDLK_KP_PLUS = 270 -keycode SDLK_KP_ENTER = 271 -keycode SDLK_KP_EQUALS = 272 - -#******************************************** - -keycode SDLK_UP = 273 -keycode SDLK_DOWN = 274 -keycode SDLK_RIGHT = 275 -keycode SDLK_LEFT = 276 -keycode SDLK_INSERT = 277 -keycode SDLK_HOME = 278 -keycode SDLK_END = 279 -keycode SDLK_PAGEUP = 280 -keycode SDLK_PAGEDOWN = 281 - -#******************************************** - -keycode SDLK_F1 = 282 -keycode SDLK_F2 = 283 -keycode SDLK_F3 = 284 -keycode SDLK_F4 = 285 -keycode SDLK_F5 = 286 -keycode SDLK_F6 = 287 -keycode SDLK_F7 = 288 -keycode SDLK_F8 = 289 -keycode SDLK_F9 = 290 -keycode SDLK_F10 = 291 -keycode SDLK_F11 = 292 -keycode SDLK_F12 = 293 -keycode SDLK_F13 = 294 -keycode SDLK_F14 = 295 -keycode SDLK_F15 = 296 - -#******************************************** - -keycode SDLK_NUMLOCK = 300 -keycode SDLK_CAPSLOCK = 301 -keycode SDLK_SCROLLOCK = 302 -keycode SDLK_RSHIFT = 303 -keycode SDLK_LSHIFT = 304 -keycode SDLK_RCTRL = 305 -keycode SDLK_LCTRL = 306 -keycode SDLK_RALT = 307 -keycode SDLK_LALT = 308 -keycode SDLK_RMETA = 3 -keycode SDLK_LMETA = 310 -keycode SDLK_LSUPER = 311 -keycode SDLK_RSUPER = 312 -keycode SDLK_MODE = 313 -keycode SDLK_COMPOSE = 314 - -#******************************************** - -keycode SDLK_HELP = 315 -keycode SDLK_PRINT = 316 -keycode SDLK_SYSREQ = 317 -keycode SDLK_BREAK = 318 -keycode SDLK_MENU = 319 -keycode SDLK_POWER = 320 -keycode SDLK_EURO = 321 -keycode SDLK_UNDO = 322 - -#******************************************** - -TUX_RIGHT_MOVE_UP = SDLK_KP8 SDLK_UP -TUX_RIGHT_MOVE_RIGHT = SDLK_KP6 SDLK_RIGHT -TUX_RIGHT_MOVE_LEFT = SDLK_KP4 SDLK_LEFT -TUX_RIGHT_MOVE_DOWN = SDLK_KP5 SDLK_DOWN -TUX_RIGHT_SHOOT = SDLK_KP0 -TUX_RIGHT_SWITCH_WEAPON = SDLK_KP1 - -TUX_LEFT_MOVE_UP = SDLK_w -TUX_LEFT_MOVE_RIGHT = SDLK_d -TUX_LEFT_MOVE_LEFT = SDLK_a -TUX_LEFT_MOVE_DOWN = SDLK_s -TUX_LEFT_SHOOT = SDLK_q -TUX_LEFT_SWITCH_WEAPON = SDLK_TAB - -#******************************************** diff --git a/include/item.h b/include/item.h index b2c8098..ad390a1 100644 --- a/include/item.h +++ b/include/item.h @@ -4,11 +4,16 @@ #define ITEM_H #include "main.h" + +#define ITEM_SYNC_TIMEOUT 5000 + #ifndef PUBLIC_SERVER #include "interface.h" #endif + #include "list.h" #include "tux.h" +#include "myTimer.h" typedef struct item_struct { @@ -23,6 +28,7 @@ typedef struct item_struct int frame; //poradove cislo animacie int count; + my_time_t lastSync; tux_t *author; #ifndef PUBLIC_SERVER diff --git a/include/language.h b/include/language.h index 03f13e7..23fc1a4 100644 --- a/include/language.h +++ b/include/language.h @@ -3,8 +3,10 @@ #define LANGUAGE_H -extern void initLanguage(); +extern int initLanguage(); extern char* getMyText(char *key); +extern char* getLanguageFont(); +extern int getLanguageSize(); extern void quitLanguage(); #endif diff --git a/include/server.h b/include/server.h index bf7a1e9..f865282 100644 --- a/include/server.h +++ b/include/server.h @@ -37,15 +37,16 @@ typedef struct client_struct { #ifdef SUPPORT_NET_UNIX_UDP sock_udp_t *socket_udp; - my_time_t lastPing; #endif #ifdef SUPPORT_NET_SDL_UDP sock_sdl_udp_t *socket_sdl_udp; - my_time_t lastPing; #endif int status; tux_t *tux; + my_time_t lastPing; + my_time_t lastEvent; + buffer_t *buffer; } client_t; diff --git a/include/tux.h b/include/tux.h index 8767afa..fbe4ecc 100644 --- a/include/tux.h +++ b/include/tux.h @@ -12,7 +12,7 @@ #define TUX_MAX_ANIMATION_FRAME 10 #define TUX_KEY 1 -#define TUX_LOCATE_UNKNOWN -1 +#define TUX_LOCATE_UNKNOWN -100 #define TUX_MAX_PICKUP 50 #define TUX_MAX_BONUS 500 @@ -23,6 +23,7 @@ #define TUX_STATUS_ALIVE 0 #define TUX_STATUS_DEAD 1 +#define TUX_STATUS_PAUZED 2 #define TUX_CONTROL_NONE 0 #define TUX_CONTROL_KEYBOARD_LEFT 1 diff --git a/lang/cs.lang b/lang/cs.lang index b364e6f..f283411 100644 --- a/lang/cs.lang +++ b/lang/cs.lang @@ -8,6 +8,8 @@ AUTHOR xHire AUTHOR_EMAIL xhire@tuxportal.cz AUTHOR_JABBER Miczek@gmail.com +HEAD fontfile="DejaVuSans.ttf" fontsize="16" + # general OK Ok BACK Zpět diff --git a/lang/en.lang b/lang/en.lang index 8d567a3..6cb6dd8 100644 --- a/lang/en.lang +++ b/lang/en.lang @@ -8,6 +8,8 @@ AUTHOR Oroborus AUTHOR_EMAIL dusan.d@centrum.sk AUTHOR_JABBER oroborus@jabbim.sk +HEAD fontfile="DejaVuSans.ttf" fontsize="16" + # general OK Ok BACK Back diff --git a/lang/sk.lang b/lang/sk.lang index 4255be2..3ae922d 100644 --- a/lang/sk.lang +++ b/lang/sk.lang @@ -8,6 +8,8 @@ AUTHOR Oroborus AUTHOR_EMAIL dusan.d@centrum.sk AUTHOR_JABBER oroborus@jabbim.sk +HEAD fontfile="DejaVuSans.ttf" fontsize="16" + # general OK Ok BACK Späť diff --git a/src/client.c b/src/client.c index 8e5aae3..612a5b4 100644 --- a/src/client.c +++ b/src/client.c @@ -15,11 +15,6 @@ static int protocolType; -#ifdef SUPPORT_NET_UNIX_TCP -#include "tcp.h" -static sock_tcp_t *sock_server_tcp; -#endif - #ifdef SUPPORT_NET_UNIX_UDP #include "udp.h" static sock_udp_t *sock_server_udp; @@ -46,27 +41,6 @@ static void initClient() proto_send_hello_client(name); } -#ifdef SUPPORT_NET_UNIX_TCP - -int initTcpClient(char *ip, int port) -{ - sock_server_tcp = connectTcpSocket(ip, port); - - if( sock_server_tcp == NULL ) - { - return -1; - } - - printf("connect TCP %s %d\n", ip, port); - - protocolType = NET_PROTOCOL_TYPE_TCP; - initClient(); - - return 0; -} - -#endif - #ifdef SUPPORT_NET_UNIX_UDP int initUdpClient(char *ip, int port) @@ -115,22 +89,6 @@ void sendServer(char *msg) assert( msg != NULL ); -#ifdef SUPPORT_NET_UNIX_TCP - ret = writeTcpSocket(sock_server_tcp, msg, strlen(msg)); - - if ( ret == 0 ) - { - fprintf(stderr, "server uzatvoril sietovy socket\n"); - setWorldEnd(); - } - - if ( ret < 0 ) - { - fprintf(stderr, "nastala chyba pri poslani spravy serveru\n"); - setWorldEnd(); - } -#endif - #ifdef SUPPORT_NET_UNIX_UDP ret = writeUdpSocket(sock_server_udp, sock_server_udp, msg, strlen(msg)); #endif @@ -151,24 +109,6 @@ static int eventServerSelect() memset(buffer,0 ,STR_PROTO_SIZE); -#ifdef SUPPORT_NET_UNIX_TCP - ret = readTcpSocket(sock_server_tcp, buffer, STR_PROTO_SIZE-1); - - if( ret == 0 ) - { - fprintf(stderr, "server uzatovril sietovy socket\n"); - setWorldEnd(); - return ret; - } - - if( ret < 0 ) - { - fprintf(stderr, "chyba, spojenie prerusene \n"); - setWorldEnd(); - return ret; - } -#endif - #ifdef SUPPORT_NET_UNIX_UDP ret = readUdpSocket(sock_server_udp, sock_server_udp, buffer, STR_PROTO_SIZE-1); #endif @@ -205,6 +145,7 @@ void eventServerBuffer() #ifdef DEBUG_CLIENT_RECV printf("recv server msg->%s", line); #endif + if( strncmp(line, "error", 5) == 0 )proto_recv_error_client(line); if( strncmp(line, "init", 4) == 0 )proto_recv_init_client(line); if( strncmp(line, "event", 5) == 0 )proto_recv_event_client(line); @@ -218,45 +159,10 @@ void eventServerBuffer() if( strncmp(line, "ping", 4) == 0 )proto_recv_ping_client(line); if( strncmp(line, "end", 3) == 0 )proto_recv_end_client(line); -#if defined SUPPORT_NET_UNIX_UDP || defined SUPPORT_NET_SDL_UDP lastPingServerAlive = getMyTime(); -#endif } } -#ifdef SUPPORT_NET_UNIX_TCP - -void selectClientTcpSocket() -{ - fd_set readfds; - struct timeval tv; - int max_fd; - bool_t isNext; - - do{ - isNext = FALSE; - - tv.tv_sec = 0; - tv.tv_usec = 0; - - FD_ZERO(&readfds); - FD_SET(sock_server_tcp->sock, &readfds); - max_fd = sock_server_tcp->sock; - - select(max_fd+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &tv); - - if( FD_ISSET(sock_server_tcp->sock, &readfds) ) - { - eventServerSelect(); - isNext = TRUE; - } - - }while( isNext == TRUE ); -} - -#endif - -#if defined SUPPORT_NET_UNIX_UDP || defined SUPPORT_NET_SDL_UDP void eventPingServer() { @@ -285,8 +191,6 @@ bool_t isServerAlive() return TRUE; } -#endif - #ifdef SUPPORT_NET_UNIX_UDP void selectClientUdpSocket() @@ -354,20 +258,6 @@ static void quitClient() destroyBuffer(clientBuffer); } -#ifdef SUPPORT_NET_UNIX_TCP - -void quitTcpClient() -{ - quitClient(); - - assert( sock_server_tcp != NULL ); - closeTcpSocket(sock_server_tcp); - - printf("quit TCP conenct\n"); -} - -#endif - #ifdef SUPPORT_NET_UNIX_UDP void quitUdpClient() diff --git a/src/gun.c b/src/gun.c index fbbeeb3..b46b995 100644 --- a/src/gun.c +++ b/src/gun.c @@ -60,11 +60,6 @@ static void addShotTrivial(tux_t *tux, int x, int y, int px, int py, int gun) int dest_px = 0, dest_py = 0; shot_t *shot; - if( getNetTypeGame() == NET_GAME_TYPE_CLIENT ) - { - return; - } - modificiationCopuse(tux->position, px, py, &dest_px, &dest_py); modificiationCopuse(tux->position, x, y, &dest_x, &dest_y); @@ -96,6 +91,11 @@ static void addShot(tux_t *tux,int x, int y, int px, int py) { int gun; + if( getNetTypeGame() == NET_GAME_TYPE_CLIENT ) + { + return; + } + if( tux->gun == GUN_LASSER ) { gun = GUN_LASSER; @@ -253,7 +253,6 @@ static void putInGunMine(tux_t *tux) appendTextInTerm(msg); #endif - tux->shot[tux->gun]--; if( getNetTypeGame() != NET_GAME_TYPE_CLIENT ) diff --git a/src/item.c b/src/item.c index 22691e6..373189e 100644 --- a/src/item.c +++ b/src/item.c @@ -76,6 +76,7 @@ item_t* newItem(int x, int y, int type, tux_t *author) new->img = g_item[type]; #endif new->author = author; + new->lastSync = getMyTime(); switch( type ) { @@ -242,9 +243,12 @@ void drawListItem(list_t *listItem) void eventListItem(list_t *listItem) { + my_time_t currentTime; item_t *thisItem; int i; + currentTime = getMyTime(); + assert( listItem != NULL ); for( i = 0 ; i < listItem->count ; i++ ) @@ -252,6 +256,16 @@ void eventListItem(list_t *listItem) thisItem = (item_t *)listItem->list[i]; assert( thisItem != NULL ); + if( getNetTypeGame() == NET_GAME_TYPE_CLIENT ) + { + if( currentTime - thisItem->lastSync > ITEM_SYNC_TIMEOUT ) + { + delListItem(listItem, i, destroyItem); + i--; + continue; + } + } + thisItem->count++; if( thisItem->count == ITEM_MAX_COUNT ) diff --git a/src/keytable.c b/src/keytable.c index 7e2ed0e..db4aa02 100644 --- a/src/keytable.c +++ b/src/keytable.c @@ -46,7 +46,7 @@ void initKeyTable() /* int i; */ - sprintf(path, PATH_DATA "keytable.conf"); + sprintf(path, PATH_CONFIG "keytable.conf"); keytableFile = loadTextFile(path); if( keytableFile == NULL ) diff --git a/src/language.c b/src/language.c index 51a7d5b..5291f44 100644 --- a/src/language.c +++ b/src/language.c @@ -8,15 +8,38 @@ #include "list.h" #include "homeDirector.h" #include "textFile.h" +#include "configFile.h" #include "language.h" static textFile_t *languageFile; +static char fontFile[STR_FILE_NAME_SIZE]; +static int fontSize; -void initLanguage() +char* getHead(textFile_t *ts) +{ + int i; + + for( i = 0 ; i < ts->text->count ; i++ ) + { + char *line; + line = (char *) (ts->text->list[i]); + + if( strncmp(line, "HEAD", 4) == 0 ) + { + return line; + } + } + + return NULL; +} + + +int initLanguage() { textFile_t *languageTypeFile; char path[STR_PATH_SIZE]; char *lang; + char *head; sprintf(path, "%s/lang.conf", getHomeDirector()); languageTypeFile = loadTextFile(path); @@ -34,25 +57,60 @@ void initLanguage() if( languageTypeFile == NULL ) { fprintf(stderr, "Don't create %s\n", path); - return; + return -1; } if( languageTypeFile->text->count == 0 ) { fprintf(stderr, "File %s empty\n", path); - return; + return -1; } lang = ((char *)languageTypeFile->text->list[0]); printf("select lang %s\n", lang); - sprintf(path, PATH_DATA "lang.%s", lang); + sprintf(path, PATH_LANG "%s.lang", lang); languageFile = loadTextFile(path); if( languageFile == NULL ) { fprintf(stderr, "Don't load %s\n", path); + return -1; + } + + head = getHead(languageFile); + + if( head != NULL ) + { + char val[STR_SIZE]; + + if( getValue(head, "fontfile", val, STR_SIZE) == 0 ) + { + strcpy(fontFile, val); + } + else + { + fprintf(stderr, "fontfile in lang file %s not found\n", path); + return -1; + } + + if( getValue(head, "fontsize", val, STR_SIZE) == 0 ) + { + fontSize = atoi(val); + } + else + { + fprintf(stderr, "fontsize in lang file %s not found\n", path); + return -1; + } } + else + { + fprintf(stderr, "head in lang file %s not found\n", path); + return -1; + } + + return 0; } char* getMyText(char *key) @@ -76,6 +134,16 @@ char* getMyText(char *key) return NULL; } +char* getLanguageFont() +{ + return fontFile; +} + +int getLanguageSize() +{ + return fontSize; +} + void quitLanguage() { destroyTextFile(languageFile); diff --git a/src/main.c b/src/main.c index e77f044..0978f89 100644 --- a/src/main.c +++ b/src/main.c @@ -45,11 +45,17 @@ static void init() { createHomeDirector(); + if( initLanguage() == -1 ) + { + printf("fatal error !\n"); + exit(-1); + } + initSDL(); + initLayer(); - initFont("DejaVuSans.ttf", 16); + initFont(getLanguageFont(), getLanguageSize()); initKeyTable(); - initLanguage(); initImageData(); initAudio(); initSound(); diff --git a/src/proto.c b/src/proto.c index a646d9c..042ce7f 100644 --- a/src/proto.c +++ b/src/proto.c @@ -254,6 +254,7 @@ void proto_recv_event_server(client_t *client, char *msg) assert( client != NULL ); assert( msg != NULL ); + sscanf(msg, "%s %d", cmd, &action); proto_send_event_server(PROTO_SEND_BUT, client, client->tux, action); @@ -488,8 +489,9 @@ void proto_recv_additem_client(char *msg) sscanf(msg, "%s %d %d %d %d %d %d %d", cmd, &id, &type, &x, &y, &count, &frame, &author_id); - if( getItemID(getCurrentArena()->listItem, id) != NULL ) + if( ( item = getItemID(getCurrentArena()->listItem, id) ) != NULL ) { + item->lastSync = getMyTime(); return; } @@ -504,6 +506,7 @@ void proto_recv_additem_client(char *msg) item->id = id; item->count = count; item->frame = frame; + item->lastSync = getMyTime(); addList(getCurrentArena()->listItem, item); diff --git a/src/screen_world.c b/src/screen_world.c index 02536de..589161e 100644 --- a/src/screen_world.c +++ b/src/screen_world.c @@ -210,9 +210,27 @@ static void netAction(tux_t *tux, int action) static void control_keyboard_right(tux_t *tux) { +/* + static my_time_t lastTime = 0; + my_time_t currentTime; +*/ Uint8 *mapa; mapa = SDL_GetKeyState(NULL); +/* + if( lastTime == 0 ) + { + lastTime = getMyTime(); + } + + currentTime = getMyTime(); + if( currentTime - lastTime < 45 ) + { + return; + } + + lastTime = getMyTime(); +*/ assert( tux != NULL ); assert( mapa != NULL ); diff --git a/src/server.c b/src/server.c index 5c11781..f3972d3 100644 --- a/src/server.c +++ b/src/server.c @@ -29,11 +29,6 @@ #include "publicServer.h" #endif -#ifdef SUPPORT_NET_UNIX_TCP -#include "tcp.h" -static sock_tcp_t *sock_server_tcp; -#endif - #ifdef SUPPORT_NET_UNIX_UDP #include "udp.h" static sock_udp_t *sock_server_udp; @@ -49,8 +44,6 @@ static list_t *listServerTimer; static my_time_t lastSyncClient; static int maxClients; -#if defined SUPPORT_NET_UNIX_UDP || defined SUPPORT_NET_SDL_UDP - static void delZombieCLient(void *p_nothink) { client_t *thisClient; @@ -83,14 +76,21 @@ static void delZombieCLient(void *p_nothink) static void eventPeriodicSyncClient(void *p_nothink) { - my_time_t currentTime; client_t *thisClientInfo; client_t *thisClientSend; + item_t *thisItem; tux_t *thisTux; int i, j; - currentTime = getMyTime(); - + for( i = 0 ; i < getCurrentArena()->listItem->count; i++) + { + thisItem = (item_t *) getCurrentArena()->listItem->list[i]; + + if( thisItem->type != ITEM_EXPLOSION || thisItem->type != ITEM_BIG_EXPLOSION ) + { + proto_send_additem_server(PROTO_SEND_ALL, NULL, thisItem); + } + } for( i = 0 ; i < listClient->count; i++) { @@ -126,8 +126,6 @@ static void eventSendPingClients(void *p_nothink) proto_send_ping_server(PROTO_SEND_ALL, NULL); } -#endif - void static initServer() { listClient = newList(); @@ -186,6 +184,8 @@ static client_t* newAnyClient() new->status = NET_STATUS_OK; new->buffer = newBuffer(LIMIT_BUFFER); + new->lastPing = getMyTime(); + new->lastEvent = getMyTime(); return new; } @@ -202,7 +202,6 @@ client_t* newUdpClient(sock_udp_t *sock_udp) printf("new client from %s:%d\n", str_ip, getSockUdpPort(sock_udp)); new = newAnyClient(); - new->lastPing = getMyTime(); new->socket_udp = sock_udp; return new; @@ -218,7 +217,6 @@ client_t* newSdlUdpClient(sock_sdl_udp_t *sock_sdl_udp) printf("new client from %d\n", getSockSdlUdpPort(sock_sdl_udp)); new = newAnyClient(); - new->lastPing = getMyTime(); new->socket_sdl_udp = sock_sdl_udp; return new; diff --git a/src/tux.c b/src/tux.c index 2069978..3b14427 100644 --- a/src/tux.c +++ b/src/tux.c @@ -87,7 +87,7 @@ tux_t* newTux() new->gun = GUN_SIMPLE; new->shot[ new->gun ] = GUN_MAX_SHOT; - sprintf(new->name, "no_name_id_%dde", new->id); + sprintf(new->name, "no_name_id_%d", new->id); new->score = 0; new->frame = 0; @@ -155,14 +155,14 @@ void drawTux(tux_t *tux) SDL_Surface *g_image = NULL; assert( tux != NULL ); -/* + if( tux->bonus == BONUS_HIDDEN && getNetTypeGame() != NET_GAME_TYPE_NONE && tux->control == TUX_CONTROL_NET ) { return; } -*/ + switch( tux->position ) { case TUX_UP : @@ -528,6 +528,22 @@ void moveTux(tux_t *tux, int n) int x, y, w, h; arena_t *arena; +/* + static my_time_t lastTime = 0; + my_time_t currentTime; + + if( lastTime == 0 ) + { + lastTime = getMyTime(); + } + + currentTime = getMyTime(); + + printf("%d\n", currentTime - lastTime ); + + lastTime = getMyTime(); +*/ + assert( tux != NULL ); if( tux->position != n ) @@ -668,7 +684,7 @@ void shotTux(tux_t *tux) void actionTux(tux_t *tux, int action) { - if( tux->status != TUX_STATUS_ALIVE ) + if( tux->status == TUX_STATUS_DEAD ) { return; } -- cgit v1.2.3