lightableSwitch OK

This commit is contained in:
theo3
2020-07-06 13:56:19 -07:00
parent a4a932deb6
commit c5897e647c
38 changed files with 197 additions and 373 deletions
+2 -2
View File
@@ -4,7 +4,7 @@
extern void sub_080A2CC0();
extern void sub_0806F69C();
extern void sub_08004488();
extern Entity* sub_0804B128();
extern Entity* GetCurrentRoomProperty();
void BladeTrap(Entity* ent) {
u16 uVar1;
@@ -12,7 +12,7 @@ void BladeTrap(Entity* ent) {
u16* puVar3;
if (ent->action == 0) {
ent->action = 1;
pEVar2 = sub_0804B128((u8)(ent->entityType).form);
pEVar2 = GetCurrentRoomProperty((u8)(ent->entityType).form);
ent->attachedEntity = pEVar2;
sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, &ent->field_0x74);
}
+2 -2
View File
@@ -19,7 +19,7 @@ extern bool32 sub_0806F520(Entity *);
extern void sub_0800449C(Entity *, u32);
extern void sub_0803CE14(Entity *);
extern void sub_0803CE3C(Entity *);
extern Entity *sub_0804B128(u8);
extern Entity *GetCurrentRoomProperty(u8);
extern void sub_0806F4E8(Entity *);
extern void sub_0806F69C(Entity *);
extern void sub_08079D84(void);
@@ -78,7 +78,7 @@ void sub_0803CD6C(Entity *this) {
this->height.HALF.HI = -2;
// Set parent to lakitu
lakitu = sub_0804B128(this->entityType.form);
lakitu = GetCurrentRoomProperty(this->entityType.form);
this->attachedEntity = lakitu;
this->parent = lakitu;
+145
View File
@@ -0,0 +1,145 @@
#include "global.h"
#include "entity.h"
#include "room.h"
#include "flags.h"
#include "functions.h"
extern void sub_0809EB30(Entity*);
extern void sub_0809EAD8(Entity*);
extern void sub_0809EABC(Entity*);
extern void sub_08004488(u32);
extern void sub_080A2CC0(Entity*, Entity**, u16*);
extern Entity* GetCurrentRoomProperty(u32);
extern void SetTile(u32, u32, u32);
extern void sub_0806F69C(Entity*);
extern void (*const gUnk_081243B4[])(Entity*);
extern void (*const gUnk_081243BC[])(Entity*);
extern void (*const gUnk_081243C4[])(Entity*);
extern BoundingBox gUnk_080FD150;
void LightableSwitch(Entity* this) {
gUnk_081243B4[this->entityType.form](this);
sub_0809EB30(this);
}
void sub_0809EA1C(Entity* this) {
gUnk_081243BC[this->action](this);
}
void sub_0809EA34(Entity* this) {
this->action = 1;
this->flags = this->flags | 0x80;
this->frameIndex = 0;
this->field_0x3c = 7;
this->field_0x40 = 0x48;
this->damageType = 0x28;
this->flags2 = 10;
this->boundingBox = &gUnk_080FD150;
sub_0809EAD8(this);
UpdateSpriteOrderAndFlip(this);
sub_0809EABC(this);
}
void sub_0809EA80(Entity* this) {
if ((this->bitfield & 0x80) != 0) {
if (CheckFlags(this->field_0x86) != 0) {
ClearFlag(this->field_0x86);
} else {
SetFlag(this->field_0x86);
}
sub_08004488(0x110);
}
sub_0809EABC(this);
}
void sub_0809EABC(Entity* this) {
bool32 anySet;
u32 f;
f = CheckFlags(this->field_0x86);
anySet = (-f | f) >> 0x1F;
if (this->frameIndex != anySet) {
this->frameIndex = anySet;
}
}
void sub_0809EAD8(Entity* this) {
u8 bVar1;
Entity* pEVar2;
if (this->entityType.parameter != 0) {
this->attachedEntity = GetCurrentRoomProperty(this->entityType.parameter);
sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74);
} else {
SetTile(0x4050, COORD_TO_TILE(this), this->collisionLayer);
}
}
void sub_0809EB30(Entity* this) {
u16 uVar1;
u16* puVar2;
if (this->entityType.parameter != 0) {
if ((this->direction & 0x80) == 0) {
sub_0806F69C(this);
}
puVar2 = &this->field_0x74;
if (!--*puVar2) {
sub_080A2CC0(this, &this->attachedEntity, puVar2);
}
}
}
void sub_0809EB68(Entity* this) {
gUnk_081243C4[this->action](this);
}
void sub_0809EB80(Entity* this) {
this->action = 1;
this->flags = this->flags | 0x80;
this->frameIndex = 3;
this->field_0x3c = 7;
this->field_0x40 = 0x48;
this->damageType = 0x28;
this->flags2 = 10;
this->boundingBox = &gUnk_080FD150;
sub_0809EAD8(this);
UpdateSpriteOrderAndFlip(this);
if (CheckFlags(this->cutsceneBeh.HWORD) != 0) {
this->action = 3;
this->frameIndex = 2;
}
}
void sub_0809EBD8(Entity* this) {
if ((this->bitfield & 0x80) != 0) {
this->action = 2;
this->actionDelay = 0x10;
this->frameIndex = 2;
SetFlag(this->field_0x86);
sub_08004488(0x110);
}
}
void sub_0809EC08(Entity* this) {
if (CheckFlags(this->cutsceneBeh.HWORD) != 0) {
this->action = 3;
} else {
if (--this->actionDelay == 0) {
this->action = 1;
this->frameIndex = 3;
ClearFlag(this->field_0x86);
sub_08004488(0x110);
}
}
}
void nullsub_126(Entity* this) { }
+5 -5
View File
@@ -3,7 +3,7 @@
void LoadRoomEntityList();
s32 CheckGlobalFlag(u32 flag);
extern s32* sub_0804B128(u8 unk);
extern s32* GetCurrentRoomProperty(u8 unk);
extern void sub_0804B058(s32* unk);
extern void sub_0804B1AC();
extern void sub_0801AC98();
@@ -15,13 +15,13 @@ void LoadRoom(void)
s32 iVar1;
s32* dat;
sub_0804B128(1);
GetCurrentRoomProperty(1);
LoadRoomEntityList();
sub_0804B128(0);
GetCurrentRoomProperty(0);
LoadRoomEntityList();
if (CheckGlobalFlag(21)) sub_0804B058(sub_0804B128(2));
sub_0804B128(3);
if (CheckGlobalFlag(21)) sub_0804B058(GetCurrentRoomProperty(2));
GetCurrentRoomProperty(3);
sub_0804B1AC();
sub_0801AC98();
}
+5 -5
View File
@@ -1,7 +1,7 @@
#include "global.h"
extern void sub_080186EC();
extern u32* sub_0804B128(u8);
extern u32* GetCurrentRoomProperty(u8);
extern u32 _call_via_r0(u32*);
extern void sub_0804B16C();
@@ -9,11 +9,11 @@ void sub_0804AFF4(void) {
u32* func;
sub_080186EC();
func = sub_0804B128(5);
func = GetCurrentRoomProperty(5);
if (func != NULL) {
_call_via_r0(func);
}
func = sub_0804B128(7);
func = GetCurrentRoomProperty(7);
if (func != NULL) {
_call_via_r0(func);
}
@@ -27,13 +27,13 @@ sub_0804AFF4: @ 0x0804AFF4
push {lr}
bl sub_080186EC
movs r0, #5
bl sub_0804B128
bl GetCurrentRoomProperty
cmp r0, #0
beq _0804B008
bl _call_via_r0
_0804B008:
movs r0, #7
bl sub_0804B128
bl GetCurrentRoomProperty
cmp r0, #0
beq _0804B016
bl _call_via_r0