diff --git a/src/scene/Interactive.cpp b/src/scene/Interactive.cpp index c844f96637..7cb95cb835 100644 --- a/src/scene/Interactive.cpp +++ b/src/scene/Interactive.cpp @@ -2222,31 +2222,28 @@ float ARX_INTERACTIVE_GetArmorClass(Entity * io) { return std::max(ac, 0.f); } -void ARX_INTERACTIVE_ActivatePhysics(EntityHandle t) { +void ARX_INTERACTIVE_ActivatePhysics(Entity & entity) { - Entity * io = entities.get(t); - if(io) { - - if(io == g_draggedEntity || io->show != SHOW_FLAG_IN_SCENE) { - return; - } - - arx_assert(!locateInInventories(io)); - - float yy; - EERIEPOLY * ep = CheckInPoly(io->pos, &yy); - - if(ep && (yy - io->pos.y < 10.f)) - return; - - io->obj->pbox->active = 1; - io->obj->pbox->stopcount = 0; - Vec3f fallvector = Vec3f(0.0f, 0.000001f, 0.f); - io->show = SHOW_FLAG_IN_SCENE; - io->soundtime = 0; - io->soundcount = 0; - EERIE_PHYSICS_BOX_Launch(io->obj, io->pos, io->angle, fallvector); + if(&entity == g_draggedEntity || entity.show != SHOW_FLAG_IN_SCENE) { + return; } + + arx_assert(!locateInInventories(&entity)); + + float yy; + EERIEPOLY * ep = CheckInPoly(entity.pos, &yy); + if(ep && (yy - entity.pos.y < 10.f)) { + return; + } + + entity.obj->pbox->active = 1; + entity.obj->pbox->stopcount = 0; + Vec3f fallvector = Vec3f(0.0f, 0.000001f, 0.f); + entity.show = SHOW_FLAG_IN_SCENE; + entity.soundtime = 0; + entity.soundcount = 0; + EERIE_PHYSICS_BOX_Launch(entity.obj, entity.pos, entity.angle, fallvector); + } std::string_view GetMaterialString(const res::path & texture) { diff --git a/src/scene/Interactive.h b/src/scene/Interactive.h index 4d63942477..f97786639d 100644 --- a/src/scene/Interactive.h +++ b/src/scene/Interactive.h @@ -184,7 +184,7 @@ bool HaveCommonGroup(Entity * io, Entity * ioo); void UpdateIOInvisibility(Entity * io); void CheckSetAnimOutOfTreatZone(Entity * io, AnimLayer & layer); void ARX_HALO_SetToNative(Entity * io); -void ARX_INTERACTIVE_ActivatePhysics(EntityHandle t); +void ARX_INTERACTIVE_ActivatePhysics(Entity & entity); void ResetVVPos(Entity * io); void UpdateGoldObject(Entity * io); diff --git a/src/script/ScriptedControl.cpp b/src/script/ScriptedControl.cpp index e730598008..8e5d0736d6 100644 --- a/src/script/ScriptedControl.cpp +++ b/src/script/ScriptedControl.cpp @@ -74,7 +74,7 @@ class ActivatePhysicsCommand : public Command { DebugScript(""); - ARX_INTERACTIVE_ActivatePhysics(context.getEntity()->index()); + ARX_INTERACTIVE_ActivatePhysics(*context.getEntity()); return Success; }