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
|
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
|
+
-
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
-
-
-
+
+
+
|
SDL_LockSurface(screen);
draw_text(0,8,t,0xF1,0xFF);
draw_text(n<<3,8,"\xB1",0xF1,0xFB);
SDL_UnlockSurface(screen);
SDL_Flip(screen);
}
}
return 0;
}
void screen_message(const char*txt) {
SDL_Rect r;
int screen_message(const char*txt) {
int n=0;
SDL_Rect r={0,0,screen->w,16};
SDL_Event ev;
SDL_FillRect(screen,&r,0xF4);
r.y=16;
r.h=1;
SDL_FillRect(screen,&r,0xF8);
SDL_LockSurface(screen);
draw_text(0,0,txt,0xF4,0xFE);
draw_text(0,8,"<Push ENTER to continue>",0xF4,0xF7);
SDL_UnlockSurface(screen);
set_cursor(XC_iron_cross);
SDL_Flip(screen);
r.y=8;
r.h=8;
while(SDL_WaitEvent(&ev)) {
switch(ev.type) {
case SDL_QUIT:
SDL_PushEvent(&ev);
return;
return -1;
case SDL_KEYDOWN:
return;
switch(ev.key.keysym.sym) {
case SDLK_RETURN: case SDLK_KP_ENTER:
r.y=0;
r.h=17;
SDL_FillRect(screen,&r,0xF0);
return 0;
case SDL_MOUSEBUTTONDOWN:
return;
}
break;
}
}
return -1;
}
static Uint16 decide_picture_size(int nwantsize,const Uint8*wantsize,const Uint16*havesize,int n) {
int i,j;
if(!nwantsize) fatal("Unable to determine what picture size is wanted\n");
for(i=0;i<nwantsize;i++) if(havesize[j=wantsize[i]]==n) return j;
for(i=*wantsize;i;--i) if(havesize[i]) return i;
|