Manager3.c: ok

This commit is contained in:
Ibot02
2020-08-21 18:59:11 +02:00
parent fa36cfe823
commit bcfae17450
10 changed files with 123 additions and 229 deletions
+2 -2
View File
@@ -45,7 +45,7 @@ void sub_0804AAD4(void)
_DmaZero((void *)&gUnk_02018EB0, 0x28);
gUnk_02018EB0.unk = 0;
EraseAllEntities();
CreateObject(0x3d, gArea.filler3[5], 0);
CreateObject(0x3d, gArea.field_0x17, 0);
gArea.filler[8]++;
}
@@ -73,4 +73,4 @@ void sub_0804AB24(void)
void sub_0804AB54(void)
{
gUnk_080D412C[gArea.filler[8]]();
}
}
+2 -2
View File
@@ -155,6 +155,6 @@ void sub_08076D94(ItemBehavior *beh, u32 arg1)
void GustJar(ItemBehavior *beh, u32 arg1)
{
gPlayerState.field_0xa8[0] = 3;
gPlayerState.field_0xa8 = 3;
gUnk_0811BDF4[beh->stateID](beh, arg1);
}
}
+102
View File
@@ -0,0 +1,102 @@
#include "global.h"
#include "manager.h"
#include "flags.h"
#include "area.h"
#include "room.h"
#include "player.h"
#include "functions.h"
typedef struct {
Manager manager;
u32 unk_20;
u32 unk_24;
u8 unk_28[0xC];
u8 unk_34;
u8 unk_35;
u16 unk_36;
u16 unk_38;
u16 unk_3a;
u16 unk_3c;
u16 unk_3e;
} Manager3;
extern s8 gUnk_08107C6C[];
extern u32 sub_0806FBFC(u32, u32, u32, u32);
extern u32 sub_08057810(void);
extern u32 sub_080002C0(u16, u16, u8);
extern void sub_080577AC(u32, u32, u32);
void sub_080576C0(Manager3* this) {
s8 tmp;
if (this->manager.action == 0) {
this->manager.action = 1;
this->unk_20 = this->unk_38 + gRoomControls.roomOriginX - 0x20;
this->unk_24 = this->unk_3a + gRoomControls.roomOriginY - 0x20;
return;
}
if (sub_0806FBFC(this->unk_20, this->unk_24, 0x40, 0x40)) {
gArea.field_0x12 = this->unk_20 + 0x20;
gArea.field_0x14 = this->unk_24 + 0x20 + gUnk_08107C6C[this->manager.unk_0a];
gArea.field_0x16 = this->unk_34;
gArea.field_0x17 = this->manager.unk_0a;
if (!CheckGlobalFlag(EZERO_1ST)) {
gArea.field_0x18 = 1;
gArea.field_0x17 = 5;
} else {
if ((gPlayerState.flags.all & 0x20) && gPlayerState.jumpStatus == 0) {
gArea.field_0x18 = 2;
} else {
if (sub_08057810()) {
gArea.field_0x18 = 3;
}
}
if (sub_080002C0(this->unk_38, this->unk_3a, this->manager.unk_0e) == 0x3d) {
sub_080577AC(this->unk_38 + gRoomControls.roomOriginX, this->unk_3a + gRoomControls.roomOriginY, this->manager.unk_0e);
if (!this->manager.unk_0f) {
this->manager.unk_0f = 1;
PlaySFX(0x152);
}
}
}
} else {
this->manager.unk_0f = 0;
}
}
void sub_080577AC(u32 baseX, u32 baseY, u32 layer) {
u32 r;
int offsetX, offsetY;
Entity* spark;
r = Random();
if ((r & 0x7) != 0) return;
spark = CreateObject(0xF, 0x26, 0);
if (!spark) return;
offsetX = (r >> 0x8) & 0xF;
offsetY = ((r >> 0x10) & 0xF);
if (offsetY > 0x4) {
offsetY = -offsetY;
}
if ((r >> 0x18) & 0x1) {
offsetX = -offsetX;
}
spark->x.HALF.HI = baseX + offsetX;
spark->y.HALF.HI = baseY + offsetY;
spark->collisionLayer = layer;
UpdateSpriteForCollisionLayer(spark);
}
u32 sub_08057810(void) {
if ((gPlayerState.flags.all & 0x80)
&& !gPlayerState.field_0xaa
&& (gArea.field_0x17 != 0x6)
&& (gPlayerState.heldObject == 0)) {
switch (gPlayerState.field_0xa8) {
case 0:
case 1:
return 1;
}
}
return 0;
}
+1 -1
View File
@@ -85,7 +85,7 @@ void sub_08058408(ManagerA* this){
u32 sub_0805848C(ManagerA* this) {
switch (gPlayerState.field_0xa8[0]-5) {
switch (gPlayerState.field_0xa8-5) {
case 0:
case 2:
case 3:
+2 -2
View File
@@ -51,7 +51,7 @@ void sub_08070698(Entity *this)
if (gPlayerState.swimState != 0) {
gPlayerState.swimState = 1;
sub_08079938();
gPlayerState.field_0xa8[0] = 7;
gPlayerState.field_0xa8 = 7;
sub_0807ACCC(this);
ent = FindEntityInListByForm(0x6, 0xf, 0x6, 0xb, 0x0);
if (ent != NULL) {
@@ -59,4 +59,4 @@ void sub_08070698(Entity *this)
}
}
}
}
}