-
-
Notifications
You must be signed in to change notification settings - Fork 78
/
ending.cpp
797 lines (685 loc) · 17.8 KB
/
ending.cpp
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
184
185
186
187
188
189
190
191
192
193
194
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
#include <cstring>
#include <stdio.h>
#include "base/qrs.h"
#include "base/msgstr.h"
#include "zc/ending.h"
#include "zc/zelda.h"
#include "base/zsys.h"
#include "play_midi.h"
#include "sprite.h"
#include "items.h"
#include "pal.h"
#include "zc/hero.h"
#include "zc/guys.h"
#include "zc/title.h"
#include "subscr.h"
#include "init.h"
#include "gamedata.h"
#include "zc/ffscript.h"
#include "zc/saves.h"
#include "zinfo.h"
#include "base/misctypes.h"
extern FFScript FFCore;
extern ZModule zcm; //modules
extern zcmodule moduledata;
extern HeroClass Hero;
extern sprite_list guys, items, Ewpns, Lwpns, chainlinks, decorations;
namespace
{
const int32_t white = WHITE;
const int32_t red = CSET(csBOSS)+4;
const int32_t blue = CSET(csBOSS)+5;
const int32_t green = CSET(csBOSS)+6;
struct EndingTextLine
{
const char* text;
int32_t xPos, yPos; // yPos determines when this line appears
int32_t color;
};
const int32_t numCreditsLines = 12;
const EndingTextLine credits[]=
{
{ " STAFF ", 104, 240, white },
{ "EXECUTIVE", 40, 272, blue },
{ "PRODUCER... H.YAMAUCHI", 40, 280, blue },
{ "PRODUCER.... S.MIYAHON", 40, 320, green },
{ "DIRECTOR.... S.MIYAHON", 40, 360, red },
{ " ...... TEN TEN", 40, 384, red },
{ "DESIGNER...... TEN TEN", 40, 424, blue },
{ "PROGRAMMER.. T.NAKAZOO", 40, 464, green },
{ " ..... YACHAN", 40, 488, green },
{ " ... MARUMARU", 40, 512, green },
{ "SOUND", 40, 552, red },
{ "COMPOSER...... KONCHAN", 40, 560, red }
};
const int32_t numQuest1EndLines = 4;
const EndingTextLine quest1End[]=
{
{ "ANOTHER QUEST WILL START", 32, 656, white },
{ "FROM HERE.", 88, 672, white },
{ "PRESS THE START BUTTON.", 40, 696, white },
{ "\2731986 NINTENDO", 72, 760, white }
};
const int32_t numQuest2EndLines = 4;
const EndingTextLine quest2End[]=
{
{ "YOU ARE GREAT.", 72, 768, white },
/* name - deaths */
{ "YOU HAVE AN AMAZING", 48, 816, white },
{ "WISDOM AND POWER.", 64, 832, white },
{ "\2731986 NINTENDO", 72, 912, blue }
};
const int32_t numQuest34EndLines = 6;
const EndingTextLine quest34End[]=
{
{ "YOU ARE GREAT.", 72, 768, white },
/* name - deaths */
{ "YOU HAVE AN AMAZING", 48, 816, white },
{ "WISDOM AND POWER.", 64, 832, white },
{ "END OF", 104, 880, white },
{ "\"THE LEGEND OF ZELDA 1\"", 32, 896, white },
{ "\2731986 NINTENDO", 72, 912, blue }
};
const int32_t numCustomQuestEndLines = 6;
const EndingTextLine customQuestEnd[]=
{
{ "Congratulations!", 64, 768, white },
/* name - deaths */
/* time */
{ "You finished a", 72, 816, white },
{ "custom quest.", 76, 832, white },
{ "ZELDA CLASSIC", 76, 880, white },
{ "\2741999-2019", 88, 896, white },
{ "Armageddon Games", 64, 912, blue }
};
}
void noproc() {}
void put_triforce()
{
if(get_qr(qr_HOLDITEMANIMATION))
{
putitem2(framebuf,120,113-(get_qr(qr_NOITEMOFFSET)),iTriforce,lens_hint_item[iTriforce][0],lens_hint_item[iTriforce][1], 0);
putitem2(framebuf,136,113-(get_qr(qr_NOITEMOFFSET)),iTriforce,lens_hint_item[iTriforce][0],lens_hint_item[iTriforce][1], 0);
}
else
{
putitem(framebuf,120,113-(get_qr(qr_NOITEMOFFSET)),iTriforce);
putitem(framebuf,136,113-(get_qr(qr_NOITEMOFFSET)),iTriforce);
}
}
void putendmsg(const char *s,int32_t x,int32_t y,int32_t speed,void(proc)())
{
int32_t i=0;
int32_t c=(int32_t)strlen(s)*speed;
for(int32_t f=0; f<c && !Quit; f++)
{
if((f%speed)==0)
{
if(s[i]!=' ')
sfx(WAV_MSG);
textprintf_ex(framebuf,get_zc_font(font_zfont),x+(i<<3),y,WHITE,0,"%c",s[i]);
++i;
}
proc();
advanceframe(true);
}
}
void brick(int32_t x,int32_t y)
{
blit(scrollbuf,scrollbuf,256,0,x,y,8,8);
}
void endingpal()
{
byte pal[16*3] =
{
0, 0, 0, // clear
63,63,63, // white
31,31,31, // gray
0, 0, 0, // black
63,14, 0, // red
26,34,63, // blue
22,54,21 // green
};
byte *hold = colordata;
colordata = pal;
loadpalset(csBOSS,0);
colordata = hold;
refreshpal = true;
}
void ending()
{
/*
*************************
* WIN THE GAME SEQUENCE *
*************************
0 HERO at ZELDA's side
288 begin WIPE (8px per side per step, each 5 frames)
363 WIPE complete, DOT out, A/B items out
QMisc.colors.hero_dot = 255;
show_subscreen_items = false;
365 first MESSAGE character in
371 next character in
407 last character in
668 HERO out, ZELDA out
669 HERO in (TRIFORCE overhead), ZELDA in (TRIFORCE overhead)
733 BLUE flash bg
734 RED
735 GREEN
736 BLACK
...
860 BLACK, HERO out, ZELDA out
861 HERO in, ZELDA in
927 first MSG character in
935 next character in
1335 last character in
1461 HERO out, ZELDA out
1493 begin SCROLL
*/
//get rid off all sprites but Hero and Zelda
items.clear();
Ewpns.clear();
Lwpns.clear();
chainlinks.clear();
decorations.clear();
kill_subscr_items();
set_uformat(U_ASCII);
kill_sfx();
Quit=0;
draw_screen_clip_rect_x1=0;
draw_screen_clip_rect_x2=255;
draw_screen_clip_rect_y1=0;
draw_screen_clip_rect_y2=223;
for(int32_t f=0; f<365; f++)
{
script_drawing_commands.Clear();
if ( FFCore.doscript(ScriptType::Player) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 )
{
ZScriptVersion::RunScript(ScriptType::Player, SCRIPT_PLAYER_WIN);
--f; load_control_state(); goto adv;
}
if ( f == 0 ) { sfx(WAV_ZELDA); music_stop(); }
if(f==363)
{
//363 WIPE complete, DOT out, A/B items out
QMisc.colors.hero_dot = 255;
show_subscreen_items = false;
for(int32_t i = guys.Count() - 1; i >= 0; i--)
{
if(guys.spr(i)->id > gDUMMY9)
{
guys.del(i);
}
}
guys.draw(framebuf,true);
Hero.draw(framebuf);
}
if(f>=288 && ((f-288)%5 == 0))
{
//288 begin WIPE (8px per side per step, each 5 frames)
//TODO::
draw_screen_clip_rect_x1+=8;
draw_screen_clip_rect_x2-=8;
}
adv:
draw_screen(tmpscr);
advanceframe(true,true,false);
if(Quit) return;
}
clear_bitmap(msg_txt_display_buf);
clear_bitmap(msg_bg_display_buf);
draw_screen(tmpscr);
advanceframe(true);
const EndingTextLine* endText;
int32_t numEndTextLines=0;
int32_t deathsYPos=-1;
int32_t timeYPos=-1;
int32_t len=600*2;
int32_t creditsLine=0;
int32_t endTextLine=0;
if ( FFCore.skip_ending_credits ) goto credits_skip;
draw_screen_clip_rect_x1=0;
draw_screen_clip_rect_x2=255;
char tmpmsg[6][25];
for(int32_t x=0; x<3; x++)
{
sprintf(tmpmsg[x], "%.24s", MsgStrings[QMisc.endstring].s.c_str()+(24*x));
}
for(int32_t x=0; x<3; x++)
{
sprintf(tmpmsg[x+3], "%.24s", MsgStrings[QMisc.endstring+1].s.c_str()+(24*x));
}
if(QMisc.endstring==0)
{
putendmsg("THANKS HERO,YOU'RE",32,96,6,noproc);
putendmsg("THE HERO OF HYRULE.",32,112,6,noproc);
}
else
{
putendmsg(tmpmsg[0],32,80,6,noproc);
putendmsg(tmpmsg[1],32,96,6,noproc);
putendmsg(tmpmsg[2],32,112,6,noproc);
}
for(int32_t f=408; f<927; f++)
{
/*
668 HERO out, ZELDA out
669 HERO in (TRIFORCE overhead), ZELDA in (TRIFORCE overhead)
733 BLUE flash bg
734 RED
735 GREEN
736 BLACK
...
860 BLACK, HERO out, ZELDA out
861 HERO in, ZELDA in
*/
if(f==668)
{
rectfill(framebuf,120,127,152,145,0); //y1 == 129 was showing tiny bits left over from Hero's sprite.
blit(framebuf, tmp_bmp, 120,113, 0,0, 32,32);
}
if(f==860)
{
blit(tmp_bmp, framebuf, 0,0, 120,113, 32,32);
}
if(f==669 || f==861)
{
overtile16(framebuf,36,120,129,6,0);//draw Zelda two-handed overhead
overtile16(framebuf,BSZ?32:29,136,129,6,0);//draw Hero two-handed overhead
}
if(f==733)
{
blit(framebuf,scrollbuf,0,playing_field_offset!=0?168:0,0,0,256,passive_subscreen_height);
for(int32_t y=0; y<224; y++)
{
for(int32_t x=0; x<256; x++)
{
if(!(framebuf->line[y][x]&15))
{
framebuf->line[y][x]=16;
}
}
}
}
if(f>=733 && f<861)
{
static byte flash[4] = {0x12,0x16,0x2A,0x0F};
RAMpal[16] = NESpal(flash[(f-733)&3]);
refreshpal=true;
}
if(f==861)
{
blit(scrollbuf,framebuf,0,0,0,playing_field_offset!=0?168:0,256,passive_subscreen_height);
try_zcmusic("zelda.nsf", moduledata.ending_track, ZC_MIDI_ENDING);
for(int32_t y=0; y<224; y++)
{
for(int32_t x=0; x<256; x++)
{
if(framebuf->line[y][x]==16)
{
framebuf->line[y][x]=0;
}
}
}
}
if(f>668 && f!=860)
{
put_triforce();
}
advanceframe(true);
if(Quit)
{
return;
}
}
if(QMisc.endstring==0)
{
putendmsg("FINALLY,",96,160,8,put_triforce);
putendmsg("PEACE RETURNS TO HYRULE.",32,176,8,put_triforce);
putendmsg("THIS ENDS THE STORY.",48,200,8,put_triforce);
}
else
{
putendmsg(tmpmsg[3],32,160,6,noproc);
putendmsg(tmpmsg[4],32,176,6,noproc);
putendmsg(tmpmsg[5],32,200,6,noproc);
}
for(int32_t f=1336; f<1492; f++)
{
if(f<1461)
{
put_triforce();
}
if(f==1461)
{
blit(tmp_bmp,framebuf,0,0,120,113,32,32);
}
advanceframe(true);
if(Quit)
{
return;
}
}
clear_bitmap(scrollbuf);
blit(framebuf,scrollbuf,0,0,0,0,256,224);
endingpal();
// draw the brick
puttile16(scrollbuf,3,256,0,csBOSS,0);
if(game->get_quest()>1)
{
len=720*2;
}
switch(game->get_quest())
{
case 1:
endText=quest1End;
numEndTextLines=numQuest1EndLines;
break;
case 2:
endText=quest2End;
numEndTextLines=numQuest2EndLines;
deathsYPos=792;
break;
case 3:
case 4:
endText=quest34End;
numEndTextLines=numQuest34EndLines;
deathsYPos=792;
break;
default:
endText=customQuestEnd;
numEndTextLines=numCustomQuestEndLines;
deathsYPos=784;
timeYPos=800;
break;
}
for(int32_t f=0; f<len; f++)
{
if(!(f&15))
{
int32_t y=(f>>1)+224;
if(y>240 && y<584)
{
brick(24,224);
brick(224,224);
}
if(y==240 || y==584)
{
for(int32_t x=24; x<=224; x+=8)
{
brick(x,224);
}
}
if(creditsLine<numCreditsLines)
{
if(y==credits[creditsLine].yPos)
{
textout_ex(scrollbuf,
get_zc_font(font_zfont),
credits[creditsLine].text,
credits[creditsLine].xPos,
224,
credits[creditsLine].color,
0);
creditsLine++;
}
}
else
{
if(endTextLine<numEndTextLines &&
y==endText[endTextLine].yPos)
{
textout_ex(scrollbuf,
get_zc_font(font_zfont),
endText[endTextLine].text,
endText[endTextLine].xPos,
224,
endText[endTextLine].color,
0);
endTextLine++;
}
else if(y==deathsYPos)
textprintf_ex(scrollbuf, get_zc_font(font_zfont), 72, 224, red, 0,
"%-8s -%3d", game->get_name(), game->get_deaths());
else if(y==timeYPos)
{
if(game->get_timevalid() && !game->did_cheat())
textout_centre_ex(scrollbuf, get_zc_font(font_zfont), time_str_med(game->get_time()), 128, 224, blue, 0);
}
}
}
if(f==112) // after subscreen has scrolled away
{
init_NES_mode();
loadpalset(9,pSprite(spPILE));
endingpal();
}
if(f&1)
{
blit(scrollbuf,scrollbuf,0,1,0,0,256,232);
}
blit(scrollbuf,framebuf,0,0,0,0,256,224);
advanceframe(true);
if(Quit)
{
return;
}
load_control_state();
getInput(btnS, true, false, true);//rSbtn();
}
do
{
if(frame&1)
{
overtile16(framebuf,176,120,129,9,0);
}
overtile16(framebuf,175,120,129,((frame&8)>>3)+7,0);
if(!(frame&1))
{
overtile16(framebuf,176,120,129,9,0);
}
advanceframe(true);
if(Quit)
{
return;
}
load_control_state();
}
while(!getInput(btnS, true, false, true)); //rSbtn()
advanceframe(true);
credits_skip:
if(game->get_quest()>0 && game->get_quest()<=9)
{
inc_quest();
removeItemsOfFamily(game, itemsbuf, itype_ring);
int32_t maxring = getHighestLevelOfFamily(&zinit,itemsbuf,itype_ring);
if(maxring != -1)
{
getitem(maxring,true);
}
ringcolor(false);
}
zc_stop_midi();
if (get_qr(qr_OLD_SCRIPT_VOLUME))
{
//restore user volume if it was changed by script
if (FFCore.coreflags & FFCORE_SCRIPTED_MIDI_VOLUME)
{
Z_scripterrlog("Trying to restore master MIDI volume to: %d\n", FFCore.usr_midi_volume);
midi_volume = FFCore.usr_midi_volume;
// master_volume(-1,FFCore.usr_midi_volume);
}
if (FFCore.coreflags & FFCORE_SCRIPTED_DIGI_VOLUME)
{
digi_volume = FFCore.usr_digi_volume;
//master_volume((int32_t)(FFCore.usr_digi_volume),1);
}
if (FFCore.coreflags & FFCORE_SCRIPTED_MUSIC_VOLUME)
{
emusic_volume = (int32_t)FFCore.usr_music_volume;
}
if (FFCore.coreflags & FFCORE_SCRIPTED_SFX_VOLUME)
{
sfx_volume = (int32_t)FFCore.usr_sfx_volume;
}
}
if (FFCore.coreflags & FFCORE_SCRIPTED_PANSTYLE)
{
pan_style = (int32_t)FFCore.usr_panstyle;
}
if(zcmusic != NULL)
{
zcmusic_stop(zcmusic);
zcmusic_unload_file(zcmusic);
zcmusic = NULL;
zcmixer->newtrack = NULL;
}
FFCore.skip_ending_credits = 0;
// setPackfilePassword(datapwd);
load_quest(game);
// setPackfilePassword(NULL);
game->save_user_objects();
game->set_continue_dmap(zinit.start_dmap);
game->set_continue_scrn(0xFF);
game->set_cont_hearts(zinit.cont_heart);
saves_write();
if (replay_get_mode() == ReplayMode::Record) replay_save();
}
void ending_scripted()
{
items.clear();
Ewpns.clear();
Lwpns.clear();
guys.clear();
chainlinks.clear();
decorations.clear();
kill_subscr_items();
clear_bitmap(msg_txt_display_buf);
clear_bitmap(msg_bg_display_buf);
dismissmsg();
ALLOFF(true, true);
//music_stop();
kill_sfx();
//sfx(WAV_ZELDA);
Quit=0;
draw_screen_clip_rect_x1=0;
draw_screen_clip_rect_x2=255;
draw_screen_clip_rect_y1=0;
draw_screen_clip_rect_y2=223;
for(int32_t f=0; f<77; f++)
{
if(f>=0 && ((f-0)%5 == 0))
{
draw_screen_clip_rect_x1+=8;
draw_screen_clip_rect_x2-=8;
}
draw_screen(tmpscr);
advanceframe(true);
if(Quit) return;
}
clear_bitmap(msg_txt_display_buf);
clear_bitmap(msg_bg_display_buf);
draw_screen(tmpscr);
advanceframe(true);
draw_screen_clip_rect_x1=0;
draw_screen_clip_rect_x2=255;
clear_bitmap(scrollbuf);
blit(framebuf,scrollbuf,0,0,0,0,256,224);
endingpal();
inc_quest();
removeItemsOfFamily(game, itemsbuf, itype_ring);
int32_t maxring = getHighestLevelOfFamily(&zinit,itemsbuf,itype_ring);
if(maxring != -1)
{
getitem(maxring,true);
}
ringcolor(false);
zc_stop_midi();
if (get_qr(qr_OLD_SCRIPT_VOLUME))
{
//restore user volume if it was changed by script
if (FFCore.coreflags & FFCORE_SCRIPTED_MIDI_VOLUME)
{
Z_scripterrlog("Trying to restore master MIDI volume to: %d\n", FFCore.usr_midi_volume);
midi_volume = FFCore.usr_midi_volume;
// master_volume(-1,FFCore.usr_midi_volume);
}
if (FFCore.coreflags & FFCORE_SCRIPTED_DIGI_VOLUME)
{
digi_volume = FFCore.usr_digi_volume;
//master_volume((int32_t)(FFCore.usr_digi_volume),1);
}
if (FFCore.coreflags & FFCORE_SCRIPTED_MUSIC_VOLUME)
{
emusic_volume = (int32_t)FFCore.usr_music_volume;
}
if (FFCore.coreflags & FFCORE_SCRIPTED_SFX_VOLUME)
{
sfx_volume = (int32_t)FFCore.usr_sfx_volume;
}
}
if ( FFCore.coreflags&FFCORE_SCRIPTED_PANSTYLE )
{
pan_style = (int32_t)FFCore.usr_panstyle;
}
if(zcmusic != NULL)
{
zcmusic_stop(zcmusic);
zcmusic_unload_file(zcmusic);
zcmusic = NULL;
zcmixer->newtrack = NULL;
}
FFCore.skip_ending_credits = 0;
// setPackfilePassword(datapwd);
load_quest(game);
game->header.title = QHeader.title;
// setPackfilePassword(NULL);
game->save_user_objects();
game->set_continue_dmap(zinit.start_dmap);
game->set_continue_scrn(0xFF);
game->set_cont_hearts(zinit.cont_heart);
game->set_hasplayed(false);
saves_write();
if (replay_get_mode() == ReplayMode::Record) replay_save();
}
void inc_quest()
{
char name[9];
strcpy(name,game->get_name());
// Go to quest 3 if you got some heart containers,
// or quest 4 if you got them all.
int32_t quest = game->get_quest(); //Don't leave uninitialised.
int32_t deaths = game->get_deaths();
if ( moduledata.old_quest_serial_flow || game->get_quest() >= 5 )
{
if(game->get_quest()==2 && game->get_maxlife()>=game->get_hp_per_heart()*16)
quest = zc_min(4,moduledata.max_quest_files);// 4;
else
quest = zc_min(game->get_quest()+1,moduledata.max_quest_files);
if(game->get_quest()==3 && game->get_maxlife()>=game->get_hp_per_heart()*16)
quest = zc_min(4,moduledata.max_quest_files);// 4;
// If you beat the 3rd quest without dying skip over the easier 4th and play the 5th quest.
if(game->get_quest()==3 && deaths == 0)
quest = zc_min(5,moduledata.max_quest_files);// 4;
// //I can't find a better solution. If we reach five with wacky progression, just move on. -Z
if(game->get_quest()==5 && deaths > 0)
quest = zc_min(game->get_quest()+1,moduledata.max_quest_files);// 4;
}
else
{
quest = zc_min(game->get_quest()+1,moduledata.max_quest_files);
}
game->Clear();
game->set_name(name);
game->set_quest(quest);
game->header.qstpath.clear();
game->set_deaths(deaths);
game->set_maxlife(3*game->get_hp_per_heart());
game->set_life(3*game->get_hp_per_heart());
game->set_maxbombs(8);
game->set_hasplayed(true);
//now bound to modules
game->set_continue_dmap(moduledata.startingdmap[quest-1]);
game->set_continue_scrn(moduledata.startingscreen[quest-1]);
resetItems(game,&zinit,true);
load_quest(game);
}