diff options
Diffstat (limited to 'apps/plugins/doom/rockdoom.c')
-rw-r--r-- | apps/plugins/doom/rockdoom.c | 706 |
1 files changed, 706 insertions, 0 deletions
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c new file mode 100644 index 0000000000..ae994c1acd --- /dev/null +++ b/apps/plugins/doom/rockdoom.c | |||
@@ -0,0 +1,706 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2005 Karl Kurbjun | ||
10 | * | ||
11 | * All files in this archive are subject to the GNU General Public License. | ||
12 | * See the file COPYING in the source tree root for full license agreement. | ||
13 | * | ||
14 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
15 | * KIND, either express or implied. | ||
16 | * | ||
17 | * H300 Port by Karl Kurbjun | ||
18 | * IPod port by Dave Chapman and Paul Louden | ||
19 | * Additional code contributed by Thom Johansen | ||
20 | * Based off work by: Digita Doom, IDoom, Prboom, lSDLDoom, LxDoom, | ||
21 | * MBF, Boom, DosDoom, | ||
22 | * and of course Original Doom by ID Software | ||
23 | * See: http://prboom.sourceforge.net/about.html for the history | ||
24 | * | ||
25 | * | ||
26 | ****************************************************************************/ | ||
27 | |||
28 | #include "d_main.h" | ||
29 | #include "doomdef.h" | ||
30 | #include "settings.h" | ||
31 | #include "m_fixed.h" | ||
32 | #include "m_argv.h" | ||
33 | #include "m_misc.h" | ||
34 | #include "g_game.h" | ||
35 | #include "rockmacros.h" | ||
36 | #include "doomstat.h" | ||
37 | #include "i_system.h" | ||
38 | |||
39 | PLUGIN_HEADER | ||
40 | |||
41 | #ifdef USE_IRAM | ||
42 | extern char iramcopy[]; | ||
43 | extern char iramstart[]; | ||
44 | extern char iramend[]; | ||
45 | extern char iedata[]; | ||
46 | extern char iend[]; | ||
47 | #endif | ||
48 | |||
49 | extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough | ||
50 | |||
51 | int filearray[9]; | ||
52 | int fpoint=1; // save 0 for closing | ||
53 | |||
54 | int fileexists(const char * fname) | ||
55 | { | ||
56 | int fd; | ||
57 | fd = open(fname,O_RDONLY); | ||
58 | |||
59 | if (fd>=0) | ||
60 | { | ||
61 | close(fd); | ||
62 | return 0; | ||
63 | } | ||
64 | return -1; | ||
65 | } | ||
66 | |||
67 | #ifndef SIMULATOR | ||
68 | int my_open(const char *file, int flags) | ||
69 | { | ||
70 | if(fpoint==8) | ||
71 | return -1; | ||
72 | #undef open | ||
73 | filearray[fpoint]=rb->open(file, flags); | ||
74 | |||
75 | if(filearray[fpoint]<0) | ||
76 | return filearray[fpoint]; | ||
77 | |||
78 | fpoint++; | ||
79 | return filearray[fpoint-1]; | ||
80 | } | ||
81 | |||
82 | int my_close(int id) | ||
83 | { | ||
84 | int i=0; | ||
85 | if(id<0) | ||
86 | return id; | ||
87 | while(filearray[i]!=id && i<8) | ||
88 | i++; | ||
89 | |||
90 | if(i==8) | ||
91 | { | ||
92 | printf("A requested FID did not exist!!!!"); | ||
93 | return -9; | ||
94 | } | ||
95 | #undef close | ||
96 | rb->close(id); | ||
97 | |||
98 | for(; i<fpoint-1; i++) | ||
99 | filearray[i]=filearray[i+1]; | ||
100 | |||
101 | fpoint--; | ||
102 | return 0; | ||
103 | } | ||
104 | #endif | ||
105 | struct plugin_api* rb; | ||
106 | #define MAXARGVS 100 | ||
107 | |||
108 | // Here is a hacked up printf command to get the output from the game. | ||
109 | int printf(const char *fmt, ...) | ||
110 | { | ||
111 | static int p_xtpt; | ||
112 | char p_buf[50]; | ||
113 | bool ok; | ||
114 | va_list ap; | ||
115 | |||
116 | va_start(ap, fmt); | ||
117 | ok = vsnprintf(p_buf,sizeof(p_buf), fmt, ap); | ||
118 | va_end(ap); | ||
119 | |||
120 | rb->lcd_putsxy(1,p_xtpt, (unsigned char *)p_buf); | ||
121 | rb->lcd_update(); | ||
122 | |||
123 | p_xtpt+=8; | ||
124 | if(p_xtpt>LCD_HEIGHT-8) | ||
125 | { | ||
126 | p_xtpt=0; | ||
127 | rb->lcd_clear_display(); | ||
128 | } | ||
129 | return 1; | ||
130 | } | ||
131 | |||
132 | char *my_strtok( char * s, const char * delim ) | ||
133 | { | ||
134 | register char *spanp; | ||
135 | register int c, sc; | ||
136 | char *tok; | ||
137 | static char *lasts; | ||
138 | |||
139 | |||
140 | if (s == NULL && (s = lasts) == NULL) | ||
141 | return (NULL); | ||
142 | |||
143 | /* | ||
144 | * Skip (span) leading delimiters (s += strspn(s, delim), sort of). | ||
145 | */ | ||
146 | cont: | ||
147 | c = *s++; | ||
148 | for (spanp = (char *)delim; (sc = *spanp++) != 0;) { | ||
149 | if (c == sc) | ||
150 | goto cont; | ||
151 | } | ||
152 | |||
153 | if (c == 0) { /* no non-delimiter characters */ | ||
154 | lasts = NULL; | ||
155 | return (NULL); | ||
156 | } | ||
157 | tok = s - 1; | ||
158 | |||
159 | /* | ||
160 | * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). | ||
161 | * Note that delim must have one NUL; we stop if we see that, too. | ||
162 | */ | ||
163 | for (;;) { | ||
164 | c = *s++; | ||
165 | spanp = (char *)delim; | ||
166 | do { | ||
167 | if ((sc = *spanp++) == c) { | ||
168 | if (c == 0) | ||
169 | s = NULL; | ||
170 | else | ||
171 | s[-1] = 0; | ||
172 | lasts = s; | ||
173 | return (tok); | ||
174 | } | ||
175 | } while (sc != 0); | ||
176 | } | ||
177 | /* NOTREACHED */ | ||
178 | } | ||
179 | #if 0 | ||
180 | static char *tp=NULL; | ||
181 | |||
182 | if(string!=NULL) | ||
183 | tp=string; | ||
184 | |||
185 | while(*tp!=NULL) | ||
186 | { | ||
187 | if(*tp==*delimiters) | ||
188 | break; | ||
189 | tp++; | ||
190 | } | ||
191 | *tp=0; | ||
192 | return tp; | ||
193 | } | ||
194 | #endif | ||
195 | |||
196 | inline void* memcpy(void* dst, const void* src, size_t size) | ||
197 | { | ||
198 | return rb->memcpy(dst, src, size); | ||
199 | } | ||
200 | |||
201 | // From suduku | ||
202 | int doom_menu_cb(int key, int m) | ||
203 | { | ||
204 | (void)m; | ||
205 | switch(key) | ||
206 | { | ||
207 | #ifdef MENU_ENTER2 | ||
208 | case MENU_ENTER2: | ||
209 | #endif | ||
210 | case MENU_ENTER: | ||
211 | key = BUTTON_NONE; /* eat the downpress, next menu reacts on release */ | ||
212 | break; | ||
213 | |||
214 | #ifdef MENU_ENTER2 | ||
215 | case MENU_ENTER2 | BUTTON_REL: | ||
216 | #endif | ||
217 | case MENU_ENTER | BUTTON_REL: | ||
218 | key = MENU_ENTER; /* fake downpress, next menu doesn't like release */ | ||
219 | break; | ||
220 | } | ||
221 | |||
222 | return key; | ||
223 | } | ||
224 | |||
225 | struct argvlist | ||
226 | { | ||
227 | int timedemo; // 1 says there's a timedemo | ||
228 | int demonum; | ||
229 | int addonnum; | ||
230 | } argvlist; | ||
231 | |||
232 | const unsigned char versions_builtin[7][20] = | ||
233 | { | ||
234 | "Doom Shareware", | ||
235 | "Doom Registered", | ||
236 | "Ultimate Doom", | ||
237 | "Doom 2", | ||
238 | "Doom 2 French", | ||
239 | "Plutonia", | ||
240 | "TNT" | ||
241 | }; | ||
242 | |||
243 | const unsigned char wads_builtin[7][30] = | ||
244 | { | ||
245 | GAMEBASE"doom1.wad", | ||
246 | GAMEBASE"doom.wad", | ||
247 | GAMEBASE"doomu.wad", | ||
248 | GAMEBASE"doom2.wad", | ||
249 | GAMEBASE"doom2f.wad", | ||
250 | GAMEBASE"plutonia.wad", | ||
251 | GAMEBASE"tnt.wad" | ||
252 | }; | ||
253 | |||
254 | int namemap[7]; | ||
255 | char *addonfiles[10]; | ||
256 | static struct opt_items demolmp[11]; | ||
257 | char addon[200]; | ||
258 | // This sets up the base game and builds up myargv/c | ||
259 | bool Dhandle_ver (int dver) | ||
260 | { | ||
261 | switch (dver) { | ||
262 | case 0: /* Doom Shareware */ | ||
263 | gamemode = shareware; | ||
264 | gamemission = doom; | ||
265 | D_AddFile(wads_builtin[0],source_iwad); | ||
266 | break; | ||
267 | case 1: /* Doom registered */ | ||
268 | gamemode = registered; | ||
269 | gamemission = doom; | ||
270 | D_AddFile(wads_builtin[1],source_iwad); | ||
271 | break; | ||
272 | case 2: /* Ultimate Doom */ | ||
273 | gamemode = retail; | ||
274 | gamemission = doom; | ||
275 | D_AddFile(wads_builtin[2],source_iwad); | ||
276 | break; | ||
277 | case 3: /* Doom2 */ | ||
278 | gamemode = commercial; | ||
279 | gamemission = doom2; | ||
280 | D_AddFile(wads_builtin[3],source_iwad); | ||
281 | break; | ||
282 | case 4: /* Doom2f */ | ||
283 | gamemode = commercial; | ||
284 | gamemission = doom2; | ||
285 | D_AddFile(wads_builtin[4],source_iwad); | ||
286 | break; | ||
287 | case 5: /* Plutonia */ | ||
288 | gamemode = commercial; | ||
289 | gamemission = pack_plut; | ||
290 | D_AddFile(wads_builtin[5],source_iwad); | ||
291 | break; | ||
292 | case 6: /* TNT */ | ||
293 | gamemode = commercial; | ||
294 | gamemission = pack_tnt; | ||
295 | D_AddFile(wads_builtin[6],source_iwad); | ||
296 | break; | ||
297 | default: | ||
298 | gamemission = none; | ||
299 | return 0; | ||
300 | } | ||
301 | // Start adding to myargv | ||
302 | if(argvlist.timedemo && (gamemode == shareware)) | ||
303 | { | ||
304 | singletics = true; | ||
305 | timingdemo = true; // show stats after quit | ||
306 | G_DeferedPlayDemo("demo3"); | ||
307 | singledemo = true; // quit after one demo | ||
308 | } | ||
309 | |||
310 | if(argvlist.addonnum) | ||
311 | { | ||
312 | snprintf(addon,sizeof(addon),"%s%s", GAMEBASE"addons/", addonfiles[argvlist.addonnum]); | ||
313 | D_AddFile(addon,source_pwad); | ||
314 | modifiedgame = true; | ||
315 | } | ||
316 | |||
317 | if(argvlist.demonum) | ||
318 | { | ||
319 | snprintf(addon, sizeof(addon),"%s%s", GAMEBASE"demos/", demolmp[argvlist.demonum].string); | ||
320 | D_AddFile(addon, source_lmp); | ||
321 | G_DeferedPlayDemo(addon); | ||
322 | singledemo = true; // quit after one demo | ||
323 | } | ||
324 | return 1; | ||
325 | } | ||
326 | |||
327 | // This function builds up the basegame list for use in the options selection | ||
328 | // it also sets the defaults for the argvlist | ||
329 | int Dbuild_base (struct opt_items *names) | ||
330 | { | ||
331 | if ( fileexists(GAMEBASE"prboom.wad") ) | ||
332 | return 0; | ||
333 | |||
334 | D_AddFile (GAMEBASE"prboom.wad", source_pwad); | ||
335 | |||
336 | int i=0; | ||
337 | /* Doom Shareware */ | ||
338 | if ( !fileexists (wads_builtin[0]) ) | ||
339 | { | ||
340 | names[i].string=versions_builtin[0]; | ||
341 | names[i].voice_id=0; | ||
342 | namemap[i]=0; | ||
343 | i++; | ||
344 | } | ||
345 | |||
346 | /* Doom registered */ | ||
347 | if ( !fileexists (wads_builtin[1]) ) | ||
348 | { | ||
349 | names[i].string=versions_builtin[1]; | ||
350 | names[i].voice_id=0; | ||
351 | namemap[i]=1; | ||
352 | i++; | ||
353 | } | ||
354 | |||
355 | /* Ultimate Doom */ | ||
356 | if ( !fileexists (wads_builtin[2]) ) | ||
357 | { | ||
358 | names[i].string=versions_builtin[2]; | ||
359 | names[i].voice_id=0; | ||
360 | namemap[i]=2; | ||
361 | i++; | ||
362 | } | ||
363 | |||
364 | /* Doom2 */ | ||
365 | if ( !fileexists (wads_builtin[3]) ) | ||
366 | { | ||
367 | names[i].string=versions_builtin[3]; | ||
368 | names[i].voice_id=0; | ||
369 | namemap[i]=3; | ||
370 | i++; | ||
371 | } | ||
372 | |||
373 | /* Doom2f */ | ||
374 | if ( !fileexists (wads_builtin[4]) ) | ||
375 | { | ||
376 | names[i].string=versions_builtin[4]; | ||
377 | names[i].voice_id=0; | ||
378 | namemap[i]=4; | ||
379 | i++; | ||
380 | } | ||
381 | |||
382 | /* Plutonia */ | ||
383 | if ( !fileexists (wads_builtin[5]) ) | ||
384 | { | ||
385 | names[i].string=versions_builtin[5]; | ||
386 | names[i].voice_id=0; | ||
387 | namemap[i]=5; | ||
388 | i++; | ||
389 | } | ||
390 | |||
391 | /* TNT */ | ||
392 | if ( !fileexists (wads_builtin[6]) ) | ||
393 | { | ||
394 | names[i].string=versions_builtin[6]; | ||
395 | names[i].voice_id=0; | ||
396 | namemap[i]=6; | ||
397 | i++; | ||
398 | } | ||
399 | // Set argvlist defaults | ||
400 | argvlist.timedemo=0; | ||
401 | |||
402 | return i; | ||
403 | } | ||
404 | |||
405 | int Dbuild_addons(struct opt_items *names) | ||
406 | { | ||
407 | int i=1; | ||
408 | |||
409 | DIR *addons; | ||
410 | struct dirent *dptr; | ||
411 | char *startpt; | ||
412 | |||
413 | startpt=malloc(strlen("No Addon")*sizeof(char)); // Add this on to allow for no addon to be played | ||
414 | strcpy(startpt,"No Addon"); | ||
415 | names[0].string=startpt; | ||
416 | names[0].voice_id=0; | ||
417 | |||
418 | addons=opendir(GAMEBASE"Addons/"); | ||
419 | if(addons==NULL) | ||
420 | return 1; | ||
421 | |||
422 | while((dptr=rb->readdir(addons)) && i<10) | ||
423 | { | ||
424 | if(rb->strcasestr(dptr->d_name, ".WAD")) | ||
425 | { | ||
426 | addonfiles[i]=malloc(strlen(dptr->d_name)*sizeof(char)); | ||
427 | strcpy(addonfiles[i],dptr->d_name); | ||
428 | names[i].string=addonfiles[i]; | ||
429 | names[i].voice_id=0; | ||
430 | i++; | ||
431 | } | ||
432 | } | ||
433 | closedir(addons); | ||
434 | return i; | ||
435 | } | ||
436 | |||
437 | |||
438 | int Dbuild_demos(struct opt_items *names) | ||
439 | { | ||
440 | int i=1; | ||
441 | |||
442 | DIR *demos; | ||
443 | struct dirent *dptr; | ||
444 | char *startpt; | ||
445 | |||
446 | startpt=malloc(strlen("No Demo")*sizeof(char)); // Add this on to allow for no demo to be played | ||
447 | strcpy(startpt,"No Demo"); | ||
448 | names[0].string=startpt; | ||
449 | names[0].voice_id=0; | ||
450 | |||
451 | demos=opendir(GAMEBASE"Demos/"); | ||
452 | if(demos==NULL) | ||
453 | return 1; | ||
454 | |||
455 | while((dptr=rb->readdir(demos)) && i<11) | ||
456 | { | ||
457 | if(rb->strcasestr(dptr->d_name, ".LMP")) | ||
458 | { | ||
459 | startpt=malloc(strlen(dptr->d_name)*sizeof(char)); | ||
460 | strcpy(startpt,dptr->d_name); | ||
461 | names[i].string=startpt; | ||
462 | names[i].voice_id=0; | ||
463 | i++; | ||
464 | } | ||
465 | } | ||
466 | closedir(demos); | ||
467 | return i; | ||
468 | } | ||
469 | |||
470 | void Oset_keys() | ||
471 | { | ||
472 | } | ||
473 | |||
474 | static const struct opt_items onoff[2] = { | ||
475 | { "Off", NULL }, | ||
476 | { "On", NULL }, | ||
477 | }; | ||
478 | |||
479 | static struct opt_items addons[10]; | ||
480 | |||
481 | extern int fake_contrast; | ||
482 | |||
483 | static bool Doptions() | ||
484 | { | ||
485 | int m, result; | ||
486 | int menuquit=0; | ||
487 | |||
488 | static const struct menu_item items[] = { | ||
489 | { "Sound", NULL }, | ||
490 | { "Set Keys(not working)", NULL }, | ||
491 | { "Timedemo", NULL }, | ||
492 | { "Player Bobbing", NULL }, | ||
493 | { "Weapon Recoil", NULL }, | ||
494 | { "Translucency", NULL }, | ||
495 | { "Fake Contrast", NULL }, | ||
496 | }; | ||
497 | |||
498 | m = rb->menu_init(items, sizeof(items) / sizeof(*items), | ||
499 | doom_menu_cb, NULL, NULL, NULL); | ||
500 | |||
501 | while(!menuquit) | ||
502 | { | ||
503 | result=rb->menu_show(m); | ||
504 | switch (result) | ||
505 | { | ||
506 | case 0: /* Sound */ | ||
507 | nosfxparm=!nosfxparm; // Have to invert it before setting | ||
508 | rb->set_option("Sound", &nosfxparm, INT, onoff, 2, NULL ); | ||
509 | break; | ||
510 | |||
511 | case 1: /* Keys */ | ||
512 | Oset_keys(); | ||
513 | break; | ||
514 | |||
515 | case 2: /* Timedemo */ | ||
516 | rb->set_option("Timedemo", &argvlist.timedemo, INT, onoff, 2, NULL ); | ||
517 | break; | ||
518 | |||
519 | case 3: /* Player Bobbing */ | ||
520 | rb->set_option("Player Bobbing", &default_player_bobbing, INT, onoff, 2, NULL ); | ||
521 | break; | ||
522 | |||
523 | case 4: /* Weapon Recoil */ | ||
524 | rb->set_option("Weapon Recoil", &default_weapon_recoil, INT, onoff, 2, NULL ); | ||
525 | break; | ||
526 | |||
527 | case 5: /* Translucency */ | ||
528 | rb->set_option("Translucency", &default_translucency, INT, onoff, 2, NULL ); | ||
529 | break; | ||
530 | |||
531 | case 6: /* Fake Contrast */ | ||
532 | rb->set_option("Fake Contrast", &fake_contrast, INT, onoff, 2, NULL ); | ||
533 | break; | ||
534 | |||
535 | default: | ||
536 | menuquit=1; | ||
537 | break; | ||
538 | } | ||
539 | } | ||
540 | |||
541 | rb->menu_exit(m); | ||
542 | |||
543 | return (1); | ||
544 | } | ||
545 | |||
546 | // | ||
547 | // Doom Menu | ||
548 | // | ||
549 | int doom_menu() | ||
550 | { | ||
551 | int m; | ||
552 | int result; | ||
553 | int status; | ||
554 | int gamever; | ||
555 | bool menuquit=0; | ||
556 | |||
557 | static struct opt_items names[7]; | ||
558 | |||
559 | static const struct menu_item items[] = { | ||
560 | { "Game", NULL }, | ||
561 | { "Addons", NULL }, | ||
562 | { "Demos", NULL }, | ||
563 | { "Options", NULL }, | ||
564 | { "Play Game", NULL }, | ||
565 | { "Quit", NULL }, | ||
566 | }; | ||
567 | |||
568 | if( (status=Dbuild_base(names)) == 0 ) // Build up the base wad files (select last added file) | ||
569 | { | ||
570 | rb->splash(HZ, true, "Sorry, you have no base wads"); | ||
571 | return -1; | ||
572 | } | ||
573 | |||
574 | int numadd=Dbuild_addons(addons); | ||
575 | |||
576 | int numdemos=Dbuild_demos(demolmp); | ||
577 | argvlist.demonum=0; | ||
578 | |||
579 | argvlist.addonnum=0; | ||
580 | |||
581 | gamever=status-1; | ||
582 | |||
583 | m = rb->menu_init(items, sizeof(items) / sizeof(*items), | ||
584 | doom_menu_cb, NULL, NULL, NULL); | ||
585 | |||
586 | while(!menuquit) | ||
587 | { | ||
588 | result=rb->menu_show(m); | ||
589 | switch (result) { | ||
590 | case 0: /* Game picker */ | ||
591 | rb->set_option("Base Game", &gamever, INT, names, status, NULL ); | ||
592 | break; | ||
593 | |||
594 | case 1: /* Addon picker */ | ||
595 | rb->set_option("Select Addon", &argvlist.addonnum, INT, addons, numadd, NULL ); | ||
596 | //Daddons(numadd); | ||
597 | break; | ||
598 | |||
599 | case 2: /* Demo's */ | ||
600 | rb->set_option("Demo's", &argvlist.demonum, INT, demolmp, numdemos, NULL ); | ||
601 | break; | ||
602 | |||
603 | case 3: /* Options */ | ||
604 | Doptions(); | ||
605 | break; | ||
606 | |||
607 | case 4: /* Play Game */ | ||
608 | menuquit=1; | ||
609 | break; | ||
610 | |||
611 | case 5: /* Quit */ | ||
612 | menuquit=1; | ||
613 | gamever=-1; | ||
614 | break; | ||
615 | |||
616 | default: | ||
617 | break; | ||
618 | } | ||
619 | } | ||
620 | |||
621 | rb->menu_exit(m); | ||
622 | |||
623 | return (gamever); | ||
624 | } | ||
625 | |||
626 | extern int systemvol; | ||
627 | /* this is the plugin entry point */ | ||
628 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | ||
629 | { | ||
630 | rb = api; | ||
631 | (void)parameter; | ||
632 | |||
633 | #if !defined(SIMULATOR) && defined(HAVE_ADJUSTABLE_CPU_FREQ) | ||
634 | rb->cpu_boost(true); | ||
635 | #endif | ||
636 | |||
637 | #ifdef USE_IRAM | ||
638 | memcpy(iramstart, iramcopy, iramend-iramstart); | ||
639 | memset(iedata, 0, iend - iedata); | ||
640 | #endif | ||
641 | |||
642 | rb->lcd_setfont(0); | ||
643 | |||
644 | #ifdef FANCY_MENU | ||
645 | if(rb->load_main_backdrop(GAMEBASE"backdrop.bmp")) | ||
646 | rb->lcd_set_foreground(LCD_RGBPACK(85,208,56)); | ||
647 | |||
648 | rb->lcd_clear_display(); | ||
649 | #endif | ||
650 | |||
651 | // We're using doom's memory management since it implements a proper free (and re-uses the memory) | ||
652 | // and now with prboom's code: realloc and calloc | ||
653 | printf ("Z_Init: Init zone memory allocation daemon. \n"); | ||
654 | Z_Init (); | ||
655 | |||
656 | printf ("M_LoadDefaults: Load system defaults.\n"); | ||
657 | M_LoadDefaults (); // load before initing other systems | ||
658 | |||
659 | #ifdef FANCY_MENU | ||
660 | rb->lcd_setfont(FONT_UI); | ||
661 | rb->lcd_putsxy(5,LCD_HEIGHT-20, "RockDoom v0.90"); | ||
662 | rb->lcd_update(); | ||
663 | rb->sleep(HZ*2); | ||
664 | rb->lcd_setfont(0); | ||
665 | #else | ||
666 | rb->splash(HZ*2, true, "RockDoom v0.90"); | ||
667 | #endif | ||
668 | |||
669 | myargv = malloc(sizeof(char *)*MAXARGVS); | ||
670 | memset(myargv,0,sizeof(char *)*MAXARGVS); | ||
671 | myargv[0]="doom.rock"; | ||
672 | myargc=1; | ||
673 | |||
674 | int result=doom_menu(); | ||
675 | |||
676 | if( result == -1) return PLUGIN_OK; // No base wads found or quit was selected | ||
677 | |||
678 | Dhandle_ver( namemap[ result ] ); | ||
679 | |||
680 | rb->lcd_setfont(0); | ||
681 | |||
682 | rb->lcd_clear_display(); | ||
683 | |||
684 | // systemvol= rb->global_settings->volume-rb->global_settings->volume%((rb->sound_max(SOUND_VOLUME)-rb->sound_min(SOUND_VOLUME))/15); | ||
685 | general_translucency = default_translucency; // phares | ||
686 | D_DoomMain (); | ||
687 | |||
688 | M_SaveDefaults (); | ||
689 | |||
690 | I_Quit(); // Make SURE everything was closed out right | ||
691 | |||
692 | printf("There were still: %d files open", fpoint); | ||
693 | while(fpoint>0) | ||
694 | { | ||
695 | rb->close(filearray[fpoint]); | ||
696 | fpoint--; | ||
697 | } | ||
698 | |||
699 | rb->splash(HZ, true, "Bye"); | ||
700 | |||
701 | #if !defined(SIMULATOR) && defined(HAVE_ADJUSTABLE_CPU_FREQ) | ||
702 | rb->cpu_boost(false); | ||
703 | #endif | ||
704 | |||
705 | return PLUGIN_OK; | ||
706 | } | ||