diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-04-04 18:46:15 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-04-04 18:46:15 +0000 |
| commit | 6dbcded21e7e9614b967b922987be6bcf3f3fe58 (patch) | |
| tree | cfa806296d8880c4136681c5cb96d06a2e856eb0 /src/screen_world.c | |
| parent | 617ba439aab5f1798eb02618dfcfbed80a5baf28 (diff) | |
- moznost nastavit si klavesy na ovladanie v ~/.tuxanci-ng/keycontrol.conf
- moznost prekladat texty do roznych jazykov, defult jazyk je EN, nastavenie je v ~/.tuxanci-ng/lang.conf
- moznost nastavit server pomocou konfiguraku ./server.conf
- uptime v sekudach a samorestartovaci casocvac tam este _NIE_ _JE_
git-svn-id: http://opensvn.csie.org/tuxanci_ng@39 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/screen_world.c')
| -rw-r--r-- | src/screen_world.c | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/src/screen_world.c b/src/screen_world.c index 571b10e..02536de 100644 --- a/src/screen_world.c +++ b/src/screen_world.c @@ -13,6 +13,7 @@ #include "screen_choiceArena.h" #include "screen_table.h" +#include "keytable.h" #include "list.h" #include "layer.h" #include "image.h" @@ -32,11 +33,12 @@ #include "arenaFile.h" #include "proto.h" #include "term.h" +#include "font.h" static arena_t *arena; static int count; static int max_count; - +static my_time_t lastServerLag; static bool_t isScreenWorldInit = FALSE; static bool_t isEndWorld; @@ -70,6 +72,11 @@ void setMaxCountRound(int n) max_count = n; } +void setLagServer(my_time_t lag) +{ + lastServerLag = lag; +} + void setWorldEnd() { isEndWorld = TRUE; @@ -98,7 +105,7 @@ void countRoundInc() { printf("count %d ending\n", count); playSound("end", SOUND_GROUP_BASE); - addTimer(getCurrentArena()->listTimer, timer_endArena, NULL, TIMER_END_ARENA); + addTaskToTimer(getCurrentArena()->listTimer, TIMER_ONE, timer_endArena, NULL, TIMER_END_ARENA); } } @@ -158,6 +165,25 @@ void prepareArena() } } +/* +static void drawServerLag() +{ + char msg[STR_SIZE]; + + if( lastServerLag == LAG_SERVER_UNKNOWN ) + { + sprintf(msg, "lag server: unknown"); + } + else + { + sprintf(msg, "lag server: %d", lastServerLag); + } + + drawFont(msg, WINDOW_SIZE_X-150, 20, COLOR_WHITE); + +} +*/ + void drawWorld() { if( arena != NULL ) @@ -190,37 +216,37 @@ static void control_keyboard_right(tux_t *tux) assert( tux != NULL ); assert( mapa != NULL ); - if( mapa[(SDLKey)SDLK_UP] == SDL_PRESSED ) + if( mapa[(SDLKey)getKey(KEY_TUX_RIGHT_MOVE_UP)] == SDL_PRESSED ) { netAction(tux, TUX_UP); actionTux(tux, TUX_UP); } - if( mapa[(SDLKey)SDLK_RIGHT] == SDL_PRESSED ) + if( mapa[(SDLKey)getKey(KEY_TUX_RIGHT_MOVE_RIGHT)] == SDL_PRESSED ) { netAction(tux, TUX_RIGHT); actionTux(tux, TUX_RIGHT); } - if( mapa[(SDLKey)SDLK_LEFT] == SDL_PRESSED ) + if( mapa[(SDLKey)getKey(KEY_TUX_RIGHT_MOVE_LEFT)] == SDL_PRESSED ) { netAction(tux, TUX_LEFT); actionTux(tux, TUX_LEFT); } - if( mapa[(SDLKey)SDLK_DOWN] == SDL_PRESSED ) + if( mapa[(SDLKey)getKey(KEY_TUX_RIGHT_MOVE_DOWN)] == SDL_PRESSED ) { netAction(tux, TUX_DOWN); actionTux(tux, TUX_DOWN); } - if( mapa[(SDLKey)SDLK_KP0] == SDL_PRESSED && tux->isCanShot == TRUE ) + if( mapa[(SDLKey)getKey(KEY_TUX_RIGHT_SHOOT)] == SDL_PRESSED && tux->isCanShot == TRUE ) { netAction(tux, TUX_SHOT); actionTux(tux, TUX_SHOT); } - if( mapa[(SDLKey)SDLK_KP1] == SDL_PRESSED ) + if( mapa[(SDLKey)getKey(KEY_TUX_RIGHT_SWITCH_WEAPON)] == SDL_PRESSED ) { if( tux->isCanSwitchGun == TRUE ) { @@ -238,17 +264,16 @@ static void control_keyboard_left(tux_t *tux) assert( tux != NULL ); assert( mapa != NULL ); - if( mapa[(SDLKey)SDLK_w] == SDL_PRESSED )actionTux(tux, TUX_UP); - if( mapa[(SDLKey)SDLK_d] == SDL_PRESSED )actionTux(tux, TUX_RIGHT); - if( mapa[(SDLKey)SDLK_a] == SDL_PRESSED )actionTux(tux, TUX_LEFT); - if( mapa[(SDLKey)SDLK_s] == SDL_PRESSED )actionTux(tux, TUX_DOWN); - if( mapa[(SDLKey)SDLK_q] == SDL_PRESSED )actionTux(tux, TUX_SHOT); + if( mapa[(SDLKey)getKey(KEY_TUX_LEFT_MOVE_UP)] == SDL_PRESSED )actionTux(tux, TUX_UP); + if( mapa[(SDLKey)getKey(KEY_TUX_LEFT_MOVE_RIGHT)] == SDL_PRESSED )actionTux(tux, TUX_RIGHT); + if( mapa[(SDLKey)getKey(KEY_TUX_LEFT_MOVE_LEFT)] == SDL_PRESSED )actionTux(tux, TUX_LEFT); + if( mapa[(SDLKey)getKey(KEY_TUX_LEFT_MOVE_DOWN)] == SDL_PRESSED )actionTux(tux, TUX_DOWN); + if( mapa[(SDLKey)getKey(KEY_TUX_LEFT_SHOOT)] == SDL_PRESSED )actionTux(tux, TUX_SHOT); - if( mapa[(SDLKey)SDLK_TAB] == SDL_PRESSED ) + if( mapa[(SDLKey)getKey(KEY_TUX_LEFT_SWITCH_WEAPON)] == SDL_PRESSED ) { if( tux->isCanSwitchGun == TRUE ) { - netAction(tux, TUX_SWITCH_GUN); actionTux(tux, TUX_SWITCH_GUN); } } @@ -326,6 +351,7 @@ void startWorld() isEndWorld = FALSE; count = 0; + lastServerLag = LAG_SERVER_UNKNOWN; setGameType(); initTerm(); |