summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-02-26 20:42:25 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-02-26 20:42:25 +0000
commitd9e265975297fb712213fbbf12c43b6ca68fc846 (patch)
treedb35124a91b29b4489820cecc5aaf1ae0020929a /src
parentd783595135ca768ae14f08aa4033dea35ed0458b (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
Diffstat (limited to 'src')
-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
7 files changed, 61 insertions, 28 deletions
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;