// Custom intermission screens Class SWWMStatScreen : StatusScreen { TextureID frametex, arttex, bgtex; int glarestr, sndcnt; int whichart, whichtip; int tipalphastate; double tipalpha; String tipstr; transient BrokenLines tipl; Font TewiFont, TewiFontOutline, MiniwiFont; double FracTic; // for smooth animations bool bNoDrawNextLoc; int tipflash; // for switching int tipheight; // total height of tip box w/ padding int mtipheight; // precalculated on start, minimum tip height to always // shift up for int topheight; // precalculated on start, maximum potential height of // level finished + stats + entering level w/ padding // // both of these are used to "shift up" the top // elements in case they could overlap with the tip box // customizable colors int lnamecolor, lauthcolor; // name / author text int lsubcolor; // finished / entering text int statbasecolor, statcolor0, // stat label / color for numbers statcolor1, statcolor2; // color for 100% / color for SUCKS int tipcolor0, tipcolor1; // tip header / tip text Color glarecolor; // for the eye glare when advancing int flashcolor, tipflashcolor; int hs, oldhs, oldwidth; double bgfade; bool bFade; SWWMStaticHandler shnd; override void Start( wbstartstruct wbstartstruct ) { Super.Start(wbstartstruct); TewiFont = Font.GetFont('TewiFont'); TewiFontOutline = Font.GetFont('TewiFontOutline'); MiniwiFont = Font.GetFont('MiniwiFont'); int iof; for ( int i=0; i<=1; i++ ) { // level name may contain trailing whitespace due to DEHACKED nonsense, so strip it lnametexts[i].StripRight(); if ( authortexts[i] != "" ) continue; // support for old author text style if ( (iof = lnametexts[i].RightIndexOf(" - by: ")) != -1 ) // 20 heretics, spooktober { authortexts[i] = lnametexts[i].Mid(iof+7); lnametexts[i].Truncate(iof); } else if ( (iof = lnametexts[i].RightIndexOf(" - by ")) != -1 ) // variation seen in DOOMIUM { authortexts[i] = lnametexts[i].Mid(iof+6); lnametexts[i].Truncate(iof); } else if ( (iof = lnametexts[i].RightIndexOf(" - ")) != -1 ) // hexmas and many others (may cause false positives?) { authortexts[i] = lnametexts[i].Mid(iof+3); lnametexts[i].Truncate(iof); } } tipalpha = -1.; hs = CleanXFac_1; oldhs = hs; oldwidth = Screen.GetWidth(); int statheight = TewiFont.GetHeight()*(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime))+32; int lfheight = (authortexts[0]!="")?(MiniwiFont.GetHeight()+TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2):(TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2); int elheight = (wbs.next=="")?0:((authortexts[1]!="")?(MiniwiFont.GetHeight()+TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2):(TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2)); topheight = (statheight+lfheight+elheight+32); mtipheight = (5*TewiFont.GetHeight()+32); // tips don't generally go past 5 lines in height // defaults lnamecolor = Font.CR_WHITE; lauthcolor = Font.CR_DARKGRAY; lsubcolor = Font.CR_SAPPHIRE; statbasecolor = Font.CR_SAPPHIRE; statcolor0 = Font.CR_WHITE; statcolor1 = Font.CR_GOLD; statcolor2 = Font.CR_RED; tipcolor0 = Font.CR_SAPPHIRE; tipcolor1 = Font.CR_WHITE; flashcolor = Font.FindFontColor('MiniFlash'); tipflashcolor = Font.FindFontColor('MiniWhiteFlash'); glarecolor = 0xFF4080FF; } override void StartMusic() { S_ChangeMusic("music/DRAGONY.XM"); } private String StatCnt( int a, int b ) { if ( b <= 0 ) return "N/A"; return String.Format("%s \cu/\c- %s \cu(\c-%3d%%\cu)",SWWMUtility.ThousandsNum(max(a,0)),SWWMUtility.ThousandsNum(b),GetPct(a,b)); } private String TimeStr( int secs ) { secs = max(secs,0); int h = secs/3600; int m = (secs/60)%60; int s = secs%60; if ( h ) return String.Format("%02d\cu:\c-%02d\cu:\c-%02d",h,m,s); return String.Format("%02d\cu:\c-%02d",m,s); } private int GetPct( int a, int b ) { if ( a < 0 ) return 0; if ( b <= 0 ) return 100; // for "missed" percentage return (a*100)/b; } // recycled KBase code, heh private void DrawBox( double x, double y, double w, double h, double intp = 1. ) { if ( !frametex ) frametex = TexMan.CheckForTexture("graphics/KBase/FrameTex.png"); double xfact = clamp(intp*2.,0.,1.)**2.; double yfact = clamp(intp,0.,1.)**5.; int rw = int(SWWMUtility.Lerp(-10*hs,w,xfact)); int rh = int(SWWMUtility.Lerp(-5*hs,h,yfact)); if ( intp <= 0. ) return; int rx = int(x+(w-rw)/2); int ry = int(y+(h-rh)/2); // dim padding rx -= 4*hs; ry -= 2*hs; rw += 8*hs; rh += 4*hs; Screen.Dim("Black",.8,rx,ry,rw,rh); // border outside rx -= hs; ry -= hs; rw += 2*hs; rh += 2*hs; Screen.DrawTexture(FrameTex,false,rx,ry,DTA_SrcX,0.,DTA_SrcY,0.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,hs,DTA_DestHeight,hs); if ( rw > 2*hs ) Screen.DrawTexture(FrameTex,false,rx+hs,ry,DTA_SrcX,1.,DTA_SrcY,0.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,rw-2*hs,DTA_DestHeight,hs); if ( rh > 2*hs ) Screen.DrawTexture(FrameTex,false,rx,ry+hs,DTA_SrcX,0.,DTA_SrcY,1.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,hs,DTA_DestHeight,rh-2*hs); Screen.DrawTexture(FrameTex,false,(rx+rw)-hs,ry,DTA_SrcX,2.,DTA_SrcY,0.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,hs,DTA_DestHeight,hs); Screen.DrawTexture(FrameTex,false,rx,(ry+rh)-hs,DTA_SrcX,0.,DTA_SrcY,2.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,hs,DTA_DestHeight,hs); if ( rh > 2*hs ) Screen.DrawTexture(FrameTex,false,(rx+rw)-hs,ry+hs,DTA_SrcX,2.,DTA_SrcY,1.,DTA_SrcWidth,2.,DTA_SrcHeight,1.,DTA_DestWidth,2*hs,DTA_DestHeight,rh-2*hs); if ( rw > 2*hs ) Screen.DrawTexture(FrameTex,false,rx+hs,(ry+rh)-hs,DTA_SrcX,1.,DTA_SrcY,2.,DTA_SrcWidth,1.,DTA_SrcHeight,2.,DTA_DestWidth,rw-2*hs,DTA_DestHeight,2*hs); Screen.DrawTexture(FrameTex,false,(rx+rw)-hs,(ry+rh)-hs,DTA_SrcX,2.,DTA_SrcY,2.,DTA_SrcWidth,2.,DTA_SrcHeight,2.,DTA_DestWidth,2*hs,DTA_DestHeight,2*hs); } override int DrawLF() { if ( sp_state < 1 ) return 0; double GameSecs = (bcnt+FracTic)/double(GameTicRate); int th = (TewiFont.GetHeight()*(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime))+32)*hs; // height of the stats box + margin int bh = ((authortexts[0]!="")?(MiniwiFont.GetHeight()+TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2):(TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2))*hs; // height of the "level finished" box double xx = Screen.GetWidth()/2; double yy = (Screen.GetHeight()-th)/2; // shift up if we overlap w/ tip box int tipyy = Screen.GetHeight()-max(tipheight,mtipheight)*hs; int topyy = (Screen.GetHeight()+topheight*hs)/2; if ( topyy > tipyy ) { // upshift to fit tips yy -= topyy-tipyy; } yy -= bh; String str = StringTable.Localize("$SWWM_INTERDONE"); int bw = max(TewiFont.StringWidth(lnametexts[0])*2,TewiFontOutline.StringWidth(str)*2); if ( authortexts[0] != "" ) bw = max(bw,MiniwiFont.StringWidth(authortexts[0])); bw += 4; bw *= hs; DrawBox(xx-bw/2,yy,bw,bh); Screen.DrawText(TewiFont,lnamecolor,xx-TewiFont.StringWidth(lnametexts[0])*hs,yy,lnametexts[0],DTA_ScaleX,hs*2,DTA_ScaleY,hs*2); yy += TewiFont.GetHeight()*2*hs; if ( authortexts[0] != "" ) { Screen.DrawText(MiniwiFont,lauthcolor,xx-MiniwiFont.StringWidth(authortexts[0])*hs/2,yy,authortexts[0],DTA_ScaleX,hs,DTA_ScaleY,hs); yy += MiniwiFont.GetHeight()*hs; } Screen.DrawText(TewiFontOutline,lsubcolor,xx-TewiFontOutline.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs*2,DTA_ScaleY,hs*2); if ( (glarestr > 0) && (sp_state < 2) ) { double alf = clamp((glarestr-FracTic)/20.,0.,1.)**2; Screen.DrawText(TewiFontOutline,flashcolor,xx-TewiFontOutline.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs*2,DTA_ScaleY,hs*2,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alf); } return 0; } override void DrawEL() { int th = (TewiFont.GetHeight()*(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime))+32)*hs; // height of the stats box + margin int bh = ((authortexts[1]!="")?(MiniwiFont.GetHeight()+TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2):(TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2))*hs; // height of the "level finished" box double xx = Screen.GetWidth()/2; double yy = (Screen.GetHeight()+th)/2; // shift up if we overlap w/ tip box int tipyy = Screen.GetHeight()-max(tipheight,mtipheight)*hs; int topyy = (Screen.GetHeight()+topheight*hs)/2; if ( topyy > tipyy ) { // upshift to fit tips yy -= topyy-tipyy; } String str = StringTable.Localize("$SWWM_INTERNEXT"); int bw = max(TewiFont.StringWidth(lnametexts[1])*2,TewiFontOutline.StringWidth(str)*2); if ( authortexts[1] != "" ) bw = max(bw,MiniwiFont.StringWidth(authortexts[1])); bw += 4; bw *= hs; DrawBox(xx-bw/2,yy,bw,bh); Screen.DrawText(TewiFontOutline,lsubcolor,xx-TewiFontOutline.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs*2,DTA_ScaleY,hs*2); if ( (glarestr > 0) && (sp_state >= 10) ) { double alf = clamp((glarestr-FracTic)/20.,0.,1.)**2; Screen.DrawText(TewiFontOutline,flashcolor,xx-TewiFontOutline.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs*2,DTA_ScaleY,hs*2,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alf); } yy += TewiFontOutline.GetHeight()*2*hs; Screen.DrawText(TewiFont,lnamecolor,xx-TewiFont.StringWidth(lnametexts[1])*hs,yy,lnametexts[1],DTA_ScaleX,hs*2,DTA_ScaleY,hs*2); yy += TewiFont.GetHeight()*2*hs; if ( authortexts[0] == "" ) return; Screen.DrawText(MiniwiFont,lauthcolor,xx-MiniwiFont.StringWidth(authortexts[1])*hs/2,yy,authortexts[1],DTA_ScaleX,hs,DTA_ScaleY,hs); } override void drawStats( void ) { if ( sp_state < 2 ) return; int ne = (sp_state>=8)?(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime)):(sp_state>=6)?6:(sp_state>=4)?4:2; int th = (TewiFont.GetHeight()*ne)*hs; // height of the stats box double xx = Screen.GetWidth()/2; double yy = (Screen.GetHeight()-th)/2; // shift up if we overlap w/ tip box int tipyy = Screen.GetHeight()-max(tipheight,mtipheight)*hs; int topyy = (Screen.GetHeight()+topheight*hs)/2; if ( topyy > tipyy ) { // upshift to fit tips yy -= topyy-tipyy; } DrawBox(xx-80.*hs,yy,160.*hs,th); String str = StringTable.Localize("$SWWM_INTERKILLS"); Screen.DrawText(TewiFont,statbasecolor,xx-80*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); yy += TewiFont.GetHeight()*hs; str = StatCnt(cnt_kills[0],wbs.maxkills); Screen.DrawText(TewiFont,((wbs.maxkills>0)&&(cnt_kills[0]>=wbs.maxkills))?statcolor1:statcolor0,xx+80*hs-TewiFont.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); if ( sp_state < 4 ) return; yy += TewiFont.GetHeight()*hs; str = StringTable.Localize("$SWWM_INTERITEMS"); Screen.DrawText(TewiFont,statbasecolor,xx-80*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); yy += TewiFont.GetHeight()*hs; str = StatCnt(cnt_items[0],wbs.maxitems); Screen.DrawText(TewiFont,((wbs.maxitems>0)&&(cnt_items[0]>=wbs.maxitems))?statcolor1:statcolor0,xx+80*hs-TewiFont.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); if ( sp_state < 6 ) return; yy += TewiFont.GetHeight()*hs; str = StringTable.Localize("$SWWM_INTERSECRETS"); Screen.DrawText(TewiFont,statbasecolor,xx-80*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); yy += TewiFont.GetHeight()*hs; str = StatCnt(cnt_secret[0],wbs.maxsecret); Screen.DrawText(TewiFont,((wbs.maxsecret>0)&&(cnt_secret[0]>=wbs.maxsecret))?statcolor1:statcolor0,xx+80*hs-TewiFont.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); if ( sp_state < 8 ) return; yy += TewiFont.GetHeight()*hs; str = "┈┈┄┄╌╌────╌╌┄┄┈┈"; Screen.DrawText(TewiFont,statbasecolor,xx-TewiFont.StringWidth(str)*hs/2,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); yy += TewiFont.GetHeight()*hs; str = StringTable.Localize("$SWWM_INTERTIME"); Screen.DrawText(TewiFont,statbasecolor,xx-80*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); str = TimeStr(max(cnt_time,0)); Screen.DrawText(TewiFont,(wbs.partime&&(cnt_time<=(wbs.partime/GameTicRate)))?statcolor1:((wbs.sucktime>0)&&(cnt_time>(wbs.sucktime*3600)))?statcolor2:statcolor0,xx+80*hs-TewiFont.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); if ( wbs.partime ) { yy += TewiFont.GetHeight()*hs; str = StringTable.Localize("$SWWM_INTERPAR"); Screen.DrawText(TewiFont,statbasecolor,xx-80*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); str = TimeStr(max(cnt_par,0)); Screen.DrawText(TewiFont,statcolor0,xx+80*hs-TewiFont.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); } if ( wbs.totaltime == Plrs[me].stime ) return; yy += TewiFont.GetHeight()*hs; str = StringTable.Localize("$SWWM_INTERTOTAL"); Screen.DrawText(TewiFont,statbasecolor,xx-80*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); str = TimeStr(max(cnt_total_time,0)); Screen.DrawText(TewiFont,statcolor0,xx+80*hs-TewiFont.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); } private void drawSWWMBg() { if ( !shnd ) shnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler")); if ( !whichart ) { int no = StringTable.Localize("$SWWM_NRENDER").ToInt(); Array ents; ents.Clear(); int rno = 0; for ( int i=1; i<=no; i++ ) { ents.Push(i); rno++; } no = rno; if ( shnd.lastart.Size() >= no ) { // exclude last one, start over int excludeme = shnd.lastart[shnd.lastart.Size()-1]; ents.Delete(excludeme-1); shnd.lastart.Clear(); } else { foreach ( la:shnd.lastart ) { int f = ents.Find(la); if ( f != ents.Size() ) ents.Delete(f); } } whichart = ents[Random[InterArt](0,ents.Size()-1)]; shnd.lastart.Push(whichart); } double ar = Screen.GetAspectRatio(), sar; Vector2 tsize, vsize; Screen.Clear(0,0,Screen.GetWidth(),Screen.GetHeight(),"Black"); // background pics if ( whichart ) { String artstr = StringTable.Localize(String.Format("$SWWM_RENDER%d",whichart)); if ( !arttex ) arttex = TexMan.CheckForTexture("graphics/Renders/"..artstr); tsize = TexMan.GetScaledSize(arttex); sar = tsize.x/tsize.y; if ( sar > ar ) vsize = (tsize.y*ar,tsize.y); else if ( sar < ar ) vsize = (tsize.x,tsize.x/ar); else vsize = tsize; Screen.DrawTexture(arttex,false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true); } } private void drawSWWMFg() { if ( !shnd ) shnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler")); // intermission tips at the bottom if ( !whichtip ) { int maxtip = StringTable.Localize("$SWWM_NINTERTIP").ToInt(); Array ents; ents.Clear(); for ( int i=1; i<=maxtip; i++ ) ents.Push(i); if ( shnd.lasttip.Size() >= maxtip ) { // exclude last one, start over int excludeme = shnd.lasttip[shnd.lasttip.Size()-1]; ents.Delete(excludeme-1); shnd.lasttip.Clear(); } else { foreach ( lt:shnd.lasttip ) { int f = ents.Find(lt); if ( f != ents.Size() ) ents.Delete(f); } } whichtip = ents[Random[InterArt](0,ents.Size()-1)]; tipstr = String.Format(StringTable.Localize("$SWWM_INTERTIP"),whichtip).."\n"..StringTable.Localize(String.Format("$SWWM_INTERTIP%d",whichtip)); if ( tipl ) tipl.Destroy(); shnd.lasttip.Push(whichtip); } if ( ((hs != oldhs) || (Screen.GetWidth() != oldwidth)) && tipl ) tipl.Destroy(); oldhs = hs; oldwidth = Screen.GetWidth(); int maxw = min(400,Screen.GetWidth()/hs-32); if ( !tipl ) tipl = TewiFont.BreakLines(tipstr,maxw); // height of the entire box plus padding tipheight = (tipl.Count()*TewiFont.GetHeight()+32); if ( tipalpha <= 0. ) return; double alf = clamp(tipalpha+(tipalphastate*fractic)/GameTicRate,0.,1.); int lw = 0; for ( int i=0; i lw ) lw = tipl.StringWidth(i); double xx = (Screen.GetWidth()-lw*hs)/2; double yy = Screen.GetHeight()-(tipheight-16)*hs; double alph; if ( tipflash && (gametic < tipflash) ) alph = max((tipflash-(gametic+fractic))/25.,0.)**1.5; xx -= 8*hs; DrawBox(xx,yy,(lw+16)*hs,tipl.Count()*TewiFont.GetHeight()*hs,alf); if ( alf < 1. ) return; for ( int i=0; i ar ) vsize = (tsize.y*ar,tsize.y); else if ( sar < ar ) vsize = (tsize.x,tsize.x/ar); else vsize = tsize; Screen.DrawTexture(arttex,false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_Alpha,alph); } override void Draw( double smoothratio ) { FracTic = smoothratio; // calculate scale factor (based mostly around 400px height) hs = max(1,int(floor(Screen.GetHeight()/400.))); Drawer(); if ( glarestr > 0 ) Screen.Dim(glarecolor,(clamp((glarestr-fractic)/20.,0.,1.)**2)*.3,0,0,Screen.GetWidth(),Screen.GetHeight()); } override void Ticker( void ) { bcnt++; if ( bcnt == 1 ) StartMusic(); glarestr = max(glarestr-1,0); tipalpha = min(tipalpha+tipalphastate/double(GameTicRate),2.); switch (CurState) { case StatCount: tipalphastate = 2; updateStats(); break; case ShowNextLoc: updateShowNextLoc(); break; case NoState: tipalphastate = -2; updateNoState(); break; case LeavingIntermission: // sorry nothing break; } // check fade if ( bFade ) bgfade = min(1.,bgfade+3./GameTicRate); else bgfade = max(0.,bgfade-4./GameTicRate); } override bool OnEvent( InputEvent evt ) { if ( evt.type == InputEvent.Type_KeyDown ) { String cmd = Bindings.GetBinding(evt.KeyScan); if ( (cmd ~== "+attack") || (cmd ~== "+use") || (evt.KeyScan == InputEvent.KEY_ENTER) ) // KEY_ENTER needed as fallback for Delta Touch compatibility { accelerateStage = 1; return true; } if ( cmd ~== "+altattack" ) { bFade = true; return true; } if ( cmd ~== "+reload" ) { PlaySound("misc/chat"); whichtip = 0; tipflash = gametic+25; return true; } if ( cmd ~== "+zoom" ) { PlaySound("misc/chat"); whichart = 0; arttex.SetNull(); return true; } return false; } else if ( (evt.type == InputEvent.Type_KeyUp) && (Bindings.GetBinding(evt.KeyScan) ~== "+altattack") ) { bFade = false; return true; } return false; } override void updateNoState() { // make sure tip alpha is zero, so this transition is less jarring if ( tipalpha > 0. ) return; Super.updateNoState(); } override void initShowNextLoc() { if ( wbs.next == "" ) { // the base statscreen skips directly here, which looks // very jarring with this one, so just skip to NoState bNoDrawNextLoc = true; initNoState(); return; } CurState = ShowNextLoc; acceleratestage = 0; cnt = SHOWNEXTLOCDELAY*GameTicRate; noautostartmap = false; } override void initStats() { CurState = StatCount; acceleratestage = 0; sp_state = 0; cnt_kills[0] = cnt_items[0] = cnt_secret[0] = -1; cnt_time = cnt_par = -1; cnt_pause = GameTicRate*2; cnt_total_time = -1; } override void updateStats() { if ( sp_state == 0 ) { if ( bcnt > GameTicRate ) { S_StartSound("misc/interstart",CHAN_WEAPON,CHANF_OVERLAP|CHANF_UI,1.,0.); acceleratestage = 0; glarestr = 20; sp_state++; } return; } if ( acceleratestage && (sp_state != 10) ) { acceleratestage = 0; sp_state = 10; S_StartSound("misc/intercntdone",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.); glarestr = 10; cnt_kills[0] = Plrs[me].skills; cnt_items[0] = Plrs[me].sitems; cnt_secret[0] = Plrs[me].ssecret; cnt_time = Thinker.Tics2Seconds(Plrs[me].stime); cnt_par = wbs.partime/GameTicRate; cnt_total_time = Thinker.Tics2Seconds(wbs.totaltime); } if ( sp_state == 2 ) { cnt_kills[0] += max((Plrs[me].skills-cnt_kills[0])/GameTicRate,1); if ( !((sndcnt++)%3) ) { S_StartSound("misc/intercnt",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.); glarestr = 5; } if ( cnt_kills[0] >= Plrs[me].skills ) { S_StartSound("misc/intercntdone",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.); cnt_kills[0] = Plrs[me].skills; glarestr = 10; sp_state++; } } else if ( sp_state == 4 ) { cnt_items[0] += max((Plrs[me].sitems-cnt_items[0])/GameTicRate,1); if ( !((sndcnt++)%3) ) { S_StartSound("misc/intercnt",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.); glarestr = 5; } if ( cnt_items[0] >= Plrs[me].sitems ) { S_StartSound("misc/intercntdone",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.); cnt_items[0] = Plrs[me].sitems; glarestr = 10; sp_state++; } } else if ( sp_state == 6 ) { cnt_secret[0] += max((Plrs[me].ssecret-cnt_secret[0])/GameTicRate,1); if ( !((sndcnt++)%3) ) { S_StartSound("misc/intercnt",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.); glarestr = 5; } if ( cnt_secret[0] >= Plrs[me].ssecret ) { S_StartSound("misc/intercntdone",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.); cnt_secret[0] = Plrs[me].ssecret; glarestr = 10; sp_state++; } } else if ( sp_state == 8 ) { int sec = Thinker.Tics2Seconds(Plrs[me].stime); int tsec = Thinker.Tics2Seconds(wbs.totaltime); int psec = wbs.partime/GameTicRate; if ( !((sndcnt++)%3) ) { S_StartSound("misc/intercnt",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.); glarestr = 5; } cnt_time += max((sec-cnt_time)/GameTicRate,1); cnt_par += max((psec-cnt_par)/GameTicRate,1); cnt_total_time += max((tsec-cnt_total_time)/GameTicRate,1); if ( cnt_time >= sec ) cnt_time = sec; if ( cnt_total_time >= tsec ) cnt_total_time = tsec; if ( cnt_par >= psec ) { cnt_par = psec; if ( cnt_time >= sec ) { S_StartSound("misc/intercntdone",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.); cnt_total_time = tsec; glarestr = 10; sp_state++; } } } else if ( sp_state == 10 ) { if ( acceleratestage ) { S_StartSound("misc/interdone",CHAN_WEAPON,CHANF_OVERLAP|CHANF_UI,1.,0.); glarestr = 20; initShowNextLoc(); } } else if ( sp_state&1 ) { if ( !--cnt_pause ) { sp_state++; cnt_pause = GameTicRate; sndcnt = 0; } } } }