Merge branch 'master' into manager8

This commit is contained in:
notyourav
2020-10-15 22:43:19 -07:00
committed by GitHub
8 changed files with 313 additions and 497 deletions
+129
View File
@@ -0,0 +1,129 @@
#include "global.h"
#include "manager.h"
#include "flags.h"
#include "functions.h"
typedef struct {
Manager manager;
u8 unk_20[0x08];
u16 unk_28;
u16 unk_2a;
u16 unk_2c;
u16 unk_2e;
u16 unk_30;
u16 unk_32;
u8 unk_34[0x04];
s16 unk_38;
s16 unk_3a;
u16 unk_3c;
u16 unk_3e;
} Manager5;
void sub_08057AE8(Manager5*);
void sub_08057BA4(Manager5*);
void sub_08057C28(Manager5*);
const u16 gUnk_08108024[] = {
0,
-1,
1,
0,
0,
1,
-1,
0
};
const u16 gUnk_08108034[] = {
0,
1,
-1,
0,
0,
-1,
1,
0
};
void (*const gUnk_08108044[])(Manager5*) = {
sub_08057AE8,
sub_08057BA4,
sub_08057C28
};
void sub_08057AD0(Manager5* this) {
gUnk_08108044[this->manager.action](this);
}
void sub_08057CA4(Manager5*, u32, u32);
extern void DeleteManager(Manager*);
void sub_08057AE8(Manager5* this) {
u32 tmp;
tmp = (this->manager.unk_0b & 0x3)<<1;
if (this->manager.unk_0e == 1) {
this->unk_30 = 0x323;
} else {
this->unk_30 = tmp & 2 ? 0x37 : 0x36;
}
this->unk_28 = gUnk_08108024[tmp];
this->unk_2a = gUnk_08108024[tmp+1];
this->unk_2c = gUnk_08108034[tmp];
this->unk_2e = gUnk_08108034[tmp+1];
this->unk_32 = ((this->manager.unk_0b>>2)&0xF)+1;
this->manager.unk_0e = 0x1C;
this->manager.unk_0f = 0;
this->manager.action = (this->manager.unk_0b & 0x80)?2:1;
if (this->manager.action != 2
|| !CheckFlags(this->unk_3e)) return;
for (;this->unk_32;this->unk_32--) {
sub_08057CA4(this, this->unk_28, this->unk_2a);
sub_0807B7D8(this->unk_30, this->unk_38 | (this->unk_3a << 6),this->unk_3c);
}
DeleteManager(&this->manager);
}
void sub_08057BA4(Manager5* this) {
if (--this->manager.unk_0e) return;
this->manager.unk_0e = 8;
if (CheckFlags(this->unk_3e)) {
if (this->unk_32 == this->manager.unk_0f) return;
sub_08057CA4(this, this->unk_28, this->unk_2a);
sub_0807B7D8(this->unk_30, this->unk_38 | (this->unk_3a << 6), this->unk_3c);
this->manager.unk_0f++;
PlaySFX(0x71);
} else {
if (!this->manager.unk_0f) return;
sub_0807BA8C(this->unk_38 | (this->unk_3a << 6), this->unk_3c);
sub_08057CA4(this, this->unk_2c, this->unk_2e);
this->manager.unk_0f--;
PlaySFX(0x71);
}
}
void sub_08057C28(Manager5* this) {
if (!this->manager.unk_0d) {
if (!CheckFlags(this->unk_3e)) return;
this->manager.unk_0d++;
} else {
if (--this->manager.unk_0e) return;
this->manager.unk_0e = 8;
if (this->unk_32 != this->manager.unk_0f) {
sub_08057CA4(this, this->unk_28, this->unk_2a);
sub_0807B7D8(this->unk_30, this->unk_38 | (this->unk_3a << 6), this->unk_3c);
this->manager.unk_0f++;
PlaySFX(0x71);
} else {
if (this->unk_30 != 0x323) {
PlaySFX(0x72);
}
DeleteManager(&this->manager);
}
}
}
void sub_08057CA4(Manager5* this, u32 unk1, u32 unk2) {
this->unk_38 += unk1;
this->unk_3a += unk2;
}
+166
View File
@@ -0,0 +1,166 @@
#include "global.h"
#include "manager.h"
#include "functions.h"
#include "gba/gba.h"
typedef struct {
Manager manager;
u8 unk_20;
u8 unk_21[0x1F];
} Manager7;
void sub_08057E30();
u32 sub_08057E40();
void sub_08057E64();
void sub_08057E7C(u32);
extern void sub_08052D74();
extern u32 sub_08056300(const u16*);
extern void sub_0805E3A0();
extern u8 gUnk_02034490;
extern const u8 gGlobalGfxAndPalettes[];
const u16 gUnk_08108050[0x2A] = {
0, 0, 0x20, 0xE0,
0xE0, 1, 0, 0x1D0,
0x80, 0x60, 2, 0x170,
0x278, 0xF8, 0xA0, 3,
0x310, 0x178, 0xC0, 0x150,
3, 0x340, 0x2C8, 0x60,
0x90, 4, 0x1D0, 0,
0x200, 0xE0, 1, 0x108,
0x188, 0xD0, 0x80, 2,
0x1E8, 0x338, 0x50, 0xC0,
0xFF, 0
};
const u32 gUnk_081080A4[0x50] = {
0x001095E0, 0x06000000,
0x0010A5E0, 0x06001000,
0x0010B5E0, 0x06002000,
0x0010C5E0, 0x06003000,
0x0010D5E0, 0x06008000,
0x0010E5E0, 0x06009000,
0x0010F5E0, 0x0600A000,
0x001105E0, 0x0600B000,
0x001115E0, 0x06000000,
0x001125E0, 0x06001000,
0x001135E0, 0x06002000,
0x001145E0, 0x06003000,
0x001155E0, 0x06008000,
0x001165E0, 0x06009000,
0x001175E0, 0x0600A000,
0x001185E0, 0x0600B000,
0x001195E0, 0x06000000,
0x0011A5E0, 0x06001000,
0x0011B5E0, 0x06002000,
0x0011C5E0, 0x06003000,
0x0011D5E0, 0x06008000,
0x0011E5E0, 0x06009000,
0x0011F5E0, 0x0600A000,
0x001205E0, 0x0600B000,
0x001215E0, 0x06000000,
0x001225E0, 0x06001000,
0x001235E0, 0x06002000,
0x001245E0, 0x06003000,
0x001255E0, 0x06008000,
0x001265E0, 0x06009000,
0x001275E0, 0x0600A000,
0x001285E0, 0x0600B000,
0x001295E0, 0x06000000,
0x0012A5E0, 0x06001000,
0x0012B5E0, 0x06002000,
0x0012C5E0, 0x06003000,
0x0012D5E0, 0x06008000,
0x0012E5E0, 0x06009000,
0x0012F5E0, 0x0600A000,
0x001305E0, 0x0600B000
};
const u8 gUnk_081081E4[] = {
0x16,
0x17,
0x17,
0x18,
0x18
};
void Manager7_Main(Manager7* this) {
u32 tmp;
const u32 * tmp2;
if (!this->manager.action) {
this->manager.action = 1;
this->manager.unk_0e = 8;
this->unk_20 = 0xFF;
sub_0805E3A0(this, 6);
sub_08052D74(this, sub_08057E30, 0);
}
if (sub_08057E40(this)) {
tmp = gRoomVars.unk_10;
if (this->unk_20 != tmp) {
this->unk_20 = tmp;
this->manager.unk_0e = 0;
}
}
if (gRoomControls.unk2) return;
tmp = this->unk_20;
tmp2 = &gUnk_081080A4[tmp<<4];
switch (this->manager.unk_0e) {
case 0:
gUnk_02034490 = 1;
LoadAssetAsync(&gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x1000);
LoadPaletteGroup(gUnk_081081E4[tmp]);
this->manager.unk_0e++;
break;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
LoadAssetAsync(&gGlobalGfxAndPalettes[tmp2[(this->manager.unk_0e << 1)]], tmp2[(this->manager.unk_0e << 1)+1], 0x1000);
this->manager.unk_0e++;
break;
case 8:
gUnk_02034490 = 0;
this->manager.unk_0e++;
break;
}
}
void sub_08057E30(Manager7* this) {
sub_08057E7C(gRoomVars.unk_10);
}
u32 sub_08057E40(Manager7* this) {
u32 tmp = sub_08056300(gUnk_08108050);
if (tmp != 0xFF) {
gRoomVars.unk_10 = tmp;
return 1;
} else {
return 0;
}
}
void sub_08057E64() {
u32 tmp;
tmp = sub_08056300(gUnk_08108050);
if (tmp != 0xFF) {
sub_08057E7C(tmp);
}
}
void sub_08057E7C(u32 unk1) {
u32 tmp;
const u32* tmp2;
if (unk1 > 4) return;
LoadPaletteGroup(gUnk_081081E4[unk1]);
tmp2 = &gUnk_081080A4[unk1<<4];
for (tmp = 0; tmp < 8; tmp++, tmp2 += 2) {
DmaSet(3,&gGlobalGfxAndPalettes[tmp2[0]],tmp2[1],0x84000400);
}
gRoomVars.unk_10 = unk1;
}