From 5beea564a27bba61b38673de6fb9cee4a167f113 Mon Sep 17 00:00:00 2001 From: Macrepeh <63179588+Macrepeh@users.noreply.github.com> Date: Sun, 28 Feb 2021 21:22:52 -0500 Subject: [PATCH] Clean up bladeTrap --- src/enemy/bladeTrap.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c index c8ffa9af..95d2d8d4 100644 --- a/src/enemy/bladeTrap.c +++ b/src/enemy/bladeTrap.c @@ -1,31 +1,25 @@ #include "global.h" #include "entity.h" #include "room.h" + extern void sub_080A2CC0(); extern void sub_0806F69C(); extern void EnqueueSFX(); -void BladeTrap(Entity* ent) { - u16 uVar1; - Entity* pEVar2; - u16* puVar3; - if (ent->action == 0) { - ent->action = 1; - pEVar2 = GetCurrentRoomProperty((u8)ent->type); - ent->attachedEntity = pEVar2; - sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, &ent->field_0x74); +void BladeTrap(Entity* this) { + if (this->action == 0) { + this->action = 1; + this->attachedEntity = GetCurrentRoomProperty(this->type); + sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74); } - if ((ent->direction & 0x80) == 0) { - sub_0806F69C(ent); + if (!(this->direction & 0x80)) { + sub_0806F69C(this); } - puVar3 = &(ent->field_0x74.HWORD); - uVar1 = *puVar3; - *puVar3 = uVar1 - 1; - if ((*puVar3) == 0) { - if ((u16)(ent->direction & 0x80) == 0) { + if (!(--this->field_0x74.HWORD)) { + if (!(this->direction & 0x80)) { EnqueueSFX(0x74); } - sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, puVar3); + sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74.HWORD); } }