Merge remote-tracking branch 'origin/master' into fix_friendly_spawn

This commit is contained in:
Rachael Alexanderson 2020-05-03 05:51:06 -04:00
commit 159c946fde
9 changed files with 71 additions and 42 deletions

View file

@ -178,6 +178,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)
@ -193,7 +194,7 @@ extern bool insave;
extern TDeletingArray<FLightDefaults *> 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)
@ -479,7 +480,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)

View file

@ -203,6 +203,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

View file

@ -246,6 +246,7 @@ extern TArray<spechit_t> 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);

View file

@ -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))
{

View file

@ -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);
}
}

View file

@ -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"

View file

@ -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);
//==========================================================================
//

View file

@ -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]);
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)
{
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);

View file

@ -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));
}
}