mirror of
https://github.com/zeldaret/tmc
synced 2026-08-15 12:59:16 -04:00
Decompile some of beanstalkSubtask
This commit is contained in:
@@ -0,0 +1,603 @@
|
||||
#include "beanstalkSubtask.h"
|
||||
#include "collision.h"
|
||||
#include "common.h"
|
||||
#include "fade.h"
|
||||
#include "functions.h"
|
||||
#include "game.h"
|
||||
#include "global.h"
|
||||
#include "item.h"
|
||||
#include "main.h"
|
||||
#include "manager.h"
|
||||
#include "menu.h"
|
||||
#include "object.h"
|
||||
#include "screen.h"
|
||||
#include "structures.h"
|
||||
|
||||
extern void UpdateIsDiggingCave(void);
|
||||
extern void sub_0807C898(void);
|
||||
extern void sub_0805BB74(s32);
|
||||
extern void LoadRoomGfx(void);
|
||||
extern void sub_0807BFD0(void);
|
||||
extern void sub_0807C4F8(void);
|
||||
|
||||
extern void gMapData;
|
||||
extern u8 gUpdateVisibleTiles;
|
||||
extern u16 gMapDataTopSpecial[];
|
||||
extern u16 gMapDataBottomSpecial[];
|
||||
|
||||
extern const u8 gGlobalGfxAndPalettes[];
|
||||
extern const u8 gUnk_081091E4[];
|
||||
|
||||
extern void (*const gUnk_080B4458[])(void);
|
||||
extern const u16 gUnk_080B44A0[];
|
||||
extern const u16 gUnk_080B4410[];
|
||||
extern const s16 gUnk_080B4488[];
|
||||
extern const s16 gUnk_080B44A8[];
|
||||
extern const u16 gUnk_080B44D0[];
|
||||
extern const u16* gUnk_080B4550[];
|
||||
extern const u16 gUnk_080B77C0[];
|
||||
extern BgAnimationFrame* gUnk_080B7278[];
|
||||
|
||||
bool32 sub_0801A4F8(void);
|
||||
bool32 sub_0801AA58(Entity*, u32, u32);
|
||||
void sub_0801AB08(u16*, LayerStruct*);
|
||||
void LoadBgAnimationGfx(BgAnimationGfx*);
|
||||
u32 GetBgAnimationTimer(s32*);
|
||||
void ClearBgAnimations(void);
|
||||
|
||||
void sub_0801967C(void) {
|
||||
gUnk_080B4458[gMenu.overlayType]();
|
||||
}
|
||||
|
||||
void sub_08019698(void) {
|
||||
Entity* object;
|
||||
const u16* ptr;
|
||||
ptr = &gUnk_080B4410[gUI.field_0x3 * 7];
|
||||
SetLocalFlagByBank(0x100, ptr[2]);
|
||||
LoadAuxiliaryRoom(ptr[0], ptr[1]);
|
||||
gRoomControls.scroll_x += ptr[3];
|
||||
gRoomControls.scroll_y += ptr[4];
|
||||
gUpdateVisibleTiles = 1;
|
||||
UpdateScrollVram();
|
||||
gScreen.lcd.displayControl &= 0xfeff;
|
||||
object = CreateObject(BEANSTALK, 0, 0);
|
||||
if (object != NULL) {
|
||||
object->x.HALF.HI = gRoomControls.scroll_x + ptr[5];
|
||||
object->y.HALF.HI = gRoomControls.scroll_y + ptr[6];
|
||||
}
|
||||
LoadGfxGroup(0x11);
|
||||
FlushSprites();
|
||||
DrawEntities();
|
||||
CopyOAM();
|
||||
SetFade(4, 8);
|
||||
gUnk_02018EB0.unk_0++;
|
||||
}
|
||||
|
||||
void sub_08019740(void) {
|
||||
if (gFadeControl.active == 0) {
|
||||
gUnk_02018EB0.unk_0++;
|
||||
gUnk_02018EB0.unk_4 = 0x186;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08019764(void) {
|
||||
FlushSprites();
|
||||
UpdateEntities();
|
||||
DrawEntities();
|
||||
CopyOAM();
|
||||
if ((--gUnk_02018EB0.unk_4 == 0) || ((gInput.newKeys & 10) != 0)) {
|
||||
gUnk_02018EB0.unk_0++;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080197A0(void) {
|
||||
MenuFadeIn(2, 0xb);
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/beanstalkSubtask/SetBGDefaults.inc", void SetBGDefaults(void)) {
|
||||
u16* ptr;
|
||||
BgSettings* bg;
|
||||
|
||||
gMapBottom.bgControlPtr = (u16*)&gScreen.bg2;
|
||||
gScreen.bg2.control = gUnk_080B77C0[0];
|
||||
gMapTop.bgControlPtr = (u16*)&gScreen.bg1;
|
||||
gScreen.bg1.control = gUnk_080B77C0[1];
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
NONMATCH("asm/non_matching/beanstalkSubtask/sub_080197D4.inc", void sub_080197D4(u32* param_1)) {
|
||||
u32 uVar1;
|
||||
u8* src;
|
||||
void* dest;
|
||||
|
||||
do {
|
||||
dest = (void*)param_1[1];
|
||||
if (dest != NULL) {
|
||||
src = &gMapData + (*param_1 & 0x7fffffff);
|
||||
if ((param_1[2] & 0x80000000) != 0) {
|
||||
if ((u32)dest >> 0x18 == 6) {
|
||||
LZ77UnCompVram(src, dest);
|
||||
} else {
|
||||
LZ77UnCompWram(src, dest);
|
||||
}
|
||||
} else {
|
||||
MemCopy(src, dest, param_1[2]);
|
||||
}
|
||||
} else {
|
||||
LoadPaletteGroup((u32) * (u16*)param_1);
|
||||
sub_080533CC();
|
||||
}
|
||||
uVar1 = *param_1;
|
||||
param_1 += 3;
|
||||
} while ((uVar1 & 0x80000000) != 0);
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
// Has ifdefs for other variants
|
||||
ASM_FUNC("asm/non_matching/beanstalkSubtask/UpdatePlayerCollision.inc", void UpdatePlayerCollision())
|
||||
|
||||
NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801A2B0.inc",
|
||||
bool32 sub_0801A2B0(LayerStruct* layer, u32 position, u32 collisionType)) {
|
||||
u16 uVar1;
|
||||
u32 uVar2;
|
||||
bool32 bVar3;
|
||||
u32 pos;
|
||||
|
||||
uVar1 = gUnk_080B4488[gPlayerEntity.animationState >> 1];
|
||||
if ((((gPlayerState.field_0x35 | gPlayerState.field_0xd) & 0x80) == 0) && ((gPlayerEntity.frame & 1) != 0)) {
|
||||
switch ((s32)sub_080B1B54(GetTileType(position + uVar1, gPlayerEntity.collisionLayer))) {
|
||||
case 0x52:
|
||||
break;
|
||||
case 0x26:
|
||||
case 0x27:
|
||||
return FALSE;
|
||||
case 0x29:
|
||||
return FALSE;
|
||||
case 0x74:
|
||||
return FALSE;
|
||||
default:
|
||||
if ((layer->collisionData[(position + uVar1)] != 0x28) &&
|
||||
(!IsTileCollision(
|
||||
layer->collisionData,
|
||||
(s32)((((position + uVar1) & 0x3f) * 0x10 + (u32)gRoomControls.origin_x) * 0x10000) >> 0x10,
|
||||
(s32)((((position + uVar1) >> 6) * 0x10 + (u32)gRoomControls.origin_y) * 0x10000) >> 0x10,
|
||||
collisionType))) {
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801A370.inc", bool32 sub_0801A370(LayerStruct* layer, u32 position)) {
|
||||
LayerStruct* topLayer;
|
||||
u32 tileType;
|
||||
u32 pos;
|
||||
s32 offset;
|
||||
|
||||
if ((gPlayerEntity.animationState & 2) == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!sub_0801A4F8()) {
|
||||
return FALSE;
|
||||
}
|
||||
topLayer = GetLayerByIndex(2);
|
||||
offset = gUnk_080B4488[gPlayerEntity.animationState >> 1];
|
||||
pos = position + offset;
|
||||
tileType = GetTileType(pos, gPlayerEntity.collisionLayer);
|
||||
switch (tileType) {
|
||||
case 0x402b:
|
||||
pos += offset;
|
||||
break;
|
||||
case 0x402c ... 0x402f:
|
||||
return TRUE;
|
||||
}
|
||||
if (topLayer->collisionData[pos - 0x80] == 0x46) {
|
||||
return FALSE;
|
||||
}
|
||||
switch ((u16)sub_080B1B54(GetTileType(pos, gPlayerEntity.collisionLayer))) {
|
||||
case 0x52:
|
||||
return FALSE;
|
||||
case 0x26:
|
||||
case 0x27:
|
||||
return FALSE;
|
||||
case 0x29:
|
||||
return FALSE;
|
||||
case 0x74:
|
||||
return FALSE;
|
||||
}
|
||||
switch (layer->collisionData[pos]) {
|
||||
case 0:
|
||||
return TRUE;
|
||||
case 5:
|
||||
case 0x45:
|
||||
if (offset == 1) {
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
case 0xa:
|
||||
case 0x44:
|
||||
if (offset == -1) {
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
bool32 sub_0801A458(LayerStruct* layer, u32 position, u32 collisionType) {
|
||||
u32 tileType;
|
||||
u32 pos;
|
||||
s32 offset = gUnk_080B4488[gPlayerEntity.animationState >> 1];
|
||||
if (sub_0801A4F8()) {
|
||||
pos = position + offset;
|
||||
tileType = GetTileType(pos, gPlayerEntity.collisionLayer);
|
||||
switch (sub_080B1B54(tileType)) {
|
||||
case 0x52:
|
||||
case 0x26:
|
||||
case 0x27:
|
||||
case 0x29:
|
||||
case 0x74:
|
||||
return FALSE;
|
||||
default:
|
||||
if (((layer->collisionData[pos] != 0x28) &&
|
||||
(!IsTileCollision(layer->collisionData, (pos & 0x3f) * 0x10 + gRoomControls.origin_x,
|
||||
(pos >> 6) * 0x10 + gRoomControls.origin_y, collisionType))) &&
|
||||
(0xe < (u32)layer->collisionData[pos] - 1)) {
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801A4F8.inc", bool32 sub_0801A4F8(void)) {
|
||||
u32 uVar1;
|
||||
u32 uVar3;
|
||||
|
||||
if ((gPlayerState.flags & PL_MINISH) != 0) {
|
||||
if (GetInventoryValue(ITEM_POWER_BRACELETS) != 1) {
|
||||
return FALSE;
|
||||
}
|
||||
if ((gPlayerState.field_0xd & 0x80) != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
if (gPlayerState.field_0xd != gPlayerEntity.direction) {
|
||||
return FALSE;
|
||||
}
|
||||
if ((gPlayerEntity.collisions & gUnk_080B44A0[(((gPlayerEntity.direction + 4) & 0x18) >> 2)]) == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (((gPlayerState.field_0x35 | gPlayerState.field_0xd) & 0x80) != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
if ((gPlayerEntity.frame & 1) == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
ASM_FUNC("asm/non_matching/beanstalkSubtask/sub_0801A570.inc", void sub_0801A570())
|
||||
|
||||
NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801A8D0.inc", u32 sub_0801A8D0(Entity* this, u32 param_2)) {
|
||||
u16* mapData;
|
||||
u32 tile;
|
||||
u32 position;
|
||||
|
||||
if (this != NULL) {
|
||||
mapData = GetLayerByIndex(this->collisionLayer)->mapData;
|
||||
if (param_2 == 0) {
|
||||
position = COORD_TO_TILE_OFFSET(this, 0, 8);
|
||||
tile = mapData[position];
|
||||
if (tile == 0x4055) {
|
||||
return position - 1;
|
||||
}
|
||||
if (tile == 0x4056) {
|
||||
return position;
|
||||
}
|
||||
} else {
|
||||
position = COORD_TO_TILE_OFFSET(this, 8, 0);
|
||||
tile = mapData[position];
|
||||
if (tile == 0x4057) {
|
||||
return position - 0x40;
|
||||
}
|
||||
if (tile == 0x4058) {
|
||||
return position;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0xffff;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
bool32 sub_0801A980(void) {
|
||||
u16 tileType;
|
||||
const s16* ptr;
|
||||
GetLayerByIndex(gPlayerEntity.collisionLayer);
|
||||
ptr = &gUnk_080B44A8[gPlayerEntity.animationState & 6];
|
||||
tileType = GetTileType(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]), gPlayerEntity.collisionLayer);
|
||||
if (tileType < 0x4000) {
|
||||
sub_080B1B54(tileType);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801A9F0.inc",
|
||||
bool32 sub_0801A9F0(u32 param_1, u32 param_2, u32 param_3)) {
|
||||
|
||||
switch (param_2) {
|
||||
case 0x361:
|
||||
if (param_1 == 0) {
|
||||
goto result;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case 0x362:
|
||||
if (param_1 == 0x10) {
|
||||
goto result;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case 0x363:
|
||||
if (param_1 == 0x18) {
|
||||
goto result;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case 0x364:
|
||||
if (param_1 == 8) {
|
||||
goto result;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case 0x360:
|
||||
result:
|
||||
return sub_0801AA58(&gPlayerEntity, param_3, param_1);
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801AA58.inc",
|
||||
bool32 sub_0801AA58(Entity* this, u32 param_2, u32 param_3)) {
|
||||
LayerStruct* layer;
|
||||
Entity* object;
|
||||
|
||||
layer = GetLayerByIndex(this->collisionLayer);
|
||||
if (((layer->collisionData[param_2 + gUnk_080B4488[param_3 >> 3]] == 0) ||
|
||||
((u8)(layer->collisionData[param_2 + gUnk_080B4488[param_3 >> 3]] - 0x20) < 0x20))) {
|
||||
|
||||
object = CreateObject(PUSHED_BLOCK, 0, 0);
|
||||
if (object != NULL) {
|
||||
object->direction = param_3;
|
||||
object->x.HALF.HI = ((param_2 & 0x3f) * 0x10 + 8) + gRoomControls.origin_x;
|
||||
object->y.HALF.HI = (((param_2 & 0xfc0) >> 2) + 8) + gRoomControls.origin_y;
|
||||
object->collisionLayer = this->collisionLayer;
|
||||
gPlayerState.pushedObject = 0xa0;
|
||||
gPlayerState.queued_action = 5;
|
||||
gPlayerState.flags |= 1;
|
||||
this->x.HALF.LO = 0;
|
||||
this->y.HALF.LO = 0;
|
||||
this->direction = param_3;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
ASM_FUNC("asm/non_matching/beanstalkSubtask/sub_0801AB08.inc", void sub_0801AB08(u16* a, LayerStruct* layer))
|
||||
|
||||
NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801AC68.inc", u32 sub_0801AC68(u32 position, u32 data)) {
|
||||
u32 index;
|
||||
struct_0200B240* ptr;
|
||||
u32 end;
|
||||
|
||||
ptr = gUnk_0200B240;
|
||||
end = gRoomVars.unk_0e;
|
||||
for (index = 0; index < end; index++) {
|
||||
if (position == ptr[index].position) {
|
||||
return ptr[index].data << 2;
|
||||
}
|
||||
}
|
||||
return data << 2;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
ASM_FUNC("asm/non_matching/beanstalkSubtask/sub_0801AC98.inc", void sub_0801AC98())
|
||||
|
||||
void sub_0801AD6C(u16* param_1, u32 param_2) {
|
||||
Entity* entity;
|
||||
Manager* manager;
|
||||
s32 tmpX1;
|
||||
s32 tmpY1;
|
||||
s32 tmpX2;
|
||||
s32 tmpY2;
|
||||
|
||||
if (param_1[1] != 9) {
|
||||
entity = GetEmptyEntity();
|
||||
if (entity != NULL) {
|
||||
entity->kind = (u8)param_1[1];
|
||||
entity->id = (u8)param_1[2];
|
||||
entity->type = (u8)param_1[3];
|
||||
entity->type2 = (u8)param_1[4];
|
||||
tmpX1 = ((u16)param_2 & 0x3f) * 0x10 + 8;
|
||||
entity->x.HALF.HI = tmpX1 + gRoomControls.origin_x;
|
||||
tmpY1 = (s16)((param_2 & 0xfc0) >> 2) + 8;
|
||||
entity->y.HALF.HI = tmpY1 + gRoomControls.origin_y;
|
||||
entity->collisionLayer = 0;
|
||||
ResolveCollisionLayer(entity);
|
||||
AppendEntityToList(entity, gUnk_081091E4[entity->kind]);
|
||||
}
|
||||
} else {
|
||||
manager = GetEmptyManager();
|
||||
if (manager != NULL) {
|
||||
manager->type = (u8)param_1[1];
|
||||
manager->subtype = (u8)param_1[2];
|
||||
manager->unk_0a = (u8)param_1[3];
|
||||
manager->unk_0b = (u8)param_1[4];
|
||||
tmpX2 = ((u16)param_2 & 0x3f) * 0x10 + 8;
|
||||
*(u16*)(&manager[1].unk_0e + 10) = tmpX2 + gRoomControls.origin_x;
|
||||
tmpY2 = (s16)((param_2 & 0xfc0) >> 2) + 8;
|
||||
*(u16*)(&manager[1].unk_0e + 12) = tmpY2 + gRoomControls.origin_y;
|
||||
AppendEntityToList((Entity*)manager, gUnk_081091E4[manager->type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_0801AE30(void) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u32 sub_0801AE34(void) {
|
||||
return gRoomControls.scroll_flags >> 1 & 1;
|
||||
}
|
||||
|
||||
void sub_0801AE44(s32 param_1) {
|
||||
void (*func)(void);
|
||||
gRoomControls.unk_34 = 0;
|
||||
sub_0807BFD0();
|
||||
if (param_1 != 0) {
|
||||
LoadRoomGfx();
|
||||
}
|
||||
sub_080809D4();
|
||||
UpdateIsDiggingCave();
|
||||
if (gRoomTransition.field_0x2c[0] != 0) {
|
||||
sub_0807C898();
|
||||
}
|
||||
if (gArea.lightType != 0) {
|
||||
MemFill16(0xf, (void*)0x600f000, 0x800);
|
||||
sub_0805BB74(-1);
|
||||
}
|
||||
func = GetCurrentRoomProperty(5);
|
||||
if (func != NULL) {
|
||||
func();
|
||||
}
|
||||
if ((gUnk_03004030.isDiggingCave == 0) && (gArea.onEnter != NULL)) {
|
||||
gArea.onEnter(gArea.transitionManager);
|
||||
}
|
||||
if ((gRoomControls.scroll_flags & 1) == 0) {
|
||||
if (gMapBottom.bgControlPtr != NULL) {
|
||||
sub_0801AB08(gMapDataBottomSpecial, &gMapBottom);
|
||||
}
|
||||
if (gMapTop.bgControlPtr != NULL) {
|
||||
sub_0801AB08(gMapDataTopSpecial, &gMapTop);
|
||||
}
|
||||
} else {
|
||||
sub_0807C4F8();
|
||||
}
|
||||
UpdateScrollVram();
|
||||
}
|
||||
|
||||
void SetMultipleTiles(TileData* tileData, u32 basePosition, u32 layer) {
|
||||
while (tileData->tile != -1) {
|
||||
SetTile((u16)tileData->tile, basePosition + tileData->position, layer);
|
||||
tileData++;
|
||||
}
|
||||
}
|
||||
|
||||
// Add a new entry at the end of gUnk_0200B240
|
||||
void sub_0801AF48(u32 data, u32 position, u32 layer) {
|
||||
u32 index;
|
||||
if ((data < 0x4000) && (gRoomTransition.field_0x2c[3] == 0)) {
|
||||
index = gRoomVars.unk_0e;
|
||||
if (index < 0x100) {
|
||||
gUnk_0200B240[index].data = data;
|
||||
gUnk_0200B240[index].position = (layer << 0xc) | position;
|
||||
gRoomVars.unk_0e = index + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/beanstalkSubtask/DeleteLoadedTileEntity.inc",
|
||||
void DeleteLoadedTileEntity(u32 position, u32 layer))
|
||||
|
||||
ASM_FUNC("asm/non_matching/beanstalkSubtask/sub_0801AFE4.inc", void sub_0801AFE4(void))
|
||||
|
||||
void UpdateBgAnimations(void) {
|
||||
bool32 alreadyUploadedGfx = FALSE;
|
||||
BgAnimation* animation = gBgAnimations;
|
||||
s32 index = 8;
|
||||
while (index != 0) {
|
||||
if (animation->currentFrame == NULL) {
|
||||
return;
|
||||
}
|
||||
if (--animation->timer == 0) {
|
||||
if (!alreadyUploadedGfx) {
|
||||
if (gFadeControl.active == 0) {
|
||||
LoadBgAnimationGfx(animation->currentFrame->gfx);
|
||||
}
|
||||
animation->timer = GetBgAnimationTimer(&animation->currentFrame->unk_4);
|
||||
animation->currentFrame++;
|
||||
if (animation->currentFrame->gfx == NULL) {
|
||||
animation->currentFrame -= animation->currentFrame->unk_4;
|
||||
}
|
||||
alreadyUploadedGfx = TRUE;
|
||||
} else {
|
||||
animation->timer++;
|
||||
}
|
||||
}
|
||||
animation++;
|
||||
index--;
|
||||
}
|
||||
}
|
||||
|
||||
u32 GetBgAnimationTimer(s32* param_1) {
|
||||
if (param_1[0] < 0) {
|
||||
return gUnk_080B4550[*(u8*)param_1][(Random() & 7)];
|
||||
} else {
|
||||
return param_1[0];
|
||||
}
|
||||
}
|
||||
|
||||
void LoadBgAnimationGfx(BgAnimationGfx* param_1) {
|
||||
const u8* src;
|
||||
u32 vramOffset;
|
||||
u32 size;
|
||||
while (TRUE) {
|
||||
src = &gGlobalGfxAndPalettes[param_1->gfxOffset];
|
||||
size = param_1->gfxSize;
|
||||
vramOffset = param_1->vramOffset;
|
||||
if ((*(u32*)param_1 >> 0x1c & 1) != 0) {
|
||||
LoadPalettes(src, vramOffset >> 5, size);
|
||||
} else {
|
||||
MemCopy(src, (void*)(vramOffset + 0x6000000), size << 5);
|
||||
}
|
||||
if (*(int*)param_1 >= 0) {
|
||||
return;
|
||||
}
|
||||
param_1++;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadBgAnimations(u16* param_1) {
|
||||
BgAnimation* animation;
|
||||
ClearBgAnimations();
|
||||
animation = gBgAnimations;
|
||||
while (param_1[0] != 0xffff) {
|
||||
animation->currentFrame = gUnk_080B7278[param_1[0]];
|
||||
animation->timer = GetBgAnimationTimer(&animation->currentFrame->unk_4);
|
||||
;
|
||||
animation++;
|
||||
param_1++;
|
||||
}
|
||||
}
|
||||
|
||||
void ClearBgAnimations(void) {
|
||||
u32 index;
|
||||
for (index = 0; index < MAX_BG_ANIMATIONS; index++) {
|
||||
gBgAnimations[index].currentFrame = NULL;
|
||||
}
|
||||
}
|
||||
@@ -9,19 +9,9 @@
|
||||
#include "game.h"
|
||||
#include "fileselect.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler[18];
|
||||
Entity* unk_14;
|
||||
u8 unk_18;
|
||||
u8 unk_19;
|
||||
u8 unk_1a;
|
||||
u8 unk_1b;
|
||||
} struct_02018EB0;
|
||||
|
||||
extern void ClearArmosData(void);
|
||||
extern void sub_080300C4(void);
|
||||
|
||||
extern struct_02018EB0 gUnk_02018EB0;
|
||||
extern u16 gUnk_020178E0[];
|
||||
extern u8 gUnk_02017700[];
|
||||
|
||||
|
||||
+9
-9
@@ -102,14 +102,14 @@ extern bool32 CheckInitPortal(void);
|
||||
extern void UpdateCarriedObject(void);
|
||||
extern void DrawUI(void);
|
||||
extern void CollisionMain(void);
|
||||
extern void sub_0805BB74(u32);
|
||||
extern void sub_0805BB74(s32);
|
||||
extern void CreateZeldaFollower(void);
|
||||
extern void LoadRoomGfx(void);
|
||||
extern void RecycleEntities(void);
|
||||
extern void sub_0804AF90(void);
|
||||
extern void CallRoomProp6(void);
|
||||
extern void UpdateScroll(void);
|
||||
extern void UpdateBgAnim(void);
|
||||
extern void UpdateBgAnimations(void);
|
||||
extern void CleanUpGFXSlots(void);
|
||||
extern void sub_080ADE24(void);
|
||||
extern void InitUI(bool32);
|
||||
@@ -246,7 +246,7 @@ extern void (*const gUnk_080FD138[])(void);
|
||||
|
||||
extern const u16 gUnk_080FD964[];
|
||||
|
||||
extern void sub_0801B170(void);
|
||||
extern void ClearBgAnimations(void);
|
||||
|
||||
void GameTask(void) {
|
||||
static GameState* const sStates[] = {
|
||||
@@ -344,7 +344,7 @@ static void GameMain_ChangeRoom(void) {
|
||||
UpdateEntities();
|
||||
if (!UpdateLightLevel())
|
||||
UpdateScroll();
|
||||
UpdateBgAnim();
|
||||
UpdateBgAnimations();
|
||||
UpdateScrollVram();
|
||||
DrawUI();
|
||||
UpdateManagers();
|
||||
@@ -421,7 +421,7 @@ static void GameMain_Update(void) {
|
||||
UpdateDoorTransition();
|
||||
CollisionMain();
|
||||
UpdateScroll();
|
||||
UpdateBgAnim();
|
||||
UpdateBgAnimations();
|
||||
UpdateScrollVram();
|
||||
sub_08052C3C();
|
||||
DrawUI();
|
||||
@@ -508,7 +508,7 @@ static void InitializeEntities(void) {
|
||||
CallRoomProp5And7();
|
||||
sub_0805329C();
|
||||
UpdateScrollVram();
|
||||
sub_0805BB74(0xffffffff);
|
||||
sub_0805BB74(-1);
|
||||
UpdatePlayerRoomStatus();
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ static void AuxCutscene_Main(void) {
|
||||
DrawEntities();
|
||||
CopyOAM();
|
||||
UpdateScroll();
|
||||
UpdateBgAnim();
|
||||
UpdateBgAnimations();
|
||||
UpdateManagers();
|
||||
UpdateScrollVram();
|
||||
}
|
||||
@@ -1878,7 +1878,7 @@ void sub_08053758(void) {
|
||||
gRoomControls.camera_target = NULL;
|
||||
gRoomControls.scroll_y = 0;
|
||||
gRoomControls.scroll_x = 0;
|
||||
sub_0801B170();
|
||||
ClearBgAnimations();
|
||||
DispReset(0);
|
||||
gScreen.lcd.displayControl = 0x2640;
|
||||
gScreen.controls.layerFXControl = 0x2244;
|
||||
@@ -2601,7 +2601,7 @@ void sub_080548E8(void) {
|
||||
DrawEntities();
|
||||
CopyOAM();
|
||||
UpdateScroll();
|
||||
UpdateBgAnim();
|
||||
UpdateBgAnimations();
|
||||
UpdateScrollVram();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ extern void (*const gUnk_0811BDB4[])(ItemBehavior*, u32);
|
||||
u32 sub_08077F64(ItemBehavior* arg0, u32 idx);
|
||||
|
||||
u32 sub_080789A8(void);
|
||||
void sub_080762C4(ItemBehavior*, void*, u8, u32);
|
||||
void sub_080762C4(ItemBehavior*, Entity*, u8, u32);
|
||||
void sub_08076088(ItemBehavior*, void*, u32);
|
||||
|
||||
void ItemTryPickupObject(ItemBehavior* this, u32 idx) {
|
||||
@@ -61,7 +61,7 @@ void ItemPickupCheck(ItemBehavior* this, u32 idx) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080762C4(ItemBehavior* this, void* arg1, u8 arg2, u32 arg3) {
|
||||
void sub_080762C4(ItemBehavior* this, Entity* arg1, u8 arg2, u32 arg3) {
|
||||
this->field_0x18 = arg1;
|
||||
gPlayerState.heldObject = arg2;
|
||||
sub_08077D38(this, arg3);
|
||||
|
||||
@@ -16,7 +16,6 @@ extern u32 gSpriteAnimations_GhostBrothers[];
|
||||
extern u32 gUnk_08110188;
|
||||
extern s8 gUnk_0811015C[8];
|
||||
|
||||
extern u8 gUnk_02018EB0[];
|
||||
extern u8 gUnk_0811022E[];
|
||||
|
||||
void sub_08065C0C(Entity* this);
|
||||
@@ -144,7 +143,7 @@ void sub_08065DB8(Entity* this) {
|
||||
if (--this->timer == 0) {
|
||||
this->subAction++;
|
||||
this->timer = 0xb4;
|
||||
gUnk_02018EB0[1]++;
|
||||
gUnk_02018EB0.unk_1++;
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
break;
|
||||
@@ -174,7 +173,7 @@ void sub_08065DB8(Entity* this) {
|
||||
this->timer = (u8) * (puVar3 + 1);
|
||||
*(u16**)&this->field_0x6c = (puVar3 + 2);
|
||||
} else {
|
||||
gUnk_02018EB0[0]++;
|
||||
gUnk_02018EB0.unk_0++;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,6 +288,7 @@ void ChestSpawner_Type0Action3(ChestSpawnerEntity* this) {
|
||||
}
|
||||
|
||||
void sub_080842D8(ChestSpawnerEntity* this) {
|
||||
// TODO recreate as TileData[]
|
||||
static const u8 gUnk_0811F854[] = {
|
||||
35, 64, 191, 255, 35, 64, 192, 255, 38, 64, 255, 255, 38, 64, 0, 0, 255, 255,
|
||||
};
|
||||
@@ -310,7 +311,7 @@ void sub_080842D8(ChestSpawnerEntity* this) {
|
||||
if ((super->y.HALF.HI & 8) != 0) {
|
||||
index += 2;
|
||||
}
|
||||
SetMultipleTiles((u16*)gUnk_0811F898[index], COORD_TO_TILE(super), super->collisionLayer);
|
||||
SetMultipleTiles((TileData*)gUnk_0811F898[index], COORD_TO_TILE(super), super->collisionLayer);
|
||||
}
|
||||
|
||||
const Hitbox gUnk_0811F8A8 = { 0, -3, { 0, 0, 0, 0 }, 6, 6 };
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
static void SetJailBarTiles(Entity*, u32);
|
||||
|
||||
extern void (*const gUnk_08124950[])(Entity*);
|
||||
extern u16 gUnk_08124960[];
|
||||
extern u16 gUnk_0812497A[];
|
||||
extern TileData gUnk_08124960[];
|
||||
extern TileData gUnk_0812497A[];
|
||||
|
||||
void JailBars(Entity* this) {
|
||||
gUnk_08124950[this->action](this);
|
||||
@@ -49,7 +49,7 @@ void nullsub_127(Entity* this) {
|
||||
}
|
||||
|
||||
static void SetJailBarTiles(Entity* this, u32 arg1) {
|
||||
u16* puVar1;
|
||||
TileData* puVar1;
|
||||
|
||||
puVar1 = gUnk_08124960;
|
||||
if (arg1 == 1) {
|
||||
|
||||
@@ -11,7 +11,6 @@ typedef struct {
|
||||
u16 unk6a;
|
||||
} MacroPlayerEntity;
|
||||
|
||||
extern u8 gUnk_02018EB0[];
|
||||
extern int sub_0807A094(int);
|
||||
|
||||
void MacroPlayer_Type0(MacroPlayerEntity*);
|
||||
@@ -112,8 +111,7 @@ void MacroPlayer_Type0_Init(MacroPlayerEntity* this) {
|
||||
this->unk6a = 4;
|
||||
super->spriteRendering.b0 = 3;
|
||||
SetAffineInfo(super, 4, 4, 0);
|
||||
ptr = gUnk_02018EB0;
|
||||
*(Entity**)&ptr[0x14] = super;
|
||||
gUnk_02018EB0.unk_14 = super;
|
||||
ChangeObjPalette(super, sub_0807A094(0));
|
||||
pEVar1 = CreateObject(PORTAL_FALLING_PLAYER, 1, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
@@ -139,7 +137,7 @@ void MacroPlayer_Type0_Action1(MacroPlayerEntity* this) {
|
||||
super->zVelocity = 0x30000;
|
||||
super->spriteSettings.shadow = 0;
|
||||
super->child->subAction = 1;
|
||||
gUnk_02018EB0[0x18] = 1;
|
||||
gUnk_02018EB0.unk_18 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +151,7 @@ void MacroPlayer_Type0_Action2(MacroPlayerEntity* this) {
|
||||
super->direction = 10;
|
||||
super->speed = 0xc0;
|
||||
super->zVelocity = 0x28000;
|
||||
gUnk_02018EB0[0x19] = 1;
|
||||
gUnk_02018EB0.unk_19 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +165,7 @@ void MacroPlayer_Type0_Action3(MacroPlayerEntity* this) {
|
||||
super->direction = 17;
|
||||
super->speed = 0x100;
|
||||
super->zVelocity = 0x24000;
|
||||
gUnk_02018EB0[0x1a] = 1;
|
||||
gUnk_02018EB0.unk_1a = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +214,7 @@ void MacroPlayer_Type0_Action7(MacroPlayerEntity* this) {
|
||||
super->direction = DirectionWest;
|
||||
}
|
||||
if (super->x.HALF.HI < 0x30) {
|
||||
gUnk_02018EB0[0x1b] = 1;
|
||||
gUnk_02018EB0.unk_1b = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +225,7 @@ void MacroPlayer_Type0_Action8(MacroPlayerEntity* this) {
|
||||
super->direction = DirectionEast;
|
||||
}
|
||||
if (super->x.HALF.HI > 0xd0) {
|
||||
gUnk_02018EB0[0x1b] = 1;
|
||||
gUnk_02018EB0.unk_1b = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +233,7 @@ void MacroPlayer_Type0_Action9(MacroPlayerEntity* this) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
LinearMoveUpdate(super);
|
||||
if (super->y.HALF.HI > 0x120) {
|
||||
gUnk_02018EB0[0x1b] = 1;
|
||||
gUnk_02018EB0.unk_1b = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,6 +244,6 @@ void MacroPlayer_Type0_Action10(MacroPlayerEntity* this) {
|
||||
super->direction = DirectionWest;
|
||||
}
|
||||
if (super->x.HALF.HI < 0x10) {
|
||||
gUnk_02018EB0[0x1b] = 1;
|
||||
gUnk_02018EB0.unk_1b = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,14 +103,15 @@ void sub_08097CB4(Object74Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08097CFC(Object74Entity* this) {
|
||||
// TODO recreate as TileData[]
|
||||
static const u16 gUnk_08123344[] = { 16448, 65471, 16449, 65472, 16450, 65473, 16451, 65535, 16452, 0,
|
||||
16453, 1, 16454, 63, 16455, 64, 16456, 65, 65535 };
|
||||
static const u16 gUnk_0812336A[] = {
|
||||
16449, 65471, 16449, 65472, 16452, 65535, 16452, 0, 16455, 63, 16455, 64, 65535
|
||||
};
|
||||
if ((super->x.HALF.HI & 0xf) == 0) {
|
||||
SetMultipleTiles((u16*)gUnk_0812336A, COORD_TO_TILE(super), super->collisionLayer);
|
||||
SetMultipleTiles((TileData*)gUnk_0812336A, COORD_TO_TILE(super), super->collisionLayer);
|
||||
} else {
|
||||
SetMultipleTiles((u16*)gUnk_08123344, COORD_TO_TILE(super), super->collisionLayer);
|
||||
SetMultipleTiles((TileData*)gUnk_08123344, COORD_TO_TILE(super), super->collisionLayer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ void PushableGrave_Init(PushableGraveEntity* this) {
|
||||
super->hitbox = (Hitbox*)&gUnk_080FD570;
|
||||
SetTile(tileIndex, tilePosition, super->collisionLayer);
|
||||
if (super->type2 == 2) {
|
||||
SetMultipleTiles((u16*)gUnk_081232C0, tilePosition, super->collisionLayer);
|
||||
SetMultipleTiles((TileData*)gUnk_081232C0, tilePosition, super->collisionLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,6 +200,8 @@ bool32 sub_0809798C(PushableGraveEntity* this) {
|
||||
void (*const gUnk_081232AC[])(PushableGraveEntity*) = {
|
||||
PushableGrave_Init, PushableGrave_Action1, PushableGrave_Action2, PushableGrave_Action3, PushableGrave_Action4,
|
||||
};
|
||||
|
||||
// TODO recreate as TileData[]
|
||||
const u8 gUnk_081232C0[] = {
|
||||
61, 64, 191, 255, 61, 64, 192, 255, 61, 64, 193, 255, 61, 64, 255,
|
||||
255, 61, 64, 1, 0, 61, 64, 63, 0, 61, 64, 65, 0, 255, 255,
|
||||
|
||||
@@ -15,6 +15,7 @@ void StoneTablet(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080979CC(Entity* this) {
|
||||
// TODO recreate as TileData[]
|
||||
static const u16 gUnk_081232EC[] = { 0x4022, 0xfffe, 0x4022, 0xffff, 0x4022, 0x0, 0x4022, 0x1, 0xffff };
|
||||
static const u16 gUnk_081232FE[] = { 0x4065, 0xffbf, 0x4022, 0xffc0, 0x4066, 0xffc1, 0x4029,
|
||||
0xffff, 0x4026, 0x0, 0x402a, 0x1, 0xffff };
|
||||
@@ -22,10 +23,10 @@ void sub_080979CC(Entity* this) {
|
||||
this->spriteSettings.draw = 1;
|
||||
if (this->type == 3) {
|
||||
this->frameIndex = 0;
|
||||
SetMultipleTiles((u16*)gUnk_081232FE, COORD_TO_TILE(this), this->collisionLayer);
|
||||
SetMultipleTiles((TileData*)gUnk_081232FE, COORD_TO_TILE(this), this->collisionLayer);
|
||||
} else {
|
||||
this->frameIndex = this->type;
|
||||
SetMultipleTiles((u16*)gUnk_081232EC, COORD_TO_TILE(this), this->collisionLayer);
|
||||
SetMultipleTiles((TileData*)gUnk_081232EC, COORD_TO_TILE(this), this->collisionLayer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -217,31 +217,31 @@ u32 sub_0806F824(Entity* a, Entity* b, s32 x, s32 y) {
|
||||
return CalculateDirectionTo(a->x.HALF.HI, a->y.HALF.HI, b->x.HALF.HI + x, b->y.HALF.HI + y);
|
||||
}
|
||||
|
||||
u32 sub_0806F854(Entity* ent, s32 x, s32 y) {
|
||||
bool32 sub_0806F854(Entity* ent, s32 x, s32 y) {
|
||||
if (ent->z.WORD == 0 || (ent->collisionLayer & 2))
|
||||
return 0;
|
||||
return FALSE;
|
||||
if (!sub_080B1BA4(TILE(ent->x.HALF.HI + x, ent->y.HALF.HI + y), 2, 8)) {
|
||||
ent->spriteRendering.b3 = 1;
|
||||
ent->spriteOrientation.flipY = 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
ent->spriteRendering.b3 = 2;
|
||||
ent->spriteOrientation.flipY = 2;
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u32 sub_0806F8DC(Entity* ent) {
|
||||
bool32 sub_0806F8DC(Entity* ent) {
|
||||
if (ent->collisionLayer & 2)
|
||||
return 0;
|
||||
return FALSE;
|
||||
if (!GetTileTypeByPos(ent->x.HALF.HI, ent->y.HALF.HI - 4, 2)) {
|
||||
GetTileTypeByPos(ent->x.HALF.HI, ent->y.HALF.HI - 4, ent->collisionLayer);
|
||||
ent->spriteRendering.b3 = 1;
|
||||
ent->spriteOrientation.flipY = 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
ent->spriteRendering.b3 = 2;
|
||||
ent->spriteOrientation.flipY = 2;
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u32 sub_0806F948(Entity* ent) {
|
||||
|
||||
+2
-4
@@ -47,8 +47,6 @@ u32 sub_080A6D74(u32);
|
||||
extern const ScreenTransitionData gUnk_08128024[];
|
||||
void sub_080A71F4(ScreenTransitionData*);
|
||||
|
||||
extern u8 gUnk_02018EB0[];
|
||||
|
||||
extern void DeleteAllEntities(void);
|
||||
extern void sub_0805E974(void);
|
||||
|
||||
@@ -314,8 +312,8 @@ void MenuFadeIn(u32 param_1, u32 param_2) {
|
||||
gUI.fadeInTime = 0x20;
|
||||
gMain.substate = GAMEMAIN_SUBTASK;
|
||||
SetFade(5, 0x20);
|
||||
gUnk_02018EB0[0] = 0;
|
||||
gUnk_02018EB0[1] = 0;
|
||||
gUnk_02018EB0.unk_0 = 0;
|
||||
gUnk_02018EB0.unk_1 = 0;
|
||||
}
|
||||
|
||||
void sub_080A71A4(u32 param_1, u32 param_2, u32 param_3) {
|
||||
|
||||
Reference in New Issue
Block a user