From e5120505b21ff38dc25efcad129a440bbfa9996d Mon Sep 17 00:00:00 2001 From: oroborus Date: Wed, 28 May 2008 19:25:15 +0000 Subject: - zrychlenie hry, bez toho aby sa menila rychlost hlavneho casovaca - oprava chyby v ID managery - ID manager spravuje ID-y pre vsetky objekty git-svn-id: http://opensvn.csie.org/tuxanci_ng@55 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/shot.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'src/shot.c') diff --git a/src/shot.c b/src/shot.c index cdbdb4e..f19e99c 100644 --- a/src/shot.c +++ b/src/shot.c @@ -30,7 +30,6 @@ static SDL_Surface *g_shot_bombball; #endif static bool_t isShotInit = FALSE; -static list_t *listID; bool_t isShotInicialized() { @@ -52,8 +51,6 @@ void initShot() #endif - listID = newListID(); - isShotInit = TRUE; } @@ -65,7 +62,7 @@ shot_t* newShot(int x,int y, int px, int py, int gun, int author_id) new = malloc( sizeof(shot_t) ); memset(new, 0, sizeof(shot_t) ); - new->id = getNewID(listID); + new->id = getNewID(); new->x = x; new->y = y; new->px = px; @@ -156,7 +153,7 @@ shot_t* getShotID(list_t *listShot, int id) void replaceShotID(shot_t *shot, int id) { - replaceID(listID, shot->id, id); + replaceID(shot->id, id); shot->id = id; } @@ -247,6 +244,29 @@ void boundBombBall(shot_t *shot) } } +void transformOnlyLasser(shot_t *shot) +{ + switch( shot->position ) + { + case TUX_RIGHT : + case TUX_LEFT : + shot->w = GUN_LASSER_HORIZONTAL; + shot->h = GUN_SHOT_VERTICAL; +#ifndef PUBLIC_SERVER + shot->img = g_shot_lasserX; +#endif + break; + case TUX_UP : + case TUX_DOWN : + shot->w = GUN_SHOT_VERTICAL; + shot->h = GUN_LASSER_HORIZONTAL; +#ifndef PUBLIC_SERVER + shot->img = g_shot_lasserY; +#endif + break; + } +} + void eventMoveListShot(list_t *listShot) { shot_t *thisShot; @@ -411,13 +431,11 @@ void moveShot(shot_t *shot, int position, int src_x, int src_y, void destroyShot(shot_t *p) { assert( p != NULL ); - delID(listID, p->id); + delID(p->id); free(p); } void quitShot() { - destroyListID(listID); isShotInit = FALSE; } - -- cgit v1.2.3