summaryrefslogtreecommitdiff
path: root/src/screen/screen_world.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/screen/screen_world.c')
-rw-r--r--src/screen/screen_world.c45
1 files changed, 24 insertions, 21 deletions
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);