mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 21:41:03 +00:00
Fix MSVS compile bug and add offset parameter for SprayDecal
This commit is contained in:
parent
0e9ca3c850
commit
4807f4240b
4 changed files with 30 additions and 16 deletions
|
@ -830,25 +830,36 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 Dir)
|
||||
void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 offset, DVector3 direction)
|
||||
{
|
||||
//just in case
|
||||
if (!shooter)
|
||||
return;
|
||||
|
||||
FTraceResults trace;
|
||||
DVector3 vec;
|
||||
//use new behavior only if directional vector not equal to zero vector
|
||||
if (!Dir.isZero() )
|
||||
{
|
||||
vec = Dir;
|
||||
}
|
||||
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();
|
||||
vec = DVector3(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)
|
||||
{
|
||||
|
|
|
@ -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., DVector3 Dir = (0, 0, 0) );
|
||||
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
|
||||
{
|
||||
|
|
|
@ -4917,10 +4917,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_SprayDecal)
|
|||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_STRING(name);
|
||||
PARAM_FLOAT(dist);
|
||||
PARAM_FLOAT(DirX);
|
||||
PARAM_FLOAT(DirY);
|
||||
PARAM_FLOAT(DirZ);
|
||||
SprayDecal(self, name, dist, DVector3(DirX, DirY, DirZ) );
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1157,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, vector3 Dir = (0, 0, 0) );
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue