summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-02 19:41:48 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-02 19:41:48 +0000
commit44404eb5063bd5f040c7a4d8605aa3d43e3a968a (patch)
treed9b4fceb80a2abf6103fd6022de80dd3286caaf0
parent8a14d60d2078b4bcdfc789b1b9794e2008979f02 (diff)
- par uprav
- dopisany credits git-svn-id: http://opensvn.csie.org/tuxanci_ng@8 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
-rw-r--r--Makefile2
-rw-r--r--control8
-rw-r--r--data/credits.en31
-rwxr-xr-xinclude/interface.h2
-rw-r--r--include/main.h1
-rw-r--r--include/path.h1
-rw-r--r--include/screen_credits.h20
-rw-r--r--include/screen_world.h1
-rwxr-xr-xsrc/Makefile9
-rw-r--r--src/item.c2
-rw-r--r--src/main.c3
-rw-r--r--src/net_multiplayer.c20
-rw-r--r--src/screen_choiceArena.c13
-rw-r--r--src/screen_credits.c125
-rw-r--r--src/screen_mainMenu.c5
-rw-r--r--src/screen_setting.c8
-rw-r--r--src/screen_world.c40
-rw-r--r--src/widget_label.c2
18 files changed, 254 insertions, 39 deletions
diff --git a/Makefile b/Makefile
index 5fea5cf..6382bdd 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,7 @@ install:
mkdir $(DISTDIR)share/tuxanci-ng/lang
mkdir $(DISTDIR)share/tuxanci-ng/music
mkdir $(DISTDIR)share/tuxanci-ng/sound
+ mkdir $(DISTDIR)share/tuxanci-ng/data
cp -rf ./arena/* $(DISTDIR)share/tuxanci-ng/arena
cp -rf ./font/* $(DISTDIR)share/tuxanci-ng/font
@@ -33,6 +34,7 @@ install:
cp -rf ./lang/* $(DISTDIR)share/tuxanci-ng/lang
cp -rf ./music/* $(DISTDIR)share/tuxanci-ng/music
cp -rf ./sound/* $(DISTDIR)share/tuxanci-ng/sound
+ cp -rf ./data/* $(DISTDIR)share/tuxanci-ng/data
deb:
./deb-build.sh
diff --git a/control b/control
index 4f65e99..27cd999 100644
--- a/control
+++ b/control
@@ -1,12 +1,12 @@
Package: tuxanci-ng
-Version: svn5
+Version: svn8
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-ttf2.0-0 (>= 2.0)
Architecture: i386
-Installed-Size: 1844
+Installed-Size: 4112
Maintainer: Dušan Ďurech <dusan.d@centrum.sk>
-Description: Game tuxanci next generation SVN revision 5
- Game tuxanci next generation SVN revision 5
+Description: Game tuxanci next generation SVN revision 8
+ Game tuxanci next generation SVN revision 8
.
http://www.tuxanci.org
diff --git a/data/credits.en b/data/credits.en
new file mode 100644
index 0000000..965b93e
--- /dev/null
+++ b/data/credits.en
@@ -0,0 +1,31 @@
+Dušan Ďurech <dusan.d@centrum.sk>
+Jabber ID: oroborus@jabbim.sk
+The project founder, main programmer
+
+Jiří Helebrant <helb@helb.cz>
+Jabber ID: helb@helb.cz
+Main graphic designer
+
+Petr Ambrož <paces@paces.cz>
+Jabber ID: paces@jabber.cz
+Additional programmer, graphic designer
+forum and IRC administrator
+
+Ladislav Láska <ladislav.laska@gmail.com>
+Jabber ID: krakonos@jabber.sh.cvut.cz
+Additional programmer
+
+Václav Seidl <vaclav.seidl@gmail.com>
+Jabber ID: vak@jabber.cz
+Additional programmer
+
+Josef Reidinger <queen.killer@seznam.cz>
+Jabber ID: qk@njs.netlab.cz
+Additional programmer
+
+Roman Kabelka (CJ Neti) <neti@cjneti.net>
+sound designer
+
+project homepage:
+http://www.tuxanci.org/
+http://enf.tuxanci.org/
diff --git a/include/interface.h b/include/interface.h
index 858f295..2012632 100755
--- a/include/interface.h
+++ b/include/interface.h
@@ -23,7 +23,7 @@
#define WINDOW_SIZE_Y 600
//napis na okne
-#define WINDOW_TITLE "RPG engine"
+#define WINDOW_TITLE "Tuxanci next generation SVN revision 8"
#define WIN_BPP 0
#define USR_EVT_TIMER 0
diff --git a/include/main.h b/include/main.h
index 7761edd..2ffe452 100644
--- a/include/main.h
+++ b/include/main.h
@@ -5,6 +5,7 @@
#include "bool.h"
#include "string_length.h"
+#include "path.h"
extern char* getParam(char *s);
extern char* getParamElse(char *s1, char *s2);
diff --git a/include/path.h b/include/path.h
index 11eeaee..ab1ae61 100644
--- a/include/path.h
+++ b/include/path.h
@@ -12,5 +12,6 @@
#define PATH_MUSIC DISTDIR PATH_DIR "music/"
#define PATH_CONFIG DISTDIR PATH_DIR "conf/"
#define PATH_LANG DISTDIR PATH_DIR "lang/"
+#define PATH_DATA DISTDIR PATH_DIR "data/"
#endif
diff --git a/include/screen_credits.h b/include/screen_credits.h
new file mode 100644
index 0000000..2bbce80
--- /dev/null
+++ b/include/screen_credits.h
@@ -0,0 +1,20 @@
+
+#ifndef SCREEN_CREDITS_H
+
+#define SCREEN_CREDITS_H
+
+#define SCREEN_CREDITS_FILE "credits.en"
+
+#define SCREEN_CREDITS_OFFSET_MIN 130
+#define SCREEN_CREDITS_OFFSET_MAX WINDOW_SIZE_Y-120
+#define SCREEN_CREDITS_OFFSET_RESTART -1000
+#define SCREEN_CREDITS_OFFSET_SPEED 2
+
+extern void startScreenCredits();
+extern void drawScreenCredits();
+extern void eventScreenCredits();
+extern void stopScreenCredits();
+extern void initScreenCredits();
+extern void quitScreenCredits();
+
+#endif
diff --git a/include/screen_world.h b/include/screen_world.h
index aa43968..d6dfd12 100644
--- a/include/screen_world.h
+++ b/include/screen_world.h
@@ -14,6 +14,7 @@ extern void initWorld();
extern arena_t* getWorldArena();
extern void setWorldArena(int id);
extern void countRoundInc();
+extern void setWorldEnd();
extern void setMaxCountRound(int n);
extern int conflictSpace(int x1,int y1,int w1,int h1,int x2,int y2,int w2,int h2);
extern int isFreeSpace(int x, int y, int w, int h);
diff --git a/src/Makefile b/src/Makefile
index 31f3393..2d5921b 100755
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,7 +1,9 @@
CC = gcc
-CFLAGS = -g -O0 -DDISTDIR=\"$(DISTDIR)\" `sdl-config --cflags` -I../include -Wall
+#CFLAGS = -g -O0 -DDISTDIR=\"$(DISTDIR)\" `sdl-config --cflags` -I../include -Wall
+CFLAGS = -O2 -DDISTDIR=\"$(DISTDIR)\" `sdl-config --cflags` -I../include -Wall
+
LIBS = `sdl-config --libs` -lSDL_image -lSDL_ttf -lSDL_mixer
FILES = interface.o font.o list.o image.o layer.o director.o configFile.o tux.o main.o \
@@ -9,7 +11,7 @@ FILES = interface.o font.o list.o image.o layer.o director.o configFile.o tux.o
buffer.o dynamicInt.o arena.o arenaFile.o textFile.o sound.o audio.o music.o gun.o \
item.o widget_label.o screen_mainMenu.o widget_button.o screen_analyze.o widget_textfield.o \
widget_check.o widget_image.o screen_setting.o screen_gameType.o screen_choiceArena.o \
- widget_buttonimage.o
+ widget_buttonimage.o screen_credits.o
tuxanci-ng: $(FILES)
@@ -111,6 +113,9 @@ screen_gameType.o: screen_gameType.c ../include/screen_gameType.h
screen_choiceArena.o: screen_choiceArena.c ../include/screen_choiceArena.h
$(CC) $(CFLAGS) -o screen_choiceArena.o -c screen_choiceArena.c
+screen_credits.o: screen_credits.c ../include/screen_credits.h
+ $(CC) $(CFLAGS) -o screen_credits.o -c screen_credits.c
+
widget_label.o: widget_label.c ../include/widget_label.h
$(CC) $(CFLAGS) -o widget_label.o -c widget_label.c
diff --git a/src/item.c b/src/item.c
index 970d903..23c3f52 100644
--- a/src/item.c
+++ b/src/item.c
@@ -117,6 +117,8 @@ void addNewItem(list_t *listItem)
arena = getWorldArena();
findFreeSpace(&new_x, &new_y, ITEM_GUN_WIDTH, ITEM_GUN_HEIGHT);
+ type = GUN_DUAL_SIMPLE;
+
do{
switch( random() % 11 )
{
diff --git a/src/main.c b/src/main.c
index dad0ea4..22c691c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,6 +14,7 @@
#include "screen_setting.h"
#include "screen_gameType.h"
#include "screen_choiceArena.h"
+#include "screen_credits.h"
#include "wall.h"
#include "shot.h"
#include "panel.h"
@@ -48,6 +49,7 @@ static void init()
initScreenSetting();
initScreenGameType();
initScreenChoiceArena();
+ initScreenCredits();
}
void quit()
@@ -71,6 +73,7 @@ void quit()
quitScreenSetting();
quitScreenGameType();
quitScreenChoiceArena();
+ quitScreenCredits();
printf("quit..\n");
diff --git a/src/net_multiplayer.c b/src/net_multiplayer.c
index 786e1b9..536474a 100644
--- a/src/net_multiplayer.c
+++ b/src/net_multiplayer.c
@@ -78,13 +78,13 @@ static void sendServer(char *msg)
if ( ret == 0 )
{
fprintf(stderr, "server uzatvoril sietovy socket\n");
- setScreen("analyze");
+ setWorldEnd();
}
if ( ret < 0 )
{
fprintf(stderr, "nastala chyba pri poslani spravy serveru\n");
- setScreen("analyze");
+ setWorldEnd();
}
}
@@ -179,16 +179,18 @@ void proto_recv_init_client(char *msg)
char arena_name[STR_SIZE];
tux_t *tux;
int id;
- int n;
+ int x, y, n;
sscanf(msg, "%s %d %d %d %d %s\n",
- cmd, &id, &tux->x, &tux->y, &n, arena_name);
+ cmd, &id, &x, &y, &n, arena_name);
setWorldArena( getArenaIdFormNetName(arena_name) );
setMaxCountRound(n);
tux = newTux();
tux->id = id;
+ tux->x = x;
+ tux->y = y;
tux->control = TUX_CONTROL_KEYBOARD_RIGHT;
getSettingNameRight(tux->name);
@@ -457,7 +459,7 @@ static void eventClientBuffer(client_t *client)
while( getBufferLine(client->buffer, line, STR_SIZE) >= 0 )
{
- printf("dostal som %s", line);
+ //printf("dostal som %s", line);
if( strncmp(line, "event", 5) == 0 )proto_recv_event_server(client, line);
if( strncmp(line, "context", 7) == 0 )proto_recv_context_server(client, line);
@@ -538,21 +540,21 @@ static void eventServerSelect(int sock)
if( ret == 0 )
{
fprintf(stderr, "server uzatovril sietovy socket\n");
- setScreen("analyze");
+ setWorldEnd();
return;
}
if( ret < 0 )
{
fprintf(stderr, "chyba, spojenie prerusene \n");
- setScreen("analyze");
+ setWorldEnd();
return;
}
if( addBuffer(clientBuffer, buffer, ret) != 0 )
{
fprintf(stderr, "chyba, nemozem zapisovat do mojho buffera !\n");
- setScreen("analyze");
+ setWorldEnd();
return;
}
}
@@ -570,7 +572,7 @@ static void eventServerBuffer()
while ( getBufferLine(clientBuffer, line, STR_SIZE) >= 0 )
{
- printf("dostal som %s", line);
+ //printf("dostal som %s", line);
if( strncmp(line, "init", 4) == 0 )proto_recv_init_client(line);
if( strncmp(line, "event", 5) == 0 )proto_recv_event_client(line);
diff --git a/src/screen_choiceArena.c b/src/screen_choiceArena.c
index c3637f1..0b36ca5 100644
--- a/src/screen_choiceArena.c
+++ b/src/screen_choiceArena.c
@@ -118,17 +118,12 @@ void initScreenChoiceArena()
SDL_Surface *image;
int i;
- image = addImageData("screen_main.png", IMAGE_NO_ALPHA, "screen_main", IMAGE_GROUP_BASE);
+ image = getImage(IMAGE_GROUP_BASE, "screen_main");
image_backgorund = newWidgetImage(0, 0, image);
button_back = newWidgetButton("Back", 100, WINDOW_SIZE_Y-100, eventWidget);
button_play = newWidgetButton("Play", WINDOW_SIZE_X-200, WINDOW_SIZE_Y-100, eventWidget);
- addMusic("menu.ogg", "menu", MUSIC_GROUP_BASE);
-
- registerScreen( newScreen("chiceArena", startScreenChoiceArena, eventScreenChoiceArena,
- drawScreenChoiceArena, stopScreenChoiceArena) );
-
listWidgetButtonimage = newList();
choiceArenaId = 0;
@@ -153,6 +148,9 @@ void initScreenChoiceArena()
addList( listWidgetButtonimage, widget_buttonimage);
}
+
+ registerScreen( newScreen("chiceArena", startScreenChoiceArena, eventScreenChoiceArena,
+ drawScreenChoiceArena, stopScreenChoiceArena) );
}
void quitScreenChoiceArena()
@@ -161,5 +159,6 @@ void quitScreenChoiceArena()
destroyWidgetButton(button_play);
destroyWidgetButton(button_back);
-}
+ destroyListItem(listWidgetButtonimage, destroyWidgetButtonimage);
+}
diff --git a/src/screen_credits.c b/src/screen_credits.c
new file mode 100644
index 0000000..17c1bfe
--- /dev/null
+++ b/src/screen_credits.c
@@ -0,0 +1,125 @@
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "main.h"
+#include "interface.h"
+#include "list.h"
+#include "textFile.h"
+#include "screen.h"
+#include "image.h"
+#include "music.h"
+#include "screen_credits.h"
+
+#include "widget_image.h"
+#include "widget_label.h"
+#include "widget_button.h"
+
+static widget_image_t *image_backgorund;
+static widget_button_t *button_back;
+static list_t *listWidgetLabel;
+static textFile_t *textFile;
+static int offset;
+
+void startScreenCredits()
+{
+ playMusic("menu", MUSIC_GROUP_BASE);
+ offset = 0;
+}
+
+void drawScreenCredits()
+{
+ int i;
+
+ drawWidgetImage(image_backgorund);
+
+ drawWidgetButton(button_back);
+
+ for( i = 0 ; i < listWidgetLabel->count ; i++ )
+ {
+ int z;
+
+ widget_label_t *this;
+ this = (widget_label_t *)listWidgetLabel->list[i];
+
+ z = this->y;
+ this->y += offset;
+
+ if( this->y > SCREEN_CREDITS_OFFSET_MIN && this->y < SCREEN_CREDITS_OFFSET_MAX )
+ {
+ drawWidgetLabel(this);
+ }
+
+ this->y = z;
+ }
+
+}
+
+void eventScreenCredits()
+{
+ eventWidgetButton(button_back);
+
+ offset -= SCREEN_CREDITS_OFFSET_SPEED;
+
+ if( offset < SCREEN_CREDITS_OFFSET_RESTART )
+ {
+ offset = 0;
+ }
+
+ //printf("offset = %d\n", offset);
+}
+
+void stopScreenCredits()
+{
+}
+
+static void eventWidget(void *p)
+{
+ widget_button_t *button;
+
+ button = (widget_button_t *)(p);
+
+ if( button == button_back )
+ {
+ setScreen("mainMenu");
+ }
+}
+
+void initScreenCredits()
+{
+ SDL_Surface *image;
+ int i;
+
+ image = getImage(IMAGE_GROUP_BASE, "screen_main");
+ image_backgorund = newWidgetImage(0, 0, image);
+
+ button_back = newWidgetButton("Back", WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, WINDOW_SIZE_Y-100, eventWidget);
+
+ listWidgetLabel = newList();
+ textFile = loadTextFile(PATH_DATA SCREEN_CREDITS_FILE);
+
+ for( i = 0 ; i < textFile->text->count ; i++ )
+ {
+ widget_label_t *label;
+ char *line;
+
+ line = (char *)textFile->text->list[i];
+ label = newWidgetLabel(line, WINDOW_SIZE_X/2, (WINDOW_SIZE_Y-100)+i*20,
+ WIDGET_LABEL_CENTER);
+
+ addList(listWidgetLabel, label);
+ }
+
+ registerScreen( newScreen("credits", startScreenCredits, eventScreenCredits,
+ drawScreenCredits, stopScreenCredits) );
+}
+
+void quitScreenCredits()
+{
+ destroyWidgetImage(image_backgorund);
+
+ destroyWidgetButton(button_back);
+ destroyListItem(listWidgetLabel, destroyWidgetLabel);
+ destroyTextFile(textFile);
+}
+
diff --git a/src/screen_mainMenu.c b/src/screen_mainMenu.c
index db503b6..3e54323 100644
--- a/src/screen_mainMenu.c
+++ b/src/screen_mainMenu.c
@@ -69,6 +69,11 @@ static void eventWidget(void *p)
setScreen("setting");
}
+ if( button == button_credits )
+ {
+ setScreen("credits");
+ }
+
if( button == button_end )
{
quit();
diff --git a/src/screen_setting.c b/src/screen_setting.c
index f54625b..6d8248d 100644
--- a/src/screen_setting.c
+++ b/src/screen_setting.c
@@ -183,8 +183,8 @@ void initScreenSetting()
for( i = GUN_DUAL_SIMPLE ; i <= GUN_BOMBBALL ; i++ )
{
- int x;
- int y;
+ int x = 0;
+ int y = 0;
if( i >= GUN_DUAL_SIMPLE && i <= GUN_TOMMY )
{
@@ -203,8 +203,8 @@ void initScreenSetting()
for( i = BONUS_SPEED ; i <= BONUS_HIDDEN ; i++ )
{
- int x;
- int y;
+ int x = 0;
+ int y = 0;
if( i >= BONUS_SPEED && i <= BONUS_TELEPORT )
{
diff --git a/src/screen_world.c b/src/screen_world.c
index 1f91cc6..b7895e6 100644
--- a/src/screen_world.c
+++ b/src/screen_world.c
@@ -33,6 +33,7 @@ static int count;
static int max_count;
static bool_t isScreenWorldInit = FALSE;
+static bool_t isEndWorld;
bool_t isScreenWorldInicialized()
{
@@ -41,14 +42,22 @@ bool_t isScreenWorldInicialized()
void setGameType()
{
+ int ret = 0;
+
if( getSettingGameType() == NET_GAME_TYPE_SERVER )
{
- initServer( getSettingPort() );
+ ret = initServer( getSettingPort() );
}
if( getSettingGameType() == NET_GAME_TYPE_CLIENT )
{
- initClient( getSettingPort() , getSettingIP() );
+ ret = initClient( getSettingPort() , getSettingIP() );
+ }
+
+ if( ret != 0 )
+ {
+ fprintf(stderr, "Chyba inicalizacie sieti !\n");
+ setWorldEnd();
}
}
@@ -68,11 +77,16 @@ void setMaxCountRound(int n)
max_count = n;
}
+void setWorldEnd()
+{
+ isEndWorld = TRUE;
+}
+
static void timer_endArena()
{
if( getNetTypeGame() != NET_GAME_TYPE_CLIENT )
{
- setScreen("analyze");
+ setWorldEnd();
return;
}
}
@@ -287,23 +301,26 @@ static void control_keyboard_left(tux_t *tux)
if( mapa[(SDLKey)SDLK_TAB] == SDL_PRESSED )actionTux(tux, TUX_SWITCH_GUN);
}
-static void eventEnd()
+static void eventEsc()
{
Uint8 *mapa;
mapa = SDL_GetKeyState(NULL);
if( mapa[(SDLKey)SDLK_ESCAPE] == SDL_PRESSED )
{
- setScreen("analyze");
+ isEndWorld = TRUE;
+ setWorldEnd();
return;
}
-/*
- if( count >= max_count && getNetTypeGame() != NET_GAME_TYPE_CLIENT )
+}
+
+static void eventEnd()
+{
+ if( isEndWorld == TRUE )
{
setScreen("analyze");
return;
}
-*/
}
void tuxControl(tux_t *p)
@@ -339,23 +356,24 @@ void eventWorld()
return;
}
- eventListTux(arena->listTux);
-
eventConflictShotWithTux(arena->listTux, arena->listShot);
eventConflictShotWithWall(arena->listWall, arena->listShot);
eventMoveListShot(arena->listShot);
eventListItem(arena->listItem);
eventConflictShotWithItem(arena->listItem, arena->listShot);
- eventTimer();
+ eventListTux(arena->listTux);
+ eventTimer();
eventNetMultiplayer();
+ eventEsc();
eventEnd();
}
void startWorld()
{
arena = NULL;
+ isEndWorld = FALSE;
count = 0;
diff --git a/src/widget_label.c b/src/widget_label.c
index c01fa6b..0cb0929 100644
--- a/src/widget_label.c
+++ b/src/widget_label.c
@@ -29,7 +29,7 @@ void drawWidgetLabel(widget_label_t *p)
drawFont(p->text, p->x, p->y+p->h/2, COLOR_WHITE);
break;
case WIDGET_LABEL_CENTER :
- drawFont(p->text, p->x+p->w/2, p->y, COLOR_WHITE);
+ drawFont(p->text, p->x-p->w/2, p->y, COLOR_WHITE);
break;
}
}