diff options
| author | Dusan Durech <dusan@debian.(none)> | 2008-11-26 23:13:54 +0100 |
|---|---|---|
| committer | Dusan Durech <dusan@debian.(none)> | 2008-11-26 23:13:54 +0100 |
| commit | ac06fff171f1b600cc9f470e04d58446a03b37ee (patch) | |
| tree | 7dbcdfd482b94ae71ce07c1617af790bd254336c /src/modules | |
| parent | ed32a3daceec1d246cd5cf08a30c23b46282b699 (diff) | |
Less amount of code is being processed on the client side now.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/modMove.c | 14 | ||||
| -rw-r--r-- | src/modules/modPipe.c | 39 |
2 files changed, 53 insertions, 0 deletions
diff --git a/src/modules/modMove.c b/src/modules/modMove.c index 55366ff..5059d73 100644 --- a/src/modules/modMove.c +++ b/src/modules/modMove.c @@ -109,8 +109,10 @@ static void transformShot(shot_t * shot, int position) shot->py = +speed; break; } + shot->position = position; shot->isCanKillAuthor = TRUE; + if (shot->gun == GUN_LASSER) export_fce->fce_transformOnlyLasser(shot); } @@ -133,7 +135,9 @@ move_shot(shot_t * shot, int position, int src_x, int src_y, offset = shot->y - src_y; break; } + transformShot(shot, position); + switch (shot->position) { case TUX_UP: new_x = dist_x + offset; @@ -152,6 +156,7 @@ move_shot(shot_t * shot, int position, int src_x, int src_y, new_y = dist_y + dist_h + 5; break; } + moveObjectInSpace(export_fce->fce_getCurrentArena()->spaceShot, shot, new_x, new_y); if (export_fce->fce_getNetTypeGame() == NET_GAME_TYPE_SERVER) { @@ -169,6 +174,7 @@ int init(export_fce_t * p) export_fce = p; export_fce->fce_addToShareFce("move_tux", (void *) move_tux); export_fce->fce_addToShareFce("move_shot", (void *) move_shot); + return 0; } @@ -180,9 +186,11 @@ static void proto_movetux(char *msg) tux_t *tux; assert(msg != NULL); + sscanf(msg, "%s %d %d %d", cmd, &id, &x, &y); space = export_fce->fce_getCurrentArena()->spaceTux; tux = getObjectFromSpaceWithID(space, id); + if (tux != NULL) moveObjectInSpace(space, tux, x, y); } @@ -195,16 +203,21 @@ static void proto_moveshot(char *msg) shot_t *shot; assert(msg != NULL); + sscanf(msg, "%s %d %d %d %d %d %d", cmd, &shot_id, &x, &y, &px, &py, &position); + space = export_fce->fce_getCurrentArena()->spaceShot; + if ((shot = getObjectFromSpaceWithID(space, shot_id)) == NULL) return; + moveObjectInSpace(space, shot, x, y); shot->isCanKillAuthor = 1; shot->position = position; shot->px = px; shot->py = py; + if (shot->gun == GUN_LASSER) export_fce->fce_transformOnlyLasser(shot); } @@ -236,6 +249,7 @@ void recvMsg(char *msg) { if (export_fce->fce_getNetTypeGame() == NET_GAME_TYPE_SERVER) return; + if (strncmp(msg, "movetux", 7) == 0) proto_movetux(msg); if (strncmp(msg, "moveshot", 8) == 0) diff --git a/src/modules/modPipe.c b/src/modules/modPipe.c index 9049731..76554b2 100644 --- a/src/modules/modPipe.c +++ b/src/modules/modPipe.c @@ -11,6 +11,8 @@ #include "list.h" #include "gun.h" #include "space.h" +#include "proto.h" +#include "serverSendMsg.h" #ifndef PUBLIC_SERVER # include "interface.h" @@ -258,6 +260,8 @@ static int negPosition(int n) return -1; // no warnning } + +#if 0 //zaloha static void action_eventpipe(space_t * space, pipe_t * pipe, shot_t * shot) { arena_t *arena; @@ -285,6 +289,32 @@ static void action_eventpipe(space_t * space, pipe_t * pipe, shot_t * shot) } } } +#endif + +static void action_eventpipe(space_t * space, pipe_t * pipe, shot_t * shot) +{ + arena_t *arena; + tux_t *author; + + arena = export_fce->fce_getCurrentArena(); + + author = getObjectFromSpaceWithID(arena->spaceTux, shot->author_id); + + if (author != NULL && + author->bonus == BONUS_GHOST && author->bonus_time > 0) { + return; + } + + if (negPosition(shot->position) == pipe->position ) { + moveShotFromPipe(shot, pipe); + } else { + if (shot->gun == GUN_BOMBBALL) { + export_fce->fce_boundBombBall(shot); + } else { + shot->del = TRUE; + } + } +} static void action_eventshot(space_t * space, shot_t * shot, space_t * spacePipe) @@ -293,6 +323,10 @@ action_eventshot(space_t * space, shot_t * shot, space_t * spacePipe) shot->y, shot->w, shot->h); if (shot->del == TRUE) { + if (getNetTypeGame() == NET_GAME_TYPE_SERVER) { + proto_send_del_server(PROTO_SEND_ALL, NULL, shot->id); + } + delObjectFromSpaceWithObject(space, shot, export_fce->fce_destroyShot); } } @@ -303,6 +337,11 @@ int event() return 0; } + // na skusku + if (export_fce->fce_getNetTypeGame() == NET_GAME_TYPE_CLIENT) { + return 0; + } + actionSpace(export_fce->fce_getCurrentArena()->spaceShot, action_eventshot, spacePipe); |