diff --git a/cvarinfo.base b/cvarinfo.base index 2ba95b26f..64d11ec66 100644 --- a/cvarinfo.base +++ b/cvarinfo.base @@ -122,6 +122,7 @@ server bool swwm_extendedpickup = false; // items will have an additional "virtu nosave bool swwm_voicelog = false; // adds player voicelines to the message log nosave bool swwm_skipskill = false; // skips skill confirmations nosave bool swwm_hudtrimammo = false; // only show ammo for owned weapons +nosave bool swwm_hudmugshot = true; // show an animated mugshot in the hud // minimap settings nosave bool swwm_mm_enable = true; // show a minimap below the score counter diff --git a/gldefs.misc b/gldefs.misc index ce11ea451..92834c0a6 100644 --- a/gldefs.misc +++ b/gldefs.misc @@ -1,10 +1,3 @@ -HardwareShader Texture "graphics/HUD/HealthBarS.png" -{ - Shader "shaders/glsl/Fuzz.fp" - Define "GRAY_COLORS" - Define "BASE_RES" = "vec2(100.,12.)" - Texture "noisetex" "textures/graynoise.png" -} HardwareShader Texture "graphics/HUD/EnemyBarS.png" { Shader "shaders/glsl/Fuzz.fp" @@ -12,46 +5,37 @@ HardwareShader Texture "graphics/HUD/EnemyBarS.png" Define "BASE_RES" = "vec2(50.,3.)" Texture "noisetex" "textures/graynoise.png" } -HardwareShader Texture "graphics/HUD/FuelBarS.png" -{ - Shader "shaders/glsl/Fuzz.fp" - Define "GRAY_COLORS" - Define "BASE_RES" = "vec2(120.,3.)" - Texture "noisetex" "textures/graynoise.png" -} -HardwareShader Texture "graphics/AltHUD/HealthBarS.png" +HardwareShader Texture "graphics/HUD/HealthBarS.png" { Shader "shaders/glsl/Fuzz.fp" Define "GRAY_COLORS" Define "BASE_RES" = "vec2(100.,5.)" Texture "noisetex" "textures/graynoise.png" } -HardwareShader Texture "graphics/AltHUD/FuelBarS.png" +HardwareShader Texture "graphics/HUD/FuelBarS.png" { Shader "shaders/glsl/Fuzz.fp" Define "GRAY_COLORS" Define "BASE_RES" = "vec2(120.,2.)" Texture "noisetex" "textures/graynoise.png" } -HardwareShader Texture "graphics/HUD/HealthBarD.png" -{ - Shader "shaders/glsl/HealthBarD.fp" - Define "TEX_SIZE" = "vec2(120.,32.)" - Texture "noisetex" "textures/graynoise.png" -} HardwareShader Texture "graphics/HUD/EnemyBarD.png" { Shader "shaders/glsl/HealthBarD.fp" Define "TEX_SIZE" = "vec2(70.,23.)" Texture "noisetex" "textures/graynoise.png" } - -HardwareShader Texture "graphics/AltHUD/HealthBarD.png" +HardwareShader Texture "graphics/HUD/HealthBarD.png" { Shader "shaders/glsl/HealthBarD.fp" Define "TEX_SIZE" = "vec2(120.,25.)" Texture "noisetex" "textures/graynoise.png" } +HardwareShader Texture "graphics/HUD/DemoFace_Barrier.png" +{ + Shader "shaders/glsl/BarrierFace.fp" + Texture "bartex" "models/barrierbar.png" +} HardwareShader Texture "graphics/tempbg.png" { Shader "shaders/glsl/Fuzz.fp" @@ -156,10 +140,6 @@ HardwareShader Texture "graphics/M_DEMOCHAN_THUMBUP.png" { Shader "shaders/glsl/Bilinear.fp" } -HardwareShader Texture "graphics/UnSXLogo.png" -{ - Shader "shaders/glsl/Bilinear.fp" -} HardwareShader Sprite "MBRNB0" { Shader "shaders/glsl/Whew.fp" diff --git a/graphics/HUD/DemoFace_Angerage.png b/graphics/HUD/DemoFace_Angerage.png new file mode 100644 index 000000000..a131a36d1 Binary files /dev/null and b/graphics/HUD/DemoFace_Angerage.png differ diff --git a/graphics/HUD/DemoFace_Angery.png b/graphics/HUD/DemoFace_Angery.png new file mode 100644 index 000000000..db74cbbc9 Binary files /dev/null and b/graphics/HUD/DemoFace_Angery.png differ diff --git a/graphics/HUD/DemoFace_Barrier.png b/graphics/HUD/DemoFace_Barrier.png new file mode 100644 index 000000000..0e366b2e6 Binary files /dev/null and b/graphics/HUD/DemoFace_Barrier.png differ diff --git a/graphics/HUD/DemoFace_Blink.png b/graphics/HUD/DemoFace_Blink.png new file mode 100644 index 000000000..04a1f90e9 Binary files /dev/null and b/graphics/HUD/DemoFace_Blink.png differ diff --git a/graphics/HUD/DemoFace_Booty.png b/graphics/HUD/DemoFace_Booty.png new file mode 100644 index 000000000..2116c3025 Binary files /dev/null and b/graphics/HUD/DemoFace_Booty.png differ diff --git a/graphics/HUD/DemoFace_Dead.png b/graphics/HUD/DemoFace_Dead.png new file mode 100644 index 000000000..9598e80ac Binary files /dev/null and b/graphics/HUD/DemoFace_Dead.png differ diff --git a/graphics/HUD/DemoFace_Default.png b/graphics/HUD/DemoFace_Default.png new file mode 100644 index 000000000..785168744 Binary files /dev/null and b/graphics/HUD/DemoFace_Default.png differ diff --git a/graphics/HUD/DemoFace_Dizzy.png b/graphics/HUD/DemoFace_Dizzy.png new file mode 100644 index 000000000..e9c937d05 Binary files /dev/null and b/graphics/HUD/DemoFace_Dizzy.png differ diff --git a/graphics/HUD/DemoFace_Evil.png b/graphics/HUD/DemoFace_Evil.png new file mode 100644 index 000000000..9f1c84750 Binary files /dev/null and b/graphics/HUD/DemoFace_Evil.png differ diff --git a/graphics/HUD/DemoFace_Flash.png b/graphics/HUD/DemoFace_Flash.png new file mode 100644 index 000000000..f17ed4a83 Binary files /dev/null and b/graphics/HUD/DemoFace_Flash.png differ diff --git a/graphics/HUD/DemoFace_Grin.png b/graphics/HUD/DemoFace_Grin.png new file mode 100644 index 000000000..460eb2ea4 Binary files /dev/null and b/graphics/HUD/DemoFace_Grin.png differ diff --git a/graphics/HUD/DemoFace_Head.png b/graphics/HUD/DemoFace_Head.png new file mode 100644 index 000000000..f12b8457d Binary files /dev/null and b/graphics/HUD/DemoFace_Head.png differ diff --git a/graphics/HUD/DemoFace_Hurt.png b/graphics/HUD/DemoFace_Hurt.png new file mode 100644 index 000000000..985078e19 Binary files /dev/null and b/graphics/HUD/DemoFace_Hurt.png differ diff --git a/graphics/HUD/DemoFace_HurtLeft.png b/graphics/HUD/DemoFace_HurtLeft.png new file mode 100644 index 000000000..d89010ae7 Binary files /dev/null and b/graphics/HUD/DemoFace_HurtLeft.png differ diff --git a/graphics/HUD/DemoFace_HurtRight.png b/graphics/HUD/DemoFace_HurtRight.png new file mode 100644 index 000000000..cccfdbc72 Binary files /dev/null and b/graphics/HUD/DemoFace_HurtRight.png differ diff --git a/graphics/HUD/DemoFace_Off.png b/graphics/HUD/DemoFace_Off.png new file mode 100644 index 000000000..913c36005 Binary files /dev/null and b/graphics/HUD/DemoFace_Off.png differ diff --git a/graphics/HUD/DemoFace_Ouch.png b/graphics/HUD/DemoFace_Ouch.png new file mode 100644 index 000000000..3757d77cb Binary files /dev/null and b/graphics/HUD/DemoFace_Ouch.png differ diff --git a/graphics/HUD/DemoFace_Rage.png b/graphics/HUD/DemoFace_Rage.png new file mode 100644 index 000000000..70d88822a Binary files /dev/null and b/graphics/HUD/DemoFace_Rage.png differ diff --git a/graphics/HUD/DemoFace_Sad.png b/graphics/HUD/DemoFace_Sad.png new file mode 100644 index 000000000..cf7ed07e8 Binary files /dev/null and b/graphics/HUD/DemoFace_Sad.png differ diff --git a/graphics/HUD/DemoFace_Smug.png b/graphics/HUD/DemoFace_Smug.png new file mode 100644 index 000000000..4858c8a01 Binary files /dev/null and b/graphics/HUD/DemoFace_Smug.png differ diff --git a/graphics/HUD/DemoFace_Unamused.png b/graphics/HUD/DemoFace_Unamused.png new file mode 100644 index 000000000..4033cc252 Binary files /dev/null and b/graphics/HUD/DemoFace_Unamused.png differ diff --git a/graphics/HUD/DemoFace_Wink.png b/graphics/HUD/DemoFace_Wink.png new file mode 100644 index 000000000..f65c58190 Binary files /dev/null and b/graphics/HUD/DemoFace_Wink.png differ diff --git a/language.def_menu b/language.def_menu index 112e8f1b4..ff1644b58 100644 --- a/language.def_menu +++ b/language.def_menu @@ -208,6 +208,7 @@ SWWM_EXTENDEDPICKUP = "Extend Item Size"; SWWM_VOICELOG = "Log Player Comments"; SWWM_SKIPSKILL = "Skip Skill Confirmation"; SWWM_HUDTRIMAMMO = "Trim Ammo List"; +SWWM_HUDMUGSHOT = "Face In HUD"; SWWM_MMTITLE = "Minimap Settings"; SWWM_MM_ENABLE = "Show Minimap"; SWWM_MM_ROTATE = "Rotate Minimap"; @@ -378,6 +379,7 @@ TOOLTIP_SWWM_EXTENDEDPICKUP = "Gives all items a vanilla-sized \"virtual hitbox\ TOOLTIP_SWWM_VOICELOG = "Subtitled player comments will be saved to the Messages tab of the Demolitionist Menu."; TOOLTIP_SWWM_SKIPSKILL = "Skips confirmation of skill selection, if you get tired of seeing it every time."; TOOLTIP_SWWM_HUDTRIMAMMO = "Only shows ammo for currently carried weapons in the HUD."; +TOOLTIP_SWWM_HUDMUGSHOT = "Shows the Demolitionist's face in the HUD, for a more classic touch."; TOOLTIP_SWWMMINIMAPMENU = "Configure the minimap."; TOOLTIP_SWWMACHIEVEMENTMENU = "View your achievements."; TOOLTIP_SWWM_MM_ENABLE = "Displays a minimap under the score counter."; diff --git a/language.es_menu b/language.es_menu index f15643446..407198243 100644 --- a/language.es_menu +++ b/language.es_menu @@ -207,6 +207,7 @@ SWWM_EXTENDEDPICKUP = "Extender Tamaño de Ítem"; SWWM_VOICELOG = "Registrar Comentarios de Jugador"; SWWM_SKIPSKILL = "Saltar Confirmación de Dificultad"; SWWM_HUDTRIMAMMO = "Recortar Lista de Munición"; +SWWM_HUDMUGSHOT = "Rostro en el HUD"; SWWM_MMTITLE = "Opciones de Minimapa"; SWWM_MM_ENABLE = "Mostrar Minimapa"; SWWM_MM_ROTATE = "Rotar Minimapa"; @@ -382,6 +383,7 @@ TOOLTIP_SWWM_EXTENDEDPICKUP = "Da a todos los ítems una \"hitbox virtual\" de t TOOLTIP_SWWM_VOICELOG = "Los comentarios de jugador subtitulados se guardarán en la pestaña de Mensajes del Menú de Demolicionista."; TOOLTIP_SWWM_SKIPSKILL = "Salta la confirmación de selección de dificultad, si te has cansado de verla todo el tiempo."; TOOLTIP_SWWM_HUDTRIMAMMO = "Muestra solo la munición de las armas obtenidas en el HUD."; +TOOLTIP_SWWM_HUDMUGSHOT = "Muestra el rostro de la Demolicionista en el HUD, para un toque más clásico."; TOOLTIP_SWWMMINIMAPMENU = "Configura el minimapa."; TOOLTIP_SWWMACHIEVEMENTMENU = "Revisa tus logros."; TOOLTIP_SWWM_MM_ENABLE = "Muestra un minimapa bajo el contador de puntuación."; diff --git a/language.version b/language.version index f12a1fc5a..9a8b5091b 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r157 \cu(Tue 5 Jul 22:18:04 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.3pre r157 \cu(2022-07-05 22:18:04)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r158 \cu(Tue 5 Jul 23:33:29 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.3pre r158 \cu(2022-07-05 23:33:29)\c-"; diff --git a/menudef.txt b/menudef.txt index b7933367e..7925ef6d0 100644 --- a/menudef.txt +++ b/menudef.txt @@ -119,6 +119,7 @@ OptionMenu "SWWMOptionMenu" Option "$SWWM_UNIQSTATS", "swwm_uniqstats", "YesNo" Slider "$SWWM_HUDMARGIN", "swwm_hudmargin", 0, 20, 1, 0 Option "$SWWM_HUDTRIMAMMO", "swwm_hudtrimammo", "YesNo" + Option "$SWWM_HUDMUGSHOT", "swwm_hudmugshot", "YesNo" Slider "$SWWM_MAXMSG", "swwm_maxshown", 1, 10, 1, 0 Slider "$SWWM_MAXMSGBIG", "swwm_maxshownbig", 1, 20, 1, 0 Slider "$SWWM_MAXPICK", "swwm_maxpickup", 1, 10, 1, 0 diff --git a/shaders/glsl/BarrierFace.fp b/shaders/glsl/BarrierFace.fp new file mode 100644 index 000000000..edec4913a --- /dev/null +++ b/shaders/glsl/BarrierFace.fp @@ -0,0 +1,9 @@ +// barrier overlay, but shaped like the texture + +void SetupMaterial( inout Material mat ) +{ + vec4 col = getTexel(vTexCoord.st); + vec3 grad = texture(bartex,vec2(0.,fract(vTexCoord.t+timer))).rgb; + mat.Base.rgb = grad*col.a; + mat.Base.a = col.a; +} diff --git a/zscript/hud/swwm_hud.zsc b/zscript/hud/swwm_hud.zsc index 194955f1e..e45617e0f 100644 --- a/zscript/hud/swwm_hud.zsc +++ b/zscript/hud/swwm_hud.zsc @@ -65,11 +65,21 @@ Enum EMiniHUDFontColor NUM_MINIHUD_COLOR }; +Enum EDemoFaceState +{ + FS_DEFAULT, + FS_EVIL, + FS_GRIN, + FS_PAIN, + FS_OUCH, + FS_DEAD // UNUSED +}; + Class SWWMStatusBar : BaseStatusBar { TextureID StatusTex, WeaponTex, ScoreTex, InventoryTex, ChatTex[6], HealthTex[9], FuelTex[2], DashTex, EnemyBTex, EnemyHTex[6], - GenericAmmoTex[3], AmmoTex[3], MiniBox, bgtex; + GenericAmmoTex[3], AmmoTex[3], MiniBox, bgtex, FaceTex[17]; Font mSmallFont, mBigFont, mTinyFont, MiniHUDFont, MiniHUDFontOutline; int mhudfontcol[NUM_MINIHUD_COLOR]; @@ -113,7 +123,7 @@ Class SWWMStatusBar : BaseStatusBar // projection data cache SWWMProjectionData projdata; - SmoothDynamicValueInterpolator ScoreInter; + DynamicValueInterpolator ScoreInter; Inventory lastsel; Weapon lastwep; @@ -175,6 +185,12 @@ Class SWWMStatusBar : BaseStatusBar SmoothDynamicValueInterpolator HealthInter, FuelInter, DashInter; SmoothLinearValueInterpolator LagHealthInter; + EDemoFaceState facestate; + int paindir; + int facetimer; + int blinktime; + transient ui int rss; + override void FlushNotify() { // flush interpolators (useful since this virtual gets called @@ -1024,9 +1040,75 @@ Class SWWMStatusBar : BaseStatusBar qsort_playerscore(a,p+1,h); } + private void UpdateMugState() + { + let d = Demolitionist(CPlayer.mo); + if ( !d ) return; + // damage handling + if ( d.lastdamagetic && (d.lastdamagetic == gametic) ) + { + if ( d.lastdamage > 70 ) + { + facestate = FS_OUCH; + facetimer = (d.lastdamagetimer-gametic)+10; + } + else if ( facestate < FS_OUCH ) + { + facestate = FS_PAIN; + facetimer = (d.lastdamagetimer-gametic)+10; + paindir = 0; + // paraphrased from vanilla, with some tweaks + if ( CPlayer.attacker && (CPlayer.attacker != d) && d ) + { + double atkang = d.AngleTo(CPlayer.attacker); + double angdiff = Actor.deltaangle(CPlayer.mo.angle,atkang); + if ( abs(angdiff) < 135 ) + { + if ( angdiff > 45 ) paindir = -1; + else if ( angdiff < -45 ) paindir = 1; + } + } + } + } + // grin timer + if ( d.lastgrin && (d.lastgrin == gametic) && (facestate <= FS_GRIN) ) + { + facestate = FS_GRIN; + facetimer = 50; + } + if ( CPlayer.mo.FindInventory("RagekitPower") && (facestate < FS_PAIN) ) + { + facestate = FS_EVIL; + facetimer = 10; + } + if ( facetimer > 0 ) + { + facetimer--; + if ( facetimer <= 0 ) + { + facestate = FS_DEFAULT; + blinktime = 30; + } + } + if ( !(gametic&1) ) + { + if ( blinktime <= 0 ) + { + blinktime--; + if ( blinktime < -3 ) + { + rss = int(MSTimeF()); + blinktime = (abs(GetRandom())%10)?(40+abs(GetRandom())%40):6; + } + } + else blinktime--; + } + } + // separated so they can be auto-ticked by the demolitionist menu void TickInterpolators() { + UpdateMugState(); ScoreInter.Update(SWWMCredits.Get(CPlayer)); int hp = CPlayer.Health; HealthInter.Update(hp); @@ -1434,6 +1516,25 @@ Class SWWMStatusBar : BaseStatusBar AmmoTex[2] = TexMan.CheckForTexture("graphics/HUD/AmmoBoxB.png",TexMan.Type_Any); MiniBox = TexMan.CheckForTexture("graphics/HUD/MinimapBox.png",TexMan.Type_Any); bgtex = TexMan.CheckForTexture("graphics/tempbg.png",TexMan.Type_Any); + FaceTex[0] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Head.png",TexMan.Type_Any); + FaceTex[1] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Flash.png",TexMan.Type_Any); + FaceTex[2] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Default.png",TexMan.Type_Any); + FaceTex[3] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Unamused.png",TexMan.Type_Any); + FaceTex[4] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Blink.png",TexMan.Type_Any); + FaceTex[5] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Grin.png",TexMan.Type_Any); + FaceTex[6] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Evil.png",TexMan.Type_Any); + FaceTex[7] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Hurt.png",TexMan.Type_Any); + FaceTex[8] = TexMan.CheckForTexture("graphics/HUD/DemoFace_HurtLeft.png",TexMan.Type_Any); + FaceTex[9] = TexMan.CheckForTexture("graphics/HUD/DemoFace_HurtRight.png",TexMan.Type_Any); + FaceTex[10] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Ouch.png",TexMan.Type_Any); + FaceTex[11] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Dead.png",TexMan.Type_Any); + FaceTex[12] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Smug.png",TexMan.Type_Any); + FaceTex[13] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Angery.png",TexMan.Type_Any); + FaceTex[14] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Barrier.png",TexMan.Type_Any); + FaceTex[15] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Rage.png",TexMan.Type_Any); + FaceTex[16] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Angerage.png",TexMan.Type_Any); + // other expressions will be added when needed + blinktime = 30; mSmallFont = Font.GetFont('TewiFont'); mBigFont = Font.GetFont('TewiFontOutline'); mTinyFont = Font.GetFont('MiniwiFont'); @@ -1539,7 +1640,7 @@ Class SWWMStatusBar : BaseStatusBar AmmoMaxFlash[i] = 0; AmmoOldMaxAmounts[i] = int.min; } - ScoreInter = SmoothDynamicValueInterpolator.Create(0,.1,1,999999999); + ScoreInter = DynamicValueInterpolator.Create(0,.1,1,999999999); hnd = SWWMHandler(EventHandler.Find("SWWMHandler")); PrevFrame = MSTimeF(); } @@ -2722,12 +2823,14 @@ Class SWWMStatusBar : BaseStatusBar return true; } - private void DrawInventory( int invy = 56 ) + private void DrawInventory( bool drawmug = false ) { + int invy = drawmug?61:56; // active items (armor / powerups) double xx = margin+2; double yy = ss.y-(margin+invy); - if ( CPlayer.mo.InvSel && !isInventoryBarVisible() ) yy -= 34; + if ( drawmug ) yy -= 9; + if ( CPlayer.mo.InvSel && !isInventoryBarVisible() && !drawmug ) yy -= 34; bool drewarmor = false; for ( Inventory i=CPlayer.mo.Inv; i; i=i.Inv ) { @@ -2737,8 +2840,13 @@ Class SWWMStatusBar : BaseStatusBar drewarmor = true; } yy = ss.y-(margin+invy); - if ( drewarmor ) xx += 40; - else if ( CPlayer.mo.InvSel && !isInventoryBarVisible() ) yy -= 34; + if ( drawmug ) yy -= 9; + if ( drewarmor ) + { + xx += 36; + if ( drawmug && CPlayer.mo.InvSel && !isInventoryBarVisible() ) yy -= 34; + } + else if ( CPlayer.mo.InvSel && !isInventoryBarVisible() && !drawmug ) yy -= 34; for ( Inventory i=CPlayer.mo.Inv; i; i=i.Inv ) { if ( (i is 'SWWMLamp') && SWWMLamp(i).bActivated ) @@ -2790,8 +2898,8 @@ Class SWWMStatusBar : BaseStatusBar DrawInvIcon(next[1],xx+70,yy+2,1./3.); return; } - Screen.DrawTexture(InventoryTex,false,margin,ss.y-(margin+invy+2),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - DrawInvIcon(CPlayer.mo.InvSel,margin+2,ss.y-(margin+invy),selected:true); + Screen.DrawTexture(InventoryTex,false,margin+(drawmug?36:0),ss.y-(margin+invy+2),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + DrawInvIcon(CPlayer.mo.InvSel,margin+2+(drawmug?36:0),ss.y-(margin+invy),selected:true); } private void DrawWeapons() @@ -2967,7 +3075,7 @@ Class SWWMStatusBar : BaseStatusBar Screen.DrawTexture(AmmoTex[0],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } // score - String sstr = String.Format("%09d",int(ScoreInter.GetValue(fractic))); + String sstr = String.Format("%09d",int(ScoreInter.GetValue())); xx = ss.x-(margin+48); if ( bDrewAmmo ) yy -= 12; else yy = ss.y-(margin+22); @@ -3016,9 +3124,77 @@ Class SWWMStatusBar : BaseStatusBar } } - private void DrawStatus() + private int GetRandom() { - Screen.DrawTexture(StatusTex,false,margin,ss.y-(margin+22),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + return (rss = (rss<<1)*35447+(rss/87)); + } + + private double RandomShiver() + { + int sd = GetRandom(); + return ((abs(sd)%11)-5)*.1; + } + + private int GetFaceTex() + { + if ( CPlayer.Health <= 0 ) return 11; + if ( facestate == FS_GRIN ) return 5; + if ( facestate == FS_EVIL ) return 6; + if ( isInvulnerable() || CPlayer.mo.FindInventory("InvinciballPower") ) return (blinktime<-1)?4:12; + if ( facestate == FS_OUCH ) return 10; + if ( facestate == FS_PAIN ) return (paindir==1)?8:(paindir==-1)?9:7; + switch ( blinktime ) + { + case -1: + case -3: + return 3; + break; + case -2: + return 4; + break; + } + return 2; + } + + private void DrawMugshot() + { + rss = int(MSTimeF())*128; + let demo = Demolitionist(CPlayer.mo); + double paintime = clamp((demo.lastdamagetimer-(gametic+Fractic))/35.,0.,1.); + double noiz = min(demo.lastdamage*.5*paintime,3.); + Vector2 shake = (RandomShiver(),RandomShiver())*noiz; + if ( !CPlayer.mo.FindInventory("GhostPower") ) + { + Screen.DrawTexture(FaceTex[0],false,margin+shake.x,ss.y-(margin+32)+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + bool raging = CPlayer.mo.FindInventory("RagekitPower"); + bool angy = CPlayer.mo.FindInventory("AngeryPower"); + if ( raging && angy ) Screen.DrawTexture(FaceTex[16],false,margin+shake.x,ss.y-(margin+32)+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + else if ( raging ) Screen.DrawTexture(FaceTex[15],false,margin+shake.x,ss.y-(margin+32)+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + else if ( angy ) Screen.DrawTexture(FaceTex[13],false,margin+shake.x,ss.y-(margin+32)+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawTexture(FaceTex[1],false,margin+shake.x,ss.y-(margin+32)+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Color,Color(255,255,0,0),DTA_Alpha,min(1.,noiz)); + if ( (CPlayer.Health > 0) && (isInvulnerable() || CPlayer.mo.FindInventory("InvinciballPower")) ) + Screen.DrawTexture(FaceTex[1],false,margin+shake.x,ss.y-(margin+32)+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,.8+.1*sin(gametic+fractic)); + } + else + { + Screen.DrawTexture(FaceTex[0],false,margin+shake.x,ss.y-(margin+32)+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_FillColor,Color(0,0,0),DTA_Alpha,.25*(1.-min(1.,noiz))); + Screen.DrawTexture(FaceTex[1],false,margin+shake.x,ss.y-(margin+32)+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_FillColor,Color(255,0,0),DTA_Alpha,.25*min(1.,noiz)); + } + Screen.DrawTexture(FaceTex[GetFaceTex()],false,margin+shake.x,ss.y-(margin+32)+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + if ( CPlayer.mo.FindInventory("BarrierPower") ) Screen.DrawTexture(FaceTex[14],false,margin+shake.x,ss.y-(margin+32)+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,.5,DTA_LegacyRenderStyle,STYLE_Add); + } + + private void DrawStatus( bool drawmug = false ) + { + int ox = 0; + int oy = 0; + if ( drawmug ) + { + DrawMugshot(); + ox = 36; + oy = 5; + } + Screen.DrawTexture(StatusTex,false,margin+ox,ss.y-(margin+22+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); String str; double ht = clamp(HealthInter.GetValue(fractic),0,10000); str = String.Format("%3d",clamp(round(ht),0,999)); @@ -3030,34 +3206,34 @@ Class SWWMStatusBar : BaseStatusBar else if ( round(ht) > 100 ) hcolor = MCR_CYAN; if ( isInvulnerable() || CPlayer.mo.FindInventory("InvinciballPower") ) { - Screen.DrawTexture(HealthTex[0],false,margin+3,ss.y-(margin+19),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw,DTA_ColorOverlay,Color(255,0,0,0)); - Screen.DrawTexture(HealthTex[4],false,margin+2,ss.y-(margin+20),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw); + Screen.DrawTexture(HealthTex[0],false,margin+3+ox,ss.y-(margin+19+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw,DTA_ColorOverlay,Color(255,0,0,0)); + Screen.DrawTexture(HealthTex[4],false,margin+2+ox,ss.y-(margin+20+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw); hcolor = MCR_WHITE; } else { - Screen.DrawTexture(HealthTex[0],false,margin+3,ss.y-(margin+19),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw,DTA_ColorOverlay,Color(255,0,0,0)); - Screen.DrawTexture(HealthTex[0],false,margin+2,ss.y-(margin+20),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw); + Screen.DrawTexture(HealthTex[0],false,margin+3+ox,ss.y-(margin+19+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw,DTA_ColorOverlay,Color(255,0,0,0)); + Screen.DrawTexture(HealthTex[0],false,margin+2+ox,ss.y-(margin+20+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw); if ( ht > 100 ) { hw = min(ht-100,100); - Screen.DrawTexture(HealthTex[1],false,margin+2,ss.y-(margin+20),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw); + Screen.DrawTexture(HealthTex[1],false,margin+2+ox,ss.y-(margin+20+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw); } if ( ht > 200 ) { hw = min(ht-200,300)/3.; - Screen.DrawTexture(HealthTex[2],false,margin+2,ss.y-(margin+20),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw); + Screen.DrawTexture(HealthTex[2],false,margin+2+ox,ss.y-(margin+20+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw); } if ( ht > 500 ) { hw = min(ht-500,500)/5.; - Screen.DrawTexture(HealthTex[3],false,margin+2,ss.y-(margin+20),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw); + Screen.DrawTexture(HealthTex[3],false,margin+2+ox,ss.y-(margin+20+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw); } } if ( CPlayer.mo.FindInventory("DivineSpriteEffect") ) { double falph = clamp((ht-1000)/6000.,0.,1.); - Screen.DrawTexture(HealthTex[5],false,margin+2,ss.y-(margin+20),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,falph,DTA_LegacyRenderStyle,STYLE_Add); + Screen.DrawTexture(HealthTex[5],false,margin+2+ox,ss.y-(margin+20+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,falph,DTA_LegacyRenderStyle,STYLE_Add); String tst; double alph = .1; int trl = 9; @@ -3066,42 +3242,42 @@ Class SWWMStatusBar : BaseStatusBar tst = "AAA"; SWWMUtility.ObscureText(tst,(gametic-trl)/3,true); trl--; - Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_WHITE],margin+107,ss.y-(margin+20),tst,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,falph*alph,DTA_LegacyRenderStyle,STYLE_Add); + Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_WHITE],margin+107+ox,ss.y-(margin+20+oy),tst,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,falph*alph,DTA_LegacyRenderStyle,STYLE_Add); } - Screen.DrawText(MiniHUDFont,mhudfontcol[hcolor],margin+107,ss.y-(margin+20),String.Format("%3d",clamp(round(ht),0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,1.-falph); + Screen.DrawText(MiniHUDFont,mhudfontcol[hcolor],margin+107+ox,ss.y-(margin+20+oy),String.Format("%3d",clamp(round(ht),0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,1.-falph); } else { - Screen.DrawText(MiniHUDFont,mhudfontcol[hcolor],margin+107,ss.y-(margin+20),String.Format("%3d",clamp(round(ht),0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(MiniHUDFont,mhudfontcol[hcolor],margin+107+ox,ss.y-(margin+20+oy),String.Format("%3d",clamp(round(ht),0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); int f = HealthFlash; if ( f && (gametic < f) ) { double alph = max((f-(gametic+FracTic))/25.,0.)**1.5; - Screen.DrawTexture(HealthTex[7],false,margin+2,ss.y-(margin+20),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,bhw,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alph); - Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_FLASH],margin+107,ss.y-(margin+20),str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alph); + Screen.DrawTexture(HealthTex[7],false,margin+2+ox,ss.y-(margin+20+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,bhw,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alph); + Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_FLASH],margin+107+ox,ss.y-(margin+20+oy),str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alph); } if ( (CPlayer.health > 0) && (CPlayer.health <= 25) && (PulsePhase <= 15) ) { double alph = clamp(sin((PulsePhase-FracTic)*12.),0.,1.); - Screen.DrawTexture(HealthTex[6],false,margin+2,ss.y-(margin+20),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw,DTA_Alpha,alph); - Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_REDFLASH],margin+107,ss.y-(margin+20),str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); + Screen.DrawTexture(HealthTex[6],false,margin+2+ox,ss.y-(margin+20+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw,DTA_Alpha,alph); + Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_REDFLASH],margin+107,ss.y-(margin+20+oy),str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); } ht = clamp(LagHealthInter.GetValue(fractic),0,1000); double hwl = min(ht,100); if ( hwl > bhw ) { - Screen.DrawTexture(HealthTex[8],false,margin+3,ss.y-(margin+19),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowLeftF,bhw,DTA_WindowRightF,hwl,DTA_ColorOverlay,Color(255,0,0,0)); - Screen.DrawTexture(HealthTex[8],false,margin+2,ss.y-(margin+20),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowLeftF,bhw,DTA_WindowRightF,hwl); + Screen.DrawTexture(HealthTex[8],false,margin+3+ox,ss.y-(margin+19+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowLeftF,bhw,DTA_WindowRightF,hwl,DTA_ColorOverlay,Color(255,0,0,0)); + Screen.DrawTexture(HealthTex[8],false,margin+2+ox,ss.y-(margin+20+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowLeftF,bhw,DTA_WindowRightF,hwl); } } double ft = clamp(FuelInter.GetValue(fractic),0,120); - Screen.DrawTexture(FuelTex[swwm_superfuel],false,margin+3,ss.y-(margin+7),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,ft,DTA_ColorOverlay,Color(255,0,0,0)); - Screen.DrawTexture(FuelTex[swwm_superfuel],false,margin+2,ss.y-(margin+8),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,ft); + Screen.DrawTexture(FuelTex[swwm_superfuel],false,margin+3+ox,ss.y-(margin+7+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,ft,DTA_ColorOverlay,Color(255,0,0,0)); + Screen.DrawTexture(FuelTex[swwm_superfuel],false,margin+2+ox,ss.y-(margin+8+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,ft); let d = Demolitionist(CPlayer.mo); bool blink = (!d || (d.dashfuel > 20) || ((gametic%10) < 5)); double dt = clamp(DashInter.GetValue(fractic),0,120); - Screen.DrawTexture(DashTex,false,margin+3,ss.y-(margin+4),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,dt,DTA_ColorOverlay,Color(255,0,0,0)); - Screen.DrawTexture(DashTex,false,margin+2,ss.y-(margin+5),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,dt,DTA_ColorOverlay,Color(blink?0:96,0,0,0)); + Screen.DrawTexture(DashTex,false,margin+3+ox,ss.y-(margin+4+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,dt,DTA_ColorOverlay,Color(255,0,0,0)); + Screen.DrawTexture(DashTex,false,margin+2+ox,ss.y-(margin+5+oy),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,dt,DTA_ColorOverlay,Color(blink?0:96,0,0,0)); } private void DrawPickups() @@ -3401,8 +3577,9 @@ Class SWWMStatusBar : BaseStatusBar { DrawTarget(); DrawTopStuff(); - DrawInventory(); - DrawStatus(); + bool drawmug = swwm_hudmugshot; + DrawInventory(drawmug); + DrawStatus(drawmug); DrawWeapons(); if ( hnd ) hnd.DrawBossBar(self); DrawPickups(); diff --git a/zscript/swwm_player.zsc b/zscript/swwm_player.zsc index 30284602c..c2ccbd7ef 100644 --- a/zscript/swwm_player.zsc +++ b/zscript/swwm_player.zsc @@ -88,7 +88,7 @@ Class Demolitionist : PlayerPawn int invwipe; // inventory wipe flags for next level - transient int lastbang; + transient int lastbang, lastgrin; transient bool ingivecheat; @@ -2816,6 +2816,7 @@ Class Demolitionist : PlayerPawn SWWMHandler.AddOneliner("getweapon",2); } else SWWMHandler.AddOneliner("getweapon",2); + lastgrin = gametic; } } if ( (item is 'Key') && !key_reentrant && !deathmatch && !bInDefaultInventory ) @@ -2836,6 +2837,7 @@ Class Demolitionist : PlayerPawn SWWMHandler.AddOneliner("keyget",2); } else SWWMHandler.AddOneliner("keyget",2); + lastgrin = gametic; } // share all keys in mp for ( int i=0; i 0) && (mystats.ownedcollectibles.Find(cls) < mystats.ownedcollectibles.Size()) ) return; @@ -2863,6 +2869,7 @@ Class Demolitionist : PlayerPawn { mystats.gotyorick = true; SWWMHandler.AddOneliner("skullget",2); + lastgrin = gametic; } // notify key obtained to flash icon if ( item is 'Key' ) diff --git a/zscript/weapons/swwm_splode.zsc b/zscript/weapons/swwm_splode.zsc index aa4502c0d..85dd945aa 100644 --- a/zscript/weapons/swwm_splode.zsc +++ b/zscript/weapons/swwm_splode.zsc @@ -61,7 +61,10 @@ Class ExplodiumGun : SWWMWeapon // add the oneliner let demo = Demolitionist(Owner); if ( demo && demo.mystats && !demo.mystats.GotWeapon(SisterWeapon.GetClass()) && (Owner.player == players[consoleplayer]) && !demo.ingivecheat ) + { SWWMHandler.AddOneliner(SWWMWeapon(SisterWeapon).GetLine,2); + demo.lastgrin = gametic; + } item.bPickupGood = true; } return true;