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
|
--- openarena-engine-0.8.1/Makefile.old 2010-03-06 21:51:19.000000000 +0100
+++ openarena-engine-0.8.1/Makefile 2010-03-06 21:58:01.000000000 +0100
@@ -283,9 +283,9 @@
SHLIBLDFLAGS=-shared $(LDFLAGS)
THREAD_LDFLAGS=-lpthread
- LDFLAGS=-ldl -lm
+ LDFLAGS=-ldl -lm -lz
- CLIENT_LDFLAGS=$(shell sdl-config --libs) -lGL
+ CLIENT_LDFLAGS=$(shell sdl-config --libs) -lGL -ljpeg
ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
@@ -560,7 +560,7 @@
THREAD_LDFLAGS=-lpthread
# don't need -ldl (FreeBSD)
- LDFLAGS=-lm
+ LDFLAGS=-lm -lz
CLIENT_LDFLAGS =
@@ -616,7 +616,7 @@
SHLIBLDFLAGS=-shared $(LDFLAGS)
THREAD_LDFLAGS=-lpthread
- LDFLAGS=-lm
+ LDFLAGS=-lm -lz
CLIENT_LDFLAGS =
@@ -644,7 +644,7 @@
ARCH=i386
endif
- LDFLAGS=-lm
+ LDFLAGS=-lm -lz
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS)
@@ -683,10 +683,10 @@
SHLIBCFLAGS=
SHLIBLDFLAGS=-shared
- LDFLAGS=-ldl -lm -lgen
+ LDFLAGS=-ldl -lm -lgen -lz
# FIXME: The X libraries probably aren't necessary?
CLIENT_LDFLAGS=-L/usr/X11/$(LIB) $(shell sdl-config --libs) -lGL \
- -lX11 -lXext -lm
+ -lX11 -lXext -lm -ljpeg
else # ifeq IRIX
@@ -750,11 +750,11 @@
SHLIBLDFLAGS=-shared $(LDFLAGS)
THREAD_LDFLAGS=-lpthread
- LDFLAGS=-lsocket -lnsl -ldl -lm
+ LDFLAGS=-lsocket -lnsl -ldl -lm -lz
BOTCFLAGS=-O0
- CLIENT_LDFLAGS +=$(shell sdl-config --libs) -lGL
+ CLIENT_LDFLAGS +=$(shell sdl-config --libs) -lGL -ljpeg
else # ifeq sunos
@@ -1278,41 +1278,7 @@
$(B)/client/l_script.o \
$(B)/client/l_struct.o \
\
- $(B)/client/jcapimin.o \
- $(B)/client/jcapistd.o \
- $(B)/client/jchuff.o \
- $(B)/client/jcinit.o \
- $(B)/client/jccoefct.o \
- $(B)/client/jccolor.o \
- $(B)/client/jfdctflt.o \
- $(B)/client/jcdctmgr.o \
- $(B)/client/jcphuff.o \
- $(B)/client/jcmainct.o \
- $(B)/client/jcmarker.o \
- $(B)/client/jcmaster.o \
- $(B)/client/jcomapi.o \
- $(B)/client/jcparam.o \
- $(B)/client/jcprepct.o \
- $(B)/client/jcsample.o \
- $(B)/client/jdapimin.o \
- $(B)/client/jdapistd.o \
$(B)/client/jdatasrc.o \
- $(B)/client/jdcoefct.o \
- $(B)/client/jdcolor.o \
- $(B)/client/jddctmgr.o \
- $(B)/client/jdhuff.o \
- $(B)/client/jdinput.o \
- $(B)/client/jdmainct.o \
- $(B)/client/jdmarker.o \
- $(B)/client/jdmaster.o \
- $(B)/client/jdpostct.o \
- $(B)/client/jdsample.o \
- $(B)/client/jdtrans.o \
- $(B)/client/jerror.o \
- $(B)/client/jidctflt.o \
- $(B)/client/jmemmgr.o \
- $(B)/client/jmemnobs.o \
- $(B)/client/jutils.o \
\
$(B)/client/tr_animation.o \
$(B)/client/tr_backend.o \
--- openarena-engine-0.8.1/code/qcommon/unzip.h.old 2010-03-06 21:59:46.000000000 +0100
+++ openarena-engine-0.8.1/code/qcommon/unzip.h 2010-03-06 22:00:58.000000000 +0100
@@ -19,6 +19,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
+#include <zconf.h>
+#include <zlib.h>
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
/* like the STRICT of WIN32, we define a pointer that cannot be converted
@@ -80,6 +82,7 @@
typedef void* (*alloc_func) (void* opaque, unsigned int items, unsigned int size);
typedef void (*free_func) (void* opaque, void* address);
+#if 0
struct internal_state;
typedef struct z_stream_s {
@@ -105,6 +108,7 @@
typedef z_stream *z_streamp;
+#endif
/* file_in_zip_read_info_s contain internal information about a file in zipfile,
when reading and decompress it */
--- openarena-engine-0.8.1/code/qcommon/unzip.c.old 2010-03-06 22:01:40.000000000 +0100
+++ openarena-engine-0.8.1/code/qcommon/unzip.c 2010-03-06 22:03:35.000000000 +0100
@@ -49,7 +49,7 @@
ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
PkWare has also a specification at :
ftp://ftp.pkware.com/probdesc.zip */
-
+#if 0
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.1.3, July 9th, 1998
@@ -955,6 +955,7 @@
// static const char * zError OF((int err));
// static int inflateSyncPoint OF((z_streamp z));
// static const uLong * get_crc_table OF((void));
+#endif
typedef unsigned char uch;
typedef unsigned short ush;
@@ -2248,6 +2249,8 @@
return (int)uReadThis;
}
+#if 0
+
/* infblock.h -- header to use infblock.c
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -4295,3 +4298,4 @@
}
+#endif
--- openarena-engine-0.8.1/code/jpeg-6/jdatasrc.c.old 2010-03-10 09:13:25.000000000 +0100
+++ openarena-engine-0.8.1/code/jpeg-6/jdatasrc.c 2010-03-10 09:23:39.000000000 +0100
@@ -16,9 +16,15 @@
/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jerror.h"
+#include <stdio.h>
+#include <string.h>
+#include <jpeglib.h>
+#include <jerror.h>
+#undef METHODDEF
+#define METHODDEF static
+#undef GLOBAL
+#define GLOBAL
+#define SIZEOF(object) ((size_t) sizeof(object))
#ifndef MIN
#define MIN(a, b) ((a)<(b)?(a):(b))
@@ -189,7 +195,7 @@
*/
GLOBAL void
-jpeg_mem_src (j_decompress_ptr cinfo, unsigned char *inbuf, size_t size)
+jpeg_mem_src (j_decompress_ptr cinfo, unsigned char *inbuf, unsigned long size)
{
my_src_ptr src;
--- openarena-engine-0.8.1/code/renderer/tr_image_jpg.c.old 2010-03-10 09:30:30.000000000 +0100
+++ openarena-engine-0.8.1/code/renderer/tr_image_jpg.c 2010-03-10 10:17:42.000000000 +0100
@@ -31,7 +31,7 @@
*/
#define JPEG_INTERNALS
-#include "../jpeg-6/jpeglib.h"
+#include <jpeglib.h>
void R_LoadJPG( const char *filename, unsigned char **pic, int *width, int *height ) {
/* This struct contains the JPEG decompression parameters and pointers to
@@ -128,7 +128,10 @@
}
memcount = pixelcount * 4;
- row_stride = cinfo.output_width * cinfo.output_components;
+ if (3 == cinfo.output_components)
+ row_stride = cinfo.output_width * 4;
+ else
+ row_stride = cinfo.output_width * cinfo.output_components;
out = ri.Malloc(memcount);
@@ -141,14 +144,26 @@
/* Here we use the library's state variable cinfo.output_scanline as the
* loop counter, so that we don't have to keep track ourselves.
*/
+ buf = out;
while (cinfo.output_scanline < cinfo.output_height) {
/* jpeg_read_scanlines expects an array of pointers to scanlines.
* Here the array is only one element long, but you could ask for
* more than one scanline at a time if that's more convenient.
*/
- buf = ((out+(row_stride*cinfo.output_scanline)));
buffer = &buf;
(void) jpeg_read_scanlines(&cinfo, buffer, 1);
+ if (3 == cinfo.output_components) {
+ /* turn RGB into RGBA */
+ int ioffset = cinfo.output_width * 3 - 1;
+ int ooffset = cinfo.output_width * 4 - 1;
+ do {
+ buf[ooffset--] = 255;
+ buf[ooffset--] = buf[ioffset--];
+ buf[ooffset--] = buf[ioffset--];
+ buf[ooffset--] = buf[ioffset--];
+ } while (ioffset > 0);
+ }
+ buf += row_stride;
}
buf = out;
@@ -173,7 +188,7 @@
buf[--dindex] = greyshade;
} while(sindex);
}
- else
+ else if (4 == cinfo.output_components)
{
// clear all the alphas to 255
int i;
|