From 67fa7f82750d036b5577baf37ebe7701ac0ad561 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Jun 2020 00:32:28 +0200 Subject: [PATCH] - work on Duke intro sequence. Now without any Build drawing code, it goes directly to DrawTexture now. :) --- source/common/2d/v_draw.cpp | 21 +- source/common/2d/v_draw.h | 3 + source/common/textures/animtexture.cpp | 10 +- source/common/textures/animtexture.h | 1 + source/core/screenjob.cpp | 238 ++-- source/core/screenjob.h | 7 +- source/games/duke/src/2d_d.cpp | 1797 ++++++++++++------------ source/games/duke/src/zz_screens.cpp | 158 +-- source/sw/src/anim.cpp | 1 - wadsrc/static/zscript/base.zs | 2 + 10 files changed, 1077 insertions(+), 1161 deletions(-) diff --git a/source/common/2d/v_draw.cpp b/source/common/2d/v_draw.cpp index 4556eeb03..8c7f6aee6 100644 --- a/source/common/2d/v_draw.cpp +++ b/source/common/2d/v_draw.cpp @@ -399,12 +399,14 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FGameTexture *img, do } if (parms->destwidth == INT_MAX || parms->fortext) { - parms->destwidth = img->GetDisplayWidth(); + parms->destwidth = parms->texwidth; } if (parms->destheight == INT_MAX || parms->fortext) { - parms->destheight = img->GetDisplayHeight(); + parms->destheight = parms->texheight; } + parms->destwidth *= parms->patchscalex; + parms->destheight *= parms->patchscaley; switch (parms->cleanmode) { @@ -446,7 +448,7 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FGameTexture *img, do case DTA_FullscreenEx: { DoubleRect rect; - CalcFullscreenScale(drawer, img->GetDisplayWidth(), img->GetDisplayHeight(), parms->fsscalemode, rect); + CalcFullscreenScale(drawer, parms->texwidth, parms->texheight, parms->fsscalemode, rect); parms->keepratio = true; parms->x = rect.left; parms->y = rect.top; @@ -624,6 +626,7 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double parms->monospace = EMonospacing::Off; parms->spacing = 0; parms->fsscalemode = -1; + parms->patchscalex = parms->patchscaley = 1; // Parse the tag list for attributes. (For floating point attributes, // consider that the C ABI dictates that all floats be promoted to @@ -958,6 +961,18 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double } break; + case DTA_ScaleX: + assert(fortext == false); + if (fortext) return false; + parms->patchscalex = ListGetDouble(tags); + break; + + case DTA_ScaleY: + assert(fortext == false); + if (fortext) return false; + parms->patchscaley = ListGetDouble(tags); + break; + case DTA_Masked: parms->masked = ListGetInt(tags); break; diff --git a/source/common/2d/v_draw.h b/source/common/2d/v_draw.h index c48fd417b..83ab241e8 100644 --- a/source/common/2d/v_draw.h +++ b/source/common/2d/v_draw.h @@ -89,6 +89,8 @@ enum DTA_FullscreenEx, DTA_FullscreenScale, + DTA_ScaleX, + DTA_ScaleY, }; @@ -157,6 +159,7 @@ struct DrawParms int8_t fsscalemode; double srcx, srcy; double srcwidth, srcheight; + double patchscalex, patchscaley; }; struct Va_List diff --git a/source/common/textures/animtexture.cpp b/source/common/textures/animtexture.cpp index b19efa167..ce11c0063 100644 --- a/source/common/textures/animtexture.cpp +++ b/source/common/textures/animtexture.cpp @@ -135,8 +135,14 @@ AnimTextures::AnimTextures() AnimTextures::~AnimTextures() { - tex[0]->CleanHardwareData(true); - tex[1]->CleanHardwareData(true); + Clean(); +} + +void AnimTextures::Clean() +{ + if (tex[0]) tex[0]->CleanHardwareData(true); + if (tex[1]) tex[1]->CleanHardwareData(true); + tex[0] = tex[1] = nullptr; } void AnimTextures::SetSize(int format, int width, int height) diff --git a/source/common/textures/animtexture.h b/source/common/textures/animtexture.h index 5710d44b3..1f79d0af1 100644 --- a/source/common/textures/animtexture.h +++ b/source/common/textures/animtexture.h @@ -29,6 +29,7 @@ class AnimTextures public: AnimTextures(); ~AnimTextures(); + void Clean(); void SetSize(int format, int width, int height); void SetFrame(const uint8_t* palette, const void* data); FGameTexture* GetFrame() diff --git a/source/core/screenjob.cpp b/source/core/screenjob.cpp index bdc2eff3a..584b690ae 100644 --- a/source/core/screenjob.cpp +++ b/source/core/screenjob.cpp @@ -38,6 +38,10 @@ #include "screenjob.h" #include "i_time.h" #include "v_2ddrawer.h" +#include "animlib.h" +#include "v_draw.h" +#include "s_soundinternal.h" +#include "animtexture.h" IMPLEMENT_CLASS(DScreenJob, true, false) @@ -63,108 +67,166 @@ void RunScreenJob(DScreenJob *job, std::function completion, while(true) { auto now = I_nsTime(); - int frame = int((now - startTime) * 120 / 1'000'000'000); + handleevents(); bool skiprequest = inputState.CheckAllInput(); - twod->ClearScreen(); - int state = job->Frame(frame, skiprequest); + int state = job->Frame(now - startTime, skiprequest); videoNextPage(); if (state < 1) { + job->Destroy(); completion(state < 0); return; } } } -void PlayVideo(const char *filename, AnimSound *ans, int frameticks, std::function completion); +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- - -#if 0 -void RunScreen(const char *classname, VMValue *params, int numparams, std::function completion) +class DAnmPlayer : public DScreenJob { - int ticker = 0; - auto ototalclock = totalclock; - - PClass *cls = PClass::FindClass(classname); - if (cls != nullptr && cls->IsDescendantOf(NAME_GameScreen)) - { - auto func = dyn_cast(cls->FindSymbol("Init", true)); - if (func != nullptr && !(func->Variants[0].Flags & (VARF_Protected | VARF_Private))) // skip internal classes which have a protected init method. - { - TArray args(numparams+1); - for(int i = 0;iCreateNew(); - if (!item) - { - completion(true); - return; - } - args[0] = item; - VMCallWithDefaults(func->Variants[0].Implementation, args, nullptr, 0); - - while (true) - { - handleevents(); - event_t *ev; - // This should later run off D_ProcessEvents, but currently requires a local copy here - while (eventtail != eventhead) - { - ev = &events[eventtail]; - eventtail = (eventtail + 1) & (MAXEVENTS - 1); - if (ev->type == EV_None) - continue; - if (ev->type == EV_DeviceChange) - UpdateJoystickMenu(I_UpdateDeviceList()); -#if 0 // this isn't safe with the current engine structure - if (C_Responder (ev)) - continue; // console ate the event - if (M_Responder (ev)) - continue; // menu ate the event -#endif + // This doesn't need its own class type + anim_t anim; + TArray buffer; + int numframes = 0; + int curframe = 1; + int lastframe = -1; + int frametime = 0; + int ototalclock = 0; + AnimTextures animtex; + const AnimSound* animSnd; + const int* frameTicks; - IFVIRTUALPTRNAME(item, NAME_GameScreen, OnEvent) - { - FInputEvent e = ev; - VMValue params[] = { (DObject*)item, &e }; - int retval; - VMReturn ret(&retval); - VMCall(func, params, 2, &ret, 1); - if (!retval) - { - completion(true); - return; - } - } - } - - while ((int)(totalclock - ototalclock) >= 1) - { - IFVIRTUALPTRNAME(item, NAME_GameScreen, Tick) - { - FInputEvent e = ev; - VMValue params[] = { (DObject*)item, ticker }; - ticker++; - int retval; - VMReturn ret(&retval); - VMCall(func, params, 2, &ret, 1); - if (!retval) - { - completion(false); - return; - } - } - } - IFVIRTUALPTRNAME(item, NAME_GameScreen, Draw) - { - FInputEvent e = ev; - VMValue params[] = { (DObject*)item }; - ticker++; - VMCall(func, params, 1, nullptr, 0); - } - videoNextPage(); +public: + bool isvalid() { return numframes > 0; } + + DAnmPlayer(FileReader& fr, const AnimSound* ans, const int *frameticks) + : animSnd(ans), frameTicks(frameticks) + { + buffer = fr.ReadPadded(1); + fr.Close(); + + if (ANIM_LoadAnim(&anim, buffer.Data(), buffer.Size() - 1) < 0) + { + return; + } + numframes = ANIM_NumFrames(&anim); + animtex.SetSize(AnimTexture::Paletted, 320, 200); + } + + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- + + int Frame(uint64_t clock, bool skiprequest) override + { + int totalclock = int(clock * 120 / 1'000'000'000); + + if (curframe > 4 && totalclock > frametime + 60) + { + Printf("WARNING: slowdown in video playback, aborting\n"); + return -1; + } + + if (totalclock < ototalclock - 1) + { + twod->ClearScreen(); + DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, 3, DTA_Masked, false, TAG_DONE); + return skiprequest? -1 : 1; + } + + animtex.SetFrame(ANIM_GetPalette(&anim), ANIM_DrawFrame(&anim, curframe)); + frametime = totalclock; + + twod->ClearScreen(); + DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, 3, DTA_Masked, false, TAG_DONE); + + int delay = 20; + if (frameTicks) + { + if (curframe == 0) delay = frameTicks[0]; + else if (curframe < numframes - 1) delay = frameTicks[1]; + else delay = frameTicks[2]; + } + ototalclock += delay; + + for (int i = 0; animSnd[i].framenum >= 0; i++) + { + if (animSnd[i].framenum == curframe) + { + int sound = animSnd[i].soundnum; + if (sound == -1) + soundEngine->StopAllChannels(); + else + soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_BODY, CHANF_NONE, sound, 1.f, ATTN_NONE); } } + curframe++; + return skiprequest ? -1 : curframe < numframes? 1 : 0; + } + + void OnDestroy() override + { + buffer.Reset(); + animtex.Clean(); + } +}; + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void PlayVideo(const char* filename, const AnimSound* ans, const int* frameticks, std::function completion) +{ + if (!filename) // this is for chaining optional videos without special case coding by the caller. + { + completion(false); + return; + } + auto fr = fileSystem.OpenFileReader(filename); + if (!fr.isOpen()) + { + Printf("%s: Unable to open video\n", filename); + completion(true); + return; + } + char id[20] = {}; + + fr.Read(&id, 20); + fr.Seek(-20, FileReader::SeekCur); + + if (!memcmp(id, "LPF ", 4)) + { + auto anm = Create(fr, ans, frameticks); + if (!anm->isvalid()) + { + Printf("%s: invalid ANM file.\n", filename); + anm->Destroy(); + return; + } + RunScreenJob(anm, completion); + } + else if (!memcmp(id, "SMK2", 4)) + { + // todo + } + else if (!memcmp(id, "Interplay MVE file", 18)) + { + // todo + } + // add more formats here. + else + { + Printf("%s: Unknown video format\n", filename); + completion(true); + return; } - completion(true); } -#endif \ No newline at end of file + diff --git a/source/core/screenjob.h b/source/core/screenjob.h index b3f3b3bd6..455dc0eab 100644 --- a/source/core/screenjob.h +++ b/source/core/screenjob.h @@ -9,11 +9,12 @@ class DScreenJob : public DObject //std::function completion; public: - virtual int Frame(int clock, bool skiprequest) = 0; + virtual int Frame(uint64_t clock, bool skiprequest) = 0; }; void RunScreenJob(DScreenJob *job, std::function completion, bool clearbefore = true); +void RunScreenJob(std::function action, std::function completion, bool clearbefore = true); struct AnimSound { @@ -21,10 +22,10 @@ struct AnimSound int soundnum; }; -void PlayVideo(const char *filename, AnimSound *ans, int frameticks, std::function completion); +void PlayVideo(const char *filename, const AnimSound *ans, const int *frameticks, std::function 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) { - PlayVideo(filename, nullptr, -1, completion); + PlayVideo(filename, nullptr, nullptr , completion); } \ No newline at end of file diff --git a/source/games/duke/src/2d_d.cpp b/source/games/duke/src/2d_d.cpp index 8d64c7d3c..7e0f4cbf6 100644 --- a/source/games/duke/src/2d_d.cpp +++ b/source/games/duke/src/2d_d.cpp @@ -35,6 +35,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #include "animlib.h" #include "raze_music.h" #include "mapinfo.h" +#include "screenjob.h" //#include "zz_text.h" #undef gametext @@ -47,290 +48,277 @@ BEGIN_DUKE_NS #if 1 int gametext(int x,int y,const char *t,char s,short dabits) { - short ac,newx; - char centre; - const char *oldt; + short ac,newx; + char centre; + const char *oldt; - centre = ( x == (320>>1) ); - newx = 0; - oldt = t; + centre = ( x == (320>>1) ); + newx = 0; + oldt = t; - if(centre) - { - while(*t) - { - if(*t == 32) {newx+=5;t++;continue;} - else ac = *t - '!' + STARTALPHANUM; + if(centre) + { + while(*t) + { + if(*t == 32) {newx+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; - if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break; + if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break; - if(*t >= '0' && *t <= '9') - newx += 8; - else newx += tilesiz[ac].x; - t++; - } + if(*t >= '0' && *t <= '9') + newx += 8; + else newx += tilesiz[ac].x; + t++; + } - t = oldt; - x = (320>>1)-(newx>>1); - } + t = oldt; + x = (320>>1)-(newx>>1); + } - while(*t) - { - if(*t == 32) {x+=5;t++;continue;} - else ac = *t - '!' + STARTALPHANUM; + while(*t) + { + if(*t == 32) {x+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; - if( ac < STARTALPHANUM || ac > ENDALPHANUM ) - break; + if( ac < STARTALPHANUM || ac > ENDALPHANUM ) + break; - rotatesprite(x<<16,y<<16,65536L,0,ac,s,0,dabits,0,0,xdim-1,ydim-1); + rotatesprite(x<<16,y<<16,65536L,0,ac,s,0,dabits,0,0,xdim-1,ydim-1); - if(*t >= '0' && *t <= '9') - x += 8; - else x += tilesiz[ac].x; + if(*t >= '0' && *t <= '9') + x += 8; + else x += tilesiz[ac].x; - t++; - } + t++; + } - return (x); + return (x); } int gametextpal(int x,int y,const char *t,char s,unsigned char p) { - short ac,newx; - char centre; - const char *oldt; + short ac,newx; + char centre; + const char *oldt; - centre = ( x == (320>>1) ); - newx = 0; - oldt = t; + centre = ( x == (320>>1) ); + newx = 0; + oldt = t; - if(centre) - { - while(*t) - { - if(*t == 32) {newx+=5;t++;continue;} - else ac = *t - '!' + STARTALPHANUM; + if(centre) + { + while(*t) + { + if(*t == 32) {newx+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; - if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break; + if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break; - if(*t >= '0' && *t <= '9') - newx += 8; - else newx += tilesiz[ac].x; - t++; - } + if(*t >= '0' && *t <= '9') + newx += 8; + else newx += tilesiz[ac].x; + t++; + } - t = oldt; - x = (320>>1)-(newx>>1); - } + t = oldt; + x = (320>>1)-(newx>>1); + } - while(*t) - { - if(*t == 32) {x+=5;t++;continue;} - else ac = *t - '!' + STARTALPHANUM; + while(*t) + { + if(*t == 32) {x+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; - if( ac < STARTALPHANUM || ac > ENDALPHANUM ) - break; + 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; + 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++; - } + t++; + } - return (x); + return (x); } int gametextpart(int x,int y,const char *t,char s,short p) { - short ac,newx, cnt; - char centre; - const char *oldt; + short ac,newx, cnt; + char centre; + const char *oldt; - centre = ( x == (320>>1) ); - newx = 0; - oldt = t; - cnt = 0; + centre = ( x == (320>>1) ); + newx = 0; + oldt = t; + cnt = 0; - if(centre) - { - while(*t) - { - if(cnt == p) break; + if(centre) + { + while(*t) + { + if(cnt == p) break; - if(*t == 32) {newx+=5;t++;continue;} - else ac = *t - '!' + STARTALPHANUM; + if(*t == 32) {newx+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; - if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break; + if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break; - newx += tilesiz[ac].x; - t++; - cnt++; + newx += tilesiz[ac].x; + t++; + cnt++; - } + } - t = oldt; - x = (320>>1)-(newx>>1); - } + t = oldt; + x = (320>>1)-(newx>>1); + } - cnt = 0; - while(*t) - { - if(*t == 32) {x+=5;t++;continue;} - else ac = *t - '!' + STARTALPHANUM; + cnt = 0; + while(*t) + { + if(*t == 32) {x+=5;t++;continue;} + else ac = *t - '!' + STARTALPHANUM; - if( ac < STARTALPHANUM || ac > ENDALPHANUM ) break; + 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); + 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; + x += tilesiz[ac].x; - t++; - cnt++; - } + t++; + cnt++; + } - return (x); + return (x); } #endif 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); + char b[10]; + //ltoa(n,b,10); + mysnprintf(b,10,"%d",n); + gametext(x,y,b,s,2+8+16); } // ANM player - catastrophically shitty implementation. Todo: Move the sound and fps data to a control file per movie. void endanimsounds(int fr) { - switch(ud.volume_number) - { - case 0:break; - case 1: - switch(fr) - { - case 1: - sound(WIND_AMBIENCE); - break; - case 26: - sound(ENDSEQVOL2SND1); - break; - case 36: - sound(ENDSEQVOL2SND2); - break; - case 54: - sound(THUD); - break; - case 62: - sound(ENDSEQVOL2SND3); - break; - case 75: - sound(ENDSEQVOL2SND4); - break; - case 81: - sound(ENDSEQVOL2SND5); - break; - case 115: - sound(ENDSEQVOL2SND6); - break; - case 124: - sound(ENDSEQVOL2SND7); - break; - } - break; - case 2: - switch(fr) - { - case 1: - sound(WIND_REPEAT); - break; - case 98: - sound(DUKE_GRUNT); - break; - case 82+20: - sound(THUD); - sound(SQUISHED); - break; - case 104+20: - sound(ENDSEQVOL3SND3); - break; - case 114+20: - sound(ENDSEQVOL3SND2); - break; - case 158: - sound(PIPEBOMB_EXPLODE); - break; - } - break; - } -} - -void logoanimsounds(int fr) -{ - switch(fr) - { - case 1: - sound(FLY_BY); - break; - case 19: - sound(PIPEBOMB_EXPLODE); - break; - } + switch(ud.volume_number) + { + case 0:break; + case 1: + switch(fr) + { + case 1: + sound(WIND_AMBIENCE); + break; + case 26: + sound(ENDSEQVOL2SND1); + break; + case 36: + sound(ENDSEQVOL2SND2); + break; + case 54: + sound(THUD); + break; + case 62: + sound(ENDSEQVOL2SND3); + break; + case 75: + sound(ENDSEQVOL2SND4); + break; + case 81: + sound(ENDSEQVOL2SND5); + break; + case 115: + sound(ENDSEQVOL2SND6); + break; + case 124: + sound(ENDSEQVOL2SND7); + break; + } + break; + case 2: + switch(fr) + { + case 1: + sound(WIND_REPEAT); + break; + case 98: + sound(DUKE_GRUNT); + break; + case 82+20: + sound(THUD); + sound(SQUISHED); + break; + case 104+20: + sound(ENDSEQVOL3SND3); + break; + case 114+20: + sound(ENDSEQVOL3SND2); + break; + case 158: + sound(PIPEBOMB_EXPLODE); + break; + } + break; + } } void intro4animsounds(int fr) { - switch(fr) - { - case 1: - sound(INTRO4_B); - break; - case 12: - case 34: - sound(SHORT_CIRCUIT); - break; - case 18: - sound(INTRO4_5); - break; - } + switch(fr) + { + case 1: + sound(INTRO4_B); + break; + case 12: + case 34: + sound(SHORT_CIRCUIT); + break; + case 18: + sound(INTRO4_5); + break; + } } void first4animsounds(int fr) { - switch(fr) - { - case 1: - sound(INTRO4_1); - break; - case 12: - sound(INTRO4_2); - break; - case 7: - sound(INTRO4_3); - break; - case 26: - sound(INTRO4_4); - break; - } + switch(fr) + { + case 1: + sound(INTRO4_1); + break; + case 12: + sound(INTRO4_2); + break; + case 7: + sound(INTRO4_3); + break; + case 26: + sound(INTRO4_4); + break; + } } void intro42animsounds(int fr) { - switch(fr) - { - case 10: - sound(INTRO4_6); - break; - } + switch(fr) + { + case 10: + sound(INTRO4_6); + break; + } } @@ -338,126 +326,125 @@ void intro42animsounds(int fr) void endanimvol41(int fr) { - switch(fr) - { - case 3: - sound(DUKE_UNDERWATER); - break; - case 35: - sound(VOL4ENDSND1); - break; - } + switch(fr) + { + case 3: + sound(DUKE_UNDERWATER); + break; + case 35: + sound(VOL4ENDSND1); + break; + } } void endanimvol42(int fr) { - switch(fr) - { - case 11: - sound(DUKE_UNDERWATER); - break; - case 20: - sound(VOL4ENDSND1); - break; - case 39: - sound(VOL4ENDSND2); - break; - case 50: - FX_StopAllSounds(); - break; - } + switch(fr) + { + case 11: + sound(DUKE_UNDERWATER); + break; + case 20: + sound(VOL4ENDSND1); + break; + case 39: + sound(VOL4ENDSND2); + break; + case 50: + FX_StopAllSounds(); + break; + } } void endanimvol43(int fr) { - switch(fr) - { - case 1: - sound(BOSS4_DEADSPEECH); - break; - case 40: - sound(VOL4ENDSND1); - sound(DUKE_UNDERWATER); - break; - case 50: - sound(BIGBANG); - break; - } + switch(fr) + { + case 1: + sound(BOSS4_DEADSPEECH); + break; + case 40: + sound(VOL4ENDSND1); + sound(DUKE_UNDERWATER); + break; + case 50: + sound(BIGBANG); + break; + } } void playanm(const char *fn,char t) { - int i, length=0, numframes=0; + int i, length=0, numframes=0; // return; - AnimTextures animtex; + AnimTextures animtex; - inputState.ClearAllInput(); + inputState.ClearAllInput(); auto fr = fileSystem.OpenFileReader(fn); - if (fr.isOpen()) - { - anim_t anm; - auto buffer = fr.ReadPadded(1); - fr.Close(); + if (fr.isOpen()) + { + anim_t anm; + auto buffer = fr.ReadPadded(1); + fr.Close(); - if (memcmp(buffer.Data(), "LPF ", 4) || - ANIM_LoadAnim(&anm, buffer.Data(), buffer.Size() - 1) < 0 || - (numframes = ANIM_NumFrames(&anm)) <= 0) - { - Printf("%s: Invalid ANM file\n", fn); - goto ENDOFANIMLOOP; - } + if (memcmp(buffer.Data(), "LPF ", 4) || + ANIM_LoadAnim(&anm, buffer.Data(), buffer.Size() - 1) < 0 || + (numframes = ANIM_NumFrames(&anm)) <= 0) + { + Printf("%s: Invalid ANM file\n", fn); + goto ENDOFANIMLOOP; + } - animtex.SetSize(AnimTexture::Paletted, 320, 200); - auto palptr = ANIM_GetPalette(&anm); + animtex.SetSize(AnimTexture::Paletted, 320, 200); + auto palptr = ANIM_GetPalette(&anm); - ototalclock = totalclock + 10; + ototalclock = totalclock + 10; - for (i = 1; i < numframes; i++) - { - while (totalclock < ototalclock) - { - handleevents(); - //getpackets(); - if (inputState.CheckAllInput()) - goto ENDOFANIMLOOP; - } - animtex.SetFrame(ANIM_GetPalette(&anm), ANIM_DrawFrame(&anm, i)); + for (i = 1; i < numframes; i++) + { + while (totalclock < ototalclock) + { + handleevents(); + //getpackets(); + if (inputState.CheckAllInput()) + goto ENDOFANIMLOOP; + } + animtex.SetFrame(ANIM_GetPalette(&anm), ANIM_DrawFrame(&anm, i)); - // ouch! - if (t == 10) ototalclock += 14; - else if (t == 9) ototalclock += 10; - else if (t == 7) ototalclock += 18; - else if (t == 6) ototalclock += 14; - else if (t == 5) ototalclock += 9; - else if (ud.volume_number == 3) ototalclock += 10; - else if (ud.volume_number == 2) ototalclock += 10; - else if (ud.volume_number == 1) ototalclock += 18; - else ototalclock += 10; + // ouch! + if (t == 10) ototalclock += 14; + else if (t == 9) ototalclock += 10; + else if (t == 7) ototalclock += 18; + else if (t == 6) ototalclock += 14; + else if (t == 5) ototalclock += 9; + else if (ud.volume_number == 3) ototalclock += 10; + else if (ud.volume_number == 2) ototalclock += 10; + else if (ud.volume_number == 1) ototalclock += 18; + else ototalclock += 10; - twod->ClearScreen(); - DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, 3, DTA_Masked, false, TAG_DONE); + twod->ClearScreen(); + DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, 3, DTA_Masked, false, TAG_DONE); - videoNextPage(); - inputState.ClearAllInput(); + videoNextPage(); + inputState.ClearAllInput(); - if (t == 8) endanimvol41(i); - else if (t == 10) endanimvol42(i); - else if (t == 11) endanimvol43(i); - else if (t == 9) intro42animsounds(i); - else if (t == 7) intro4animsounds(i); - else if (t == 6) first4animsounds(i); - else if (t == 5) logoanimsounds(i); - else if (t < 4) endanimsounds(i); - } - } + if (t == 8) endanimvol41(i); + else if (t == 10) endanimvol42(i); + else if (t == 11) endanimvol43(i); + else if (t == 9) intro42animsounds(i); + else if (t == 7) intro4animsounds(i); + else if (t == 6) first4animsounds(i); + else if (t < 4) endanimsounds(i); + } + } - ENDOFANIMLOOP: + ENDOFANIMLOOP: - inputState.ClearAllInput(); + inputState.ClearAllInput(); } //--------------------------------------------------------------------------- @@ -466,394 +453,386 @@ void playanm(const char *fn,char t) // //--------------------------------------------------------------------------- +class DDRealmsScreen : public DScreenJob +{ + int Frame(uint64_t clock, bool skiprequest) override + { + const int duration = 7500; + const auto tex = tileGetTexture(DREALMS); + const int translation = TRANSLATION(Translation_BasePalettes, DREALMSPAL); + + int span = int(clock / 1'000'000); + int light = 255; + if (span < 255) light = span; + else if (span > duration - 255) light = duration - span; + light = clamp(light, 0, 255); + PalEntry pe(255, light, light, light); + DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, 3, DTA_TranslationIndex, translation, DTA_Color, pe, TAG_DONE); + return skiprequest ? -1 : span < duration ? 1 : 0; + } +}; + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +class DTitleScreen : public DScreenJob +{ + int soundanm = 0; + + int Frame(uint64_t nsclock, bool skiprequest) override + { + twod->ClearScreen(); + int clock = nsclock * 120 / 1'000'000'000; + // Make this draw an empty frame before it ends. + if (clock > (860 + 120)) + { + return 0; + } + + auto translation = TRANSLATION(Translation_BasePalettes, TITLEPAL); + uint64_t span = nsclock / 1'000'000; + int light = 255; + if (span < 255) light = span; + //else if (span > duration - 255) light = duration - span; + light = clamp(light, 0, 255); + PalEntry pe(255, light, light, light); + + twod->ClearScreen(); + DrawTexture(twod, tileGetTexture(BETASCREEN), 0, 0, DTA_FullscreenEx, 3, DTA_TranslationIndex, translation, DTA_Color, pe, TAG_DONE); + + if (soundanm == 0 && clock >= 120 && clock < 120 + 60) + { + soundanm = 1; + sound(PIPEBOMB_EXPLODE); + } + if (soundanm == 1 && clock > 220 && clock < (220 + 30)) + { + soundanm = 2; + sound(PIPEBOMB_EXPLODE); + } + if (soundanm == 2 && clock >= 280 && clock < 395) + { + soundanm = 3; + sound(FLY_BY); + } + else if (soundanm == 3 && clock >= 395) + { + soundanm = 4; + sound(PIPEBOMB_EXPLODE); + } + + double scale = clamp(clock - 120, 0, 60) / 64.; + if (scale > 0.) + DrawTexture(twod, tileGetTexture(DUKENUKEM), 160, 104, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, + DTA_CenterOffset, true, DTA_TranslationIndex, translation, DTA_Color, pe, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE); + + scale = clamp(clock - 220, 0, 30) / 32.; + if (scale > 0.) + DrawTexture(twod, tileGetTexture(THREEDEE), 160, 129, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, + DTA_CenterOffset, true, DTA_TranslationIndex, translation, DTA_Color, pe, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE); + + if (PLUTOPAK) + { + scale = (410 - clamp(clock, 280, 395)) / 16.; + if (scale > 0.) + DrawTexture(twod, tileGetTexture(PLUTOPAKSPRITE+1), 160, 151, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, + DTA_CenterOffset, true, DTA_TranslationIndex, translation, DTA_Color, pe, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE); + } + return skiprequest ? -1 : 1; + } +}; + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void Logo(void) { - int soundanm; + Mus_Stop(); + FX_StopAllSounds(); // JBF 20031228 - soundanm = 0; + static const AnimSound logosound[] = + { + { 1, FLY_BY+1 }, + { 19, PIPEBOMB_EXPLODE+1 }, + { -1, -1 } + }; + static const int logoframetimes[] = { 9, 9, 9 }; - ready2send = 0; + PlayVideo(VOLUMEALL && !inputState.CheckAllInput() ? "logo.anm" : nullptr, logosound, logoframetimes, [](bool skipped) + { + S_PlaySpecialMusic(MUS_INTRO); + RunScreenJob(!isNam() ? Create() : nullptr, [](bool skipped) + { + RunScreenJob(Create(), [](bool skipped) + { + sound(NITEVISION_ONOFF); + }); + }); + }); - inputState.ClearAllInput(); - twod->ClearScreen(); - videoNextPage(); - Mus_Stop(); - FX_StopAllSounds(); // JBF 20031228 - if (VOLUMEALL) - { - if (!inputState.CheckAllInput()) - { - //getpackets(); - playanm("logo.anm", 5); - inputState.ClearAllInput(); - } - - twod->ClearScreen(); - videoNextPage(); - } - - S_PlaySpecialMusic(MUS_INTRO); - - if (!isNam()) - { - auto tex = tileGetTexture(DREALMS); - if (tex && tex->isValid()) - { - auto translation = TRANSLATION(Translation_BasePalettes + DREALMSPAL, 0); - - auto start = I_msTime(); - uint64_t span = 0; - inputState.ClearAllInput(); - int color = 0; - uint64_t duration = 7500; - while (span < duration) - { - twod->ClearScreen(); - int light = 255; - if (span < 255) light = span; - else if (span > duration - 255) light = duration - span; - light = clamp(light, 0, 255); - PalEntry pe(255, light, light, light); - DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, 3, DTA_TranslationIndex, translation, DTA_Color, pe, TAG_DONE); - handleevents(); - videoNextPage(); - span = I_msTime() - start; - if (inputState.CheckAllInput()) break; - } - } - } - twod->ClearScreen(); - videoNextPage(); - inputState.ClearAllInput(); - auto translation = TRANSLATION(Translation_BasePalettes + TITLEPAL, 0); - auto start = I_msTime(); - uint64_t span = 0; - int clock = 0; - do - { - int light = 255; - if (span < 255) light = span; - //else if (span > duration - 255) light = duration - span; - light = clamp(light, 0, 255); - PalEntry pe(255, light, light, light); - - twod->ClearScreen(); - DrawTexture(twod, tileGetTexture(BETASCREEN), 0, 0, DTA_FullscreenEx, 3, DTA_TranslationIndex, translation, DTA_Color, pe, TAG_DONE); - - span = I_msTime() - start; - clock = Scale(span, 120, 1000); - if (clock >= 120 && clock < 120+60) - { - if (soundanm == 0) - { - soundanm = 1; - sound(PIPEBOMB_EXPLODE); - } - // Todo: figure out how to translate this call - //DrawTexture(twod, tileGetTexture(DUKENUKEM), 0, 0, DTA_FullscreenEx, 3, DTA_TranslationIndex, translation, DTA_Color, pe, TAG_DONE); - rotatesprite(160 << 16, 104 << 16, clock << 10, 0, DUKENUKEM, 0, 0, 2 + 8, 0, 0, xdim - 1, ydim - 1, nullptr, TITLEPAL); - } - else if (span >= 1500) - rotatesprite(160 << 16, (104) << 16, 60 << 10, 0, DUKENUKEM, 0, 0, 2 + 8, 0, 0, xdim - 1, ydim - 1, nullptr, TITLEPAL); - - if (clock > 220 && clock < (220 + 30)) - { - if (soundanm == 1) - { - soundanm = 2; - sound(PIPEBOMB_EXPLODE); - } - - rotatesprite(160 << 16, (104) << 16, 60 << 10, 0, DUKENUKEM, 0, 0, 2 + 8, 0, 0, xdim - 1, ydim - 1, nullptr, TITLEPAL); - rotatesprite(160 << 16, (129) << 16, (clock - 220) << 11, 0, THREEDEE, 0, 0, 2 + 8, 0, 0, xdim - 1, ydim - 1, nullptr, TITLEPAL); - } - else if (clock >= (220 + 30)) - rotatesprite(160 << 16, (129) << 16, 30 << 11, 0, THREEDEE, 0, 0, 2 + 8, 0, 0, xdim - 1, ydim - 1, nullptr, TITLEPAL); - - if (PLUTOPAK) { // JBF 20030804 - if( clock >= 280 && clock < 395 ) - { - rotatesprite(160 << 16, (151) << 16, (410 - clock) << 12, 0, PLUTOPAKSPRITE + 1, 0, 0, 2 + 8, 0, 0, xdim - 1, ydim - 1, nullptr, TITLEPAL); - if(soundanm == 2) - { - soundanm = 3; - sound(FLY_BY); - } - } - else if( clock >= 395 ) - { - if(soundanm == 3) - { - soundanm = 4; - sound(PIPEBOMB_EXPLODE); - } - rotatesprite(160 << 16, (151) << 16, 30 << 11, 0, PLUTOPAKSPRITE + 1, 0, 0, 2 + 8, 0, 0, xdim - 1, ydim - 1, nullptr, TITLEPAL); - } - } - - videoNextPage(); - handleevents(); - //getpackets(); - } - while(clock < (860+120) && !inputState.CheckAllInput()); - inputState.ClearAllInput(); #if 0 - if(ud.multimode > 1) - { - rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1); + // 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); + 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(); - } + gametext(160,190,"WAITING FOR PLAYERS",14,2); + videoNextPage(); + } - waitforeverybody(); + waitforeverybody(); #endif - twod->ClearScreen(); - videoNextPage(); + twod->ClearScreen(); + videoNextPage(); - sound(NITEVISION_ONOFF); } void dobonus(char bonusonly) { - short t, /*r,*/ tinc,gfx_offset; - //int i, y, xfragtotal, yfragtotal; - short bonuscnt; + short t, /*r,*/ tinc,gfx_offset; + //int i, y, xfragtotal, yfragtotal; + short bonuscnt; - static const int breathe[] = - { - 0, 30,VICTORY1+1,176,59, - 30, 60,VICTORY1+2,176,59, - 60, 90,VICTORY1+1,176,59, - 90, 120,0 ,176,59 - }; + static const int breathe[] = + { + 0, 30,VICTORY1+1,176,59, + 30, 60,VICTORY1+2,176,59, + 60, 90,VICTORY1+1,176,59, + 90, 120,0 ,176,59 + }; - static const int bossmove[] = - { - 0, 120,VICTORY1+3,86,59, - 220, 260,VICTORY1+4,86,59, - 260, 290,VICTORY1+5,86,59, - 290, 320,VICTORY1+6,86,59, - 320, 350,VICTORY1+7,86,59, - 350, 380,VICTORY1+8,86,59 - }; + static const int bossmove[] = + { + 0, 120,VICTORY1+3,86,59, + 220, 260,VICTORY1+4,86,59, + 260, 290,VICTORY1+5,86,59, + 290, 320,VICTORY1+6,86,59, + 320, 350,VICTORY1+7,86,59, + 350, 380,VICTORY1+8,86,59 + }; - bonuscnt = 0; + bonuscnt = 0; - twod->ClearScreen(); - videoNextPage(); + twod->ClearScreen(); + videoNextPage(); - FX_StopAllSounds(); - FX_SetReverb(0); + FX_StopAllSounds(); + FX_SetReverb(0); - if(bonusonly) goto FRAGBONUS; + if(bonusonly) goto FRAGBONUS; - if(numplayers < 2 && ud.eog && ud.from_bonus == 0) - switch(ud.volume_number) - { - case 0: - if(ud.lockout == 0) - { - twod->ClearScreen(); - rotatesprite(0, 50 << 16, 65536L, 0, VICTORY1, 0, 0, 2 + 8 + 16 + 64 + 128, 0, 0, xdim - 1, ydim - 1, nullptr, ENDINGPAL); - videoNextPage(); - //for(t=63;t>=0;t--) palto(0,0,0,t); + if(numplayers < 2 && ud.eog && ud.from_bonus == 0) + switch(ud.volume_number) + { + case 0: + if(ud.lockout == 0) + { + twod->ClearScreen(); + rotatesprite(0, 50 << 16, 65536L, 0, VICTORY1, 0, 0, 2 + 8 + 16 + 64 + 128, 0, 0, xdim - 1, ydim - 1, nullptr, ENDINGPAL); + videoNextPage(); + //for(t=63;t>=0;t--) palto(0,0,0,t); - inputState.ClearAllInput(); - totalclock = 0; tinc = 0; - while( 1 ) - { - twod->ClearScreen(); - rotatesprite(0,50<<16,65536L,0,VICTORY1,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + inputState.ClearAllInput(); + totalclock = 0; tinc = 0; + while( 1 ) + { + twod->ClearScreen(); + rotatesprite(0,50<<16,65536L,0,VICTORY1,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - // boss - if( totalclock > 390 && totalclock < 780 ) - for(t=0;t<35;t+=5) if( bossmove[t+2] && (totalclock%390) > bossmove[t] && (totalclock%390) <= bossmove[t+1] ) - { - if(t==10 && bonuscnt == 1) { sound(SHOTGUN_FIRE);sound(SQUISHED); bonuscnt++; } - rotatesprite(bossmove[t+3]<<16,bossmove[t+4]<<16,65536L,0,bossmove[t+2],0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - } + // boss + if( totalclock > 390 && totalclock < 780 ) + for(t=0;t<35;t+=5) if( bossmove[t+2] && (totalclock%390) > bossmove[t] && (totalclock%390) <= bossmove[t+1] ) + { + if(t==10 && bonuscnt == 1) { sound(SHOTGUN_FIRE);sound(SQUISHED); bonuscnt++; } + rotatesprite(bossmove[t+3]<<16,bossmove[t+4]<<16,65536L,0,bossmove[t+2],0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + } - // Breathe - if( totalclock < 450 || totalclock >= 750 ) - { - if(totalclock >= 750) - { - rotatesprite(86<<16,59<<16,65536L,0,VICTORY1+8,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - if(totalclock >= 750 && bonuscnt == 2) { sound(DUKETALKTOBOSS); bonuscnt++; } - } - for(t=0;t<20;t+=5) - if( breathe[t+2] && (totalclock%120) > breathe[t] && (totalclock%120) <= breathe[t+1] ) - { - if(t==5 && bonuscnt == 0) - { - sound(BOSSTALKTODUKE); - bonuscnt++; - } - rotatesprite(breathe[t+3]<<16,breathe[t+4]<<16,65536L,0,breathe[t+2],0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - } - } + // Breathe + if( totalclock < 450 || totalclock >= 750 ) + { + if(totalclock >= 750) + { + rotatesprite(86<<16,59<<16,65536L,0,VICTORY1+8,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + if(totalclock >= 750 && bonuscnt == 2) { sound(DUKETALKTOBOSS); bonuscnt++; } + } + for(t=0;t<20;t+=5) + if( breathe[t+2] && (totalclock%120) > breathe[t] && (totalclock%120) <= breathe[t+1] ) + { + if(t==5 && bonuscnt == 0) + { + sound(BOSSTALKTODUKE); + bonuscnt++; + } + rotatesprite(breathe[t+3]<<16,breathe[t+4]<<16,65536L,0,breathe[t+2],0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + } + } - //getpackets(); - videoNextPage(); - if( inputState.CheckAllInput() ) break; - } - } + //getpackets(); + videoNextPage(); + if( inputState.CheckAllInput() ) break; + } + } - //for(t=0;t<64;t++) palto(0,0,0,t); + //for(t=0;t<64;t++) palto(0,0,0,t); - inputState.ClearAllInput(); + inputState.ClearAllInput(); - do - { - twod->ClearScreen(); - rotatesprite(0, 0, 65536L, 0, 3292, 0, 0, 2 + 8 + 16 + 64, 0, 0, xdim - 1, ydim - 1); - videoNextPage(); - //for(t=63;t>0;t--) palto(0,0,0,t); - } while (!inputState.CheckAllInput()); //getpackets(); - //for(t=0;t<64;t++) palto(0,0,0,t); - Mus_Stop(); - FX_StopAllSounds(); - break; - case 1: - Mus_Stop(); - twod->ClearScreen(); - videoNextPage(); + do + { + twod->ClearScreen(); + rotatesprite(0, 0, 65536L, 0, 3292, 0, 0, 2 + 8 + 16 + 64, 0, 0, xdim - 1, ydim - 1); + videoNextPage(); + //for(t=63;t>0;t--) palto(0,0,0,t); + } while (!inputState.CheckAllInput()); //getpackets(); + //for(t=0;t<64;t++) palto(0,0,0,t); + Mus_Stop(); + FX_StopAllSounds(); + break; + case 1: + Mus_Stop(); + twod->ClearScreen(); + videoNextPage(); - if(ud.lockout == 0) - { - playanm("cineov2.anm",1); - inputState.ClearAllInput(); - twod->ClearScreen(); - videoNextPage(); - } + if(ud.lockout == 0) + { + playanm("cineov2.anm",1); + inputState.ClearAllInput(); + twod->ClearScreen(); + videoNextPage(); + } - sound(PIPEBOMB_EXPLODE); + sound(PIPEBOMB_EXPLODE); - //for(t=0;t<64;t++) palto(0,0,0,t); - inputState.ClearAllInput(); - do - { - twod->ClearScreen(); - rotatesprite(0, 0, 65536L, 0, 3293, 0, 0, 2 + 8 + 16 + 64, 0, 0, xdim - 1, ydim - 1); - videoNextPage(); - //for(t=63;t>0;t--) palto(0,0,0,t); - } while (!inputState.CheckAllInput()); //getpackets(); - //for(t=0;t<64;t++) palto(0,0,0,t); + //for(t=0;t<64;t++) palto(0,0,0,t); + inputState.ClearAllInput(); + do + { + twod->ClearScreen(); + rotatesprite(0, 0, 65536L, 0, 3293, 0, 0, 2 + 8 + 16 + 64, 0, 0, xdim - 1, ydim - 1); + videoNextPage(); + //for(t=63;t>0;t--) palto(0,0,0,t); + } while (!inputState.CheckAllInput()); //getpackets(); + //for(t=0;t<64;t++) palto(0,0,0,t); - break; + break; - case 3: + case 3: - Mus_Stop(); - twod->ClearScreen(); - videoNextPage(); + Mus_Stop(); + twod->ClearScreen(); + videoNextPage(); - if(ud.lockout == 0) - { - inputState.ClearAllInput(); - playanm("vol4e1.anm",8); - twod->ClearScreen(); - videoNextPage(); - playanm("vol4e2.anm",10); - twod->ClearScreen(); - videoNextPage(); - playanm("vol4e3.anm",11); - twod->ClearScreen(); - videoNextPage(); - } + if(ud.lockout == 0) + { + inputState.ClearAllInput(); + playanm("vol4e1.anm",8); + twod->ClearScreen(); + videoNextPage(); + playanm("vol4e2.anm",10); + twod->ClearScreen(); + videoNextPage(); + playanm("vol4e3.anm",11); + twod->ClearScreen(); + videoNextPage(); + } - FX_StopAllSounds(); - sound(ENDSEQVOL3SND4); - inputState.ClearAllInput(); + FX_StopAllSounds(); + sound(ENDSEQVOL3SND4); + inputState.ClearAllInput(); - //palto(0,0,0,63); - twod->ClearScreen(); - menutext_center(60, GStrings("Thanks to all our")); - menutext_center(60 + 16, GStrings("fans for giving")); - menutext_center(60 + 16 + 16, GStrings("us big heads.")); - menutext_center(70 + 16 + 16 + 16, GStrings("Look for a Duke Nukem 3D")); - menutext_center(70 + 16 + 16 + 16 + 16, GStrings("sequel soon.")); - videoNextPage(); + //palto(0,0,0,63); + twod->ClearScreen(); + menutext_center(60, GStrings("Thanks to all our")); + menutext_center(60 + 16, GStrings("fans for giving")); + menutext_center(60 + 16 + 16, GStrings("us big heads.")); + menutext_center(70 + 16 + 16 + 16, GStrings("Look for a Duke Nukem 3D")); + menutext_center(70 + 16 + 16 + 16 + 16, GStrings("sequel soon.")); + videoNextPage(); - //for(t=63;t>0;t-=3) palto(0,0,0,t); - inputState.ClearAllInput(); - while(!inputState.CheckAllInput()) //getpackets(); - //for(t=0;t<64;t+=3) palto(0,0,0,t); + //for(t=63;t>0;t-=3) palto(0,0,0,t); + inputState.ClearAllInput(); + while(!inputState.CheckAllInput()) //getpackets(); + //for(t=0;t<64;t+=3) palto(0,0,0,t); - twod->ClearScreen(); - videoNextPage(); + twod->ClearScreen(); + videoNextPage(); - playanm("DUKETEAM.ANM",4); + playanm("DUKETEAM.ANM",4); - inputState.ClearAllInput(); - while(!inputState.CheckAllInput()) //getpackets(); + inputState.ClearAllInput(); + while(!inputState.CheckAllInput()) //getpackets(); - twod->ClearScreen(); - videoNextPage(); - //palto(0,0,0,63); + twod->ClearScreen(); + videoNextPage(); + //palto(0,0,0,63); - FX_StopAllSounds(); - inputState.ClearAllInput(); - break; + FX_StopAllSounds(); + inputState.ClearAllInput(); + break; - case 2: + case 2: - Mus_Stop(); - twod->ClearScreen(); - videoNextPage(); - if(ud.lockout == 0) - { - //for(t=63;t>=0;t--) palto(0,0,0,t); - playanm("cineov3.anm",2); - inputState.ClearAllInput(); - ototalclock = totalclock+200; - while(totalclock < ototalclock) //getpackets(); - twod->ClearScreen(); - videoNextPage(); + Mus_Stop(); + twod->ClearScreen(); + videoNextPage(); + if(ud.lockout == 0) + { + //for(t=63;t>=0;t--) palto(0,0,0,t); + playanm("cineov3.anm",2); + inputState.ClearAllInput(); + ototalclock = totalclock+200; + while(totalclock < ototalclock) //getpackets(); + twod->ClearScreen(); + videoNextPage(); - FX_StopAllSounds(); - } + FX_StopAllSounds(); + } - playanm("RADLOGO.ANM",3); + playanm("RADLOGO.ANM",3); - if( ud.lockout == 0 && !inputState.CheckAllInput() ) - { - sound(ENDSEQVOL3SND5); - while (S_CheckSoundPlaying(ENDSEQVOL3SND5, 0)) { handleevents(); /*getpackets();*/ } - if (inputState.CheckAllInput()) goto ENDANM; - sound(ENDSEQVOL3SND6); - while (S_CheckSoundPlaying(ENDSEQVOL3SND6, 0)) { handleevents(); /*getpackets();*/ } - if (inputState.CheckAllInput()) goto ENDANM; - sound(ENDSEQVOL3SND7); - while (S_CheckSoundPlaying(ENDSEQVOL3SND7, 0)) { handleevents(); /*getpackets();*/ } - if (inputState.CheckAllInput()) goto ENDANM; - sound(ENDSEQVOL3SND8); - while (S_CheckSoundPlaying(ENDSEQVOL3SND8, 0)) { handleevents(); /*getpackets();*/ } - if (inputState.CheckAllInput()) goto ENDANM; - sound(ENDSEQVOL3SND9); - while (S_CheckSoundPlaying(ENDSEQVOL3SND9, 0)) { handleevents(); /*getpackets();*/ } - } + if( ud.lockout == 0 && !inputState.CheckAllInput() ) + { + sound(ENDSEQVOL3SND5); + while (S_CheckSoundPlaying(ENDSEQVOL3SND5, 0)) { handleevents(); /*getpackets();*/ } + if (inputState.CheckAllInput()) goto ENDANM; + sound(ENDSEQVOL3SND6); + while (S_CheckSoundPlaying(ENDSEQVOL3SND6, 0)) { handleevents(); /*getpackets();*/ } + if (inputState.CheckAllInput()) goto ENDANM; + sound(ENDSEQVOL3SND7); + while (S_CheckSoundPlaying(ENDSEQVOL3SND7, 0)) { handleevents(); /*getpackets();*/ } + if (inputState.CheckAllInput()) goto ENDANM; + sound(ENDSEQVOL3SND8); + while (S_CheckSoundPlaying(ENDSEQVOL3SND8, 0)) { handleevents(); /*getpackets();*/ } + if (inputState.CheckAllInput()) goto ENDANM; + sound(ENDSEQVOL3SND9); + while (S_CheckSoundPlaying(ENDSEQVOL3SND9, 0)) { handleevents(); /*getpackets();*/ } + } - inputState.ClearAllInput(); - totalclock = 0; - while(!inputState.CheckAllInput() && totalclock < 120) //getpackets(); + inputState.ClearAllInput(); + totalclock = 0; + while(!inputState.CheckAllInput() && totalclock < 120) //getpackets(); - ENDANM: + ENDANM: - FX_StopAllSounds(); - inputState.ClearAllInput(); - twod->ClearScreen(); + FX_StopAllSounds(); + inputState.ClearAllInput(); + twod->ClearScreen(); - break; + break; case 4: if (!isWorldTour()) @@ -894,326 +873,326 @@ void dobonus(char bonusonly) FX_StopAllSounds(); S_ClearSoundLocks(); break; - } + } FRAGBONUS: - ; + ; #if 0 - inputState.ClearAllInput(); - totalclock = 0; tinc = 0; - bonuscnt = 0; + inputState.ClearAllInput(); + totalclock = 0; tinc = 0; + bonuscnt = 0; - Mus_Stop(); - FX_StopAllSounds(); + Mus_Stop(); + FX_StopAllSounds(); - if(playerswhenstarted > 1 && ud.coop != 1 ) - { - if(!(MusicToggle == 0 || MusicDevice == NumSoundCards)) - sound(BONUSMUSIC); + if(playerswhenstarted > 1 && ud.coop != 1 ) + { + if(!(MusicToggle == 0 || MusicDevice == NumSoundCards)) + sound(BONUSMUSIC); - rotatesprite(0,0,65536L,0,MENUSCREEN,16,0,2+8+16+64,0,0,xdim-1,ydim-1); - rotatesprite(160<<16,34<<16,65536L,0,INGAMEDUKETHREEDEE,0,0,10,0,0,xdim-1,ydim-1); + rotatesprite(0,0,65536L,0,MENUSCREEN,16,0,2+8+16+64,0,0,xdim-1,ydim-1); + rotatesprite(160<<16,34<<16,65536L,0,INGAMEDUKETHREEDEE,0,0,10,0,0,xdim-1,ydim-1); #ifndef UK - rotatesprite((260)<<16,36<<16,65536L,0,PLUTOPAKSPRITE+2,0,0,2+8,0,0,xdim-1,ydim-1); + rotatesprite((260)<<16,36<<16,65536L,0,PLUTOPAKSPRITE+2,0,0,2+8,0,0,xdim-1,ydim-1); #endif - gametext(160,58+2,"MULTIPLAYER TOTALS",0,2+8+16); - gametext(160,58+10,level_names[(ud.volume_number*11)+ud.last_level-1],0,2+8+16); + gametext(160,58+2,"MULTIPLAYER TOTALS",0,2+8+16); + gametext(160,58+10,level_names[(ud.volume_number*11)+ud.last_level-1],0,2+8+16); - gametext(160,165,"PRESS ANY KEY TO CONTINUE",0,2+8+16); + gametext(160,165,"PRESS ANY KEY TO CONTINUE",0,2+8+16); - t = 0; - minitext(23,80," NAME KILLS",8,2+8+16+128); - for(i=0;i 1) return; + if(bonusonly || ud.multimode > 1) return; - for(t=0;t<64;t+=7) palto(0,0,0,t); - } + for(t=0;t<64;t+=7) palto(0,0,0,t); + } #endif - if(bonusonly || ud.multimode > 1) return; + if(bonusonly || ud.multimode > 1) return; - switch(ud.volume_number) - { - case 1: - gfx_offset = 5; - break; - default: - gfx_offset = 0; - break; - } + switch(ud.volume_number) + { + case 1: + gfx_offset = 5; + break; + default: + gfx_offset = 0; + break; + } - const char* lastmapname; + const char* lastmapname; - if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0]) - { - lastmapname = strrchr(boardfilename, '\\'); - if (!lastmapname) lastmapname = strrchr(boardfilename, '/'); - if (!lastmapname) lastmapname = boardfilename; - } - else - { - lastmapname = currentLevel->name; - if (!lastmapname || !*lastmapname) // this isn't right but it's better than no name at all - lastmapname = currentLevel->fileName; - } + if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0]) + { + lastmapname = strrchr(boardfilename, '\\'); + if (!lastmapname) lastmapname = strrchr(boardfilename, '/'); + if (!lastmapname) lastmapname = boardfilename; + } + else + { + lastmapname = currentLevel->name; + if (!lastmapname || !*lastmapname) // this isn't right but it's better than no name at all + lastmapname = currentLevel->fileName; + } - rotatesprite(0,0,65536L,0,BONUSSCREEN+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + rotatesprite(0,0,65536L,0,BONUSSCREEN+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - menutext_center(20-6,lastmapname); - menutext_center(36-6,"COMPLETED"); + menutext_center(20-6,lastmapname); + menutext_center(36-6,"COMPLETED"); - gametext(160,192,"PRESS ANY KEY TO CONTINUE",16,2+8+16); + gametext(160,192,"PRESS ANY KEY TO CONTINUE",16,2+8+16); - if (MusicEnabled() && mus_enabled) - S_PlaySound(BONUSMUSIC, CHAN_AUTO, CHANF_UI); + if (MusicEnabled() && mus_enabled) + S_PlaySound(BONUSMUSIC, CHAN_AUTO, CHANF_UI); - videoNextPage(); - inputState.ClearAllInput(); - //for(t=0;t<64;t++) palto(0,0,0,63-t); - bonuscnt = 0; - totalclock = 0; tinc = 0; + videoNextPage(); + inputState.ClearAllInput(); + //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) - { - rotatesprite(0,0,65536L,0,BONUSSCREEN+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + while( 1 ) + { + if(ps[myconnectindex].gm&MODE_EOL) + { + rotatesprite(0,0,65536L,0,BONUSSCREEN+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - if( totalclock > (1000000000L) && totalclock < (1000000320L) ) - { - switch( ((int)totalclock>>4)%15 ) - { - case 0: - if(bonuscnt == 6) - { - bonuscnt++; - sound(SHOTGUN_COCK); - switch(rand()&3) - { - case 0: - sound(BONUS_SPEECH1); - break; - case 1: - sound(BONUS_SPEECH2); - break; - case 2: - sound(BONUS_SPEECH3); - break; - case 3: - sound(BONUS_SPEECH4); - break; - } - } - case 1: - case 4: - case 5: - rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+3+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - break; - case 2: - case 3: - rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+4+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - break; - } - } - else if( totalclock > (10240+120L) ) break; - else - { - switch( ((int)totalclock>>5)&3 ) - { - case 1: - case 3: - rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+1+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - break; - case 2: - rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+2+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - break; - } - } + if( totalclock > (1000000000L) && totalclock < (1000000320L) ) + { + switch( ((int)totalclock>>4)%15 ) + { + case 0: + if(bonuscnt == 6) + { + bonuscnt++; + sound(SHOTGUN_COCK); + switch(rand()&3) + { + case 0: + sound(BONUS_SPEECH1); + break; + case 1: + sound(BONUS_SPEECH2); + break; + case 2: + sound(BONUS_SPEECH3); + break; + case 3: + sound(BONUS_SPEECH4); + break; + } + } + case 1: + case 4: + case 5: + rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+3+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + break; + case 2: + case 3: + rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+4+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + break; + } + } + else if( totalclock > (10240+120L) ) break; + else + { + switch( ((int)totalclock>>5)&3 ) + { + case 1: + case 3: + rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+1+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + break; + case 2: + rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+2+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + break; + } + } - menutext_center(20-6,lastmapname); - menutext_center(36-6,"COMPLETED"); + menutext_center(20-6,lastmapname); + menutext_center(36-6,"COMPLETED"); - gametext(160,192,"PRESS ANY KEY TO CONTINUE",16,2+8+16); + gametext(160,192,"PRESS ANY KEY TO CONTINUE",16,2+8+16); - if( totalclock > (60*3) ) - { - gametext(10,59+9,"Your Time:",0,2+8+16); - gametext(10,69+9,"Par time:",0,2+8+16); - if (!isNamWW2GI()) - gametext(10,78+9,"3D Realms' Time:",0,2+8+16); + if( totalclock > (60*3) ) + { + gametext(10,59+9,"Your Time:",0,2+8+16); + gametext(10,69+9,"Par time:",0,2+8+16); + if (!isNamWW2GI()) + gametext(10,78+9,"3D Realms' Time:",0,2+8+16); - if(bonuscnt == 0) - bonuscnt++; + if(bonuscnt == 0) + bonuscnt++; - if( totalclock > (60*4) ) - { - if(bonuscnt == 1) - { - bonuscnt++; - sound(PIPEBOMB_EXPLODE); - } - sprintf(tempbuf,"%02ld:%02ld", - (ps[myconnectindex].player_par/(26*60))%60, - (ps[myconnectindex].player_par/26)%60); - gametext((320>>2)+71,60+9,tempbuf,0,2+8+16); + if( totalclock > (60*4) ) + { + if(bonuscnt == 1) + { + bonuscnt++; + sound(PIPEBOMB_EXPLODE); + } + sprintf(tempbuf,"%02ld:%02ld", + (ps[myconnectindex].player_par/(26*60))%60, + (ps[myconnectindex].player_par/26)%60); + gametext((320>>2)+71,60+9,tempbuf,0,2+8+16); - sprintf(tempbuf,"%02ld:%02ld", - (currentLevel->parTime / (26*60))%60, - (currentLevel->parTime / 26)%60); - gametext((320>>2)+71,69+9,tempbuf,0,2+8+16); + sprintf(tempbuf,"%02ld:%02ld", + (currentLevel->parTime / (26*60))%60, + (currentLevel->parTime / 26)%60); + gametext((320>>2)+71,69+9,tempbuf,0,2+8+16); - if (!isNamWW2GI()) - { - sprintf(tempbuf, "%02ld:%02ld", - (currentLevel->designerTime / (26 * 60)) % 60, - (currentLevel->designerTime / 26) % 60); - gametext((320 >> 2) + 71, 78 + 9, tempbuf, 0, 2 + 8 + 16); - } + if (!isNamWW2GI()) + { + sprintf(tempbuf, "%02ld:%02ld", + (currentLevel->designerTime / (26 * 60)) % 60, + (currentLevel->designerTime / 26) % 60); + gametext((320 >> 2) + 71, 78 + 9, tempbuf, 0, 2 + 8 + 16); + } - } - } - if( totalclock > (60*6) ) - { - gametext(10,94+9,"Enemies Killed:",0,2+8+16); - gametext(10,99+4+9,"Enemies Left:",0,2+8+16); + } + } + if( totalclock > (60*6) ) + { + gametext(10,94+9,"Enemies Killed:",0,2+8+16); + gametext(10,99+4+9,"Enemies Left:",0,2+8+16); - if(bonuscnt == 2) - { - bonuscnt++; - sound(FLY_BY); - } + if(bonuscnt == 2) + { + bonuscnt++; + sound(FLY_BY); + } - if( totalclock > (60*7) ) - { - if(bonuscnt == 3) - { - bonuscnt++; - sound(PIPEBOMB_EXPLODE); - } - sprintf(tempbuf,"%-3ld",ps[myconnectindex].actors_killed); - gametext((320>>2)+70,93+9,tempbuf,0,2+8+16); - if(ud.player_skill > 3 ) - { - sprintf(tempbuf,"N/A"); - gametext((320>>2)+70,99+4+9,tempbuf,0,2+8+16); - } - 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); - gametext((320>>2)+70,99+4+9,tempbuf,0,2+8+16); - } - } - } - if( totalclock > (60*9) ) - { - gametext(10,120+9,"Secrets Found:",0,2+8+16); - gametext(10,130+9,"Secrets Missed:",0,2+8+16); - if(bonuscnt == 4) bonuscnt++; + if( totalclock > (60*7) ) + { + if(bonuscnt == 3) + { + bonuscnt++; + sound(PIPEBOMB_EXPLODE); + } + sprintf(tempbuf,"%-3ld",ps[myconnectindex].actors_killed); + gametext((320>>2)+70,93+9,tempbuf,0,2+8+16); + if(ud.player_skill > 3 ) + { + sprintf(tempbuf,"N/A"); + gametext((320>>2)+70,99+4+9,tempbuf,0,2+8+16); + } + 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); + gametext((320>>2)+70,99+4+9,tempbuf,0,2+8+16); + } + } + } + if( totalclock > (60*9) ) + { + gametext(10,120+9,"Secrets Found:",0,2+8+16); + gametext(10,130+9,"Secrets Missed:",0,2+8+16); + if(bonuscnt == 4) bonuscnt++; - if( totalclock > (60*10) ) - { - if(bonuscnt == 5) - { - bonuscnt++; - sound(PIPEBOMB_EXPLODE); - } - sprintf(tempbuf,"%-3d",ps[myconnectindex].secret_rooms); - gametext((320>>2)+70,120+9,tempbuf,0,2+8+16); - if( ps[myconnectindex].secret_rooms > 0 ) - sprintf(tempbuf,"%-3d",(100*ps[myconnectindex].secret_rooms/ps[myconnectindex].max_secret_rooms)); - sprintf(tempbuf,"%-3d",ps[myconnectindex].max_secret_rooms-ps[myconnectindex].secret_rooms); - gametext((320>>2)+70,130+9,tempbuf,0,2+8+16); - } - } + if( totalclock > (60*10) ) + { + if(bonuscnt == 5) + { + bonuscnt++; + sound(PIPEBOMB_EXPLODE); + } + sprintf(tempbuf,"%-3d",ps[myconnectindex].secret_rooms); + gametext((320>>2)+70,120+9,tempbuf,0,2+8+16); + if( ps[myconnectindex].secret_rooms > 0 ) + sprintf(tempbuf,"%-3d",(100*ps[myconnectindex].secret_rooms/ps[myconnectindex].max_secret_rooms)); + sprintf(tempbuf,"%-3d",ps[myconnectindex].max_secret_rooms-ps[myconnectindex].secret_rooms); + gametext((320>>2)+70,130+9,tempbuf,0,2+8+16); + } + } - if(totalclock > 10240 && totalclock < 10240+10240) - totalclock = 1024; + if(totalclock > 10240 && totalclock < 10240+10240) + totalclock = 1024; - if( inputState.CheckAllInput() && totalclock > (60*2) ) - { - if( totalclock < (60*13) ) - { - inputState.ClearAllInput(); - totalclock = (60*13); - } - else if( totalclock < (1000000000L)) - totalclock = (1000000000L); - } - } - else break; - videoNextPage(); - } + if( inputState.CheckAllInput() && totalclock > (60*2) ) + { + if( totalclock < (60*13) ) + { + inputState.ClearAllInput(); + totalclock = (60*13); + } + else if( totalclock < (1000000000L)) + totalclock = (1000000000L); + } + } + else break; + videoNextPage(); + } } diff --git a/source/games/duke/src/zz_screens.cpp b/source/games/duke/src/zz_screens.cpp index 86fe924e5..0226c38c7 100644 --- a/source/games/duke/src/zz_screens.cpp +++ b/source/games/duke/src/zz_screens.cpp @@ -1069,12 +1069,13 @@ void G_DisplayExtraScreens(void) } } -void Logo(); +void Logo_d(); +void Logo_r(); void G_DisplayLogo(void) { if (!isRR()) { - Logo(); + Logo_d(); return; } int32_t soundanm = 0; @@ -1144,159 +1145,6 @@ void G_DisplayLogo(void) videoClearScreen(0L); return; } - if (!g_noLogo && !userConfig.nologo /* && (!g_netServer && ud.multimode < 2) */) - { - if (VOLUMEALL) - { - if (!inputState.CheckAllInput() && g_noLogoAnim == 0 && !userConfig.nologo) - { - Net_GetPackets(); - Anim_Play("logo.anm"); - G_FadePalette(0, 0, 0, 252); - inputState.ClearAllInput(); - } - - videoClearScreen(0L); - videoNextPage(); - FX_StopAllSounds(); - S_ClearSoundLocks(); - } - - S_PlaySpecialMusic(MUS_INTRO); - - //g_player[myconnectindex].ps->palette = drealms; - //G_FadePalette(0,0,0,252); - - if (!inputState.CheckAllInput() && g_noLogoAnim == 0 && !userConfig.nologo) - { - Net_GetPackets(); - - if (fileSystem.FileExists("3dr.ivf") || fileSystem.FileExists("3dr.anm")) - { - Anim_Play("3dr.anm"); - G_FadePalette(0, 0, 0, 252); - inputState.ClearAllInput(); - } - else - { - videoClearScreen(0); - - fadepal(0, 0, 0, 0, 252, 28); - renderFlushPerms(); - rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, TILE_DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH, nullptr, DREALMSPAL); - videoNextPage(); - fadepaltile(0, 0, 0, 252, 0, -28, TILE_DREALMS, DREALMSPAL); - totalclock = 0; - - while (totalclock < (120 * 7) && !inputState.CheckAllInput()) - { - if (G_FPSLimit()) - { - videoClearScreen(0); - rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, TILE_DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH, nullptr, DREALMSPAL); - G_HandleAsync(); - videoNextPage(); - } - } - - fadepaltile(0, 0, 0, 0, 252, 28, TILE_DREALMS, DREALMSPAL); - } - } - - videoClearScreen(0L); - videoNextPage(); - - inputState.ClearAllInput(); - - videoClearScreen(0L); - videoNextPage(); - - videoClearScreen(0); - - //g_player[myconnectindex].ps->palette = titlepal; - renderFlushPerms(); - rotatesprite_fs(160<<16, 100<<16, 65536L, 0, TILE_BETASCREEN, 0, 0, 2+8+64+BGSTRETCH, nullptr, TITLEPAL); - inputState.keyFlushChars(); - fadepaltile(0, 0, 0, 252, 0, -28, TILE_BETASCREEN, TITLEPAL); - totalclock = 0; - - while ( - totalclock < (860+120) && - !inputState.CheckAllInput()) - { - if (G_FPSLimit()) - { - videoClearScreen(0); - rotatesprite_fs(160<<16, 100<<16, 65536L, 0, TILE_BETASCREEN, 0, 0, 2+8+64+BGSTRETCH, nullptr, TITLEPAL); - - if (totalclock > 120 && totalclock < (120+60)) - { - if (soundanm == 0) - { - soundanm++; - S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI); - } - rotatesprite_fs(160<<16, 104<<16, ((int32_t) totalclock-120)<<10, 0, TILE_DUKENUKEM, 0, 0, 2+8, nullptr, TITLEPAL); - } - else if (totalclock >= (120+60)) - rotatesprite_fs(160<<16, (104)<<16, 60<<10, 0, TILE_DUKENUKEM, 0, 0, 2+8, nullptr, TITLEPAL); - - if (totalclock > 220 && totalclock < (220+30)) - { - if (soundanm == 1) - { - soundanm++; - S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI); - } - - rotatesprite_fs(160<<16, (104)<<16, 60<<10, 0, TILE_DUKENUKEM, 0, 0, 2+8, nullptr, TITLEPAL); - rotatesprite_fs(160<<16, (129)<<16, ((int32_t) totalclock - 220)<<11, 0, TILE_THREEDEE, 0, 0, 2+8, nullptr, TITLEPAL); - } - else if (totalclock >= (220+30)) - rotatesprite_fs(160<<16, (129)<<16, 30<<11, 0, TILE_THREEDEE, 0, 0, 2+8, nullptr, TITLEPAL); - - if (PLUTOPAK) - { - // JBF 20030804 - if (totalclock >= 280 && totalclock < 395) - { - rotatesprite_fs(160<<16, (151)<<16, (410-(int32_t) totalclock)<<12, 0, TILE_PLUTOPAKSPRITE+1, (sintable[((int32_t) totalclock<<4)&2047]>>11), 0, 2+8, nullptr, TITLEPAL); - if (soundanm == 2) - { - soundanm++; - S_PlaySound(FLY_BY, CHAN_AUTO, CHANF_UI); - } - } - else if (totalclock >= 395) - { - if (soundanm == 3) - { - soundanm++; - S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI); - } - rotatesprite_fs(160<<16, (151)<<16, 30<<11, 0, TILE_PLUTOPAKSPRITE+1, (sintable[((int32_t) totalclock<<4)&2047]>>11), 0, 2+8, nullptr, TITLEPAL); - } - } - - videoNextPage(); - } - - G_HandleAsync(); - } - - inputState.ClearAllInput(); - } - - renderFlushPerms(); - videoClearScreen(0L); - videoNextPage(); - - //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); } void G_DoOrderScreen(void) diff --git a/source/sw/src/anim.cpp b/source/sw/src/anim.cpp index 928166b65..c73df89ee 100644 --- a/source/sw/src/anim.cpp +++ b/source/sw/src/anim.cpp @@ -260,7 +260,6 @@ playanm(short anim_num) goto ENDOFANIMLOOP; } - ANIM_LoadAnim(&anm, buffer.Data(), buffer.Size()-1); ANIMnumframes = ANIM_NumFrames(&anm); numframes = ANIMnumframes; diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs index 02aacf4f9..982a9afe3 100644 --- a/wadsrc/static/zscript/base.zs +++ b/wadsrc/static/zscript/base.zs @@ -155,6 +155,8 @@ enum DrawTextureTags DTA_FullscreenEx, // advanced fullscreen control. DTA_FullscreenScale, // enable DTA_Fullscreen coordinate calculation for placed overlays. + DTA_ScaleX, // scales the patch dimensions before applying any other transformation. + DTA_ScaleY, };