summaryrefslogtreecommitdiff
path: root/src/tux.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-21 14:03:35 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-21 14:03:35 +0000
commit114131bf71d7d4ec48c92a7bde8183442995940f (patch)
tree84a3e5ba788d3a6bf76f5067b861fbce8b2f239b /src/tux.c
parent1e1d106a545a9cadc517de1a0ad931f1a8fcc2fa (diff)
- vypisovanie sprav do hry
- oprava chyby odhlaelenj pomocou valgrindu - zena rychlosti zbrani - drobne upravy git-svn-id: http://opensvn.csie.org/tuxanci_ng@31 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/tux.c')
-rw-r--r--src/tux.c66
1 files changed, 59 insertions, 7 deletions
diff --git a/src/tux.c b/src/tux.c
index 9672f28..60cdd2a 100644
--- a/src/tux.c
+++ b/src/tux.c
@@ -23,6 +23,7 @@
#include "sound.h"
#include "layer.h"
#include "screen_world.h"
+#include "term.h"
#endif
#ifdef BUBLIC_SERVER
@@ -360,15 +361,20 @@ static void timer_tuxCanSwitchGun(void *p)
void eventTuxIsDead(tux_t *tux)
{
+#ifndef BUBLIC_SERVER
+ char msg[STR_SIZE];
+#endif
+
if( tux->status == TUX_STATUS_DEAD )
{
return;
}
#ifndef BUBLIC_SERVER
+ sprintf(msg, "tux with id %d is dead\n", tux->id);
playSound("dead", SOUND_GROUP_BASE);
+ appendTextInTerm(msg);
#endif
- printf("tux id %d is dead\n", tux->id);
tux->status = TUX_STATUS_DEAD;
memset(tux->shot, 0, sizeof(int) * GUN_COUNT);
@@ -397,6 +403,14 @@ static void eventTuxIsDeadWIthShot(tux_t *tux, shot_t *shot)
{
if( shot->author != NULL && shot->author != tux )
{
+#ifndef BUBLIC_SERVER
+ char term_msg[STR_SIZE];
+
+ sprintf(term_msg, "tux with id %d set score to %d\n",
+ shot->author->id, shot->author->score+1);
+
+ appendTextInTerm(term_msg);
+#endif
shot->author->score++;
if( getNetTypeGame() == NET_GAME_TYPE_SERVER )
@@ -412,11 +426,15 @@ static void eventTuxIsDeadWIthShot(tux_t *tux, shot_t *shot)
void tuxTeleport(tux_t *tux)
{
int x, y;
+#ifndef BUBLIC_SERVER
+ char msg[STR_SIZE];
+#endif
#ifndef BUBLIC_SERVER
+ sprintf(msg, "tux with id %d teleporting\n", tux->id);
playSound("teleport", SOUND_GROUP_BASE);
+ appendTextInTerm(msg);
#endif
- printf("tux id %d teleporting\n", tux->id);
if( getNetTypeGame() != NET_GAME_TYPE_CLIENT )
{
@@ -569,21 +587,23 @@ void moveTux(tux_t *tux, int n)
if( tux->frame == TUX_MAX_ANIMATION_FRAME ) tux->frame = 0;
}
+
+// printf("move %d %d %d\n", tux->id, tux->x, tux->y);
}
void switchTuxGun(tux_t *tux)
{
int i;
-
+#ifndef BUBLIC_SERVER
+ char msg[STR_SIZE];
+#endif
+
if( tux->control != TUX_CONTROL_NET &&
tux->isCanSwitchGun == FALSE )
{
return;
}
-#ifndef BUBLIC_SERVER
- playSound("switch_gun", SOUND_GROUP_BASE);
-#endif
for( i = tux->gun+1 ; i < GUN_COUNT ; i++ )
{
if( tux->shot[i] > 0 )
@@ -591,6 +611,11 @@ void switchTuxGun(tux_t *tux)
tux->gun = i;
tux->isCanSwitchGun = FALSE;
addTimer(timer_tuxCanSwitchGun, newInt(tux->id), TUX_TIME_CAN_SWITCH_GUN );
+#ifndef BUBLIC_SERVER
+ playSound("switch_gun", SOUND_GROUP_BASE);
+ sprintf(msg, "tux with id %d switch gun\n", tux->id);
+ appendTextInTerm(msg);
+#endif
return;
}
}
@@ -602,6 +627,13 @@ void switchTuxGun(tux_t *tux)
tux->gun = i;
tux->isCanSwitchGun = FALSE;
addTimer(timer_tuxCanSwitchGun, newInt(tux->id), TUX_TIME_CAN_SWITCH_GUN );
+
+#ifndef BUBLIC_SERVER
+ playSound("switch_gun", SOUND_GROUP_BASE);
+ sprintf(msg, "tux with id %d switch gun\n", tux->id);
+ appendTextInTerm(msg);
+#endif
+
return;
}
}
@@ -617,6 +649,10 @@ void shotTux(tux_t *tux)
return;
}
+#ifndef BUBLIC_SERVER
+ playSound("switch_gun", SOUND_GROUP_BASE);
+#endif
+
shotInGun(tux);
tux->isCanShot = FALSE;
@@ -663,6 +699,13 @@ static void pickUpGun(tux_t *tux)
if( tux->pickup_time == TUX_MAX_PICKUP )
{
+#ifndef BUBLIC_SERVER
+ char msg[STR_SIZE];
+ playSound("switch_gun", SOUND_GROUP_BASE);
+ sprintf(msg, "tux with id %d pickup\n", tux->id);
+ appendTextInTerm(msg);
+#endif
+
tux->gun = GUN_SIMPLE;
tux->shot[ tux->gun ] = GUN_MAX_SHOT;
tux->pickup_time = 0;
@@ -679,8 +722,12 @@ static void eventBonus(tux_t *tux)
tux->bonus_time--;
}
- if( tux->bonus_time == 0 && getNetTypeGame() != NET_GAME_TYPE_CLIENT )
+ if( tux->bonus_time == 0 && getNetTypeGame() != NET_GAME_TYPE_CLIENT )
{
+#ifndef BUBLIC_SERVER
+ char msg[STR_SIZE];
+#endif
+
if( tux->bonus == BONUS_GHOST )
{
int x, y, w, h;
@@ -694,6 +741,11 @@ static void eventBonus(tux_t *tux)
tux->bonus = BONUS_NONE;
+#ifndef BUBLIC_SERVER
+ sprintf(msg, "tux with id %d bonus disabled\n", tux->id);
+ appendTextInTerm(msg);
+#endif
+
if( getNetTypeGame() == NET_GAME_TYPE_SERVER )
{
proto_send_newtux_server(PROTO_SEND_ALL, NULL, tux);