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
|
--- tools.cpp.orig 2002-12-17 09:35:55.000000000 -0500
+++ tools.cpp 2002-12-17 09:39:28.000000000 -0500
@@ -100,8 +100,19 @@
///////////////////////// misc tools ///////////////////////
+char *addfullpath(char *s) {
+ static char ret[256]; // choose a reasonable max buffer size
+ if (s[0] == '/') { return s; }
+ int slen = strlen(s);
+ memset(ret, 0x00, 256);
+ memcpy(ret, GAMES_DATADIR, GAMES_DATADIR_LEN);
+ memcpy(ret+GAMES_DATADIR_LEN, s, slen);
+ return ret;
+}
+
char *path(char *s)
{
+ s = addfullpath(s);
for(char *t = s; t = strpbrk(t, "/\\"); *t++ = PATHDIV);
return s;
};
--- rendergl.cpp.orig 2002-12-17 09:48:00.000000000 -0500
+++ rendergl.cpp 2002-12-17 09:50:19.000000000 -0500
@@ -59,6 +59,7 @@
bool installtex(int tnum, char *texname, int &xs, int &ys, bool clamp)
{
+ texname = addfullpath(texname);
SDL_Surface *s = IMG_Load(texname);
if(!s) { conoutf("couldn't load texture %s", (int)texname); return false; };
if(s->format->BitsPerPixel!=24) { conoutf("texture must be 24bpp: %s", (int)texname); return false; };
--- tools.h.orig 2002-12-17 09:51:06.000000000 -0500
+++ tools.h 2002-12-17 09:50:59.000000000 -0500
@@ -96,7 +96,7 @@
#endif
-
+extern char *addfullpath(char *s);
extern char *path(char *s);
extern char *loadfile(char *fn, int *size);
extern void endianswap(void *, int, int);
|