//HERE BE SPAGHETTI //Icon bobbing. Also used for the warp menu top text. local bobRange = 3 local bobSpeed = 5 local bobDissonance = 18 //Variables that need to be initialized ASAP and preserved between loops local bgScroll = 0 local alternator = false local livesDisabled = false local overlayColor = 253 local overlayIntensity = 5 local destHori = nil local currHori = nil //Tables for fade-ins and outs. Icons get their own table to fade faster but still sync with the warp background local fadeTable = {V_90TRANS,V_80TRANS,V_70TRANS,V_60TRANS,V_50TRANS,V_40TRANS,V_30TRANS,V_20TRANS,V_10TRANS,V_HUDTRANS} local IconFadeTable = {V_60TRANS,V_90TRANS,V_70TRANS,V_50TRANS,V_30TRANS,V_10TRANS,V_HUDTRANS} local teleportFade = {1,2,3,4,5,5,4,3,2,1} hud.add(function(v,p) if KRIMA and KRIMA == 3 and not xmasBl then v.fadeScreen(overlayColor, overlayIntensity) end end,"scores") hud.add(function(v,p) if KRIMA and KRIMA == 3 and not xmasBl then v.fadeScreen(overlayColor, overlayIntensity) end end,"intermission") //HUD stuff for emblems hud.add(function(v,p) //Sanity checks if (p.mo == nil) or (not p.valid) then return end if not (emblems) then return end if KRIMA and KRIMA == 3 and not xmasBl then v.fadeScreen(overlayColor, overlayIntensity) end //Keep scrolling our background and alternating the checkpoints' flashing icons bgScroll = $-1 if not (leveltime%5) then alternator = not alternator end //disable lives and add our sprites livesDisabled = true v.gemb = v.cachePatch("goalemb") //Small goal emblem icon v.warpbg = v.cachePatch("chkwabg") //Warp screen background v.chkicou = v.cachePatch("chkiconu") //Icon-sized checkpoints (unlit) v.chkicol = v.cachePatch("chkiconl") //Icon-sized checkpoints (lit) v.chksel = v.cachePatch("chkselect") //Warp menu selection box v.radar1 = v.cachePatch("HOMITM1") //Emerald radar sprites v.radar2 = v.cachePatch("HOMITM2") // || v.radar3 = v.cachePatch("HOMITM3") // || v.radar4 = v.cachePatch("HOMITM4") // || v.radar5 = v.cachePatch("HOMITM5") // || v.radar6 = v.cachePatch("HOMITM6") // || //Fade in and out for warps. I decided not to use P_FlashPal() to prevent eye strains from constant warping if p.warpTimer and p.warpTimer > 0 then v.fadeScreen(0, teleportFade[p.warpTimer]) end //Bobbing emblem sprites under RINGS. Only displayed if we're not in the warp menu //HORI and VERTI are in charge of positioning our emblems in a way that makes them //go to a lower row every 5 emblems if p.warpScreenFade <= 1 local hori = 1 local verti = 1 //the for loop will position each emblem in our emblem table (which is being carried by our players) for i=1,#emblems do if (not emblems[i]) or (not emblems[i].valid) continue end //in case an emblem has been collected we give it the V_HUDTRANSHALF flag if hori == 6 then hori = 1 end //reseting HORI when appropriate //Ypos positions our emblems appropriately when we have multiples of 5 local Ypos = (verti-1) * FRACUNIT * 13 //iconbob bobs the icons. good old sine waves. local iconBob = sin( FixedAngle((leveltime+bobDissonance*i)*FRACUNIT*bobSpeed) ) * bobRange //finally we draw our emblems using the numbers we got above v.drawScaled( (hudinfo[HUD_RINGS].x) * FRACUNIT * hori, (hudinfo[HUD_RINGS].y+18) * FRACUNIT + Ypos + iconBob, FRACUNIT/2, v.gemb, emblems[i].inactive and V_PERPLAYER|V_SNAPTOLEFT|V_SNAPTOTOP|V_HUDTRANSHALF|V_PERPLAYER or V_PERPLAYER|V_SNAPTOLEFT|V_SNAPTOTOP|V_HUDTRANS ) hori = $+1 if not (i%5) then verti = $+1 end end //Emblem radar. Also hidden when the menu is present. for i=1,#emblems do if not emblems[i].valid continue end local hori = (152 - 9*(#emblems-1)) + (18*(i-1)) - 60 local radarColor = { v.radar1 , v.radar2 , v.radar3 , v.radar4 , v.radar5 , v.radar6 } local proxBeep = { 50, 50, 40, 20, 10, 5 } local proximity = getProximity(p.mo, emblems[i]) if proximity > 1 and not (leveltime % proxBeep[proximity]) S_StartSoundAtVolume(p.mo, sfx_emfind, 125, p) end v.draw( hori, 176, emblems[i].inactive and v.radar1 or radarColor[proximity], emblems[i].inactive and V_PERPLAYER|V_SNAPTOBOTTOM|V_HUDTRANSHALF or V_PERPLAYER|V_SNAPTOBOTTOM|V_HUDTRANS ) end end end,"game")