diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-05-26 12:45:53 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-05-26 12:45:53 +0000 |
| commit | c94fd664bba352732bf0e5c9a77e709b49f1aa4f (patch) | |
| tree | 70936acfc33b46792ce1e3170de6a82f86edfe68 /src/pipe.c | |
| parent | a1e9bc7430ca827808a502f455b20a23ba15e31a (diff) | |
- mensie upravy v kode
- navod na zostavovanie projektu
- da sa to skompilovat :D
- PS: este to nie je odladene, a musim sa ucit na prijmacky na FEI
git-svn-id: http://opensvn.csie.org/tuxanci_ng@54 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/pipe.c')
| -rw-r--r-- | src/pipe.c | 223 |
1 files changed, 0 insertions, 223 deletions
diff --git a/src/pipe.c b/src/pipe.c deleted file mode 100644 index 9225be5..0000000 --- a/src/pipe.c +++ /dev/null @@ -1,223 +0,0 @@ - -#include <stdlib.h> -#include <stdio.h> -#include <assert.h> - -#include "main.h" -#include "pipe.h" -#include "shot.h" -#include "net_multiplayer.h" - -#ifndef PUBLIC_SERVER -#include "screen_world.h" -#include "layer.h" -#endif - -#ifdef PUBLIC_SERVER -#include "publicServer.h" -#endif - -#ifndef PUBLIC_SERVER -pipe_t* newPipe(int x, int y, int w, int h, int layer, int id, int id_out, int position, SDL_Surface *img) -#endif - -#ifdef PUBLIC_SERVER -pipe_t* newPipe(int x, int y, int w, int h, int layer, int id, int id_out, int position) -#endif - -{ - pipe_t *new; - -#ifndef PUBLIC_SERVER - assert( img != NULL ); -#endif - - new = malloc( sizeof(pipe_t) ); - assert( new != NULL ); - - new->x = x; - new->y = y; - new->w = w; - new->h = h; - new->layer = layer; - new->id = id; - new->id_out = id_out; - new->position = position; -#ifndef PUBLIC_SERVER - new->img = img; -#endif - return new; -} - -#ifndef PUBLIC_SERVER - -void drawPipe(pipe_t *p) -{ - assert( p != NULL ); - - addLayer(p->img, p->x, p->y, 0, 0, p->img->w, p->img->h, p->layer); -} - -void drawListPipe(list_t *listPipe) -{ - pipe_t *thisPipe; - int i; - - assert( listPipe != NULL ); - - for( i = 0 ; i < listPipe->count ; i++ ) - { - thisPipe = (pipe_t *)listPipe->list[i]; - assert( thisPipe != NULL ); - drawPipe(thisPipe); - } -} - -#endif - -pipe_t* isConflictWithListPipe(list_t *listPipe, int x, int y, int w, int h) -{ - pipe_t *thisPipe; - int i; - - assert( listPipe != NULL ); - - for( i = 0 ; i < listPipe->count ; i++ ) - { - thisPipe = (pipe_t *)listPipe->list[i]; - assert( thisPipe != NULL ); - - if( conflictSpace(x, y, w, h, - thisPipe->x, thisPipe->y, thisPipe->w, thisPipe->h) ) - { - return thisPipe; - } - } - - return NULL; -} - -static int negPosition(int n) -{ - switch( n ) - { - case TUX_UP : - return TUX_DOWN; - - case TUX_LEFT : - return TUX_RIGHT; - - case TUX_RIGHT : - return TUX_LEFT; - - case TUX_DOWN : - return TUX_UP; - - default : - assert( ! "premenna n ma zlu hodnotu !" ); - break; - } -} - -static pipe_t* getPipeId(list_t *listPipe, int id) -{ - int i; - - for( i = 0 ; i < listPipe->count ; i++ ) - { - pipe_t *thisPipe; - - thisPipe = (pipe_t *) listPipe->list[i]; - - if( thisPipe->id == id ) - { - return thisPipe; - } - } - - return NULL; -} - -static void moveShotFromPipe(shot_t *shot, pipe_t *pipe, list_t *listPipe) -{ - pipe_t *distPipe; - - distPipe = getPipeId(listPipe, pipe->id_out); - - if( distPipe == NULL ) - { - fprintf(stderr, "Pipe %d ID not found\n", pipe->id); - return; - } -/* - moveShot(shot, distPipe->position, pipe->x, pipe->y, - distPipe->x, distPipe->y, distPipe->w, distPipe->h); -*/ -} - -void eventConflictShotWithPipe(list_t *listPipe, list_t *listShot) -{ - shot_t *thisShot; - pipe_t *thisPipe; - int i; - - assert( listPipe != NULL ); - assert( listShot != NULL ); - - for( i = 0 ; i < listShot->count ; i++ ) - { - thisShot = (shot_t *)listShot->list[i]; - assert( thisShot != NULL ); - - if( ( thisPipe = isConflictWithListPipe(listPipe, thisShot->x, thisShot->y, - thisShot->w, thisShot->h) ) != NULL ) - { - tux_t *author; - - author = getTuxID(getCurrentArena()->listTux, thisShot->author_id); - - if( author != NULL && - author->bonus == BONUS_GHOST && - author->bonus_time > 0 ) - { - continue; - } - - if( negPosition( thisShot->position ) == thisPipe->position ) - { - if( getNetTypeGame() == NET_GAME_TYPE_CLIENT ) - { - if( thisShot->gun != GUN_BOMBBALL ) - { - delListItem(listShot, i, destroyShot); - i--; - } - } - else - { - moveShotFromPipe(thisShot, thisPipe, listPipe); - } - } - else - { - if( thisShot->gun == GUN_BOMBBALL && getNetTypeGame() != NET_GAME_TYPE_CLIENT ) - { - boundBombBall(thisShot); - continue; - } - else - { - delListItem(listShot, i, destroyShot); - i--; - } - } - } - } -} - -void destroyPipe(pipe_t *p) -{ - assert( p != NULL ); - free(p); -} - |