summaryrefslogtreecommitdiff
path: root/src/modules/modTeleport.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/modTeleport.c')
-rwxr-xr-xsrc/modules/modTeleport.c106
1 files changed, 44 insertions, 62 deletions
diff --git a/src/modules/modTeleport.c b/src/modules/modTeleport.c
index 1411b88..28ebeb6 100755
--- a/src/modules/modTeleport.c
+++ b/src/modules/modTeleport.c
@@ -380,96 +380,78 @@ int init(export_fce_t *p)
}
#ifndef PUBLIC_SERVER
-int draw(int x, int y, int w, int h)
+
+static void action_drawteleport(space_t *space, teleport_t *teleport, void *p)
{
- teleport_t *thisTeleport;
- int i;
+ drawTeleport(teleport);
+}
+int draw(int x, int y, int w, int h)
+{
if( spaceTeleport == NULL )
{
return 0;
}
- listDoEmpty(listTeleport);
- getObjectFromSpace(spaceTeleport, x, y, w, h, listTeleport);
-
- for( i = 0 ; i < listTeleport->count ; i++ )
- {
- thisTeleport = (teleport_t *)listTeleport->list[i];
- assert( thisTeleport != NULL );
- drawTeleport(thisTeleport);
- }
+ actionSpaceFromLocation(spaceTeleport, action_drawteleport, NULL, x, y, w, h);
return 0;
}
#endif
-int event()
+static void action_eventteleportshot(space_t *space, teleport_t *teleport, shot_t *shot)
{
- teleport_t *thisTeleport;
arena_t *arena;
- int i;
-
- if( spaceTeleport == NULL )
- {
- return 0;
- }
-
- if( export_fce->fce_getNetTypeGame() == NET_GAME_TYPE_CLIENT )
- {
- return 0;
- }
+ tux_t *author;
arena = export_fce->fce_getCurrentArena();
- for( i = 0 ; i < arena->spaceTux->list->count ; i++ )
+ author = getObjectFromSpaceWithID(arena->spaceTux, shot->author_id);
+
+ if( author != NULL &&
+ author->bonus == BONUS_GHOST &&
+ author->bonus_time > 0 )
{
- tux_t *thisTux;
- int x, y, w, h;
- int j;
+ return;
+ }
- thisTux = (tux_t *)arena->spaceTux->list->list[i];
- export_fce->fce_getTuxProportion(thisTux, &x, &y, &w, &h);
+ moveShotFromTeleport(shot, teleport, spaceTeleport->list);
+}
- listDoEmpty(listTeleport);
- getObjectFromSpace(spaceTeleport, x, y, w, h, listTeleport);
+static void action_eventshot(space_t *space, shot_t *shot, space_t *spaceTeleport)
+{
+ actionSpaceFromLocation(spaceTeleport, action_eventteleportshot, shot, shot->x, shot->y, shot->w, shot->h);
+}
- for( j = 0 ; j < listTeleport->count ; j++ )
- {
- thisTeleport = (teleport_t *)listTeleport->list[j];
- teleportTux(thisTux, thisTeleport);
- }
- }
-
- for( i = 0 ; i < arena->spaceShot->list->count ; i++ )
- {
- shot_t *thisShot;
- int j;
+static void action_eventteleporttux(space_t *space, teleport_t *teleport, tux_t *tux)
+{
+ teleportTux(tux, teleport);
+}
- thisShot = (shot_t *)arena->spaceShot->list->list[i];
- assert( thisShot != NULL );
+static void action_eventtux(space_t *space, tux_t *tux, space_t *spaceTeleport)
+{
+ int x, y, w, h;
- listDoEmpty(listTeleport);
- getObjectFromSpace(spaceTeleport, thisShot->x, thisShot->y, thisShot->w, thisShot->h, listTeleport);
+ export_fce->fce_getTuxProportion(tux, &x, &y, &w, &h);
- for( j = 0 ; j < listTeleport->count ; j++ )
- {
- tux_t *author;
+ actionSpaceFromLocation(spaceTeleport, action_eventteleporttux, tux, x, y, w, h);
+}
- thisTeleport = (teleport_t *)listTeleport->list[j];
- author = getObjectFromSpaceWithID(arena->spaceTux, thisShot->author_id);
-
- if( author != NULL &&
- author->bonus == BONUS_GHOST &&
- author->bonus_time > 0 )
- {
- continue;
- }
+int event()
+{
+ if( spaceTeleport == NULL )
+ {
+ return 0;
+ }
- moveShotFromTeleport(thisShot, thisTeleport, spaceTeleport->list);
- }
+ if( export_fce->fce_getNetTypeGame() == NET_GAME_TYPE_CLIENT )
+ {
+ return 0;
}
+ actionSpace(export_fce->fce_getCurrentArena()->spaceShot, action_eventshot, spaceTeleport);
+ actionSpace(export_fce->fce_getCurrentArena()->spaceTux, action_eventtux, spaceTeleport);
+
return 0;
}