From 28502b9a80b7bb33a65e0fe5e2bda9e515efc135 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Thu, 21 Jan 2016 18:34:39 -0600 Subject: [PATCH 1/7] - Reorganized A_SpawnParticle parameters. - Decorate order is now color, x/y/zoff, velx/y/z, lifetime, angle, flags, size, startalphaf, fadestepf, accelx/y/z. - ACS order is now color, xyz offset, xyz velocity, lifetime, fullbright, size, startalpha, fadestep, xyz accel --- src/p_acs.cpp | 18 ++++++++-------- src/thingdef/thingdef_codeptr.cpp | 34 +++++++++++++++---------------- wadsrc/static/actors/actor.txt | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 84ac11f76..c80c2c47a 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -5993,17 +5993,17 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) 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]; + PalEntry color = args[0]; + fixed_t x = args[1]; + fixed_t y = args[2]; + fixed_t z = args[3]; + fixed_t xvel = args[4]; + fixed_t yvel = args[5]; + fixed_t zvel = 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 size = argCount > 9 ? args[9] : 1; + int startalpha = argCount > 10 ? args[10] : 0xFF; // Byte trans int fadestep = argCount > 11 ? args[11] : -1; fixed_t accelx = argCount > 12 ? args[12] : 0; fixed_t accely = argCount > 13 ? args[13] : 0; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 3770001c9..bd02127ae 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2645,23 +2645,23 @@ enum SPFflag 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_INT(flags, 8); - ACTION_PARAM_FIXED(startalphaf, 9); - ACTION_PARAM_INT(size, 10); - ACTION_PARAM_FIXED(fadestepf, 11); - ACTION_PARAM_FIXED(accelx, 12); - ACTION_PARAM_FIXED(accely, 13); - ACTION_PARAM_FIXED(accelz, 14); - ACTION_PARAM_ANGLE(angle, 15); - + ACTION_PARAM_COLOR(color, 0); + ACTION_PARAM_FIXED(xoff, 1); + ACTION_PARAM_FIXED(yoff, 2); + ACTION_PARAM_FIXED(zoff, 3); + ACTION_PARAM_FIXED(xvel, 4); + ACTION_PARAM_FIXED(yvel, 5); + ACTION_PARAM_FIXED(zvel, 6); + ACTION_PARAM_ANGLE(angle, 7); + ACTION_PARAM_INT(lifetime, 8); + ACTION_PARAM_INT(flags, 9); + ACTION_PARAM_INT(size, 10); + ACTION_PARAM_FIXED(startalphaf, 11); + ACTION_PARAM_FIXED(fadestepf, 12); + ACTION_PARAM_FIXED(accelx, 13); + ACTION_PARAM_FIXED(accely, 14); + ACTION_PARAM_FIXED(accelz, 15); + 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 diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 07dd0871b..3ae298051 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, int flags = 0, float startalpha = 1, int size = 1, float fadestep = -1, float accelx = 0.0, float accely = 0.0, float accelz = 0.0, float angle = 0); + action native A_SpawnParticle(color color1, float xoff, float yoff, float zoff, float velx, float vely, float velz, int lifetime, float angle = 0, int flags = 0, int size = 1, float startalphaf = 1, float fadestepf = -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 793fc907163c3dd571b0469447bdfc9466fec6df Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Thu, 21 Jan 2016 19:59:33 -0600 Subject: [PATCH 2/7] Once more homogenized! - DECORATE: color, flags, lifetime, size, angle, xyz offset/vel/accel, startalpha, fadestep. - ACS: Similar, minus the angle parameter. --- src/p_acs.cpp | 28 ++++++++++++++-------------- src/thingdef/thingdef_codeptr.cpp | 31 ++++++++++++++++--------------- wadsrc/static/actors/actor.txt | 2 +- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index c80c2c47a..931f3a127 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -5994,20 +5994,20 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) case ACSF_SpawnParticle: { PalEntry color = args[0]; - fixed_t x = args[1]; - fixed_t y = args[2]; - fixed_t z = args[3]; - fixed_t xvel = args[4]; - fixed_t yvel = args[5]; - fixed_t zvel = args[6]; - int lifetime = args[7]; - bool fullbright = argCount > 8 ? !!args[8] : false; - int size = argCount > 9 ? args[9] : 1; - int startalpha = argCount > 10 ? args[10] : 0xFF; // Byte trans - 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; + bool fullbright = argCount > 1 ? !!args[1] : false; + int lifetime = argCount > 2 ? args[2] : 35; + int size = argCount > 3 ? args[3] : 1; + fixed_t x = argCount > 4 ? args[4] : 0; + fixed_t y = argCount > 5 ? args[5] : 0; + fixed_t z = argCount > 6 ? args[6] : 0; + fixed_t xvel = argCount > 7 ? args[7] : 0; + fixed_t yvel = argCount > 8 ? args[8] : 0; + fixed_t zvel = argCount > 9 ? args[9] : 0; + fixed_t accelx = argCount > 10 ? args[10] : 0; + fixed_t accely = argCount > 11 ? args[11] : 0; + fixed_t accelz = argCount > 12 ? args[12] : 0; + 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 diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index bd02127ae..0cd450074 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2644,23 +2644,24 @@ 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_FIXED(xoff, 1); - ACTION_PARAM_FIXED(yoff, 2); - ACTION_PARAM_FIXED(zoff, 3); - ACTION_PARAM_FIXED(xvel, 4); - ACTION_PARAM_FIXED(yvel, 5); - ACTION_PARAM_FIXED(zvel, 6); - ACTION_PARAM_ANGLE(angle, 7); - ACTION_PARAM_INT(lifetime, 8); - ACTION_PARAM_INT(flags, 9); - ACTION_PARAM_INT(size, 10); - ACTION_PARAM_FIXED(startalphaf, 11); - ACTION_PARAM_FIXED(fadestepf, 12); - ACTION_PARAM_FIXED(accelx, 13); - ACTION_PARAM_FIXED(accely, 14); - ACTION_PARAM_FIXED(accelz, 15); + ACTION_PARAM_INT(flags, 1); + ACTION_PARAM_INT(lifetime, 2); + ACTION_PARAM_INT(size, 3); + ACTION_PARAM_ANGLE(angle, 4); + ACTION_PARAM_FIXED(xoff, 5); + ACTION_PARAM_FIXED(yoff, 6); + ACTION_PARAM_FIXED(zoff, 7); + ACTION_PARAM_FIXED(xvel, 8); + ACTION_PARAM_FIXED(yvel, 9); + ACTION_PARAM_FIXED(zvel, 10); + ACTION_PARAM_FIXED(accelx, 11); + ACTION_PARAM_FIXED(accely, 12); + ACTION_PARAM_FIXED(accelz, 13); + ACTION_PARAM_FIXED(startalphaf, 14); + ACTION_PARAM_FIXED(fadestepf, 15); BYTE startalpha = (BYTE)Scale(clamp(startalphaf, 0, FRACUNIT), 255, FRACUNIT); int fadestep = fadestepf < 0? -1 : Scale(clamp(fadestepf, 0, FRACUNIT), 255, FRACUNIT); diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 3ae298051..e435a18bf 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(color color1, float xoff, float yoff, float zoff, float velx, float vely, float velz, int lifetime, float angle = 0, int flags = 0, int size = 1, float startalphaf = 1, float fadestepf = -1, float accelx = 0.0, float accely = 0.0, float accelz = 0.0); + action native 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 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 2dff9a743c4eba2741ad96df63e25b37b83652e5 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Fri, 22 Jan 2016 22:26:21 +1300 Subject: [PATCH 3/7] Fixed Z-Velocity movement for MF5_NOINTERACTION --- src/p_mobj.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 8dda50de6..d691e062b 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3234,7 +3234,7 @@ void AActor::Tick () UnlinkFromWorld (); flags |= MF_NOBLOCKMAP; - SetXYZ(Vec3Offset(velx, vely, vely)); + SetXYZ(Vec3Offset(velx, vely, velz)); SetMovement(velx, vely, velz); LinkToWorld (); } From 2034f4e49f775a9059e813307eb8bc6e79051296 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Fri, 22 Jan 2016 23:06:09 +1300 Subject: [PATCH 4/7] Fixed cmf_aimdirection doubling up the spawn Z --- src/thingdef/thingdef_codeptr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 0cd450074..f61bd2825 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -953,7 +953,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile) break; case 2: - self->SetXYZ(self->Vec3Offset(x, y, self->Z())); + self->SetXYZ(self->Vec3Offset(x, y, 0)); missile = P_SpawnMissileAngleZSpeed(self, self->Z() + self->GetBobOffset() + spawnheight, ti, self->angle, 0, GetDefaultByType(ti)->Speed, self, false); self->SetXYZ(pos); From 01aaef1528486e49ba2367079698e96a24b54fd5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 22 Jan 2016 12:16:17 +0100 Subject: [PATCH 5/7] - fixed: The P_DamageMobj call for damaging sectors should be skipped completely if godmode is on, so that instant damage sectors don't kill an invulnerable player. --- src/p_spec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 523295642..2cb322278 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -463,7 +463,7 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector) } else if (level.time % sector->damageinterval == 0) { - P_DamageMobj(player->mo, NULL, NULL, sector->damageamount, sector->damagetype); + if (!(player->cheats & (CF_GODMODE|CF_GODMODE2))) P_DamageMobj(player->mo, NULL, NULL, sector->damageamount, sector->damagetype); if ((sector->Flags & SECF_ENDLEVEL) && player->health <= 10 && (!deathmatch || !(dmflags & DF_NO_EXIT))) { G_ExitLevel(0, false); From f4f7bd5d341abd01464b78b08b41d19f50d65750 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 22 Jan 2016 18:24:15 +0100 Subject: [PATCH 6/7] - fixed a double/fixed_t mixup in P_SeekerMissile --- src/p_mobj.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index d691e062b..d65f8b52c 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1684,7 +1684,8 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool preci angle_t pitch = 0; if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) { // Need to seek vertically - double dist = MAX(1.0, FVector2(actor->Vec2To(target)).Length()); + fixedvec2 vec = actor->Vec2To(target); + double dist = MAX(1.0, TVector2(vec.x, vec.y).Length()); // Aim at a player's eyes and at the middle of the actor for everything else. fixed_t aimheight = target->height/2; if (target->IsKindOf(RUNTIME_CLASS(APlayerPawn))) From 88f96950b58af3a43286d6ccbbe71caf5f1e1869 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Fri, 22 Jan 2016 11:47:41 -0600 Subject: [PATCH 7/7] Projectiles should set their z to floor, not add it. --- src/p_mobj.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index d65f8b52c..9f8fbe2ea 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2422,7 +2422,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz) { if ((mo->flags & MF_MISSILE) && !(mo->flags & MF_NOCLIP)) { - mo->AddZ(mo->floorz); + mo->SetZ(mo->floorz); if (mo->BounceFlags & BOUNCE_Floors) { mo->FloorBounceMissile (mo->floorsector->floorplane);