From bb303c6469ea8770a969c1e604948cd851fdfbb9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 1 Jul 2020 20:31:29 +0200 Subject: [PATCH] - cleaned up the rest of the summary screen code, particularly the totally redundant second variant for RRRA. --- source/core/mapinfo.h | 6 +- source/games/duke/src/2d_d.cpp | 146 ++++-- source/games/duke/src/2d_r.cpp | 719 +++------------------------ source/games/duke/src/game.h | 2 - source/games/duke/src/game_main.cpp | 1 - source/games/duke/src/gamedef.cpp | 2 + source/games/duke/src/global.h | 4 +- source/games/duke/src/names_rr.h | 1 + source/games/duke/src/player.h | 2 +- source/games/duke/src/screens.h | 1 - source/games/duke/src/zz_demo.cpp | 4 +- source/games/duke/src/zz_game.cpp | 14 +- source/games/duke/src/zz_premap.cpp | 11 +- source/games/duke/src/zz_screens.cpp | 645 +----------------------- 14 files changed, 194 insertions(+), 1364 deletions(-) diff --git a/source/core/mapinfo.h b/source/core/mapinfo.h index 7b2dea3ff..cbeab6f73 100644 --- a/source/core/mapinfo.h +++ b/source/core/mapinfo.h @@ -22,14 +22,15 @@ enum struct MapRecord { - int parTime = -1; - int designerTime = -1; + int parTime = 0; + int designerTime = 0; FString fileName; FString labelName; FString name; FString music; int cdSongId = -1; int flags = 0; + int levelNumber = -1; // The rest is only used by Blood int nextLevel = -1; @@ -109,6 +110,7 @@ inline void InitRREndMap() // RR defines its end map ad-hoc so give it a proper entry to reference (the last one in episode 2 because it needs to be in Ep. 2.) mapList[127].SetName("$TXT_CLOSEENCOUNTERS"); mapList[127].SetFileName("endgame.map"); + mapList[127].levelNumber = 163; // last one in Ep. 2. } enum diff --git a/source/games/duke/src/2d_d.cpp b/source/games/duke/src/2d_d.cpp index 642427686..0b99fb822 100644 --- a/source/games/duke/src/2d_d.cpp +++ b/source/games/duke/src/2d_d.cpp @@ -538,7 +538,7 @@ public: // //--------------------------------------------------------------------------- -void bonussequence_d(int num, CompletionFunc completion) +static void bonussequence_d(int num, JobDesc *jobs, int &job) { static const AnimSound cineov2sound[] = { @@ -591,41 +591,11 @@ void bonussequence_d(int num, CompletionFunc completion) { -1,-1 } }; - static const AnimSound vol42a[] = - { - { 1, INTRO4_B +1 }, - { 12, SHORT_CIRCUIT + 1 }, - { 18, INTRO4_5 + 1 }, - { 34, SHORT_CIRCUIT+1 }, - { -1,-1 } - }; - - static const AnimSound vol41a[] = - { - { 1, INTRO4_1+1 }, - { 7, INTRO4_3+1 }, - { 12, INTRO4_2+1 }, - { 26, INTRO4_4+1 }, - { -1,-1 } - }; - - static const AnimSound vol43a[] = - { - { 10, INTRO4_6+1 }, - { -1,-1 } - }; - static const int framespeed_10[] = { 10, 10, 10 }; static const int framespeed_14[] = { 14, 14, 14 }; static const int framespeed_18[] = { 18, 18, 18 }; - Mus_Stop(); - FX_StopAllSounds(); - - JobDesc jobs[10]; - int job = 0; - switch (num) { case 0: @@ -635,14 +605,14 @@ void bonussequence_d(int num, CompletionFunc completion) case 1: jobs[job++] = { PlayVideo("cineov2.anm", cineov2sound, framespeed_18), []() { S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI); } }; - jobs[job++] = { Create(E2ENDSCREEN), nullptr }; + jobs[job++] = { Create(E2ENDSCREEN), []() { FX_StopAllSounds(); } }; break; case 2: jobs[job++] = { PlayVideo("cineov3.anm", cineov3sound, framespeed_10), nullptr }; jobs[job++] = { Create(200), []() { FX_StopAllSounds(); } }; jobs[job++] = { Create(), []() { if (!PLUTOPAK) S_PlaySound(ENDSEQVOL3SND4, CHAN_AUTO, CHANF_UI); } }; - if (!PLUTOPAK) jobs[job++] = { Create(TexMan.GetGameTextureByName("DUKETEAM.ANM", false, FTextureManager::TEXMAN_ForceLookup)) }; + if (!PLUTOPAK) jobs[job++] = { Create(TexMan.GetGameTextureByName("DUKETEAM.ANM", false, FTextureManager::TEXMAN_ForceLookup)), []() { FX_StopAllSounds(); } }; break; case 3: @@ -656,15 +626,7 @@ void bonussequence_d(int num, CompletionFunc completion) case 4: jobs[job++] = { Create(), []() { FX_StopAllSounds(); } }; break; - - case 5: // Episode 4 start - S_PlaySpecialMusic(MUS_BRIEFING); - jobs[job++] = { PlayVideo("vol41a.anm", vol41a, framespeed_10), nullptr }; - jobs[job++] = { PlayVideo("vol42a.anm", vol42a, framespeed_14), nullptr }; - jobs[job++] = { PlayVideo("vol43a.anm", vol43a, framespeed_10), nullptr }; - break; } - RunScreenJob(jobs, job, completion); } //--------------------------------------------------------------------------- @@ -714,6 +676,7 @@ public: DDukeMultiplayerBonusScreen(int pws) : DScreenJob(fadein|fadeout) { playerswhenstarted = pws; + PlayBonusMusic(); } int Frame(uint64_t clock, bool skiprequest) @@ -797,13 +760,6 @@ public: } }; -void ShowMPBonusScreen_d(int pws, CompletionFunc completion) -{ - PlayBonusMusic(); - JobDesc job = { Create(pws) }; - RunScreenJob(&job, 1, completion); -} - //--------------------------------------------------------------------------- // // @@ -1000,18 +956,92 @@ public: }; -void ShowBonusScreen_d(CompletionFunc completion) +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void dobonus_d(bool bonusonly, CompletionFunc completion) { - PlayBonusMusic(); - JobDesc job = { Create() }; - RunScreenJob(&job, 1, completion); + JobDesc jobs[20]; + int job = 0; + + FX_StopAllSounds(); + Mus_Stop(); + + if (!bonusonly && numplayers < 2 && ud.eog && ud.from_bonus == 0) + { + bonussequence_d(ud.volume_number, jobs, job); + } + + if (playerswhenstarted > 1 && ud.coop != 1) + { + jobs[job++] = { Create(playerswhenstarted) }; + } + else if (!bonusonly && ud.multimode <= 1) + { + jobs[job++] = { Create() }; + } + if (job) + RunScreenJob(jobs, job, completion); + else if (completion) completion(false); +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void e4intro(CompletionFunc completion) +{ + JobDesc jobs[5]; + int job = 0; + + static const AnimSound vol42a[] = + { + { 1, INTRO4_B + 1 }, + { 12, SHORT_CIRCUIT + 1 }, + { 18, INTRO4_5 + 1 }, + { 34, SHORT_CIRCUIT + 1 }, + { -1,-1 } + }; + + static const AnimSound vol41a[] = + { + { 1, INTRO4_1 + 1 }, + { 7, INTRO4_3 + 1 }, + { 12, INTRO4_2 + 1 }, + { 26, INTRO4_4 + 1 }, + { -1,-1 } + }; + + static const AnimSound vol43a[] = + { + { 10, INTRO4_6 + 1 }, + { -1,-1 } + }; + + static const int framespeed_10[] = { 10, 10, 10 }; + static const int framespeed_14[] = { 14, 14, 14 }; + + S_PlaySpecialMusic(MUS_BRIEFING); + jobs[job++] = { PlayVideo("vol41a.anm", vol41a, framespeed_10), nullptr }; + jobs[job++] = { PlayVideo("vol42a.anm", vol42a, framespeed_14), nullptr }; + jobs[job++] = { PlayVideo("vol43a.anm", vol43a, framespeed_10), nullptr }; + RunScreenJob(jobs, job, completion); } // Utility for testing the above screens CCMD(testscreen) { + JobDesc jobs[10]; + int job = 0; C_HideConsole(); + FX_StopAllSounds(); + Mus_Stop(); if (argv.argc() > 1) { int screen = strtol(argv[1], nullptr, 0); @@ -1022,12 +1052,17 @@ CCMD(testscreen) case 2: case 3: case 4: + bonussequence_d(screen, jobs, job); + RunScreenJob(jobs, job, nullptr); + break; + case 5: - bonussequence_d(screen, nullptr); + e4intro(nullptr); break; case 6: - ShowMPBonusScreen_d(6, nullptr); + jobs[job++] = { Create(6) }; + RunScreenJob(jobs, job, nullptr); break; case 7: @@ -1039,7 +1074,8 @@ CCMD(testscreen) break; case 9: - ShowBonusScreen_d(nullptr); + jobs[job++] = { Create() }; + RunScreenJob(jobs, job, nullptr); break; } } diff --git a/source/games/duke/src/2d_r.cpp b/source/games/duke/src/2d_r.cpp index 388001d1a..25e702d41 100644 --- a/source/games/duke/src/2d_r.cpp +++ b/source/games/duke/src/2d_r.cpp @@ -210,7 +210,7 @@ void Logo_r(CompletionFunc completion) // //--------------------------------------------------------------------------- -void bonussequence_r(int num, CompletionFunc completion) +static void bonussequence_r(int num, JobDesc* jobs, int& job) { static const AnimSound turdmov[] = { @@ -229,9 +229,6 @@ void bonussequence_r(int num, CompletionFunc completion) Mus_Stop(); FX_StopAllSounds(); - JobDesc jobs[2]; - int job = 0; - switch (num) { case 0: @@ -247,29 +244,6 @@ void bonussequence_r(int num, CompletionFunc completion) default: break; } - RunScreenJob(jobs, job, completion); -} - -//--------------------------------------------------------------------------- -// -// RRRA only -// -//--------------------------------------------------------------------------- - -void PlayMapAnim(int volnum, int mapnum, CompletionFunc completion) -{ - char fn[20]; - - int lev = mapnum + 7 * volnum; - if (lev >= 1 && lev <= 13) - { - mysnprintf(fn, 20, "lvl%d.anm", lev); - - static const int framespeed[] = { 20, 20, 7200 }; // wait for one minute on the final frame - JobDesc job = { PlayVideo(fn, nullptr, framespeed) }; - RunScreenJob(&job, 1, completion); - } - else if (completion) completion(false); } //--------------------------------------------------------------------------- @@ -370,14 +344,6 @@ public: } }; -void ShowMPBonusScreen_r(int pws, CompletionFunc completion) -{ - PlayBonusMusic(); - JobDesc job = { Create(pws) }; - RunScreenJob(&job, 1, completion); -} - - //--------------------------------------------------------------------------- // // @@ -396,16 +362,16 @@ class DRRLevelSummaryScreen : public DScreenJob } public: - DRRLevelSummaryScreen() : DScreenJob(fadein | fadeout) + DRRLevelSummaryScreen(bool dofadein = true) : DScreenJob(dofadein? (fadein | fadeout) : fadeout) { - gfx_offset = (ud.volume_number == 0) ? RRTILE403 : RRTILE409; - gfx_offset += ud.level_number - 1; - - if (g_lastLevel || g_vixenLevel) - gfx_offset = RRTILE409 + 7; - + PlayBonusMusic(); if (boardfilename[0]) gfx_offset = RRTILE403; + else if (!isRRRA()) + gfx_offset = RRTILE403 + clamp((currentLevel->levelNumber / 100) * 7 + (currentLevel->levelNumber % 100), 0, 13); + else + gfx_offset = LEVELMAP + clamp((currentLevel->levelNumber / 100) * 7 + (currentLevel->levelNumber % 100), 0, 13); + if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0]) // todo: get rid of this awful hack. { @@ -565,624 +531,82 @@ public: }; -void ShowBonusScreen_r(CompletionFunc completion) +class DRRRAEndOfGame : public DScreenJob { - PlayBonusMusic(); +public: + DRRRAEndOfGame() : DScreenJob(fadein|fadeout) + { + S_PlaySound(35, CHAN_AUTO, CHANF_UI); + } + int Frame(uint64_t clock, bool skiprequest) + { + int totalclock = int(clock * 120 / 1'000'000'000); + auto tex = tileGetTexture(RRTILE8677 + ((totalclock >> 4) & 1)); + DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, 3, TAG_DONE); + if (!S_CheckSoundPlaying(-1, 35) && totalclock > 15*120) return 0; // make sure it stays, even if sound is off. + if (skiprequest) + { + S_StopSound(35); + return -1; + } + return 1; + } +}; -} +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- - - -#if 0 - -#ifdef RRRA -void dobonus2(char bonusonly) +void dobonus_r(bool bonusonly, CompletionFunc completion) { - short t, r, tinc,gfx_offset,bg_tile; - long i, y,xfragtotal,yfragtotal,var24; - short bonuscnt; - - var24 = 0; - bonuscnt = 0; - - for(t=0;t<64;t++) palto(0,0,0,t); - setview(0,0,xdim-1,ydim-1); - clearview(0L); - nextpage(); - flushperms(); + JobDesc jobs[20]; + int job = 0; FX_StopAllSounds(); - clearsoundlocks(); - FX_SetReverb(0L); + Mus_Stop(); - if (boardfilename[0] == 0 && numplayers < 2) + if (!bonusonly && !isRRRA() && numplayers < 2 && ud.eog && ud.from_bonus == 0) { - if ((ud.eog == 0 || ud.volume_number != 1) && ud.volume_number <= 1) - { - var24 = 1; - MUSIC_StopSong(); - KB_FlushKeyboardQueue(); - ShowMapFrame(); - } + bonussequence_r(ud.volume_number, jobs, job); } - if(bonusonly) goto FRAGBONUS; - - FRAGBONUS: - - ps[myconnectindex].palette = palette; - KB_FlushKeyboardQueue(); - totalclock = 0; tinc = 0; - bonuscnt = 0; - - MUSIC_StopSong(); - - if(bonusonly || ud.multimode > 1) return; - - if (ud.eog) + if (playerswhenstarted > 1 && ud.coop != 1) { - for (t = 0; t < 64; t++) palto(0, 0, 0, t); - clearview(0); - nextpage(); - spritesound(35,ps[0].i); - palto(0, 0, 0, 0); - ps[myconnectindex].palette = palette; - while (1) + jobs[job++] = { Create(playerswhenstarted) }; + } + else if (!bonusonly && ud.multimode <= 1) + { + jobs[job++] = { Create() }; + if (isRRRA() && !boardfilename[0] && currentLevel->levelNumber < 106) // fixme: The logic here is awful. Shift more control to the map records. { - int var40; - switch ((totalclock >> 4) & 1) + int levnum = clamp((currentLevel->levelNumber / 100) * 7 + (currentLevel->levelNumber % 100), 0, 13); + char fn[20]; + mysnprintf(fn, 20, "lvl%d.anm", levnum + 1); + static const int framespeed[] = { 20, 20, 7200 }; // wait for one minute on the final frame so that the video doesn't appear before the user notices. + jobs[job++] = { PlayVideo(fn, nullptr, framespeed) }; + if (ud.eog && currentLevel->levelNumber > 100) { - case 0: - rotatesprite(0,0,65536,0,0,RRTILE8677,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - nextpage(); - palto(0, 0, 0, 0); - ps[myconnectindex].palette = palette; - getpackets(); - break; - case 1: - rotatesprite(0,0,65536,0,0,RRTILE8677+1,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - nextpage(); - palto(0, 0, 0, 0); - ps[myconnectindex].palette = palette; - getpackets(); - break; + jobs[job++] = { Create() }; } - if (Sound[35].num == 0) break; } + } - if (word_119BE4) - { - word_119BE4 = 0; - ud.m_volume_number = ud.volume_number = 1; - ud.m_level_number = ud.level_number = 0; - ud.eog = 0; - } - if (turdlevel) - turdlevel = 0; - if (vixenlevel) - vixenlevel = 0; + if (job) + RunScreenJob(jobs, job, completion); + else if (completion) completion(false); } -#else -void dobonus(char bonusonly) -{ - short t, r, tinc,gfx_offset; - long i, y,xfragtotal,yfragtotal; - short bonuscnt; - short bg_tile; - - bonuscnt = 0; - - for(t=0;t<64;t++) palto(0,0,0,t); - setview(0,0,xdim-1,ydim-1); - clearview(0L); - nextpage(); - flushperms(); - - FX_StopAllSounds(); - clearsoundlocks(); - FX_SetReverb(0L); - - if(bonusonly) goto FRAGBONUS; - - if(numplayers < 2 && ud.eog && ud.from_bonus == 0) - switch(ud.volume_number) - { - case 0: - MUSIC_StopSong(); - clearview(0L); - nextpage(); - if(ud.lockout == 0) - { - playanm("turdmov.anm",5,5); - KB_FlushKeyboardQueue(); - clearview(0L); - nextpage(); - } - ud.level_number = 0; - ud.volume_number = 1; - ud.eog = 0; - - for(t=0;t<64;t++) palto(0,0,0,t); - - KB_FlushKeyboardQueue(); - ps[myconnectindex].palette = palette; - - rotatesprite(0,0,65536L,0,1685,0,0,2+8+16+64,0,0,xdim-1,ydim-1); - nextpage(); for(t=63;t>0;t--) palto(0,0,0,t); - while( !KB_KeyWaiting() ) getpackets(); - for(t=0;t<64;t++) palto(0,0,0,t); - MUSIC_StopSong(); - FX_StopAllSounds(); - clearsoundlocks(); - break; - case 1: - MUSIC_StopSong(); - clearview(0L); - nextpage(); - - if(ud.lockout == 0) - { - playanm("rr_outro.anm",5,4); - KB_FlushKeyboardQueue(); - clearview(0L); - nextpage(); - } - lastlevel = 0; - vixenlevel = 1; - ud.level_number = 0; - ud.volume_number = 0; - - for(t=0;t<64;t++) palto(0,0,0,t); - setview(0,0,xdim-1,ydim-1); - KB_FlushKeyboardQueue(); - ps[myconnectindex].palette = palette; - rotatesprite(0,0,65536L,0,1685,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); - nextpage(); for(t=63;t>0;t--) palto(0,0,0,t); - while( !KB_KeyWaiting() ) getpackets(); - for(t=0;t<64;t++) palto(0,0,0,t); - - break; - - case 2: - KB_FlushKeyboardQueue(); - while( !KB_KeyWaiting() ) getpackets(); - - FX_StopAllSounds(); - clearsoundlocks(); - KB_FlushKeyboardQueue(); - - clearview(0L); - nextpage(); - playanm("LNRDTEAM.ANM",4,3); - KB_FlushKeyboardQueue(); - - while( !KB_KeyWaiting() ) getpackets(); - - FX_StopAllSounds(); - clearsoundlocks(); - - KB_FlushKeyboardQueue(); - - break; - } - - FRAGBONUS: - - ps[myconnectindex].palette = palette; - KB_FlushKeyboardQueue(); - totalclock = 0; tinc = 0; - bonuscnt = 0; - - MUSIC_StopSong(); - FX_StopAllSounds(); - clearsoundlocks(); - - if(playerswhenstarted > 1 && ud.coop != 1 ) - { - if(!(MusicToggle == 0 || MusicDevice == NumSoundCards)) - sound(249); - - rotatesprite(0,0,65536L,0,MENUSCREEN,16,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - rotatesprite(160<<16,24<<16,23592L,0,INGAMEDUKETHREEDEE,0,0,2+8,0,0,xdim-1,ydim-1); - gametext(160,58,"MULTIPLAYER TOTALS",0); - gametext(160,58+10,level_names[(ud.volume_number*7)+ud.last_level-1],0); - - gametext(160,175,"PRESS ANY KEY TO CONTINUE",0); - - - t = 0; - minitext(23,80," NAME KILLS",8,2+8+16+128); - for(i=0;i 1) return; - - for(t=0;t<64;t++) palto(0,0,0,t); - } - - if(bonusonly || ud.multimode > 1) return; - - if(!(MusicToggle == 0 || MusicDevice == NumSoundCards)) - sound(249); - - - gfx_offset = (ud.volume_number&1)*5; - bg_tile = RRTILE403; - if (ud.volume_number == 0) - bg_tile = ud.level_number+RRTILE403-1; - else - bg_tile = ud.level_number+RRTILE409-1; - - if (lastlevel || vixenlevel) - bg_tile = RRTILE409+7; - - if (boardfilename[0]) - { - rotatesprite(0,0,65536L,0,403,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - endlvlmenutext(80,16,0,0,boardfilename); - } - else - { - rotatesprite(0,0,65536L,0,bg_tile,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - if ((lastlevel && ud.volume_number == 2) || vixenlevel) - endlvlmenutext(80,16,0,0,"CLOSE ENCOUNTERS"); - else if (turdlevel) - endlvlmenutext(80,16,0,0,"SMELTING PLANT"); - else - endlvlmenutext(80,16,0,0,level_names[(ud.volume_number*7)+ud.last_level-1]); - } - - endlvlmenutext(15,192,0,0,"PRESS ANY KEY TO CONTINUE"); - nextpage(); - KB_FlushKeyboardQueue(); - for(t=0;t<64;t++) palto(0,0,0,63-t); - bonuscnt = 0; - totalclock = 0; tinc = 0; - - while( 1 ) - { - if(ps[myconnectindex].gm&MODE_EOL) - { - if (boardfilename[0]) - rotatesprite(0,0,65536L,0,403,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - else - rotatesprite(0,0,65536L,0,bg_tile,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - - if( totalclock > (1000000000L) && totalclock < (1000000320L) ) - { - switch( ((unsigned long)totalclock>>4)%15 ) - { - case 0: - if(bonuscnt == 6) - { - bonuscnt++; - sound(425); - switch(rand()&3) - { - case 0: - sound(195); - break; - case 1: - sound(196); - break; - case 2: - sound(197); - break; - case 3: - sound(199); - break; - } - } - case 1: - case 4: - case 5: - case 2: - case 3: - break; - } - } - else if( totalclock > (10240+120L) ) break; - else - { - switch( (totalclock>>5)&3 ) - { - case 1: - case 3: - break; - case 2: - break; - } - } - - if (boardfilename[0]) - { - rotatesprite(0,0,65536L,0,403,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - endlvlmenutext(80,16,0,0,boardfilename); - } - else - { - rotatesprite(0,0,65536L,0,bg_tile,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - if ((lastlevel && ud.volume_number == 2) || vixenlevel) - endlvlmenutext(80,16,0,0,"CLOSE ENCOUNTERS"); - else if (turdlevel) - endlvlmenutext(80,16,0,0,"SMELTING PLANT"); - else - endlvlmenutext(80,16,0,0,level_names[(ud.volume_number*7)+ud.last_level-1]); - } - - endlvlmenutext(15,192,0,0,"PRESS ANY KEY TO CONTINUE"); - - if( totalclock > (60*3) ) - { - endlvlmenutext(30,48,0,0,"Yer Time:"); - endlvlmenutext(30,64,0,0,"Par time:"); - endlvlmenutext(30,80,0,0,"Xatrix Time:"); - if(bonuscnt == 0) - bonuscnt++; - - if( totalclock > (60*4) ) - { - if(bonuscnt == 1) - { - bonuscnt++; - sound(404); - } - sprintf(tempbuf,"%02ld : %02ld", - (ps[myconnectindex].player_par/(26*60))%60, - (ps[myconnectindex].player_par/26)%60); - endlvlmenutext(191,48,0,0,tempbuf); - - if(!boardfilename[0]) - { - sprintf(tempbuf,"%02ld : %02ld", - (partime[ud.volume_number*7+ud.last_level-1]/(26*60))%60, - (partime[ud.volume_number*7+ud.last_level-1]/26)%60); - endlvlmenutext(191,64,0,0,tempbuf); - - sprintf(tempbuf,"%02ld : %02ld", - (designertime[ud.volume_number*7+ud.last_level-1]/(26*60))%60, - (designertime[ud.volume_number*7+ud.last_level-1]/26)%60); - endlvlmenutext(191,80,0,0,tempbuf); - } - - } - } - if( totalclock > (60*6) ) - { - endlvlmenutext(30,112,0,0,"Varmints Killed:"); - endlvlmenutext(30,128,0,0,"Varmints Left:"); - - if(bonuscnt == 2) - bonuscnt++; - - if( totalclock > (60*7) ) - { - if(bonuscnt == 3) - { - bonuscnt++; - sound(422); - } - sprintf(tempbuf,"%-3ld",ps[myconnectindex].actors_killed); - endlvlmenutext(231,112,0,0,tempbuf); - if(ud.player_skill > 3 ) - { - sprintf(tempbuf,"N/A"); - endlvlmenutext(231,128,0,0,tempbuf); - } - else - { - if( (ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed) < 0 ) - sprintf(tempbuf,"%-3ld",0); - else sprintf(tempbuf,"%-3ld",ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed); - endlvlmenutext(231,128,0,0,tempbuf); - } - } - } - if( totalclock > (60*9) ) - { - endlvlmenutext(30,144,0,0,"Secrets Found:"); - endlvlmenutext(30,160,0,0,"Secrets Missed:"); - if(bonuscnt == 4) bonuscnt++; - - if( totalclock > (60*10) ) - { - if(bonuscnt == 5) - { - bonuscnt++; - sound(404); - } - sprintf(tempbuf,"%-3ld",ps[myconnectindex].secret_rooms); - endlvlmenutext(231,144,0,0,tempbuf); - if( ps[myconnectindex].secret_rooms > 0 ) - sprintf(tempbuf,"%-3ld%",(100*ps[myconnectindex].secret_rooms/ps[myconnectindex].max_secret_rooms)); - sprintf(tempbuf,"%-3ld",ps[myconnectindex].max_secret_rooms-ps[myconnectindex].secret_rooms); - endlvlmenutext(231,160,0,0,tempbuf); - } - } - - if(totalclock > 10240 && totalclock < 10240+10240) - totalclock = 1024; - - if( KB_KeyWaiting() && totalclock > (60*2) ) - { - if( KB_KeyPressed( sc_F12 ) ) - { - KB_ClearKeyDown( sc_F12 ); - screencapture("rdnk0000.pcx",0); - } - - if( totalclock < (60*13) ) - { - KB_FlushKeyboardQueue(); - totalclock = (60*13); - } - else if( totalclock < (1000000000L)) - totalclock = (1000000000L); - } - } - else break; - nextpage(); - } - if (turdlevel) - turdlevel = 0; - if (vixenlevel) - vixenlevel = 0; -} -#endif - -#ifdef RRRA - -void dobonus(char bonusonly) -{ - if (turdlevel) - turdlevel = 0; - if (vixenlevel) - vixenlevel = 0; -} -#endif - -#endif - - - -#if 0 -void ShowMapFrame(void) -{ - short t = -1, i; - ps[myconnectindex].palette = palette; - if (ud.volume_number == 0) - { - switch (ud.level_number) - { - case 1: - t = 0; - break; - case 2: - t = 1; - break; - case 3: - t = 2; - break; - case 4: - t = 3; - break; - case 5: - t = 4; - break; - case 6: - t = 5; - break; - default: - t = 6; - break; - } - } - else - { - switch (ud.level_number) - { - case 1: - t = 7; - break; - case 2: - t = 8; - break; - case 3: - t = 9; - break; - case 4: - t = 10; - break; - case 5: - t = 11; - break; - case 6: - t = 12; - break; - default: - t = -1; - break; - } - } - rotatesprite(0, 0, 65536, 0, 8624 + t, 0, 0, 10 + 16 + 64 + 128, 0, 0, xdim - 1, ydim - 1); - for (i = 0; i < 64; i++) - palto(0, 0, 0, 63 - i); - ps[myconnectindex].palette = palette; -} -#endif // Utility for testing the above screens CCMD(testrscreen) { + JobDesc jobs[10]; + int job = 0; C_HideConsole(); + FX_StopAllSounds(); + Mus_Stop(); if (argv.argc() > 1) { int screen = strtol(argv[1], nullptr, 0); @@ -1190,22 +614,29 @@ CCMD(testrscreen) { case 0: case 1: - if (!isRRRA()) bonussequence_r(screen, nullptr); + if (!isRRRA()) + { + bonussequence_r(screen, jobs, job); + RunScreenJob(jobs, job, nullptr); + } break; case 2: - ShowMPBonusScreen_r(6, nullptr); + jobs[job++] = { Create(6) }; + RunScreenJob(jobs, job, nullptr); break; case 3: - ShowBonusScreen_r(nullptr); + jobs[job++] = { Create() }; + RunScreenJob(jobs, job, nullptr); + break; + + case 4: + jobs[job++] = { Create() }; + RunScreenJob(jobs, job, nullptr); break; default: - if (isRRRA() && screen >= 100 && screen < 114) - { - PlayMapAnim(0, screen - 100, nullptr); - } break; } } diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h index 02703c081..c780e3f07 100644 --- a/source/games/duke/src/game.h +++ b/source/games/duke/src/game.h @@ -266,8 +266,6 @@ void OffBoat(DukePlayer_t *pPlayer); // 2048+(32+16)+8+4 #define SPAWN_PROTECT_CSTAT_MASK (CSTAT_SPRITE_NOSHADE|CSTAT_SPRITE_ALIGNMENT_SLAB|CSTAT_SPRITE_XFLIP|CSTAT_SPRITE_YFLIP); -void fadepal(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step); -//void fadepaltile(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step,int32_t tile); void G_InitTimer(int32_t ticspersec); inline int32_t G_GetTeamPalette(int32_t team) diff --git a/source/games/duke/src/game_main.cpp b/source/games/duke/src/game_main.cpp index 516372b4a..954ad48b1 100644 --- a/source/games/duke/src/game_main.cpp +++ b/source/games/duke/src/game_main.cpp @@ -198,6 +198,5 @@ void FTA(int q, struct player_struct* p) } } - END_DUKE_NS diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index 35d1cff35..6c067dfda 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -1425,6 +1425,8 @@ int parsecommand() (((*(textptr + 0) - '0') * 10 + (*(textptr + 1) - '0')) * 26 * 60) + (((*(textptr + 3) - '0') * 10 + (*(textptr + 4) - '0')) * 26); + mapList[j * MAXLEVELS + k].levelNumber = k + j * 100; + textptr += 5; while (*textptr == ' ') textptr++; diff --git a/source/games/duke/src/global.h b/source/games/duke/src/global.h index f1e5b21f6..3f78bf39e 100644 --- a/source/games/duke/src/global.h +++ b/source/games/duke/src/global.h @@ -135,7 +135,7 @@ G_EXTERN int32_t impact_damage; extern int32_t labelcnt; G_EXTERN int32_t g_maxPlayerHealth; G_EXTERN int32_t mirrorcnt; -G_EXTERN int32_t g_mostConcurrentPlayers; +G_EXTERN int32_t playerswhenstarted; G_EXTERN int32_t g_musicSize; G_EXTERN int32_t numplayersprites; G_EXTERN int32_t g_scriptDebug; @@ -181,10 +181,8 @@ G_EXTERN int32_t g_ufoCnt; #define ufocnt g_ufoCnt G_EXTERN int32_t g_hulkSpawn; #define hulkspawn g_hulkSpawn -G_EXTERN int32_t g_vixenLevel; G_EXTERN int32_t g_lastLevel; #define lastlevel g_lastLevel -G_EXTERN int32_t g_turdLevel; G_EXTERN int32_t geosectorwarp[MAXGEOSECTORS]; diff --git a/source/games/duke/src/names_rr.h b/source/games/duke/src/names_rr.h index 3e2d96f5f..1656a808a 100644 --- a/source/games/duke/src/names_rr.h +++ b/source/games/duke/src/names_rr.h @@ -1383,6 +1383,7 @@ enum RABBITJIBC = 7397, ROCK = 8035, ROCK2 = 8036, + LEVELMAP = 8624, MAMACLOUD = 8663, MAMA = 8705, MAMAJIBA = 8890, diff --git a/source/games/duke/src/player.h b/source/games/duke/src/player.h index a07893f5a..82536fe18 100644 --- a/source/games/duke/src/player.h +++ b/source/games/duke/src/player.h @@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_DUKE_NS -extern int32_t g_mostConcurrentPlayers; +extern int32_t playerswhenstarted; #define MOVEFIFOSIZ 256 diff --git a/source/games/duke/src/screens.h b/source/games/duke/src/screens.h index e500f1b34..4895bcc30 100644 --- a/source/games/duke/src/screens.h +++ b/source/games/duke/src/screens.h @@ -40,6 +40,5 @@ extern sprstat_t g_spriteStat; extern int32_t dr_yxaspect, dr_viewingrange; extern int32_t g_noLogoAnim, g_noLogo; -extern void G_FadePalette(int32_t r, int32_t g, int32_t b, int32_t e); END_DUKE_NS diff --git a/source/games/duke/src/zz_demo.cpp b/source/games/duke/src/zz_demo.cpp index 9729bf35b..b56813edc 100644 --- a/source/games/duke/src/zz_demo.cpp +++ b/source/games/duke/src/zz_demo.cpp @@ -76,12 +76,12 @@ RECHECK: { ud.recstat = 0; - fadepal(0,0,0, 0,252,28); + //fadepal(0,0,0, 0,252,28); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 G_DrawBackground(); //M_DisplayMenus(); videoNextPage(); - fadepal(0,0,0, 252,0,-28); + //fadepal(0,0,0, 252,0,-28); ud.reccnt = 0; } diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index 8e2e68d9e..987bd80f5 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -182,7 +182,8 @@ void G_GameExit(const char *msg) if (!g_quickExit) { - if (g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ') + + if (playerswhenstarted > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ') { G_BonusScreen(1); } @@ -411,7 +412,7 @@ static void G_OROR_DupeSprites(const spritetype *sp) int32_t k; const spritetype *refsp; - if ((unsigned)sp->yvel >= (unsigned)g_mostConcurrentPlayers) + if ((unsigned)sp->yvel >= (unsigned)playerswhenstarted) return; refsp = &sprite[sp->yvel]; @@ -1640,10 +1641,7 @@ static int G_EndOfLevel(void) G_UpdateScreenArea(); ud.screen_size = i; - if (!RRRA || (g_mostConcurrentPlayers > 1 && numplayers > 1)) - G_BonusScreen(0); - else - G_BonusScreenRRRA(0); + G_BonusScreen(0); } // Clear potentially loaded per-map ART only after the bonus screens. @@ -1835,7 +1833,7 @@ int GameInterface::app_main() } numplayers = 1; - g_mostConcurrentPlayers = ud.multimode; + playerswhenstarted = ud.multimode; if (!g_fakeMultiMode) { @@ -1909,7 +1907,7 @@ int GameInterface::app_main() } } - g_mostConcurrentPlayers = ud.multimode; // XXX: redundant? + playerswhenstarted = ud.multimode; // XXX: redundant? ud.last_level = -1; registerosdcommands(); diff --git a/source/games/duke/src/zz_premap.cpp b/source/games/duke/src/zz_premap.cpp index fba967a8f..c3bb65ade 100644 --- a/source/games/duke/src/zz_premap.cpp +++ b/source/games/duke/src/zz_premap.cpp @@ -121,7 +121,6 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent) { videoClearScreen(0L); //g_player[myconnectindex].ps->palette = palette; - //G_FadePalette(0,0,0,0); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 } /*Gv_SetVar(g_iReturnVarID,TILE_LOADSCREEN, -1, -1);*/ @@ -230,7 +229,7 @@ void G_InitRRRASkies(void) void prelevel_d(int g); void prelevel_r(int g); -void bonussequence_d(int num, CompletionFunc completion); +void e4intro(CompletionFunc completion); void G_NewGame(int volumeNum, int levelNum, int skillNum) { @@ -245,10 +244,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum) if (m_recstat != 2 && ud.last_level >= 0 && (g_netServer || ud.multimode > 1) && (ud.coop&GAMETYPE_SCORESHEET)) { - if (!RRRA || g_mostConcurrentPlayers > 1 || g_netServer || numplayers > 1) - G_BonusScreen(1); - else - G_BonusScreenRRRA(1); + G_BonusScreen(1); } if (RR && !RRRA && ud.level_number == 6 && ud.volume_number == 0) @@ -270,7 +266,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum) if (!RR && (!g_netServer && ud.multimode < 2) && UserMap == 0 && levelNum == 0 && volumeNum == 3 && adult_lockout == 0) { - bonussequence_d(5, [](bool) {}); + e4intro([](bool) {}); } #ifdef EDUKE32_TOUCH_DEVICES @@ -591,7 +587,6 @@ int G_EnterLevel(int gameMode) Net_ResetPrediction(); //g_player[myconnectindex].ps->palette = palette; - //G_FadePalette(0,0,0,0); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 P_UpdateScreenPal(g_player[myconnectindex].ps); renderFlushPerms(); diff --git a/source/games/duke/src/zz_screens.cpp b/source/games/duke/src/zz_screens.cpp index e6ea8ce05..6ad05ac53 100644 --- a/source/games/duke/src/zz_screens.cpp +++ b/source/games/duke/src/zz_screens.cpp @@ -92,7 +92,7 @@ static void G_ShowScores(void) { int32_t t, i; - if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET)) + if (playerswhenstarted > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET)) { gametext_center(SCORESHEETOFFSET+58+2, GStrings("Multiplayer Totals")); gametext_center(SCORESHEETOFFSET+58+10, currentLevel->DisplayName()); @@ -103,7 +103,7 @@ static void G_ShowScores(void) minitext(200, SCORESHEETOFFSET+80, GStrings("Deaths"), 8, 2+8+16+ROTATESPRITE_MAX); minitext(235, SCORESHEETOFFSET+80, GStrings("Ping"), 8, 2+8+16+ROTATESPRITE_MAX); - for (i=g_mostConcurrentPlayers-1; i>=0; i--) + for (i=playerswhenstarted-1; i>=0; i--) { if (!g_player[i].playerquitflag) continue; @@ -918,641 +918,16 @@ void G_DisplayRest(int32_t smoothratio) } } -void G_FadePalette(int32_t r, int32_t g, int32_t b, int32_t e) -{ - if (ud.screenfade == 0) - return; - videoFadePalette(r, g, b, e); - videoNextPage(); - - int32_t tc = (int32_t) totalclock; - while (totalclock < tc + 4) - G_HandleAsync(); -} - -// START and END limits are always inclusive! -// STEP must evenly divide END-START, i.e. abs(end-start)%step == 0 -void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step) -{ - if (ud.screenfade == 0) - return; - if (videoGetRenderMode() >= REND_POLYMOST) - { - G_FadePalette(r, g, b, end); - return; - } - - // (end-start)/step + 1 iterations - do - { - if (inputState.GetKeyStatus(sc_Space)) - { - inputState.ClearKeyStatus(sc_Space); - videoFadePalette(r, g, b, end); // have to set to end fade value if we break! - return; - } - - G_FadePalette(r, g, b, start); - - start += step; - } while (start != end+step); -} - -// START and END limits are always inclusive! -static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step, int32_t tile, int basepal) -{ - if (ud.screenfade == 0) - return; - // STEP must evenly divide END-START - Bassert(klabs(end-start)%step == 0); - - videoClearScreen(0); - - // (end-start)/step + 1 iterations - do - { - if (inputState.GetKeyStatus(sc_Space)) - { - inputState.ClearKeyStatus(sc_Space); - videoFadePalette(r, g, b, end); // have to set to end fade value if we break! - return; - } - rotatesprite_fs(160<<16, 100<<16, 65536L, 0, tile, 0, 0, 2+8+64+BGSTRETCH, nullptr, basepal); - G_FadePalette(r, g, b, start); - - start += step; - } while (start != end+step); -} - -void bonussequence_d(int num, CompletionFunc completion); -void bonussequence_r(int num, CompletionFunc completion); - -static void G_BonusCutscenes(void) -{ - if (RRRA) - return; - if (!(numplayers < 2 && ud.eog && ud.from_bonus == 0)) - return; - - if (RR) - { - bonussequence_r(ud.volume_number, [](bool) {}); - if (ud.volume_number == 0) - { - // Todo: allow to return to the menu here - m_level_number = ud.level_number = 0; - ud.m_volume_number = ud.volume_number = 1; - ud.eog = 0; - g_turdLevel = false; - } - else - { - g_lastLevel = 0; - g_vixenLevel = 1; - ud.level_number = 0; - ud.volume_number = 0; - } - } - else - bonussequence_d(ud.volume_number, [](bool){}); -} - -void ShowMPBonusScreen_d(int pws, CompletionFunc completion); -void ShowMPBonusScreen_r(int pws, CompletionFunc completion); - -static int32_t G_PrintTime_ClockPad(void) -{ - int32_t clockpad = 2; - int32_t ii, ij; - - for (ii=g_player[myconnectindex].ps->player_par/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { } - clockpad = max(clockpad, ij); - if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0])) - { - for (ii=currentLevel->parTime/(60), ij=1; ii>9; ii/=10, ij++) { } - clockpad = max(clockpad, ij); - if (currentLevel->designerTime) - { - for (ii=currentLevel->designerTime/(60), ij=1; ii>9; ii/=10, ij++) { } - clockpad = max(clockpad, ij); - } - } - if (ud.playerbest > 0) for (ii=ud.playerbest/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { } - clockpad = max(clockpad, ij); - - return clockpad; -} - -static const char* G_PrintTime2(int32_t time) -{ - Bsprintf(tempbuf, RR ? "%0*d : %02d" : "%0*d:%02d", G_PrintTime_ClockPad(), time/(REALGAMETICSPERSEC*60), (time/REALGAMETICSPERSEC)%60); - return tempbuf; -} -static const char* G_PrintTime3(int32_t time) -{ - Bsprintf(tempbuf, RR ? "%0*d : %02d . %02d" : "%0*d:%02d.%02d", G_PrintTime_ClockPad(), time/(REALGAMETICSPERSEC*60), (time/REALGAMETICSPERSEC)%60, ((time%REALGAMETICSPERSEC)*33)/10); - return tempbuf; -} - -const char* G_PrintYourTime(void) -{ - return G_PrintTime3(g_player[myconnectindex].ps->player_par); -} -const char* G_PrintParTime(void) -{ - if (ud.last_level < 1) - return ""; - return G_PrintTime2(currentLevel->parTime * REALGAMETICSPERSEC); -} -const char* G_PrintDesignerTime(void) -{ - if (ud.last_level < 1) - return ""; - return G_PrintTime2(currentLevel->designerTime*REALGAMETICSPERSEC); -} -const char* G_PrintBestTime(void) -{ - return G_PrintTime3(ud.playerbest); -} +void dobonus_d(bool bonusonly, CompletionFunc completion); +void dobonus_r(bool bonusonly, CompletionFunc completion); void G_BonusScreen(int32_t bonusonly) { - int32_t bonuscnt; - int32_t clockpad = 2; + if (isRRRA()); + else if (isRR()) dobonus_r(bonusonly, nullptr); + else dobonus_d(bonusonly, nullptr); - fadepal(0, 0, 0, 0, 252, RR ? 4 : 28); - videoSetViewableArea(0, 0, xdim-1, ydim-1); - videoClearScreen(0L); - videoNextPage(); - renderFlushPerms(); - - FX_StopAllSounds(); - S_ClearSoundLocks(); - FX_SetReverb(0L); - inputState.SetBindsEnabled(1); // so you can use your screenshot bind on the score screens - - if (!bonusonly) - G_BonusCutscenes(); - - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 - G_FadePalette(0, 0, 0, 252); // JBF 20031228 - inputState.keyFlushChars(); - totalclock = 0; - bonuscnt = 0; - - Mus_Stop(); - FX_StopAllSounds(); - S_ClearSoundLocks(); - - if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET)) - { - if (!isRR()) ShowMPBonusScreen_d(g_mostConcurrentPlayers, [](bool) {}); - else ShowMPBonusScreen_r(g_mostConcurrentPlayers, [](bool) {}); - } - - if (bonusonly || (g_netServer || ud.multimode > 1)) return; - - //if (!RR) ShowBonusScreen_d(); - //else ShowMPBonusScreen_r(); - - if (g_turdLevel) - g_turdLevel = 0; - if (g_vixenLevel) - g_vixenLevel = 0; -} - -void G_ShowMapFrame(void) -{ - int frame = -1; - - if (ud.volume_number == 0) - { - switch (ud.level_number) - { - case 1: - frame = 0; - break; - case 2: - frame = 1; - break; - case 3: - frame = 2; - break; - case 4: - frame = 3; - break; - case 5: - frame = 4; - break; - case 6: - frame = 5; - break; - default: - frame = 6; - break; - } - } - else - { - switch (ud.level_number) - { - case 1: - frame = 7; - break; - case 2: - frame = 8; - break; - case 3: - frame = 9; - break; - case 4: - frame = 10; - break; - case 5: - frame = 11; - break; - case 6: - frame = 12; - break; - default: - frame = -1; - break; - } - } - rotatesprite_fs(160<<16,100<<16,65536L,0,TILE_RRTILE8624+frame,0,0,10+64+128); -} - -void PlayMapAnim(int v, int m, CompletionFunc completion); - - -void G_BonusScreenRRRA(int32_t bonusonly) -{ - int32_t gfx_offset; - int32_t bonuscnt; - int32_t showMap = 0; - const char *lastmapname; - - //if (g_networkMode == NET_DEDICATED_SERVER) - // return; - - if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0]) - { - lastmapname = Bstrrchr(boardfilename, '\\'); - if (!lastmapname) lastmapname = Bstrrchr(boardfilename, '/'); - if (!lastmapname) lastmapname = boardfilename; - } - else - { - lastmapname = currentLevel->DisplayName(); - } - - fadepal(0, 0, 0, 0, 252, 4); - videoSetViewableArea(0, 0, xdim-1, ydim-1); - videoClearScreen(0L); - videoNextPage(); - renderFlushPerms(); - - FX_StopAllSounds(); - S_ClearSoundLocks(); - FX_SetReverb(0L); - inputState.SetBindsEnabled(1); // so you can use your screenshot bind on the score screens - - if (boardfilename[0] == 0 && numplayers < 2) - { - if ((ud.eog == 0 || ud.volume_number != 1) && ud.volume_number <= 1) - { - showMap = 1; - Mus_Stop(); - inputState.keyFlushChars(); - - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); - G_ShowMapFrame(); - fadepal(0, 0, 0, 252, 0, -4); - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); - } - } - - if (!bonusonly) - G_BonusCutscenes(); - - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 - //G_FadePalette(0, 0, 0, 252); // JBF 20031228 - inputState.keyFlushChars(); - totalclock = 0; - bonuscnt = 0; - - Mus_Stop(); - FX_StopAllSounds(); - S_ClearSoundLocks(); - - if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET)) - { - if (!isRR()) ShowMPBonusScreen_d(g_mostConcurrentPlayers, [](bool) {}); - else ShowMPBonusScreen_r(g_mostConcurrentPlayers, [](bool) {}); - } - - if (bonusonly || (g_netServer || ud.multimode > 1)) return; - - gfx_offset = (ud.volume_number==0) ? TILE_RRTILE403 : TILE_RRTILE409; - gfx_offset += ud.level_number-1; - - if (g_lastLevel || g_vixenLevel) - gfx_offset = TILE_RRTILE409+7; - - if (boardfilename[0]) - gfx_offset = TILE_RRTILE403; - - if (!showMap) - rotatesprite_fs(160<<16, 100<<16, 65536L, 0, gfx_offset, 0, 0, 2+8+64+128+BGSTRETCH); - if (lastmapname) - menutext(80,16, lastmapname); - - menutext(15, 192, "Press any key to continue"); - - inputState.ClearAllInput(); - if (!showMap) - { - videoNextPage(); - fadepal(0, 0, 0, 252, 0, -4); - } - bonuscnt = 0; - totalclock = 0; - - do - { - int32_t yy = 0, zz; - - G_HandleAsync(); - - if (G_FPSLimit()) - { - if (g_player[myconnectindex].ps->gm&MODE_EOL) - { - videoClearScreen(0); - if (showMap) - G_ShowMapFrame(); - else - rotatesprite_fs(160<<16, 100<<16, 65536L, 0, gfx_offset, 0, 0, 2+8+64+128+BGSTRETCH); - - if (showMap) - { - if (bonuscnt == 7) - { - bonuscnt++; - Mus_Stop(); - PlayMapAnim(ud.volume_number, ud.level_number, [](bool) {}); - break; - } - } - - if (totalclock >= 1000000000 && totalclock < 1000000320) - { - switch (((int32_t) totalclock>>4)%15) - { - case 0: - if (bonuscnt == 6) - { - bonuscnt++; - S_PlaySound(425, CHAN_AUTO, CHANF_UI); - switch (rand()&3) - { - case 0: - S_PlaySound(BONUS_SPEECH1, CHAN_AUTO, CHANF_UI); - break; - case 1: - S_PlaySound(BONUS_SPEECH2, CHAN_AUTO, CHANF_UI); - break; - case 2: - S_PlaySound(BONUS_SPEECH3, CHAN_AUTO, CHANF_UI); - break; - case 3: - S_PlaySound(BONUS_SPEECH4, CHAN_AUTO, CHANF_UI); - break; - } - } - fallthrough__; - case 1: - case 4: - case 5: - break; - case 2: - case 3: - break; - } - } - else if (totalclock > (10240+120L)) break; - else - { - switch (((int32_t) totalclock>>5)&3) - { - case 1: - case 3: - break; - case 2: - break; - } - } - - if (lastmapname) - menutext(80, 16, lastmapname); - - menutext(15, 192, GStrings("PRESSKEY")); - - const int yystep = 16; - if (totalclock > (60*3)) - { - yy = zz = 48; - - menutext(30, yy, GStrings("TXT_YERTIME")); - - yy+= yystep; - if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0])) - { - if (currentLevel->parTime) - { - menutext(30, yy, GStrings("TXT_PARTIME")); - yy+=yystep; - } - if (currentLevel->designerTime) - { - menutext(30, yy, GStrings("TXT_XTRTIME")); - yy+=yystep; - } - - } - if (ud.playerbest > 0) - { - menutext(30, yy, (g_player[myconnectindex].ps->player_par > 0 && g_player[myconnectindex].ps->player_par < ud.playerbest) ? "Prev Best:" : "Yer Best:"); - yy += yystep; - } - - if (bonuscnt == 0) - bonuscnt++; - - yy = zz; - if (totalclock >(60*4)) - { - if (bonuscnt == 1) - { - bonuscnt++; - S_PlaySound(404, CHAN_AUTO, CHANF_UI); - } - - if (g_player[myconnectindex].ps->player_par > 0) - { - G_PrintYourTime(); - menutext(191, yy, tempbuf); - //if (g_player[myconnectindex].ps->player_par < ud.playerbest) - // menutext(191 + 30 + (clockpad*24), yy, "New record!"); - } - else - menutext(191, yy, GStrings("TXT_Cheated")); - yy+=yystep; - - if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0])) - { - if (currentLevel->parTime) - { - G_PrintParTime(); - menutext(191, yy, tempbuf); - yy+=yystep; - } - if (currentLevel->designerTime) - { - G_PrintDesignerTime(); - menutext(191, yy, tempbuf); - yy+=yystep; - } - } - - if (ud.playerbest > 0) - { - G_PrintBestTime(); - menutext(191, yy, tempbuf); - yy+=yystep; - } - } - } - - zz = yy += 16; - if (totalclock > (60*6)) - { - menutext(30, yy, GStrings("TXT_VARMINTSKILLED")); - yy += yystep; - menutext(30, yy, GStrings("TXT_VARMINTSLEFT")); - yy += yystep; - - if (bonuscnt == 2) - bonuscnt++; - - yy = zz; - - if (totalclock > (60*7)) - { - if (bonuscnt == 3) - { - bonuscnt++; - S_PlaySound(422, CHAN_AUTO, CHANF_UI); - } - Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->actors_killed); - menutext(231,yy,tempbuf); - yy += yystep; - //if (ud.player_skill > 3) - //{ - // menutext(231,yy, "N/A"); - // yy += yystep; - //} - //else - { - if ((g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed) < 0) - Bsprintf(tempbuf, "%-3d", 0); - else Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed); - menutext(231, yy, tempbuf); - yy += yystep; - } - } - } - - zz = yy += 0; - if (totalclock > (60*9)) - { - menutext(30, yy, GStrings("TXT_SECFND")); - yy += yystep; - menutext(30, yy, GStrings("TXT_SECMISS")); - yy += yystep; - if (bonuscnt == 4) bonuscnt++; - - yy = zz; - if (totalclock > (60*10)) - { - if (bonuscnt == 5) - { - bonuscnt++; - S_PlaySound(404, CHAN_AUTO, CHANF_UI); - } - Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->secret_rooms); - menutext(231, yy, tempbuf); - yy += yystep; - Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->max_secret_rooms-g_player[myconnectindex].ps->secret_rooms); - menutext(231, yy, tempbuf); - yy += yystep; - } - } - - if (totalclock > 10240 && totalclock < 10240+10240) - totalclock = 1024; - - if (inputState.CheckAllInput() && totalclock >(60*2)) // JBF 20030809 - { - if (totalclock < (60*13)) - { - totalclock = (60*13); - } - else if (totalclock < 1000000000) - totalclock = 1000000000; - } - } - else - break; - videoNextPage(); - } - } while (1); - if (ud.eog) - { - fadepal(0, 0, 0, 0, 252, 4); - videoClearScreen(0L); - videoNextPage(); - S_PlaySound(35, CHAN_AUTO, CHANF_UI); - G_FadePalette(0, 0, 0, 0); - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); - while (1) - { - switch (((int32_t) totalclock >> 4) & 1) - { - case 0: - rotatesprite(0,0,65536,0,TILE_RRTILE8677,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - videoNextPage(); - G_FadePalette(0, 0, 0, 0); - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); - Net_GetPackets(); - break; - case 1: - rotatesprite(0,0,65536,0,TILE_RRTILE8677+1,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - videoNextPage(); - G_FadePalette(0, 0, 0, 0); - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); - Net_GetPackets(); - break; - } - - if (!S_CheckSoundPlaying(-1,35)) break; - if (inputState.CheckAllInput()) - { - S_StopSound(35); - break; - } - } - } + // This hack needs to go away! if (RRRA_EndEpisode) { RRRA_EndEpisode = 0; @@ -1560,10 +935,6 @@ void G_BonusScreenRRRA(int32_t bonusonly) m_level_number = ud.level_number = 0; ud.eog = 0; } - if (g_turdLevel) - g_turdLevel = 0; - if (g_vixenLevel) - g_vixenLevel = 0; } END_DUKE_NS