diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-02-26 20:42:25 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-02-26 20:42:25 +0000 |
| commit | d9e265975297fb712213fbbf12c43b6ca68fc846 (patch) | |
| tree | db35124a91b29b4489820cecc5aaf1ae0020929a | |
| parent | d783595135ca768ae14f08aa4033dea35ed0458b (diff) | |
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
| -rwxr-xr-x | include/interface.h | 2 | ||||
| -rw-r--r-- | include/item.h | 2 | ||||
| -rw-r--r-- | include/screen_world.h | 2 | ||||
| -rw-r--r-- | include/tux.h | 4 | ||||
| -rw-r--r-- | sound/dead.ogg | bin | 0 -> 17112 bytes | |||
| -rw-r--r-- | sound/end.ogg | bin | 0 -> 153633 bytes | |||
| -rw-r--r-- | sound/explozion.ogg | bin | 0 -> 15987 bytes | |||
| -rw-r--r-- | sound/gun2.ogg | bin | 0 -> 4789 bytes | |||
| -rw-r--r-- | sound/gun_lasser.ogg | bin | 0 -> 8348 bytes | |||
| -rw-r--r-- | sound/gun_revolver.ogg | bin | 0 -> 7441 bytes | |||
| -rw-r--r-- | sound/gun_scatter.ogg | bin | 0 -> 10303 bytes | |||
| -rw-r--r-- | sound/gun_tommy.ogg | bin | 0 -> 9460 bytes | |||
| -rw-r--r-- | sound/item_bonus.ogg | bin | 0 -> 7339 bytes | |||
| -rw-r--r-- | sound/item_gun.ogg | bin | 0 -> 4604 bytes | |||
| -rw-r--r-- | sound/odraz-gun.ogg | bin | 0 -> 14901 bytes | |||
| -rw-r--r-- | sound/odraz-l.ogg | bin | 0 -> 13561 bytes | |||
| -rw-r--r-- | sound/odraz-r.ogg | bin | 0 -> 13581 bytes | |||
| -rw-r--r-- | sound/put_mine.ogg | bin | 0 -> 5463 bytes | |||
| -rw-r--r-- | sound/switch_gun.ogg | bin | 0 -> 6401 bytes | |||
| -rw-r--r-- | sound/teleport.ogg | bin | 0 -> 20232 bytes | |||
| -rw-r--r-- | src/gun.c | 36 | ||||
| -rwxr-xr-x | src/interface.c | 18 | ||||
| -rw-r--r-- | src/item.c | 1 | ||||
| -rw-r--r-- | src/myTimer.c | 6 | ||||
| -rw-r--r-- | src/screen.c | 2 | ||||
| -rw-r--r-- | src/screen_world.c | 25 | ||||
| -rw-r--r-- | src/tux.c | 1 |
27 files changed, 67 insertions, 32 deletions
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 Binary files differnew file mode 100644 index 0000000..a78c53a --- /dev/null +++ b/sound/dead.ogg diff --git a/sound/end.ogg b/sound/end.ogg Binary files differnew file mode 100644 index 0000000..613265e --- /dev/null +++ b/sound/end.ogg diff --git a/sound/explozion.ogg b/sound/explozion.ogg Binary files differnew file mode 100644 index 0000000..6018394 --- /dev/null +++ b/sound/explozion.ogg diff --git a/sound/gun2.ogg b/sound/gun2.ogg Binary files differnew file mode 100644 index 0000000..2a360fd --- /dev/null +++ b/sound/gun2.ogg diff --git a/sound/gun_lasser.ogg b/sound/gun_lasser.ogg Binary files differnew file mode 100644 index 0000000..56a7257 --- /dev/null +++ b/sound/gun_lasser.ogg diff --git a/sound/gun_revolver.ogg b/sound/gun_revolver.ogg Binary files differnew file mode 100644 index 0000000..79dcefd --- /dev/null +++ b/sound/gun_revolver.ogg diff --git a/sound/gun_scatter.ogg b/sound/gun_scatter.ogg Binary files differnew file mode 100644 index 0000000..32c267f --- /dev/null +++ b/sound/gun_scatter.ogg diff --git a/sound/gun_tommy.ogg b/sound/gun_tommy.ogg Binary files differnew file mode 100644 index 0000000..3c2ea41 --- /dev/null +++ b/sound/gun_tommy.ogg diff --git a/sound/item_bonus.ogg b/sound/item_bonus.ogg Binary files differnew file mode 100644 index 0000000..c2b8ba8 --- /dev/null +++ b/sound/item_bonus.ogg diff --git a/sound/item_gun.ogg b/sound/item_gun.ogg Binary files differnew file mode 100644 index 0000000..1b749da --- /dev/null +++ b/sound/item_gun.ogg diff --git a/sound/odraz-gun.ogg b/sound/odraz-gun.ogg Binary files differnew file mode 100644 index 0000000..c007ae7 --- /dev/null +++ b/sound/odraz-gun.ogg diff --git a/sound/odraz-l.ogg b/sound/odraz-l.ogg Binary files differnew file mode 100644 index 0000000..258dbd5 --- /dev/null +++ b/sound/odraz-l.ogg diff --git a/sound/odraz-r.ogg b/sound/odraz-r.ogg Binary files differnew file mode 100644 index 0000000..c885172 --- /dev/null +++ b/sound/odraz-r.ogg diff --git a/sound/put_mine.ogg b/sound/put_mine.ogg Binary files differnew file mode 100644 index 0000000..b5fa822 --- /dev/null +++ b/sound/put_mine.ogg diff --git a/sound/switch_gun.ogg b/sound/switch_gun.ogg Binary files differnew file mode 100644 index 0000000..e453472 --- /dev/null +++ b/sound/switch_gun.ogg diff --git a/sound/teleport.ogg b/sound/teleport.ogg Binary files differnew file mode 100644 index 0000000..1d1ead1 --- /dev/null +++ b/sound/teleport.ogg @@ -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"); @@ -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) @@ -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; |