mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
- added A_SprayDecal function.
This commit is contained in:
parent
c4b546404a
commit
5fe04dfd20
5 changed files with 30 additions and 19 deletions
|
@ -2376,25 +2376,8 @@ void Net_DoCommand (int type, BYTE **stream, int player)
|
|||
break;
|
||||
|
||||
case DEM_SPRAY:
|
||||
{
|
||||
FTraceResults trace;
|
||||
|
||||
DAngle ang = players[player].mo->Angles.Yaw;
|
||||
DAngle pitch = players[player].mo->Angles.Pitch;
|
||||
double c = pitch.Cos();
|
||||
DVector3 vec(c * ang.Cos(), c * ang.Sin(), -pitch.Sin());
|
||||
|
||||
s = ReadString(stream);
|
||||
|
||||
if (Trace (players[player].mo->PosPlusZ(players[player].mo->Height/2), players[player].mo->Sector,
|
||||
vec, 172., 0, ML_BLOCKEVERYTHING, players[player].mo, trace, TRACE_NoSky))
|
||||
{
|
||||
if (trace.HitType == TRACE_HitWall)
|
||||
{
|
||||
DImpactDecal::StaticCreate (s, trace.HitPos, trace.Line->sidedef[trace.Side], NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
SprayDecal(players[player].mo, s);
|
||||
break;
|
||||
|
||||
case DEM_PAUSE:
|
||||
|
|
|
@ -704,6 +704,24 @@ CCMD (spray)
|
|||
Net_WriteString (argv[1]);
|
||||
}
|
||||
|
||||
void SprayDecal(AActor *shooter, const char *name)
|
||||
{
|
||||
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());
|
||||
|
||||
if (Trace(shooter->PosPlusZ(shooter->Height / 2), shooter->Sector, vec, 172., 0, ML_BLOCKEVERYTHING, shooter, trace, TRACE_NoSky))
|
||||
{
|
||||
if (trace.HitType == TRACE_HitWall)
|
||||
{
|
||||
DImpactDecal::StaticCreate(name, trace.HitPos, trace.Line->sidedef[trace.Side], NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DBaseDecal *ShootDecal(const FDecalTemplate *tpl, AActor *basisactor, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent)
|
||||
{
|
||||
if (tpl == NULL || (tpl = tpl->GetDecal()) == NULL)
|
||||
|
|
|
@ -11,6 +11,7 @@ struct F3DFloor;
|
|||
class DBaseDecal;
|
||||
|
||||
class DBaseDecal *ShootDecal(const FDecalTemplate *tpl, AActor *basisactor, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent);
|
||||
void SprayDecal(AActor *shooter, const char *name);
|
||||
|
||||
class DBaseDecal : public DThinker
|
||||
{
|
||||
|
|
|
@ -6932,3 +6932,11 @@ DEFINE_ACTION_FUNCTION(AActor, SetCamera)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_SprayDecal)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_STRING(name);
|
||||
SprayDecal(self, name);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -868,6 +868,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, double newheight = -1, bool testpos = false);
|
||||
native void A_SprayDecal(String name);
|
||||
|
||||
native void A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0);
|
||||
native void A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0);
|
||||
|
|
Loading…
Reference in a new issue