From a8248433e95080d8bc2d94910ea6a49f14b2c596 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sun, 1 May 2016 08:45:50 -0500 Subject: [PATCH 1/8] - Updated /flat/roll/wall sprites submission to 2.9+. (ZDoom compatibility submission. ) - FLATSPRITE: An actor becomes flat as if they were a decal on the floor. - PITCHFLATSPRITE: A flat sprite tilts up and down based on pitch. - WALLSPRITE: Similar to a Y billboarded sprite. The degree of the flattening is determined by the FlatAngle property. - ROLLSPRITE: The sprite of the actor is affected by the Roll property. --- src/actor.h | 5 ++++- src/p_mobj.cpp | 3 ++- src/thingdef/thingdef_codeptr.cpp | 22 ++++++++++++++++++++++ src/thingdef/thingdef_data.cpp | 5 +++++ src/version.h | 4 ++-- wadsrc/static/actors/actor.txt | 1 + 6 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/actor.h b/src/actor.h index 0336c41857..1d1090c192 100644 --- a/src/actor.h +++ b/src/actor.h @@ -407,12 +407,14 @@ enum ActorRenderFlag RF_SPRITETYPEMASK = 0x7000, // ---Different sprite types, not all implemented RF_FACESPRITE = 0x0000, // Face sprite RF_WALLSPRITE = 0x1000, // Wall sprite - RF_FLOORSPRITE = 0x2000, // Floor sprite + RF_FLATSPRITE = 0x2000, // Flat sprite RF_VOXELSPRITE = 0x3000, // Voxel object + RF_PITCHFLATSPRITE = 0x4000, // [MC] Flat sprite that rotates around pitch (GZDoom only) RF_INVISIBLE = 0x8000, // Don't bother drawing this actor RF_FORCEYBILLBOARD = 0x10000, // [BB] OpenGL only: draw with y axis billboard, i.e. anchored to the floor (overrides gl_billboard_mode setting) RF_FORCEXYBILLBOARD = 0x20000, // [BB] OpenGL only: draw with xy axis billboard, i.e. unanchored (overrides gl_billboard_mode setting) + RF_ROLLSPRITE = 0x40000, //[marrub]roll the sprite billboard }; // This translucency value produces the closest match to Heretic's TINTTAB. @@ -974,6 +976,7 @@ public: DVector3 OldRenderPos; DRotator Angles; + DAngle FlatAngle; DVector3 Vel; double Speed; double FloatSpeed; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index b7d8871951..77e862028b 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -262,7 +262,8 @@ void AActor::Serialize(FArchive &arc) << projectilepassheight << Vel << tics - << state; + << state + << FlatAngle; if (arc.IsStoring()) { int dmg; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 34a9cf02cc..20848f4785 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -6881,3 +6881,25 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMovementDirection) } ACTION_RETURN_BOOL(true); } + +//=========================================================================== +// +// A_SetFlatAngle +// +// Set actor's flat angle (in degrees). GZDoom only. Requires the +// (PITCH)FLATSPRITE flag to have any visible effect. +// +//=========================================================================== +DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFlatAngle) +{ + PARAM_ACTION_PROLOGUE; + PARAM_FLOAT_OPT(flatangle) { flatangle = 0; } + PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + + AActor *ref = COPY_AAPTR(self, ptr); + if (ref != NULL) + { + ref->FlatAngle = flatangle; + } + return 0; +} \ No newline at end of file diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index efb7be0c25..8b245e8289 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -265,6 +265,11 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(RF, INVISIBLE, AActor, renderflags), DEFINE_FLAG(RF, FORCEYBILLBOARD, AActor, renderflags), DEFINE_FLAG(RF, FORCEXYBILLBOARD, AActor, renderflags), + DEFINE_FLAG(RF, ROLLSPRITE, AActor, renderflags), // [marrub] roll the sprite billboard + // [fgsfds] Flat sprites + DEFINE_FLAG(RF, FLATSPRITE, AActor, renderflags), + DEFINE_FLAG(RF, WALLSPRITE, AActor, renderflags), + DEFINE_FLAG(RF, PITCHFLATSPRITE, AActor, renderflags), // Bounce flags DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags), diff --git a/src/version.h b/src/version.h index 21d05b3ed6..68c7d0325b 100644 --- a/src/version.h +++ b/src/version.h @@ -72,11 +72,11 @@ const char *GetVersionString(); // SAVESIG should match SAVEVER. // MINSAVEVER is the minimum level snapshot version that can be loaded. -#define MINSAVEVER 4545 +#define MINSAVEVER 4546 // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4545 +#define SAVEVER 4546 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 8b35be30d0..f47a1d87ac 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -325,6 +325,7 @@ ACTOR Actor native //: Thinker native state A_CheckSightOrRange(float distance, state label, bool two_dimension = false); native state A_CheckRange(float distance, state label, bool two_dimension = false); action native bool A_FaceMovementDirection(float offset = 0, float anglelimit = 0, float pitchlimit = 0, int flags = 0, int ptr = AAPTR_DEFAULT); + action native A_SetFlatAngle(float flatangle = 0, int ptr = AAPTR_DEFAULT); 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); From 9ba547e6e3c835b9555097b9956e91ae2996f06e Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sun, 1 May 2016 11:38:20 -0500 Subject: [PATCH 2/8] Revert MINSAVEVER and added FlatAngle DECORATE property expression. --- src/namedef.h | 1 + src/p_mobj.cpp | 7 +++++-- src/thingdef/thingdef_data.cpp | 1 + src/version.h | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/namedef.h b/src/namedef.h index 17fa9e2910..622e5ed5f2 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -300,6 +300,7 @@ xx(ATan2) xx(VectorAngle) xx(Alpha) xx(Angle) +xx(FlatAngle) xx(Args) xx(CeilingZ) xx(FloorZ) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 77e862028b..5dbfd96515 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -262,8 +262,11 @@ void AActor::Serialize(FArchive &arc) << projectilepassheight << Vel << tics - << state - << FlatAngle; + << state; + if (SaveVersion >= 4545) + { + arc << FlatAngle; + } if (arc.IsStoring()) { int dmg; diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 8b245e8289..9669c78ab0 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -627,6 +627,7 @@ void InitThingdef() PType *array5 = NewArray(TypeSInt32, 5); symt.AddSymbol(new PField(NAME_Alpha, TypeFloat64, VARF_Native, myoffsetof(AActor,Alpha))); symt.AddSymbol(new PField(NAME_Angle, TypeFloat64, VARF_Native, myoffsetof(AActor,Angles.Yaw))); + symt.AddSymbol(new PField(NAME_FlatAngle, TypeFloat64, VARF_Native, myoffsetof(AActor,FlatAngle))); symt.AddSymbol(new PField(NAME_Args, array5, VARF_Native, myoffsetof(AActor,args))); symt.AddSymbol(new PField(NAME_CeilingZ, TypeFloat64, VARF_Native, myoffsetof(AActor,ceilingz))); symt.AddSymbol(new PField(NAME_FloorZ, TypeFloat64, VARF_Native, myoffsetof(AActor,floorz))); diff --git a/src/version.h b/src/version.h index 68c7d0325b..52b7ea0ba6 100644 --- a/src/version.h +++ b/src/version.h @@ -72,7 +72,7 @@ const char *GetVersionString(); // SAVESIG should match SAVEVER. // MINSAVEVER is the minimum level snapshot version that can be loaded. -#define MINSAVEVER 4546 +#define MINSAVEVER 4545 // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. From 3ed95510545914d3e1408c8212f6f90067bf55b3 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sun, 1 May 2016 14:33:22 -0500 Subject: [PATCH 3/8] Fixed typo. --- 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 5dbfd96515..e51a62856f 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -263,7 +263,7 @@ void AActor::Serialize(FArchive &arc) << Vel << tics << state; - if (SaveVersion >= 4545) + if (SaveVersion >= 4546) { arc << FlatAngle; } From f41dcc75d1fc8bebe986d2e8fffb0ff2314573ac Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sun, 1 May 2016 16:33:00 -0500 Subject: [PATCH 4/8] FlatAngle can now be defined directly via properties. --- src/thingdef/thingdef_properties.cpp | 9 +++++++++ wadsrc/static/actors/actor.txt | 1 + 2 files changed, 10 insertions(+) diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 3ec4c624d5..7bf72fc485 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -682,6 +682,15 @@ DEFINE_PROPERTY(scale, F, Actor) defaults->Scale.X = defaults->Scale.Y = id; } +//========================================================================== +// +//========================================================================== +DEFINE_PROPERTY(flatangle, F, Actor) +{ + PROP_DOUBLE_PARM(id, 0); + defaults->FlatAngle = id; +} + //========================================================================== // //========================================================================== diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index f47a1d87ac..8794debde9 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -35,6 +35,7 @@ ACTOR Actor native //: Thinker BloodType "Blood", "BloodSplatter", "AxeBlood" ExplosionDamage 128 MissileHeight 32 + FlatAngle 0 // Functions From 0bf7c3e362cc40852b0244dfd2ac8cd89a629b19 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sun, 1 May 2016 17:19:39 -0500 Subject: [PATCH 5/8] - Removed FlatAngle. This will come back hopefully in another commit sometime in the future. --- src/actor.h | 1 - src/p_mobj.cpp | 4 ---- src/thingdef/thingdef_codeptr.cpp | 21 --------------------- src/thingdef/thingdef_data.cpp | 1 - src/thingdef/thingdef_properties.cpp | 9 --------- src/version.h | 2 +- wadsrc/static/actors/actor.txt | 5 +---- 7 files changed, 2 insertions(+), 41 deletions(-) diff --git a/src/actor.h b/src/actor.h index 1d1090c192..7ef63bb947 100644 --- a/src/actor.h +++ b/src/actor.h @@ -976,7 +976,6 @@ public: DVector3 OldRenderPos; DRotator Angles; - DAngle FlatAngle; DVector3 Vel; double Speed; double FloatSpeed; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index e51a62856f..b7d8871951 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -263,10 +263,6 @@ void AActor::Serialize(FArchive &arc) << Vel << tics << state; - if (SaveVersion >= 4546) - { - arc << FlatAngle; - } if (arc.IsStoring()) { int dmg; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 20848f4785..9b8975063b 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -6882,24 +6882,3 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMovementDirection) ACTION_RETURN_BOOL(true); } -//=========================================================================== -// -// A_SetFlatAngle -// -// Set actor's flat angle (in degrees). GZDoom only. Requires the -// (PITCH)FLATSPRITE flag to have any visible effect. -// -//=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFlatAngle) -{ - PARAM_ACTION_PROLOGUE; - PARAM_FLOAT_OPT(flatangle) { flatangle = 0; } - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } - - AActor *ref = COPY_AAPTR(self, ptr); - if (ref != NULL) - { - ref->FlatAngle = flatangle; - } - return 0; -} \ No newline at end of file diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 9669c78ab0..8b245e8289 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -627,7 +627,6 @@ void InitThingdef() PType *array5 = NewArray(TypeSInt32, 5); symt.AddSymbol(new PField(NAME_Alpha, TypeFloat64, VARF_Native, myoffsetof(AActor,Alpha))); symt.AddSymbol(new PField(NAME_Angle, TypeFloat64, VARF_Native, myoffsetof(AActor,Angles.Yaw))); - symt.AddSymbol(new PField(NAME_FlatAngle, TypeFloat64, VARF_Native, myoffsetof(AActor,FlatAngle))); symt.AddSymbol(new PField(NAME_Args, array5, VARF_Native, myoffsetof(AActor,args))); symt.AddSymbol(new PField(NAME_CeilingZ, TypeFloat64, VARF_Native, myoffsetof(AActor,ceilingz))); symt.AddSymbol(new PField(NAME_FloorZ, TypeFloat64, VARF_Native, myoffsetof(AActor,floorz))); diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 7bf72fc485..3ec4c624d5 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -682,15 +682,6 @@ DEFINE_PROPERTY(scale, F, Actor) defaults->Scale.X = defaults->Scale.Y = id; } -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(flatangle, F, Actor) -{ - PROP_DOUBLE_PARM(id, 0); - defaults->FlatAngle = id; -} - //========================================================================== // //========================================================================== diff --git a/src/version.h b/src/version.h index 52b7ea0ba6..21d05b3ed6 100644 --- a/src/version.h +++ b/src/version.h @@ -76,7 +76,7 @@ const char *GetVersionString(); // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4546 +#define SAVEVER 4545 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 8794debde9..6129d9b9b7 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -34,9 +34,7 @@ ACTOR Actor native //: Thinker DefThreshold 100 BloodType "Blood", "BloodSplatter", "AxeBlood" ExplosionDamage 128 - MissileHeight 32 - FlatAngle 0 - + MissileHeight 32 // Functions native bool CheckClass(class checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false); @@ -326,7 +324,6 @@ ACTOR Actor native //: Thinker native state A_CheckSightOrRange(float distance, state label, bool two_dimension = false); native state A_CheckRange(float distance, state label, bool two_dimension = false); action native bool A_FaceMovementDirection(float offset = 0, float anglelimit = 0, float pitchlimit = 0, int flags = 0, int ptr = AAPTR_DEFAULT); - action native A_SetFlatAngle(float flatangle = 0, int ptr = AAPTR_DEFAULT); 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); From def785e4620eb20cf017b19947803260604e59e4 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 2 May 2016 06:32:33 -0500 Subject: [PATCH 6/8] Removed PITCHFLATSPRITE. FLATSPRITE now encompasses its behavior. --- src/actor.h | 1 - src/namedef.h | 1 - src/thingdef/thingdef_data.cpp | 1 - 3 files changed, 3 deletions(-) diff --git a/src/actor.h b/src/actor.h index 7ef63bb947..e5fb4384e2 100644 --- a/src/actor.h +++ b/src/actor.h @@ -409,7 +409,6 @@ enum ActorRenderFlag RF_WALLSPRITE = 0x1000, // Wall sprite RF_FLATSPRITE = 0x2000, // Flat sprite RF_VOXELSPRITE = 0x3000, // Voxel object - RF_PITCHFLATSPRITE = 0x4000, // [MC] Flat sprite that rotates around pitch (GZDoom only) RF_INVISIBLE = 0x8000, // Don't bother drawing this actor RF_FORCEYBILLBOARD = 0x10000, // [BB] OpenGL only: draw with y axis billboard, i.e. anchored to the floor (overrides gl_billboard_mode setting) diff --git a/src/namedef.h b/src/namedef.h index 622e5ed5f2..17fa9e2910 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -300,7 +300,6 @@ xx(ATan2) xx(VectorAngle) xx(Alpha) xx(Angle) -xx(FlatAngle) xx(Args) xx(CeilingZ) xx(FloorZ) diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 8b245e8289..49b6b0dd83 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -269,7 +269,6 @@ static FFlagDef ActorFlagDefs[]= // [fgsfds] Flat sprites DEFINE_FLAG(RF, FLATSPRITE, AActor, renderflags), DEFINE_FLAG(RF, WALLSPRITE, AActor, renderflags), - DEFINE_FLAG(RF, PITCHFLATSPRITE, AActor, renderflags), // Bounce flags DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags), From 53837de17dd86407fc3fba2a61faf3aa35b78001 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sun, 5 Jun 2016 15:21:19 -0500 Subject: [PATCH 7/8] Added DONTFLIP flag. - By default, when viewing a flat sprite from behind, the image is flipped around on the X axis. This may not always be desired, so this flag disables it. --- src/actor.h | 3 ++- src/thingdef/thingdef_data.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/actor.h b/src/actor.h index e5fb4384e2..333059ce51 100644 --- a/src/actor.h +++ b/src/actor.h @@ -410,10 +410,11 @@ enum ActorRenderFlag RF_FLATSPRITE = 0x2000, // Flat sprite RF_VOXELSPRITE = 0x3000, // Voxel object RF_INVISIBLE = 0x8000, // Don't bother drawing this actor + RF_ROLLSPRITE = 0x40000, //[marrub]roll the sprite billboard + RF_DONTFLIP = 0x80000, // Don't flip it when viewed from behind. RF_FORCEYBILLBOARD = 0x10000, // [BB] OpenGL only: draw with y axis billboard, i.e. anchored to the floor (overrides gl_billboard_mode setting) RF_FORCEXYBILLBOARD = 0x20000, // [BB] OpenGL only: draw with xy axis billboard, i.e. unanchored (overrides gl_billboard_mode setting) - RF_ROLLSPRITE = 0x40000, //[marrub]roll the sprite billboard }; // This translucency value produces the closest match to Heretic's TINTTAB. diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 49b6b0dd83..b9e6414ffd 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -269,6 +269,7 @@ static FFlagDef ActorFlagDefs[]= // [fgsfds] Flat sprites DEFINE_FLAG(RF, FLATSPRITE, AActor, renderflags), DEFINE_FLAG(RF, WALLSPRITE, AActor, renderflags), + DEFINE_FLAG(RF, DONTFLIP, AActor, renderflags), // Bounce flags DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags), From d87665bfe0961f05414bc19da3ffeb1207f0e0e9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 4 Jul 2016 00:39:35 +0200 Subject: [PATCH 8/8] - fixed: A_CheckTerrain must add to the actor's current velocity, not set it. --- src/g_strife/a_strifestuff.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index 8b5788d44e..4e49121fac 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -317,7 +317,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain) int anglespeed = tagManager.GetFirstSectorTag(sec) - 100; double speed = (anglespeed % 10) / 16.; DAngle an = (anglespeed / 10) * (360 / 8.); - self->VelFromAngle(an, speed); + self->Thrust(an, speed); } } return 0;