From 77465c2629ef63629d69c97a0af60a47a07ce7f5 Mon Sep 17 00:00:00 2001 From: oroborus Date: Thu, 17 Jul 2008 20:49:03 +0000 Subject: - opravena chyba, tux mophol pomocou bombballu vybuchnuteho v objekte do ktoreho sa dostal ako duch pridavat itemy - kod namiesto SDL_Surface pouziva moj typ image_t git-svn-id: http://opensvn.csie.org/tuxanci_ng@154 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/base/arena.h | 4 ++-- src/base/item.c | 10 ++++++---- src/base/item.h | 4 ++-- src/base/modules.h | 4 ++-- src/base/proto.c | 2 +- src/base/shot.c | 8 ++++---- src/base/shot.h | 4 ++-- src/base/tux.c | 30 +++++++++++++++++++++++------- src/base/tux.h | 1 + 9 files changed, 43 insertions(+), 24 deletions(-) (limited to 'src/base') diff --git a/src/base/arena.h b/src/base/arena.h index e7f70ea..9512222 100644 --- a/src/base/arena.h +++ b/src/base/arena.h @@ -6,7 +6,7 @@ #include "main.h" #ifndef PUBLIC_SERVER -#include "interface.h" +#include "image.h" #endif #ifdef __WIN32__ @@ -21,7 +21,7 @@ typedef struct arena_struct #ifndef PUBLIC_SERVER char music[STR_SIZE]; - SDL_Surface *background; + image_t *background; #endif int w, h; list_t *listTimer; diff --git a/src/base/item.c b/src/base/item.c index ef83066..c341754 100644 --- a/src/base/item.c +++ b/src/base/item.c @@ -33,7 +33,7 @@ #endif #ifndef PUBLIC_SERVER -static SDL_Surface *g_item[ITEM_COUNT]; +static image_t *g_item[ITEM_COUNT]; #endif static bool_t isItemInit = FALSE; @@ -512,6 +512,8 @@ static void action_giveitem(space_t *space, item_t *item, tux_t *tux) } delObjectFromSpaceWithObject(space, item, destroyItem); + + addNewItem(space, ID_UNKNOWN); break; case ITEM_MINE : @@ -543,10 +545,10 @@ static void action_giveitem(space_t *space, item_t *item, tux_t *tux) } delObjectFromSpaceWithObject(space, item, destroyItem); + + addNewItem(space, ID_UNKNOWN); break; } - - addNewItem(space, ID_UNKNOWN); } void eventGiveTuxListItem(tux_t *tux, space_t *spaceItem) @@ -558,7 +560,7 @@ void eventGiveTuxListItem(tux_t *tux, space_t *spaceItem) if( getNetTypeGame() == NET_GAME_TYPE_CLIENT ) { - return; + return; } if( tux->status == TUX_STATUS_DEAD ) diff --git a/src/base/item.h b/src/base/item.h index e7900d7..9dcb678 100644 --- a/src/base/item.h +++ b/src/base/item.h @@ -8,7 +8,7 @@ #define ITEM_SYNC_TIMEOUT 5000 #ifndef PUBLIC_SERVER -#include "interface.h" +#include "image.h" #endif #ifdef __WIN32__ @@ -35,7 +35,7 @@ typedef struct item_struct int author_id; #ifndef PUBLIC_SERVER - SDL_Surface *img; //obrazok + image_t *img; //obrazok #endif } item_t; diff --git a/src/base/modules.h b/src/base/modules.h index 1d68568..9705d7f 100644 --- a/src/base/modules.h +++ b/src/base/modules.h @@ -21,9 +21,9 @@ typedef struct export_fce_s int (*fce_getValue)(char *line, char *env, char *val, int len); #ifndef PUBLIC_SERVER - SDL_Surface* (*fce_getImage)(char *group, char *name); + image_t* (*fce_getImage)(char *group, char *name); - void (*fce_addLayer)(SDL_Surface *img, + void (*fce_addLayer)(image_t *img, int x,int y, int px,int py, int w,int h, int player); #endif diff --git a/src/base/proto.c b/src/base/proto.c index 6d4c2f2..e42e4d9 100644 --- a/src/base/proto.c +++ b/src/base/proto.c @@ -115,7 +115,7 @@ void proto_recv_hello_server(client_t *client, char *msg) name[STR_NAME_SIZE-1] = '\0'; } - strcpy(client->tux->name, name); + tuxSetName(client->tux, name); sendInfoCreateClient(client); } diff --git a/src/base/shot.c b/src/base/shot.c index c631a26..5e95a8e 100644 --- a/src/base/shot.c +++ b/src/base/shot.c @@ -22,10 +22,10 @@ #ifndef PUBLIC_SERVER -static SDL_Surface *g_shot_simple; -static SDL_Surface *g_shot_lasserX; -static SDL_Surface *g_shot_lasserY; -static SDL_Surface *g_shot_bombball; +static image_t *g_shot_simple; +static image_t *g_shot_lasserX; +static image_t *g_shot_lasserY; +static image_t *g_shot_bombball; #endif diff --git a/src/base/shot.h b/src/base/shot.h index c507976..d279c02 100644 --- a/src/base/shot.h +++ b/src/base/shot.h @@ -13,7 +13,7 @@ #endif #ifndef PUBLIC_SERVER -#include "interface.h" +#include "image.h" #endif typedef struct shot_struct @@ -36,7 +36,7 @@ typedef struct shot_struct bool_t isCanKillAuthor; #ifndef PUBLIC_SERVER - SDL_Surface *img; + image_t *img; #endif } shot_t; diff --git a/src/base/tux.c b/src/base/tux.c index cfaaddf..bbc63e0 100644 --- a/src/base/tux.c +++ b/src/base/tux.c @@ -18,6 +18,7 @@ #include "idManager.h" #ifndef PUBLIC_SERVER +#include "font.h" #include "image.h" #include "layer.h" #include "term.h" @@ -36,11 +37,11 @@ #ifndef PUBLIC_SERVER -static SDL_Surface *g_tux_up; -static SDL_Surface *g_tux_right; -static SDL_Surface *g_tux_left; -static SDL_Surface *g_tux_down; -static SDL_Surface *g_cross; +static image_t *g_tux_up; +static image_t *g_tux_right; +static image_t *g_tux_left; +static image_t *g_tux_down; +static image_t *g_cross; #endif @@ -104,6 +105,12 @@ tux_t* newTux() return new; } +void tuxSetName(tux_t *tux, char *name) +{ + strcpy(tux->name, name); + //tux->g_name = getFontImage(name, COLOR_WHITE); +} + bool_t isTuxAnyGun(tux_t *tux) { int i; @@ -156,7 +163,7 @@ void getCourse(int n, int *x, int *y) void drawTux(tux_t *tux) { - SDL_Surface *g_image = NULL; + image_t *g_image = NULL; assert( tux != NULL ); @@ -202,7 +209,16 @@ void drawTux(tux_t *tux) return; } - +/* + if( tux->g_name != NULL ) + { + addLayer(tux->g_name, + tux->x - TUX_IMG_WIDTH / 2, + ( tux->y + TUX_HEIGHT / 2 ) - TUX_IMG_HEIGHT, + 0, 0, + tux->g_name->w, tux->g_name->h, TUX_LAYER); + } +*/ addLayer(g_image, tux->x - TUX_IMG_WIDTH / 2, ( tux->y + TUX_HEIGHT / 2 ) - TUX_IMG_HEIGHT, diff --git a/src/base/tux.h b/src/base/tux.h index 4908af7..2d39195 100644 --- a/src/base/tux.h +++ b/src/base/tux.h @@ -112,6 +112,7 @@ typedef struct tux_struct extern bool_t isTuxInicialized(); extern void initTux(); extern tux_t* newTux(); +extern void tuxSetName(tux_t *tux, char *name); extern bool_t isTuxAnyGun(tux_t *tux); extern void getCourse(int n, int *x, int *y); extern void drawTux(tux_t *tux); -- cgit v1.2.3