Package: biniax2 / 1.30-4

datadir.patch Patch series | download
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
From: Miriam Ruiz <little_miry@yahoo.es>
Date: Fri, 5 Apr 2013 00:08:18 +0200
Subject: datadir

# Copyright (C) 2008 by Miriam Ruiz <little_miry@yahoo.es>
# Distributed under the same license as the game. See debian/copyright
---
 desktop/gfx.c |   52 ++++++++++++++++++++++++++--------------------------
 desktop/snd.c |   28 ++++++++++++++--------------
 makefile      |    5 +++--
 3 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/desktop/gfx.c b/desktop/gfx.c
index c71c855..c834026 100755
--- a/desktop/gfx.c
+++ b/desktop/gfx.c
@@ -809,40 +809,40 @@ BNX_BOOL gfxLoadResources()
 	BNX_BOOL bLoad = BNX_TRUE;
 
 	/* Load GUI related graphics data */
-	bLoad &= gfxLoadImage( "data/graphics/background0.png", &_Gfx.background[ cModeRealtime ]);
-	bLoad &= gfxLoadImage( "data/graphics/background1.png", &_Gfx.background[ cModeTurn ]);
-	bLoad &= gfxLoadImage( "data/graphics/background2.png", &_Gfx.background[ cModeMultiplayer ] );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/background0.png", &_Gfx.background[ cModeRealtime ]);
+	bLoad &= gfxLoadImage( DATADIR "/graphics/background1.png", &_Gfx.background[ cModeTurn ]);
+	bLoad &= gfxLoadImage( DATADIR "/graphics/background2.png", &_Gfx.background[ cModeMultiplayer ] );
 
-	bLoad &= gfxLoadImage( "data/graphics/window.png", &_Gfx.window );
-	bLoad &= gfxLoadImage( "data/graphics/splash.png", &_Gfx.splash );
-	bLoad &= gfxLoadImage( "data/graphics/logo.png", &_Gfx.logo );
-	bLoad &= gfxLoadImage( "data/graphics/help.png", &_Gfx.help );
-	bLoad &= gfxLoadImage( "data/graphics/font.png", &_Gfx.font );
-	bLoad &= gfxLoadImage( "data/graphics/roadmap.png", &_Gfx.roadmap );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/window.png", &_Gfx.window );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/splash.png", &_Gfx.splash );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/logo.png", &_Gfx.logo );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/help.png", &_Gfx.help );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/font.png", &_Gfx.font );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/roadmap.png", &_Gfx.roadmap );
 
 	// Loading Game Elements
-	bLoad &= gfxLoadImage( "data/graphics/element0.png", &_Gfx.elements[ 0 ] );
-	bLoad &= gfxLoadImage( "data/graphics/element1.png", &_Gfx.elements[ 1 ] );
-	bLoad &= gfxLoadImage( "data/graphics/element2.png", &_Gfx.elements[ 2 ] );
-	bLoad &= gfxLoadImage( "data/graphics/element3.png", &_Gfx.elements[ 3 ] );
-	bLoad &= gfxLoadImage( "data/graphics/elementB.png", &_Gfx.elements[ 4 ] );
-
-	bLoad &= gfxLoadImage( "data/graphics/movecount.png", &_Gfx.movecount );
-	bLoad &= gfxLoadImage( "data/graphics/keyboard.png", &_Gfx.keyboard );
-	bLoad &= gfxLoadImage( "data/graphics/cursor0.png", &_Gfx.cursors[ 0 ] );
-	bLoad &= gfxLoadImage( "data/graphics/cursor1.png", &_Gfx.cursors[ 1 ] );
-	bLoad &= gfxLoadImage( "data/graphics/marker0.png", &_Gfx.markers[ 0 ] );
-	bLoad &= gfxLoadImage( "data/graphics/marker1.png", &_Gfx.markers[ 1 ] );
-
-	bLoad &= gfxLoadImage( "data/graphics/particle0.png", &_Gfx.part[ 0 ] );
-	bLoad &= gfxLoadImage( "data/graphics/particle1.png", &_Gfx.part[ 1 ] );
-	bLoad &= gfxLoadImage( "data/graphics/particle2.png", &_Gfx.part[ 2 ] );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/element0.png", &_Gfx.elements[ 0 ] );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/element1.png", &_Gfx.elements[ 1 ] );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/element2.png", &_Gfx.elements[ 2 ] );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/element3.png", &_Gfx.elements[ 3 ] );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/elementB.png", &_Gfx.elements[ 4 ] );
+
+	bLoad &= gfxLoadImage( DATADIR "/graphics/movecount.png", &_Gfx.movecount );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/keyboard.png", &_Gfx.keyboard );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/cursor0.png", &_Gfx.cursors[ 0 ] );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/cursor1.png", &_Gfx.cursors[ 1 ] );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/marker0.png", &_Gfx.markers[ 0 ] );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/marker1.png", &_Gfx.markers[ 1 ] );
+
+	bLoad &= gfxLoadImage( DATADIR "/graphics/particle0.png", &_Gfx.part[ 0 ] );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/particle1.png", &_Gfx.part[ 1 ] );
+	bLoad &= gfxLoadImage( DATADIR "/graphics/particle2.png", &_Gfx.part[ 2 ] );
 
 	// Set alpha
 	SDL_SetAlpha( _Gfx.window, SDL_SRCALPHA | SDL_RLEACCEL, cGfxWinBlending );
 
 	// Load Help Text
