Skip to content

Commit

Permalink
Merge pull request #749 from LoboEire/master
Browse files Browse the repository at this point in the history
New DDF action: SET_SCALE(float)
  • Loading branch information
dashodanger authored Dec 1, 2024
2 parents faeb5ce + 81c6923 commit bc08dcc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source_files/ddf/ddf_thing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ const DDFActionCode thing_actions[] = {{"NOTHING", nullptr, nullptr},
{"CLEAR_TARGET", A_ClearTarget, nullptr},
{"FRIEND_LOOKOUT", A_FriendLook, nullptr},

{"SET_SCALE", A_ScaleSet, DDFStateGetFloat},

{"DROPITEM", A_DropItem, DDFStateGetMobj},
{"SPAWN", A_Spawn, DDFStateGetMobj},
{"TRANS_SET", A_TransSet, DDFStateGetPercent},
Expand Down
13 changes: 13 additions & 0 deletions source_files/edge/p_action.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5088,6 +5088,19 @@ void A_PainChanceSet(MapObject *mo)
mo->pain_chance_ = value;
}

void A_ScaleSet(MapObject *mo)
{
float value = mo->info_->scale_; //grab the default scale for this thing as a fallback

const State *st = mo->state_;

if (st && st->action_par)
{
value = ((float *)st->action_par)[0];
}
mo->scale_ = value;
}

void A_Gravity(MapObject *mo)
{
mo->flags_ &= ~kMapObjectFlagNoGravity; //Remove NoGravity flag
Expand Down
2 changes: 2 additions & 0 deletions source_files/edge/p_action.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ void A_ClearInvuln(MapObject *mo);

void A_PainChanceSet(MapObject *mo);

void A_ScaleSet(MapObject *mo);

void A_Gravity(MapObject *mo);
void A_NoGravity(MapObject *mo);

Expand Down

0 comments on commit bc08dcc

Please sign in to comment.