From d5ae032d2b251a1604042f68a9cd3215c233792e Mon Sep 17 00:00:00 2001 From: oroborus Date: Wed, 16 Jul 2008 19:51:46 +0000 Subject: nove funkcie : extern void actionSpace(space_t *space, void *f, void *p); extern void actionSpaceFromLocation(space_t *space, void *f, void *p, int x, int y, int w, int h); casti kodu ktore tieto funkcie potrebovali boli prepisane tak aby ich pouzivali. ( moduly tak prepisem zajtra ) git-svn-id: http://opensvn.csie.org/tuxanci_ng@150 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/base/tux.c | 85 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 38 insertions(+), 47 deletions(-) (limited to 'src/base/tux.c') diff --git a/src/base/tux.c b/src/base/tux.c index 21fa7e6..94a7666 100644 --- a/src/base/tux.c +++ b/src/base/tux.c @@ -406,62 +406,53 @@ static void bombBallExplosion(shot_t *shot) delObjectFromSpaceWithObject(getCurrentArena()->spaceShot, shot, destroyShot); } -void eventConflictTuxWithShot(arena_t *arena) +static void action_tux(space_t *space, tux_t *tux, shot_t *shot) { - shot_t *thisShot; - tux_t *thisTux; - int i, j; - - for( i = 0 ; i < arena->spaceShot->list->count ; i++ ) - { - thisShot = (shot_t *)arena->spaceShot->list->list[i]; - assert( thisShot != NULL ); + arena_t *arena; - listDoEmpty(listHelp); - getObjectFromSpace(arena->spaceTux, thisShot->x, thisShot->y, - thisShot->w, thisShot->h, listHelp); + arena = getCurrentArena(); - for( j = 0 ; j < listHelp->count ; j++ ) + if( tux->status == TUX_STATUS_ALIVE ) + { + if( shot->author_id == tux->id && + shot->isCanKillAuthor == FALSE ) { - thisTux = listHelp->list[j]; + return; + } - if( thisTux->status == TUX_STATUS_ALIVE ) + if( tux->bonus == BONUS_TELEPORT ) + { + tuxTeleport(tux); + return; + } + + if( shot->gun == GUN_BOMBBALL ) + { + if( getNetTypeGame() != NET_GAME_TYPE_CLIENT ) { - if( thisShot->author_id == thisTux->id && - thisShot->isCanKillAuthor == FALSE ) - { - continue; - } - - if( thisTux->bonus == BONUS_TELEPORT ) - { - tuxTeleport(thisTux); - continue; - } - - if( thisShot->gun == GUN_BOMBBALL ) - { - if( getNetTypeGame() != NET_GAME_TYPE_CLIENT ) - { - bombBallExplosion(thisShot); - i--; - } - - continue; - } - - if( getNetTypeGame() != NET_GAME_TYPE_CLIENT ) - { - eventTuxIsDeadWIthShot(thisTux, thisShot); - } + bombBallExplosion(shot); } - - delObjectFromSpaceWithObject(arena->spaceShot, thisShot, destroyShot); - i--; - - continue; + + return; + } + + if( getNetTypeGame() != NET_GAME_TYPE_CLIENT ) + { + eventTuxIsDeadWIthShot(tux, shot); } } + + delObjectFromSpaceWithObject(arena->spaceShot, shot, destroyShot); +} + +static void action_shot(space_t *space, shot_t *shot, space_t *spaceTux) +{ + actionSpaceFromLocation(spaceTux, action_tux, shot, shot->x, shot->y, shot->w, shot->h); +} + +void eventConflictTuxWithShot(arena_t *arena) +{ + actionSpace(arena->spaceShot, action_shot, arena->spaceTux); } void moveTux(tux_t *tux, int n) -- cgit v1.2.3