diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-07-18 19:19:10 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-07-18 19:19:10 +0000 |
| commit | 8b93dd8dac51e28bb25ad341f594d21a955c3adb (patch) | |
| tree | e04e9ea1d2d9b57c77617614283fc8756c96d53c /src/modules/modWall.c | |
| parent | a5a03e684b5ed3e8781ce30e5ffd4f73b59c3e97 (diff) | |
- bezpecnejsie prepiannie screenov ( uz sa to nedeje v event() daneho screenu aj ked to on vyvolal )
- do laveho horneho rohu s nevypisuju blbiny
- moduly pouzivaju funkcie actionSpace a actionSpaceFromLocation
- dane funkcie sa pouzivaju aj pri vykreslovani objektov
- btw. je jedno kolko zeru tuxanci top, na kerneli-2.6.25.* to zralo X a na kerneli 2.6.26 to zere 2*X
git-svn-id: http://opensvn.csie.org/tuxanci_ng@159 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/modules/modWall.c')
| -rwxr-xr-x | src/modules/modWall.c | 99 |
1 files changed, 41 insertions, 58 deletions
diff --git a/src/modules/modWall.c b/src/modules/modWall.c index 0422bbe..8376e29 100755 --- a/src/modules/modWall.c +++ b/src/modules/modWall.c @@ -110,51 +110,6 @@ void drawListWall(list_t *list) #endif -void eventConflictShotWithWall() -{ - arena_t *arena; - shot_t *thisShot; - tux_t *author; - int i; - - arena = export_fce->fce_getCurrentArena(); - - for( i = 0 ; i < arena->spaceShot->list->count ; i++ ) - { - thisShot = (shot_t *)arena->spaceShot->list->list[i]; - assert( thisShot != NULL ); - - if( isConflictWithObjectFromSpace(spaceWall, thisShot->x, thisShot->y, thisShot->w, thisShot->h) ) - { - author = getObjectFromSpaceWithID( - export_fce->fce_getCurrentArena()->spaceTux, thisShot->author_id ); - - if( author != NULL && - author->bonus == BONUS_GHOST && - author->bonus_time > 0 ) - { - continue; - } - - if( thisShot->gun == GUN_BOMBBALL) - { - if( export_fce->fce_getNetTypeGame() != NET_GAME_TYPE_CLIENT ) - { - export_fce->fce_boundBombBall(thisShot); - } - - continue; - } - - delObjectFromSpaceWithObject(export_fce->fce_getCurrentArena()->spaceShot, - thisShot, export_fce->fce_destroyShot); - - //delListItem(listShot, i, export_fce->fce_destroyShot); - i--; - } - } -} - void destroyWall(wall_t *p) { assert( p != NULL ); @@ -285,25 +240,19 @@ int init(export_fce_t *p) #ifndef PUBLIC_SERVER -int draw(int x, int y, int w, int h) +static void action_drawwall(space_t *space, wall_t *wall, void *p) { - wall_t *thisWall; - int i; + drawWall(wall); +} +int draw(int x, int y, int w, int h) +{ if( spaceWall == NULL ) { return 0; } - listDoEmpty(listWall); - getObjectFromSpace(spaceImgWall, x, y, w, h, listWall); - - for( i = 0 ; i < listWall->count ; i++ ) - { - thisWall = (wall_t *)listWall->list[i]; - assert( thisWall != NULL ); - drawWall(thisWall); - } + actionSpaceFromLocation(spaceImgWall, action_drawwall, NULL, x, y, w, h); //printSpace(spaceWall); @@ -311,6 +260,39 @@ int draw(int x, int y, int w, int h) } #endif +static void action_eventwall(space_t *space, wall_t *wall, 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( shot->gun == GUN_BOMBBALL) + { + if( export_fce->fce_getNetTypeGame() != NET_GAME_TYPE_CLIENT ) + { + export_fce->fce_boundBombBall(shot); + } + + return; + } + + delObjectFromSpaceWithObject(arena->spaceShot, shot, export_fce->fce_destroyShot); +} + +static void action_eventshot(space_t *space, shot_t *shot, space_t *spaceWall) +{ + actionSpaceFromLocation(spaceWall, action_eventwall, shot, shot->x, shot->y, shot->w, shot->h); +} int event() { @@ -319,7 +301,8 @@ int event() return 0; } - eventConflictShotWithWall(export_fce->fce_getCurrentArena()->spaceShot->list); + actionSpace(export_fce->fce_getCurrentArena()->spaceShot, action_eventshot, spaceWall); + return 0; } |