From 6ed79c5de77b3f6be5c297cb5432d123ff1ff177 Mon Sep 17 00:00:00 2001 From: oroborus Date: Sat, 5 Jul 2008 15:56:13 +0000 Subject: - miny sa nezobrazuju na radare - tux moze chodit strielat a zmenit zbran sucastne - master server sa pouziga ten na "ms.tuxanci.org" - AI sa nastavuje v GUI ako v TFG git-svn-id: http://opensvn.csie.org/tuxanci_ng@93 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/screen/screen_world.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'src/screen/screen_world.c') diff --git a/src/screen/screen_world.c b/src/screen/screen_world.c index 380fd43..91820ff 100644 --- a/src/screen/screen_world.c +++ b/src/screen/screen_world.c @@ -148,10 +148,12 @@ void prepareArena() getSettingNameLeft(tux->name); addObjectToSpace(arena->spaceTux, tux); - if( strcmp(getSettingAI(), "none") != 0 ) + if( isSettingAI() ) { - loadModule( getSettingAI() ); - tux->control = TUX_CONTROL_AI; + if( loadModule("modAI.so") == 0 ) + { + tux->control = TUX_CONTROL_AI; + } } break; @@ -237,6 +239,16 @@ static void control_keyboard_right(tux_t *tux) if( mapa[(SDLKey)getKey(KEY_TUX_RIGHT_MOVE_LEFT)] == SDL_PRESSED )countKey++; if( mapa[(SDLKey)getKey(KEY_TUX_RIGHT_MOVE_DOWN)] == SDL_PRESSED )countKey++; + if( mapa[(SDLKey)getKey(KEY_TUX_RIGHT_SWITCH_WEAPON)] == SDL_PRESSED ) + { + if( tux->isCanSwitchGun == TRUE ) + { + netAction(tux, TUX_SWITCH_GUN); + actionTux(tux, TUX_SWITCH_GUN); + return; + } + } + if( mapa[(SDLKey)getKey(KEY_TUX_RIGHT_SHOOT)] == SDL_PRESSED && tux->isCanShot == TRUE ) { netAction(tux, TUX_SHOT); @@ -292,16 +304,6 @@ static void control_keyboard_right(tux_t *tux) tuDown:; } - - if( mapa[(SDLKey)getKey(KEY_TUX_RIGHT_SWITCH_WEAPON)] == SDL_PRESSED ) - { - if( tux->isCanSwitchGun == TRUE ) - { - netAction(tux, TUX_SWITCH_GUN); - actionTux(tux, TUX_SWITCH_GUN); - return; - } - } } static void control_keyboard_left(tux_t *tux) @@ -321,6 +323,15 @@ static void control_keyboard_left(tux_t *tux) if( mapa[(SDLKey)getKey(KEY_TUX_LEFT_MOVE_LEFT)] == SDL_PRESSED )countKey++; if( mapa[(SDLKey)getKey(KEY_TUX_LEFT_MOVE_DOWN)] == SDL_PRESSED )countKey++; + if( mapa[(SDLKey)getKey(KEY_TUX_LEFT_SWITCH_WEAPON)] == SDL_PRESSED ) + { + if( tux->isCanSwitchGun == TRUE ) + { + actionTux(tux, TUX_SWITCH_GUN); + return; + } + } + if( mapa[(SDLKey)getKey(KEY_TUX_LEFT_SHOOT)] == SDL_PRESSED && tux->isCanShot == TRUE ) { actionTux(tux, TUX_SHOT); @@ -372,14 +383,6 @@ static void control_keyboard_left(tux_t *tux) tuDown:; } - if( mapa[(SDLKey)getKey(KEY_TUX_LEFT_SWITCH_WEAPON)] == SDL_PRESSED ) - { - if( tux->isCanSwitchGun == TRUE ) - { - actionTux(tux, TUX_SWITCH_GUN); - return; - } - } /* 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); -- cgit v1.2.3