Merge branch 'master' of https://github.com/coelckers/gzdoom into texture_rework

This commit is contained in:
Rachael Alexanderson 2020-05-07 04:32:46 -04:00
commit 192882f63a
18 changed files with 106 additions and 51 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

@ -830,16 +830,36 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl
//
//----------------------------------------------------------------------------
void SprayDecal(AActor *shooter, const char *name, double distance)
void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 offset, DVector3 direction)
{
FTraceResults trace;
//just in case
if (!shooter)
return;
FTraceResults trace;
DVector3 off(0, 0, 0), dir(0, 0, 0);
//use vanilla offset only if "custom" equal to zero
if (offset.isZero() )
off = shooter->PosPlusZ(shooter->Height / 2);
else
off = shooter->Pos() + offset;
//same for direction
if (direction.isZero() )
{
DAngle ang = shooter->Angles.Yaw;
DAngle pitch = shooter->Angles.Pitch;
double c = pitch.Cos();
DVector3 vec(c * ang.Cos(), c * ang.Sin(), -pitch.Sin());
dir = DVector3(c * ang.Cos(), c * ang.Sin(), -pitch.Sin());
}
if (Trace(shooter->PosPlusZ(shooter->Height / 2), shooter->Sector, vec, distance, 0, ML_BLOCKEVERYTHING, shooter, trace, TRACE_NoSky))
else
dir = direction;
if (Trace(off, shooter->Sector, dir, distance, 0, ML_BLOCKEVERYTHING, shooter, trace, TRACE_NoSky))
{
if (trace.HitType == TRACE_HitWall)
{

View file

@ -12,7 +12,7 @@ class DBaseDecal;
struct SpreadInfo;
DBaseDecal *ShootDecal(FLevelLocals *Level, const FDecalTemplate *tpl, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent);
void SprayDecal(AActor *shooter, const char *name,double distance = 172.);
void SprayDecal(AActor *shooter, const char *name,double distance = 172., DVector3 offset = DVector3(0., 0., 0.), DVector3 direction = DVector3(0., 0., 0.) );
class DBaseDecal : public DThinker
{

View file

@ -4917,7 +4917,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_SprayDecal)
PARAM_SELF_PROLOGUE(AActor);
PARAM_STRING(name);
PARAM_FLOAT(dist);
SprayDecal(self, name, dist);
PARAM_FLOAT(offset_x);
PARAM_FLOAT(offset_y);
PARAM_FLOAT(offset_z);
PARAM_FLOAT(direction_x);
PARAM_FLOAT(direction_y);
PARAM_FLOAT(direction_z);
SprayDecal(self, name, dist, DVector3(offset_x, offset_y, offset_z), DVector3(direction_x, direction_y, direction_z) );
return 0;
}

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);
//==========================================================================
//
@ -1156,7 +1157,7 @@ class Actor : Thinker native
native bool A_SetVisibleRotation(double anglestart = 0, double angleend = 0, double pitchstart = 0, double pitchend = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
native void A_SetTranslation(name transname);
native bool A_SetSize(double newradius = -1, double newheight = -1, bool testpos = false);
native void A_SprayDecal(String name, double dist = 172);
native void A_SprayDecal(String name, double dist = 172, vector3 offset = (0, 0, 0), vector3 direction = (0, 0, 0) );
native void A_SetMugshotState(String name);
native void CopyBloodColor(Actor other);

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