Clean up bladeTrap

This commit is contained in:
Macrepeh 2021-02-28 21:22:52 -05:00 committed by GitHub
parent 0748c59ff2
commit 5beea564a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 17 deletions

View File

@ -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);
}
}