summary refs log tree commit diff
path: root/pkgs/games/tennix/fix_FTBFS.patch
blob: d58aa3a8129f32bbeeacb86ba2442d6c367a56b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
From: Thomas Perl <m@thp.io>
Description: Fix FTBFS 
Origin: upstream, https://repo.or.cz/w/tennix.git/commitdiff/6144cb7626dfdc0820a0036af83a531e8e68bae6
Bug-Debian:  https://bugs.debian.org/664907

--- tennix-1.1.orig/archivetool.cc
+++ tennix-1.1/archivetool.cc
@@ -24,6 +24,7 @@
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <libgen.h>
 #include <sys/stat.h>
 
 #include "archive.hh"
--- tennix-1.1.orig/game.c
+++ tennix-1.1/game.c
@@ -388,6 +388,9 @@ void step(GameState* s) {
                         s->ball.move_x = 4.0 + 3.0*PLAYER(s, p).power/PLAYER_POWER_MAX;
                         s->ball.move_z = 1.1*PLAYER(s, p).power/PLAYER_POWER_MAX;
                         break;
+                    default:
+                        assert(false);
+                        break;
                 }
                 s->ball.move_y = get_move_y( s, p);
                 s->sound_events ^= SOUND_EVENT_RACKET;
--- tennix-1.1.orig/network.h
+++ tennix-1.1/network.h
@@ -103,19 +103,19 @@ void
 net_serialize_ball(const Ball* src, NetworkBall* dest);
 
 void
-net_unserialize_ball(const NetworkBall* src, Ball* dest);
+net_unserialize_ball(NetworkBall* src, Ball* dest);
 
 void
 net_serialize_player(const Player* src, NetworkPlayer* dest);
 
 void
-net_unserialize_player(const NetworkPlayer* src, Player* dest);
+net_unserialize_player(NetworkPlayer* src, Player* dest);
 
 void
 net_serialize_gamestate(const GameState* src, NetworkGameState* dest);
 
 void
-net_unserialize_gamestate(const NetworkGameState* src, GameState* dest);
+net_unserialize_gamestate(NetworkGameState* src, GameState* dest);
 
 #endif
 
--- tennix-1.1.orig/locations.h
+++ tennix-1.1/locations.h
@@ -155,7 +155,7 @@ static Location locations[] = {
 #endif
 
     /* End marker */
-    { NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, false }
+    { NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, false, false, 0, 0 }
 };
 
 unsigned int location_count()
