From e4b236cbccc8fc5972c072baea19896d53c365ac Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 14 Jan 2011 22:59:20 +0000 Subject: [PATCH] - added DavidPH's A_SetMass submission. SVN r3105 (trunk) --- src/p_acs.cpp | 7 +++++++ src/thingdef/thingdef_codeptr.cpp | 15 +++++++++++++++ src/thingdef/thingdef_expression.cpp | 1 + wadsrc/static/actors/actor.txt | 2 ++ 4 files changed, 25 insertions(+) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 497c0fbdf..72648a052 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -2543,6 +2543,7 @@ enum APROP_ScaleX = 29, APROP_ScaleY = 30, APROP_Dormant = 31, + APROP_Mass = 32, }; // These are needed for ACS's APROP_RenderStyle @@ -2731,6 +2732,10 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value) actor->scaleY = value; break; + case APROP_Mass: + actor->Mass = value; + break; + default: // do nothing. break; @@ -2796,6 +2801,7 @@ int DLevelScript::GetActorProperty (int tid, int property) case APROP_WaterLevel: return actor->waterlevel; case APROP_ScaleX: return actor->scaleX; case APROP_ScaleY: return actor->scaleY; + case APROP_Mass: return actor->Mass; default: return 0; } @@ -2833,6 +2839,7 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value) case APROP_WaterLevel: case APROP_ScaleX: case APROP_ScaleY: + case APROP_Mass: return (GetActorProperty(tid, property) == value); // Boolean values need to compare to a binary version of value diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index a40c49467..1717a77e1 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2037,6 +2037,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale) self->scaleY = scaley ? scaley : scalex; } +//=========================================================================== +// +// A_SetMass(int mass) +// +// Sets the actor's mass. +// +//=========================================================================== +DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetMass) +{ + ACTION_PARAM_START(2); + ACTION_PARAM_INT(mass, 0); + + self->Mass = mass; +} + //=========================================================================== // // A_SpawnDebris diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 5f7238e29..f31753b1b 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -61,6 +61,7 @@ DEFINE_MEMBER_VARIABLE(args, AActor) DEFINE_MEMBER_VARIABLE(ceilingz, AActor) DEFINE_MEMBER_VARIABLE(floorz, AActor) DEFINE_MEMBER_VARIABLE(health, AActor) +DEFINE_MEMBER_VARIABLE(Mass, AActor) DEFINE_MEMBER_VARIABLE(pitch, AActor) DEFINE_MEMBER_VARIABLE(special, AActor) DEFINE_MEMBER_VARIABLE(special1, AActor) diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index f8dd3d863..b0bb3a3d8 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -32,6 +32,7 @@ ACTOR Actor native //: Thinker native fixed_t ceilingz; native fixed_t floorz; native int health; + native int mass; native angle_t pitch; native int special; native int tid; @@ -207,6 +208,7 @@ ACTOR Actor native //: Thinker action native A_FadeOut(float reduce = 0.1, bool remove = true); action native A_FadeTo(float target, float amount = 0.1, bool remove = false); action native A_SetScale(float scalex, float scaley = 0); + 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_CheckSight(state label); action native A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false);