summaryrefslogtreecommitdiff
path: root/src/tux.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-08 21:43:44 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-08 21:43:44 +0000
commit4919e623c6695a80aaf96187253756dcbb72bf87 (patch)
tree948fbcc211b1a8f13e3830853edef6505234bab2 /src/tux.c
parenta8110d0786e7931715a0d7116ed7d4c23697bdb6 (diff)
- 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
Diffstat (limited to 'src/tux.c')
-rw-r--r--src/tux.c25
1 files changed, 22 insertions, 3 deletions
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;
@@ -565,6 +580,9 @@ void moveTux(tux_t *tux, int n)
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;