From 63c86caae216779d08b378423ca99a5f5fd74265 Mon Sep 17 00:00:00 2001 From: LoboEire <67418208+LoboEire@users.noreply.github.com> Date: Mon, 4 Nov 2024 21:03:18 +0100 Subject: [PATCH] New Actions: GRAVITY and NO_GRAVITY For things.ddf and weapons.ddf --- edge_base/heretic/scripts/things.ddf | 7 ++++--- source_files/ddf/ddf_thing.cc | 3 +++ source_files/ddf/ddf_weapon.cc | 4 ++++ source_files/edge/p_action.cc | 9 +++++++++ source_files/edge/p_action.h | 3 +++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/edge_base/heretic/scripts/things.ddf b/edge_base/heretic/scripts/things.ddf index 27a963a3c..53daaac4a 100644 --- a/edge_base/heretic/scripts/things.ddf +++ b/edge_base/heretic/scripts/things.ddf @@ -1480,7 +1480,7 @@ PAINCHANCE=90%; CASTORDER=7; BLOOD=BLOOD; FLOAT_SPEED=5; -SPECIAL=COUNT_AS_KILL,SOLID,SPAWNCEILING,CLIMBABLE,SHOOTABLE,NOGRAVITY,FLOATER; +SPECIAL=COUNT_AS_KILL,SOLID,SPAWNCEILING,CLIMBABLE,SHOOTABLE,NOGRAVITY,FLOATER,NOGRAV_KILL; MINATTACK_CHANCE=22%; CASTORDER=7; BLOOD=BLOOD; @@ -1537,11 +1537,12 @@ STATES(DEATH)=IMPX:G:0:NORMAL:KILLSOUND, IMPX:G:4:NORMAL:MAKEDEATHSOUND, IMPX:H:3:NORMAL:SPARE_ATTACK, IMPX:H:1:NORMAL:SPARE_ATTACK, - IMPX:H:0:NORMAL:JUMP(DEATH:6,50%), + IMPX:H:0:NORMAL:JUMP(DEATH:7,50%), IMPX:H:1:NORMAL:SPARE_ATTACK, + IMPX:H:7:NORMAL:GRAVITY, IMPX:I:7:NORMAL:NOTHING, IMPX:J:7:NORMAL:MAKEDEAD, - IMPX:K:7:NORMAL:NOTHING, + IMPX:K:7:NORMAL:NOTHING, IMPX:L:-1:NORMAL:NOTHING; STATES(OVERKILL)=IMPX:S:5:NORMAL:NOTHING, diff --git a/source_files/ddf/ddf_thing.cc b/source_files/ddf/ddf_thing.cc index 83b8b5c2d..20d4a14b4 100644 --- a/source_files/ddf/ddf_thing.cc +++ b/source_files/ddf/ddf_thing.cc @@ -312,6 +312,9 @@ const DDFActionCode thing_actions[] = {{"NOTHING", nullptr, nullptr}, {"CLEAR_INVULNERABLE", A_ClearInvuln, nullptr}, {"SET_PAINCHANCE", A_PainChanceSet, DDFStateGetPercent}, + {"GRAVITY", A_Gravity, nullptr}, + {"NO_GRAVITY", A_NoGravity, nullptr}, + {"CLEAR_TARGET", A_ClearTarget, nullptr}, {"FRIEND_LOOKOUT", A_FriendLook, nullptr}, diff --git a/source_files/ddf/ddf_weapon.cc b/source_files/ddf/ddf_weapon.cc index 845473629..54be7dc7b 100644 --- a/source_files/ddf/ddf_weapon.cc +++ b/source_files/ddf/ddf_weapon.cc @@ -192,6 +192,10 @@ static const DDFActionCode weapon_actions[] = {{"NOTHING", nullptr, nullptr}, {"ZOOM", A_WeaponZoom, nullptr}, {"SET_INVULNERABLE", A_SetInvuln, nullptr}, {"CLEAR_INVULNERABLE", A_ClearInvuln, nullptr}, + + {"GRAVITY", A_Gravity, nullptr}, + {"NO_GRAVITY", A_NoGravity, nullptr}, + {"MOVE_FWD", WA_MoveFwd, DDFStateGetFloat}, {"MOVE_RIGHT", WA_MoveRight, DDFStateGetFloat}, {"MOVE_UP", WA_MoveUp, DDFStateGetFloat}, diff --git a/source_files/edge/p_action.cc b/source_files/edge/p_action.cc index 10a50bd6d..5bc4bea6f 100644 --- a/source_files/edge/p_action.cc +++ b/source_files/edge/p_action.cc @@ -5088,6 +5088,15 @@ void A_PainChanceSet(MapObject *mo) mo->pain_chance_ = value; } +void A_Gravity(MapObject *mo) +{ + mo->flags_ &= ~kMapObjectFlagNoGravity; //Remove NoGravity flag +} + +void A_NoGravity(MapObject *mo) +{ + mo->flags_ |= kMapObjectFlagNoGravity; //Set NoGravity flag +} // Thing will forget both current target and supported player void A_ClearTarget(MapObject *object) diff --git a/source_files/edge/p_action.h b/source_files/edge/p_action.h index 38f38cc03..379848d85 100644 --- a/source_files/edge/p_action.h +++ b/source_files/edge/p_action.h @@ -200,6 +200,9 @@ void A_ClearInvuln(MapObject *mo); void A_PainChanceSet(MapObject *mo); +void A_Gravity(MapObject *mo); +void A_NoGravity(MapObject *mo); + void A_ClearTarget(MapObject *mo); void A_FriendLook(MapObject *mo); bool FindPlayerToSupport(MapObject *mo);