From c099cd45810884cd793fb51ef6b66b4967865429 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Tue, 8 Dec 2015 22:58:24 +1300 Subject: [PATCH 1/9] SpawnParticle functions - Added A_SpawnParticle Decorate and SpawnParticle ACS functions. --- src/p_acs.cpp | 32 ++++++++++++++++++++++++++++- src/p_effect.cpp | 25 +++++++++++++++++++++++ src/p_effect.h | 1 + src/thingdef/thingdef_codeptr.cpp | 34 +++++++++++++++++++++++++++++++ wadsrc/static/actors/actor.txt | 1 + 5 files changed, 92 insertions(+), 1 deletion(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 30733eac8..bc0e74469 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -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(startalpha, 0, 0xFF); // Clamp to byte + lifetime = clamp(lifetime, 0, 0xFF); // Clamp to byte + fadestep = clamp(fadestep, -1, 0xFF); // Clamp to byte inc. -1 (indicating automatic) + size = clamp(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; } diff --git a/src/p_effect.cpp b/src/p_effect.cpp index db3129521..59142a8cf 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -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 // diff --git a/src/p_effect.h b/src/p_effect.h index 11116e8a3..aac9a63dc 100644 --- a/src/p_effect.h +++ b/src/p_effect.h @@ -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); diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 89299e0fa..b8a2c802d 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -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(startalpha, 0, 0xFF); // Clamp to byte + lifetime = clamp(lifetime, 0, 0xFF); // Clamp to byte + fadestep = clamp(fadestep, -1, 0xFF); // Clamp to byte inc. -1 (indicating automatic) + size = clamp(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); +} + //=========================================================================== // diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 5158aa7b5..0d31851b7 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -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 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 itemtype); From 673ac1295ca5492f4d029968e7b881bb6a230a59 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 21 Jan 2016 15:53:35 +0200 Subject: [PATCH 2/9] Fixed broken 'closedialog' property in Strife dialogs See http://forum.zdoom.org/viewtopic.php?t=50524 --- src/p_conversation.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index a74b9bd18..7b7355181 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -1345,20 +1345,24 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply if (reply->NextNode != 0) { int rootnode = npc->ConversationRoot; - unsigned next = (unsigned)(rootnode + (reply->NextNode < 0 ? -1 : 1) * reply->NextNode - 1); + const bool isNegative = reply->NextNode < 0; + const unsigned next = (unsigned)(rootnode + (isNegative ? -1 : 1) * reply->NextNode - 1); if (next < StrifeDialogues.Size()) { npc->Conversation = StrifeDialogues[next]; - if (gameaction != ga_slideshow) + if (isNegative) { - P_StartConversation (npc, player->mo, player->ConversationFaceTalker, false); - return; - } - else - { - S_StopSound (npc, CHAN_VOICE); + if (gameaction != ga_slideshow) + { + P_StartConversation (npc, player->mo, player->ConversationFaceTalker, false); + return; + } + else + { + S_StopSound (npc, CHAN_VOICE); + } } } } From 598bccbe9347cb8065faf07711dc9240651bbf95 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 21 Jan 2016 15:53:58 +0200 Subject: [PATCH 3/9] Added warning when next dialog page is incorrect --- src/p_conversation.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 7b7355181..ab6cf5883 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -1365,6 +1365,10 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply } } } + else + { + Printf ("Next node %u is invalid, no such dialog page\n", next); + } } npc->angle = player->ConversationNPCAngle; From 68fcbc0c92a5ea4c3f402a4e7f73397651f10d6e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 21 Jan 2016 14:54:14 +0100 Subject: [PATCH 4/9] - fixed: loading sector damage information from an old savegame could retrieve invalid data due to an uninitialized variable. --- src/p_sectors.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index 83adc438f..8ee5c280b 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -878,6 +878,7 @@ FArchive &operator<< (FArchive &arc, secspecial_t &p) int special; arc << special; sector_t sec; + memset(&sec, 0, sizeof(sec)); P_InitSectorSpecial(&sec, special, true); sec.GetSpecial(&p); } From f10dd68ca6d917907e65e77fea9b5b34532d166b Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 21 Jan 2016 16:21:09 +0200 Subject: [PATCH 5/9] Fixed actors intersection check --- src/actor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/actor.h b/src/actor.h index 3a474bc6f..a9bd60f75 100644 --- a/src/actor.h +++ b/src/actor.h @@ -881,7 +881,7 @@ public: bool intersects(AActor *other) const { fixed_t blockdist = radius + other->radius; - return ( abs(X() - other->Y()) < blockdist && abs(Y() - other->Y()) < blockdist); + return ( abs(X() - other->X()) < blockdist && abs(Y() - other->Y()) < blockdist); } // 'absolute' is reserved for a linked portal implementation which needs From d190da9e2e51ecb4371d80fa2b288749e0436476 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 21 Jan 2016 12:03:52 -0600 Subject: [PATCH 6/9] Silence pointer truncation warnings in Ppmd7.c --- lzma/C/Ppmd7.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lzma/C/Ppmd7.c b/lzma/C/Ppmd7.c index 7ef84d47b..abd7e6309 100644 --- a/lzma/C/Ppmd7.c +++ b/lzma/C/Ppmd7.c @@ -276,12 +276,12 @@ static void *ShrinkUnits(CPpmd7 *p, void *oldPtr, unsigned oldNU, unsigned newNU return oldPtr; } -#define SUCCESSOR(p) ((CPpmd_Void_Ref)((p)->SuccessorLow | ((UInt32)(p)->SuccessorHigh << 16))) +#define SUCCESSOR(p) ((CPpmd_Void_Ref)(size_t)((p)->SuccessorLow | ((UInt32)(p)->SuccessorHigh << 16))) static void SetSuccessor(CPpmd_State *p, CPpmd_Void_Ref v) { - (p)->SuccessorLow = (UInt16)((UInt32)(v) & 0xFFFF); - (p)->SuccessorHigh = (UInt16)(((UInt32)(v) >> 16) & 0xFFFF); + (p)->SuccessorLow = (UInt16)((UInt32)((size_t)v) & 0xFFFF); + (p)->SuccessorHigh = (UInt16)(((UInt32)((size_t)v) >> 16) & 0xFFFF); } static void RestartModel(CPpmd7 *p) From 39014b173294049b4e14f283894b0d6baa2e6da0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 21 Jan 2016 20:13:55 +0100 Subject: [PATCH 7/9] - make the startalpha parameter of A_SpawnParticle a float to be consistent with other functions that want an alpha value. --- src/thingdef/thingdef_codeptr.cpp | 4 ++-- wadsrc/static/actors/actor.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 6fd1b3aa8..22a0b8d10 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2645,14 +2645,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) ACTION_PARAM_COLOR(color, 6); ACTION_PARAM_INT(lifetime, 7); ACTION_PARAM_BOOL(fullbright, 8); - ACTION_PARAM_INT(startalpha, 9); // Byte trans + ACTION_PARAM_FIXED(startalphaf, 9); 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(startalpha, 0, 0xFF); // Clamp to byte + BYTE startalpha = (BYTE)Scale(clamp(startalphaf, 0, FRACUNIT), 255, FRACUNIT); lifetime = clamp(lifetime, 0, 0xFF); // Clamp to byte fadestep = clamp(fadestep, -1, 0xFF); // Clamp to byte inc. -1 (indicating automatic) size = clamp(size, 0, 0xFF); // Clamp to byte diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 0d31851b7..093ace107 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -234,7 +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 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_SpawnParticle(float xoff, float yoff, float zoff, float velx, float vely, float velz, color color1, int lifetime, bool fullbright = false, float startalpha = 1, 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 itemtype); From 13dc6be5a12079898f3c30c64e96a8987149a3ab Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Thu, 21 Jan 2016 16:36:58 -0600 Subject: [PATCH 8/9] - Added flags for A_SpawnParticle and angle parameter. - SPF_FULLBRIGHT makes the particle full bright. - SPF_RELATIVE encapsulates the following flags: - SPF_RELPOS: Position is relative to angle. - SPF_RELVEL: Velocity is relative to angle. - SPF_RELACCEL: Acceleration is relative to angle. - SPF_RELANG: Add caller's angle to angle parameter for relativity. --- src/thingdef/thingdef_codeptr.cpp | 38 +++++++++++++++++++++++++++--- wadsrc/static/actors/actor.txt | 2 +- wadsrc/static/actors/constants.txt | 11 +++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 22a0b8d10..a10c109eb 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2633,6 +2633,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris) // A_SpawnParticle // //=========================================================================== +enum SPFflag +{ + SPF_FULLBRIGHT = 1, + SPF_RELPOS = 1 << 1, + SPF_RELVEL = 1 << 2, + SPF_RELACCEL = 1 << 3, + SPF_RELANG = 1 << 4, +}; DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) { ACTION_PARAM_START(15); @@ -2644,13 +2652,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) ACTION_PARAM_FIXED(zvel, 5); ACTION_PARAM_COLOR(color, 6); ACTION_PARAM_INT(lifetime, 7); - ACTION_PARAM_BOOL(fullbright, 8); + ACTION_PARAM_INT(flags, 8); ACTION_PARAM_FIXED(startalphaf, 9); 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); + ACTION_PARAM_ANGLE(angle, 15); BYTE startalpha = (BYTE)Scale(clamp(startalphaf, 0, FRACUNIT), 255, FRACUNIT); lifetime = clamp(lifetime, 0, 0xFF); // Clamp to byte @@ -2659,8 +2668,31 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) if (lifetime != 0) { - fixedvec3 pos = self->Vec3Offset(xoff, yoff, zoff); - P_SpawnParticle(pos.x, pos.y, pos.z, xvel, yvel, zvel, color, fullbright, startalpha, lifetime, size, fadestep, accelx, accely, accelz); + const angle_t ang = (angle + ((flags & SPF_RELANG) ? self->angle : 0)) >> ANGLETOFINESHIFT; + fixedvec3 pos; + //[MC] Code ripped right out of A_SpawnItemEx. + if (flags & SPF_RELPOS) + { + // in relative mode negative y values mean 'left' and positive ones mean 'right' + // This is the inverse orientation of the absolute mode! + const fixed_t xof1 = xoff; + xoff = FixedMul(xof1, finecosine[ang]) + FixedMul(yoff, finesine[ang]); + yoff = FixedMul(xof1, finesine[ang]) - FixedMul(yoff, finecosine[ang]); + } + if (flags & SPF_RELVEL) + { + const fixed_t newxvel = FixedMul(xvel, finecosine[ang]) + FixedMul(yvel, finesine[ang]); + yvel = FixedMul(xvel, finesine[ang]) - FixedMul(yvel, finecosine[ang]); + xvel = newxvel; + } + if (flags & SPF_RELACCEL) + { + fixed_t newaccelx = FixedMul(accelx, finecosine[ang]) + FixedMul(accely, finesine[ang]); + accely = FixedMul(accelx, finesine[ang]) - FixedMul(accely, finecosine[ang]); + accelx = newaccelx; + } + pos = self->Vec3Offset(xoff, yoff, zoff); + P_SpawnParticle(pos.x, pos.y, pos.z, xvel, yvel, zvel, color, !!(flags & SPF_FULLBRIGHT), startalpha, lifetime, size, fadestep, accelx, accely, accelz); } } diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 093ace107..71cf77ba6 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -234,7 +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 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, float startalpha = 1, int size = 1, int fadestep = -1, float accelx = 0.0, float accely = 0.0, float accelz = 0.0); + action native A_SpawnParticle(float xoff, float yoff, float zoff, float velx, float vely, float velz, color color1, int lifetime, int flags = 0, float startalpha = 1, int size = 1, int fadestep = -1, float accelx = 0.0, float accely = 0.0, float accelz = 0.0, float angle = 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 itemtype); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index a88290451..b2d641b69 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -511,6 +511,17 @@ enum CBF_SETONPTR = 1 << 4, //Sets the pointer change on the actor doing the checking instead of self. }; +enum +{ + SPF_FULLBRIGHT = 1, + SPF_RELPOS = 1 << 1, + SPF_RELVEL = 1 << 2, + SPF_RELACCEL = 1 << 3, + SPF_RELANG = 1 << 4, + + SPF_RELATIVE = SPF_RELPOS|SPF_RELVEL|SPF_RELACCEL|SPF_RELANG +}; + // This is only here to provide one global variable for testing. native int testglobalvar; From 3b4ed8d7cd48e35cd68d3bf06026cf25818449a6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 22 Jan 2016 00:54:09 +0100 Subject: [PATCH 9/9] - made A_SpawnParticle's fadestep parameter a fixed point value as well. --- src/thingdef/thingdef_codeptr.cpp | 4 ++-- wadsrc/static/actors/actor.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 22a0b8d10..171913e78 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2647,14 +2647,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) ACTION_PARAM_BOOL(fullbright, 8); ACTION_PARAM_FIXED(startalphaf, 9); ACTION_PARAM_INT(size, 10); - ACTION_PARAM_INT(fadestep, 11); + ACTION_PARAM_FIXED(fadestepf, 11); ACTION_PARAM_FIXED(accelx, 12); ACTION_PARAM_FIXED(accely, 13); ACTION_PARAM_FIXED(accelz, 14); BYTE startalpha = (BYTE)Scale(clamp(startalphaf, 0, FRACUNIT), 255, FRACUNIT); + int fadestep = fadestepf < 0? -1 : Scale(clamp(fadestepf, 0, FRACUNIT), 255, FRACUNIT); lifetime = clamp(lifetime, 0, 0xFF); // Clamp to byte - fadestep = clamp(fadestep, -1, 0xFF); // Clamp to byte inc. -1 (indicating automatic) size = clamp(size, 0, 0xFF); // Clamp to byte if (lifetime != 0) diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 093ace107..14925eb5a 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -234,7 +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 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, float startalpha = 1, int size = 1, int fadestep = -1, float accelx = 0.0, float accely = 0.0, float accelz = 0.0); + action native A_SpawnParticle(float xoff, float yoff, float zoff, float velx, float vely, float velz, color color1, int lifetime, bool fullbright = false, float startalpha = 1, int size = 1, float 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 itemtype);