diff --git a/source/core/screenjob.cpp b/source/core/screenjob.cpp index 584b690ae..2c3df9cb8 100644 --- a/source/core/screenjob.cpp +++ b/source/core/screenjob.cpp @@ -52,7 +52,7 @@ IMPLEMENT_CLASS(DScreenJob, true, false) // //--------------------------------------------------------------------------- -void RunScreenJob(DScreenJob *job, std::function completion, bool clearbefore) +void RunScreenJob(DScreenJob *job, CompletionFunc completion, bool clearbefore) { if (clearbefore) { @@ -183,7 +183,7 @@ public: // //--------------------------------------------------------------------------- -void PlayVideo(const char* filename, const AnimSound* ans, const int* frameticks, std::function completion) +void PlayVideo(const char* filename, const AnimSound* ans, const int* frameticks, CompletionFunc completion) { if (!filename) // this is for chaining optional videos without special case coding by the caller. { diff --git a/source/core/screenjob.h b/source/core/screenjob.h index 455dc0eab..b4b8cdaf9 100644 --- a/source/core/screenjob.h +++ b/source/core/screenjob.h @@ -2,6 +2,7 @@ #include #include "dobject.h" +using CompletionFunc = std::function; class DScreenJob : public DObject { @@ -14,7 +15,7 @@ public: void RunScreenJob(DScreenJob *job, std::function completion, bool clearbefore = true); -void RunScreenJob(std::function action, std::function completion, bool clearbefore = true); +void RunScreenJob(std::function action, CompletionFunc completion, bool clearbefore = true); struct AnimSound { @@ -22,10 +23,10 @@ struct AnimSound int soundnum; }; -void PlayVideo(const char *filename, const AnimSound *ans, const int *frameticks, std::function completion); +void PlayVideo(const char *filename, const AnimSound *ans, const int *frameticks, CompletionFunc completion); // This one is not suitable for ANM and SMK unless a descriptor file format is implemented. -inline void PlayVideo(const char *filename, std::function completion) +inline void PlayVideo(const char *filename,CompletionFunc completion) { PlayVideo(filename, nullptr, nullptr , completion); } \ No newline at end of file diff --git a/source/games/duke/CMakeLists.txt b/source/games/duke/CMakeLists.txt index 83a5d093a..6e4cbb00f 100644 --- a/source/games/duke/CMakeLists.txt +++ b/source/games/duke/CMakeLists.txt @@ -1,6 +1,7 @@ set( PCH_SOURCES src/2d_d.cpp + src/2d_r.cpp src/game_main.cpp src/actors.cpp src/actors_r.cpp diff --git a/source/games/duke/src/2d_d.cpp b/source/games/duke/src/2d_d.cpp index 7e0f4cbf6..253a9f5eb 100644 --- a/source/games/duke/src/2d_d.cpp +++ b/source/games/duke/src/2d_d.cpp @@ -36,6 +36,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #include "raze_music.h" #include "mapinfo.h" #include "screenjob.h" +#include "texturemanager.h" //#include "zz_text.h" #undef gametext @@ -43,10 +44,80 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) BEGIN_DUKE_NS +//========================================================================== +// +// Sets up the game fonts. +// +//========================================================================== + +void InitFonts_d() +{ + GlyphSet fontdata; + + // Small font + for (int i = 0; i < 95; i++) + { + auto tile = tileGetTexture(STARTALPHANUM + i); + if (tile && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0) + fontdata.Insert('!' + i, tile); + } + SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, -1, false, false, false, &fontdata); + fontdata.Clear(); + + // Big font + + // This font is VERY messy... + fontdata.Insert('_', tileGetTexture(BIGALPHANUM - 11)); + fontdata.Insert('-', tileGetTexture(BIGALPHANUM - 11)); + for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(BIGALPHANUM - 10 + i)); + for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(BIGALPHANUM + i)); + fontdata.Insert('.', tileGetTexture(BIGPERIOD)); + fontdata.Insert(',', tileGetTexture(BIGCOMMA)); + fontdata.Insert('!', tileGetTexture(BIGX)); + fontdata.Insert('?', tileGetTexture(BIGQ)); + fontdata.Insert(';', tileGetTexture(BIGSEMI)); + fontdata.Insert(':', tileGetTexture(BIGCOLIN)); + fontdata.Insert('\\', tileGetTexture(BIGALPHANUM + 68)); + fontdata.Insert('/', tileGetTexture(BIGALPHANUM + 68)); + fontdata.Insert('%', tileGetTexture(BIGALPHANUM + 69)); + fontdata.Insert('`', tileGetTexture(BIGAPPOS)); + fontdata.Insert('"', tileGetTexture(BIGAPPOS)); + fontdata.Insert('\'', tileGetTexture(BIGAPPOS)); + BigFont = new ::FFont("BigFont", nullptr, "defbigfont", 0, 0, 0, -1, -1, false, false, false, &fontdata); + fontdata.Clear(); + + // Tiny font + for (int i = 0; i < 95; i++) + { + auto tile = tileGetTexture(MINIFONT + i); + if (tile && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0) + fontdata.Insert('!' + i, tile); + } + fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. + SmallFont2 = new ::FFont("SmallFont2", nullptr, "defsmallfont2", 0, 0, 0, -1, -1, false, false, false, &fontdata); + fontdata.Clear(); + + // SBAR index font + for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE + i)); + fontdata.Insert(':', tileGetTexture(THREEBYFIVE + 10)); + fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11)); + fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!')); + fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. + IndexFont = new ::FFont("IndexFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata); + + fontdata.Clear(); + + // digital font + for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(DIGITALNUM + i)); + fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. + DigiFont = new ::FFont("DigiFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata); + +} + // Text output - needs to transition to the actual font routines once everything is set up. #if 1 -int gametext(int x,int y,const char *t,char s,short dabits) +static int gametext(int x,int y,const char *t,char s,short dabits) { short ac,newx; char centre; @@ -95,7 +166,7 @@ int gametext(int x,int y,const char *t,char s,short dabits) return (x); } -int gametextpal(int x,int y,const char *t,char s,unsigned char p) +static int gametextpal(int x,int y,const char *t,char s,unsigned char p) { short ac,newx; char centre; @@ -143,7 +214,7 @@ int gametextpal(int x,int y,const char *t,char s,unsigned char p) return (x); } -int gametextpart(int x,int y,const char *t,char s,short p) +static int gametextpart(int x,int y,const char *t,char s,short p) { short ac,newx, cnt; char centre; @@ -199,15 +270,15 @@ int gametextpart(int x,int y,const char *t,char s,short p) return (x); } -#endif -void gamenumber(int x,int y,int n,char s) +static void gamenumber(int x,int y,int n,char s) { char b[10]; //ltoa(n,b,10); mysnprintf(b,10,"%d",n); gametext(x,y,b,s,2+8+16); } +#endif // ANM player - catastrophically shitty implementation. Todo: Move the sound and fps data to a control file per movie. @@ -551,7 +622,7 @@ class DTitleScreen : public DScreenJob // //--------------------------------------------------------------------------- -void Logo(void) +void Logo_d(CompletionFunc completion) { Mus_Stop(); FX_StopAllSounds(); // JBF 20031228 @@ -564,43 +635,21 @@ void Logo(void) }; static const int logoframetimes[] = { 9, 9, 9 }; - PlayVideo(VOLUMEALL && !inputState.CheckAllInput() ? "logo.anm" : nullptr, logosound, logoframetimes, [](bool skipped) + PlayVideo(VOLUMEALL && !inputState.CheckAllInput() ? "logo.anm" : nullptr, logosound, logoframetimes, [=](bool skipped) { S_PlaySpecialMusic(MUS_INTRO); - RunScreenJob(!isNam() ? Create() : nullptr, [](bool skipped) + RunScreenJob(!isNam() ? Create() : nullptr, [=](bool skipped) { - RunScreenJob(Create(), [](bool skipped) + RunScreenJob(Create(), [=](bool skipped) { sound(NITEVISION_ONOFF); + completion(skipped); }); }); }); - - - -#if 0 - // Needs to be fixed later. The network code busy-waits and blocks the entire app. - if(ud.multimode > 1) - { - rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1); - - rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1); - rotatesprite(160<<16,(129)<<16,30<<11,0,THREEDEE,0,0,2+8,0,0,xdim-1,ydim-1); - if (PLUTOPAK) // JBF 20030804 - rotatesprite(160<<16,(151)<<16,30<<11,0,PLUTOPAKSPRITE+1,0,0,2+8,0,0,xdim-1,ydim-1); - - gametext(160,190,"WAITING FOR PLAYERS",14,2); - videoNextPage(); - } - - waitforeverybody(); -#endif - - twod->ClearScreen(); - videoNextPage(); - } + void dobonus(char bonusonly) { short t, /*r,*/ tinc,gfx_offset; diff --git a/source/games/duke/src/2d_r.cpp b/source/games/duke/src/2d_r.cpp new file mode 100644 index 000000000..2ea3f8a84 --- /dev/null +++ b/source/games/duke/src/2d_r.cpp @@ -0,0 +1,2054 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 1996, 2003 - 3D Realms Entertainment +Copyright (C) 2017-2019 Nuke.YKT + +This file is part of Duke Nukem 3D version 1.5 - Atomic Edition + +Duke Nukem 3D is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Original Source: 1996 - Todd Replogle +Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms +*/ +//------------------------------------------------------------------------- + +// this file collects all 2D content of the game that was scattered across multiple sources originally. +// All this should transition to a more modern, preferably localization friendly, approach later. + +#include "ns.h" +#include "duke3d.h" +#include "names_rr.h" +#include "animtexture.h" +#include "animlib.h" +#include "raze_music.h" +#include "mapinfo.h" +#include "screenjob.h" +#include "texturemanager.h" +//#include "zz_text.h" + +#undef gametext +//#undef menutext + +BEGIN_DUKE_NS + + +//========================================================================== +// +// Sets up the game fonts. +// This is a duplicate of the _d function but needed since the tile numbers differ. +// +//========================================================================== + +void InitFonts_r() +{ + GlyphSet fontdata; + + // Small font + for (int i = 0; i < 95; i++) + { + auto tile = tileGetTexture(STARTALPHANUM + i); + if (tile && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0) + fontdata.Insert('!' + i, tile); + } + SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, -1, false, false, false, &fontdata); + fontdata.Clear(); + + // Big font + + // This font is VERY messy... + fontdata.Insert('_', tileGetTexture(BIGALPHANUM - 11)); + fontdata.Insert('-', tileGetTexture(BIGALPHANUM - 11)); + for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(BIGALPHANUM - 10 + i)); + for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(BIGALPHANUM + i)); + fontdata.Insert('.', tileGetTexture(BIGPERIOD)); + fontdata.Insert(',', tileGetTexture(BIGCOMMA)); + fontdata.Insert('!', tileGetTexture(BIGX)); + fontdata.Insert('?', tileGetTexture(BIGQ)); + fontdata.Insert(';', tileGetTexture(BIGSEMI)); + fontdata.Insert(':', tileGetTexture(BIGCOLIN)); + fontdata.Insert('\\', tileGetTexture(BIGALPHANUM + 68)); + fontdata.Insert('/', tileGetTexture(BIGALPHANUM + 68)); + fontdata.Insert('%', tileGetTexture(BIGALPHANUM + 69)); + fontdata.Insert('`', tileGetTexture(BIGAPPOS)); + fontdata.Insert('"', tileGetTexture(BIGAPPOS)); + fontdata.Insert('\'', tileGetTexture(BIGAPPOS)); + BigFont = new ::FFont("BigFont", nullptr, "defbigfont", 0, 0, 0, -1, -1, false, false, false, &fontdata); + fontdata.Clear(); + + // Tiny font + for (int i = 0; i < 95; i++) + { + auto tile = tileGetTexture(MINIFONT + i); + if (tile && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0) + fontdata.Insert('!' + i, tile); + } + fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. + SmallFont2 = new ::FFont("SmallFont2", nullptr, "defsmallfont2", 0, 0, 0, -1, -1, false, false, false, &fontdata); + fontdata.Clear(); + + // SBAR index font + for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE + i)); + fontdata.Insert(':', tileGetTexture(THREEBYFIVE + 10)); + fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11)); + fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!')); + fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. + IndexFont = new ::FFont("IndexFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata); + + fontdata.Clear(); + + // digital font + for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(DIGITALNUM + i)); + fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. + DigiFont = new ::FFont("DigiFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata); + +} + + +static int gametext(int x,int y,char *t,char s) +{ + short ac,newx; + char centre, *oldt; + + centre = ( x == (320>>1) ); + newx = 0; + oldt = t; + + if(centre) + { + while(*t) + { + if(*t == 32) {newx+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; + + if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break; + + if(*t >= '0' && *t <= '9') + newx += 8; + else newx += tilesiz[ac].x / 2; + t++; + } + + t = oldt; + x = (320>>1)-(newx>>1); + } + + while(*t) + { + if(*t == 32) {x+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; + + if( ac < STARTALPHANUM || ac > ENDALPHANUM ) + break; + + rotatesprite(x<<16,y<<16,32768L,0,ac,s,0,2+8+16,0,0,xdim-1,ydim-1); + + if(*t >= '0' && *t <= '9') + x += 8; + else x += tilesiz[ac].x / 2; + + t++; + } + + return (x); +} + +static int gametext2(int x,int y,char *t,char s) +{ + short ac,newx; + char centre, *oldt; + + centre = ( x == (320>>1) ); + newx = 0; + oldt = t; + + if(centre) + { + while(*t) + { + if(*t == 32) {newx+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; + + if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break; + + if(*t >= '0' && *t <= '9') + newx += 8; + else newx += tilesiz[ac].x / 2; + t++; + } + + t = oldt; + x = (320>>1)-(newx>>1); + } + + while(*t) + { + if(*t == 32) {x+=5;t++;continue;} + else if(*t == '\'') ac = '`' - '!' + STARTALPHANUM; + else ac = *t - '!' + STARTALPHANUM; + + if( ac < STARTALPHANUM || ac > ENDALPHANUM ) + break; + + rotatesprite(x<<16,y<<16,32768L,0,ac,s,s,2+8+16,0,0,xdim-1,ydim-1); + + if(*t >= '0' && *t <= '9') + x += 8; + else x += tilesiz[ac].x / 2; + + t++; + } + + return (x); +} + +static int gametextpal(int x,int y,char *t,char s,char p) +{ + short ac,newx; + char centre, *oldt; + + centre = ( x == (320>>1) ); + newx = 0; + oldt = t; + + if(centre) + { + while(*t) + { + if(*t == 32) {newx+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; + + if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break; + + if(*t >= '0' && *t <= '9') + newx += 8; + else newx += tilesiz[ac].x; + t++; + } + + t = oldt; + x = (320>>1)-(newx>>1); + } + + while(*t) + { + if(*t == 32) {x+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; + + if( ac < STARTALPHANUM || ac > ENDALPHANUM ) + break; + + rotatesprite(x<<16,y<<16,65536L,0,ac,s,p,2+8+16,0,0,xdim-1,ydim-1); + if(*t >= '0' && *t <= '9') + x += 8; + else x += tilesiz[ac].x; + + t++; + } + + return (x); +} + +static int gametextpart(int x,int y,char *t,char s,short p) +{ + short ac,newx, cnt; + char centre, *oldt; + + centre = ( x == (320>>1) ); + newx = 0; + oldt = t; + cnt = 0; + + if(centre) + { + while(*t) + { + if(cnt == p) break; + + if(*t == 32) {newx+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; + + if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break; + + newx += tilesiz[ac].x; + t++; + cnt++; + + } + + t = oldt; + x = (320>>1)-(newx>>1); + } + + cnt = 0; + while(*t) + { + if(*t == 32) {x+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; + + if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break; + + if(cnt == p) + { + rotatesprite(x<<16,y<<16,65536L,0,ac,s,1,2+8+16,0,0,xdim-1,ydim-1); + break; + } + else + rotatesprite(x<<16,y<<16,65536L,0,ac,s,0,2+8+16,0,0,xdim-1,ydim-1); + + x += tilesiz[ac].x; + + t++; + cnt++; + } + + return (x); +} + +static void gamenumber(long x,long y,long n,char s) +{ + char b[10]; + ltoa(n,b,10); + gametext(x,y,b,s); +} + + +void endanimsounds(long fr) +{ + switch(ud.volume_number) + { + case 0:break; + case 1: + switch(fr) + { + case 1: + sound(390); + break; + case 26: + sound(390); + break; + case 36: + sound(390); + break; + case 54: + sound(390); + break; + case 62: + sound(390); + break; + case 75: + sound(390); + break; + case 81: + sound(390); + break; + case 115: + sound(390); + break; + case 124: + sound(390); + break; + } + break; + case 2: + switch(fr) + { + case 1: + sound(390); + break; + case 98: + sound(390); + break; + case 82+20: + sound(390); + sound(390); + break; + case 104+20: + sound(390); + break; + case 114+20: + sound(390); + break; + case 158: + sound(390); + break; + } + break; + } +} + +void logoanimsounds(long fr, short s) +{ +#ifdef RRRA + switch (s) + { + case 1: + if (fr == 1) + sound(256); + break; + case 2: + if (fr == 1) + sound(257); + break; + case 3: + if (fr == 1) + sound(258); + break; + case 4: + if (fr == 1) + sound(259); + break; + case 5: + break; + case 6: + if (fr == 1) + sound(479); + break; + } +#else + switch(s) + { + case -1: + if (fr == 1) + sound(29); + break; + case 0: + if (fr == 1) + sound(478); + break; + case 1: + if (fr == 1) + sound(479); + break; + case 4: + if (fr == 1) + sound(35); + break; + case 5: + if (fr == 1) + sound(82); + break; + } +#endif +} + + +#if 0 +#ifdef RRRA +short playanm(char *fn,char t, short s) +#else +void playanm(char *fn,char t, short s) +#endif +{ + char *animbuf, *palptr; + long i, j, k, length, numframes; + int handle; +#ifdef RRRA + char *windir = getenv("windir"); + if (windir) + { + cddrives = 0; + cdon = 0; + sound(390); + return -1; + } + handle = kopen4load(fn,0); + if(handle == -1) return -1; + length = kfilelength(handle); +#else + handle = kopen4load(fn,0); + if(handle == -1) return; + length = kfilelength(handle); +#endif + + walock[MAXTILES-3-t] = 219+t; + + if(anim == 0) + allocache((long *)&anim,length+sizeof(anim_t),&walock[MAXTILES-3-t]); + + animbuf = (char *)(FP_OFF(anim)+sizeof(anim_t)); + + tilesizx[MAXTILES-3-t] = 200; + tilesizy[MAXTILES-3-t] = 320; + + kread(handle,animbuf,length); + kclose(handle); + + setview(0, 0, xdim, ydim); + clearview(0); + nextpage(); + + ANIM_LoadAnim (animbuf); + numframes = ANIM_NumFrames(); + + palptr = ANIM_GetPalette(); + for(i=0;i<256;i++) + { + j = (i<<2); k = j-i; + tempbuf[j+0] = (palptr[k+2]>>2); + tempbuf[j+1] = (palptr[k+1]>>2); + tempbuf[j+2] = (palptr[k+0]>>2); + tempbuf[j+3] = 0; + } + + VBE_setPalette(0L,256L,tempbuf); + + ototalclock = totalclock + 10; + + KB_FlushKeyboardQueue(); + + for(i=1;i>2); + tempbuf[j+1] = (palptr[k+1]>>2); + tempbuf[j+2] = (palptr[k+0]>>2); + tempbuf[j+3] = 0; + } + + VBE_setPalette(0L,256L,tempbuf); + + ototalclock = totalclock + 10; + + KB_FlushKeyboardQueue(); + + for(i=1;i 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,57<<16,16592L,0,THREEDEE,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]) + { + if (!var24) + { + 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 if (!var24) + { + 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]); + } + 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"); + KB_FlushKeyboardQueue(); + if (!var24) + { + nextpage(); + 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]) + { + if (!var24) + rotatesprite(0,0,65536L,0,403,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + } + else if (!var24) + 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]) + { + if (!var24) + { + 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 if (!var24) + { + 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]); + } + 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 (var24) + { + if (bonuscnt == 7) + { + bonuscnt++; + MUSIC_StopSong(); + KB_FlushKeyboardQueue(); + PlayMapAnim(); + } + else if (bonuscnt == 8) + { + KB_FlushKeyboardQueue(); + totalclock = 10361; + break; + } + + } + if( KB_KeyPressed( sc_F12 ) ) + { + KB_ClearKeyDown( sc_F12 ); + screencapture("rdnk0000.pcx",0); + } + + if (var24) + { + if( totalclock < (60*13) ) + { + KB_FlushKeyboardQueue(); + totalclock = (60*13); + } + else if( totalclock < (1000000000L)) + totalclock = (1000000000L); + } + else + { + if( totalclock < (60*13) ) + { + KB_FlushKeyboardQueue(); + totalclock = (60*13); + } + else if( totalclock < (1000000000L)) + totalclock = (1000000000L); + } + } + } + else break; + if (!var24 || bonuscnt) + nextpage(); + } + if (ud.eog) + { + 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) + { + int var40; + switch ((totalclock >> 4) & 1) + { + 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; + } + 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; +} +#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) +{ + short t, r, tinc,gfx_offset,bg_tile; + long i, y,xfragtotal,yfragtotal; + short bonuscnt; + + 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; + + 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 + +#endif + +END_DUKE_NS diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 695faecdf..11a215c40 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -112,6 +112,10 @@ void displaymasks_r(int snum); void think_d(); void think_r(); +void Logo_d(CompletionFunc); +void Logo_r(CompletionFunc); +void InitFonts_d(); +void InitFonts_r(); Dispatcher fi; @@ -121,6 +125,8 @@ void SetDispatcher() if (!isRR()) { fi = { + Logo_d, + InitFonts_d, think_d, initactorflags_d, isadoorwall_d, @@ -168,6 +174,8 @@ void SetDispatcher() else { fi = { + Logo_r, + InitFonts_r, think_r, initactorflags_r, isadoorwall_r, diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h index 306810881..ecc36f7b9 100644 --- a/source/games/duke/src/game.h +++ b/source/games/duke/src/game.h @@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mmulti.h" #include "palette.h" #include "cmdlib.h" +#include "screenjob.h" BEGIN_DUKE_NS @@ -469,6 +470,10 @@ void spawneffector(int i); struct Dispatcher { + // global stuff + void (*ShowLogo)(CompletionFunc completion); + void (*InitFonts)(); + // sectors_?.cpp void (*think)(); void (*initactorflags)(); diff --git a/source/games/duke/src/game_main.cpp b/source/games/duke/src/game_main.cpp index 97ea6a36c..fa972b079 100644 --- a/source/games/duke/src/game_main.cpp +++ b/source/games/duke/src/game_main.cpp @@ -122,14 +122,14 @@ void genspriteremaps(void) if (isRR()) { uint8_t table[256]; - for (j = 0; j < 768; j++) + for (j = 0; j < 256; j++) table[j] = j; for (j = 0; j < 32; j++) table[j] = j + 32; lookups.makeTable(7, table, 0, 0, 0, 0); - for (j = 0; j < 768; j++) + for (j = 0; j < 256; j++) table[j] = j; lookups.makeTable(30, table, 0, 0, 0, 0); lookups.makeTable(31, table, 0, 0, 0, 0); @@ -152,7 +152,7 @@ void genspriteremaps(void) table[j] = j + 32; } lookups.makeTable(34, table, 0, 0, 0, 0); - for (j = 0; j < 768; j++) + for (j = 0; j < 256; j++) table[j] = j; for (j = 0; j < 16; j++) table[j] = j + 129; diff --git a/source/games/duke/src/screens.h b/source/games/duke/src/screens.h index 8c4ad1fc1..632265bf3 100644 --- a/source/games/duke/src/screens.h +++ b/source/games/duke/src/screens.h @@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_DUKE_NS extern void G_DisplayExtraScreens(void); -extern void G_DisplayLogo(void); extern void G_DoOrderScreen(void); #ifdef DEBUGGINGAIDS diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index 2d00e3b52..08dd5d9eb 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -1645,8 +1645,6 @@ void G_PostCreateGameState(void) Net_SendClientInfo(); } -void InitFonts(); - static void G_Startup(void) { int32_t i; @@ -1708,7 +1706,7 @@ static void G_Startup(void) if (TileFiles.artLoadFiles("tiles%03i.art") < 0) G_GameExit("Failed loading art."); - InitFonts(); + fi.InitFonts(); // Make the fullscreen nuke logo background non-fullbright. Has to be // after dynamic tile remapping (from C_Compile) and loading tiles. @@ -1906,8 +1904,6 @@ static const char* actions[] = { "Toggle_Crouch", // This is the last one used by EDuke32. }; -void InitFonts(); - int32_t SetDefaults(void) { g_player[0].ps->aim_mode = 1; @@ -2076,7 +2072,6 @@ int GameInterface::app_main() #endif videoInit(); - InitFonts(); V_LoadTranslations(); videoSetPalette(BASEPAL, 0); @@ -2142,9 +2137,11 @@ MAIN_LOOP_RESTART: Net_WaitForEverybody(); } else - G_DisplayLogo(); + { + fi.ShowLogo([](bool) {}); + } - M_StartControlPanel(false); + M_StartControlPanel(false); M_SetMenu(NAME_Mainmenu); if (G_PlaybackDemo()) { diff --git a/source/games/duke/src/zz_screens.cpp b/source/games/duke/src/zz_screens.cpp index 0226c38c7..cc3b08e4d 100644 --- a/source/games/duke/src/zz_screens.cpp +++ b/source/games/duke/src/zz_screens.cpp @@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "menu/menu.h" #include "mapinfo.h" #include "v_2ddrawer.h" +#include "screenjob.h" BEGIN_DUKE_NS @@ -1069,84 +1070,6 @@ void G_DisplayExtraScreens(void) } } -void Logo_d(); -void Logo_r(); -void G_DisplayLogo(void) -{ - if (!isRR()) - { - Logo_d(); - return; - } - int32_t soundanm = 0; - //int32_t logoflags = G_GetLogoFlags(); - - ready2send = 0; - - inputState.ClearAllInput(); - - videoSetViewableArea(0, 0, xdim-1, ydim-1); - videoClearScreen(0L); - G_FadePalette(0, 0, 0, 252); - - renderFlushPerms(); - videoNextPage(); - - Mus_Stop(); - FX_StopAllSounds(); // JBF 20031228 - if (RRRA) - return; - if (RR) - { - if (!inputState.CheckAllInput() && g_noLogoAnim == 0 && !userConfig.nologo) - { - Net_GetPackets(); - Anim_Play("rr_intro.anm"); - G_FadePalette(0, 0, 0, 252); - inputState.ClearAllInput(); - } - - videoClearScreen(0L); - videoNextPage(); - FX_StopAllSounds(); - S_ClearSoundLocks(); - - if (!inputState.CheckAllInput() && g_noLogoAnim == 0 && !userConfig.nologo) - { - Net_GetPackets(); - Anim_Play("redneck.anm"); - G_FadePalette(0, 0, 0, 252); - inputState.ClearAllInput(); - } - - videoClearScreen(0L); - videoNextPage(); - FX_StopAllSounds(); - S_ClearSoundLocks(); - - if (!inputState.CheckAllInput() && g_noLogoAnim == 0 && !userConfig.nologo) - { - Net_GetPackets(); - Anim_Play("xatlogo.anm"); - G_FadePalette(0, 0, 0, 252); - inputState.ClearAllInput(); - } - - videoClearScreen(0L); - videoNextPage(); - FX_StopAllSounds(); - S_ClearSoundLocks(); - - //g_player[myconnectindex].ps->palette = palette; - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 - S_PlaySound(NITEVISION_ONOFF, CHAN_AUTO, CHANF_UI); - - //G_FadePalette(0,0,0,0); - videoClearScreen(0L); - return; - } -} - void G_DoOrderScreen(void) { int32_t i;