summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/proto.c33
-rw-r--r--src/base/tux.c7
2 files changed, 35 insertions, 5 deletions
diff --git a/src/base/proto.c b/src/base/proto.c
index f927dfa..69dd1a8 100644
--- a/src/base/proto.c
+++ b/src/base/proto.c
@@ -124,8 +124,13 @@ static void sendInfoCreateClient(client_t * client)
thisClient = (client_t *) listClient->list[i];
thisTux = thisClient->tux;
- if (thisTux != NULL && thisTux != client->tux) {
+ // odosli kazdemu stremu hracovy informacie o novom hracovy
+ if (thisTux != NULL && thisTux != client->tux) {
proto_send_newtux_server(PROTO_SEND_ONE, thisClient, client->tux);
+ }
+
+ // odosli novemu hracovy informacie o kazdom starom hracovy aj o sebe
+ if (thisTux != NULL) {
proto_send_newtux_server(PROTO_SEND_ONE, client, thisTux);
}
}
@@ -617,6 +622,25 @@ void proto_send_del_server(int type, client_t * client, int id)
#ifndef PUBLIC_SERVER
+void timer_delShot(void *p)
+{
+ shot_t *shot;
+ int *id;
+
+ assert( p != NULL );
+ id = (int *)(p);
+
+ shot = getObjectFromSpaceWithID(getCurrentArena()->spaceShot, *id);
+
+ if( shot != NULL )
+ {
+ delFromRadar(shot->id);
+ delObjectFromSpaceWithObject(getCurrentArena()->spaceShot, shot, destroyShot);
+ }
+
+ free(p);
+}
+
void proto_recv_del_client(char *msg)
{
char cmd[STR_PROTO_SIZE];
@@ -648,8 +672,9 @@ void proto_recv_del_client(char *msg)
if (shot != NULL) {
//printf("delete shot..\n");
- delFromRadar(id);
- delObjectFromSpaceWithObject(getCurrentArena()->spaceShot, shot, destroyShot);
+ //delFromRadar(id);
+ //delObjectFromSpaceWithObject(getCurrentArena()->spaceShot, shot, destroyShot);
+ addTaskToTimer(getCurrentArena()->listTimer, TIMER_ONE, timer_delShot, newInt(id), 50);
return;
}
@@ -734,7 +759,7 @@ void proto_send_shot_server(int type, client_t * client, shot_t * p)
assert(p != NULL);
snprintf(msg, STR_PROTO_SIZE, "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,
+ p->id, p->x-p->px*8, p->y-p->py*8, p->px, p->py, p->position, p->gun,
p->author_id, p->isCanKillAuthor);
//proto_send(type, client, msg);
diff --git a/src/base/tux.c b/src/base/tux.c
index 5bb2305..a7e330f 100644
--- a/src/base/tux.c
+++ b/src/base/tux.c
@@ -68,6 +68,11 @@ void initTux()
isTuxInit = TRUE;
}
+int getRandomGun()
+{
+ return random() % (GUN_BOMBBALL+1);
+}
+
tux_t *newTux()
{
int x, y;
@@ -86,7 +91,7 @@ tux_t *newTux()
setTuxProportion(new, x, y);
new->position = TUX_DOWN;
- new->gun = GUN_SIMPLE;
+ new->gun = getRandomGun();
new->shot[new->gun] = GUN_MAX_SHOT;
sprintf(new->name, "no_name_id_%d", new->id);