-	gfxLoadHelp( "data/text/help.txt" );
+	gfxLoadHelp( DATADIR "/text/help.txt" );
 
 	return bLoad;
 }
diff --git a/desktop/snd.c b/desktop/snd.c
index 55b1c87..b2a9e07 100755
--- a/desktop/snd.c
+++ b/desktop/snd.c
@@ -63,20 +63,20 @@ BNX_BOOL sndInit()
 
 	Mix_VolumeMusic( MIX_MAX_VOLUME >> 1 );
 
-	_Snd.sounds[ 1 ] = Mix_LoadWAV( "data/sound/sfx1.wav" );
-	_Snd.sounds[ 2 ] = Mix_LoadWAV( "data/sound/sfx2.wav" );
-	_Snd.sounds[ 3 ] = Mix_LoadWAV( "data/sound/sfx3.wav" );
-	_Snd.sounds[ 4 ] = Mix_LoadWAV( "data/sound/sfx4.wav" );
-	_Snd.sounds[ 5 ] = Mix_LoadWAV( "data/sound/sfx5.wav" );
-
-	_Snd.music[ 0 ] = Mix_LoadMUS( "data/music/biniax_common00.it" );
-	_Snd.music[ 1 ] = Mix_LoadMUS( "data/music/biniax_common01.it" );
-	_Snd.music[ 2 ] = Mix_LoadMUS( "data/music/biniax_common02.it" );
-	_Snd.music[ 3 ] = Mix_LoadMUS( "data/music/biniax_common03.it" );
-	_Snd.music[ 4 ] = Mix_LoadMUS( "data/music/biniax_common04.it" );
-	_Snd.music[ 5 ] = Mix_LoadMUS( "data/music/biniax_common05.it" );
-	_Snd.music[ 6 ] = Mix_LoadMUS( "data/music/biniax_common06.it" );
-	_Snd.music[ 7 ] = Mix_LoadMUS( "data/music/biniax_common07.it" );
+	_Snd.sounds[ 1 ] = Mix_LoadWAV( DATADIR "/sound/sfx1.wav" );
+	_Snd.sounds[ 2 ] = Mix_LoadWAV( DATADIR "/sound/sfx2.wav" );
+	_Snd.sounds[ 3 ] = Mix_LoadWAV( DATADIR "/sound/sfx3.wav" );
+	_Snd.sounds[ 4 ] = Mix_LoadWAV( DATADIR "/sound/sfx4.wav" );
+	_Snd.sounds[ 5 ] = Mix_LoadWAV( DATADIR "/sound/sfx5.wav" );
+
+	_Snd.music[ 0 ] = Mix_LoadMUS( DATADIR "/music/biniax_common00.it" );
+	_Snd.music[ 1 ] = Mix_LoadMUS( DATADIR "/music/biniax_common01.it" );
+	_Snd.music[ 2 ] = Mix_LoadMUS( DATADIR "/music/biniax_common02.it" );
+	_Snd.music[ 3 ] = Mix_LoadMUS( DATADIR "/music/biniax_common03.it" );
+	_Snd.music[ 4 ] = Mix_LoadMUS( DATADIR "/music/biniax_common04.it" );
+	_Snd.music[ 5 ] = Mix_LoadMUS( DATADIR "/music/biniax_common05.it" );
+	_Snd.music[ 6 ] = Mix_LoadMUS( DATADIR "/music/biniax_common06.it" );
+	_Snd.music[ 7 ] = Mix_LoadMUS( DATADIR "/music/biniax_common07.it" );
 
 	return loaded;
 }
diff --git a/makefile b/makefile
index 39d3596..62e0da1 100755
--- a/makefile
+++ b/makefile
@@ -8,8 +8,9 @@ CC=gcc
 FILES=biniax.c hof.c desktop/cfg.c desktop/gfx.c desktop/snd.c desktop/inp.c desktop/sys.c
 INCLUDES=-I . -I desktop
 LINKTO=-lSDL -lSDL_mixer -lSDL_image
-AUTO=`sdl-config --libs --cflags`
+DATADIR=/usr/share/games/biniax2
+AUTO=`sdl-config --libs --cflags` -DDATADIR=\"$(DATADIR)\"
 TARGET=biniax2
 
 biniax:
-	$(CC) $(AUTO) $(FILES) $(INCLUDES) -o $(TARGET) $(LINKTO)
\ No newline at end of file
+	$(CC) $(FLAGS) $(AUTO) $(FILES) $(INCLUDES) -o $(TARGET) $(LINKTO)