summaryrefslogtreecommitdiff
path: root/src/screen_world.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-25 21:23:08 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-25 21:23:08 +0000
commitca324c005d511752b2bcdc21fdc7d6c46597469b (patch)
tree050b5b836f26390ef44f67a2208fe47c161e8b62 /src/screen_world.c
parent6d43cfd6df88e1b6e94c63f9e8e9eb6775bdbf42 (diff)
- drobne upravy v kode
- vymazanie duplivitneho kodu pri "hre s GUI" a "public serverom" git-svn-id: http://opensvn.csie.org/tuxanci_ng@36 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/screen_world.c')
-rw-r--r--src/screen_world.c88
1 files changed, 5 insertions, 83 deletions
diff --git a/src/screen_world.c b/src/screen_world.c
index 6bd1b9d..f61677f 100644
--- a/src/screen_world.c
+++ b/src/screen_world.c
@@ -58,15 +58,11 @@ void setGameType()
}
}
-arena_t* getWorldArena()
-{
- return arena;
-}
-
void setWorldArena(int id)
{
arena = getArena(id);
playMusic(arena->music, MUSIC_GROUP_USER);
+ setCurrentArena(arena);
}
void setMaxCountRound(int n)
@@ -165,73 +161,15 @@ void prepareArena()
void drawWorld()
{
- tux_t *tux = NULL;
-
- if( arena == NULL )
- {
- return;
- }
-
- addLayer(arena->background, 0, 0, 0, 0, WINDOW_SIZE_X, WINDOW_SIZE_Y, -100);
-
- drawListTux(arena->listTux);
- drawListWall(arena->listWall);
- drawListTeleport(arena->listTeleport);
- drawListPipe(arena->listPipe);
- drawListShot(arena->listShot);
- drawListItem(arena->listItem);
-
-/*
- tux = getControlTux( TUX_CONTROL_KEYBOARD_RIGHT );
-*/
-
- if( tux == NULL )
- {
- drawLayerCenter(WINDOW_SIZE_X/2, WINDOW_SIZE_Y/2);
- }
- else
+ if( arena != NULL )
{
- drawLayerCenter(tux->x, tux->y);
+ drawArena(arena);
+ drawPanel(arena->listTux);
}
- drawPanel(arena->listTux);
drawTerm();
}
-int conflictSpace(int x1,int y1,int w1,int h1,int x2,int y2,int w2,int h2)
-{
- return (x1<x2+w2 && x2<x1+w1 && y1<y2+h2 && y2<y1+h1);
-}
-
-int isFreeSpace(int x, int y, int w, int h)
-{
- if ( isConflictWithListTux(arena->listTux, x, y, w, h) )return 0;
- if ( isConflictWithListWall(arena->listWall, x, y, w, h) )return 0;
- if ( isConflictWithListShot(arena->listShot, x, y, w, h) )return 0;
- if ( isConflictWithListItem(arena->listItem, x, y, w, h) )return 0;
- if ( isConflictWithListTeleport(arena->listTeleport, x, y, w, h) )return 0;
- if ( isConflictWithListPipe(arena->listPipe, x, y, w, h) )return 0;
-
- return 1;
-}
-
-void findFreeSpace(int *x, int *y, int w, int h)
-{
- int z_x;
- int z_y;
-
- assert( x != NULL );
- assert( y != NULL );
-
- do{
- z_x = random() % WINDOW_SIZE_X;
- z_y = random() % (WINDOW_SIZE_Y-200);
- }while( isFreeSpace(z_x, z_y ,w ,h) == 0 );
-
- *x = z_x;
- *y = z_y;
-}
-
static void netAction(tux_t *tux, int action)
{
if( getSettingGameType() == NET_GAME_TYPE_SERVER )
@@ -366,8 +304,6 @@ void tuxControl(tux_t *p)
void eventWorld()
{
- int i;
-
if( arena == NULL )
{
eventNetMultiplayer();
@@ -378,21 +314,7 @@ void eventWorld()
eventNetMultiplayer();
- eventConflictTuxWithTeleport(arena->listTux, arena->listTeleport);
- eventConflictTuxWithShot(arena->listTux, arena->listShot);
-
- for( i = 0 ; i < 4 ; i++)
- {
- eventMoveListShot(arena->listShot);
- eventConflictShotWithWall(arena->listWall, arena->listShot);
- eventConflictShotWithTeleport(arena->listTeleport, arena->listShot);
- eventConflictShotWithPipe(arena->listPipe, arena->listShot);
- eventConflictShotWithItem(arena->listItem, arena->listShot);
- }
-
- eventListItem(arena->listItem);
-
- eventListTux(arena->listTux);
+ eventArena(arena);
eventTimer();
eventTerm();