forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0.9.6-gentoo.patch
183 lines (167 loc) · 6 KB
/
0.9.6-gentoo.patch
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
--- Makefile
+++ Makefile
@@ -1,4 +1,3 @@
-LDFLAGS= -lSDL -lpthread -s
CFLAGS= -Wall # -DDEBUG
PKG_BCDIR=balloonchase-`cat src/ver`
PKG_BCVER=`cat src/ver`
@@ -9,8 +8,8 @@
clean:
rm balloonchase src/*.o
main: src/main.c
- g++ -c -o src/main.o `sdl-config --cflags` src/main.c
- g++ -o balloonchase src/main.o `sdl-config --libs`
+ g++ $(CXXFLAGS) -c -o src/main.o `sdl-config --cflags` src/main.c
+ g++ $(LDFLAGS) -o balloonchase src/main.o `sdl-config --libs`
pkg:
@echo $(PKG_BCVERSION) >VERSION
rm balloonchase src/*.o
--- src/main.c
+++ src/main.c
@@ -333,47 +333,47 @@
int InitImages()
{
- back = SDL_LoadBMP("images/back.bmp");
+ back = SDL_LoadBMP("GENTOODIR/images/back.bmp");
- num3 = SDL_LoadBMP("images/num3.bmp");
+ num3 = SDL_LoadBMP("GENTOODIR/images/num3.bmp");
SDL_SetColorKey(num3, SDL_SRCCOLORKEY, SDL_MapRGB(num3->format, 0xFF, 0xFF, 0xFF));
- num2 = SDL_LoadBMP("images/num2.bmp");
+ num2 = SDL_LoadBMP("GENTOODIR/images/num2.bmp");
SDL_SetColorKey(num2, SDL_SRCCOLORKEY, SDL_MapRGB(num2->format, 0xFF, 0xFF, 0xFF));
- num1 = SDL_LoadBMP("images/num1.bmp");
+ num1 = SDL_LoadBMP("GENTOODIR/images/num1.bmp");
SDL_SetColorKey(num1, SDL_SRCCOLORKEY, SDL_MapRGB(num1->format, 0xFF, 0xFF, 0xFF));
- num0 = SDL_LoadBMP("images/num0.bmp");
+ num0 = SDL_LoadBMP("GENTOODIR/images/num0.bmp");
SDL_SetColorKey(num0, SDL_SRCCOLORKEY, SDL_MapRGB(num0->format, 0xFF, 0xFF, 0xFF));
- numv = SDL_LoadBMP("images/num-.bmp");
+ numv = SDL_LoadBMP("GENTOODIR/images/num-.bmp");
SDL_SetColorKey(numv, SDL_SRCCOLORKEY, SDL_MapRGB(numv->format, 0xFF, 0xFF, 0xFF));
- menu = SDL_LoadBMP("images/menu.bmp");
- menu_onoff = SDL_LoadBMP("images/menu_onoff.bmp");
+ menu = SDL_LoadBMP("GENTOODIR/images/menu.bmp");
+ menu_onoff = SDL_LoadBMP("GENTOODIR/images/menu_onoff.bmp");
-// arrow[0] = SDL_LoadBMP("images/down.bmp");
+// arrow[0] = SDL_LoadBMP("GENTOODIR/images/down.bmp");
// SDL_SetColorKey(arrow[0], SDL_SRCCOLORKEY, SDL_MapRGB(arrow[0]->format, 0x00, 0x00, 0x00));
-// arrow[1] = SDL_LoadBMP("images/down.bmp");
+// arrow[1] = SDL_LoadBMP("GENTOODIR/images/down.bmp");
// SDL_SetColorKey(arrow[1], SDL_SRCCOLORKEY, SDL_MapRGB(arrow[1]->format, 0x00, 0x00, 0x00));
- kp1 = SDL_LoadBMP("images/kp1.bmp");
+ kp1 = SDL_LoadBMP("GENTOODIR/images/kp1.bmp");
SDL_SetColorKey(kp1, SDL_SRCCOLORKEY, SDL_MapRGB(kp1->format, 0xFF, 0xFF, 0xFF));
- kp1b = SDL_LoadBMP("images/kp1b.bmp");
+ kp1b = SDL_LoadBMP("GENTOODIR/images/kp1b.bmp");
SDL_SetColorKey(kp1b, SDL_SRCCOLORKEY, SDL_MapRGB(kp1b->format, 0xFF, 0xFF, 0xFF));
- kp2 = SDL_LoadBMP("images/kp2.bmp");
+ kp2 = SDL_LoadBMP("GENTOODIR/images/kp2.bmp");
SDL_SetColorKey(kp2, SDL_SRCCOLORKEY, SDL_MapRGB(kp2->format, 0xFF, 0xFF, 0xFF));
- kp2b = SDL_LoadBMP("images/kp2b.bmp");
+ kp2b = SDL_LoadBMP("GENTOODIR/images/kp2b.bmp");
SDL_SetColorKey(kp2b, SDL_SRCCOLORKEY, SDL_MapRGB(kp2b->format, 0xFF, 0xFF, 0xFF));
- font2 = SDL_LoadBMP("images/font.bmp");
+ font2 = SDL_LoadBMP("GENTOODIR/images/font.bmp");
font = SDL_CreateRGBSurface(SDL_SWSURFACE, 1288, 100, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
SDL_SetColorKey(font, SDL_SRCCOLORKEY, SDL_MapRGB(font->format, 0x00, 0x00, 0x00));
DrawIMG (font, font2, 0, 0);
- blobtrox = SDL_LoadBMP("images/blobtrox.bmp");
+ blobtrox = SDL_LoadBMP("GENTOODIR/images/blobtrox.bmp");
//SDL_SetColorKey(blobtrox, SDL_SRCCOLORKEY, SDL_MapRGB(blobtrox->format, 0x01, 0x01, 0x01));
- balloonchase = SDL_LoadBMP("images/balloonchase.bmp");
+ balloonchase = SDL_LoadBMP("GENTOODIR/images/balloonchase.bmp");
TMP = SDL_CreateRGBSurface(SDL_SWSURFACE, 259, 200, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
blursurface = SDL_CreateRGBSurface(SDL_SWSURFACE, 640, 480, 32, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
@@ -578,7 +578,7 @@
void createdat(int winsneed, int option_wave_effect)
{
- FILE *OPTFILE=fopen ("balloonchase.dat", "w+");
+ FILE *OPTFILE=fopen (".balloonchaserc", "w+");
char datmsg[60];
sprintf (datmsg, "Balloon Chase settings file -- Do not edit manually!");
char tmp2;
@@ -588,52 +588,32 @@
}
fputc (winsneed, OPTFILE);
fputc (option_wave_effect+2, OPTFILE);
- fprintf (stderr, "Saved configuration to balloonchase.dat\n");
+ fprintf (stderr, "Saved configuration to .balloonchaserc\n");
fclose (OPTFILE);
}
void checkfiles()
{
- char found=0;
- #ifdef WIN32
- WIN32_FIND_DATA fileinfo;
- BOOL rc = 0;
- HANDLE hFile;
- hFile = FindFirstFile("*", &fileinfo);
- while(rc)
- {
- rc = FindNextFile(hFile, &fileinfo);
- if (strcmp (fileinfo.cFileName, "balloonchase.dat")==0)
- {
- fprintf(stderr, "Found balloonchase.dat\n");
- found = 1;
- _findclose(hFile);
- #endif
- #ifndef WIN32
- struct dirent *filelist[255];
- int i=0;
- int j=0;
DIR *dp;
- dp=opendir("./");
- int filenum=0;
- while( filelist[filenum]=readdir(dp) )
- filenum++;
- closedir(dp);
- if (filenum>=2)
- for (i=0;i<filenum;i++)
- {
- if (strcmp(filelist[i]->d_name,"balloonchase.dat")==0)
- {
- fprintf (stderr, "Found balloonchase.dat\n");
- found=1;
- }
+
+ if (getenv("HOME")) {
+ chdir(getenv("HOME"));
+ }
+ if ((dp = opendir("./"))) {
+ struct dirent *f;
+
+ while(f=readdir(dp)) {
+ if (strcmp(f->d_name, ".balloonchaserc") == 0) {
+ fprintf (stderr, "Found .balloonchaserc\n");
+ closedir(dp);
+ return;
}
- #endif
- if (found==0)
- {
- fprintf (stderr, "Balloonchase.dat not found!\nCreating new...\n");
- if (found==0) createdat(2, 1);
}
+ closedir(dp);
+ fprintf (stderr,
+ "Balloonchase.dat not found!\nCreating new...\n");
+ createdat(2, 1);
+ }
}
Uint32 rgb(Uint8 r, Uint8 g, Uint8 b)
@@ -1257,7 +1237,7 @@
SDL_WM_SetCaption ("Balloon Chase", 0);
checkfiles();
- FILE *OPTFILE=fopen ("balloonchase.dat", "r");
+ FILE *OPTFILE=fopen (".balloonchaserc", "r");
char datmsg[60];
char varmistus[60];
@@ -1275,7 +1255,7 @@
{
winsneeded=fgetc(OPTFILE);
option_wave_effect=fgetc(OPTFILE)-2;
- fprintf (stderr, "Successfully loaded balloonchase.dat\n");
+ fprintf (stderr, "Successfully loaded .balloonchaserc\n");
}
else
{