From 0be09f54bde1ab1ad084c4359d018d7e28341381 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 25 Jan 2016 15:44:11 -0600 Subject: [PATCH] Particles can now scale up to 65535. --- src/p_acs.cpp | 8 ++++---- src/p_effect.cpp | 2 +- src/p_effect.h | 4 ++-- src/thingdef/thingdef_codeptr.cpp | 5 ++--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index ff968d62f..3aab261f4 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -6009,10 +6009,10 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) int startalpha = argCount > 13 ? args[13] : 0xFF; // Byte trans int fadestep = argCount > 14 ? args[14] : -1; - 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, 127); // Clamp to byte + startalpha = clamp(startalpha, 0, 255); // Clamp to byte + lifetime = clamp(lifetime, 0, 255); // Clamp to byte + fadestep = clamp(fadestep, -1, 255); // Clamp to byte inc. -1 (indicating automatic) + size = clamp(size, 0, 65535); // Clamp to word if (lifetime != 0) P_SpawnParticle(x, y, z, xvel, yvel, zvel, color, fullbright, startalpha, lifetime, size, fadestep, accelx, accely, accelz); diff --git a/src/p_effect.cpp b/src/p_effect.cpp index 3ccfb67d2..84ed4c16f 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -284,7 +284,7 @@ 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) +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, WORD size, int fadestep, fixed_t accelx, fixed_t accely, fixed_t accelz) { particle_t *particle = NewParticle(); diff --git a/src/p_effect.h b/src/p_effect.h index aac9a63dc..d92c77e23 100644 --- a/src/p_effect.h +++ b/src/p_effect.h @@ -59,7 +59,7 @@ struct particle_t fixed_t accx,accy,accz; BYTE ttl; BYTE trans; - BYTE size:7; + WORD size; BYTE bright:1; BYTE fade; int color; @@ -83,7 +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_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, WORD 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 ac1afcf49..6926c1fac 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2644,7 +2644,6 @@ enum SPFflag DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) { - //(color color1, int flags = 0, int lifetime = 35, int size = 1, float angle = 0, float xoff = 0, float yoff = 0, float zoff = 0, float velx = 0, float vely = 0, float velz = 0, float accelx = 0, float accely = 0, float accelz = 0, float startalphaf = 1, float fadestepf = -1); ACTION_PARAM_START(15); ACTION_PARAM_COLOR(color, 0); ACTION_PARAM_INT(flags, 1); @@ -2665,8 +2664,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) 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 - size = clamp(size, 0, 0xFF); // Clamp to byte + lifetime = clamp(lifetime, 0, 255); // Clamp to byte + size = clamp(size, 0, 65535); // Clamp to word if (lifetime != 0) {