mirror of
https://github.com/zeldaret/tmc
synced 2026-08-17 21:33:45 -04:00
Decompile some scroll functions
This commit is contained in:
@@ -12,7 +12,7 @@ void Manager4_Main(Manager* this) {
|
||||
gUnk_08107C70[this->action](this);
|
||||
}
|
||||
|
||||
extern void sub_080805F8(void);
|
||||
extern void UpdateIsDiggingCave(void);
|
||||
|
||||
extern DiggingCaveEntrance* sub_08057AA8(DiggingCaveEntrance*, int);
|
||||
|
||||
@@ -21,8 +21,8 @@ void sub_0805786C(Manager* this) {
|
||||
u8 room;
|
||||
u8 area;
|
||||
u16 uVar = 0x81 << 7;
|
||||
sub_080805F8();
|
||||
if (gUnk_03004030.unk_08 != 0) {
|
||||
UpdateIsDiggingCave();
|
||||
if (gUnk_03004030.isDiggingCave != 0) {
|
||||
if (gUnk_03004030.unk_00 == 0) {
|
||||
gUnk_03004030.unk_0a = 0xFF;
|
||||
room = gRoomControls.room;
|
||||
@@ -66,7 +66,7 @@ void sub_08057A18(Manager*, DiggingCaveEntrance*);
|
||||
u32 sub_0805795C(Manager* this, DiggingCaveEntrance* entr) {
|
||||
u16 offsetX, offsetY, offsetX2, offsetY2;
|
||||
u32 tmp, tmp2;
|
||||
if (gUnk_03004030.unk_08) {
|
||||
if (gUnk_03004030.isDiggingCave) {
|
||||
offsetX = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x;
|
||||
offsetY = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y;
|
||||
offsetX2 = (entr->unk_00 & 0x3F) * 16 + 8;
|
||||
@@ -105,10 +105,10 @@ void sub_08057A18(Manager* this, DiggingCaveEntrance* entr) {
|
||||
gUnk_03004030.unk_06 = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y - ((entr->unk_00 & 0xFC0) >> 2);
|
||||
|
||||
#ifndef EU
|
||||
tmp = gUnk_03004030.unk_08;
|
||||
tmp = gUnk_03004030.isDiggingCave;
|
||||
if (!tmp) {
|
||||
if ((entr->target_room | 0x80) != gUnk_03004030.unk_0b) {
|
||||
gUnk_02034480.unk_00 = gUnk_03004030.unk_08;
|
||||
gUnk_02034480.unk_00 = gUnk_03004030.isDiggingCave;
|
||||
}
|
||||
gUnk_03004030.unk_0b = entr->target_room | 0x80;
|
||||
}
|
||||
|
||||
+247
-31
@@ -7,23 +7,58 @@
|
||||
#include "asm.h"
|
||||
#include "common.h"
|
||||
#include "fileselect.h"
|
||||
#include "screen.h"
|
||||
|
||||
extern void sub_08080BC4(void);
|
||||
extern void sub_080197D4(const void*);
|
||||
extern void sub_0807C8B0(u8*, u32, u32);
|
||||
extern void sub_0801AB08(u8*, u8*);
|
||||
extern void sub_0807C810();
|
||||
extern void DeleteSleepingEntities(void);
|
||||
extern void sub_0807BBE4();
|
||||
extern void sub_0807BC84();
|
||||
extern void sub_0805E248();
|
||||
|
||||
extern u8 gUpdateVisibleTiles;
|
||||
extern u16 gUnk_0200B640;
|
||||
extern u32** gUnk_08109194[];
|
||||
extern u8 gMapDataTop[];
|
||||
extern u8 gMapDataBottom[];
|
||||
extern u8 gUnk_02022830[];
|
||||
extern u8 gUnk_020246B0[];
|
||||
|
||||
extern void (*const gUnk_0811E768[])(RoomControls*);
|
||||
|
||||
void sub_0807FC64(RoomControls*);
|
||||
void sub_0807FC7C(RoomControls*);
|
||||
void sub_080805F8(void);
|
||||
void sub_0807FDB0(RoomControls*);
|
||||
void sub_0807FEF0(RoomControls*);
|
||||
void sub_0807FF54(RoomControls*);
|
||||
void sub_0807FDC8(RoomControls*);
|
||||
void sub_0807FDE4(RoomControls*);
|
||||
void sub_0807FDF8(RoomControls*);
|
||||
void sub_0807FEC8(RoomControls*);
|
||||
void sub_0807FF08(RoomControls*);
|
||||
void sub_0807FF1C(RoomControls*);
|
||||
|
||||
extern void (*const gUnk_0811E780[])(RoomControls*);
|
||||
|
||||
extern void (*const gUnk_0811E794[])(RoomControls*);
|
||||
void sub_0807FF6C(RoomControls*);
|
||||
void sub_0807FFE4(RoomControls*);
|
||||
void sub_08080040(RoomControls*);
|
||||
void sub_08080108(RoomControls*);
|
||||
void sub_08080198(RoomControls*);
|
||||
void sub_080801BC(RoomControls*);
|
||||
void UpdateIsDiggingCave(void);
|
||||
u32 sub_080803D0();
|
||||
u32 sub_08080278();
|
||||
void sub_08080C80(u32*);
|
||||
void sub_08080368();
|
||||
void sub_08080B60(u8*);
|
||||
|
||||
extern u8 gMapDataTopSpecial[];
|
||||
|
||||
void UpdateScroll(void) {
|
||||
static void (*const gUnk_0811E768[])(RoomControls*) = {
|
||||
sub_0807FC64, sub_0807FC7C, sub_0807FDB0, NULL, sub_0807FEF0, sub_0807FF54,
|
||||
};
|
||||
|
||||
gRoomControls.scroll_flags &= 0xfb;
|
||||
gUnk_0811E768[gRoomControls.unk3](&gRoomControls);
|
||||
}
|
||||
@@ -33,12 +68,17 @@ void sub_0807FC64(RoomControls* controls) {
|
||||
controls->reload_flags = 0;
|
||||
controls->unk5 = 4;
|
||||
sub_0807FC7C(controls);
|
||||
sub_080805F8();
|
||||
UpdateIsDiggingCave();
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_0807FC7C.inc", void sub_0807FC7C(RoomControls* controls))
|
||||
|
||||
void sub_0807FDB0(RoomControls* controls) {
|
||||
static void (*const gUnk_0811E780[])(RoomControls*) = {
|
||||
sub_0807FDC8,
|
||||
sub_0807FDE4,
|
||||
sub_0807FDF8,
|
||||
};
|
||||
gUnk_0811E780[controls->unk4](controls);
|
||||
}
|
||||
|
||||
@@ -55,17 +95,70 @@ void sub_0807FDE4(RoomControls* controls) {
|
||||
gUpdateVisibleTiles = 2;
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_0807FDF8.inc", void sub_0807FDF8())
|
||||
void sub_0807FDF8(RoomControls* controls) {
|
||||
u32 bVar1;
|
||||
Entity* pEVar2;
|
||||
int iVar3;
|
||||
|
||||
gUpdateVisibleTiles = 2;
|
||||
controls->filler2[0]++;
|
||||
switch (controls->scroll_direction) {
|
||||
case 0:
|
||||
controls->scroll_y -= 4;
|
||||
pEVar2 = controls->camera_target;
|
||||
if (pEVar2 == &gPlayerEntity) {
|
||||
pEVar2->y.WORD = gPlayerEntity.y.WORD - 0x6000;
|
||||
}
|
||||
if (controls->filler2[0] == 0x28) {
|
||||
sub_0807FEC8(controls);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
controls->scroll_x = controls->scroll_x + 4;
|
||||
if (controls->camera_target == &gPlayerEntity) {
|
||||
gPlayerEntity.x.WORD += 0x4000;
|
||||
}
|
||||
if (controls->filler2[0] == 0x3c) {
|
||||
sub_0807FEC8(controls);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
controls->scroll_y = controls->scroll_y + 4;
|
||||
pEVar2 = controls->camera_target;
|
||||
if (pEVar2 == &gPlayerEntity) {
|
||||
pEVar2->y.WORD = gPlayerEntity.y.WORD + 0x6000;
|
||||
}
|
||||
if (controls->filler2[0] == 0x28) {
|
||||
sub_0807FEC8(controls);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
controls->scroll_x -= 4;
|
||||
if (controls->camera_target == &gPlayerEntity) {
|
||||
gPlayerEntity.x.WORD -= 0x4000;
|
||||
}
|
||||
if (controls->filler2[0] == 0x3c) {
|
||||
sub_0807FEC8(controls);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
controls->shake_duration = 0;
|
||||
sub_08080BC4();
|
||||
}
|
||||
|
||||
void sub_0807FEC8(RoomControls* this) {
|
||||
this->unk3 = 0;
|
||||
MemFill32(0xffffffff, gPlayerState.path_memory, 0x40);
|
||||
MemFill32(0xffffffff, gPlayerState.path_memory, sizeof(gPlayerState.path_memory));
|
||||
gPlayerState.startPosX = this->camera_target->x.HALF.HI;
|
||||
gPlayerState.startPosY = this->camera_target->y.HALF.HI;
|
||||
}
|
||||
|
||||
void sub_0807FEF0(RoomControls* controls) {
|
||||
extern void (*const gUnk_0811E78C[])(RoomControls*);
|
||||
static void (*const gUnk_0811E78C[])(RoomControls*) = {
|
||||
sub_0807FF08,
|
||||
sub_0807FF1C,
|
||||
};
|
||||
gUnk_0811E78C[controls->unk4](controls);
|
||||
}
|
||||
|
||||
@@ -86,16 +179,95 @@ void sub_0807FF1C(RoomControls* controls) {
|
||||
}
|
||||
|
||||
void sub_0807FF54(RoomControls* controls) {
|
||||
static void (*const gUnk_0811E794[])(RoomControls*) = {
|
||||
sub_0807FF6C, sub_0807FFE4, sub_08080040, sub_08080108, sub_08080198, sub_080801BC,
|
||||
};
|
||||
gUnk_0811E794[controls->unk4](controls);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_0807FF6C.inc", void sub_0807FF6C())
|
||||
void sub_0807FF6C(RoomControls* controls) {
|
||||
controls->unk4 = 1;
|
||||
gScreen.lcd.displayControl |= DISPCNT_WIN1_ON;
|
||||
gScreen.controls.windowInsideControl = (u8)gScreen.controls.windowInsideControl | 0x1700;
|
||||
gScreen.controls.windowOutsideControl = (gScreen.controls.windowOutsideControl & 0xff00) | 7;
|
||||
gScreen.controls.window1HorizontalDimensions = 0xf0;
|
||||
gScreen.controls.window1VerticalDimensions = 0xf0;
|
||||
ResetPlayer();
|
||||
ResetPlayerAnimationAndAction();
|
||||
if (gUnk_03004030.isDiggingCave) {
|
||||
gPlayerEntity.animationState = 4;
|
||||
} else {
|
||||
gPlayerEntity.animationState = 0;
|
||||
}
|
||||
sub_080809D4();
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_0807FFE4.inc", void sub_0807FFE4())
|
||||
void sub_0807FFE4(RoomControls* controls) {
|
||||
controls->unk4 = 2;
|
||||
controls->filler2[0] = sub_080803D0() + 6;
|
||||
gUnk_0200B640 = sub_08080278();
|
||||
sub_080197D4(*gUnk_08109194[gUnk_03004030.unk_00->unk_03]);
|
||||
sub_0807C8B0(gMapDataTop, controls->width >> 4, controls->height >> 4);
|
||||
sub_0801AB08(gMapDataTopSpecial, gMapDataTop - 4);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_08080040.inc", void sub_08080040())
|
||||
void sub_08080040(RoomControls* controls) {
|
||||
int iVar2;
|
||||
int iVar3;
|
||||
int uVar5;
|
||||
int uVar6;
|
||||
int iVar7;
|
||||
int temp;
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_08080108.inc", void sub_08080108())
|
||||
controls->filler2[0] -= 6;
|
||||
controls->filler2[1] = (controls->filler2[0] << 1) / 3;
|
||||
if (0x2a < controls->filler2[0]) {
|
||||
iVar2 = controls->camera_target->x.HALF.HI - controls->scroll_x;
|
||||
uVar6 = (iVar2 - controls->filler2[0]) + 8;
|
||||
if (uVar6 < 0) {
|
||||
uVar6 = 0;
|
||||
}
|
||||
iVar7 = iVar2 + controls->filler2[0] - 8;
|
||||
if (0xf0 < iVar7) {
|
||||
iVar7 = 0xf0;
|
||||
}
|
||||
temp = controls->camera_target->y.HALF.HI - controls->scroll_y;
|
||||
uVar5 = (temp - controls->filler2[1]) + 8;
|
||||
if (uVar5 < 0) {
|
||||
uVar5 = 0;
|
||||
}
|
||||
iVar3 = temp + controls->filler2[1] - 8;
|
||||
if (0xa0 < iVar3) {
|
||||
iVar3 = 0xa0;
|
||||
}
|
||||
gScreen.controls.window1HorizontalDimensions = ((uVar6 & 0xff) << 8) | (iVar7 & 0xff);
|
||||
gScreen.controls.window1VerticalDimensions = ((uVar5 & 0xff) << 8) | (iVar3 & 0xff);
|
||||
}
|
||||
if (controls->filler2[0] == 0) {
|
||||
controls->unk4 = 3;
|
||||
DeleteSleepingEntities();
|
||||
sub_0807C810();
|
||||
sub_08080C80(*(gUnk_08109194[gUnk_03004030.unk_00->unk_03] + 1));
|
||||
} else {
|
||||
gUpdateVisibleTiles = 4;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08080108(RoomControls* controls) {
|
||||
controls->unk4 = 4;
|
||||
MemCopy(gMapDataBottom, gMapDataBottom + 0x3000, 0x2000);
|
||||
MemCopy(gMapDataTop, gMapDataTop + 0x3000, 0x2000);
|
||||
sub_08080368();
|
||||
gUnk_02034480.unk_00 = gUnk_0200B640;
|
||||
MemCopy(gUnk_02022830, gUnk_020246B0, 0x1800);
|
||||
sub_08080B60(gMapDataBottom - 4);
|
||||
sub_08080B60(gMapDataTop - 4);
|
||||
sub_0807BBE4();
|
||||
sub_0807BC84();
|
||||
sub_0805E248();
|
||||
sub_0801AB08((u8*)&gMapDataBottomSpecial, gMapDataBottom - 4);
|
||||
sub_0801AB08(gMapDataTopSpecial, gMapDataTop - 4);
|
||||
}
|
||||
|
||||
void sub_08080198(RoomControls* controls) {
|
||||
controls->unk4 = 5;
|
||||
@@ -103,35 +275,79 @@ void sub_08080198(RoomControls* controls) {
|
||||
LoadRoom();
|
||||
CallRoomProp5And7();
|
||||
gUpdateVisibleTiles = 0;
|
||||
sub_080805F8();
|
||||
UpdateIsDiggingCave();
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_080801BC.inc", void sub_080801BC())
|
||||
void sub_080801BC(RoomControls* controls) {
|
||||
int iVar2;
|
||||
int iVar3;
|
||||
int uVar5;
|
||||
int uVar6;
|
||||
int iVar7;
|
||||
int temp;
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_08080278.inc", void sub_08080278())
|
||||
controls->filler2[0] += 6;
|
||||
controls->filler2[1] = (controls->filler2[0] << 1) / 3;
|
||||
if (0x1e < controls->filler2[0]) {
|
||||
iVar2 = controls->camera_target->x.HALF.HI - controls->scroll_x;
|
||||
uVar6 = (iVar2 - controls->filler2[0]);
|
||||
if (uVar6 < 0) {
|
||||
uVar6 = 0;
|
||||
}
|
||||
iVar7 = iVar2 + controls->filler2[0];
|
||||
if (0xf0 < iVar7) {
|
||||
iVar7 = 0xf0;
|
||||
}
|
||||
temp = controls->camera_target->y.HALF.HI - controls->scroll_y;
|
||||
uVar5 = (temp - controls->filler2[1]);
|
||||
if (uVar5 < 0) {
|
||||
uVar5 = 0;
|
||||
}
|
||||
iVar3 = temp + controls->filler2[1];
|
||||
if (0xa0 < iVar3) {
|
||||
iVar3 = 0xa0;
|
||||
}
|
||||
gScreen.controls.window1HorizontalDimensions = ((uVar6 & 0xff) << 8) | (iVar7 & 0xff);
|
||||
gScreen.controls.window1VerticalDimensions = ((uVar5 & 0xff) << 8) | (iVar3 & 0xff);
|
||||
}
|
||||
if (controls->filler2[2] == 0) {
|
||||
controls->unk3 = 0;
|
||||
controls->reload_flags = 0;
|
||||
ResetSystemPriority();
|
||||
gScreen.lcd.displayControl &= ~DISPCNT_WIN1_ON;
|
||||
gScreen.controls.windowInsideControl &= 0xff;
|
||||
gScreen.controls.windowOutsideControl &= 0xff00;
|
||||
} else {
|
||||
gUpdateVisibleTiles = 4;
|
||||
controls->filler2[2] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_08080278.inc", u32 sub_08080278())
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_08080368.inc", void sub_08080368())
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_080803D0.inc", void sub_080803D0())
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_080803D0.inc", u32 sub_080803D0())
|
||||
|
||||
void sub_080805F8(void) {
|
||||
void UpdateIsDiggingCave(void) {
|
||||
switch (gRoomControls.area) {
|
||||
case 0xc:
|
||||
case 0x0f:
|
||||
case 0x13:
|
||||
case 0x14:
|
||||
case 0x16:
|
||||
case 0x17:
|
||||
case 0x19:
|
||||
gUnk_03004030.unk_08 = 1;
|
||||
case AREA_LAKE_WOODS_CAVE:
|
||||
case AREA_HYRULE_DIG_CAVES:
|
||||
case AREA_DIG_CAVES_1:
|
||||
case AREA_CRENEL_DIG_CAVE:
|
||||
case AREA_VEIL_FALLS_DIG_CAVE:
|
||||
case AREA_CASTOR_WILDS_DIG_CAVE:
|
||||
case AREA_HYLIA_DIG_CAVES:
|
||||
gUnk_03004030.isDiggingCave = 1;
|
||||
return;
|
||||
}
|
||||
gUnk_03004030.unk_08 = 0;
|
||||
gUnk_03004030.isDiggingCave = 0;
|
||||
}
|
||||
|
||||
void ClearTilemaps(void) {
|
||||
// Is gRoomControls 4 bytes bigger?
|
||||
MemClear(&gRoomControls, 0x38);
|
||||
MemClear(&gUnk_03004030, 0xc);
|
||||
MemClear(&gUnk_03004030, sizeof(gUnk_03004030));
|
||||
gRoomControls.filler3 = 0xffff;
|
||||
gUnk_03004030.unk_0a = 0xff;
|
||||
gUnk_02034480.unk_00 = 0;
|
||||
@@ -265,10 +481,10 @@ void sub_080809D4(void) {
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/UpdateDoorTransition.inc", void UpdateDoorTransition())
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_08080B60.inc", void sub_08080B60())
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_08080B60.inc", void sub_08080B60(u8* param_1))
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_08080BC4.inc", void sub_08080BC4())
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_08080C80.inc", void sub_08080C80())
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_08080C80.inc", void sub_08080C80(u32* param_1))
|
||||
|
||||
ASM_FUNC("asm/non_matching/scroll/sub_08080CB4.inc", void sub_08080CB4(Entity* a))
|
||||
|
||||
Reference in New Issue
Block a user