summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-04-30 19:11:49 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-04-30 19:11:49 +0000
commit29173b3199ea526b6f9de13ee9255db3900f3f42 (patch)
treeafe8819193e22f50ec88100c0c2242105dd98f3a
parent1f7f0b8da7a868b40c23f034c75bce46713c5c32 (diff)
- program si kontroluje ci existuju subory ktore pouziva
git-svn-id: http://opensvn.csie.org/tuxanci_ng@48 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
-rw-r--r--include/main.h1
-rw-r--r--packaging/deb/control12
-rwxr-xr-xpackaging/deb/deb-build.sh41
-rw-r--r--packaging/deb/r1
-rw-r--r--packaging/deb/tuxanci-ng.desktop9
-rw-r--r--src/arenaFile.c2
-rw-r--r--src/client.c2
-rwxr-xr-xsrc/font.c2
-rwxr-xr-xsrc/image.c3
-rwxr-xr-xsrc/interface.c16
-rw-r--r--src/item.c2
-rw-r--r--src/language.c2
-rw-r--r--src/main.c12
-rw-r--r--src/music.c3
-rw-r--r--src/screen_credits.c1
-rw-r--r--src/server.c2
-rw-r--r--src/sound.c4
17 files changed, 112 insertions, 3 deletions
diff --git a/include/main.h b/include/main.h
index 0b96144..7524cc6 100644
--- a/include/main.h
+++ b/include/main.h
@@ -25,6 +25,7 @@ extern char* getParam(char *s);
extern char* getParamElse(char *s1, char *s2);
extern bool_t isParamFlag(char *s);
extern char *getString(int n);
+extern void accessExistFile(const char *s);
extern void quit();
#endif
diff --git a/packaging/deb/control b/packaging/deb/control
new file mode 100644
index 0000000..9779ea8
--- /dev/null
+++ b/packaging/deb/control
@@ -0,0 +1,12 @@
+Package: tuxanci-ng
+Version: svn48
+Section: Game
+Priority: optional
+Depends: libc6 (>= 2.2.4-4), libsdl1.2debian (>= 1.2), libsdl-image1.2 (>= 1.2), libsdl-mixer1.2 (>= 1.2), libsdl-net1.2 (>= 1.2), libsdl-ttf2.0-0 (>= 2.0)
+Architecture: i386
+Installed-Size: 4510
+Maintainer: Dušan Ďurech <dusan.d@centrum.sk>
+Description: Game tuxanci next generation SVN revision 27
+ Game tuxanci next generation SVN revision 27
+ .
+ http://www.tuxanci.org
diff --git a/packaging/deb/deb-build.sh b/packaging/deb/deb-build.sh
new file mode 100755
index 0000000..d471748
--- /dev/null
+++ b/packaging/deb/deb-build.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+PROJECT="tuxanci-ng"
+TMP_DIR="tmp"
+DEB_ARCH="i386"
+DEB_NAME="tuxanci-ng_svn"
+
+SRC_DIR="../../.."
+
+rm -rf $TMP_DIR
+
+
+mkdir $TMP_DIR
+mkdir $TMP_DIR/DEBIAN
+mkdir $TMP_DIR/usr
+mkdir $TMP_DIR/usr/bin
+mkdir $TMP_DIR/usr/share
+mkdir $TMP_DIR/usr/share/applications
+
+cp control $TMP_DIR/DEBIAN/
+cp $PROJECT.desktop $TMP_DIR/usr/share/applications
+
+cd $TMP_DIR
+
+echo -e "2.0\n" > DEBIAN/debian-binary
+
+mv $SRC_DIR/config.h $SRC_DIR/zal_config.h
+mv $SRC_DIR/deb_config.h $SRC_DIR/config.h
+
+make -C $SRC_DIR clean
+make -C $SRC_DIR
+make -C $SRC_DIR DESTDIR="./packaging/deb/$TMP_DIR/usr" install;
+
+mv $SRC_DIR/config.h $SRC_DIR/deb_config.h
+mv $SRC_DIR/zal_config.h $SRC_DIR/config.h
+
+md5sum `find ./ -type f | awk '/.\// { print substr($0, 3) }'` > DEBIAN/md5sums
+
+cd ..
+rm -rf *.deb
+dpkg -b ./$TMP_DIR $DEB_NAME`cat r`_$DEB_ARCH.deb
diff --git a/packaging/deb/r b/packaging/deb/r
new file mode 100644
index 0000000..21e72e8
--- /dev/null
+++ b/packaging/deb/r
@@ -0,0 +1 @@
+48
diff --git a/packaging/deb/tuxanci-ng.desktop b/packaging/deb/tuxanci-ng.desktop
new file mode 100644
index 0000000..45ed4b0
--- /dev/null
+++ b/packaging/deb/tuxanci-ng.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=tuxanci-ng
+Comment=game tuxanci next generation
+Exec=/usr/bin/tuxanci-ng
+Terminal=false
+Type=Application
+Icon=/usr/share/tuxanci-ng/image/tuxanci.png
+Encoding=UTF-8
+Categories=Game
diff --git a/src/arenaFile.c b/src/arenaFile.c
index fdf80fb..b829e9e 100644
--- a/src/arenaFile.c
+++ b/src/arenaFile.c
@@ -311,6 +311,8 @@ void initArenaFile()
sprintf(path, PATH_ARENA "%s", line);
printf("load map %s\n", line);
+
+ accessExistFile(path);
addList(listArenaFile, loadTextFile(path));
}
}
diff --git a/src/client.c b/src/client.c
index a047a2a..9fc5e07 100644
--- a/src/client.c
+++ b/src/client.c
@@ -143,8 +143,8 @@ void eventServerBuffer()
while ( getBufferLine(clientBuffer, line, STR_PROTO_SIZE) >= 0 )
{
#ifdef DEBUG_CLIENT_RECV
- printf("recv server msg->%s", line);
#endif
+ printf("recv server msg->%s", line);
if( strncmp(line, "error", 5) == 0 )proto_recv_error_client(line);
if( strncmp(line, "init", 4) == 0 )proto_recv_init_client(line);
diff --git a/src/font.c b/src/font.c
index a9fb817..0f1c200 100755
--- a/src/font.c
+++ b/src/font.c
@@ -37,6 +37,8 @@ void initFont(char *file,int size)
return;
}
+ accessExistFile(str);
+
g_font = TTF_OpenFont(str, size);
TTF_SetFontStyle(g_font, TTF_STYLE_NORMAL);
diff --git a/src/image.c b/src/image.c
index 3726167..a7c2261 100755
--- a/src/image.c
+++ b/src/image.c
@@ -38,8 +38,11 @@ static SDL_Surface *loadImage(const char *filename, int alpha)
char str[STR_PATH_SIZE];
+
sprintf(str, PATH_IMAGE "%s", filename);
+ accessExistFile(str);
+
if( ( tmp = IMG_Load(str) ) == NULL )
{
fprintf(stderr, "%s\n", SDL_GetError());
diff --git a/src/interface.c b/src/interface.c
index 9e0d6bf..1da3989 100755
--- a/src/interface.c
+++ b/src/interface.c
@@ -138,6 +138,22 @@ int isPessAnyKey()
return 0;
}
+void printPessAnyKey()
+{
+ Uint8 *mapa;
+ int i;
+
+ mapa = SDL_GetKeyState(NULL);
+
+ for( i = SDLK_BACKSPACE ; i < SDLK_KP9 ; i++ )
+ if( mapa[i] == SDL_PRESSED )
+ {
+ printf("press key with code : %d\n", i);
+ }
+
+}
+
+
/*
static void action_esc()
{
diff --git a/src/item.c b/src/item.c
index c336cd4..70b43fb 100644
--- a/src/item.c
+++ b/src/item.c
@@ -416,7 +416,7 @@ void eventConflictShotWithItem(list_t *listItem, list_t *listShot)
if( isDelShot )
{
- printf("del shot\n");
+ //printf("del shot\n");
delListItem(listShot, i, destroyShot);
i--;
}
diff --git a/src/language.c b/src/language.c
index 5291f44..ee9b18c 100644
--- a/src/language.c
+++ b/src/language.c
@@ -70,6 +70,8 @@ int initLanguage()
printf("select lang %s\n", lang);
sprintf(path, PATH_LANG "%s.lang", lang);
+
+ accessExistFile(path);
languageFile = loadTextFile(path);
if( languageFile == NULL )
diff --git a/src/main.c b/src/main.c
index 0978f89..c1c3371 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4,6 +4,9 @@
#include <stdlib.h>
#include <string.h>
#include <signal.h>
+#include <unistd.h>
+#include <assert.h>
+#include <sys/stat.h>
#include "main.h"
#include "tux.h"
@@ -170,6 +173,15 @@ char *getString(int n)
return strdup(str);
}
+void accessExistFile(const char *s)
+{
+ if( access(s, F_OK) != 0 )
+ {
+ fprintf(stderr, "File %s not fount !\nProgram shutdown !\n", s);
+ exit(-1);
+ }
+}
+
int main(int argc, char *argv[])
{
srand( (unsigned) time(NULL) );
diff --git a/src/music.c b/src/music.c
index c2f3f16..5ef4ae6 100644
--- a/src/music.c
+++ b/src/music.c
@@ -54,9 +54,12 @@ static Mix_Music* loadMixMusic(char *file)
Mix_Music *new;
char str[STR_PATH_SIZE];
+
printf("load music %s..\n", file);
sprintf(str, PATH_MUSIC "%s", file);
+ accessExistFile(str);
+
new = Mix_LoadMUS(str);
if( new == NULL )
diff --git a/src/screen_credits.c b/src/screen_credits.c
index b42cfe1..ce352f9 100644
--- a/src/screen_credits.c
+++ b/src/screen_credits.c
@@ -97,6 +97,7 @@ void initScreenCredits()
button_back = newWidgetButton(getMyText("BACK"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, WINDOW_SIZE_Y-80, eventWidget);
listWidgetLabel = newList();
+ accessExistFile(PATH_DATA SCREEN_CREDITS_FILE);
textFile = loadTextFile(PATH_DATA SCREEN_CREDITS_FILE);
for( i = 0 ; i < textFile->text->count ; i++ )
diff --git a/src/server.c b/src/server.c
index afebb10..37f38eb 100644
--- a/src/server.c
+++ b/src/server.c
@@ -152,7 +152,7 @@ void static initServer()
addTaskToTimer(listServerTimer, TIMER_PERIODIC, delZombieCLient, NULL, SERVER_TIMEOUT);
addTaskToTimer(listServerTimer, TIMER_PERIODIC, eventPeriodicSyncClient, NULL, SERVER_TIME_SYNC);
- addTaskToTimer(listServerTimer, TIMER_PERIODIC, eventPeriodicSyncSelfClient, NULL, 5000);
+ //addTaskToTimer(listServerTimer, TIMER_PERIODIC, eventPeriodicSyncSelfClient, NULL, 5000);
addTaskToTimer(listServerTimer, TIMER_PERIODIC, eventSendPingClients, NULL, SERVER_TIME_PING);
}
diff --git a/src/sound.c b/src/sound.c
index 4d574b8..3dc5552 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -51,8 +51,12 @@ static Mix_Chunk* loadMixSound(char *file)
Mix_Chunk *new;
char str[STR_PATH_SIZE];
+
printf("load sound %s..\n", file);
sprintf(str, PATH_SOUND "%s", file);
+
+ accessExistFile(str);
+
new = Mix_LoadWAV(str);
if( new == NULL )