summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/Makefile8
-rw-r--r--src/arena.c11
-rw-r--r--src/client.c1
-rw-r--r--src/gun.c14
-rwxr-xr-xsrc/interface.c16
-rw-r--r--src/item.c24
-rw-r--r--src/panel.c1
-rw-r--r--src/pipe.c21
-rw-r--r--src/proto.c59
-rw-r--r--src/screen_setting.c2
-rw-r--r--src/server.c13
-rw-r--r--src/shot.c103
-rw-r--r--src/tux.c61
-rw-r--r--src/wall.c8
14 files changed, 302 insertions, 40 deletions
diff --git a/src/Makefile b/src/Makefile
index 532132a..8661603 100755
--- a/src/Makefile
+++ b/src/Makefile
@@ -6,7 +6,7 @@ CC = gcc
CFLAGS = -g -O0 -I../include -Wall `sdl-config --cflags`
#CFLAGS = -O2 -DDESTDIR=\"$(DESTDIR)\" `sdl-config --cflags` -I../include -Wall
-BUILD_DIR = ../build
+BUILD_DIR = .
LIBS = `sdl-config --libs` -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL_net
FILES = interface.o font.o list.o image.o layer.o director.o configFile.o tux.o main.o \
@@ -17,11 +17,9 @@ FILES = interface.o font.o list.o image.o layer.o director.o configFile.o tux.o
widget_buttonimage.o screen_credits.o teleport.o pipe.o homeDirector.o screen_table.o \
sdl_udp.o proto.o server.o client.o term.o keytable.o language.o
-tuxanci-ng: mkdir_build $(FILES)
+tuxanci-ng: $(FILES)
$(CC) $(CFLAGS) $(LIBS) -o $(BUILD_DIR)/tuxanci-ng $(BUILD_DIR)/*.o
-mkdir_build:
- mkdir -p $(BUILD_DIR)
main.o: main.c
$(CC) $(CFLAGS) -o $(BUILD_DIR)/main.o -c main.c
@@ -180,4 +178,4 @@ language.o: language.c ../include/language.h
$(CC) $(CFLAGS) -o $(BUILD_DIR)/language.o -c language.c
clean:
- rm -rf $(BUILD_DIR) *.c~ ../include/*.h~ Makefile~
+ rm -rf *.o *.c~ ../include/*.h~ Makefile~
diff --git a/src/arena.c b/src/arena.c
index 760c51b..b762937 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -139,6 +139,17 @@ void eventArena(arena_t *arena)
eventTimer(arena->listTimer);
}
+int isConflictWithObjectInArena(arena_t *arena, int x, int y, int w, int h)
+{
+ if( isConflictWithListWall(arena->listWall, x, y, w, h) ||
+ isConflictWithListPipe(arena->listPipe, x, y, w, h) )
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
void destroyArena(arena_t *p)
{
destroyListItem(p->listTux, destroyTux);
diff --git a/src/client.c b/src/client.c
index 612a5b4..a047a2a 100644
--- a/src/client.c
+++ b/src/client.c
@@ -154,6 +154,7 @@ void eventServerBuffer()
if( strncmp(line, "additem", 7) == 0 )proto_recv_additem_client(line);
if( strncmp(line, "item", 4) == 0 )proto_recv_item_client(line);
if( strncmp(line, "shot", 4) == 0 )proto_recv_shot_client(line);
+ if( strncmp(line, "delshot", 7) == 0 )proto_recv_delshot_client(line);
if( strncmp(line, "kill", 4) == 0 )proto_recv_kill_client(line);
if( strncmp(line, "score", 5) == 0 )proto_recv_score_client(line);
if( strncmp(line, "ping", 4) == 0 )proto_recv_ping_client(line);
diff --git a/src/gun.c b/src/gun.c
index b46b995..a055440 100644
--- a/src/gun.c
+++ b/src/gun.c
@@ -96,7 +96,11 @@ static void addShot(tux_t *tux,int x, int y, int px, int py)
return;
}
- if( tux->gun == GUN_LASSER )
+ if( tux->gun == GUN_BOMBBALL )
+ {
+ gun = GUN_BOMBBALL;
+ }
+ else if( tux->gun == GUN_LASSER )
{
gun = GUN_LASSER;
}
@@ -269,6 +273,11 @@ static void putInGunMine(tux_t *tux)
}
}
+static void shotInGunBombball(tux_t *tux)
+{
+ addShot(tux, 0, 0, +10, 0);
+}
+
void shotInGun(tux_t *tux)
{
if( tux->bonus != BONUS_SHOT && tux->gun != GUN_MINE )
@@ -308,6 +317,9 @@ void shotInGun(tux_t *tux)
#endif
shotInGunLasser(tux);
break;
+ case GUN_BOMBBALL :
+ shotInGunBombball(tux);
+ break;
case GUN_MINE :
putInGunMine(tux);
break;
diff --git a/src/interface.c b/src/interface.c
index d629c5b..9e0d6bf 100755
--- a/src/interface.c
+++ b/src/interface.c
@@ -122,6 +122,22 @@ int isMouseClicked()
return SDL_GetMouseState(NULL,NULL) & SDL_BUTTON(SDL_BUTTON_LEFT);
}
+int isPessAnyKey()
+{
+ Uint8 *mapa;
+ int i;
+
+ mapa = SDL_GetKeyState(NULL);
+
+ for( i = SDLK_BACKSPACE ; i < SDLK_KP9 ; i++ )
+ if( mapa[i] == SDL_PRESSED )
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
/*
static void action_esc()
{
diff --git a/src/item.c b/src/item.c
index 373189e..38490f9 100644
--- a/src/item.c
+++ b/src/item.c
@@ -43,6 +43,8 @@ void initItem()
g_item[GUN_SCATTER] = addImageData("item.scatter.png", IMAGE_ALPHA, "item_scatter_simple", IMAGE_GROUP_BASE);
g_item[GUN_LASSER] = addImageData("item.lasser.png", IMAGE_ALPHA, "item_lasser_simple", IMAGE_GROUP_BASE);
g_item[GUN_MINE] = addImageData("item.mine.png", IMAGE_ALPHA, "item_mines_simple", IMAGE_GROUP_BASE);
+ g_item[GUN_BOMBBALL] = addImageData("item.bombball.png", IMAGE_ALPHA, "item_bombball_simple", IMAGE_GROUP_BASE);
+
g_item[ITEM_MINE] = addImageData("mine.png", IMAGE_ALPHA, "item_mine_simple", IMAGE_GROUP_BASE);
g_item[ITEM_EXPLOSION] = addImageData("explosion.png", IMAGE_ALPHA, "item_explosion_simple", IMAGE_GROUP_BASE);
g_item[ITEM_BIG_EXPLOSION] = addImageData("big-explosion.png", IMAGE_ALPHA, "item_big-explosion_simple", IMAGE_GROUP_BASE);
@@ -85,6 +87,7 @@ item_t* newItem(int x, int y, int type, tux_t *author)
case GUN_TOMMY :
case GUN_LASSER :
case GUN_MINE :
+ case GUN_BOMBBALL :
new->w = ITEM_GUN_WIDTH;
new->h = ITEM_GUN_HEIGHT;
break;
@@ -171,7 +174,7 @@ void addNewItem(list_t *listItem, tux_t *author)
#ifndef PUBLIC_SERVER
do{
#endif
- switch( random() % 11 )
+ switch( random() % 12 )
{
case 0 : type = GUN_DUAL_SIMPLE;
break;
@@ -183,21 +186,24 @@ void addNewItem(list_t *listItem, tux_t *author)
break;
case 4 : type = GUN_LASSER;
break;
- case 5 : type = BONUS_SPEED;
+ case 5 : type = GUN_BOMBBALL;
+ break;
+ case 6 : type = BONUS_SPEED;
break;
- case 6 : type = BONUS_SHOT;
+ case 7 : type = BONUS_SHOT;
break;
- case 7 : type = BONUS_TELEPORT;
+ case 8 : type = BONUS_TELEPORT;
break;
- case 8 : type = BONUS_GHOST;
+ case 9 : type = BONUS_GHOST;
break;
- case 9 : type = BONUS_4X;
+ case 10 : type = BONUS_4X;
break;
- case 10 : type = BONUS_HIDDEN;
+ case 11 : type = BONUS_HIDDEN;
break;
}
#ifndef PUBLIC_SERVER
- }while( isSettingItem(type) == FALSE );
+ }while( isSettingItem(type) == FALSE ||
+ (getNetTypeGame() == NET_GAME_TYPE_NONE && type == BONUS_HIDDEN) );
#endif
item = newItem(new_x, new_y, type, author);
@@ -281,6 +287,7 @@ void eventListItem(list_t *listItem)
case GUN_SCATTER :
case GUN_LASSER :
case GUN_MINE :
+ case GUN_BOMBBALL :
if( thisItem->frame == ITEM_GUN_MAX_FRAME )
{
thisItem->frame = 0;
@@ -494,6 +501,7 @@ int eventGiveTuxItem(tux_t *tux, list_t *listItem, item_t *item)
case GUN_SCATTER :
case GUN_LASSER :
case GUN_MINE :
+ case GUN_BOMBBALL :
tuxGiveGun(tux, item);
delListItem(listItem, index, destroyItem);
return index;
diff --git a/src/panel.c b/src/panel.c
index 1e93084..079d753 100644
--- a/src/panel.c
+++ b/src/panel.c
@@ -38,6 +38,7 @@ void initPanel()
g_icon[GUN_SCATTER] = addImageData("icon.gun.scatter.png", IMAGE_ALPHA, "panel_scatter", IMAGE_GROUP_BASE);
g_icon[GUN_LASSER] = addImageData("icon.gun.lasser.png", IMAGE_ALPHA, "panel_lasser", IMAGE_GROUP_BASE);
g_icon[GUN_MINE] = addImageData("icon.gun.mine.png", IMAGE_ALPHA, "panel_mine", IMAGE_GROUP_BASE);
+ g_icon[GUN_BOMBBALL] = addImageData("icon.gun.bombball.png", IMAGE_ALPHA, "panel_bombball", IMAGE_GROUP_BASE);
g_icon[BONUS_SPEED] = addImageData("icon.bonus.speed.png", IMAGE_ALPHA, "panel_speed", IMAGE_GROUP_BASE);
g_icon[BONUS_SHOT] = addImageData("icon.bonus.shot.png", IMAGE_ALPHA, "panel_shot", IMAGE_GROUP_BASE);
diff --git a/src/pipe.c b/src/pipe.c
index 19b12c5..2a85667 100644
--- a/src/pipe.c
+++ b/src/pipe.c
@@ -169,7 +169,7 @@ void eventConflictShotWithPipe(list_t *listPipe, list_t *listShot)
assert( thisShot != NULL );
if( ( thisPipe = isConflictWithListPipe(listPipe, thisShot->x, thisShot->y,
- thisShot->w, thisShot->h) ) != NULL )
+ thisShot->w, thisShot->h) ) != NULL )
{
if( thisShot->author->bonus == BONUS_GHOST &&
thisShot->author->bonus_time > 0 )
@@ -181,8 +181,11 @@ void eventConflictShotWithPipe(list_t *listPipe, list_t *listShot)
{
if( getNetTypeGame() == NET_GAME_TYPE_CLIENT )
{
- delListItem(listShot, i, destroyShot);
- i--;
+ if( thisShot->gun != GUN_BOMBBALL )
+ {
+ delListItem(listShot, i, destroyShot);
+ i--;
+ }
}
else
{
@@ -191,8 +194,16 @@ void eventConflictShotWithPipe(list_t *listPipe, list_t *listShot)
}
else
{
- delListItem(listShot, i, destroyShot);
- i--;
+ if( thisShot->gun == GUN_BOMBBALL && getNetTypeGame() != NET_GAME_TYPE_CLIENT )
+ {
+ boundBombBall(thisShot);
+ continue;
+ }
+ else
+ {
+ delListItem(listShot, i, destroyShot);
+ i--;
+ }
}
}
}
diff --git a/src/proto.c b/src/proto.c
index 042ce7f..60bcf20 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -584,8 +584,8 @@ void proto_send_shot_server(int type, client_t *client, shot_t *p)
id = p->author->id;
}
- sprintf(msg, "shot %d %d %d %d %d %d %d %d\n",
- p->x, p->y, p->px, p->py, p->position, p->gun, id, p->isCanKillAuthor);
+ sprintf(msg, "shot %d %d %d %d %d %d %d %d %d\n",
+ p->id, p->x, p->y, p->px, p->py, p->position, p->gun, id, p->isCanKillAuthor);
proto_send(type, client, msg);
}
@@ -595,15 +595,21 @@ void proto_send_shot_server(int type, client_t *client, shot_t *p)
void proto_recv_shot_client(char *msg)
{
char cmd[STR_PROTO_SIZE];
- int x, y, px, py, position, gun, id, isCanKillAuthor;
+ int x, y, px, py, position, gun, shot_id, author_id, isCanKillAuthor;
shot_t *shot;
assert( msg != NULL );
- sscanf(msg, "%s %d %d %d %d %d %d %d %d",
- cmd, &x, &y, &px, &py, &position, &gun, &id, &isCanKillAuthor);
+ sscanf(msg, "%s %d %d %d %d %d %d %d %d %d",
+ cmd, &shot_id, &x, &y, &px, &py, &position, &gun, &author_id, &isCanKillAuthor);
- shot = newShot(x, y, px, py, gun, getTuxID(getCurrentArena()->listTux, id));
+/*
+ if( getShotID(getCurrentArena()->listShot, shot_id) != NULL )
+ {
+ return;
+ }
+*/
+ shot = newShot(x, y, px, py, gun, getTuxID(getCurrentArena()->listTux, author_id));
shot->isCanKillAuthor = isCanKillAuthor;
shot->position = position;
@@ -618,6 +624,47 @@ void proto_recv_shot_client(char *msg)
#endif
+void proto_send_delshot_server(int type, client_t *client, shot_t *shot)
+{
+ char msg[STR_PROTO_SIZE];
+
+ assert( shot != NULL );
+
+ sprintf(msg, "delshot %d\n", shot->id);
+
+ proto_send(type, client, msg);
+}
+
+#ifndef PUBLIC_SERVER
+
+void proto_recv_delshot_client(char *msg)
+{
+ char cmd[STR_PROTO_SIZE];
+ shot_t *shot;
+ int id;
+
+ assert( msg != NULL );
+
+ sscanf(msg, "%s %d",
+ cmd, &id);
+
+ shot = getShotID(getCurrentArena()->listShot, id);
+
+ if( shot != NULL )
+ {
+ int index;
+
+ index = searchListItem(getCurrentArena()->listShot, shot);
+
+ if( index >= 0 )
+ {
+ delListItem(getCurrentArena()->listShot, index, destroyShot);
+ }
+ }
+}
+
+#endif
+
#ifndef PUBLIC_SERVER
void proto_send_ping_client()
diff --git a/src/screen_setting.c b/src/screen_setting.c
index 72368c1..82bf432 100644
--- a/src/screen_setting.c
+++ b/src/screen_setting.c
@@ -332,7 +332,7 @@ void initScreenSetting()
image_gun_tommy = newWidgetImage(110 + WIDGET_CHECK_WIDTH, 300, getImage(IMAGE_GROUP_BASE, "panel_tommy"));
image_gun_lasser = newWidgetImage(260 + WIDGET_CHECK_WIDTH, 200, getImage(IMAGE_GROUP_BASE, "panel_lasser"));
image_gun_mine = newWidgetImage(260 + WIDGET_CHECK_WIDTH, 250, getImage(IMAGE_GROUP_BASE, "panel_mine"));
- image_gun_bombball = newWidgetImage(260 + WIDGET_CHECK_WIDTH, 300, getImage(IMAGE_GROUP_BASE, "panel_dual"));
+ image_gun_bombball = newWidgetImage(260 + WIDGET_CHECK_WIDTH, 300, getImage(IMAGE_GROUP_BASE, "panel_bombball"));
image_bonus_speed = newWidgetImage(430 + WIDGET_CHECK_WIDTH, 200, getImage(IMAGE_GROUP_BASE, "panel_speed"));;
image_bonus_shot = newWidgetImage(430 + WIDGET_CHECK_WIDTH, 250, getImage(IMAGE_GROUP_BASE, "panel_shot"));;
diff --git a/src/server.c b/src/server.c
index f3972d3..90a388a 100644
--- a/src/server.c
+++ b/src/server.c
@@ -121,6 +121,18 @@ static void eventPeriodicSyncClient(void *p_nothink)
}
}
+static void eventPeriodicSyncSelfClient(void *p_nothink)
+{
+ client_t *thisClient;
+ int i;
+
+ for( i = 0 ; i < listClient->count; i++)
+ {
+ thisClient = (client_t *) listClient->list[i];
+ proto_send_newtux_server(PROTO_SEND_ONE, thisClient, thisClient->tux);
+ }
+}
+
static void eventSendPingClients(void *p_nothink)
{
proto_send_ping_server(PROTO_SEND_ALL, NULL);
@@ -136,6 +148,7 @@ void static initServer()
addTaskToTimer(listServerTimer, TIMER_PERIODIC, delZombieCLient, NULL, SERVER_TIMEOUT);
addTaskToTimer(listServerTimer, TIMER_PERIODIC, eventPeriodicSyncClient, NULL, SERVER_TIME_SYNC);
+ addTaskToTimer(listServerTimer, TIMER_PERIODIC, eventPeriodicSyncSelfClient, NULL, 5000);
addTaskToTimer(listServerTimer, TIMER_PERIODIC, eventSendPingClients, NULL, SERVER_TIME_PING);
}
diff --git a/src/shot.c b/src/shot.c
index 4b45c35..17dfa2a 100644
--- a/src/shot.c
+++ b/src/shot.c
@@ -6,6 +6,8 @@
#include "main.h"
#include "shot.h"
#include "gun.h"
+#include "wall.h"
+#include "pipe.h"
#include "net_multiplayer.h"
#include "proto.h"
@@ -24,6 +26,7 @@
static SDL_Surface *g_shot_simple;
static SDL_Surface *g_shot_lasserX;
static SDL_Surface *g_shot_lasserY;
+static SDL_Surface *g_shot_bombball;
#endif
@@ -45,6 +48,7 @@ void initShot()
g_shot_simple = addImageData("shot.png", IMAGE_ALPHA, "shot", IMAGE_GROUP_BASE);
g_shot_lasserX = addImageData("lasserX.png", IMAGE_NO_ALPHA, "lasserX", IMAGE_GROUP_BASE);
g_shot_lasserY = addImageData("lasserY.png", IMAGE_NO_ALPHA, "lasserY", IMAGE_GROUP_BASE);
+ g_shot_bombball = addImageData("bombball.png", IMAGE_ALPHA, "bombball", IMAGE_GROUP_BASE);
#endif
@@ -103,6 +107,15 @@ shot_t* newShot(int x,int y, int px, int py, int gun, tux_t *author)
}
break;
+ case GUN_BOMBBALL :
+ new->w = GUN_BOMBBALL_WIDTH;
+ new->h = GUN_BOMBBALL_HEIGHT;
+
+#ifndef PUBLIC_SERVER
+ new->img = g_shot_bombball;
+#endif
+ break;
+
default :
assert( ! "Premenna weapon ma zlu hodnotu !" );
break;
@@ -111,6 +124,28 @@ shot_t* newShot(int x,int y, int px, int py, int gun, tux_t *author)
return new;
}
+shot_t* getShotID(list_t *listShot, int id)
+{
+ shot_t *thisShot;
+ int i;
+
+ assert( listShot != NULL );
+
+ for( i = 0 ; i < listShot->count ; i++ )
+ {
+ thisShot = (shot_t *)listShot->list[i];
+ assert( thisShot != NULL );
+
+ if( thisShot->id == id )
+ {
+ return thisShot;
+ }
+ }
+
+ return NULL;
+}
+
+
#ifndef PUBLIC_SERVER
void drawShot(shot_t *p)
@@ -158,6 +193,51 @@ int isConflictWithListShot(list_t *listShot, int x, int y, int w, int h)
return 0;
}
+static int myAbs(int n)
+{
+ return ( n > 0 ? n : -n );
+}
+
+
+static int getRandomCourse(int x, int y)
+{
+ int ret;
+
+ do{
+ switch( random() % 3 )
+ {
+ case 0 :
+ ret = y;
+ break;
+ case 1 :
+ ret = -y;
+ break;
+ case 2 :
+ ret = 0;
+ break;
+ }
+ }while( ret == x );
+
+ return ret;
+}
+
+void boundBombBall(shot_t *shot)
+{
+ if( shot->gun != GUN_BOMBBALL )
+ {
+ return;
+ }
+
+ shot->px = getRandomCourse(shot->px, +10);
+ shot->py = getRandomCourse(shot->py, +10);
+ shot->isCanKillAuthor = 1;
+
+ if( getNetTypeGame() == NET_GAME_TYPE_SERVER )
+ {
+ proto_send_shot_server(PROTO_SEND_ALL, NULL, shot);
+ }
+}
+
void eventMoveListShot(list_t *listShot)
{
shot_t *thisShot;
@@ -172,7 +252,23 @@ void eventMoveListShot(list_t *listShot)
thisShot->x += thisShot->px;
thisShot->y += thisShot->py;
-
+/*
+ if( thisShot->gun == GUN_BOMBBALL && (
+ isConflictWithListWall(getCurrentArena()->listWall, thisShot->x, thisShot->y, thisShot->w, thisShot->h) ||
+ isConflictWithListPipe(getCurrentArena()->listPipe, thisShot->x, thisShot->y, thisShot->w, thisShot->h) ) )
+ {
+ if( getNetTypeGame() != NET_GAME_TYPE_CLIENT )
+ {
+ boundBombBall(thisShot);
+ }
+ else
+ {
+ delListItem(listShot, i, destroyShot);
+ i--;
+ continue;
+ }
+ }
+*/
if( thisShot->x+thisShot->w < 0 || thisShot->x > WINDOW_SIZE_X ||
thisShot->y+thisShot->h < 0 || thisShot->y > WINDOW_SIZE_Y )
{
@@ -183,11 +279,6 @@ void eventMoveListShot(list_t *listShot)
}
}
-static int myAbs(int n)
-{
- return ( n > 0 ? n : -n );
-}
-
static int getSppedShot(shot_t *shot)
{
return ( myAbs(shot->px) > myAbs(shot->py) ? myAbs(shot->px) : myAbs(shot->py) );
diff --git a/src/tux.c b/src/tux.c
index 3b14427..5d94fbe 100644
--- a/src/tux.c
+++ b/src/tux.c
@@ -292,7 +292,7 @@ int isConflictTuxWithListTux(tux_t *tux, list_t *listTux)
getTuxProportion(thisTux, &thisTux_x, &thisTux_y, &thisTux_w, &thisTux_h);
- if( conflictSpace(tux_x, tux_y, tux_w, tux_h,
+ if( thisTux->bonus != BONUS_GHOST && conflictSpace(tux_x, tux_y, tux_w, tux_h,
thisTux_x, thisTux_y, thisTux_w, thisTux_h) )
{
return 1;
@@ -449,6 +449,24 @@ void tuxTeleport(tux_t *tux)
}
}
+static void bombBallExplosion(shot_t *shot)
+{
+ item_t *item;
+ int x, y;
+
+ x = ( shot->x + shot->w/2 ) - ITEM_BIG_EXPLOSION_WIDTH/2;
+ y = ( shot->y + shot->h/2 ) - ITEM_BIG_EXPLOSION_HEIGHT/2;
+
+ item = newItem(x, y, ITEM_BIG_EXPLOSION, shot->author);
+ addList(getCurrentArena()->listItem, item );
+
+ if( getNetTypeGame() == NET_GAME_TYPE_SERVER )
+ {
+ proto_send_delshot_server(PROTO_SEND_ALL, NULL, shot);
+ proto_send_additem_server(PROTO_SEND_ALL, NULL, item);
+ }
+}
+
void eventConflictTuxWithShot(list_t *listTux, list_t *listShot)
{
shot_t *thisShot;
@@ -481,6 +499,18 @@ void eventConflictTuxWithShot(list_t *listTux, list_t *listShot)
continue;
}
+ if( thisShot->gun == GUN_BOMBBALL )
+ {
+ if( getNetTypeGame() != NET_GAME_TYPE_CLIENT )
+ {
+ bombBallExplosion(thisShot);
+ delListItem(listShot, i, destroyShot);
+ i--;
+ }
+
+ continue;
+ }
+
if( getNetTypeGame() != NET_GAME_TYPE_CLIENT )
{
eventTuxIsDeadWIthShot(thisTux, thisShot);
@@ -552,22 +582,22 @@ void moveTux(tux_t *tux, int n)
return;
}
- if( n == TUX_LEFT && tux->x < 0 )
+ if( n == TUX_LEFT && tux->x-TUX_STEP <= 0 )
{
return;
}
- if( n == TUX_RIGHT && tux->x > WINDOW_SIZE_X )
+ if( n == TUX_RIGHT && tux->x+TUX_STEP >= WINDOW_SIZE_X )
{
return;
}
- if( n == TUX_UP && tux->y < 0 )
+ if( n == TUX_UP && tux->y-TUX_STEP <= 0 )
{
return;
}
- if( n == TUX_DOWN && tux->y > WINDOW_SIZE_Y )
+ if( n == TUX_DOWN && tux->y+TUX_STEP >= WINDOW_SIZE_Y )
{
return;
}
@@ -673,6 +703,7 @@ void shotTux(tux_t *tux)
shotInGun(tux);
tux->isCanShot = FALSE;
+
addTaskToTimer(getCurrentArena()->listTimer, TIMER_ONE, timer_tuxCanShot,
newInt(tux->id), TUX_TIME_CAN_SHOT );
@@ -713,9 +744,13 @@ static void pickUpGun(tux_t *tux)
if( isTuxAnyGun(tux) == FALSE )
{
tux->gun = GUN_SIMPLE;
- tux->pickup_time++;
+
+ if( tux->pickup_time < TUX_MAX_PICKUP )
+ {
+ tux->pickup_time++;
+ }
- if( tux->pickup_time == TUX_MAX_PICKUP )
+ if( tux->pickup_time == TUX_MAX_PICKUP && getNetTypeGame() != NET_GAME_TYPE_CLIENT )
{
#ifndef PUBLIC_SERVER
char msg[STR_SIZE];
@@ -727,6 +762,11 @@ static void pickUpGun(tux_t *tux)
tux->gun = GUN_SIMPLE;
tux->shot[ tux->gun ] = GUN_MAX_SHOT;
tux->pickup_time = 0;
+
+ if( getNetTypeGame() == NET_GAME_TYPE_SERVER )
+ {
+ proto_send_newtux_server(PROTO_SEND_ALL, NULL, tux);
+ }
}
}
}
@@ -751,8 +791,13 @@ static void eventBonus(tux_t *tux)
int x, y, w, h;
getTuxProportion(tux, &x, &y, &w, &h);
- if ( isConflictWithListWall(getCurrentArena()->listWall, x, y, w, h) )
+ tux->bonus = BONUS_NONE;
+
+ if ( isConflictWithListWall(getCurrentArena()->listWall, x, y, w, h) ||
+ isConflictWithListPipe(getCurrentArena()->listPipe, x, y, w, h) ||
+ isConflictTuxWithListTux(tux, getCurrentArena()->listTux) )
{
+ tux->bonus = BONUS_GHOST;
return;
}
}
diff --git a/src/wall.c b/src/wall.c
index c66b5c6..54f034a 100644
--- a/src/wall.c
+++ b/src/wall.c
@@ -5,6 +5,8 @@
#include "main.h"
#include "wall.h"
#include "shot.h"
+#include "net_multiplayer.h"
+#include "proto.h"
#ifndef PUBLIC_SERVER
#include "layer.h"
@@ -116,6 +118,12 @@ void eventConflictShotWithWall(list_t *listWall, list_t *listShot)
continue;
}
+ if( thisShot->gun == GUN_BOMBBALL && getNetTypeGame() != NET_GAME_TYPE_CLIENT )
+ {
+ boundBombBall(thisShot);
+ continue;
+ }
+
delListItem(listShot, i, destroyShot);
i--;
}