From d9e265975297fb712213fbbf12c43b6ca68fc846 Mon Sep 17 00:00:00 2001 From: oroborus Date: Tue, 26 Feb 2008 20:42:25 +0000 Subject: par drobnych uprav, casovac je nastaveny na 50ms aby to nezralo procak git-svn-id: http://opensvn.csie.org/tuxanci_ng@5 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- include/interface.h | 2 +- include/item.h | 2 +- include/screen_world.h | 2 ++ include/tux.h | 4 ++-- sound/dead.ogg | Bin 0 -> 17112 bytes sound/end.ogg | Bin 0 -> 153633 bytes sound/explozion.ogg | Bin 0 -> 15987 bytes sound/gun2.ogg | Bin 0 -> 4789 bytes sound/gun_lasser.ogg | Bin 0 -> 8348 bytes sound/gun_revolver.ogg | Bin 0 -> 7441 bytes sound/gun_scatter.ogg | Bin 0 -> 10303 bytes sound/gun_tommy.ogg | Bin 0 -> 9460 bytes sound/item_bonus.ogg | Bin 0 -> 7339 bytes sound/item_gun.ogg | Bin 0 -> 4604 bytes sound/odraz-gun.ogg | Bin 0 -> 14901 bytes sound/odraz-l.ogg | Bin 0 -> 13561 bytes sound/odraz-r.ogg | Bin 0 -> 13581 bytes sound/put_mine.ogg | Bin 0 -> 5463 bytes sound/switch_gun.ogg | Bin 0 -> 6401 bytes sound/teleport.ogg | Bin 0 -> 20232 bytes src/gun.c | 36 +++++++++++++----------------------- src/interface.c | 18 ++++++++++++++++-- src/item.c | 1 + src/myTimer.c | 6 ++++++ src/screen.c | 2 +- src/screen_world.c | 25 +++++++++++++++++++++++-- src/tux.c | 1 + 27 files changed, 67 insertions(+), 32 deletions(-) create mode 100644 sound/dead.ogg create mode 100644 sound/end.ogg create mode 100644 sound/explozion.ogg create mode 100644 sound/gun2.ogg create mode 100644 sound/gun_lasser.ogg create mode 100644 sound/gun_revolver.ogg create mode 100644 sound/gun_scatter.ogg create mode 100644 sound/gun_tommy.ogg create mode 100644 sound/item_bonus.ogg create mode 100644 sound/item_gun.ogg create mode 100644 sound/odraz-gun.ogg create mode 100644 sound/odraz-l.ogg create mode 100644 sound/odraz-r.ogg create mode 100644 sound/put_mine.ogg create mode 100644 sound/switch_gun.ogg create mode 100644 sound/teleport.ogg diff --git a/include/interface.h b/include/interface.h index abd37f3..3335ff1 100755 --- a/include/interface.h +++ b/include/interface.h @@ -28,7 +28,7 @@ #define USR_EVT_TIMER 0 //interval pri ktorom sa spusta akcia(); -#define INTERVAL 25 +#define INTERVAL 50 extern bool_t isInterfaceInicialized(); extern int initSDL(); diff --git a/include/item.h b/include/item.h index 7f40c45..49b3173 100644 --- a/include/item.h +++ b/include/item.h @@ -25,7 +25,7 @@ typedef struct item_struct } item_t; -#define ITEM_MAX_COUNT 3 +#define ITEM_MAX_COUNT 2 #define ITEM_GUN_MAX_FRAME 8 #define ITEM_MINE_MAX_FRAME 1 diff --git a/include/screen_world.h b/include/screen_world.h index 3ce7cc7..937e0a2 100644 --- a/include/screen_world.h +++ b/include/screen_world.h @@ -7,6 +7,8 @@ #include "tux.h" #include "arena.h" +#define TIMER_END_ARENA 5000 + extern bool_t isScreenWorldInicialized(); extern void initWorld(); extern arena_t* getWorldArena(); diff --git a/include/tux.h b/include/tux.h index e73f934..ed5e01e 100644 --- a/include/tux.h +++ b/include/tux.h @@ -6,11 +6,11 @@ #include "main.h" #include "list.h" -#define TUX_STEP 4 +#define TUX_STEP 6 #define TUX_LAYER 0 #define TUX_MAX_ANIMATION_FRAME 10 #define TUX_MAX_PICKUP 50 -#define TUX_MAX_BONUS 500 +#define TUX_MAX_BONUS 250 #define TUX_TIME_SPAWN 2000 #define TUX_TIME_CAN_SHOT 500 diff --git a/sound/dead.ogg b/sound/dead.ogg new file mode 100644 index 0000000..a78c53a Binary files /dev/null and b/sound/dead.ogg differ diff --git a/sound/end.ogg b/sound/end.ogg new file mode 100644 index 0000000..613265e Binary files /dev/null and b/sound/end.ogg differ diff --git a/sound/explozion.ogg b/sound/explozion.ogg new file mode 100644 index 0000000..6018394 Binary files /dev/null and b/sound/explozion.ogg differ diff --git a/sound/gun2.ogg b/sound/gun2.ogg new file mode 100644 index 0000000..2a360fd Binary files /dev/null and b/sound/gun2.ogg differ diff --git a/sound/gun_lasser.ogg b/sound/gun_lasser.ogg new file mode 100644 index 0000000..56a7257 Binary files /dev/null and b/sound/gun_lasser.ogg differ diff --git a/sound/gun_revolver.ogg b/sound/gun_revolver.ogg new file mode 100644 index 0000000..79dcefd Binary files /dev/null and b/sound/gun_revolver.ogg differ diff --git a/sound/gun_scatter.ogg b/sound/gun_scatter.ogg new file mode 100644 index 0000000..32c267f Binary files /dev/null and b/sound/gun_scatter.ogg differ diff --git a/sound/gun_tommy.ogg b/sound/gun_tommy.ogg new file mode 100644 index 0000000..3c2ea41 Binary files /dev/null and b/sound/gun_tommy.ogg differ diff --git a/sound/item_bonus.ogg b/sound/item_bonus.ogg new file mode 100644 index 0000000..c2b8ba8 Binary files /dev/null and b/sound/item_bonus.ogg differ diff --git a/sound/item_gun.ogg b/sound/item_gun.ogg new file mode 100644 index 0000000..1b749da Binary files /dev/null and b/sound/item_gun.ogg differ diff --git a/sound/odraz-gun.ogg b/sound/odraz-gun.ogg new file mode 100644 index 0000000..c007ae7 Binary files /dev/null and b/sound/odraz-gun.ogg differ diff --git a/sound/odraz-l.ogg b/sound/odraz-l.ogg new file mode 100644 index 0000000..258dbd5 Binary files /dev/null and b/sound/odraz-l.ogg differ diff --git a/sound/odraz-r.ogg b/sound/odraz-r.ogg new file mode 100644 index 0000000..c885172 Binary files /dev/null and b/sound/odraz-r.ogg differ diff --git a/sound/put_mine.ogg b/sound/put_mine.ogg new file mode 100644 index 0000000..b5fa822 Binary files /dev/null and b/sound/put_mine.ogg differ diff --git a/sound/switch_gun.ogg b/sound/switch_gun.ogg new file mode 100644 index 0000000..e453472 Binary files /dev/null and b/sound/switch_gun.ogg differ diff --git a/sound/teleport.ogg b/sound/teleport.ogg new file mode 100644 index 0000000..1d1ead1 Binary files /dev/null and b/sound/teleport.ogg differ diff --git a/src/gun.c b/src/gun.c index 9e5fd5d..3ad1bac 100644 --- a/src/gun.c +++ b/src/gun.c @@ -15,38 +15,28 @@ #include "interface.h" #include "gun.h" -static void modificiationCopuse(int courser, - int right_x, int right_y, int right_px, int right_py, - int *dest_x, int *dest_y, int *dest_px, int *dest_py) +static void modificiationCopuse(int courser, int right_x, int right_y, int *dest_x, int *dest_y) { - assert( dest_px != NULL ); - assert( dest_py != NULL ); + assert( dest_x != NULL ); + assert( dest_y != NULL ); switch( courser ) { case TUX_UP : *dest_x = right_y; *dest_y = -right_x; - *dest_px = right_py; - *dest_py = -right_px; break; case TUX_RIGHT : *dest_x = right_x; *dest_y = right_y; - *dest_px = right_px; - *dest_py = right_py; break; case TUX_LEFT : *dest_x = -right_x; *dest_y = right_y; - *dest_px = -right_px; - *dest_py = right_py; break; case TUX_DOWN : *dest_x = right_y; *dest_y = right_x; - *dest_px = right_py; - *dest_py = right_px; break; default : assert( ! "V premennej courser je zly smer !" ); @@ -90,8 +80,8 @@ static void addShot(tux_t *tux,int x, int y, int px, int py) case 3 : tux->position = TUX_DOWN; break; } - modificiationCopuse(tux->position, x, y, px, py, - &dest_x, &dest_y, &dest_px, &dest_py); + modificiationCopuse(tux->position, x, y, &dest_x, &dest_y); + modificiationCopuse(tux->position, px, py, &dest_px, &dest_py); shot = newShot(tux->x + dest_x, tux->y + dest_y, dest_px, dest_py, gun, tux); addList( arena->listShot, shot ); @@ -101,8 +91,8 @@ static void addShot(tux_t *tux,int x, int y, int px, int py) } else { - modificiationCopuse(tux->position, x, y, px, py, - &dest_x, &dest_y, &dest_px, &dest_py); + modificiationCopuse(tux->position, x, y, &dest_x, &dest_y); + modificiationCopuse(tux->position, px, py, &dest_px, &dest_py); shot = newShot(tux->x + dest_x, tux->y + dest_y, dest_px, dest_py, gun, tux); addList( arena->listShot, shot ); @@ -111,13 +101,13 @@ static void addShot(tux_t *tux,int x, int y, int px, int py) static void shotInGunSimpe(tux_t *tux) { - addShot(tux, 0, 0, +10, 0); + addShot(tux, 0, 0, +20, 0); } static void shotInGunDualSimpe(tux_t *tux) { - addShot(tux, 0, -5, +10, 0); - addShot(tux, 0, +5, +10, 0); + addShot(tux, 0, -5, +20, 0); + addShot(tux, 0, +5, +20, 0); } static void shotInGunScatter(tux_t *tux) @@ -126,7 +116,7 @@ static void shotInGunScatter(tux_t *tux) for( i = -2 ; i <= +2 ; i++ ) { - addShot(tux, 0, 0, +12, i); + addShot(tux, 0, 0, +25, i); } } @@ -145,7 +135,7 @@ static void timer_addShotTimer(void *p) gun = tux->gun; tux->gun = GUN_SIMPLE; - addShot(tux, 0, 0, +15, 0); + addShot(tux, 0, 0, +25, 0); tux->gun = gun; } @@ -174,7 +164,7 @@ static void timer_addLaserTimer(void *p) gun = tux->gun; tux->gun = GUN_LASSER; - addShot(tux, 0, 0, +20, 0); + addShot(tux, 0, 0, +25, 0); tux->gun = gun; } diff --git a/src/interface.c b/src/interface.c index f47c2dd..42ced59 100755 --- a/src/interface.c +++ b/src/interface.c @@ -5,12 +5,13 @@ //povrch okna static SDL_Surface *screen; +static SDL_Surface *fake_screen; //casovac static SDL_TimerID timer; //priznaky okna -static Uint32 g_win_flags = SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_ANYFORMAT; +static Uint32 g_win_flags = SDL_HWSURFACE|SDL_DOUBLEBUF; static bool_t isInterfaceInit = FALSE; @@ -48,6 +49,11 @@ int initSDL() //screen = SDL_SetVideoMode(WINDOW_SIZE_X, WINDOW_SIZE_Y, 0, g_win_flags); screen = SDL_SetVideoMode(WINDOW_SIZE_X, WINDOW_SIZE_Y, 0, g_win_flags); + fake_screen = SDL_CreateRGBSurface(screen->flags, WINDOW_SIZE_X, WINDOW_SIZE_Y, + screen->format->BitsPerPixel, + screen->format->Rmask, screen->format->Gmask, + screen->format->Bmask, screen->format->Amask); + if (screen == NULL ) { fprintf(stderr, "%s\n", SDL_GetError()); @@ -68,9 +74,17 @@ int initSDL() SDL_Surface* getSDL_Screen() { + //return fake_screen; return screen; } +void interfaceRefresh() +{ + //SDL_BlitSurface(fake_screen, NULL, screen, NULL); + SDL_UpdateRect(screen, 0, 0, screen->w, screen->h); + //SDL_Flip(screen); +} + int toggleFullscreen() { if(g_win_flags & SDL_FULLSCREEN) @@ -78,7 +92,7 @@ int toggleFullscreen() else g_win_flags |= SDL_FULLSCREEN; - if(SDL_WM_ToggleFullScreen(screen) == 0) + if( SDL_WM_ToggleFullScreen(screen) == 0 ) { fprintf(stderr, "Nemozem prepnut do fullscreenu!\n"); diff --git a/src/item.c b/src/item.c index 188ad5b..970d903 100644 --- a/src/item.c +++ b/src/item.c @@ -346,6 +346,7 @@ void eventGiveTuxItem(tux_t *tux, list_t *listItem) case GUN_SCATTER : case GUN_LASSER : case GUN_MINE : + tux->pickup_time = 0; playSound("item_gun", SOUND_GROUP_BASE); tux->shot[ thisItem->type ] += GUN_MAX_SHOT; tux->gun = thisItem->type; diff --git a/src/myTimer.c b/src/myTimer.c index 1faca9b..1a73384 100644 --- a/src/myTimer.c +++ b/src/myTimer.c @@ -62,6 +62,12 @@ void eventTimer() if( currentTime >= thisTimer->time ) { thisTimer->fce(thisTimer->arg); + + if( isTimerInit == FALSE ) + { + return; + } + delListItem(listTime, i, free); i--; } diff --git a/src/screen.c b/src/screen.c index c0c6885..fe6bbd3 100644 --- a/src/screen.c +++ b/src/screen.c @@ -115,7 +115,7 @@ void drawScreen() assert( currentScreen != NULL ); currentScreen->fce_draw(); - SDL_Flip(p_screen); + interfaceRefresh(); } void eventScreen() diff --git a/src/screen_world.c b/src/screen_world.c index bf091a5..8d0b87d 100644 --- a/src/screen_world.c +++ b/src/screen_world.c @@ -56,9 +56,29 @@ arena_t* getWorldArena() return arena; } +static void timer_endArena() +{ + if( getNetTypeGame() != NET_GAME_TYPE_CLIENT ) + { + setScreen("analyze"); + return; + } +} + void countRoundInc() { + if( count >= max_count ) + { + return; + } + count++; + + if( count >= max_count ) + { + playSound("end", SOUND_GROUP_BASE); + addTimer(timer_endArena, NULL, TIMER_END_ARENA); + } } static tux_t* getControlTux(int control_type) @@ -250,12 +270,13 @@ static void eventEnd() setScreen("analyze"); return; } - +/* if( count >= max_count && getNetTypeGame() != NET_GAME_TYPE_CLIENT ) { setScreen("analyze"); return; - } + } +*/ } void tuxControl(tux_t *p) diff --git a/src/tux.c b/src/tux.c index 1af5f90..31964b6 100644 --- a/src/tux.c +++ b/src/tux.c @@ -352,6 +352,7 @@ void eventTuxIsDead(tux_t *tux) tux->bonus = BONUS_NONE; tux->bonus_time = 0; + tux->pickup_time = 0; tux->isCanShot = TRUE; tux->isCanSwitchGun = TRUE; -- cgit v1.2.3