mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
Add optional direction parameters for SprayDecal and its A_SprayDecal zscript counterpart
This commit is contained in:
parent
50e0353668
commit
ba43244764
4 changed files with 21 additions and 9 deletions
|
@ -830,14 +830,23 @@ 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, double DirX, double DirY, double DirZ)
|
||||
{
|
||||
FTraceResults trace;
|
||||
|
||||
DAngle ang = shooter->Angles.Yaw;
|
||||
DAngle pitch = shooter->Angles.Pitch;
|
||||
double c = pitch.Cos();
|
||||
DVector3 vec(c * ang.Cos(), c * ang.Sin(), -pitch.Sin());
|
||||
DVector3 vec;
|
||||
//use new behavior only if directional vector not equal to zero vector
|
||||
if (DirX != 0 || DirY != 0 || DirZ != 0)
|
||||
{
|
||||
vec = DVector3(DirX, DirY, DirZ);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
DAngle ang = shooter->Angles.Yaw;
|
||||
DAngle pitch = shooter->Angles.Pitch;
|
||||
double c = pitch.Cos();
|
||||
vec = 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))
|
||||
{
|
||||
|
|
|
@ -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., double DirX = 0., double DirY = 0., double DirZ = 0.);
|
||||
|
||||
class DBaseDecal : public DThinker
|
||||
{
|
||||
|
|
|
@ -4917,7 +4917,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_SprayDecal)
|
|||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_STRING(name);
|
||||
PARAM_FLOAT(dist);
|
||||
SprayDecal(self, name, dist);
|
||||
PARAM_FLOAT(DirX);
|
||||
PARAM_FLOAT(DirY);
|
||||
PARAM_FLOAT(DirZ);
|
||||
SprayDecal(self, name, dist, DirX, DirY, DirZ);
|
||||
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);
|
||||
native void A_SprayDecal(String name, double dist = 172, double DirX = 0, double DirY = 0, double DirZ = 0);
|
||||
native void A_SetMugshotState(String name);
|
||||
native void CopyBloodColor(Actor other);
|
||||
|
||||
|
|
Loading…
Reference in a new issue