--- tennix-1.1.orig/tennix.cc
+++ tennix-1.1/tennix.cc
@@ -461,7 +461,7 @@ int main( int argc, char** argv) {
                 start_fade();
                 gameloop(current_game, connection);
                 SDL_Delay(150);
-                while(SDL_PollEvent(&e));
+                while (SDL_PollEvent(&e)) {};
 #ifdef ENABLE_FPS_LIMIT
                 frames = 0;
                 ft = SDL_GetTicks();
--- tennix-1.1.orig/SDL_rotozoom.c
+++ tennix-1.1/SDL_rotozoom.c
@@ -365,6 +365,9 @@ int zoomSurfaceRGBA(SDL_Surface * src, S
 
 int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy)
 {
+    (void)flipx;
+    (void)flipy;
+
     Uint32 x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy;
     Uint8 *sp, *dp, *csp;
     int dgap;
@@ -393,7 +396,7 @@ int zoomSurfaceY(SDL_Surface * src, SDL_
      */
     csx = 0;
     csax = sax;
-    for (x = 0; x < dst->w; x++) {
+    for (x = 0; x < (Uint32)dst->w; x++) {
 	csx += sx;
 	*csax = (csx >> 16);
 	csx &= 0xffff;
@@ -401,7 +404,7 @@ int zoomSurfaceY(SDL_Surface * src, SDL_
     }
     csy = 0;
     csay = say;
-    for (y = 0; y < dst->h; y++) {
+    for (y = 0; y < (Uint32)dst->h; y++) {
 	csy += sy;
 	*csay = (csy >> 16);
 	csy &= 0xffff;
@@ -410,13 +413,13 @@ int zoomSurfaceY(SDL_Surface * src, SDL_
 
     csx = 0;
     csax = sax;
-    for (x = 0; x < dst->w; x++) {
+    for (x = 0; x < (Uint32)dst->w; x++) {
 	csx += (*csax);
 	csax++;
     }
     csy = 0;
     csay = say;
-    for (y = 0; y < dst->h; y++) {
+    for (y = 0; y < (Uint32)dst->h; y++) {
 	csy += (*csay);
 	csay++;
     }
@@ -432,10 +435,10 @@ int zoomSurfaceY(SDL_Surface * src, SDL_
      * Draw 
      */
     csay = say;
-    for (y = 0; y < dst->h; y++) {
+    for (y = 0; y < (Uint32)dst->h; y++) {
 	csax = sax;
 	sp = csp;
-	for (x = 0; x < dst->w; x++) {
+	for (x = 0; x < (Uint32)dst->w; x++) {
 	    /*
 	     * Draw 
 	     */
@@ -801,6 +804,8 @@ SDL_Surface* rotateSurface90Degrees(SDL_
 void rotozoomSurfaceSizeTrig(int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight, 
 			     double *canglezoom, double *sanglezoom)
 {
+    (void)zoomy;
+
     double x, y, cx, cy, sx, sy;
     double radangle;
     int dstwidthhalf, dstheighthalf;
--- tennix-1.1.orig/network.c
+++ tennix-1.1/network.c
@@ -183,7 +183,7 @@ net_serialize_ball(const Ball* src, Netw
 }
 
 void
-net_unserialize_ball(const NetworkBall* src, Ball* dest)
+net_unserialize_ball(NetworkBall* src, Ball* dest)
 {
     assert(src != NULL && dest != NULL);
     dest->x = unpack_float(SDLNet_Read32(&(src->x)), -WIDTH, WIDTH*2);
@@ -213,7 +213,7 @@ net_serialize_player(const Player* src,
 }
 
 void
-net_unserialize_player(const NetworkPlayer* src, Player* dest)
+net_unserialize_player(NetworkPlayer* src, Player* dest)
 {
     assert(src != NULL && dest != NULL);
     dest->x = unpack_float(SDLNet_Read32(&(src->x)), 0, WIDTH*1.2);
@@ -221,7 +221,7 @@ net_unserialize_player(const NetworkPlay
     dest->power = unpack_float(SDLNet_Read32(&(src->power)), 0, 110);
     dest->use_power = src->use_power;
     dest->score = src->score;
-    dest->desire = src->desire;
+    dest->desire = (PlayerDesire)src->desire;
     dest->game = src->game;
     memcpy(dest->sets, src->sets, sizeof(unsigned char)*(SETS_TO_WIN*2));
     dest->accelerate = unpack_float(SDLNet_Read32(&(src->accelerate)), 0, 200);
@@ -250,7 +250,7 @@ net_serialize_gamestate(const GameState*
 }
 
 void
-net_unserialize_gamestate(const NetworkGameState* src, GameState* dest)
+net_unserialize_gamestate(NetworkGameState* src, GameState* dest)
 {
     int p;
 
--- tennix-1.1.orig/makefile
+++ tennix-1.1/makefile
@@ -27,24 +27,23 @@ ifeq ($(MKCALLGRAPH),1)
   LD        =  nccld
 endif
 
-RELEASE   =  1.1
-
-UNAME = $(shell uname)
+RELEASE = 1.1.1
 
 PREFIX ?= /usr/local
 BINDIR ?= $(PREFIX)/bin
 DATAROOTDIR ?= $(PREFIX)/share
 DATADIR ?= $(DATAROOTDIR)/games
 
-LIBS =
-CFLAGS += -W -Wall -ansi -pedantic -Wcast-qual -Wwrite-strings -DVERSION=\"$(RELEASE)\" -O2 -DPREFIX=\"$(PREFIX)\" -g
+CFLAGS += -W -Wall -DVERSION=\"$(RELEASE)\" -O2 -DPREFIX=\"$(PREFIX)\"
 CXXFLAGS += $(CFLAGS)
 
 USE_PYTHON ?= 1
 
 ifeq ($(USE_PYTHON),1)
-  CFLAGS += `python-config --includes` -DTENNIX_PYTHON
-  LIBS += `python-config --libs`
+  PYTHON_INCLUDES := $(shell python-config --includes)
+  PYTHON_LIBS := $(shell python-config --libs)
+  CFLAGS += $(PYTHON_INCLUDES) -DTENNIX_PYTHON
+  LIBS += $(PYTHON_LIBS)
 endif
 
 ifeq ($(NONFREE_LOCATIONS),1)
@@ -67,17 +66,14 @@ ifeq ($(MAEMO),1)
   CFLAGS += -DMAEMO
 endif
 
-ifeq ($(UNAME),Darwin)
-  SDLLIBS=$$(sdl-config --prefix)/lib
-  LIBS += $$(sdl-config --static-libs) $(SDLLIBS)/libSDL_mixer.a $(SDLLIBS)/libSDL_image.a $(SDLLIBS)/libSDL_ttf.a $(SDLLIBS)/libSDL_net.a $$(freetype-config --prefix)/lib/libfreetype.a
-  CFLAGS += $$(sdl-config --cflags) -lz
-else
-  LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image -lSDL_ttf -lSDL_net
-  CFLAGS += $$(sdl-config --cflags)
-endif
+SDL_LIBS := $(shell sdl-config --libs)
+SDL_CFLAGS := $(shell sdl-config --cflags)
+
+LIBS += $(SDL_LIBS) -lSDL_mixer -lSDL_image -lSDL_ttf -lSDL_net
+CFLAGS += $(SDL_CFLAGS)
 
-SRC = tennix.cc game.c graphics.cc input.c util.c sound.cc animation.c network.c
 OBJ = tennix.o game.o graphics.o input.o util.o sound.o animation.o archive.o SDL_rotozoom.o network.o
+
 ifeq ($(MSYSTEM),MINGW32)
   OBJ += tennixres.o
 endif
--- tennix-1.1.orig/game.h
+++ tennix-1.1/game.h
@@ -98,6 +98,13 @@ typedef struct {
     bool inhibit_gravity;
 } Ball;
 
+enum PlayerDesire {
+    DESIRE_NORMAL,
+    DESIRE_TOPSPIN,
+    DESIRE_SMASH,
+    DESIRE_MAX
+};
+
 typedef struct {
     InputDevice* input;
     char input_device_index;
@@ -106,9 +113,9 @@ typedef struct {
     float power;
     bool use_power;
     unsigned char score;
-    unsigned char desire;
+    PlayerDesire desire;
     bool type; /* is this player ai-controlled or human? */
-    char game; /* score for the current game */
+    int game; /* score for the current game */
     unsigned char sets[SETS_TO_WIN*2]; /* score for each set */
     float accelerate; /* a value [0..1] how fast the user accelerates */
 } Player;
@@ -118,13 +125,6 @@ enum {
     PLAYER_TYPE_AI
 };
 
-enum {
-    DESIRE_NORMAL,
-    DESIRE_TOPSPIN,
-    DESIRE_SMASH,
-    DESIRE_MAX
-};
-
 /* wait 2 seconds before we score the game */
 #define SCORING_DELAY 1000
 
@@ -161,7 +161,7 @@ enum {
 
 typedef struct {
     const Location* location;
-    char current_location; /* index of loc. in global location table */
+    int current_location; /* index of loc. in global location table */
     Ball ball;
     Player players[MAXPLAYERS];
     unsigned char serving_player;