Skip to content

Commit

Permalink
Interactive: Use Entity reference
Browse files Browse the repository at this point in the history
  • Loading branch information
dscharrer committed Aug 20, 2021
1 parent d5d6f9c commit 15662f2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
43 changes: 20 additions & 23 deletions src/scene/Interactive.cpp
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/scene/Interactive.h
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/script/ScriptedControl.cpp
Expand Up @@ -74,7 +74,7 @@ class ActivatePhysicsCommand : public Command {

DebugScript("");

ARX_INTERACTIVE_ActivatePhysics(context.getEntity()->index());
ARX_INTERACTIVE_ActivatePhysics(*context.getEntity());

return Success;
}
Expand Down

0 comments on commit 15662f2

Please sign in to comment.