mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
SpawnParticle functions
- Added A_SpawnParticle Decorate and SpawnParticle ACS functions.
This commit is contained in:
parent
94c397b868
commit
c099cd4581
5 changed files with 92 additions and 1 deletions
|
@ -76,6 +76,7 @@
|
|||
#include "farchive.h"
|
||||
#include "decallib.h"
|
||||
#include "version.h"
|
||||
#include "p_effect.h"
|
||||
|
||||
#include "g_shared/a_pickups.h"
|
||||
|
||||
|
@ -4441,7 +4442,8 @@ enum EACSFunctions
|
|||
ACSF_ChangeActorRoll,
|
||||
ACSF_GetActorRoll,
|
||||
ACSF_QuakeEx,
|
||||
ACSF_Warp, // 92
|
||||
ACSF_Warp,
|
||||
ACSF_SpawnParticle, // 93
|
||||
|
||||
/* Zandronum's - these must be skipped when we reach 99!
|
||||
-100:ResetMap(0),
|
||||
|
@ -5916,6 +5918,34 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
return false;
|
||||
}
|
||||
|
||||
case ACSF_SpawnParticle:
|
||||
{
|
||||
fixed_t x = args[0];
|
||||
fixed_t y = args[1];
|
||||
fixed_t z = args[2];
|
||||
fixed_t xvel = args[3];
|
||||
fixed_t yvel = args[4];
|
||||
fixed_t zvel = args[5];
|
||||
PalEntry color = args[6];
|
||||
int lifetime = args[7];
|
||||
bool fullbright = argCount > 8 ? !!args[8] : false;
|
||||
int startalpha = argCount > 9 ? args[9] : 0xFF; // Byte trans
|
||||
int size = argCount > 10 ? args[10] : 1;
|
||||
int fadestep = argCount > 11 ? args[11] : -1;
|
||||
fixed_t accelx = argCount > 12 ? args[12] : 0;
|
||||
fixed_t accely = argCount > 13 ? args[13] : 0;
|
||||
fixed_t accelz = argCount > 14 ? args[14] : 0;
|
||||
|
||||
startalpha = clamp<int>(startalpha, 0, 0xFF); // Clamp to byte
|
||||
lifetime = clamp<int>(lifetime, 0, 0xFF); // Clamp to byte
|
||||
fadestep = clamp<int>(fadestep, -1, 0xFF); // Clamp to byte inc. -1 (indicating automatic)
|
||||
size = clamp<int>(size, 0, 0xFF); // Clamp to byte
|
||||
|
||||
if (lifetime != 0)
|
||||
P_SpawnParticle(x, y, z, xvel, yvel, zvel, color, fullbright, startalpha, lifetime, size, fadestep, accelx, accely, accelz);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -284,6 +284,31 @@ void P_ThinkParticles ()
|
|||
}
|
||||
}
|
||||
|
||||
void P_SpawnParticle(fixed_t x, fixed_t y, fixed_t z, fixed_t velx, fixed_t vely, fixed_t velz, PalEntry color, bool fullbright, BYTE startalpha, BYTE lifetime, BYTE size, int fadestep, fixed_t accelx, fixed_t accely, fixed_t accelz)
|
||||
{
|
||||
particle_t *particle = NewParticle();
|
||||
|
||||
if (particle)
|
||||
{
|
||||
particle->x = x;
|
||||
particle->y = y;
|
||||
particle->z = z;
|
||||
particle->velx = velx;
|
||||
particle->vely = vely;
|
||||
particle->velz = velz;
|
||||
particle->color = ParticleColor(color);
|
||||
particle->trans = startalpha;
|
||||
if (fadestep < 0) fadestep = FADEFROMTTL(lifetime);
|
||||
particle->fade = fadestep;
|
||||
particle->ttl = lifetime;
|
||||
particle->accx = accelx;
|
||||
particle->accy = accely;
|
||||
particle->accz = accelz;
|
||||
particle->bright = fullbright;
|
||||
particle->size = size;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_RunEffects
|
||||
//
|
||||
|
|
|
@ -83,6 +83,7 @@ particle_t *JitterParticle (int ttl);
|
|||
particle_t *JitterParticle (int ttl, float drift);
|
||||
|
||||
void P_ThinkParticles (void);
|
||||
void P_SpawnParticle(fixed_t x, fixed_t y, fixed_t z, fixed_t velx, fixed_t vely, fixed_t velz, PalEntry color, bool fullbright, BYTE startalpha, BYTE lifetime, BYTE size, int fadestep, fixed_t accelx, fixed_t accely, fixed_t accelz);
|
||||
void P_InitEffects (void);
|
||||
void P_RunEffects (void);
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "s_sound.h"
|
||||
#include "cmdlib.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "p_effect.h"
|
||||
#include "p_enemy.h"
|
||||
#include "a_action.h"
|
||||
#include "decallib.h"
|
||||
|
@ -2614,6 +2615,39 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris)
|
|||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_SpawnParticle
|
||||
//
|
||||
//===========================================================================
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle)
|
||||
{
|
||||
ACTION_PARAM_START(15);
|
||||
ACTION_PARAM_FIXED(xoff, 0);
|
||||
ACTION_PARAM_FIXED(yoff, 1);
|
||||
ACTION_PARAM_FIXED(zoff, 2);
|
||||
ACTION_PARAM_FIXED(xvel, 3);
|
||||
ACTION_PARAM_FIXED(yvel, 4);
|
||||
ACTION_PARAM_FIXED(zvel, 5);
|
||||
ACTION_PARAM_COLOR(color, 6);
|
||||
ACTION_PARAM_INT(lifetime, 7);
|
||||
ACTION_PARAM_BOOL(fullbright, 8);
|
||||
ACTION_PARAM_INT(startalpha, 9); // Byte trans
|
||||
ACTION_PARAM_INT(size, 10);
|
||||
ACTION_PARAM_INT(fadestep, 11);
|
||||
ACTION_PARAM_FIXED(accelx, 12);
|
||||
ACTION_PARAM_FIXED(accely, 13);
|
||||
ACTION_PARAM_FIXED(accelz, 14);
|
||||
|
||||
startalpha = clamp<int>(startalpha, 0, 0xFF); // Clamp to byte
|
||||
lifetime = clamp<int>(lifetime, 0, 0xFF); // Clamp to byte
|
||||
fadestep = clamp<int>(fadestep, -1, 0xFF); // Clamp to byte inc. -1 (indicating automatic)
|
||||
size = clamp<int>(size, 0, 0xFF); // Clamp to byte
|
||||
|
||||
if (lifetime != 0)
|
||||
P_SpawnParticle(xoff + self->x, yoff + self->y, zoff + self->z, xvel, yvel, zvel, color, fullbright, startalpha, lifetime, size, fadestep, accelx, accely, accelz);
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
|
|
@ -234,6 +234,7 @@ ACTOR Actor native //: Thinker
|
|||
action native A_SetScale(float scalex, float scaley = 0, int ptr = AAPTR_DEFAULT);
|
||||
action native A_SetMass(int mass);
|
||||
action native A_SpawnDebris(class<Actor> spawntype, bool transfer_translation = false, float mult_h = 1, float mult_v = 1);
|
||||
action native A_SpawnParticle(float xoff, float yoff, float zoff, float velx, float vely, float velz, color color1, int lifetime, bool fullbright = false, int startalpha = 255, int size = 1, int fadestep = -1, float accelx = 0.0, float accely = 0.0, float accelz = 0.0);
|
||||
action native A_CheckSight(state label);
|
||||
action native A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false);
|
||||
action native A_DropInventory(class<Inventory> itemtype);
|
||||
|
|
Loading…
Reference in a new issue