summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinclude/interface.h2
-rw-r--r--include/item.h2
-rw-r--r--include/screen_world.h2
-rw-r--r--include/tux.h4
-rw-r--r--sound/dead.oggbin0 -> 17112 bytes
-rw-r--r--sound/end.oggbin0 -> 153633 bytes
-rw-r--r--sound/explozion.oggbin0 -> 15987 bytes
-rw-r--r--sound/gun2.oggbin0 -> 4789 bytes
-rw-r--r--sound/gun_lasser.oggbin0 -> 8348 bytes
-rw-r--r--sound/gun_revolver.oggbin0 -> 7441 bytes
-rw-r--r--sound/gun_scatter.oggbin0 -> 10303 bytes
-rw-r--r--sound/gun_tommy.oggbin0 -> 9460 bytes
-rw-r--r--sound/item_bonus.oggbin0 -> 7339 bytes
-rw-r--r--sound/item_gun.oggbin0 -> 4604 bytes
-rw-r--r--sound/odraz-gun.oggbin0 -> 14901 bytes
-rw-r--r--sound/odraz-l.oggbin0 -> 13561 bytes
-rw-r--r--sound/odraz-r.oggbin0 -> 13581 bytes
-rw-r--r--sound/put_mine.oggbin0 -> 5463 bytes
-rw-r--r--sound/switch_gun.oggbin0 -> 6401 bytes
-rw-r--r--sound/teleport.oggbin0 -> 20232 bytes
-rw-r--r--src/gun.c36
-rwxr-xr-xsrc/interface.c18
-rw-r--r--src/item.c1
-rw-r--r--src/myTimer.c6
-rw-r--r--src/screen.c2
-rw-r--r--src/screen_world.c25
-rw-r--r--src/tux.c1
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
new file mode 100644
index 0000000..a78c53a
--- /dev/null
+++ b/sound/dead.ogg
Binary files differ
diff --git a/sound/end.ogg b/sound/end.ogg
new file mode 100644
index 0000000..613265e
--- /dev/null
+++ b/sound/end.ogg
Binary files differ
diff --git a/sound/explozion.ogg b/sound/explozion.ogg
new file mode 100644
index 0000000..6018394
--- /dev/null
+++ b/sound/explozion.ogg
Binary files differ
diff --git a/sound/gun2.ogg b/sound/gun2.ogg
new file mode 100644
index 0000000..2a360fd
--- /dev/null
+++ b/sound/gun2.ogg
Binary files differ
diff --git a/sound/gun_lasser.ogg b/sound/gun_lasser.ogg
new file mode 100644
index 0000000..56a7257
--- /dev/null
+++ b/sound/gun_lasser.ogg
Binary files differ
diff --git a/sound/gun_revolver.ogg b/sound/gun_revolver.ogg
new file mode 100644
index 0000000..79dcefd
--- /dev/null
+++ b/sound/gun_revolver.ogg
Binary files differ
diff --git a/sound/gun_scatter.ogg b/sound/gun_scatter.ogg
new file mode 100644
index 0000000..32c267f
--- /dev/null
+++ b/sound/gun_scatter.ogg
Binary files differ
diff --git a/sound/gun_tommy.ogg b/sound/gun_tommy.ogg
new file mode 100644
index 0000000..3c2ea41
--- /dev/null
+++ b/sound/gun_tommy.ogg
Binary files differ
diff --git a/sound/item_bonus.ogg b/sound/item_bonus.ogg
new file mode 100644
index 0000000..c2b8ba8
--- /dev/null
+++ b/sound/item_bonus.ogg
Binary files differ
diff --git a/sound/item_gun.ogg b/sound/item_gun.ogg
new file mode 100644
index 0000000..1b749da
--- /dev/null
+++ b/sound/item_gun.ogg
Binary files differ
diff --git a/sound/odraz-gun.ogg b/sound/odraz-gun.ogg
new file mode 100644
index 0000000..c007ae7
--- /dev/null
+++ b/sound/odraz-gun.ogg
Binary files differ
diff --git a/sound/odraz-l.ogg b/sound/odraz-l.ogg
new file mode 100644
index 0000000..258dbd5
--- /dev/null
+++ b/sound/odraz-l.ogg
Binary files differ
diff --git a/sound/odraz-r.ogg b/sound/odraz-r.ogg
new file mode 100644
index 0000000..c885172
--- /dev/null
+++ b/sound/odraz-r.ogg
Binary files differ
diff --git a/sound/put_mine.ogg b/sound/put_mine.ogg
new file mode 100644
index 0000000..b5fa822
--- /dev/null
+++ b/sound/put_mine.ogg
Binary files differ
diff --git a/sound/switch_gun.ogg b/sound/switch_gun.ogg
new file mode 100644
index 0000000..e453472
--- /dev/null
+++ b/sound/switch_gun.ogg
Binary files differ
diff --git a/sound/teleport.ogg b/sound/teleport.ogg
new file mode 100644
index 0000000..1d1ead1
--- /dev/null
+++ b/sound/teleport.ogg
Binary files 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;