From f65a97322e9debe2c9c155c4b7dd75a32809c6dc Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Tue, 31 Mar 2020 19:30:27 +0800 Subject: [PATCH 1/6] Add an alpha parameter to StatusBar.DrawBar --- wadsrc/static/zscript/ui/statusbar/statusbar.zs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wadsrc/static/zscript/ui/statusbar/statusbar.zs b/wadsrc/static/zscript/ui/statusbar/statusbar.zs index 131649a2fe..4944104d82 100644 --- a/wadsrc/static/zscript/ui/statusbar/statusbar.zs +++ b/wadsrc/static/zscript/ui/statusbar/statusbar.zs @@ -1019,7 +1019,7 @@ class BaseStatusBar native ui // //============================================================================ - void DrawBar(String ongfx, String offgfx, double curval, double maxval, Vector2 position, int border, int vertical, int flags = 0) + void DrawBar(String ongfx, String offgfx, double curval, double maxval, Vector2 position, int border, int vertical, int flags = 0, double alpha = 1.0) { let ontex = TexMan.CheckForTexture(ongfx, TexMan.TYPE_MiscPatch); if (!ontex.IsValid()) return; @@ -1050,17 +1050,17 @@ class BaseStatusBar native ui for(int i = 0; i < 4; i++) Clip[i] += border; //Draw the whole foreground - DrawTexture(ontex, position, flags | DI_ITEM_LEFT_TOP); + DrawTexture(ontex, position, flags | DI_ITEM_LEFT_TOP, alpha); SetClipRect(position.X + Clip[0], position.Y + Clip[1], texsize.X - Clip[0] - Clip[2], texsize.Y - Clip[1] - Clip[3], flags); } if (offtex.IsValid() && TexMan.GetScaledSize(offtex) == texsize) DrawTexture(offtex, position, flags | DI_ITEM_LEFT_TOP); - else Fill(color(255,0,0,0), position.X + Clip[0], position.Y + Clip[1], texsize.X - Clip[0] - Clip[2], texsize.Y - Clip[1] - Clip[3]); + else Fill(color(int(255*alpha),0,0,0), position.X + Clip[0], position.Y + Clip[1], texsize.X - Clip[0] - Clip[2], texsize.Y - Clip[1] - Clip[3]); - if (border == 0) + if (border == 0) { SetClipRect(position.X + Clip[0], position.Y + Clip[1], texsize.X - Clip[0] - Clip[2], texsize.Y - Clip[1] - Clip[3], flags); - DrawTexture(ontex, position, flags | DI_ITEM_LEFT_TOP); + DrawTexture(ontex, position, flags | DI_ITEM_LEFT_TOP, alpha); } // restore the previous clipping rectangle screen.SetClipRect(cx, cy, cw, ch); From d563b0339c236e3867500343123b5e4b825f369d Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Wed, 1 Apr 2020 01:45:28 +0800 Subject: [PATCH 2/6] Apply alpha to the background texture in DrawBar --- wadsrc/static/zscript/ui/statusbar/statusbar.zs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/ui/statusbar/statusbar.zs b/wadsrc/static/zscript/ui/statusbar/statusbar.zs index 4944104d82..c2ed4c6d9d 100644 --- a/wadsrc/static/zscript/ui/statusbar/statusbar.zs +++ b/wadsrc/static/zscript/ui/statusbar/statusbar.zs @@ -1054,7 +1054,7 @@ class BaseStatusBar native ui SetClipRect(position.X + Clip[0], position.Y + Clip[1], texsize.X - Clip[0] - Clip[2], texsize.Y - Clip[1] - Clip[3], flags); } - if (offtex.IsValid() && TexMan.GetScaledSize(offtex) == texsize) DrawTexture(offtex, position, flags | DI_ITEM_LEFT_TOP); + if (offtex.IsValid() && TexMan.GetScaledSize(offtex) == texsize) DrawTexture(offtex, position, flags | DI_ITEM_LEFT_TOP, alpha); else Fill(color(int(255*alpha),0,0,0), position.X + Clip[0], position.Y + Clip[1], texsize.X - Clip[0] - Clip[2], texsize.Y - Clip[1] - Clip[3]); if (border == 0) From 6b70cad6e1fc8d161e893f4e118f4e20d14e1622 Mon Sep 17 00:00:00 2001 From: arookas Date: Tue, 24 Mar 2020 23:21:26 -0400 Subject: [PATCH 3/6] Add option to invert mouse x --- src/d_main.cpp | 6 +++++- src/g_game.cpp | 1 + wadsrc/static/menudef.txt | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 163c9824f0..bf2eb02df1 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -171,6 +171,7 @@ EXTERN_CVAR (Bool, freelook) EXTERN_CVAR (Float, m_pitch) EXTERN_CVAR (Float, m_yaw) EXTERN_CVAR (Bool, invertmouse) +EXTERN_CVAR (Bool, invertmousex) EXTERN_CVAR (Bool, lookstrafe) EXTERN_CVAR (Int, screenblocks) EXTERN_CVAR (Bool, sv_cheats) @@ -449,7 +450,10 @@ void D_PostEvent (const event_t *ev) } if (!buttonMap.ButtonDown(Button_Strafe) && !lookstrafe) { - G_AddViewAngle (int(ev->x * m_yaw * mouse_sensitivity * 8.0), true); + int turn = int(ev->x * m_yaw * mouse_sensitivity * 8.0); + if (invertmousex) + turn = -turn; + G_AddViewAngle (turn, true); events[eventhead].x = 0; } if ((events[eventhead].x | events[eventhead].y) == 0) diff --git a/src/g_game.cpp b/src/g_game.cpp index 0bf7812604..b29f67d6bf 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -202,6 +202,7 @@ int lookspeed[2] = {450, 512}; CVAR (Bool, cl_run, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Always run? CVAR (Bool, invertmouse, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Invert mouse look down/up? +CVAR (Bool, invertmousex, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Invert mouse look left/right? CVAR (Bool, freelook, true, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Always mlook? CVAR (Bool, lookstrafe, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Always strafe with mouse? CVAR (Float, m_pitch, 1.f, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Mouse speeds diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index b59af595f4..e7803545ef 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -734,6 +734,7 @@ OptionMenu "MouseOptions" protected Slider "$MOUSEMNU_STRAFESPEED", "m_side", 0, 2.5, 0.1 StaticText "" Option "$MOUSEMNU_ALWAYSMOUSELOOK", "freelook", "OnOff" + Option "$MOUSEMNU_INVERTMOUSEX", "invertmousex", "OnOff" Option "$MOUSEMNU_INVERTMOUSE", "invertmouse", "OnOff" Option "$MOUSEMNU_LOOKSPRING", "lookspring", "OnOff" Option "$MOUSEMNU_LOOKSTRAFE", "lookstrafe", "OnOff" From 4b4ff8dd0e55178be233ab97d04bcaa28a425e63 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 30 Apr 2020 12:55:09 +0600 Subject: [PATCH 4/6] Fix bouncing missiles not dealing damage when hitting top/bottom (#1068) * Fix bouncing missiles not dealing damage when hitting top/bottom --- src/playsim/p_local.h | 1 + src/playsim/p_map.cpp | 84 +++++++++++++++++---------- src/playsim/p_mobj.cpp | 1 + wadsrc/static/zscript/actors/actor.zs | 1 + 4 files changed, 55 insertions(+), 32 deletions(-) diff --git a/src/playsim/p_local.h b/src/playsim/p_local.h index 0c7bb1bc72..2a031b6895 100644 --- a/src/playsim/p_local.h +++ b/src/playsim/p_local.h @@ -246,6 +246,7 @@ extern TArray portalhit; int P_TestMobjLocation (AActor *mobj); int P_TestMobjZ (AActor *mobj, bool quick=true, AActor **pOnmobj = NULL); bool P_CheckPosition(AActor *thing, const DVector2 &pos, bool actorsonly = false); +void P_DoMissileDamage(AActor* inflictor, AActor* target); bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, bool actorsonly = false); AActor *P_CheckOnmobj (AActor *thing); void P_FakeZMovement (AActor *mo); diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index ae0eecef0c..ac7b817d59 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -1230,6 +1230,57 @@ static bool CanAttackHurt(AActor *victim, AActor *shooter) return true; } +//========================================================================== +// +// P_DoMissileDamage +// Handle damaging/poisoning enemies from missiles. +// target is the target to be dealt damage to. +// inflictor is the actor dealing the damage. +// +//========================================================================== + +void P_DoMissileDamage(AActor* inflictor, AActor* target) +{ + // Do poisoning (if using new style poison) + if (inflictor->PoisonDamage > 0 && inflictor->PoisonDuration != INT_MIN) + { + P_PoisonMobj(target, inflictor, inflictor->target, inflictor->PoisonDamage, inflictor->PoisonDuration, inflictor->PoisonPeriod, inflictor->PoisonDamageType); + } + + // Do damage + int damage = inflictor->GetMissileDamage((inflictor->flags4 & MF4_STRIFEDAMAGE) ? 3 : 7, 1); + if ((damage > 0) || (inflictor->flags6 & MF6_FORCEPAIN) || (inflictor->flags7 & MF7_CAUSEPAIN)) + { + int newdam = P_DamageMobj(target, inflictor, inflictor->target, damage, inflictor->DamageType); + if (damage > 0) + { + if ((inflictor->flags5 & MF5_BLOODSPLATTER) && + !(target->flags & MF_NOBLOOD) && + !(target->flags2 & MF2_REFLECTIVE) && + !(target->flags2 & (MF2_INVULNERABLE | MF2_DORMANT)) && + !(inflictor->flags3 & MF3_BLOODLESSIMPACT) && + (pr_checkthing() < 192)) + { + P_BloodSplatter(inflictor->Pos(), target, inflictor->AngleTo(target)); + } + if (!(inflictor->flags3 & MF3_BLOODLESSIMPACT)) + { + P_TraceBleed(newdam > 0 ? newdam : damage, target, inflictor); + } + } + } + else + { + P_GiveBody(target, -damage); + } +} +DEFINE_ACTION_FUNCTION(AActor, DoMissileDamage) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_OBJECT_NOT_NULL(target, AActor); + P_DoMissileDamage(self, target); + return 0; +} //========================================================================== // // PIT_CheckThing @@ -1555,38 +1606,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch } } - // Do poisoning (if using new style poison) - if (tm.thing->PoisonDamage > 0 && tm.thing->PoisonDuration != INT_MIN) - { - P_PoisonMobj(thing, tm.thing, tm.thing->target, tm.thing->PoisonDamage, tm.thing->PoisonDuration, tm.thing->PoisonPeriod, tm.thing->PoisonDamageType); - } - - // Do damage - damage = tm.thing->GetMissileDamage((tm.thing->flags4 & MF4_STRIFEDAMAGE) ? 3 : 7, 1); - if ((damage > 0) || (tm.thing->flags6 & MF6_FORCEPAIN) || (tm.thing->flags7 & MF7_CAUSEPAIN)) - { - int newdam = P_DamageMobj(thing, tm.thing, tm.thing->target, damage, tm.thing->DamageType); - if (damage > 0) - { - if ((tm.thing->flags5 & MF5_BLOODSPLATTER) && - !(thing->flags & MF_NOBLOOD) && - !(thing->flags2 & MF2_REFLECTIVE) && - !(thing->flags2 & (MF2_INVULNERABLE | MF2_DORMANT)) && - !(tm.thing->flags3 & MF3_BLOODLESSIMPACT) && - (pr_checkthing() < 192)) - { - P_BloodSplatter(tm.thing->Pos(), thing, tm.thing->AngleTo(thing)); - } - if (!(tm.thing->flags3 & MF3_BLOODLESSIMPACT)) - { - P_TraceBleed(newdam > 0 ? newdam : damage, thing, tm.thing); - } - } - } - else - { - P_GiveBody(thing, -damage); - } + P_DoMissileDamage(tm.thing, thing); if ((thing->flags7 & MF7_THRUREFLECT) && (thing->flags2 & MF2_REFLECTIVE) && (tm.thing->flags & MF_MISSILE)) { diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 0f6f32e9d4..c98bc9c7b1 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -3976,6 +3976,7 @@ void AActor::Tick () // to be in line with the case when an actor's side is hit. if (!res && (flags & MF_MISSILE)) { + P_DoMissileDamage(this, onmo); P_ExplodeMissile(this, nullptr, onmo); } } diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 0b3841a19c..27a929fdd4 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -759,6 +759,7 @@ class Actor : Thinker native native void GiveSecret(bool printmsg = true, bool playsound = true); native clearscope double GetCameraHeight() const; native clearscope double GetGravity() const; + native void DoMissileDamage(Actor target); //========================================================================== // From 331f3d85d61fb52c571afbdb9f76a8da8a834ca4 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 30 Apr 2020 16:26:12 +0300 Subject: [PATCH 5/6] - fixed secondary ammo display in strife status bar https://forum.zdoom.org/viewtopic.php?t=68315 --- wadsrc/static/zscript/ui/statusbar/strife_sbar.zs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wadsrc/static/zscript/ui/statusbar/strife_sbar.zs b/wadsrc/static/zscript/ui/statusbar/strife_sbar.zs index 79fc0ada4a..912effbb46 100644 --- a/wadsrc/static/zscript/ui/statusbar/strife_sbar.zs +++ b/wadsrc/static/zscript/ui/statusbar/strife_sbar.zs @@ -353,8 +353,8 @@ class StrifeStatusBar : BaseStatusBar if (ammo2 != NULL && ammo1!=ammo2) { // Draw secondary ammo just above the primary ammo - DrawString(mGrnFont, FormatNumber(ammo1.Amount, 3), (-23, -48)); - DrawInventoryIcon(ammo1, (-14, -55)); + DrawString(mGrnFont, FormatNumber(ammo2.Amount, 3), (-23, -48)); + DrawInventoryIcon(ammo2, (-14, -55)); } } From a528290b5c6e1bae4179756adb56beeedc1cfa22 Mon Sep 17 00:00:00 2001 From: PaulyB <43163391+3saster@users.noreply.github.com> Date: Sat, 2 May 2020 23:22:44 -0700 Subject: [PATCH 6/6] Fix single top level filter folder not being read I have no idea why the missing comma broke it in this particular way... --- src/d_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index bf2eb02df1..eee2b36479 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -186,7 +186,7 @@ extern bool insave; extern TDeletingArray LightDefaults; const char* iwad_folders[13] = { "flats/", "textures/", "hires/", "sprites/", "voxels/", "colormaps/", "acs/", "maps/", "voices/", "patches/", "graphics/", "sounds/", "music/" }; -const char* iwad_reserved[12] = { "mapinfo", "zmapinfo", "gameinfo", "sndinfo", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "iwadinfo" "maps/" }; +const char* iwad_reserved[12] = { "mapinfo", "zmapinfo", "gameinfo", "sndinfo", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "iwadinfo", "maps/" }; CUSTOM_CVAR(Float, i_timescale, 1.0f, CVAR_NOINITCALL)