From 4919e623c6695a80aaf96187253756dcbb72bf87 Mon Sep 17 00:00:00 2001 From: oroborus Date: Sun, 8 Jun 2008 21:43:44 +0000 Subject: - kod bol prepisany tak aby dokazal pracovat aj s arenami vascimi ako je obrazovka okna ( ako pozadie na arenu sa da pouzit aj tepeta aj textura ) git-svn-id: http://opensvn.csie.org/tuxanci_ng@62 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/tux.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src/tux.c') diff --git a/src/tux.c b/src/tux.c index c925019..8c89207 100644 --- a/src/tux.c +++ b/src/tux.c @@ -248,6 +248,21 @@ void replaceTuxID(tux_t *tux, int id) tux->id = id; } +int isTuxSeesTux(tux_t *tux, tux_t *thisTux) +{ + int tux_x, tux_y, tux_w, tux_h; + int thisTux_x, thisTux_y, thisTux_w, thisTux_h; + int screen_x, screen_y; + + getTuxProportion(tux, &tux_x, &tux_y, &tux_w, &tux_h); + getTuxProportion(thisTux, &thisTux_x, &thisTux_y, &thisTux_w, &thisTux_h); + + getCenterScreen(&screen_x, &screen_y, tux->x, tux->y); + + return conflictSpace(screen_x, screen_y, + WINDOW_SIZE_X, WINDOW_SIZE_Y, thisTux_x, thisTux_y, thisTux_w, thisTux_h); +} + tux_t* isConflictWithListTux(list_t *listTux, int x, int y, int w, int h) { tux_t *thisTux; @@ -564,6 +579,9 @@ void moveTux(tux_t *tux, int n) int x, y, w, h; arena_t *arena; +/* + printf("%d %d\n", tux->x, tux->y); +*/ /* static my_time_t lastTime = 0; my_time_t currentTime; @@ -582,6 +600,8 @@ void moveTux(tux_t *tux, int n) assert( tux != NULL ); + arena = getCurrentArena(); + if( tux->position != n ) { tux->position = n; @@ -593,7 +613,7 @@ void moveTux(tux_t *tux, int n) return; } - if( n == TUX_RIGHT && tux->x+TUX_STEP >= WINDOW_SIZE_X ) + if( n == TUX_RIGHT && tux->x+TUX_STEP >= arena->w ) { return; } @@ -603,12 +623,11 @@ void moveTux(tux_t *tux, int n) return; } - if( n == TUX_DOWN && tux->y+TUX_STEP >= WINDOW_SIZE_Y ) + if( n == TUX_DOWN && tux->y+TUX_STEP >= arena->h ) { return; } - arena = getCurrentArena(); getCourse(tux->position, &px, &py); zal_x = tux->x; -- cgit v1.2.3