Merge remote-tracking branch 'upstream/master' into enumasm

This commit is contained in:
Tal Hayon
2022-05-14 20:55:51 +03:00
39 changed files with 749 additions and 2071 deletions
+5 -10
View File
@@ -324,28 +324,23 @@ void sub_0803981C(StalfosEntity* this) {
EnqueueSFX(SFX_12B);
}
NONMATCH("asm/non_matching/stalfos/sub_08039858.inc", void sub_08039858(StalfosEntity* this)) {
void sub_08039858(StalfosEntity* this) {
s32 iVar1;
u32 uVar2;
u32 uVar3;
u32 tmp;
iVar1 = sub_080398C0(this);
uVar2 = (u32)super->animationState;
tmp = uVar2 * 8;
if (((iVar1 + 4U) & 0x18) == tmp) {
uVar2 = (u32)super->animationState * 8;
if (((iVar1 + 4U) & 0x18) == uVar2) {
if (this->unk_7b != 3) {
return;
}
this->unk_7b = 0;
uVar3 = Random();
iVar1 += ((uVar3 & 2) - 1) * 8;
iVar1 += ((Random() & 2) - 1) * 8;
}
uVar2 = ((iVar1 + uVar2 * -8) & 0x1f) >> 4 ^ 1;
uVar2 = ((iVar1 - uVar2) & 0x1f) >> 4 ^ 1;
InitAnimationForceUpdate(super, gUnk_080CF8F8[(u32)super->animationState * 2 + uVar2]);
super->animationState = ((uVar2 * 2 + super->animationState) - 1) & 3;
}
END_NONMATCH
u32 sub_080398C0(StalfosEntity* this) {
u32 rand = Random();
+11 -11
View File
@@ -374,7 +374,7 @@ static void GameMain_ChangeRoom(void) {
SetPlayerControl(0);
gPauseMenuOptions.disabled = 0;
#if defined(USA) || defined(DEMO_USA)
if (gArea.inventoryGfxIdx != 0xff) {
if (gArea.unk28.inventoryGfxIdx != 0xff) {
sub_0801855C();
}
CreateManagerF();
@@ -384,13 +384,13 @@ static void GameMain_ChangeRoom(void) {
sub_0801855C();
#elif defined(JP)
CheckAreaDiscovery();
if (gArea.inventoryGfxIdx != 0xff) {
if (gArea.unk28.inventoryGfxIdx != 0xff) {
sub_0801855C();
}
#elif defined(DEMO_JP)
if (gRoomTransition.field_0x2c[4])
CheckAreaDiscovery();
if (gArea.inventoryGfxIdx != 0xff) {
if (gArea.unk28.inventoryGfxIdx != 0xff) {
sub_0801855C();
}
CreateManagerF();
@@ -2105,10 +2105,10 @@ void sub_08053CC8(void) {
void sub_08053D34(void) {
if (gMenu.field_0xa != 0) {
gMenu.field_0xa = 0;
if (CheckLocalFlagByBank(0x680, 0x3d)) {
if (CheckLocalFlagByBank(FLAG_BANK_7, 0x3d)) {
SetTileType(0x74, 0xc4, 1);
}
if (CheckLocalFlagByBank(0x680, 0x3e)) {
if (CheckLocalFlagByBank(FLAG_BANK_7, 0x3e)) {
SetTileType(0x74, 0xcc, 1);
}
}
@@ -2682,22 +2682,22 @@ void sub_08054968(void) {
void sub_08054974(s32 param_1, s32 param_2) {
struct_080FE320* ptr = &gUnk_080FE320[param_1];
SetCurrentRoomPropertyList(ptr->_2, ptr->_3);
gRoomControls.area = ptr->_2;
gRoomControls.room = ptr->_3;
SetCurrentRoomPropertyList(ptr->area, ptr->room);
gRoomControls.area = ptr->area;
gRoomControls.room = ptr->room;
LoadGfxGroups();
gArea.localFlagOffset = GetFlagBankOffset(gRoomControls.area);
if (param_2 != 0) {
LoadAuxiliaryRoom(ptr->_2, ptr->_3);
LoadAuxiliaryRoom(ptr->area, ptr->room);
} else {
sub_08052FF4(ptr->_2, ptr->_3);
sub_08052FF4(ptr->area, ptr->room);
InitializeCamera();
gUpdateVisibleTiles = 1;
}
gScreen.lcd.displayControl &= 0x1fff;
gRoomControls.scroll_x = gRoomControls.origin_x + ptr->_4;
gRoomControls.scroll_y = gRoomControls.origin_y + ptr->_6;
if (ptr->_2 == 2) {
if (ptr->area == AREA_HYRULE_TOWN) {
TryLoadPrologueHyruleTown();
}
sub_08018710(gUI.field_0x3);
+456
View File
@@ -1,5 +1,461 @@
#include "global.h"
#include "room.h"
#include "subtask.h"
#include "common.h"
#include "flags.h"
#include "player.h"
#include "kinstone.h"
#include "area.h"
#include "manager.h"
#include "asm.h"
typedef struct {
u8 unk0;
u8 unk1;
u8 unk2;
u8 unk3;
} struct_gUnk_080B3D20;
extern struct_gUnk_080B3D20 gUnk_080B3D20[];
extern EntityData gUnk_080FEC28[];
extern EntityData gUnk_080FEBE8[];
extern EntityData gUnk_080FECC8[];
extern EntityData gUnk_080FEE78[];
extern EntityData gUnk_080FED58[];
extern const EntityData gUnk_080FED18[];
extern const EntityData gUnk_080FEE38[];
extern const EntityData gUnk_080FEE18[];
extern const EntityData gUnk_080FEE48[];
extern const EntityData gUnk_080FEE58[];
extern const void* gUnk_080FED98[];
extern const u16 gUnk_080B3D14[];
void sub_08018AB4(int);
void sub_08018BB4(int);
void sub_08018A58(int);
void sub_08018B50(int);
void sub_080189EC(int);
void sub_0801876C(int, int);
void sub_08018738(u32, int);
void sub_08018690(int param_1, u16* param_2);
void sub_08018500();
bool32 sub_080185B4(const struct_gUnk_080B3D20* param_1);
void sub_08018500(void) {
s32 sVar1;
u32 i;
u16* puVar3;
u16* puVar4;
struct_area_28* ptr = &gArea.unk28;
puVar3 = ptr->unk2C;
sVar1 = gUnk_080B3D14[ptr->inventoryGfxIdx] + ptr->unk29 * 3;
for (i = 0; i < 3; i++) {
*puVar3 = sVar1;
sVar1++;
puVar3++;
}
sVar1 = ptr->inventoryGfxIdx * 5 + 0xc81;
for (i = 0, puVar4 = &ptr->unk2C[3]; i < 5; i++) {
*puVar3 = sVar1;
sVar1++;
puVar3++;
}
sub_08018690(5, puVar4);
ptr->unk2a = 0;
}
void sub_0801855C(void) {
u32 bVar3;
struct_area_28* ptr;
// TODO: Figure out what is up with the pointer assignment
struct_gUnk_080B3D20* pcVar2 = (struct_gUnk_080B3D20*)&gArea.unk28;
MemClear(pcVar2, 0x14);
ptr = (struct_area_28*)pcVar2;
for (pcVar2 = gUnk_080B3D20, bVar3 = 0; pcVar2->unk0 != 0xff; pcVar2++) {
if (sub_080185B4(pcVar2)) {
bVar3 = ptr->unk2b;
}
ptr->unk2b++;
}
ptr->unk2b = bVar3;
pcVar2 = &gUnk_080B3D20[ptr->unk2b];
ptr->inventoryGfxIdx = pcVar2->unk2;
ptr->unk29 = pcVar2->unk3;
ptr->unk2b = bVar3 + 1;
sub_08018500();
}
bool32 sub_080185B4(const struct_gUnk_080B3D20* param_1) {
if (param_1->unk0 == 0xff)
return 0;
if (param_1->unk0 == 0xfe) {
return GetInventoryValue(param_1->unk1) != 0;
}
if (param_1->unk0 == 0xfd) {
return CheckKinstoneFused(param_1->unk1);
}
return CheckLocalFlagByBank(gLocalFlagBanks[param_1->unk0], param_1->unk1);
}
void sub_080185F8(void) {
struct_area_28* ptr2 = &gArea.unk28;
struct_gUnk_080B3D20* ptr = &gUnk_080B3D20[ptr2->unk2b];
if (sub_080185B4(ptr)) {
ptr2->inventoryGfxIdx = ptr->unk2;
ptr2->unk29 = ptr->unk3;
ptr2->unk2b++;
sub_08018500();
}
}
void GenerateAreaHint(void) {
u16 uVar1;
struct_area_28* ptr;
gPlayerState.queued_action = 0x16;
#if defined(EU) || defined(JP)
// TODO what fields of the room transition are switched in these variants?
gRoomTransition.field_0x2c[7] = 0;
#else
gRoomTransition.hint_height = 0;
#endif
ptr = &gArea.unk28;
if (ptr->inventoryGfxIdx == 0xff) {
gRoomTransition.hint_idx = ptr->unk2C[0];
} else {
gRoomTransition.hint_idx = ptr->unk2C[ptr->unk2a];
ptr->unk2a++;
if (ptr->unk2a > 7) {
ptr->unk2a = 0;
sub_08018690(8, ptr->unk2C);
if (ptr->unk2C[0] == gRoomTransition.hint_idx) {
uVar1 = ptr->unk2C[0];
ptr->unk2C[0] = ptr->unk3E;
ptr->unk3E = uVar1;
}
}
}
}
void sub_08018690(int param_1, u16* param_2) {
u32 uVar1;
s32 uVar4;
s32 uVar2;
s32 iVar3;
u16* puVar4;
u16* puVar5;
uVar4 = param_1 - 1;
if (uVar4 != 0) {
puVar5 = (u16*)(uVar4 * 2 + (int)param_2);
do {
uVar2 = Random();
iVar3 = uVar2 % (uVar4 + 1);
uVar1 = *puVar5;
puVar4 = (u16*)(iVar3 * 2 + (int)param_2);
*puVar5 = *puVar4;
*puVar4 = uVar1;
puVar5--;
uVar4--;
} while (uVar4 != 0);
}
}
void sub_080186C0(u32 param_1) {
gArea.unk28.inventoryGfxIdx = 0xff;
gArea.unk28.unk2C[0] = param_1;
}
void sub_080186D4(void) {
if (gArea.unk28.inventoryGfxIdx == 0xff) {
sub_0801855C();
}
}
void sub_080186EC(u32 param_1) {
struct_080C9CBC* psVar1;
u32 i;
for (i = 0, psVar1 = gUnk_080C9CBC; i <= 100; psVar1++, i++) {
if (psVar1->unk3 == 8) {
sub_08018738(i, psVar1->evt_type);
}
}
}
void sub_08018710(u32 param_1) {
struct_080C9CBC* psVar1;
u32 i;
for (i = 0, psVar1 = gUnk_080C9CBC; i <= 100; psVar1++, i++) {
if (psVar1->unk3 == 8 && param_1 != psVar1->evt_type) {
sub_08018738(i, psVar1->evt_type);
}
}
}
void sub_08018738(u32 param_1, int param_2) {
struct_080FE320* ptr = &gUnk_080FE320[param_2];
if (ptr->area == gRoomControls.area && ptr->room == gRoomControls.room) {
sub_0801876C(param_2, CheckKinstoneFused(param_1));
}
}
void sub_0801876C(int param_1, int param_2) {
Entity* roomEnt;
Entity* ent;
u32 uVar3;
u32 tmp;
u8* puVar4;
u32 uVar5;
struct_080FE320* ptr;
ptr = &gUnk_080FE320[param_1];
switch (ptr->evt_type) {
case 6:
if (param_2 == 0) {
sub_08018AB4((ptr->x >> 4 & 0x3f) | (ptr->y >> 4 & 0x3f) << 6);
}
break;
case 0:
break;
case 2:
if (param_2 != 0) {
sub_08018BB4(param_1);
}
break;
case 1:
if (param_2 == 0) {
return;
}
if (CheckGlobalFlag(ptr->flag)) {
return;
}
LoadRoomEntity(gUnk_080FEC28 + ptr->entity_idx);
break;
case 3:
if (param_2 == 0) {
return;
}
if (GetInventoryValue(ptr->flag)) {
return;
}
LoadRoomEntity(gUnk_080FEBE8 + ptr->entity_idx);
break;
case 4:
if (param_2 == 0) {
sub_08018A58(param_1);
}
break;
case 5:
if (param_2 != 0) {
sub_08018B50(param_1);
}
break;
case 7:
if (param_2 != 0) {
return;
}
if (ptr->entity_idx != 0x80) {
LoadRoomEntity(gUnk_080FECC8 + ptr->entity_idx);
} else {
sub_080189EC(param_1);
}
break;
case 0x19:
roomEnt = LoadRoomEntity(&gUnk_080FED18[ptr->entity_idx]);
if (roomEnt != 0) {
roomEnt->type = param_2 ? 2 : 0;
}
break;
case 8:
if (param_2 == 0) {
return;
}
SetTileType(0x168, (ptr->x >> 4 & 0x3f) | (ptr->y >> 4 & 0x3f) << 6, 1);
break;
case 0xb:
if (param_2 != 0) {
LoadRoomEntity(&gUnk_080FED58[ptr->entity_idx]);
gRoomVars.field_0x8c[ptr->entity_idx] = (void*)gUnk_080FED98[ptr->entity_idx];
}
break;
case 9:
if (param_2 == 0) {
return;
}
ent = LoadRoomEntity(&gUnk_080FEE78[ptr->entity_idx]);
if (ent != 0) {
*(u16*)&ent->collisionLayer = ptr->x + gRoomControls.origin_x;
*(u16*)&ent->gustJarState = ptr->y + gRoomControls.origin_y;
}
if (ptr->entity_idx == 0) {
SetTileType(0x8d, (ptr->x >> 4 & 0x3f) | (ptr->y >> 4 & 0x3f) << 6, 1);
} else {
uVar5 = (ptr->x >> 4 & 0x3f) | (ptr->y >> 4 & 0x3f) << 6;
SetTileType(0x8c, uVar5 - 1, 1);
uVar3 = 0x8e;
SetTileType(uVar3, uVar5, 1);
}
break;
case 0x18:
if (param_2 != 0) {
LoadRoomEntityList(gUnk_080FEE18);
}
break;
case 0xf:
if (param_2 != 0) {
LoadRoomEntity(gUnk_080FEE58);
} else {
LoadRoomEntity(gUnk_080FEE48);
}
break;
case 0x11:
if (param_2 != 0) {
SetLocalFlagByBank(FLAG_BANK_1, SOUGEN_05_BOMB_00);
LoadRoomEntityList(gUnk_080FEE38);
}
break;
case 0x1a:
case 0x1b:
case 0x1c:
break;
}
}
void sub_080189EC(int param_1) {
u32 i;
int iVar1;
int tilePosition;
struct_080FE320* ptr;
ptr = &gUnk_080FE320[param_1];
tilePosition = (ptr->x >> 4) & 0x3f;
tilePosition |= ((ptr->y >> 4) & 0x3f) << 6;
tilePosition -= 0x42;
for (i = 0; i < 4; i++) {
SetTileType(i + 0x1df, tilePosition + i, 2);
}
tilePosition += 0x40;
for (i = 0; i < 4; i++) {
SetTileType(i + 0x1e3, tilePosition + i, 2);
SetTileType(i + 0x1db, tilePosition + i, 1);
}
}
void sub_08018A58(int param_1) {
u32 i;
int iVar2;
u32 j;
int tilePosition;
struct_080FE320* ptr;
ptr = &gUnk_080FE320[param_1];
tilePosition = (ptr->x >> 4) & 0x3f;
tilePosition |= ((ptr->y >> 4) & 0x3f) << 6;
tilePosition -= 0x43;
iVar2 = 0x232;
for (i = 0; i < 4; tilePosition += 0x40, i++) {
for (j = 0; j < 7; j++) {
SetTileType(iVar2++, tilePosition + j, 1);
}
}
}
void sub_08018AB4(int param_1) {
u32 i;
int iVar2;
u32 j;
int iVar6;
iVar2 = 0x1e8;
iVar6 = 500;
for (i = 0; i < 3; i++) {
j = 0;
for (; j < 4; j++) {
SetTileType(iVar2++, param_1 + j, 1);
SetTileType(iVar6++, param_1 - 0x40 + j, 2);
}
param_1 += 0x40;
}
}
void sub_08018B10(int param_1) {
int iVar1;
u32 index;
int iVar3;
int iVar4;
iVar4 = 0x1f0;
iVar3 = 0x1fc;
index = 0;
iVar1 = param_1 - 0x40;
for (; index < 4; iVar1++, index++) {
SetTileType(iVar4++, param_1 + index, 1);
SetTileType(iVar3++, iVar1, 2);
}
}
void sub_08018B50(int param_1) {
u32 i;
int iVar2;
u32 j;
int tilePosition;
struct_080FE320* ptr;
ptr = &gUnk_080FE320[param_1];
if ((ptr->entity_idx & 0x80) == 0) {
iVar2 = 0x200;
} else {
iVar2 = 0x219;
}
tilePosition = (ptr->x >> 4) & 0x3f;
tilePosition |= ((ptr->y >> 4) & 0x3f) << 6;
tilePosition -= 0x82;
for (i = 0; i < 5; tilePosition += 0x40, i++) {
for (j = 0; j < 5; j++) {
SetTileType(iVar2++, tilePosition + j, 1);
}
}
}
void sub_08018BB4(int param_1) {
u32 layer;
TileEntity tile;
struct_080FE320* ptr;
u32 position;
MemCopy(gUnk_080FEAC8 + param_1, &tile, sizeof(TileEntity));
ptr = &gUnk_080FE320[param_1];
tile.tilePos = (ptr->x >> 4 & 0x3f) | (((ptr->y) >> 4 & 0x3f) << 6);
sub_0804B3C4(&tile);
if (CheckLocalFlag(tile.localFlag) == 0) {
position = tile.tilePos;
if ((tile._6 & 1) == 0) {
layer = 1;
} else {
layer = 2;
}
SetTileType(0x73, position, layer);
}
}
void CreateMinishEntrance(u32 tilePos) {
u32 x, y;
-2
View File
@@ -1,8 +1,6 @@
#include "entity.h"
#include "room.h"
extern Entity* LoadRoomEntity(EntityData*);
void sub_0805E0C0(Entity*);
void sub_0805E0F4(Entity*);
+1 -1
View File
@@ -147,7 +147,7 @@ static void sub_08058514(ManagerA* this) {
}
static void sub_080585B0(ManagerA* this) {
if (gArea.inventoryGfxIdx != 0xFF) {
if (gArea.unk28.inventoryGfxIdx != 0xFF) {
DeleteThisEntity();
}
if (CheckFlags(this->flag1)) {
-2
View File
@@ -81,8 +81,6 @@ void ManagerB_WaitForDone(ManagerB* this) {
ManagerBHelper* CreateHelper(Manager*);
void ManagerBHelper_Monitor(ManagerBHelper*, Entity*, u32);
extern Entity* LoadRoomEntity(EntityData*);
void ManagerB_LoadFight(Manager* this) {
ManagerBHelper* monitor;
EntityData* prop;
+1 -1
View File
@@ -414,7 +414,7 @@ void sub_080594DC(ManagerF* this) {
break;
case 2:
default:
if (gArea.inventoryGfxIdx != 0xFF) {
if (gArea.unk28.inventoryGfxIdx != 0xFF) {
DeleteThisEntity();
}
if (CheckLocalFlagByBank(FLAG_BANK_10, 0x85)) {
+73 -63
View File
@@ -1775,25 +1775,26 @@ bool32 MoveNorth(Entity* this, s32 radius, s32 angle, u32 collisionType) {
}
}
ASM_FUNC("asm/non_matching/movement/MoveNorthEast.inc",
bool32 MoveNorthEast(Entity* this, s32 radius, s32 angle, u32 collisionType))
/*NONMATCH("asm/non_matching/movement/MoveNorthEast.inc",
bool32 MoveNorthEast(Entity* this, s32 radius, s32 angle, u32 collisionType)) {
bool32 MoveNorthEast(Entity* this, s32 radius, s32 angle, u32 collisionType) {
s32 moveA = 0;
s32 moveB = 0;
if (((this->collisions & COL_NORTH_ANY) == COL_NONE) || ((this->collisions & COL_EAST_ANY) == COL_NONE)) {
if ((this->collisions & (COL_NORTH_ANY | COL_EAST_ANY)) == COL_NONE) {
moveA = radius * gSineTable[angle + 0x40];
s32 northCollision = (this->collisions & COL_NORTH_ANY);
u32 northCollision2 = northCollision;
s32 eastCollision = (this->collisions & COL_EAST_ANY);
u32 eastCollision2 = eastCollision;
if ((northCollision == COL_NONE) || (eastCollision == COL_NONE)) {
if ((northCollision | eastCollision) == COL_NONE) {
moveA = gSineTable[angle + 0x40] * radius;
this->y.WORD -= moveA;
moveB = radius * gSineTable[angle];
moveB = gSineTable[angle] * radius;
this->x.WORD += moveB;
} else {
if ((this->collisions & COL_NORTH_ANY) == COL_NORTH_WEST) {
if (northCollision2 == COL_NORTH_WEST) {
moveA = radius * 0x100;
this->x.WORD += moveA;
CalculateEntityTileCollisions(this, DirectionNorthEast, collisionType);
} else {
if ((this->collisions & COL_EAST_ANY) == COL_EAST_NORTH) {
if (eastCollision2 == COL_EAST_NORTH) {
moveA = radius * 0x100;
this->y.WORD -= moveA;
CalculateEntityTileCollisions(this, DirectionNorthEast, collisionType);
@@ -1809,13 +1810,14 @@ ASM_FUNC("asm/non_matching/movement/MoveNorthEast.inc",
}
}
}
if (((moveA >= -0x3333) && (moveA < 0x3333)) && ((moveB >= -0x3333) && (moveB < 0x3333))) {
return FALSE;
} else {
if (((moveA < -0x3333) || (moveA >= 0x3333))) {
return TRUE;
} else if ((moveB < -0x3333) || (moveB >= 0x3333)) {
return TRUE;
} else {
return FALSE;
}
}
END_NONMATCH*/
bool32 MoveEast(Entity* this, s32 radius, s32 angle, u32 collisionType) {
s32 moveA = 0;
@@ -1855,24 +1857,25 @@ bool32 MoveEast(Entity* this, s32 radius, s32 angle, u32 collisionType) {
}
}
ASM_FUNC("asm/non_matching/movement/MoveSouthEast.inc",
bool32 MoveSouthEast(Entity* this, s32 radius, s32 angle, u32 collisionType))
/*NONMATCH("asm/non_matching/movement/MoveSouthEast.inc",
bool32 MoveSouthEast(Entity* this, s32 radius, s32 angle, u32 collisionType)) {
bool32 MoveSouthEast(Entity* this, s32 radius, s32 angle, u32 collisionType) {
s32 moveA = 0;
s32 moveB = 0;
if (((this->collisions & COL_SOUTH_ANY) == COL_NONE) || ((this->collisions & COL_EAST_ANY) == COL_NONE)) {
if ((this->collisions & (COL_SOUTH_ANY | COL_EAST_ANY)) == COL_NONE) {
s32 anySouth = this->collisions & COL_SOUTH_ANY;
s32 anySouth2 = anySouth;
s32 anyEast = this->collisions & COL_EAST_ANY;
s32 anyEast2 = anyEast;
if ((anySouth == COL_NONE) || (anyEast == COL_NONE)) {
if ((anySouth | anyEast) == COL_NONE) {
moveA = gSineTable[angle + 0x40] * radius;
this->y.WORD -= moveA;
moveB = gSineTable[angle] * radius;
this->x.WORD += moveB;
} else {
if ((this->collisions & COL_SOUTH_ANY) == COL_SOUTH_WEST) {
if (anySouth2 == COL_SOUTH_WEST) {
moveA = radius * 0x100;
this->x.WORD += moveA;
CalculateEntityTileCollisions(this, DirectionSouthEast, collisionType);
} else if ((this->collisions & COL_EAST_ANY) == COL_EAST_SOUTH) {
} else if (anyEast2 == COL_EAST_SOUTH) {
moveA = radius * 0x100;
this->y.WORD += moveA;
CalculateEntityTileCollisions(this, DirectionSouthEast, collisionType);
@@ -1887,13 +1890,16 @@ ASM_FUNC("asm/non_matching/movement/MoveSouthEast.inc",
}
}
}
if (((moveA >= -0x3333) && (moveA < 0x3333)) && ((moveB >= -0x3333) && (moveB < 0x3333))) {
return FALSE;
} else {
if (moveA < -0x3333 || moveA >= 0x3333) {
return TRUE;
}
if (moveB < -0x3333 || moveB >= 0x3333) {
return TRUE;
}
return FALSE;
}
END_NONMATCH*/
bool32 MoveSouth(Entity* this, s32 radius, s32 angle, u32 collisionType) {
s32 moveA = 0;
@@ -1934,47 +1940,49 @@ bool32 MoveSouth(Entity* this, s32 radius, s32 angle, u32 collisionType) {
}
}
ASM_FUNC("asm/non_matching/movement/MoveSouthWest.inc",
bool32 MoveSouthWest(Entity* this, s32 radius, s32 angle, u32 collisionType))
/*NONMATCH("asm/non_matching/movement/MoveSouthWest.inc",
bool32 MoveSouthWest(Entity* this, s32 radius, s32 angle, u32 collisionType)) {
bool32 MoveSouthWest(Entity* this, s32 radius, s32 angle, u32 collisionType) {
s32 moveA = 0;
s32 moveB = 0;
if (((this->collisions & COL_SOUTH_ANY) == COL_NONE) || ((this->collisions & COL_WEST_ANY) == COL_NONE)) {
if ((this->collisions & (COL_SOUTH_ANY | COL_WEST_ANY)) == COL_NONE) {
moveB = gSineTable[angle + 0x40] * radius;
this->y.WORD -= moveB;
moveA = gSineTable[angle] * radius;
this->x.WORD += moveA;
s32 anySouth = this->collisions & COL_SOUTH_ANY;
s32 anySouth2 = anySouth;
s32 anyWest = this->collisions & COL_WEST_ANY;
s32 anyWest2 = anyWest;
if ((anySouth == COL_NONE) || (anyWest == COL_NONE)) {
if ((anySouth | anyWest) == COL_NONE) {
moveA = gSineTable[angle + 0x40] * radius;
this->y.WORD -= moveA;
moveB = gSineTable[angle] * radius;
this->x.WORD += moveB;
} else {
if ((this->collisions & COL_SOUTH_ANY) == COL_SOUTH_EAST) {
moveB = radius * 0x100;
this->x.WORD -= moveB;
if (anySouth2 == COL_SOUTH_EAST) {
moveA = radius * 0x100;
this->x.WORD -= moveA;
CalculateEntityTileCollisions(this, DirectionSouthWest, collisionType);
} else if (anyWest2 == COL_WEST_SOUTH) {
moveA = radius * 0x100;
this->y.WORD += moveA;
CalculateEntityTileCollisions(this, DirectionSouthWest, collisionType);
} else {
if ((this->collisions & COL_WEST_ANY) == COL_WEST_SOUTH) {
moveB = radius * 0x100;
this->y.WORD += moveB;
CalculateEntityTileCollisions(this, DirectionSouthWest, collisionType);
}
}
if ((this->collisions & COL_SOUTH_ANY) == COL_NONE) {
moveA = gSineTable[angle + 0x40] * radius;
this->y.WORD -= moveA;
moveB = gSineTable[angle + 0x40] * radius;
this->y.WORD -= moveB;
}
if ((this->collisions & COL_WEST_ANY) == COL_NONE) {
moveA = gSineTable[angle] * radius;
this->x.WORD += moveA;
moveB = gSineTable[angle] * radius;
this->x.WORD += moveB;
}
}
}
if (((moveA >= -0x3333) && (moveA < 0x3333)) && ((moveB >= -0x3333) && (moveB < 0x3333))) {
return FALSE;
} else {
if (moveA < -0x3333 || moveA >= 0x3333) {
return TRUE;
}
if (moveB < -0x3333 || moveB >= 0x3333) {
return TRUE;
}
return FALSE;
}
END_NONMATCH*/
bool32 MoveWest(Entity* this, s32 radius, s32 angle, u32 collisionType) {
s32 moveA = 0;
@@ -2018,14 +2026,13 @@ bool32 MoveWest(Entity* this, s32 radius, s32 angle, u32 collisionType) {
}
}
ASM_FUNC("asm/non_matching/movement/MoveNorthWest.inc",
bool32 MoveNorthWest(Entity* this, s32 radius, s32 angle, u32 collisionType))
/*NONMATCH("asm/non_matching/movement/MoveNorthWest.inc",
bool32 MoveNorthWest(Entity* this, s32 radius, s32 angle, u32 collisionType)) {
bool32 MoveNorthWest(Entity* this, s32 radius, s32 angle, u32 collisionType) {
s32 moveA = 0;
s32 moveB = 0;
u32 colNorthAny = (this->collisions & COL_NORTH_ANY);
u32 colNorthAny2 = colNorthAny;
u32 colWestAny = (this->collisions & COL_WEST_ANY);
u32 colWestAny2 = colWestAny;
if ((colNorthAny == COL_NONE) || (colWestAny == COL_NONE)) {
if ((colNorthAny | colWestAny) == COL_NONE) {
moveA = gSineTable[angle + 0x40] * radius;
@@ -2033,12 +2040,12 @@ ASM_FUNC("asm/non_matching/movement/MoveNorthWest.inc",
moveB = gSineTable[angle] * radius;
this->x.WORD += moveB;
} else {
if (colNorthAny == COL_NORTH_EAST) {
if (colNorthAny2 == COL_NORTH_EAST) {
moveA = radius * 0x100;
this->x.WORD -= moveA;
CalculateEntityTileCollisions(this, DirectionNorthWest, collisionType);
} else {
if (colWestAny == COL_WEST_NORTH) {
if (colWestAny2 == COL_WEST_NORTH) {
moveA = radius * 0x100;
this->y.WORD -= moveA;
CalculateEntityTileCollisions(this, DirectionNorthWest, collisionType);
@@ -2054,13 +2061,16 @@ ASM_FUNC("asm/non_matching/movement/MoveNorthWest.inc",
}
}
}
if (((moveA >= -0x3333) && (moveA < 0x3333)) && ((moveB >= -0x3333) && (moveB < 0x3333))) {
return FALSE;
} else {
if (moveA < -0x3333 || moveA >= 0x3333) {
return TRUE;
}
if (moveB < -0x3333 || moveB >= 0x3333) {
return TRUE;
}
return FALSE;
}
END_NONMATCH*/
bool32 ProcessMovement0(Entity* this) {
bool32 result;
+1 -1
View File
@@ -61,7 +61,7 @@ void (*const gObjectFunctions[])(Entity*) = {
[JAR_PORTAL] = JarPortal,
[BOSS_DOOR] = BossDoor,
[OBJECT_3A] = Object3A,
[PORTAL_MUSHROOM_STALKS] = MacroMushromStalks,
[PORTAL_MUSHROOM_STALKS] = MacroMushroomStalks,
[PORTAL_FALLING_PLAYER] = MacroPlayer,
[OBJECT_3D] = Object3D,
[OBJECT_3E] = Object3E,
+101 -1
View File
@@ -1,12 +1,112 @@
#include "entity.h"
#include "area.h"
#include "main.h"
#include "sound.h"
#include "object.h"
void sub_0808C964(Entity*);
void sub_0808CA10(Entity*);
void MacroMushromStalks(Entity* this) {
static const s16 gUnk_08121648[] = { 264, 252, 256, 256, 248, 260, 240, 264, 248, 260, 256, 256, 264, 252, 272, 248 };
void MacroMushroomStalks(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
sub_0808C964,
sub_0808CA10,
};
actionFuncs[this->action](this);
}
void Object75(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
sub_0808C964,
sub_0808CA10,
};
actionFuncs[this->action](this);
}
void Object76(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
sub_0808C964,
sub_0808CA10,
};
actionFuncs[this->action](this);
}
void sub_0808C964(Entity* this) {
u32 uVar1;
this->frameIndex = this->type;
if ((this->id == OBJECT_76) && (gUI.roomControls.area != AREA_HYRULE_TOWN)) {
this->type -= 9;
}
if (4 < this->type) {
if (gArea.portal_exit_dir != this->type2) {
DeleteThisEntity();
}
}
this->action = 1;
this->spriteSettings.draw = 1;
this->spriteOrientation.flipY = 2;
this->spriteRendering.b3 = 2;
;
this->spritePriority.b0 = this->type2;
if (this->id != OBJECT_75 && (u8)(this->type - 1) < 3) {
this->spriteRendering.b0 = 3;
if (this->type == 1) {
uVar1 = 0xe0;
} else {
uVar1 = 0x100;
}
SetAffineInfo(this, uVar1, uVar1, 0);
}
}
void sub_0808CA10(Entity* this) {
s32 sVar3;
s32 sVar5;
switch (this->type) {
case 1:
if (gUnk_02018EB0.unk_18 != 0) {
this->timer = 0x20;
gUnk_02018EB0.unk_18 = 0;
SoundReq(SFX_12E);
}
break;
case 2:
if (gUnk_02018EB0.unk_19 != 0) {
this->timer = 0x20;
gUnk_02018EB0.unk_19 = 0;
SoundReq(SFX_12E);
}
break;
case 3:
if (gUnk_02018EB0.unk_1a != 0) {
this->timer = 0x20;
gUnk_02018EB0.unk_1a = 0;
SoundReq(SFX_12E);
}
break;
}
if ((this->id != OBJECT_75 && ((u8)(this->type - 1) < 3)) && this->timer != 0) {
this->timer--;
this->subtimer++;
if (this->timer != 0) {
sVar5 = gUnk_08121648[this->subtimer & 0xe];
sVar3 = gUnk_08121648[(this->subtimer & 0xe) + 1];
} else {
sVar3 = 0x100;
sVar5 = sVar3;
}
if (this->type == 1) {
sVar5 = sVar5 - 0x20;
sVar3 = sVar3 - 0x20;
}
SetAffineInfo(this, sVar5, sVar3, 0);
}
}
-2
View File
@@ -160,5 +160,3 @@ void sub_0808C8B8(Object3AEntity* this) {
DeleteThisEntity();
}
}
const u16 gUnk_08121648[] = { 264, 252, 256, 256, 248, 260, 240, 264, 248, 260, 256, 256, 264, 252, 272, 248 };
+3 -3
View File
@@ -808,7 +808,7 @@ void sub_0809584C(Object6AEntity* this) {
u32 tmp, idx;
idx = super->health;
if ((idx & 0x7F) != 0 && !ReadBit((u32*)gArea.filler5, idx - 1))
if ((idx & 0x7F) != 0 && !ReadBit((u32*)gArea.filler6, idx - 1))
DeleteThisEntity();
if (super->timer != 0 && CheckKinstoneFused(super->type2))
DeleteThisEntity();
@@ -1178,9 +1178,9 @@ void sub_08095F38(Object6AEntity* this) {
void sub_08096028(Object6AEntity* this) {
u32 type2 = 6;
if (!CheckLocalFlagByBank(768, 123))
if (!CheckLocalFlagByBank(FLAG_BANK_3, 123))
type2 = 4;
if (!CheckLocalFlagByBank(768, 122))
if (!CheckLocalFlagByBank(FLAG_BANK_3, 122))
type2 = 3;
CreateObject(OBJECT_6A, 0x1F, type2);
}
-14
View File
@@ -1,14 +0,0 @@
#define NENT_DEPRECATED
#include "entity.h"
extern void sub_0808C964(Entity*);
extern void sub_0808CA10(Entity*);
void Object75(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
sub_0808C964,
sub_0808CA10,
};
actionFuncs[this->action](this);
}
-14
View File
@@ -1,14 +0,0 @@
#define NENT_DEPRECATED
#include "entity.h"
extern void sub_0808C964(Entity*);
extern void sub_0808CA10(Entity*);
void Object76(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
sub_0808C964,
sub_0808CA10,
};
actionFuncs[this->action](this);
}
+2 -2
View File
@@ -283,8 +283,8 @@ typedef struct {
} struct_gUnk_08122898;
const struct_gUnk_08122898 gUnk_08122898[] = {
{ 0x200, 0xa1, 0xa2 },
{ 0x8c0, 0x6f, 0x70 },
{ FLAG_BANK_2, 0xa1, 0xa2 },
{ FLAG_BANK_10, 0x6f, 0x70 },
};
u32 sub_080932D8(u32 param_1) {
+3 -3
View File
@@ -294,9 +294,9 @@ void sub_080971E0(ObjectOnPillarEntity* this) {
bool32 sub_08097348(u32 tilePosition) {
u32 index;
TileEntity* tileEntity = gSmallChests;
for (index = 0; index < 8; index++, tileEntity++) {
if (tileEntity->_4 == tilePosition) {
return CheckLocalFlag(tileEntity->_1);
for (index = 0; index < ARRAY_COUNT(gSmallChests); index++, tileEntity++) {
if (tileEntity->tilePos == tilePosition) {
return CheckLocalFlag(tileEntity->localFlag);
}
}
return FALSE;
+1 -1
View File
@@ -23,7 +23,7 @@ void Whirlwind(Entity* this) {
Whirlwind_Action2,
};
u32 tmp = this->health;
if (((tmp & 0x7f) != 0) && (ReadBit(gArea.filler5, tmp - 1) == 0)) {
if (((tmp & 0x7f) != 0) && (ReadBit(gArea.filler6, tmp - 1) == 0)) {
DeleteThisEntity();
}
Whirlwind_Actions[this->action](this);
+1 -1
View File
@@ -26,7 +26,7 @@ static bool32 sub_0807007C(struct_gUnk_020000C0*, u32);
void sub_0806F364(void) {
gArea.filler[2] ^= 0x80;
MemClear(&gArea.filler5[(gArea.filler[2] + 7) / 8], 16);
MemClear(&gArea.filler6[(gArea.filler[2] + 7) / 8], 16);
}
void sub_0806F38C(void) {
+4 -4
View File
@@ -56,14 +56,14 @@ void sub_080A7C8C(u32 pos, u32 layer) {
u32 found = 0;
u32 i;
for (i = 0; i < 8; ++i, ++t) {
if (*(u16*)&t->_4 == pos) {
if (*(u16*)&t->tilePos == pos) {
found = 1;
break;
}
}
if ((layer >> 1) == ((u32)(t->_6 << 31) >> 31)) {
if (found) {
SetLocalFlag(t->_1);
SetLocalFlag(t->localFlag);
CreateItemEntity(t->_2, t->_3, 0);
} else {
CreateItemEntity(0x60, 0, 0);
@@ -81,7 +81,7 @@ u32 sub_080A7CFC(u32 a1) {
TileEntity* t = GetCurrentRoomProperty(3);
if (t != 0) {
do {
if (t->_4 == a1) {
if (t->tilePos == a1) {
switch (t->type) {
case SIGN:
hint = FALSE;
@@ -95,7 +95,7 @@ u32 sub_080A7CFC(u32 a1) {
break;
}
t++;
} while (t->_4 != 0);
} while (t->tilePos != 0);
}
InitTileMessage(msg, hint);
}
+20 -20
View File
@@ -215,27 +215,27 @@ bool32 sub_080777A0(void) {
}
}
NONMATCH("asm/non_matching/playerUtils/sub_08077880.inc", void sub_08077880(u32 param_1, u32 param_2, u32 param_3)) {
void sub_08077880(Item itemId, u32 param_2, u32 param_3) {
ItemBehavior* item;
u16* puVar2;
if (param_1 - 1 < 0x1f) {
if (gUnk_0811BE48[param_1].unk0[0] != 0) {
if (itemId - 1 < 0x1f) {
struct_0811BE48* ptr = &gUnk_0811BE48[itemId];
puVar2 = &gPlayerState.field_0x90;
if (ptr->unk0[0] != 0) {
puVar2 = &gPlayerState.field_0x92;
} else {
puVar2 = &gPlayerState.field_0x90;
}
if (((*puVar2 & param_2) != 0) || (param_3 != 0)) {
item = sub_0807794C(param_1);
item = sub_0807794C(itemId);
if (item != NULL) {
item->field_0x5[4] = gUnk_0811BE48[param_1].unk0[1];
item->behaviorID = (u8)param_1;
item->field_0x2[1] = (u8)param_2;
item->field_0x5[4] = gUnk_0811BE48[itemId].unk0[1];
item->behaviorID = itemId;
item->field_0x2[1] = param_2;
}
}
}
}
END_NONMATCH
bool32 sub_080778CC(void) {
ItemBehavior* item;
@@ -246,9 +246,9 @@ bool32 sub_080778CC(void) {
(((sub_080789A8() != 0 || ((gPlayerState.field_0x90 & 0xf03) == 0)))))) {
return FALSE;
}
item = sub_0807794C(0x1b);
item = sub_0807794C(ITEM_TRAP);
if (item != NULL) {
item->behaviorID = 0x1b;
item->behaviorID = ITEM_TRAP;
item->field_0x5[4] = gUnk_0811BE48[0].unk0[0x145];
return TRUE;
} else {
@@ -256,16 +256,16 @@ bool32 sub_080778CC(void) {
}
}
ItemBehavior* sub_0807794C(u32 param_1) {
if (((((gPlayerState.queued_action == PLAYER_ROLL) && (param_1 != 0x1b)) ||
(((gPlayerState.flags & (PL_ROLLING | PL_CLONING)) != 0 && (6 < param_1)))) ||
((((gPlayerState.jump_status != 0 || (gPlayerEntity.z.WORD != 0)) && (6 < param_1)) ||
(((gPlayerState.flags & PL_MINISH) != 0 && (gUnk_0811BE48[param_1].unk6[2] == 0)))))) ||
((gPlayerState.floor_type == SURFACE_SWAMP && ((gPlayerState.field_0x37 != 0 && (1 < param_1 - 0x14)))))) {
ItemBehavior* sub_0807794C(Item itemId) {
if (((((gPlayerState.queued_action == PLAYER_ROLL) && (itemId != ITEM_TRAP)) ||
(((gPlayerState.flags & (PL_ROLLING | PL_CLONING)) != 0 && (ITEM_FOURSWORD < itemId)))) ||
((((gPlayerState.jump_status != 0 || (gPlayerEntity.z.WORD != 0)) && (ITEM_FOURSWORD < itemId)) ||
(((gPlayerState.flags & PL_MINISH) != 0 && (gUnk_0811BE48[itemId].unk6[2] == 0)))))) ||
((gPlayerState.floor_type == SURFACE_SWAMP && ((gPlayerState.field_0x37 != 0 && (1 < itemId - 0x14)))))) {
return NULL;
} else {
u32 tmp = gUnk_0811BE48[param_1].unk0[2];
return gUnk_0811BFC8[tmp](param_1);
u32 tmp = gUnk_0811BE48[itemId].unk0[2];
return gUnk_0811BFC8[tmp](itemId);
}
}
-1
View File
@@ -5,7 +5,6 @@
#include "object.h"
extern u32 sub_080B1AE0(u16, u8);
extern Entity* LoadRoomEntity(EntityData*);
extern void (*const RemovableDust_Functions[])(Entity*);
extern const u16 gUnk_08129FD0[];
+18 -22
View File
@@ -51,32 +51,29 @@ void V1EyeLaser_Action2(Entity* this) {
}
}
NONMATCH("asm/non_matching/v1EyeLaser/sub_080AB758.inc", void sub_080AB758(Entity* this)) {
void sub_080AB758(Entity* this) {
s32 r6 = 6;
u32 r7 = 0;
u32 index = 0;
if (((u32)this->y.HALF.HI) <= (u16)(gRoomControls.origin_y + 0xd4)) {
u32 tmp = 7;
do {
if ((index & tmp) == 7) {
sub_080AB844(this, 4, r6);
r6 += 0x3e;
r7 += 0x3e;
}
index = (index + 1) & tmp;
} while (this->y.HALF.HI + r7 + (index << 3) <= (u16)(gRoomControls.origin_y + 0xd4));
u32 tmp = this->y.HALF.HI + r7 + (index << 3);
for (; tmp <= (u16)(gRoomControls.origin_y + 0xd4);
index = (index + 1) & 7, tmp = this->y.HALF.HI + r7 + (index << 3)) {
if ((index & 7) == 7) {
sub_080AB844(this, 4, r6);
r6 += 0x3e;
r7 += 0x3e;
}
}
index = 0;
if (this->y.HALF.HI + r7 <= (u16)(gRoomControls.origin_y + 0xd4)) {
u32 tmp = 3;
do {
if ((index & tmp) == 3) {
sub_080AB844(this, 3, r6);
r6 += 0x1e;
r7 += 0x1e;
}
index = (index + 1) & tmp;
} while (this->y.HALF.HI + r7 + (index << 3) <= (u16)(gRoomControls.origin_y + 0xd4));
tmp = this->y.HALF.HI + r7 + (index << 3);
for (; tmp <= (u16)(gRoomControls.origin_y + 0xd4);
index = (index + 1) & 3, tmp = this->y.HALF.HI + r7 + (index << 3)) {
if ((index & 3) == 3) {
sub_080AB844(this, 3, r6);
r6 += 0x1e;
r7 += 0x1e;
}
}
if (index & 0x2) {
@@ -89,7 +86,6 @@ NONMATCH("asm/non_matching/v1EyeLaser/sub_080AB758.inc", void sub_080AB758(Entit
sub_080AB844(this, 6, r6);
}
END_NONMATCH
void sub_080AB844(Entity* this, s32 param_1, s32 param_2) {
Entity* entity;
+21 -21
View File
@@ -10,7 +10,7 @@
static void sub_0804B058(EntityData* dat);
extern void sub_0801AC98(void);
extern u32 sub_08049D1C(u32);
extern Entity* LoadRoomEntity(EntityData*);
extern Entity* LoadRoomEntity(const EntityData*);
extern void* GetRoomProperty(u32, u32, u32);
extern void** gCurrentRoomProperties;
@@ -22,8 +22,8 @@ extern void sub_0804B16C(void);
extern void ClearSmallChests(void);
extern Entity* GetEmptyEntityByKind(u32 kind);
void RegisterRoomEntity(Entity*, EntityData*);
void sub_0804AF0C(Entity*, EntityData*);
void RegisterRoomEntity(Entity*, const EntityData*);
void sub_0804AF0C(Entity*, const EntityData*);
void sub_0804AFB0(void** properties);
void sub_08054524(void);
@@ -39,7 +39,7 @@ static void LoadDestructibleTile(TileEntity*);
static void LoadGrassDropTile(TileEntity*);
static void LoadLocationTile(TileEntity*);
void LoadRoomEntityList(EntityData* listPtr) {
void LoadRoomEntityList(const EntityData* listPtr) {
if (listPtr != NULL) {
while (listPtr->kind != 0xFF) {
LoadRoomEntity(listPtr++);
@@ -47,7 +47,7 @@ void LoadRoomEntityList(EntityData* listPtr) {
}
}
NONMATCH("asm/non_matching/LoadRoomEntity.inc", Entity* LoadRoomEntity(EntityData* dat)) {
NONMATCH("asm/non_matching/LoadRoomEntity.inc", Entity* LoadRoomEntity(const EntityData* dat)) {
int kind;
Entity* v4;
Entity* v5;
@@ -86,7 +86,7 @@ NONMATCH("asm/non_matching/LoadRoomEntity.inc", Entity* LoadRoomEntity(EntityDat
}
END_NONMATCH
void RegisterRoomEntity(Entity* ent, EntityData* dat) {
void RegisterRoomEntity(Entity* ent, const EntityData* dat) {
u32 list;
u32 kind;
void* offset;
@@ -108,7 +108,7 @@ void RegisterRoomEntity(Entity* ent, EntityData* dat) {
MemCopy(dat, offset, sizeof(EntityData));
}
void sub_0804AF0C(Entity* ent, EntityData* dat) {
void sub_0804AF0C(Entity* ent, const EntityData* dat) {
switch (dat->flags & 0xf0) {
case 0x0:
ent->x.HALF.HI = dat->xPos + gRoomControls.origin_x;
@@ -251,8 +251,8 @@ void* GetCurrentRoomProperty(u32 idx) {
void sub_0804B16C(void) {
TileEntity* tile = gSmallChests;
do {
if (tile->_4 != 0 && CheckLocalFlag(tile->_1)) {
SetTileType(0x74, tile->_4, tile->_6 & 1 ? 2 : 1);
if (tile->tilePos != 0 && CheckLocalFlag(tile->localFlag)) {
SetTileType(0x74, tile->tilePos, tile->_6 & 1 ? 2 : 1);
}
} while (++tile < gSmallChests + 8);
}
@@ -297,28 +297,28 @@ void LoadRoomTileEntities(TileEntity* list) {
}
static void LoadGrassDropTile(TileEntity* tile) {
MemCopy(&gAreaDroptables[tile->_1], &gRoomVars.currentAreaDroptable, 0x20);
MemCopy(&gAreaDroptables[tile->localFlag], &gRoomVars.currentAreaDroptable, 0x20);
}
static void LoadLocationTile(TileEntity* tile) {
gArea.locationIndex = tile->_1;
gArea.locationIndex = tile->localFlag;
sub_08054524();
}
static void LoadRoomVisitTile(TileEntity* tile) {
SetLocalFlag(tile->_1);
SetLocalFlag(tile->localFlag);
}
static void LoadSmallChestTile(TileEntity* tile) {
TileEntity* t = gSmallChests;
u32 i = 0;
for (i = 0; i < 8; ++i, ++t) {
if (!t->_4) {
if (!t->tilePos) {
MemCopy(tile, t, sizeof(TileEntity));
if ((t->_6 & 1) && (gRoomControls.scroll_flags & 2) && !CheckLocalFlag(t->_1)) {
Entity* e = CreateObject(OBJECT_52, t->_1, 0);
if ((t->_6 & 1) && (gRoomControls.scroll_flags & 2) && !CheckLocalFlag(t->localFlag)) {
Entity* e = CreateObject(OBJECT_52, t->localFlag, 0);
if (e != NULL) {
sub_0806F704(e, t->_4);
sub_0806F704(e, t->tilePos);
}
}
return;
@@ -331,10 +331,10 @@ static void LoadBombableWallTile(TileEntity* tile) {
if (mgr != NULL) {
mgr->manager.type = 9;
mgr->manager.subtype = 0x24;
mgr->x = tile->_4;
mgr->x = tile->tilePos;
mgr->y = *(u16*)&tile->_6;
mgr->field_0x35 = tile->_2;
mgr->field_0x3e = tile->_1;
mgr->field_0x3e = tile->localFlag;
AppendEntityToList((Entity*)mgr, 6);
}
}
@@ -345,7 +345,7 @@ static void LoadDarknessTile(TileEntity* tile) {
static void LoadDestructibleTile(TileEntity* tile) {
if (CheckLocalFlag(*(u16*)&tile->_2)) {
SetTileType(*(u16*)&tile->_6, tile->_4, tile->_1);
SetTileType(*(u16*)&tile->_6, tile->tilePos, tile->localFlag);
} else if (!gRoomVars.filler_0x1) {
Manager* mgr;
gRoomVars.filler_0x1 = 1;
@@ -369,6 +369,6 @@ void sub_0804B388(u32 a1, u32 a2) {
sub_080526F8(-1);
}
void sub_0804B3C4(void* arg0) {
LoadSmallChestTile(arg0);
void sub_0804B3C4(TileEntity* tile) {
LoadSmallChestTile(tile);
}
+3 -6
View File
@@ -4633,10 +4633,7 @@ u32 sub_unk3_SimonsSimulation_Main(void) {
extern u8* gUnk_080F0D58[4];
extern Entity* gUnk_080F0CB8[15];
extern u8* gUnk_080F0E08[];
extern struct {
u32 unk_00;
u32 unk_04;
} gUnk_080F0E1C[];
extern TileEntity gUnk_080F0E1C[];
void sub_StateChange_SimonsSimulation_Main(void) {
u32 r;
@@ -5356,7 +5353,7 @@ extern EntityData gUnk_080F5788;
void sub_StateChange_HouseInteriors3_StockwellShop(void) {
LoadRoomEntityList(&gUnk_080F5758);
if (!GetInventoryValue(ITEM_QST_DOGFOOD) && CheckLocalFlagByBank(0x200, 0x8f)) {
if (!GetInventoryValue(ITEM_QST_DOGFOOD) && CheckLocalFlagByBank(FLAG_BANK_2, 0x8f)) {
LoadRoomEntityList(&gUnk_080F57E8);
}
if (!CheckLocalFlag(0x55)) {
@@ -5549,7 +5546,7 @@ extern EntityData gUnk_080F66AC;
void sub_StateChange_WindTribeTowerRoof_Main(void) {
sub_0805B4D0(5);
if (CheckGlobalFlag(LV5_CLEAR) && !CheckLocalFlagByBank(0x100, 5)) {
if (CheckGlobalFlag(LV5_CLEAR) && !CheckLocalFlagByBank(FLAG_BANK_1, 5)) {
LoadRoomEntityList(&gUnk_080F66AC);
}
SetWorldMapPos(8, 0, 0x1e8, 0x158);
+2 -10
View File
@@ -69,7 +69,6 @@ extern const EntityData gUnk_080FF264[];
extern void (*const gUnk_080FF28C[])(void);
extern Entity* LoadRoomEntity(EntityData*);
extern void sub_08054A14(u32);
extern const EntityData gUnk_080FEE48[];
@@ -90,13 +89,6 @@ extern void (*const gUnk_080FF330[])(void);
void sub_08055994(void);
typedef struct {
u8 unk_0[6];
u8 unk_6;
u8 unk_7;
} struct_080FEAC8;
extern struct_080FEAC8 gUnk_080FEAC8[];
extern void (*const gUnk_080FF35C[])(void);
extern const EntityData gUnk_080FF33C[];
@@ -676,8 +668,8 @@ void sub_08055978(void) {
void sub_08055994(void) {
u32 layer;
struct_080FEAC8* ptr = &gUnk_080FEAC8[gMenu.field_0x4];
if ((ptr->unk_6 & 1) != 0) {
TileEntity* ptr = &gUnk_080FEAC8[gMenu.field_0x4];
if ((ptr->_6 & 1) != 0) {
layer = 2;
} else {
layer = 1;
+1 -1
View File
@@ -765,7 +765,7 @@ void sub_080A5D1C(void) {
bool32 sub_080A5F24(void) {
bool32 result = TRUE;
if ((gArea.dungeon_idx == 6) && CheckLocalFlagByBank(0x8c0, 0x7b)) {
if ((gArea.dungeon_idx == 6) && CheckLocalFlagByBank(FLAG_BANK_10, 0x7b)) {
result = 0;
}
return result;