managerE.c: ok

This commit is contained in:
Ibot02 2020-08-17 18:34:03 +02:00
parent cfaba92b84
commit 8186e1ed0d
5 changed files with 53 additions and 69 deletions

View File

@ -1,60 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_08058E60
sub_08058E60: @ 0x08058E60
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xc]
cmp r0, #0
bne _08058E80
movs r0, #1
strb r0, [r4, #0xc]
ldrh r0, [r4, #0x3e]
bl CheckFlags
cmp r0, #0
beq _08058E80
adds r0, r4, #0
bl sub_0805E900
b _08058EC8
_08058E80:
ldrh r0, [r4, #0x3e]
bl CheckFlags
cmp r0, #0
beq _08058EC8
ldrb r0, [r4, #0xb]
cmp r0, #0
beq _08058E9E
movs r0, #0
strb r0, [r4, #0xb]
movs r0, #0xff
bl sub_08078A90
bl sub_08078B48
_08058E9E:
ldrh r1, [r4, #0x3a]
movs r2, #0x3a
ldrsh r0, [r4, r2]
cmp r0, #0
bne _08058EC4
movs r1, #0x38
ldrsh r0, [r4, r1]
cmp r0, #0
beq _08058EB4
bl PlaySFX
_08058EB4:
ldrb r0, [r4, #0xa]
bl GetCurrentRoomProperty
bl LoadRoomEntityList
bl DeleteThisEntity
b _08058EC8
_08058EC4:
subs r0, r1, #1
strh r0, [r4, #0x3a]
_08058EC8:
pop {r4, pc}
.align 2, 0

View File

@ -3,6 +3,13 @@
#include "global.h"
union SplitSHWord {
s16 SHWORD;
struct {
u8 LO, HI;
} PACKED HALF;
} PACKED;
typedef struct {
u8 unk_00[0x0a];
u8 unk_0a;
@ -18,10 +25,8 @@ typedef struct {
u8 unk_28[0x0D];
u8 unk_35;
u16 unk_36;
u8 unk_38;
u8 unk_39;
u8 unk_3a;
u8 unk_3b;
union SplitSHWord unk_38;
union SplitSHWord unk_3a;
u16 unk_3c;
u16 unk_3e;
} Manager;

View File

@ -483,7 +483,7 @@ SECTIONS {
asm/managerB.o(.text);
asm/managerC.o(.text);
asm/managerD.o(.text);
asm/managerE.o(.text);
src/manager/managerE.o(.text);
asm/managerF.o(.text);
asm/manager10.o(.text);
asm/manager11.o(.text);

View File

@ -21,10 +21,10 @@ void sub_08058398(Manager* this) {
if (CheckFlags(this->unk_3c) != 0) {
DeleteThisEntity();
}
this->unk_24 = this->unk_3a<<3;
this->unk_26 = this->unk_3b<<3;
this->unk_20 = this->unk_24 + (this->unk_38<<4);
this->unk_22 = this->unk_26 + (this->unk_39<<4);
this->unk_24 = this->unk_3a.HALF.LO<<3;
this->unk_26 = this->unk_3a.HALF.HI<<3;
this->unk_20 = this->unk_24 + (this->unk_38.HALF.LO<<4);
this->unk_22 = this->unk_26 + (this->unk_38.HALF.HI<<4);
sub_0805E3A0(this, 0x06);
if (this->unk_3e == 0) {
this->unk_0c = 2;

39
src/manager/managerE.c Normal file
View File

@ -0,0 +1,39 @@
#include "global.h"
#include "entity.h"
#include "manager.h"
#include "flags.h"
#include "room.h"
extern Entity* GetCurrentRoomProperty(u8);
extern void LoadRoomEntityList(Entity*);
extern void DeleteThisEntity(void);
extern void sub_0805E900(Manager*);
extern void sub_08078A90(u32);
extern void sub_08078B48(void);
extern void PlaySFX(u32);
void sub_08058E60(Manager* this) {
if (!this->unk_0c) {
this->unk_0c = 1;
if (CheckFlags(this->unk_3e)) {
sub_0805E900(this);
return;
}
}
if (!CheckFlags(this->unk_3e))
return;
if (this->unk_0b != 0) {
this->unk_0b = 0;
sub_08078A90(0xff);
sub_08078B48();
}
if (this->unk_3a.SHWORD == 0){
if (this->unk_38.SHWORD != 0) {
PlaySFX(this->unk_38.SHWORD);
}
LoadRoomEntityList(GetCurrentRoomProperty(this->unk_0a));
DeleteThisEntity();
} else {
this->unk_3a.SHWORD -= 1;
}
}