summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/arena.h2
-rwxr-xr-xinclude/interface.h4
-rw-r--r--include/item.h5
-rw-r--r--include/main.h4
-rw-r--r--include/myTimer.h8
-rw-r--r--include/pipe.h12
-rw-r--r--include/proto.h1
-rw-r--r--include/publicServer.h18
-rw-r--r--include/server.h8
-rw-r--r--include/shot.h4
-rw-r--r--include/teleport.h15
-rw-r--r--include/wall.h12
12 files changed, 81 insertions, 12 deletions
diff --git a/include/arena.h b/include/arena.h
index 38a0a18..8ac353d 100644
--- a/include/arena.h
+++ b/include/arena.h
@@ -9,9 +9,11 @@
typedef struct arena_struct
{
+#ifndef BUBLIC_SERVER
char music[STR_SIZE];
SDL_Surface *background;
+#endif
list_t *listTux;
list_t *listShot;
diff --git a/include/interface.h b/include/interface.h
index 929c8bf..720676e 100755
--- a/include/interface.h
+++ b/include/interface.h
@@ -18,10 +18,6 @@
#define SDL_SUBSYSTEMS SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_DOUBLEBUF
-//rozlisenie obrazovky
-#define WINDOW_SIZE_X 800
-#define WINDOW_SIZE_Y 600
-
//napis na okne
#define WINDOW_TITLE "Tuxanci next generation SVN revision 13"
#define WIN_BPP 0
diff --git a/include/item.h b/include/item.h
index 3f6b6bd..fd66839 100644
--- a/include/item.h
+++ b/include/item.h
@@ -22,8 +22,9 @@ typedef struct item_struct
int count;
tux_t *author;
+#ifndef BUBLIC_SERVER
SDL_Surface *img; //obrazok
-
+#endif
} item_t;
#define ITEM_MAX_COUNT 2
@@ -52,8 +53,10 @@ extern bool_t isItemInicialized();
extern void initItem();
extern item_t* newItem(int x, int y, int type, tux_t *author);
extern void addNewItem(list_t *listItem, tux_t *author);
+#ifndef BUBLIC_SERVER
extern void drawItem(item_t *p);
extern void drawListItem(list_t *listItem);
+#endif
extern void eventListItem(list_t *listItem);
extern void eventConflictShotWithItem(list_t *listItem, list_t *listShot);
extern int isConflictWithListItem(list_t *listItem, int x, int y, int w, int h);
diff --git a/include/main.h b/include/main.h
index 2ffe452..a51fd1e 100644
--- a/include/main.h
+++ b/include/main.h
@@ -7,6 +7,10 @@
#include "string_length.h"
#include "path.h"
+//rozlisenie obrazovky
+#define WINDOW_SIZE_X 800
+#define WINDOW_SIZE_Y 600
+
extern char* getParam(char *s);
extern char* getParamElse(char *s1, char *s2);
extern bool_t isParamFlag(char *s);
diff --git a/include/myTimer.h b/include/myTimer.h
index 785dc77..fbb83a8 100644
--- a/include/myTimer.h
+++ b/include/myTimer.h
@@ -3,20 +3,22 @@
#define MY_TIME_H
-#include "interface.h"
#include "main.h"
+#define my_time_t unsigned int
+
typedef struct my_timer_struct
{
unsigned int id;
void (*fce)(void *p);
void *arg;
- Uint32 time;
+ my_time_t time;
} my_timer_t;
extern bool_t isMyTimerInit();
extern void initTimer();
-extern int addTimer(void (*fce)(void *p), void *arg, int my_time);
+extern my_time_t getMyTime();
+extern int addTimer(void (*fce)(void *p), void *arg, my_time_t my_time);
extern void eventTimer();
extern void delTimer(int id);
extern void quitTimer();
diff --git a/include/pipe.h b/include/pipe.h
index e665e0a..7f38fb8 100644
--- a/include/pipe.h
+++ b/include/pipe.h
@@ -3,6 +3,7 @@
#define PIPE_H
+#include "main.h"
#include "interface.h"
#include "list.h"
@@ -20,14 +21,25 @@ typedef struct pipe_struct
int layer; // vrstva
+#ifndef BUBLIC_SERVER
SDL_Surface *img; //obrazok
+#endif
} pipe_t;
+#ifndef BUBLIC_SERVER
extern pipe_t* newPipe(int x, int y, int w, int h, int layer,
int id, int id_out, int position, SDL_Surface *img);
+#endif
+
+#ifdef BUBLIC_SERVER
+extern pipe_t* newPipe(int x, int y, int w, int h, int layer,
+ int id, int id_out, int position);
+#endif
+#ifndef BUBLIC_SERVER
extern void drawPipe(pipe_t *p);
extern void drawListPipe(list_t *listPipe);
+#endif
extern pipe_t* isConflictWithListPipe(list_t *listPipe, int x, int y, int w, int h);
extern void eventConflictShotWithPipe(list_t *listPipe, list_t *listShot);
extern void destroyPipe(pipe_t *p);
diff --git a/include/proto.h b/include/proto.h
index 7deb346..cc17f79 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -5,6 +5,7 @@
#include "tux.h"
#include "server.h"
+#include "item.h"
extern void proto_send_hello_client();
extern void proto_recv_hello_server(client_t *client, char *msg);
diff --git a/include/publicServer.h b/include/publicServer.h
new file mode 100644
index 0000000..9c3a367
--- /dev/null
+++ b/include/publicServer.h
@@ -0,0 +1,18 @@
+
+#ifndef PUBLIC_SERVER_H
+
+#define PUBLIC_SERVER_H
+
+#include "arena.h"
+
+extern arena_t* getWorldArena();
+extern void countRoundInc();
+extern void initPublicServer();
+extern int getChoiceArenaId();
+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);
+extern void findFreeSpace(int *x, int *y, int w, int h);
+extern void eventPublicServer();
+extern void quitPublicServer();
+
+#endif
diff --git a/include/server.h b/include/server.h
index c44b86b..531afd0 100644
--- a/include/server.h
+++ b/include/server.h
@@ -6,21 +6,25 @@
#include "list.h"
#include "tux.h"
#include "buffer.h"
+#include "myTimer.h"
#include "tcp.h"
#include "udp.h"
+#ifndef BUBLIC_SERVER
+#include "interface.h"
+#endif
+
#define SERVER_TIMEOUT 5000
#define SERVER_TIME_SYNC 5000
#define SERVER_INDEX_ROOT_TUX 0
-
typedef struct client_struct
{
sock_tcp_t *socket_tcp;
sock_udp_t *socket_udp;
int status;
- Uint32 lastPing;
+ my_time_t lastPing;
tux_t *tux;
buffer_t *buffer;
} client_t;
diff --git a/include/shot.h b/include/shot.h
index 749767f..3bd0142 100644
--- a/include/shot.h
+++ b/include/shot.h
@@ -25,14 +25,18 @@ typedef struct shot_struct
tux_t *author;
bool_t isCanKillAuthor;
+#ifndef BUBLIC_SERVER
SDL_Surface *img;
+#endif
} shot_t;
extern bool_t isShotInicialized();
extern void initShot();
extern shot_t* newShot(int x,int y, int px, int py, int gun, tux_t *author);
+#ifndef BUBLIC_SERVER
extern void drawShot(shot_t *p);
extern void drawListShot(list_t *listShot);
+#endif
extern int isConflictWithListShot(list_t *listShot, int x, int y, int w, int h);
extern void eventMoveListShot(list_t *listShot);
diff --git a/include/teleport.h b/include/teleport.h
index 4b9ed66..7eba1ce 100644
--- a/include/teleport.h
+++ b/include/teleport.h
@@ -3,8 +3,10 @@
#define TELEPORT_H
-#include <interface.h>
+#include "interface.h"
+#include "main.h"
#include "list.h"
+#include "interface.h"
typedef struct teleport_struct
{
@@ -16,12 +18,23 @@ typedef struct teleport_struct
int layer; // vrstva
+#ifndef BUBLIC_SERVER
SDL_Surface *img; //obrazok
+#endif
} teleport_t;
+#ifndef BUBLIC_SERVER
extern teleport_t* newTeleport(int x, int y, int w, int h, int layer, SDL_Surface *img);
+#endif
+
+#ifdef BUBLIC_SERVER
+extern teleport_t* newTeleport(int x, int y, int w, int h, int layer);
+#endif
+
+#ifndef BUBLIC_SERVER
extern void drawTeleport(teleport_t *p);
extern void drawListTeleport(list_t *listTeleport);
+#endif
extern teleport_t* isConflictWithListTeleport(list_t *listTeleport, int x, int y, int w, int h);
extern void eventConflictShotWithTeleport(list_t *listTeleport, list_t *listShot);
extern void eventTeleportTux(list_t *listTeleport, teleport_t *teleport, tux_t *tux);
diff --git a/include/wall.h b/include/wall.h
index 5918140..e22bf34 100644
--- a/include/wall.h
+++ b/include/wall.h
@@ -3,7 +3,7 @@
#define WALL_H
-#include <interface.h>
+#include "interface.h"
#include "list.h"
typedef struct wall_struct
@@ -19,11 +19,21 @@ typedef struct wall_struct
int layer; // vrstva
+#ifndef BUBLIC_SERVER
SDL_Surface *img; //obrazok
+#endif
} wall_t;
+#ifndef BUBLIC_SERVER
extern wall_t* newWall(int x, int y, int w, int h,
int img_x, int img_y, int layer, SDL_Surface *img);
+#endif
+
+#ifdef BUBLIC_SERVER
+extern wall_t* newWall(int x, int y, int w, int h,
+ int img_x, int img_y, int layer);
+#endif
+
extern void drawWall(wall_t *p);
extern void drawListWall(list_t *listWall);
extern int isConflictWithListWall(list_t *listWall, int x, int y, int w, int h);