merge PR 4

This commit is contained in:
Henny022p
2021-03-02 10:35:40 +01:00
353 changed files with 4345 additions and 5250 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ void sub_080570B8(Entity* this) {
this->height.WORD = 0;
pbVar1 = ((u8*)&this->field_0x20 + 1);
if (*pbVar1 == 3) {
gScreen.affine.unk4 = 1;
gScreen.affine.bg3Updated = 1;
} else {
gUnk_08107C48[*pbVar1](this);
}
+4 -4
View File
@@ -80,14 +80,14 @@ void sub_0805A370(Manager15* this) {
if (this->manager.unk_0d) {
LoadRoomEntityList(&gUnk_080E4C08);
this->manager.action = 3;
PlaySFX(0x80100000);
SoundReq(0x80100000);
}
}
void sub_0805A394(Manager15* this) {
Entity* ent;
if ((ent = FindEntityInListBySubtype(0x3, 0x13, 0x4))) {
if (ent->entityType.form != 4) {
if (ent->type != 4) {
return;
}
}
@@ -499,10 +499,10 @@ void sub_0805AAF0(u32 unk0) {
gScreen.controls.layerFXControl = 0x3E48;
gScreen.controls.alphaBlend = 0x1008;
gScreen.affine.bg3Control = 0x1E04;
gScreen.affine.unk5 = &gBG3Buffer;
gScreen.affine.bg3Tilemap = &gBG3Buffer;
gScreen.affine.bg3xOffset = 0;
gScreen.affine.bg3yOffset = 0;
gScreen.affine.unk4 = 1;
gScreen.affine.bg3Updated = 1;
gScreen.controls.windowInsideControl = 0x3F3F;
gScreen.controls.windowOutsideControl = 0x37;
gScreen.controls.window1HorizontalDimensions = 0xF0;
+2 -2
View File
@@ -71,7 +71,7 @@ void sub_0805B048(Manager1A* this) {
struct_08108764* tmp;
Entity* obj;
sub_0805E3A0(&this->manager, 6);
_DmaZero(&this->unk_20, 0x20);
MemClear32(&this->unk_20, 0x20);
this->manager.action = 1;
this->unk_3f = gRoomControls.roomID;
tmp = &gUnk_08108764[this->manager.unk_0a];
@@ -209,7 +209,7 @@ void sub_0805B328(Manager1A* this) {
if (!this->manager.unk_0b)
return;
tmp = &gUnk_08108764[this->manager.unk_0a];
LoadAssetAsync(&gGlobalGfxAndPalettes[tmp->unk_0c->unk_00], 0x0600F000, 0x800);
LoadResourceAsync(&gGlobalGfxAndPalettes[tmp->unk_0c->unk_00], 0x0600F000, 0x800);
gScreen.affine.bg3Control = 0x1E07;
gScreen.lcd.displayControl |= 0x800;
gScreen.affine.bg3xOffset = gRoomControls.bg3OffsetX.HALF.HI;
+4 -10
View File
@@ -6,28 +6,22 @@
typedef struct {
Manager manager;
u8 unk_20[0x14];//unused
u8 unk_20[0x14]; // unused
u16 radiusX;
u16 radiusY;
s16 posX;
s16 posY;
u8 unk_3c[2];//unused
u8 unk_3c[2]; // unused
u16 playerInRegionFlag;
} Manager1E;
enum Manager1E_State {
Init,
ObserveRegion
};
enum Manager1E_State { Init, ObserveRegion };
void Manager1E_Handler(Manager1E*);
void Manager1E_Init(Manager1E*);
void Manager1E_ObserveRegion(Manager1E*);
void (* const Manager1E_ActionFuncs[2])(Manager1E*) = {
Manager1E_Init,
Manager1E_ObserveRegion
};
void (*const Manager1E_ActionFuncs[2])(Manager1E*) = { Manager1E_Init, Manager1E_ObserveRegion };
void Manager1E_Handler(Manager1E* this) {
Manager1E_ActionFuncs[this->manager.action](this);
+2 -2
View File
@@ -9,8 +9,8 @@ extern void sub_0805754C(Entity*);
void Manager2(Entity* this) {
if (this->action == 0) {
this->action = 1;
gScreen.affine.unk4 = 0;
gScreen.bg.bg2yOffset = 0;
gScreen.affine.bg3Updated = 0;
gScreen.bg.bg1Updated = 0;
sub_08052D74(this, sub_080576A0, 0);
}
sub_0805754C(this);
+4 -8
View File
@@ -17,16 +17,12 @@ void sub_0805C6D0(Manager26*);
void sub_0805C7A0(Manager26*);
void sub_0805C7C4(Manager26*);
void (* const gUnk_08108D04[])(Manager26*) = {
sub_0805C6D0,
sub_0805C7A0,
sub_0805C7C4
};
void (*const gUnk_08108D04[])(Manager26*) = { sub_0805C6D0, sub_0805C7A0, sub_0805C7C4 };
void sub_0805C7CC(Manager26*);
void sub_0805C6B8(Manager26* this) {
gUnk_08108D04[this->manager.action](this);
gUnk_08108D04[this->manager.action](this);
}
void sub_0805C6D0(Manager26* this) {
@@ -46,7 +42,7 @@ void sub_0805C6D0(Manager26* this) {
obj->actionDelay = tmp->unk_03;
obj->x.HALF.HI = gRoomControls.roomOriginX + tmp->unk_04;
obj->y.HALF.HI = gRoomControls.roomOriginY + tmp->unk_06;
obj->parent = (Entity*) this;
obj->parent = (Entity*)this;
obj->collisionLayer = 1;
obj->field_0x82.HALF.HI = this->manager.unk_0e;
obj->field_0x82.HALF.LO = tmp->unk_00;
@@ -75,7 +71,7 @@ void sub_0805C7A0(Manager26* this) {
}
void sub_0805C7C4(Manager26* this) {
sub_0805C7CC(this);
sub_0805C7CC(this);
}
void sub_0805C7CC(Manager26* this) {
+8 -15
View File
@@ -11,24 +11,17 @@ void sub_0805C894(Entity*);
void sub_0805C8B4(Entity*);
void sub_0805C908(Entity*);
void (*const gUnk_08108D10[])(Entity*) = {
sub_0805C874,
sub_0805C894,
sub_0805C8B4,
sub_0805C908
};
void (*const gUnk_08108D10[])(Entity*) = { sub_0805C874, sub_0805C894, sub_0805C8B4, sub_0805C908 };
const u8 gUnk_08108D20[] = {
0x6F, 0x70, 0x71, 0x72, 0x71, 0x70
};
const u8 gUnk_08108D20[] = { 0x6F, 0x70, 0x71, 0x72, 0x71, 0x70 };
void Manager27(Entity* this) {
gUnk_08108D10[this->action](this);
if (CheckLocalFlagByOffset(0x300, this->entityType.form + 0x67)) {
gScreenTransition.field_0xac |= (1 << (this->entityType).form);
if (CheckLocalFlagByOffset(0x300, this->type + 0x67)) {
gScreenTransition.field_0xac |= (1 << this->type);
} else {
gScreenTransition.field_0xac &= ~(1 << (this->entityType).form);
gScreenTransition.field_0xac &= ~(1 << this->type);
}
}
@@ -49,7 +42,7 @@ void sub_0805C894(Entity* this) {
if (sub_0805C920(this)) {
this->action = 2;
this->actionDelay = 1;
PlaySFX(0x11a);
SoundReq(0x11a);
}
}
@@ -65,7 +58,7 @@ void sub_0805C8B4(Entity* this) {
}
LoadPaletteGroup(gUnk_08108D20[this->field_0xf]);
if (this->field_0xf == 0) {
PlaySFX(0x11a);
SoundReq(0x11a);
}
}
if (sub_0805C920(this) == 0) {
@@ -82,5 +75,5 @@ void sub_0805C908(Entity* this) {
}
u32 sub_0805C920(Entity* this) {
return CheckLocalFlagByOffset(0x300, (this->entityType).form + 0x67);
return CheckLocalFlagByOffset(0x300, this->type + 0x67);
}
+27 -33
View File
@@ -18,20 +18,11 @@ u32 Manager28_FindMatchingEntities(Manager28*);
Entity* Manager28_FindMatchingEntity(EntityData*);
void Manager28_RemoveDeletedEntities(Manager28*);
void (* const Manager28_ActionFuncs[])(Manager28*) = {
Manager28_Init,
Manager28_Main
};
void (*const Manager28_ActionFuncs[])(Manager28*) = { Manager28_Init, Manager28_Main };
enum Manager28_Action {
Init = 0,
Main = 1
};
enum Manager28_Action { Init = 0, Main = 1 };
enum Manager28_InitState {
DoInit = 0,
DoNotInit = 1
};
enum Manager28_InitState { DoInit = 0, DoNotInit = 1 };
void Manager28_Entry(Manager28* this) {
Manager28_ActionFuncs[this->manager.action](this);
@@ -46,7 +37,7 @@ void Manager28_Init(Manager28* this) {
}
tmp2 = Manager28_FindMatchingEntities(this);
if (tmp2 > 1) {
Manager28* tmp3 = (Manager28*) GetEmptyManager();
Manager28* tmp3 = (Manager28*)GetEmptyManager();
if (tmp3) {
tmp3->manager.type = 9;
tmp3->manager.subtype = 0x28;
@@ -92,20 +83,26 @@ void Manager28_Main(Manager28* this) {
u32 Manager28_FindMatchingEntities(Manager28* this) {
u32 re = 0;
EntityData * tmp = GetCurrentRoomProperty(this->manager.unk_0b);
if (!tmp) return 0;
for (; *((u8*) tmp) != 0xFF && !(tmp->type == 9 && tmp->subtype == 0x28); tmp++) {
EntityData* tmp = GetCurrentRoomProperty(this->manager.unk_0b);
if (!tmp)
return 0;
for (; *((u8*)tmp) != 0xFF && !(tmp->type == 9 && tmp->subtype == 0x28); tmp++) {
Entity* tmp2;
u32 i;
if (tmp->type != 3) continue;
if (tmp->type != 3)
continue;
tmp2 = Manager28_FindMatchingEntity(tmp);
if (!tmp2) continue;
if (!tmp2)
continue;
for (i = 0; i < re; i++) {
if (this->d.enemies[i] == tmp2) break;
if (this->d.enemies[i] == tmp2)
break;
}
if (i != re) continue;
if (i != re)
continue;
this->d.enemies[re++] = tmp2;
if (re == 8) return 8;
if (re == 8)
return 8;
}
return re;
}
@@ -115,15 +112,11 @@ Entity* Manager28_FindMatchingEntity(EntityData* unk1) {
Entity* i;
LinkedList* tmp;
x = unk1->xPos + gRoomControls.roomOriginX;
y = unk1->yPos + gRoomControls.roomOriginY;
tmp = &gUnk_03003D90;
for (i = tmp->first; (u32) i != (u32) tmp; i = i->next) {
if (x == i->x.HALF.HI
&& y == i->y.HALF.HI
&& unk1->subtype == i->entityType.subtype
&& 3 == i->entityType.type
&& unk1->form == i->entityType.form) {
return i;
y = unk1->yPos + gRoomControls.roomOriginY;
tmp = &gUnk_03003D90;
for (i = tmp->first; (u32)i != (u32)tmp; i = i->next) {
if (x == i->x.HALF.HI && y == i->y.HALF.HI && unk1->subtype == i->id && 3 == i->kind && unk1->form == i->type) {
return i;
}
}
return 0;
@@ -133,13 +126,14 @@ void Manager28_RemoveDeletedEntities(Manager28* this) {
s32 i;
for (i = 0; i < this->manager.unk_0e; i++) {
if (this->d.enemies[i]->next == 0) {
if (this->manager.unk_0e-1 == i) {
if (this->manager.unk_0e - 1 == i) {
this->d.enemies[i] = 0;
} else {
this->d.enemies[i] = this->d.enemies[this->manager.unk_0e-1];
this->d.enemies[i] = this->d.enemies[this->manager.unk_0e - 1];
}
this->manager.unk_0e--;
}
}
if (this->manager.unk_0e <= 1) DeleteThisEntity();
if (this->manager.unk_0e <= 1)
DeleteThisEntity();
}
+1 -1
View File
@@ -5,7 +5,7 @@ extern void (*const gUnk_08108D3C[])(Entity*);
extern void (*const gUnk_08108D44[])(Entity*);
void sub_0805D250(Entity* this) {
gUnk_08108D3C[this->entityType.form](this);
gUnk_08108D3C[this->type](this);
}
void sub_0805D268(Entity* this) {
+1 -1
View File
@@ -55,7 +55,7 @@ void sub_080576C0(Manager3* this) {
this->manager.unk_0e);
if (!this->manager.unk_0f) {
this->manager.unk_0f = 1;
PlaySFX(0x152);
SoundReq(0x152);
}
}
}
+3 -3
View File
@@ -48,13 +48,13 @@ void Manager30_Main(Manager30* this) {
case 0x317:
// stepped on a red tile again
this->manager.action = FAILED;
PlaySFX(0x6d);
SoundReq(0x6d);
break;
case 0x318:
// stepped on a blue tile
// turn the tile into a red tile
sub_0807B7D8(0x317, this->player_current_tile, this->manager.unk_0b);
PlaySFX(0x6b);
SoundReq(0x6b);
// decrease the number of remaining tiles and check if we're done
if (--this->manager.unk_0e == 0) {
this->manager.action = SUCCEEDED;
@@ -89,7 +89,7 @@ void Manager30_Main(Manager30* this) {
SetFlag(this->flag_succeeded);
}
} else {
PlaySFX(0x72);
SoundReq(0x72);
}
}
}
+24 -23
View File
@@ -7,38 +7,37 @@
typedef struct {
Manager manager;
u8 unk_20;//unused
u8 unk_21[0x13];//unused
u16 unk_34;//unused
u16 unk_36;//unused
s16 unk_38;//unused
s16 unk_3A;//unused
u16 unk_3C;//unused
u16 unk_3E;//unused
u8 unk_20; // unused
u8 unk_21[0x13]; // unused
u16 unk_34; // unused
u16 unk_36; // unused
s16 unk_38; // unused
s16 unk_3A; // unused
u16 unk_3C; // unused
u16 unk_3E; // unused
} Manager39;
extern u8 gUnk_02034DF0[0x2F2];
extern const u16 gUnk_08108DE8[];
extern void (* const gUnk_08108E28[])(Manager39*);
extern void (*const gUnk_08108E28[])(Manager39*);
extern const u8 gUnk_08108E30[0x18];
extern const u8 gUnk_08108E48[0x18];
extern const u8 gUnk_08108E60[];
extern void _DmaCopy(const void* src, void* dest, u32 size);
extern void MemCopy(const void* src, void* dest, u32 size);
extern void sub_0805F46C(void*, const void*);
extern u32 CheckIsDungeon(void);
extern void sub_0805E5B4(void);
void sub_0805E140(Manager39*);
void sub_0805E18C(Manager39*); //unused?
void sub_0805E18C(Manager39*); // unused?
void sub_0805E1D8(Manager39*);
void sub_0805E1F8(u32, u32);
void sub_0805E0FC(Manager39* this) {
gUnk_08108E28[this->manager.action](this);
if ((gRoomControls.roomID != this->unk_20)
|| (gTextBox.doTextBox & 0x7F)) {
if ((gRoomControls.roomID != this->unk_20) || (gTextBox.doTextBox & 0x7F)) {
sub_0805E1D8(this);
}
}
@@ -49,12 +48,13 @@ void sub_0805E140(Manager39* this) {
this->unk_20 = gRoomControls.roomID;
this->manager.unk_0e = 0x78;
this->manager.unk_0f = 0x3c;
sub_0805E3A0((Entity*) this, 7);
sub_0805E3A0((Entity*)this, 7);
sub_0805E1F8(gUnk_08108DE8[gArea.locationIndex], CheckIsDungeon());
}
void sub_0805E18C(Manager39* this) {
if (gFadeControl.active) return;
if (gFadeControl.active)
return;
if (this->manager.unk_0b) {
if (!--this->manager.unk_0f) {
this->manager.unk_0b = 0;
@@ -68,8 +68,8 @@ void sub_0805E18C(Manager39* this) {
}
void sub_0805E1D8(Manager39* this) {
_DmaZero(&gUnk_02034DF0, 0x80);
gScreen.bg.bg3Control = 1;
MemClear32(&gUnk_02034DF0, 0x80);
gScreen.bg.bg0Updated = 1;
DeleteThisEntity();
}
@@ -80,13 +80,14 @@ void sub_0805E1F8(u32 unk0, u32 unk1) {
u8 unk_05;
u8 unk_06[3];
} PACKED tmp;
const u8 * tmp2;
_DmaZero(&gUnk_02034DF0, 0x80);
_DmaCopy(gUnk_08108E60, &tmp, sizeof(tmp));
tmp.unk_04 = unk0>>8;
const u8* tmp2;
MemClear32(&gUnk_02034DF0, 0x80);
MemCopy(gUnk_08108E60, &tmp, sizeof(tmp));
tmp.unk_04 = unk0 >> 8;
tmp.unk_05 = unk0;
tmp2 = gUnk_08108E48;
if (!unk1) tmp2 = gUnk_08108E30;
if (!unk1)
tmp2 = gUnk_08108E30;
sub_0805F46C(&tmp, tmp2);
gScreen.bg.bg3Control = 1;
gScreen.bg.bg0Updated = 1;
}
+4 -4
View File
@@ -71,14 +71,14 @@ void sub_08057BA4(Manager5* this) {
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);
SoundReq(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);
SoundReq(0x71);
}
}
@@ -95,10 +95,10 @@ void sub_08057C28(Manager5* this) {
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);
SoundReq(0x71);
} else {
if (this->unk_30 != 0x323) {
PlaySFX(0x72);
SoundReq(0x72);
}
DeleteManager(&this->manager);
}
+3 -3
View File
@@ -64,7 +64,7 @@ void Manager7_Main(Manager7* this) {
switch (this->manager.unk_0e) {
case 0:
gUnk_02034490[0] = 1;
LoadAssetAsync(&gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x1000);
LoadResourceAsync(&gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x1000);
LoadPaletteGroup(gUnk_081081E4[tmp]);
this->manager.unk_0e++;
break;
@@ -75,8 +75,8 @@ void Manager7_Main(Manager7* this) {
case 5:
case 6:
case 7:
LoadAssetAsync(&gGlobalGfxAndPalettes[tmp2[(this->manager.unk_0e << 1)]],
tmp2[(this->manager.unk_0e << 1) + 1], 0x1000);
LoadResourceAsync(&gGlobalGfxAndPalettes[tmp2[(this->manager.unk_0e << 1)]],
tmp2[(this->manager.unk_0e << 1) + 1], 0x1000);
this->manager.unk_0e++;
break;
case 8:
+15 -15
View File
@@ -25,8 +25,8 @@ void sub_08057ED0(Manager8* this) {
sub_08057F20(this);
if (!this->manager.action) {
this->manager.action = 1;
gScreen.bg.bg2yOffset = 0;
gScreen.affine.unk4 = 0;
gScreen.bg.bg1Updated = 0;
gScreen.affine.bg3Updated = 0;
sub_08052D74(this, sub_08057EFC, 0);
}
}
@@ -50,23 +50,23 @@ void sub_08057F20(Manager8* this) {
tmp = tmp + (tmp >> 3) + ((0x400 - gRoomControls.width) / 2);
gScreen.affine.bg3xOffset = tmp & 0xF;
gScreen.affine.bg3yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 2);
gScreen.affine.unk5 = gBG3Buffer;
gScreen.affine.bg3Tilemap = gBG3Buffer;
sub_08058004(tmp, gUnk_02006F00, gBG3Buffer);
tmp = ((tmp >> 4) << 1);
if (this->unk_38 != tmp) {
this->unk_38 = tmp;
gScreen.affine.unk4 = 1;
gScreen.affine.bg3Updated = 1;
}
tmp = (gRoomControls.roomScrollX - gRoomControls.roomOriginX);
tmp = tmp + (tmp >> 2) + ((0x400 - gRoomControls.width) / 2);
gScreen.bg.bg1yOffset = tmp & 0xF;
gScreen.bg.bg2xOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1);
gScreen.bg.unk_14 = gBG3Buffer + 0x800;
gScreen.bg.bg1xOffset = tmp & 0xF;
gScreen.bg.bg1yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1);
gScreen.bg.bg1Tilemap = gBG3Buffer + 0x800;
sub_08058004(tmp, gUnk_02006F00 + 0x2000, gBG3Buffer + 0x800);
tmp = ((tmp >> 4) << 1);
if (this->unk_3c != tmp) {
this->unk_3c = tmp;
gScreen.bg.bg2yOffset = 1;
gScreen.bg.bg1Updated = 1;
}
}
@@ -121,16 +121,16 @@ void sub_080580B0(u32 unk1) {
gScreen.affine.bg3xOffset = tmp & 0xF;
gScreen.affine.bg3yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); //?
gScreen.affine.bg3Control = 0x1D09;
gScreen.affine.unk5 = gBG3Buffer;
gScreen.affine.unk4 = 1;
gScreen.affine.bg3Tilemap = gBG3Buffer;
gScreen.affine.bg3Updated = 1;
tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX; // r7
tmp = tmp + (tmp >> 2) + (0x400 - gRoomControls.width) / 2;
sub_08058004(tmp, gUnk_02006F00 + 0x2000, gBG3Buffer + 0x800);
gScreen.bg.bg1yOffset = tmp & 0xF;
gScreen.bg.bg2xOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); //?
gScreen.bg.bg1xOffset = 0x1E09;
gScreen.bg.unk_14 = gBG3Buffer + 0x800;
gScreen.bg.bg2yOffset = 1;
gScreen.bg.bg1xOffset = tmp & 0xF;
gScreen.bg.bg1yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); //?
gScreen.bg.bg1Control = 0x1E09;
gScreen.bg.bg1Tilemap = gBG3Buffer + 0x800;
gScreen.bg.bg1Updated = 1;
gScreen.controls.layerFXControl = 0x3C48;
gScreen.controls.alphaBlend = 0x609;
gScreen.lcd.displayControl |= 0xa00;
+7 -7
View File
@@ -26,7 +26,7 @@ void sub_080581D8(Manager9* this) {
sub_08058210(this);
if (!this->manager.action) {
this->manager.action = 1;
gScreen.bg.bg2yOffset = 0;
gScreen.bg.bg1Updated = 0;
sub_08052D74(this, sub_08058204, NULL);
}
}
@@ -41,7 +41,7 @@ void sub_08058210(Manager9* this) {
return;
this->unk_3c = tmp;
sub_080582A0(tmp, gUnk_02006F00, gBG3Buffer);
gScreen.bg.bg2yOffset = 1;
gScreen.bg.bg1Updated = 1;
}
u32 sub_08058244(int i) {
@@ -50,9 +50,9 @@ u32 sub_08058244(int i) {
u32 tmp3;
s32 tmp4;
tmp = ((gRoomControls.roomScrollY - gRoomControls.roomOriginY) * 0x20) / (gRoomControls.height - 0xa0);
gScreen.bg.bg2xOffset = gRoomControls.roomOriginY + tmp;
gScreen.bg.bg1yOffset = gRoomControls.roomOriginY + tmp;
tmp = (((gRoomControls.roomScrollX - gRoomControls.roomOriginX) * gUnk_081081EC[i]) / (gRoomControls.width - 0xf0));
gScreen.bg.bg1yOffset = tmp & 0xf;
gScreen.bg.bg1xOffset = tmp & 0xf;
return tmp;
}
@@ -92,8 +92,8 @@ void sub_08058324(u32 unk) {
LoadGfxGroup(unk + 0x36);
sub_080582D0();
sub_080582A0(sub_08058244(unk), gUnk_02006F00, gBG3Buffer);
gScreen.bg.bg1xOffset = 0x1D47;
gScreen.bg.unk_14 = gBG3Buffer;
gScreen.bg.bg2yOffset = 1;
gScreen.bg.bg1Control = 0x1D47;
gScreen.bg.bg1Tilemap = gBG3Buffer;
gScreen.bg.bg1Updated = 1;
gScreen.lcd.displayControl |= 0x200;
}
+4 -4
View File
@@ -55,7 +55,7 @@ void ManagerB_WaitForFlag(ManagerB* this) {
tmp = gRoomVars.field_0x9 ? gRoomVars.field_0x9 : 0x33;
this->unk_20 = gArea.musicIndex;
gArea.musicIndex = tmp;
PlaySFX(tmp);
SoundReq(tmp);
}
sub_080186C0(0xB0F);
}
@@ -73,7 +73,7 @@ void ManagerB_WaitForDone(ManagerB* this) {
if (this->unk_3c) {
if (!this->unk_35) {
gArea.musicIndex = this->unk_20;
PlaySFX(gArea.musicIndex);
SoundReq(gArea.musicIndex);
sub_0801855C();
}
}
@@ -101,7 +101,7 @@ void ManagerB_LoadFight(Manager* this) {
if (prop) {
while (*((u8*)prop) != 0xFF) {
ent = LoadRoomEntity(prop++);
if (ent && (ent->entityType.type == 3)) {
if (ent && (ent->kind == 3)) {
ent->field_0x6c.HALF.HI |= 0x40;
ManagerBHelper_Monitor(monitor, ent, counter++);
}
@@ -128,7 +128,7 @@ ManagerBHelper* CreateHelper(Manager* this) {
extra->manager.unk_0a = 1;
extra->manager.parent = this;
this->unk_0e++;
_DmaZero(&extra->enemies, 0x20);
MemClear32(&extra->enemies, 0x20);
AppendEntityToList(extra, 8);
}
return extra;
+41 -73
View File
@@ -9,10 +9,9 @@
#include "functions.h"
#include "save.h"
typedef struct {
Manager manager;
s32 unk_20;
s32 unk_20;
union SplitWord unk_24;
u32 unk_28;
u32 unk_2c;
@@ -26,7 +25,7 @@ typedef struct {
u16 unk_6;
} struct_08108228;
void (* const gUnk_0810821C[])(ManagerC*);
void (*const gUnk_0810821C[])(ManagerC*);
const struct_08108228 gUnk_08108228[6];
const struct_08108228 gUnk_08108258[6];
const struct_08108228 gUnk_08108288[6];
@@ -46,7 +45,7 @@ void sub_08058D34(void);
extern void sub_0805622C(struct BgAffineDstData*, u32, u32);
extern void sub_08052D74(void*, void*, void*);
extern void sub_080044AE(Entity*, u32, u32);
extern void _DmaCopy(const void* src, void* dest, u32 size);
extern void MemCopy(const void* src, void* dest, u32 size);
extern u8 gUnk_03003DE4[0xC];
@@ -60,11 +59,7 @@ void sub_08058894(ManagerC*);
void sub_080588CC(ManagerC*);
void nullsub_108(ManagerC*);
void (* const gUnk_0810821C[])(ManagerC*) = {
sub_08058894,
sub_080588CC,
nullsub_108
};
void (*const gUnk_0810821C[])(ManagerC*) = { sub_08058894, sub_080588CC, nullsub_108 };
void sub_0805884C(ManagerC* this) {
u32 tmp;
@@ -90,9 +85,10 @@ void sub_080588CC(ManagerC* this) {
}
}
void nullsub_108(ManagerC* this) {}
void nullsub_108(ManagerC* this) {
}
#define ABS_DIFF_GT(a, b, c) (signed) a - b >= 0 ? a - b > c : b - a > c
#define ABS_DIFF_GT(a, b, c) (signed)a - b >= 0 ? a - b > c : b - a > c
void sub_080588F8(ManagerC* this) {
if (this->manager.unk_0f == 0) {
@@ -104,7 +100,7 @@ void sub_080588F8(ManagerC* this) {
case 0xf0:
this->unk_28 = this->unk_24.HALF.HI;
this->manager.unk_0f = 0x2D;
PlaySFX(0x8c);
SoundReq(0x8c);
}
}
} else {
@@ -126,8 +122,8 @@ void sub_080588F8(ManagerC* this) {
this->unk_24.WORD += tmp2;
}
if (ABS_DIFF_GT(this->unk_2c, this->unk_24.WORD, 0x100000)) {
this->unk_2c = this->unk_24.WORD;
PlaySFX(0x8b);
this->unk_2c = this->unk_24.WORD;
SoundReq(0x8b);
}
}
}
@@ -140,50 +136,27 @@ void sub_080588F8(ManagerC* this) {
}
}
const struct_08108228 gUnk_08108228[6] = {
{0x40, 0x2A, 0x1C, 0x10},
{0x3C, 0x24, 0x1C, 0x12},
{0x3C, 0x1C, 0x1A, 0x18},
{0x38, 0x16, 0x1C, 0x16},
{0x34, 0x16, 0x1E, 0x0E},
{0x30, 0x16, 0x20, 0x0A}
};
const struct_08108228 gUnk_08108228[6] = { { 0x40, 0x2A, 0x1C, 0x10 }, { 0x3C, 0x24, 0x1C, 0x12 },
{ 0x3C, 0x1C, 0x1A, 0x18 }, { 0x38, 0x16, 0x1C, 0x16 },
{ 0x34, 0x16, 0x1E, 0x0E }, { 0x30, 0x16, 0x20, 0x0A } };
const struct_08108228 gUnk_08108258[6] = {
{0x30, 0x88, 0x20, 0x0A},
{0x34, 0x7E, 0x1E, 0x12},
{0x38, 0x78, 0x1A, 0x16},
{0x3A, 0x70, 0x1A, 0x18},
{0x3C, 0x64, 0x1E, 0x1E},
{0x3E, 0x6A, 0x1C, 0x10}
};
const struct_08108228 gUnk_08108258[6] = { { 0x30, 0x88, 0x20, 0x0A }, { 0x34, 0x7E, 0x1E, 0x12 },
{ 0x38, 0x78, 0x1A, 0x16 }, { 0x3A, 0x70, 0x1A, 0x18 },
{ 0x3C, 0x64, 0x1E, 0x1E }, { 0x3E, 0x6A, 0x1C, 0x10 } };
const struct_08108228 gUnk_08108288[6] = {
{0x98, 0x2A, 0x1C, 0x10},
{0x98, 0x24, 0x1C, 0x12},
{0x9C, 0x1C, 0x1A, 0x18},
{0x9C, 0x16, 0x1C, 0x16},
{0xA0, 0x16, 0x1E, 0x0E},
{0xA0, 0x16, 0x20, 0x0A}
};
const struct_08108228 gUnk_08108288[6] = { { 0x98, 0x2A, 0x1C, 0x10 }, { 0x98, 0x24, 0x1C, 0x12 },
{ 0x9C, 0x1C, 0x1A, 0x18 }, { 0x9C, 0x16, 0x1C, 0x16 },
{ 0xA0, 0x16, 0x1E, 0x0E }, { 0xA0, 0x16, 0x20, 0x0A } };
const struct_08108228 gUnk_081082B8[6] = {
{0xA0, 0x88, 0x20, 0x0A},
{0x9E, 0x7E, 0x1E, 0x12},
{0x9C, 0x78, 0x1A, 0x16},
{0x9A, 0x70, 0x1A, 0x18},
{0x98, 0x64, 0x1E, 0x1E},
{0x98, 0x6A, 0x1C, 0x10}
};
const struct_08108228 gUnk_081082B8[6] = { { 0xA0, 0x88, 0x20, 0x0A }, { 0x9E, 0x7E, 0x1E, 0x12 },
{ 0x9C, 0x78, 0x1A, 0x16 }, { 0x9A, 0x70, 0x1A, 0x18 },
{ 0x98, 0x64, 0x1E, 0x1E }, { 0x98, 0x6A, 0x1C, 0x10 } };
void sub_08058A04(ManagerC* this) {
s32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX;
s32 tmp2 = gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY;
if ((this->unk_20 - 0x118 < 0xDu) &&
CheckGlobalFlag(LV1TARU_OPEN) &&
(tmp - 0x6d < 0x17u) &&
(tmp2 - 0x45 < 0x17u) &&
(gPlayerEntity.height.HALF.HI == 0)) {
if ((this->unk_20 - 0x118 < 0xDu) && CheckGlobalFlag(LV1TARU_OPEN) && (tmp - 0x6d < 0x17u) &&
(tmp2 - 0x45 < 0x17u) && (gPlayerEntity.height.HALF.HI == 0)) {
gPlayerState.playerAction = 3;
gPlayerState.field_0x38 = 0;
gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x78;
@@ -228,12 +201,7 @@ u32 sub_08058B08(ManagerC* this, u32 unk1, u32 unk2, const struct_08108228* unk3
}
}
const u16 gUnk_081082E8[0xC] = {
0xB8, 0x80, 0x0,
0xB8, 0x110, 0x2,
0x118, 0x80, 0x2,
0x118, 0x110, 0x0
};
const u16 gUnk_081082E8[0xC] = { 0xB8, 0x80, 0x0, 0xB8, 0x110, 0x2, 0x118, 0x80, 0x2, 0x118, 0x110, 0x0 };
void sub_08058B5C(ManagerC* this, u32 unk1) {
gScreenTransition.transitioningOut = 1;
@@ -242,14 +210,14 @@ void sub_08058B5C(ManagerC* this, u32 unk1) {
gScreenTransition.areaID = gRoomControls.areaID;
gScreenTransition.roomID = 6;
gScreenTransition.playerState = unk1 & 1 ? 4 : 0;
gScreenTransition.playerStartPos.HALF.x = gUnk_081082E8[unk1*3];
gScreenTransition.playerStartPos.HALF.y = gUnk_081082E8[unk1*3+1];
gSave.unk7 = gUnk_081082E8[unk1*3+2];
PlaySFX(0x121);
gScreenTransition.playerStartPos.HALF.x = gUnk_081082E8[unk1 * 3];
gScreenTransition.playerStartPos.HALF.y = gUnk_081082E8[unk1 * 3 + 1];
gSave.unk7 = gUnk_081082E8[unk1 * 3 + 2];
SoundReq(0x121);
}
void sub_08058BC8(ManagerC* this) {
struct BgAffineDstData * tmp = &gUnk_02017AA0[gUnk_03003DE4[0]*0xA0];
struct BgAffineDstData* tmp = &gUnk_02017AA0[gUnk_03003DE4[0] * 0xA0];
struct BgAffineSrcData tmp2;
s32 tmp3;
tmp2.texX = 0x10000;
@@ -262,25 +230,25 @@ void sub_08058BC8(ManagerC* this) {
do {
u32 indx = ((tmp3 << 7) / 0xA0) & 0xFF;
tmp2.sx = 0x100 + ((gSineTable[indx] * 3) >> 2);
tmp2.sy = 0x100 - ((gSineTable[indx * 2] * 2) >> 5);//yes, it makes no sense to multiply first and then shift right, but it's matching this way
tmp2.sy =
0x100 - ((gSineTable[indx * 2] * 2) >>
5); // yes, it makes no sense to multiply first and then shift right, but it's matching this way
tmp2.texY = (this->unk_20 + tmp3) << 8;
BgAffineSet(&tmp2, tmp, 1);
tmp++;
} while (++tmp3<0xA0u);
tmp = &gUnk_02017BA0[gUnk_03003DE4[0]*0xA0];
} while (++tmp3 < 0xA0u);
tmp = &gUnk_02017BA0[gUnk_03003DE4[0] * 0xA0];
gScreen.controls.bg2dx = tmp->pa;
gScreen.controls.bg2dmx = tmp->pb;
gScreen.controls.bg2dy = tmp->pc;
gScreen.controls.bg2dmy = tmp->pd;
gScreen.controls.bg2xPointLeastSig = ((union SplitWord *) &tmp->dx)->HALF.LO;
gScreen.controls.bg2xPointMostSig = ((union SplitWord *) &tmp->dx)->HALF.HI;
gScreen.controls.bg2yPointLeastSig = ((union SplitWord *) &tmp->dy)->HALF.LO;
gScreen.controls.bg2yPointMostSig = ((union SplitWord *) &tmp->dy)->HALF.HI;
gScreen.controls.bg2xPointLeastSig = ((union SplitWord*)&tmp->dx)->HALF.LO;
gScreen.controls.bg2xPointMostSig = ((union SplitWord*)&tmp->dx)->HALF.HI;
gScreen.controls.bg2yPointLeastSig = ((union SplitWord*)&tmp->dy)->HALF.LO;
gScreen.controls.bg2yPointMostSig = ((union SplitWord*)&tmp->dy)->HALF.HI;
}
const u16 gUnk_08108300[4] = {
0xA4, 0x4C, 0xF4, 0x9C
};
const u16 gUnk_08108300[4] = { 0xA4, 0x4C, 0xF4, 0x9C };
void sub_08058CB0(ManagerC* this) {
u32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX;
@@ -313,7 +281,7 @@ void sub_08058CFC() {
#ifdef NON_MATCHING
void sub_08058D34() {
LoadPaletteGroup(0x28);
_DmaCopy(gUnk_02017700, gUnk_02017700 + 0x240, 0x20);
MemCopy(gUnk_02017700, gUnk_02017700 + 0x240, 0x20);
gUsedPalettes |= 0x200000;
LoadGfxGroup(0x16);
gScreen.lcd.displayControl |= 1;
+2 -2
View File
@@ -9,7 +9,7 @@ extern void DeleteThisEntity(void);
extern void DeleteManager(Manager*);
extern void sub_08078A90(u32);
extern void sub_08078B48(void);
extern void PlaySFX(u32);
extern void SoundReq(u32);
void sub_08058E60(ManagerE* this) {
if (!this->manager.action) {
@@ -28,7 +28,7 @@ void sub_08058E60(ManagerE* this) {
}
if (this->unk_3a == 0) {
if (this->unk_38 != 0) {
PlaySFX(this->unk_38);
SoundReq(this->unk_38);
}
LoadRoomEntityList(GetCurrentRoomProperty(this->manager.unk_0a));
DeleteThisEntity();